From 2851a328c5c96edd6370a7db197c9ccf4a1be9c5 Mon Sep 17 00:00:00 2001 From: Rex Date: Sat, 19 Oct 2024 14:17:21 +0800 Subject: [PATCH] export plugins --- dist/rexcanvasinputplugin.js | 109 +++- dist/rexcanvasinputplugin.min.js | 2 +- dist/rexcolorcomponents.js | 109 +++- dist/rexcolorcomponents.min.js | 4 +- dist/rexcolorinput.js | 109 +++- dist/rexcolorinput.min.js | 4 +- dist/rexconfirmdialog.js | 46 +- dist/rexconfirmdialog.min.js | 2 +- dist/rexdropdownlist.js | 46 +- dist/rexdropdownlist.min.js | 2 +- dist/rexdynamictext.js | 46 +- dist/rexdynamictext.min.js | 2 +- dist/rexdynamictextplugin.js | 46 +- dist/rexdynamictextplugin.min.js | 2 +- dist/rexfileselectorbutton.js | 46 +- dist/rexfileselectorbutton.min.js | 2 +- dist/rexgameobjectshellplugin.js | 109 +++- dist/rexgameobjectshellplugin.min.js | 4 +- dist/rexlabel.js | 46 +- dist/rexlabel.min.js | 2 +- dist/rexmdscenario.js | 109 +++- dist/rexmdscenario.min.js | 8 +- dist/rexmdscenarioplugin.js | 109 +++- dist/rexmdscenarioplugin.min.js | 4 +- dist/rexnameinputdialog.js | 109 +++- dist/rexnameinputdialog.min.js | 4 +- dist/rexsimpledropdownlist.js | 46 +- dist/rexsimpledropdownlist.min.js | 2 +- dist/rexsimplelabel.js | 46 +- dist/rexsimplelabel.min.js | 2 +- dist/rextextareainput.js | 109 +++- dist/rextextareainput.min.js | 2 +- dist/rextextbox.js | 46 +- dist/rextextbox.min.js | 2 +- dist/rextextplayer.js | 46 +- dist/rextextplayer.min.js | 2 +- dist/rextextplayerplugin.js | 46 +- dist/rextextplayerplugin.min.js | 2 +- dist/rextitlelabel.js | 46 +- dist/rextitlelabel.min.js | 2 +- dist/rextoast.js | 46 +- dist/rextoast.min.js | 2 +- dist/rextrees.js | 46 +- dist/rextrees.min.js | 4 +- dist/rextweaker.js | 109 +++- dist/rextweaker.min.js | 4 +- dist/rexuiplugin.js | 109 +++- dist/rexuiplugin.min.js | 6 +- docs/site/canvasinput/index.html | 70 +++ docs/site/search/search_index.json | 2 +- docs/site/sitemap.xml | 816 +++++++++++++-------------- docs/site/sitemap.xml.gz | Bin 2831 -> 2831 bytes 52 files changed, 1921 insertions(+), 773 deletions(-) diff --git a/dist/rexcanvasinputplugin.js b/dist/rexcanvasinputplugin.js index e836f829ba..5dc544fa31 100644 --- a/dist/rexcanvasinputplugin.js +++ b/dist/rexcanvasinputplugin.js @@ -2064,6 +2064,8 @@ this.setBackgroundColor(GetValue$a(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$a(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$a(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$a(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$a(o, 'backgroundRightX', 0)); return this; } @@ -2134,6 +2136,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -2288,6 +2296,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -2715,20 +2733,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -5915,7 +5937,7 @@ var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -6568,6 +6590,33 @@ }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -7216,6 +7265,7 @@ var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -7243,19 +7293,41 @@ } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -7450,6 +7522,11 @@ return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rexcanvasinputplugin.min.js b/dist/rexcanvasinputplugin.min.js index 05a8339894..03a290ea06 100644 --- a/dist/rexcanvasinputplugin.min.js +++ b/dist/rexcanvasinputplugin.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.Renderer.WebGL.Utils;var e={renderWebGL:function(e,i,s,r){if(i.dirty&&(i.updateTexture(),i.dirty=!1),0!==i.width&&0!==i.height){s.addToRenderList(i);var n=i.frame,h=n.width,o=n.height,a=t.getTintAppendFloatAlpha,l=e.pipelines.set(i.pipeline,i),d=l.setTexture2D(n.glTexture,i);e.pipelines.preBatch(i),l.batchTexture(i,n.glTexture,h,o,i.x,i.y,h/i.resolution,o/i.resolution,i.scaleX,i.scaleY,i.rotation,i.flipX,i.flipY,i.scrollFactorX,i.scrollFactorY,i.displayOriginX,i.displayOriginY,0,0,h,o,a(i.tintTopLeft,s.alpha*i._alphaTL),a(i.tintTopRight,s.alpha*i._alphaTR),a(i.tintBottomLeft,s.alpha*i._alphaBL),a(i.tintBottomRight,s.alpha*i._alphaBR),i.tintFill,0,0,s,r,!1,d),e.pipelines.postBatch(i)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const i=Phaser.Display.Color;var s,r={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,o,a,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var u=d.cutWidth,c=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=u),void 0===n&&(n=c),void 0===h&&(h=0),void 0===o&&(o=0),void 0===a&&(a=u),void 0===l&&(l=c);var p=d.cutX+h,g=d.cutY+o;return this.context.drawImage(d.source.image,p,g,a,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,s){void 0===s&&(s=new i);var r=this.context.getImageData(t,e,1,1);return s.setTo(r.data[0],r.data[1],r.data[2],r.data[3]),s},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},n={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var o,a=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(o=a.exists(i)?a.get(i):a.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var u=d.getContext("2d",{willReadFrequently:!0});u.clearRect(0,0,n,h),u.drawImage(e,s,r,n,h),l.gl&&o&&l.canvasToTexture(d,o.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}},h=!1;h||(void 0===s&&(s=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(W.prototype,Y);const B=Phaser.Utils.String.Pad;var M=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${B(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},D=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const F=Phaser.Utils.Objects.GetValue;class H{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=F(t,"x",0),i=F(t,"y",0));var s=this.cornerRadius;s.tl=j(F(t,"tl",void 0),e,i),s.tr=j(F(t,"tr",void 0),e,i),s.bl=j(F(t,"bl",void 0),e,i),s.br=j(F(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){z(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){z(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){z(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){z(this.cornerRadius.br,t)}}var j=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),I(t),t},z=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=F(e,"x",0),t.y=F(e,"y",0)),I(t)},I=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const G=Phaser.Math.DegToRad;var U=function(t){return!t.hasOwnProperty("convex")||t.convex},V=function(t){return t.x>0&&t.y>0},N=function(t,e,i,s,r,n,h,o,a){if(o&&h>n?h-=360:!o&&h=p?1:s/p,v=r>=g?1:r/g,x=c.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=x.tl,V(o)?(a=o.x*f,l=o.y*v,U(o)?N(t,a,l,a,l,180,270,!1,h):N(t,0,0,a,l,90,0,!0,h),d=0,u=l):(t.lineTo(0,0),d=0,u=0),o=x.tr,V(o)?(a=o.x*f,l=o.y*v,U(o)?N(t,s-a,l,a,l,270,360,!1,h):N(t,s,0,a,l,180,90,!0,h)):t.lineTo(s,0),o=x.br,V(o)?(a=o.x*f,l=o.y*v,U(o)?N(t,s-a,r-l,a,l,0,90,!1,h):N(t,s,r,a,l,270,180,!0,h)):t.lineTo(s,r),o=x.bl,V(o)?(a=o.x*f,l=o.y*v,U(o)?N(t,a,r-l,a,l,90,180,!1,h):N(t,0,r,a,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,u),t.closePath(),t.restore()}(e,i,s,r,n,h,c),null!=o)&&(null!=d&&((p=u?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke())};const q=Phaser.Utils.Objects.GetValue;class J extends W{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(q(e,"color",null),q(e,"color2",null),q(e,"horizontalGradient",!0)),this.setStroke(q(e,"stroke",null),q(e,"strokeThickness",2)),this.setCornerRadius(q(e,"cornerRadius",0),q(e,"cornerIteration",null))}set color(t){t=M(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=M(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=M(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,D("color2",t,this),D("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,D("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,D("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;a=Math.max(1,a-s),l=Math.max(1,l-s),$(t.canvas,t.context,d,d,a,l,r,e,i,s,n,h,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const K=Phaser.Utils.Objects.GetValue;class Z extends W{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(K(e,"color",null),K(e,"color2",null),K(e,"horizontalGradient",!0)),this.setStroke(K(e,"stroke",null),K(e,"strokeThickness",2))}set color(t){t=M(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=M(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=M(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,K(t,"color2",null),K(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,K(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,h))}}const Q=Phaser.Utils.Objects.GetValue;class tt{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Q(t,"bold",!1)),this.setItalic(Q(t,"italic",!1)),this.setFontSize(Q(t,"fontSize","16px")),this.setFontFamily(Q(t,"fontFamily","Courier")),this.setColor(Q(t,"color","#fff")),this.setStrokeStyle(Q(t,"stroke",null),Q(t,"strokeThickness",0)),this.setShadow(Q(t,"shadowColor",null),Q(t,"shadowOffsetX",0),Q(t,"shadowOffsetY",0),Q(t,"shadowBlur",0)),this.setOffset(Q(t,"offsetX",0),Q(t,"offsetY",0)),this.setSpace(Q(t,"leftSpace",0),Q(t,"rightSpace",0)),this.setAlign(Q(t,"align",void 0)),this.setBackgroundColor(Q(t,"backgroundColor",null)),this.setBackgroundHeight(Q(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Q(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(D("stroke",t,this),D("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(D("shadowOffsetX",t,this),D("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tt(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=M(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=M(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=M(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=M(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const et=Phaser.Utils.Array.Remove,it=Phaser.Utils.Array.Remove,st="text",rt="image",nt="drawer",ht="space",ot="command";var at=function(t){return t.type===st&&"\n"===t.text},lt=function(t){return t.type===st&&"\f"===t.text},dt=function(t){return t.type===st};class ut extends W{constructor(t,e,i){super(t,st),this.updateTextFlag=!1,this.style=new tt(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var o=e.hasFill,a=e.hasStroke;(o||a)&&(e.syncFont(t).syncStyle(t),a&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ct=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const pt=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class gt extends W{constructor(t,e,i){super(t,rt),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var a=e.getContext("2d",{willReadFrequently:!0});if(h){var l=pt.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),a.drawImage(l,0,0,r,n,i,s,r,n),pt.remove(l)}else a.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class ft extends W{constructor(t,e,i,s){super(t,nt),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class vt extends W{constructor(t,e){super(t,ht),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class xt extends f{constructor(t,e,i,s,r){super(t,ot),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function yt(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>yt(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=yt(t[i]));return e}var mt=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const wt={none:0,word:1,char:2,character:2,mix:3};var Ct=/^[\x00-\x7F]+$/,bt=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,h=3===i,o=!n&&!h,a=t.length,l=e,d=s.word,u=0,c=!1;l0&&!o){var a=this.fixedHeight-s;i>0?n=a/i:(n=(l=Tt.call(this)).height,h=l.ascent,i=Math.floor((a-h)/n))}else{var l;n=(l=Tt.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_t(t,"maxLines"))&&(a=this.fixedHeight-s,i=Math.floor(a/n)):i=_t(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,u=_t(t,"wrapMode");void 0===u&&(u=_t(t,"charWrap",!1)?"char":"word"),"string"==typeof u&&(u=wt[u]);var c=_t(t,"wrapWidth",void 0);void 0===c&&(this.fixedWidth>0?c=this.fixedWidth-r:(c=1/0,u=0));for(var g=_t(t,"letterSpacing",0),f=_t(t,"hAlign",0),v=_t(t,"vAlign",0),x=_t(t,"justifyPercentage",.25),y=mt({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:g,maxLines:i,hAlign:f,vAlign:v,justifyPercentage:x,ascent:h,lineHeight:n,wrapWidth:c,wrapMode:u}),m=this.children,w=0,C=m.length;w0&&(E.push({children:Y,width:X}),R=Math.max(R,X)),y.start+=L.length,y.isLastPage=!A&&y.start===_,y.maxLineWidth=R,y.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:y.maxLineWidth+r,z=this.fixedHeight>0?this.fixedHeight:y.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,o=t.justifyPercentage,a=t.lines,l=0,d=a.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Yt(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Yt(t,"maxLines",0);var o=0===i,a=Yt(t,"fixedCharacterHeight",void 0);if(void 0===a){var l=Yt(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;a=Math.floor(d/l)}}var u=Yt(t,"wrapHeight",void 0);void 0===u&&(u=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var c=Yt(t,"letterSpacing",0),g=Yt(t,"rtl",!0),f=Yt(t,"hAlign",g?2:0),v=Yt(t,"vAlign",0),x=mt({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:c,maxLines:i,hAlign:f,vAlign:v,lineWidth:n,fixedCharacterHeight:a,wrapHeight:u,rtl:g}),y=this.children,m=0,w=y.length;m0&&(L.push({children:E,height:Y}),X=Math.max(X,Y)),x.start+=_.length,x.isLastPage=x.start===P,x.maxLineHeight=X,x.linesWidth=L.length*n;var D=this.fixedWidth>0?this.fixedWidth:x.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:x.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,o=t.rtl,a=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var u=0,c=a.length;u0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return p(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),et(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return it(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(st);return null===i?i=new ut(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),E(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ie=Phaser.Utils.Objects.GetFastValue;var se={};class re{constructor(t){this.pools=ie(t,"pools",se)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ee),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0)return me.length=0,!0;return me.length=0,!1},me=[],we=void 0;const Ce=Phaser.Utils.Objects.GetValue;var be=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=Ce(e,n,s[1]))&&(i[s[0]]=r);return i},Se=function(t){t.stopPropagation()},Oe=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this};const ke=Phaser.Utils.Array,Te=function(t){var e;return t.parentContainer?-1===(e=t.parentContainer.list).indexOf(this)&&t.parentContainer.add(this):t.displayList&&-1===(e=t.displayList.list).indexOf(this)&&t.displayList.add(this),e?(ke.MoveBelow(e,this,t),this):this},Pe=function(t){var e;return t.parentContainer?-1===(e=t.parentContainer.list).indexOf(this)&&(t.isRexContainerLite?t.addToContainer(t.parentContainer):t.parentContainer.add(t)):t.displayList&&-1===(e=t.displayList.list).indexOf(this)&&(t.isRexContainerLite?t.addToLayer(t.displayList):t.displayList.add(t)),e?(ke.MoveAbove(e,this,t),this):this};var _e=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",Oe,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(Pe.call(this.clickOutSideTarget,this.parent),Te.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},Le=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",Oe,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const Ee=Phaser.Utils.Objects.GetValue;var Ye=function(t,e){var i,s=Ee(e,"inputType",void 0);void 0===s&&(s=Ee(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=Ee(e,"style",void 0),n=i.style;be(ve,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",be(fe,e,i),function(t){t.addEventListener("touchstart",Se,!1),t.addEventListener("touchmove",Se,!1),t.addEventListener("touchend",Se,!1),t.addEventListener("mousedown",Se,!1),t.addEventListener("mouseup",Se,!1),t.addEventListener("mousemove",Se,!1)}(i);var h=t.scene.sys.scale;return(h.isFullscreen?h.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){_e.call(t)})),i.addEventListener("blur",(function(e){Le.call(t)})),i},Xe={open:function(){return this.isOpened||this.readOnly||((t=this)!==we&&(void 0!==we&&we.close(),we=t),this.node||(this.node=Ye(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===we&&(we=void 0),this.setBlur(),this):this}};const Re=Phaser.Utils.Objects.GetValue;class Ae extends ge{constructor(t,e){super(t);var i=Re(e,"inputType",void 0);void 0===i&&(i=Re(e,"type","text")),this.setEnterCloseEnable(Re(e,"enterClose","textarea"!==i));var s=Re(e,"onOpen",void 0);s||(s=Re(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=Re(e,"clickOutSideTarget",void 0);var r=Re(e,"onClose",void 0);r||(r=Re(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=Re(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return xe(t,e,"inputType"),xe(t,e,"type"),xe(t,e,"style"),xe(t,e,ve),xe(t,e,fe),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){(function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!ye(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,o=n.pointers,a=0;a=r&&a=i&&ai.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,o=t.drawY,a=h+t.drawTLX,l=h+t.drawTRX,d=o+t.drawTLY,u=o+t.drawBLY;e=a<0?0-a:l>r?r-l:0,i=d<0?0-d:u>n?n-u:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Be(this),Me(this)),this}setNumberInput(){return this.onUpdateCallback=We,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const He=Phaser.Utils.Objects.GetValue,je=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var ze=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,o=r/2,a=n/2,l=r*h,d=n*h;e.x===o&&e.y===a||e.setPosition(o,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const qe=Phaser.GameObjects.Zone;class Je extends qe{constructor(t){super(t,0,0,2,2),this.fullWindow=new $e(this)}}var Ke=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Ze=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},Qe=function(t){for(var e in t)return!1;return!0},ti=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(o,o+h.count));o+=h.count,h.added||(a+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}ri.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,a=1,l=h+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],u=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&u+1>=o)return n([{value:this.join(e),count:e.length}]);function c(){for(let s=-1*a;s<=a;s+=2){let a,l=d[s-1],u=d[s+1],c=(u?u.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&c+1>=o)return n(ni(r,a.components,e,t,r.useLongestToken));d[s]=a}else d[s]=void 0}var i;a++}if(s)!function t(){setTimeout((function(){if(a>l)return s();c()||t()}),0)}();else for(;a<=l;){let t=c();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,o=h-s,a=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const hi=new ri,oi=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,ai=/\S/,li=new ri;li.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ai.test(t)&&!ai.test(e)},li.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(pi(t,null,null,i),i," ")},ci.equals=function(t,e){return ri.prototype.equals.call(ci,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const gi=new ri;gi.tokenize=function(t){return t.slice()},gi.join=gi.removeEmpty=function(t){return t};const fi=Phaser.Utils.Array.Remove;var vi=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),fi(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(a=i,l=e,hi.diff(a,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Ci={cursorMoveLeft(){if(!this.isOpened)return this;var t=yi(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=yi(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=mi(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=yi(wi(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=mi(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=yi(wi(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const bi=Phaser.Utils.Objects.IsPlainObject;class Si extends oe{constructor(t,e,i,s,r,n){bi(e)?n=e:bi(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(ze(e,"wrap.vAlign")||Ge(e,"wrap.vAlign",s=i?"center":"top"),ze(e,"wrap.wrapMode")||Ge(e,"wrap.wrapMode","char"),ze(e,"wrap.maxLines")||Ge(e,"wrap.maxLines",s=i?1:void 0),i&&Ge(e,"wrap.wrapWidth",1/0),ze(e,"wrap.useDefaultTextHeight")||Ge(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!ze(e.edit,"inputType")){var s=i?"text":"textarea";Ge(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Je(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var o=Ke(n.background,"focus"),a=Ke(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=He(e,"edit");return void 0===i&&(i={}),xe(e,i,je),new Fe(t,i)}(this,n),Ze.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),si.call(this,o),n.cursorStyle&&Object.assign(a,n.cursorStyle),ii.call(this,a);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var u=n.onCursorIn;u&&this.on("cursorin",u);var c,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((c=this.createCharChild("|")).text="",c),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(W.prototype,E);const B=Phaser.Utils.String.Pad;var M=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${B(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},D=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const F=Phaser.Utils.Objects.GetValue;class H{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=F(t,"x",0),i=F(t,"y",0));var s=this.cornerRadius;s.tl=j(F(t,"tl",void 0),e,i),s.tr=j(F(t,"tr",void 0),e,i),s.bl=j(F(t,"bl",void 0),e,i),s.br=j(F(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){z(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){z(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){z(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){z(this.cornerRadius.br,t)}}var j=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),I(t),t},z=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=F(e,"x",0),t.y=F(e,"y",0)),I(t)},I=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const G=Phaser.Math.DegToRad;var U=function(t){return!t.hasOwnProperty("convex")||t.convex},V=function(t){return t.x>0&&t.y>0},N=function(t,e,i,s,r,n,h,o,a){if(o&&h>n?h-=360:!o&&h=g?1:s/g,v=r>=p?1:r/p,y=c.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=y.tl,V(o)?(a=o.x*f,l=o.y*v,U(o)?N(t,a,l,a,l,180,270,!1,h):N(t,0,0,a,l,90,0,!0,h),d=0,u=l):(t.lineTo(0,0),d=0,u=0),o=y.tr,V(o)?(a=o.x*f,l=o.y*v,U(o)?N(t,s-a,l,a,l,270,360,!1,h):N(t,s,0,a,l,180,90,!0,h)):t.lineTo(s,0),o=y.br,V(o)?(a=o.x*f,l=o.y*v,U(o)?N(t,s-a,r-l,a,l,0,90,!1,h):N(t,s,r,a,l,270,180,!0,h)):t.lineTo(s,r),o=y.bl,V(o)?(a=o.x*f,l=o.y*v,U(o)?N(t,a,r-l,a,l,90,180,!1,h):N(t,0,r,a,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,u),t.closePath(),t.restore()}(e,i,s,r,n,h,c),null!=o)&&(null!=d&&((g=u?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),g.addColorStop(1,d),o=g),e.fillStyle=o,e.fill());null!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke())};const q=Phaser.Utils.Objects.GetValue;class J extends W{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(q(e,"color",null),q(e,"color2",null),q(e,"horizontalGradient",!0)),this.setStroke(q(e,"stroke",null),q(e,"strokeThickness",2)),this.setCornerRadius(q(e,"cornerRadius",0),q(e,"cornerIteration",null))}set color(t){t=M(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=M(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=M(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,D("color2",t,this),D("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,D("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,D("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;a=Math.max(1,a-s),l=Math.max(1,l-s),$(t.canvas,t.context,d,d,a,l,r,e,i,s,n,h,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const K=Phaser.Utils.Objects.GetValue;class Z extends W{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(K(e,"color",null),K(e,"color2",null),K(e,"horizontalGradient",!0)),this.setStroke(K(e,"stroke",null),K(e,"strokeThickness",2))}set color(t){t=M(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=M(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=M(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,K(t,"color2",null),K(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,K(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,h))}}const Q=Phaser.Utils.Objects.GetValue;class tt{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Q(t,"bold",!1)),this.setItalic(Q(t,"italic",!1)),this.setFontSize(Q(t,"fontSize","16px")),this.setFontFamily(Q(t,"fontFamily","Courier")),this.setColor(Q(t,"color","#fff")),this.setStrokeStyle(Q(t,"stroke",null),Q(t,"strokeThickness",0)),this.setShadow(Q(t,"shadowColor",null),Q(t,"shadowOffsetX",0),Q(t,"shadowOffsetY",0),Q(t,"shadowBlur",0)),this.setOffset(Q(t,"offsetX",0),Q(t,"offsetY",0)),this.setSpace(Q(t,"leftSpace",0),Q(t,"rightSpace",0)),this.setAlign(Q(t,"align",void 0)),this.setBackgroundColor(Q(t,"backgroundColor",null)),this.setBackgroundHeight(Q(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Q(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Q(t,"backgroundLeftX",0)),this.setBackgroundRightX(Q(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(D("stroke",t,this),D("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(D("shadowOffsetX",t,this),D("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tt(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=M(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=M(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=M(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=M(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const et=Phaser.Utils.Array.Remove,it=Phaser.Utils.Array.Remove,st="text",rt="image",nt="drawer",ht="space",ot="command";var at=function(t){return t.type===st&&"\n"===t.text},lt=function(t){return t.type===st&&"\f"===t.text},dt=function(t){return t.type===st};class ut extends W{constructor(t,e,i){super(t,st),this.updateTextFlag=!1,this.style=new tt(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var o=n-h;t.fillRect(s,o,r,h)}}var a=e.hasFill,l=e.hasStroke;(a||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ct=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const gt=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class pt extends W{constructor(t,e,i){super(t,rt),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var a=e.getContext("2d",{willReadFrequently:!0});if(h){var l=gt.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),a.drawImage(l,0,0,r,n,i,s,r,n),gt.remove(l)}else a.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class ft extends W{constructor(t,e,i,s){super(t,nt),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class vt extends W{constructor(t,e){super(t,ht),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class yt extends f{constructor(t,e,i,s,r){super(t,ot),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function xt(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>xt(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=xt(t[i]));return e}var mt=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const wt={none:0,word:1,char:2,character:2,mix:3};var Ct=/^[\x00-\x7F]+$/,bt=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,h=3===i,o=!n&&!h,a=t.length,l=e,d=s.word,u=0,c=!1;l0&&!o){var a=this.fixedHeight-s;i>0?n=a/i:(n=(l=Pt.call(this)).height,h=l.ascent,i=Math.floor((a-h)/n))}else{var l;n=(l=Pt.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_t(t,"maxLines"))&&(a=this.fixedHeight-s,i=Math.floor(a/n)):i=_t(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,u=_t(t,"wrapMode");void 0===u&&(u=_t(t,"charWrap",!1)?"char":"word"),"string"==typeof u&&(u=wt[u]);var c=_t(t,"wrapWidth",void 0);void 0===c&&(this.fixedWidth>0?c=this.fixedWidth-r:(c=1/0,u=0));for(var p=_t(t,"letterSpacing",0),f=_t(t,"hAlign",0),v=_t(t,"vAlign",0),y=_t(t,"justifyPercentage",.25),x=mt({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:f,vAlign:v,justifyPercentage:y,ascent:h,lineHeight:n,wrapWidth:c,wrapMode:u}),m=this.children,w=0,C=m.length;w0&&(X.push({children:E,width:R}),Y=Math.max(Y,R)),x.start+=L.length,x.isLastPage=!A&&x.start===_,x.maxLineWidth=Y,x.linesHeight=X.length*n;var j=this.fixedWidth>0?this.fixedWidth:x.maxLineWidth+r,z=this.fixedHeight>0?this.fixedHeight:x.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,o=t.justifyPercentage,a=t.lines,l=0,d=a.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Et(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Et(t,"maxLines",0);var o=0===i,a=Et(t,"fixedCharacterHeight",void 0);if(void 0===a){var l=Et(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;a=Math.floor(d/l)}}var u=Et(t,"wrapHeight",void 0);void 0===u&&(u=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var c=Et(t,"letterSpacing",0),p=Et(t,"rtl",!0),f=Et(t,"hAlign",p?2:0),v=Et(t,"vAlign",0),y=mt({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:c,maxLines:i,hAlign:f,vAlign:v,lineWidth:n,fixedCharacterHeight:a,wrapHeight:u,rtl:p}),x=this.children,m=0,w=x.length;m0&&(L.push({children:X,height:E}),R=Math.max(R,E)),y.start+=_.length,y.isLastPage=y.start===T,y.maxLineHeight=R,y.linesWidth=L.length*n;var D=this.fixedWidth>0?this.fixedWidth:y.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:y.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,o=t.rtl,a=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var u=0,c=a.length;u0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return g(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),et(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return it(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(st);return null===i?i=new ut(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),X(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ie=Phaser.Utils.Objects.GetFastValue;var se={};class re{constructor(t){this.pools=ie(t,"pools",se)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ee),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0)return me.length=0,!0;return me.length=0,!1},me=[],we=void 0;const Ce=Phaser.Utils.Objects.GetValue;var be=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=Ce(e,n,s[1]))&&(i[s[0]]=r);return i},Se=function(t){t.stopPropagation()},Oe=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this};const ke=Phaser.Utils.Array,Pe=function(t){var e;return t.parentContainer?-1===(e=t.parentContainer.list).indexOf(this)&&t.parentContainer.add(this):t.displayList&&-1===(e=t.displayList.list).indexOf(this)&&t.displayList.add(this),e?(ke.MoveBelow(e,this,t),this):this},Te=function(t){var e;return t.parentContainer?-1===(e=t.parentContainer.list).indexOf(this)&&(t.isRexContainerLite?t.addToContainer(t.parentContainer):t.parentContainer.add(t)):t.displayList&&-1===(e=t.displayList.list).indexOf(this)&&(t.isRexContainerLite?t.addToLayer(t.displayList):t.displayList.add(t)),e?(ke.MoveAbove(e,this,t),this):this};var _e=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",Oe,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(Te.call(this.clickOutSideTarget,this.parent),Pe.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},Le=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",Oe,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const Xe=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){var i,s=Xe(e,"inputType",void 0);void 0===s&&(s=Xe(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=Xe(e,"style",void 0),n=i.style;be(ve,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",be(fe,e,i),function(t){t.addEventListener("touchstart",Se,!1),t.addEventListener("touchmove",Se,!1),t.addEventListener("touchend",Se,!1),t.addEventListener("mousedown",Se,!1),t.addEventListener("mouseup",Se,!1),t.addEventListener("mousemove",Se,!1)}(i);var h=t.scene.sys.scale;return(h.isFullscreen?h.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){_e.call(t)})),i.addEventListener("blur",(function(e){Le.call(t)})),i},Re={open:function(){return this.isOpened||this.readOnly||((t=this)!==we&&(void 0!==we&&we.close(),we=t),this.node||(this.node=Ee(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===we&&(we=void 0),this.setBlur(),this):this}};const Ye=Phaser.Utils.Objects.GetValue;class Ae extends pe{constructor(t,e){super(t);var i=Ye(e,"inputType",void 0);void 0===i&&(i=Ye(e,"type","text")),this.setEnterCloseEnable(Ye(e,"enterClose","textarea"!==i));var s=Ye(e,"onOpen",void 0);s||(s=Ye(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=Ye(e,"clickOutSideTarget",void 0);var r=Ye(e,"onClose",void 0);r||(r=Ye(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=Ye(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return ye(t,e,"inputType"),ye(t,e,"type"),ye(t,e,"style"),ye(t,e,ve),ye(t,e,fe),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){(function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xe(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,o=n.pointers,a=0;a=r&&a=i&&ai.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,o=t.drawY,a=h+t.drawTLX,l=h+t.drawTRX,d=o+t.drawTLY,u=o+t.drawBLY;e=a<0?0-a:l>r?r-l:0,i=d<0?0-d:u>n?n-u:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Be(this),Me(this)),this}setNumberInput(){return this.onUpdateCallback=We,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const He=Phaser.Utils.Objects.GetValue,je=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var ze=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,o=r/2,a=n/2,l=r*h,d=n*h;e.x===o&&e.y===a||e.setPosition(o,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const qe=Phaser.GameObjects.Zone;class Je extends qe{constructor(t){super(t,0,0,2,2),this.fullWindow=new $e(this)}}var Ke=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Ze=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},Qe=function(t){for(var e in t)return!1;return!0},ti=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(o,o+h.count));o+=h.count,h.added||(a+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}ni.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,a=1,l=h+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],u=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&u+1>=o)return n([{value:this.join(e),count:e.length}]);function c(){for(let s=-1*a;s<=a;s+=2){let a,l=d[s-1],u=d[s+1],c=(u?u.newPos:0)-s;l&&(d[s-1]=void 0);let g=l&&l.newPos+1=h&&c+1>=o)return n(hi(r,a.components,e,t,r.useLongestToken));d[s]=a}else d[s]=void 0}var i;a++}if(s)!function t(){setTimeout((function(){if(a>l)return s();c()||t()}),0)}();else for(;a<=l;){let t=c();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,o=h-s,a=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const oi=new ni,ai=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,li=/\S/,di=new ni;di.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!li.test(t)&&!li.test(e)},di.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(pi(t,null,null,i),i," ")},gi.equals=function(t,e){return ni.prototype.equals.call(gi,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const fi=new ni;fi.tokenize=function(t){return t.slice()},fi.join=fi.removeEmpty=function(t){return t};const vi=Phaser.Utils.Array.Remove;var yi=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),vi(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(a=i,l=e,oi.diff(a,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},bi={cursorMoveLeft(){if(!this.isOpened)return this;var t=mi(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=mi(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=wi(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=mi(Ci(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=wi(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=mi(Ci(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Si=Phaser.Utils.Objects.IsPlainObject;class Oi extends oe{constructor(t,e,i,s,r,n){Si(e)?n=e:Si(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(ze(e,"wrap.vAlign")||Ge(e,"wrap.vAlign",s=i?"center":"top"),ze(e,"wrap.wrapMode")||Ge(e,"wrap.wrapMode","char"),ze(e,"wrap.maxLines")||Ge(e,"wrap.maxLines",s=i?1:void 0),i&&Ge(e,"wrap.wrapWidth",1/0),ze(e,"wrap.useDefaultTextHeight")||Ge(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!ze(e.edit,"inputType")){var s=i?"text":"textarea";Ge(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Je(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var o=Ke(n.background,"focus"),a=Ke(n.style,"cursor"),l=Ke(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=He(e,"edit");return void 0===i&&(i={}),ye(e,i,je),new Fe(t,i)}(this,n),Ze.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),ri.call(this,o),n.cursorStyle&&Object.assign(a,n.cursorStyle),ii.call(this,a),n.rangeStyle&&Object.assign(l,n.rangeStyle),Qe(l)&&Object.assign(l,a),si.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var u=n.onCursorIn;u&&this.on("cursorin",u);var c=n.onCursorOut;c&&this.on("cursorout",c);var g=!n.onRangeIn&&!n.onRangeOut,p=g?n.onCursorIn:n.onRangeIn;p&&this.on("rangein",p);var f=g?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,y=n.onMoveCursor;y&&this.on("movecursor",y),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -33680,7 +33702,7 @@ var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -34087,6 +34109,33 @@ }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -34735,6 +34784,7 @@ var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -34762,19 +34812,41 @@ } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -34969,6 +35041,11 @@ return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rexcolorcomponents.min.js b/dist/rexcolorcomponents.min.js index ee4e51a648..d80a69f641 100644 --- a/dist/rexcolorcomponents.min.js +++ b/dist/rexcolorcomponents.min.js @@ -1,6 +1,6 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},z=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Ds,As,Ys,Xs);const zs=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,Ws);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Ns=Phaser.Utils.Objects.GetValue;class Vs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(Tn.prototype,$e);var _n={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(zn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),Fr.call(t,e),Br.call(t,e),Gr.call(t,e),Vn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,uh,fh,mh,yh,xh,bh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Oh=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Oh(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,Ch);var _h=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Eh={appendText:kh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Mh extends Th{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(_h(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(_h(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&_h(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&_h(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Mh.prototype,Eh);var Rh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Lh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Dh=Phaser.GameObjects.Graphics;class Ah extends Dh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Yh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ge(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ge(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Lh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Rh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Rh.call(this,this.width,this.height,this.padding,t,e)),this}}const Yh={rectangle:0,circle:1};var Xh=function(t,e,i,s){var r=new Ah(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Wh=Phaser.GameObjects.Text;var zh=function(t){return t instanceof Wh};const Fh=Phaser.GameObjects.BitmapText;var jh=function(t){return t instanceof Fh},Ih=function(t){return jh(t)?2:zh(t)?0:1},Bh=/^[\x00-\x7F]+$/,Hh=function(t){return Bh.test(t)},Nh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Gh=0,Uh=1,$h=2,Jh=0,Kh=1,qh=2,Zh=/(?:\r\n|\r|\n)/;const Qh={none:Jh,word:Kh,char:qh,character:qh,mix:3},ta=Phaser.Renderer.WebGL.Utils;var ea={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ta.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ia=Phaser.Display.Color;var sa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ia);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ra=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},na={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,ra(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ha=Phaser.Display.Canvas.CanvasPool,aa=Phaser.GameObjects.GameObject,oa=Phaser.Utils.String.UUID;class la extends aa{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ha.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=oa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ha.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const da=Phaser.GameObjects.Components;Phaser.Class.mixin(la,[da.Alpha,da.BlendMode,da.Crop,da.Depth,da.Flip,da.GetBounds,da.Mask,da.Origin,da.Pipeline,da.PostPipeline,da.ScrollFactor,da.Tint,da.Transform,da.Visible,ea,sa,na]);var ca={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ua{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ua.prototype,ca);var pa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const va=Phaser.Math.RotateAround;var ga;const fa=Phaser.Geom.Rectangle;var ma,ya=function(t){void 0===ma&&(ma=new fa);var e=t.drawTLX,i=t.drawTLY;return ma.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ma};const xa=Phaser.Math.RotateAround;var ba,Ca=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ba&&(ba={}),s=ba),s.x=e,s.y=i,0!==t.rotation&&xa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const wa=Phaser.GameObjects.Components.TransformMatrix;var Sa,Oa,Pa={},Ta=function(t,e,i,s,r){var n=Ca(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Pa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Sa&&(Sa=new wa,Oa=new wa),t.parentContainer?t.getWorldTransformMatrix(Sa,Oa):Sa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Sa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},_a=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ta(t,e,n,h,r)},ka={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ga&&(ga={}),s=ga),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&va(s,0,0,-i.rotation),s}(t,e,this,!0);return ya(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return _a(this.parent,this,t,e,i)}};Object.assign(ka,pa);const Ea=Phaser.Math.DegToRad,Ma=Phaser.Math.RadToDeg,Ra=Phaser.Utils.Objects.GetValue;class La extends ua{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ma(this._rotation)}set angle(t){this.rotation=Ea(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ra(t,"width",void 0),i=Ra(t,"height",void 0),s=Ra(t,"scaleX",void 0),r=Ra(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(La.prototype,ka);const Da=Phaser.Utils.String.Pad;var Aa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Da(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ya=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Xa=Phaser.Utils.Objects.GetValue;let Wa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Xa(t,"x",0),i=Xa(t,"y",0));var s=this.cornerRadius;s.tl=za(Xa(t,"tl",void 0),e,i),s.tr=za(Xa(t,"tr",void 0),e,i),s.bl=za(Xa(t,"bl",void 0),e,i),s.br=za(Xa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Fa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Fa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Fa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Fa(this.cornerRadius.br,t)}};var za=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ja(t),t},Fa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Xa(e,"x",0),t.y=Xa(e,"y",0)),ja(t)},ja=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ia=Phaser.Math.DegToRad;var Ba=function(t){return!t.hasOwnProperty("convex")||t.convex},Ha=function(t){return t.x>0&&t.y>0},Na=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,o,l,o,l,180,270,!1,h):Na(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,s-o,l,o,l,270,360,!1,h):Na(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,s-o,r-l,o,l,0,90,!1,h):Na(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,o,r-l,o,l,90,180,!1,h):Na(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ga=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Va(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ua=Phaser.Utils.Objects.GetValue;class $a extends La{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ua(e,"color",null),Ua(e,"color2",null),Ua(e,"horizontalGradient",!0)),this.setStroke(Ua(e,"stroke",null),Ua(e,"strokeThickness",2)),this.setCornerRadius(Ua(e,"cornerRadius",0),Ua(e,"cornerIteration",null))}set color(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ya("color2",t,this),Ya("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ya("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ya("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ga(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ja=Phaser.Utils.Objects.GetValue;class Ka extends La{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ja(e,"color",null),Ja(e,"color2",null),Ja(e,"horizontalGradient",!0)),this.setStroke(Ja(e,"stroke",null),Ja(e,"strokeThickness",2))}set color(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ja(t,"color2",null),Ja(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ja(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const qa=Phaser.Utils.Objects.GetValue;let Za=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(qa(t,"bold",!1)),this.setItalic(qa(t,"italic",!1)),this.setFontSize(qa(t,"fontSize","16px")),this.setFontFamily(qa(t,"fontFamily","Courier")),this.setColor(qa(t,"color","#fff")),this.setStrokeStyle(qa(t,"stroke",null),qa(t,"strokeThickness",0)),this.setShadow(qa(t,"shadowColor",null),qa(t,"shadowOffsetX",0),qa(t,"shadowOffsetY",0),qa(t,"shadowBlur",0)),this.setOffset(qa(t,"offsetX",0),qa(t,"offsetY",0)),this.setSpace(qa(t,"leftSpace",0),qa(t,"rightSpace",0)),this.setAlign(qa(t,"align",void 0)),this.setBackgroundColor(qa(t,"backgroundColor",null)),this.setBackgroundHeight(qa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(qa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ya("stroke",t,this),Ya("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ya("shadowOffsetX",t,this),Ya("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Aa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Aa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Aa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Aa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Qa=Phaser.Utils.Array.Remove,to=Phaser.Utils.Array.Remove,eo="text",io="image",so="drawer",ro="space",no="command";var ho=function(t){return t.type===eo&&"\n"===t.text},ao=function(t){return t.type===eo&&"\f"===t.text},oo=function(t){return t.type===eo};class lo extends La{constructor(t,e,i){super(t,eo),this.updateTextFlag=!1,this.style=new Za(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var co=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const uo=Phaser.Display.Canvas.CanvasPool;var po=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=uo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),uo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class vo extends La{constructor(t,e,i){super(t,io),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){po(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class go extends La{constructor(t,e,i,s){super(t,so),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class fo extends La{constructor(t,e){super(t,ro),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class mo extends ua{constructor(t,e,i,s,r){super(t,no),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function yo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>yo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=yo(t[i]));return e}var xo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const bo={none:0,word:1,char:2,character:2,mix:3};var Co=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Po.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Po.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_o(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=_o(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=_o(t,"wrapMode");void 0===c&&(c=_o(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=bo[c]);var u=_o(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_o(t,"letterSpacing",0),v=_o(t,"hAlign",0),g=_o(t,"vAlign",0),f=_o(t,"justifyPercentage",.25),m=xo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Mo(t,"maxLines",0);var a=0===i,o=Mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Mo(t,"letterSpacing",0),p=Mo(t,"rtl",!0),v=Mo(t,"hAlign",p?2:0),g=Mo(t,"vAlign",0),f=xo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return to(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(eo);return null===i?i=new lo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),_a(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const el=Phaser.Utils.Objects.GetFastValue;var il={};class sl{constructor(t){this.pools=el(t,"pools",il)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new tl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=cl(t,r,e,i,n),a=0;a<=ol&&0!==h;a++){if((r+=h)<0){r=0;break}h=cl(t,r,e,i,n)}return a===ol&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ul(t,e,i),t},dl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},cl=function(t,e,i,s,r){var n,h=dl(t,e,r),a=dl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ul=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const pl=Phaser.Utils.Objects.GetValue,vl=Phaser.Utils.Objects.GetValue;class gl extends Mh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=vl(e,"background",void 0),r=vl(e,"icon",void 0),n=vl(e,"iconMask",void 0),h=vl(e,"text",void 0),a=vl(e,"action",void 0),o=vl(e,"actionMask",void 0),l=vl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:vl(e,"space.icon",0),top:vl(e,"space.iconTop",0),bottom:vl(e,"space.iconBottom",0),left:vl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:vl(e,"space.icon",0),left:vl(e,"space.iconLeft",0),right:vl(e,"space.iconRight",0),top:vl(e,"space.iconTop",0)});var d=vl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Xh.call(this,r,r,1)),!d){var c=vl(e,"iconSize",void 0);this.setIconSize(vl(e,"iconWidth",c),vl(e,"iconHeight",c))}}if(h){var u=vl(e,"wrapText",!1),p=vl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Ih(t)){case 0:switch("string"==typeof e&&(e=Qh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Nh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Qh[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,al(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=pl(e,"minWidth",0),s=pl(e,"minHeight",0),r=pl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ll(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ll(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=vl(e,"space.text",0),m=vl(e,"expandTextWidth",!1),y=vl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:vl(e,"space.actionTop",0),bottom:vl(e,"space.actionBottom",0),right:vl(e,"space.actionRight",0)}:{left:vl(e,"space.actionLeft",0),right:vl(e,"space.actionRight",0),bottom:vl(e,"space.actionBottom",0)},d=vl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Xh.call(this,a,a,1)),!d)){var x=vl(e,"actionSize");this.setActionSize(vl(e,"actionWidth",x),vl(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var fl=Phaser.Renderer.WebGL.Utils,ml=function(t,e,i,s,r,n){for(var h=fl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},wl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Sl=Phaser.Renderer.Canvas.SetTransform;var Ol={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=bl(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&ml(r,h,e,l,a,o),e.isStroked&&xl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Sl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Tl.prototype,Ol);var _l=function(t){return t.x>0&&t.y>0},kl=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const El=Phaser.Math.DegToRad;var Ml=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Rd=Phaser.Utils.Objects.GetValue,Ld=Phaser.Utils.Objects.IsPlainObject;class Dd extends(rd(Kl)){constructor(t,e,i,s,r,n,h,a){Ld(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Ld(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Ld(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Ed).setName("trackFill")).addShape((new Ed).setName("bar")).addShape((new Ed).setName("trackStroke")),this.setTrackColor(Rd(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Rd(a,"trackStrokeThickness",2),Rd(a,"trackStrokeColor",void 0)),this.setSkewX(Rd(a,"skewX",0)),this.setRTL(Rd(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Ad={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Md(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Md(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Md(a,0,0,e,i,t)}};Object.assign(Dd.prototype,Ad);var Yd=function(t){return null==t||""===t||0===t.length},Xd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Yd(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Yd(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=yo(i),s=yo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return tc(t)?(this.stretchMode.edge=ic(ec(t,"edge",0)),this.stretchMode.internal=ic(ec(t,"internal",0))):(t=ic(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return rc.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const hc=Phaser.Utils.Objects.IsPlainObject,ac=Phaser.Utils.Objects.GetValue,oc=Phaser.GameObjects;var lc=void 0,dc=function(t,e){if(lc||(lc={},ti(t).events.once("destroy",(function(){for(var t in lc)lc[t].destroy();lc=void 0}))),!lc.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new oc[e](i)).setOrigin(0),lc[e]=t}return lc[e]};const cc=Phaser.GameObjects.RenderTexture;class uc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(hc(i)?(i=ac(d=i,"x",0),s=ac(d,"y",0),r=ac(d,"width",1),n=ac(d,"height",1),h=ac(d,"key",void 0),a=ac(d,"baseFrame",void 0),o=ac(d,"columns",void 0),l=ac(d,"rows",void 0)):hc(r)?(r=ac(d=r,"width",1),n=ac(d,"height",1),h=ac(d,"key",void 0),a=ac(d,"baseFrame",void 0),o=ac(d,"columns",void 0),l=ac(d,"rows",void 0)):hc(h)?(h=ac(d=h,"key",void 0),a=ac(d,"baseFrame",void 0),o=ac(d,"columns",void 0),l=ac(d,"rows",void 0)):hc(a)?(a=ac(d=a,"baseFrame",void 0),o=ac(d,"columns",void 0),l=ac(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ac(d,"baseFrame",void 0)):hc(o)&&(o=ac(d=o,"columns",void 0),l=ac(d,"rows",void 0)),void 0===a&&(a=ac(d,"frame",void 0)),void 0===o){var c=ac(d,"leftWidth",void 0),u=ac(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=ac(d,"topHeight",void 0),v=ac(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(ac(d,"getFrameNameCallback",void 0)),this.setStretchMode(ac(d,"stretchMode",0)),this.setPreserveRatio(ac(d,"preserveRatio",!0));var g=ac(d,"maxFixedPartScale",1),f=ac(d,"maxFixedPartScaleX",g),m=ac(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,nc),i}(cc,"rexNinePatch")){}var pc={_drawImage:function(t,e,i,s,r,n){var h=dc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=dc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(uc.prototype,pc);let vc=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Fd(t,e))return t[e];var i=t.parent;return Fd(i,e)?i[e]:void 0}set(t,e,i){return Fd(t,e)?t[e]=i:Fd(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const gc=Phaser.Utils.Objects.GetValue;class fc extends uc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=gc(e,"effects",!0);i&&Nd(this,i),this.style=new vc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(fc.prototype,Bl);const mc=["alpha","tint","flipX","flipY"];var yc=function(t,e){if(!e)return t;for(var i=0,s=mc.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},z=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Ds,As,Ys,Xs);const zs=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,Ws);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Ns=Phaser.Utils.Objects.GetValue;class Vs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(Tn.prototype,$e);var _n={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(zn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),Fr.call(t,e),Br.call(t,e),Gr.call(t,e),Vn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,uh,fh,mh,yh,xh,bh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Oh=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Oh(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,Ch);var _h=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Eh={appendText:kh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Mh extends Th{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(_h(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(_h(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&_h(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&_h(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Mh.prototype,Eh);var Rh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Lh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Dh=Phaser.GameObjects.Graphics;class Ah extends Dh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Yh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ge(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ge(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Lh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Rh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Rh.call(this,this.width,this.height,this.padding,t,e)),this}}const Yh={rectangle:0,circle:1};var Xh=function(t,e,i,s){var r=new Ah(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Wh=Phaser.GameObjects.Text;var zh=function(t){return t instanceof Wh};const Fh=Phaser.GameObjects.BitmapText;var jh=function(t){return t instanceof Fh},Ih=function(t){return jh(t)?2:zh(t)?0:1},Bh=/^[\x00-\x7F]+$/,Hh=function(t){return Bh.test(t)},Nh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Gh=0,Uh=1,$h=2,Jh=0,Kh=1,qh=2,Zh=/(?:\r\n|\r|\n)/;const Qh={none:Jh,word:Kh,char:qh,character:qh,mix:3},ta=Phaser.Renderer.WebGL.Utils;var ea={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ta.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ia=Phaser.Display.Color;var sa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ia);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ra=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},na={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,ra(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ha=Phaser.Display.Canvas.CanvasPool,aa=Phaser.GameObjects.GameObject,oa=Phaser.Utils.String.UUID;class la extends aa{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ha.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=oa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ha.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const da=Phaser.GameObjects.Components;Phaser.Class.mixin(la,[da.Alpha,da.BlendMode,da.Crop,da.Depth,da.Flip,da.GetBounds,da.Mask,da.Origin,da.Pipeline,da.PostPipeline,da.ScrollFactor,da.Tint,da.Transform,da.Visible,ea,sa,na]);var ca={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ua{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ua.prototype,ca);var pa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const va=Phaser.Math.RotateAround;var ga;const fa=Phaser.Geom.Rectangle;var ma,ya=function(t){void 0===ma&&(ma=new fa);var e=t.drawTLX,i=t.drawTLY;return ma.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ma};const xa=Phaser.Math.RotateAround;var ba,Ca=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ba&&(ba={}),s=ba),s.x=e,s.y=i,0!==t.rotation&&xa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const wa=Phaser.GameObjects.Components.TransformMatrix;var Sa,Oa,Pa={},Ta=function(t,e,i,s,r){var n=Ca(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Pa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Sa&&(Sa=new wa,Oa=new wa),t.parentContainer?t.getWorldTransformMatrix(Sa,Oa):Sa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Sa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},_a=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ta(t,e,n,h,r)},ka={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ga&&(ga={}),s=ga),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&va(s,0,0,-i.rotation),s}(t,e,this,!0);return ya(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return _a(this.parent,this,t,e,i)}};Object.assign(ka,pa);const Ea=Phaser.Math.DegToRad,Ma=Phaser.Math.RadToDeg,Ra=Phaser.Utils.Objects.GetValue;class La extends ua{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ma(this._rotation)}set angle(t){this.rotation=Ea(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ra(t,"width",void 0),i=Ra(t,"height",void 0),s=Ra(t,"scaleX",void 0),r=Ra(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(La.prototype,ka);const Da=Phaser.Utils.String.Pad;var Aa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Da(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ya=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Xa=Phaser.Utils.Objects.GetValue;let Wa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Xa(t,"x",0),i=Xa(t,"y",0));var s=this.cornerRadius;s.tl=za(Xa(t,"tl",void 0),e,i),s.tr=za(Xa(t,"tr",void 0),e,i),s.bl=za(Xa(t,"bl",void 0),e,i),s.br=za(Xa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Fa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Fa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Fa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Fa(this.cornerRadius.br,t)}};var za=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ja(t),t},Fa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Xa(e,"x",0),t.y=Xa(e,"y",0)),ja(t)},ja=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ia=Phaser.Math.DegToRad;var Ba=function(t){return!t.hasOwnProperty("convex")||t.convex},Ha=function(t){return t.x>0&&t.y>0},Na=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,o,l,o,l,180,270,!1,h):Na(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,s-o,l,o,l,270,360,!1,h):Na(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,s-o,r-l,o,l,0,90,!1,h):Na(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,o,r-l,o,l,90,180,!1,h):Na(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ga=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Va(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ua=Phaser.Utils.Objects.GetValue;class $a extends La{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ua(e,"color",null),Ua(e,"color2",null),Ua(e,"horizontalGradient",!0)),this.setStroke(Ua(e,"stroke",null),Ua(e,"strokeThickness",2)),this.setCornerRadius(Ua(e,"cornerRadius",0),Ua(e,"cornerIteration",null))}set color(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ya("color2",t,this),Ya("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ya("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ya("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ga(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ja=Phaser.Utils.Objects.GetValue;class Ka extends La{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ja(e,"color",null),Ja(e,"color2",null),Ja(e,"horizontalGradient",!0)),this.setStroke(Ja(e,"stroke",null),Ja(e,"strokeThickness",2))}set color(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Aa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ja(t,"color2",null),Ja(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ja(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const qa=Phaser.Utils.Objects.GetValue;let Za=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(qa(t,"bold",!1)),this.setItalic(qa(t,"italic",!1)),this.setFontSize(qa(t,"fontSize","16px")),this.setFontFamily(qa(t,"fontFamily","Courier")),this.setColor(qa(t,"color","#fff")),this.setStrokeStyle(qa(t,"stroke",null),qa(t,"strokeThickness",0)),this.setShadow(qa(t,"shadowColor",null),qa(t,"shadowOffsetX",0),qa(t,"shadowOffsetY",0),qa(t,"shadowBlur",0)),this.setOffset(qa(t,"offsetX",0),qa(t,"offsetY",0)),this.setSpace(qa(t,"leftSpace",0),qa(t,"rightSpace",0)),this.setAlign(qa(t,"align",void 0)),this.setBackgroundColor(qa(t,"backgroundColor",null)),this.setBackgroundHeight(qa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(qa(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(qa(t,"backgroundLeftX",0)),this.setBackgroundRightX(qa(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ya("stroke",t,this),Ya("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ya("shadowOffsetX",t,this),Ya("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Aa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Aa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Aa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Aa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Qa=Phaser.Utils.Array.Remove,to=Phaser.Utils.Array.Remove,eo="text",io="image",so="drawer",ro="space",no="command";var ho=function(t){return t.type===eo&&"\n"===t.text},ao=function(t){return t.type===eo&&"\f"===t.text},oo=function(t){return t.type===eo};class lo extends La{constructor(t,e,i){super(t,eo),this.updateTextFlag=!1,this.style=new Za(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var co=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const uo=Phaser.Display.Canvas.CanvasPool;var po=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=uo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),uo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class vo extends La{constructor(t,e,i){super(t,io),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){po(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class go extends La{constructor(t,e,i,s){super(t,so),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class fo extends La{constructor(t,e){super(t,ro),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class mo extends ua{constructor(t,e,i,s,r){super(t,no),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function yo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>yo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=yo(t[i]));return e}var xo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const bo={none:0,word:1,char:2,character:2,mix:3};var Co=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Po.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Po.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_o(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=_o(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=_o(t,"wrapMode");void 0===c&&(c=_o(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=bo[c]);var u=_o(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_o(t,"letterSpacing",0),v=_o(t,"hAlign",0),g=_o(t,"vAlign",0),f=_o(t,"justifyPercentage",.25),m=xo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Mo(t,"maxLines",0);var a=0===i,o=Mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Mo(t,"letterSpacing",0),p=Mo(t,"rtl",!0),v=Mo(t,"hAlign",p?2:0),g=Mo(t,"vAlign",0),f=xo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return to(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(eo);return null===i?i=new lo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),_a(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const el=Phaser.Utils.Objects.GetFastValue;var il={};class sl{constructor(t){this.pools=el(t,"pools",il)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new tl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=cl(t,r,e,i,n),a=0;a<=ol&&0!==h;a++){if((r+=h)<0){r=0;break}h=cl(t,r,e,i,n)}return a===ol&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ul(t,e,i),t},dl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},cl=function(t,e,i,s,r){var n,h=dl(t,e,r),a=dl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ul=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const pl=Phaser.Utils.Objects.GetValue,vl=Phaser.Utils.Objects.GetValue;class gl extends Mh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=vl(e,"background",void 0),r=vl(e,"icon",void 0),n=vl(e,"iconMask",void 0),h=vl(e,"text",void 0),a=vl(e,"action",void 0),o=vl(e,"actionMask",void 0),l=vl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:vl(e,"space.icon",0),top:vl(e,"space.iconTop",0),bottom:vl(e,"space.iconBottom",0),left:vl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:vl(e,"space.icon",0),left:vl(e,"space.iconLeft",0),right:vl(e,"space.iconRight",0),top:vl(e,"space.iconTop",0)});var d=vl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Xh.call(this,r,r,1)),!d){var c=vl(e,"iconSize",void 0);this.setIconSize(vl(e,"iconWidth",c),vl(e,"iconHeight",c))}}if(h){var u=vl(e,"wrapText",!1),p=vl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Ih(t)){case 0:switch("string"==typeof e&&(e=Qh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Nh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Qh[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,al(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=pl(e,"minWidth",0),s=pl(e,"minHeight",0),r=pl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ll(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ll(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=vl(e,"space.text",0),m=vl(e,"expandTextWidth",!1),y=vl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:vl(e,"space.actionTop",0),bottom:vl(e,"space.actionBottom",0),right:vl(e,"space.actionRight",0)}:{left:vl(e,"space.actionLeft",0),right:vl(e,"space.actionRight",0),bottom:vl(e,"space.actionBottom",0)},d=vl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Xh.call(this,a,a,1)),!d)){var x=vl(e,"actionSize");this.setActionSize(vl(e,"actionWidth",x),vl(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var fl=Phaser.Renderer.WebGL.Utils,ml=function(t,e,i,s,r,n){for(var h=fl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},wl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Sl=Phaser.Renderer.Canvas.SetTransform;var Ol={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=bl(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&ml(r,h,e,l,a,o),e.isStroked&&xl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Sl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Tl.prototype,Ol);var _l=function(t){return t.x>0&&t.y>0},kl=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const El=Phaser.Math.DegToRad;var Ml=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Rd=Phaser.Utils.Objects.GetValue,Ld=Phaser.Utils.Objects.IsPlainObject;class Dd extends(rd(Kl)){constructor(t,e,i,s,r,n,h,a){Ld(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Ld(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Ld(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Ed).setName("trackFill")).addShape((new Ed).setName("bar")).addShape((new Ed).setName("trackStroke")),this.setTrackColor(Rd(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Rd(a,"trackStrokeThickness",2),Rd(a,"trackStrokeColor",void 0)),this.setSkewX(Rd(a,"skewX",0)),this.setRTL(Rd(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Ad={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Md(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Md(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Md(a,0,0,e,i,t)}};Object.assign(Dd.prototype,Ad);var Yd=function(t){return null==t||""===t||0===t.length},Xd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Yd(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Yd(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=yo(i),s=yo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return tc(t)?(this.stretchMode.edge=ic(ec(t,"edge",0)),this.stretchMode.internal=ic(ec(t,"internal",0))):(t=ic(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return rc.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const hc=Phaser.Utils.Objects.IsPlainObject,ac=Phaser.Utils.Objects.GetValue,oc=Phaser.GameObjects;var lc=void 0,dc=function(t,e){if(lc||(lc={},ti(t).events.once("destroy",(function(){for(var t in lc)lc[t].destroy();lc=void 0}))),!lc.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new oc[e](i)).setOrigin(0),lc[e]=t}return lc[e]};const cc=Phaser.GameObjects.RenderTexture;class uc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(hc(i)?(i=ac(d=i,"x",0),s=ac(d,"y",0),r=ac(d,"width",1),n=ac(d,"height",1),h=ac(d,"key",void 0),a=ac(d,"baseFrame",void 0),o=ac(d,"columns",void 0),l=ac(d,"rows",void 0)):hc(r)?(r=ac(d=r,"width",1),n=ac(d,"height",1),h=ac(d,"key",void 0),a=ac(d,"baseFrame",void 0),o=ac(d,"columns",void 0),l=ac(d,"rows",void 0)):hc(h)?(h=ac(d=h,"key",void 0),a=ac(d,"baseFrame",void 0),o=ac(d,"columns",void 0),l=ac(d,"rows",void 0)):hc(a)?(a=ac(d=a,"baseFrame",void 0),o=ac(d,"columns",void 0),l=ac(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ac(d,"baseFrame",void 0)):hc(o)&&(o=ac(d=o,"columns",void 0),l=ac(d,"rows",void 0)),void 0===a&&(a=ac(d,"frame",void 0)),void 0===o){var c=ac(d,"leftWidth",void 0),u=ac(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=ac(d,"topHeight",void 0),v=ac(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(ac(d,"getFrameNameCallback",void 0)),this.setStretchMode(ac(d,"stretchMode",0)),this.setPreserveRatio(ac(d,"preserveRatio",!0));var g=ac(d,"maxFixedPartScale",1),f=ac(d,"maxFixedPartScaleX",g),m=ac(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,nc),i}(cc,"rexNinePatch")){}var pc={_drawImage:function(t,e,i,s,r,n){var h=dc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=dc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(uc.prototype,pc);let vc=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Fd(t,e))return t[e];var i=t.parent;return Fd(i,e)?i[e]:void 0}set(t,e,i){return Fd(t,e)?t[e]=i:Fd(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const gc=Phaser.Utils.Objects.GetValue;class fc extends uc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=gc(e,"effects",!0);i&&Nd(this,i),this.style=new vc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(fc.prototype,Bl);const mc=["alpha","tint","flipX","flipY"];var yc=function(t,e){if(!e)return t;for(var i=0,s=mc.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Mc=Phaser.Display.Canvas.CanvasPool;var Rc=function(t){var e=Mc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Mc.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Mc.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Jh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Qh[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Dc(t,l,d);else{var u=Lc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Dc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Dc(t,"fill",null);null!==v&&(this.color=Aa(v));var g=Dc(t,"metrics",!1);return g?this.metrics={ascent:Dc(g,"ascent",0),descent:Dc(g,"descent",0),fontSize:Dc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Rc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Rc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Dc(t,"fontFamily","Courier"),this.fontSize=Dc(t,"fontSize","16px"),this.fontStyle=Dc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Aa(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Aa(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Aa(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Aa(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Aa(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Aa(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Aa(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Qh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Dc(e,"fontFamily",this.fontFamily),this.fontSize=Dc(e,"fontSize",this.fontSize),this.fontStyle=Dc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Yc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ga(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Xc=Phaser.Utils.Objects.GetValue,Wc=Gh,zc=Uh;class Fc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Xc(t,"text",""),this.x=Xc(t,"x",0),this.y=Xc(t,"y",0),this.width=Xc(t,"width",0);var e=Xc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Xc(t,"newLineMode",0),this.startIndex=Xc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===zc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Wc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===zc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const jc=Phaser.Utils.Objects.GetFastValue,Ic=Gh,Bc=$h;class Hc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=jc(t,"tagToText",Wt),this.tagToTextScope=jc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Nc={};const Vc=Phaser.Geom.Rectangle;var Gc=new tl;class Uc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&au(g)){""!==x?h.push(n.getLine(x,b,tu)):0===C&&r>0&&h.push(n.getLine("",0,tu)),h.push(...nu(g,e,su,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,tu)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},hu=function(t,e){var i;switch(e){case iu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==lu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Hc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return gp(this.sizerChildren,null),vh.call(this,t),this}},mp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)gp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Cp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,gp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)gp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Sp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Op=Phaser.Utils.Objects.IsPlainObject,Pp=Phaser.Utils.Objects.GetValue;class Tp extends th{constructor(t,e,i,s,r,n,h,a,o,l){Op(e)?(e=Pp(l=e,"x",0),i=Pp(l,"y",0),s=Pp(l,"width",void 0),r=Pp(l,"height",void 0),n=Pp(l,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(s)?(s=Pp(l=s,"width",void 0),r=Pp(l,"height",void 0),n=Pp(l,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(n)?(n=Pp(l=n,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(a)&&(a=Pp(l=a,"columnProportions",0),o=Pp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Pp(l,"createCellContainerCallback")),this.setIndentLeft(Pp(l,"space.indentLeftOdd",0),Pp(l,"space.indentLeftEven",0)),this.setIndentTop(Pp(l,"space.indentTopOdd",0),Pp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Pp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=wp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Sp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Tp.prototype,Cp);const _p=Phaser.Utils.Objects.GetValue,kp=Phaser.Math.Percent;var Ep=function(t,e,i){var s;return t.y===e.y?s=kp(i.x,t.x,e.x):t.x===e.x&&(s=kp(i.y,t.y,e.y)),s},Mp=function(t,e,i){var s,r;this.enable&&(Rp.x=e,Rp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Ep(s,r,Rp))},Rp={},Lp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Dp.x=t.worldX,Dp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Ep(s,r,Dp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Dp={},Ap=function(t,e){void 0===e&&(e=Yp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Yp={};const Xp=Phaser.Display.Align.LEFT_CENTER,Wp=Phaser.Display.Align.TOP_CENTER;var zp={};const Fp=Phaser.Display.Align.RIGHT_CENTER,jp=Phaser.Display.Align.BOTTOM_CENTER;var Ip={};const Bp=Phaser.Math.Linear;var Hp={};const Np=Phaser.Display.Align.LEFT_CENTER,Vp=Phaser.Display.Align.TOP_CENTER,Gp=Phaser.Display.Align.RIGHT_CENTER,Up=Phaser.Display.Align.BOTTOM_CENTER,$p=Phaser.Utils.Objects.GetValue,Jp=Phaser.Utils.Objects.IsPlainObject,Kp=Phaser.Math.Clamp,qp=Phaser.Math.Snap.To;class Zp extends(rd(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=$p(e,"reverseAxis",!1);var i=$p(e,"background",void 0),s=$p(e,"track",void 0),r=$p(e,"indicator",void 0),n=$p(e,"thumb",void 0);if(i&&(Jp(i)&&(i=xc(t,i)),this.addBackground(i)),s&&(Jp(s)&&(s=xc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Jp(r)&&(r=xc(t,r)),this.pin(r)),n){Jp(n)&&(n=xc(t,n)),this.pin(n);var h=$p(e,"thumbOffsetX",0),a=$p(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=$p(e,"input",0);switch("string"==typeof o&&(o=Qp[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Mp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Lp,this).on("pointermove",Lp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable($p(e,"enable",void 0)),this.setGap($p(e,"gap",void 0)),this.setValue($p(e,"value",0),$p(e,"min",void 0),$p(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=qp(t,this.gap));var e=this._value;this._value=Kp(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const Qp={pan:0,drag:0,click:1,none:-1};var tv={getStartPoint:function(t){if(void 0===t&&(t=zp),this.childrenMap.thumb){var e=0===this.orientation?Xp:Wp;Ap.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Ip),this.childrenMap.thumb){var e=0===this.orientation?Fp:jp;Ap.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Hp),s.x=Bp(e.x,i.x,t),s.y=Bp(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Gp:Up:0===this.orientation?Np:Vp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Zp.prototype,tv);const ev=Phaser.Utils.Objects.GetValue;class iv extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=ev(e,"background",void 0),n=ev(e,"buttons",void 0),h=ev(n,"top",ev(n,"left",void 0)),a=ev(n,"bottom",ev(n,"right",void 0)),o=ev(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===ev(o,"width",void 0)?1:0:void 0===ev(o,"height",void 0)?1:0,i=new Zp(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=ev(e,"valuechangeCallback",null);if(null!==d){var c=ev(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(ev(e,"enable",void 0)),this.setValue(ev(e,"value",0)),this.setScrollStep(ev(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class sv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Math.Distance.Between;class hv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=rv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(rv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(rv(t,"enable",!0)),this.holdThreshold=rv(t,"holdThreshold",50),this.pointerOutReleaseEnable=rv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:nv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const av=Phaser.Utils.Objects.GetValue;class ov{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(av(t,"value",0)),this.setSpeed(av(t,"speed",0)),this.setAcceleration(av(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class lv{constructor(){this.value,this.dir,this.movement=new ov}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const pv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},vv=Phaser.Utils.Objects.GetValue;class gv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=vv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(vv(e,"speed",.1)),this.setEnable(vv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(vv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const fv=Phaser.Utils.Objects.GetValue;var mv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?fv(s,l,void 0):fv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new iv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=fv(r,"position",0);"string"==typeof p&&(p=yv[p]);var v,g,f=fv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=fv(s,"space.slider",void 0))&&(a?f=0:v=fv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:fv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:fv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:fv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:fv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=fv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=fv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=fv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=fv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=fv(s,"scrollDetectionMode");"string"==typeof x&&(x=xv[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?fv(s,b,!0):fv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new uv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=fv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new gv(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const yv={right:0,left:1,bottom:0,top:1},xv={gameObject:0,rectBounds:1},bv=Phaser.Utils.Objects.GetValue;var Cv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=bv(e,"width"),h=bv(e,"height");n||bv(e,"child.expandWidth",!0)||(s[1]=0),h||bv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Tp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=_p(i,"child"),r=_p(s,"gameObject",void 0);if(r){var n=_p(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=_p(n,"top",0),h.bottom=_p(n,"bottom",0),a.left=_p(n,"left",0),a.right=_p(n,"right",0);break;case 1:h.top=_p(n,"left",0),h.bottom=_p(n,"right",0),a.top=_p(n,"top",0),a.bottom=_p(n,"bottom",0);break;default:h.top=_p(n,"top",0),h.bottom=_p(n,"bottom",0),h.left=_p(n,"left",0),h.right=_p(n,"right",0)}e.add(r,{column:1,row:1,align:_p(s,"align","center"),padding:a,expand:{width:_p(s,"expandWidth",!0),height:_p(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:mv(t,a,"y",e);break;case 1:mv(t,a,"x",e);break;default:mv(t,a,"y",e),mv(t,a,"x",e)}return a},wv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Sv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Ov=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Mv.call(this,-this.textOY)),0),e=Rv.call(this,t)+this.textOY,i=Lv.call(this,t);return function(t,e){switch(Ih(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Dv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Yv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Dv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Wv=Phaser.Utils.Objects.IsPlainObject,zv=Phaser.Utils.Objects.GetValue,Fv=Phaser.Display.Align.TOP_LEFT;class jv extends th{constructor(t,e,i,s,r,n){Wv(e)?(e=zv(n=e,"x",0),i=zv(n,"y",0),s=zv(n,"width",void 0),r=zv(n,"height",void 0)):Wv(s)&&(s=zv(n=s,"width",void 0),r=zv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=zv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(zv(n,"clampTextOY",!0)),this.alwaysScrollable=zv(n,"alwaysScrollable",!1);var h=zv(n,"background",void 0),a=zv(n,"text",void 0);void 0===a&&(a=Iv(t)),this.textCropEnable=zv(n,"textCrop",!!a.setCrop);var o=zv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Fv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Ih(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Mv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Rv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Iv=function(t){return t.add.text(0,0,"")};Object.assign(jv.prototype,Xv);var Bv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Hv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Nv=Phaser.Utils.Objects.GetValue;class Vv extends kv{constructor(t,e){void 0===e&&(e={});var i=Nv(e,"text",void 0),s=Nv(e,"textWidth",void 0),r=Nv(e,"textHeight",void 0),n=Nv(e,"textCrop",!!i.setCrop),h=Nv(e,"textMask",!n),a=Nv(e,"content",""),o=new jv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Nv(e,"clampChildOY",!1),alwaysScrollable:Nv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Nv(e,"space",void 0);l&&(l.child=Nv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Vv.prototype,Bv,Hv);const Gv=Phaser.Utils.Objects.GetValue;var Uv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new np(t,e);break;case"bbcodetext":case"bbcode":s=new ep(t,0,0,"",e);break;case"label":s=new Kv(t,e);break;case"textarea":s=function(t,e,i){e=e?yo(e):{};var s=Gv(i,"background",xc),r=Gv(i,"text",Uv),n=Gv(i,"track",xc),h=Gv(i,"thumb",xc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Vv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new wc(t,e)}return yc(s,e),t.add.existing(s),s},$v=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new fc(t,e):new $d(t,e);break;case"roundRectangle":s=new Hl(t,e);break;default:s=new Zd(t,e)}return yc(s,e),t.add.existing(s),s};const Jv=Phaser.Utils.Objects.GetValue;class Kv extends gl{constructor(t,e,i){e=function(t,e,i){e=e?yo(e):{};var s=Jv(i,"background",xc),r=Jv(i,"text",Uv),n=Jv(i,"icon",$v),h=Jv(i,"action",$v);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return qv(this.getChildren(),"setActiveState",t),this}setHoverState(t){return qv(this.getChildren(),"setHoverState",t),this}setDisableState(t){return qv(this.getChildren(),"setDisableState",t),this}}var qv=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(mg(this),yg(this)),this}setNumberInput(){return this.onUpdateCallback=fg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Cg=Phaser.Utils.Objects.GetValue,wg=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Sg=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Mg.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Rg(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Lg=new Mg,Dg=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Ag=/\S/,Yg=new Mg;Yg.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Ag.test(t)&&!Ag.test(e)},Yg.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Fg(t,null,null,i),i," ")},zg.equals=function(t,e){return Mg.prototype.equals.call(zg,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const jg=new Mg;jg.tokenize=function(t){return t.slice()},jg.join=jg.removeEmpty=function(t){return t};const Ig=Phaser.Utils.Array.Remove;var Bg=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Ig(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Lg.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Ug={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ng(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ng(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Vg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Ng(Gg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Vg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Ng(Gg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const $g=Phaser.Utils.Objects.IsPlainObject;class Jg extends hl{constructor(t,e,i,s,r,n){$g(e)?n=e:$g(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Sg(e,"wrap.vAlign")||Xd(e,"wrap.vAlign",s=i?"center":"top"),Sg(e,"wrap.wrapMode")||Xd(e,"wrap.wrapMode","char"),Sg(e,"wrap.maxLines")||Xd(e,"wrap.maxLines",s=i?1:void 0),i&&Xd(e,"wrap.wrapWidth",1/0),Sg(e,"wrap.useDefaultTextHeight")||Xd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Sg(e.edit,"inputType")){var s=i?"text":"textarea";Xd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Pg(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Xl(n.background,"focus"),o=Xl(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Cg(e,"edit");return void 0===i&&(i={}),tg(e,i,wg),new bg(t,i)}(this,n),Tg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Eg.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),kg.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;so;d--){for(c=0;c0&&this.wrapMode!==Jh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Qh[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Dc(t,l,d);else{var u=Lc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Dc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Dc(t,"fill",null);null!==v&&(this.color=Aa(v));var g=Dc(t,"metrics",!1);return g?this.metrics={ascent:Dc(g,"ascent",0),descent:Dc(g,"descent",0),fontSize:Dc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Rc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Rc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Dc(t,"fontFamily","Courier"),this.fontSize=Dc(t,"fontSize","16px"),this.fontStyle=Dc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Aa(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Aa(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Aa(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Aa(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Aa(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Aa(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Aa(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Aa(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Qh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Dc(e,"fontFamily",this.fontFamily),this.fontSize=Dc(e,"fontSize",this.fontSize),this.fontStyle=Dc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Yc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ga(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Xc=Phaser.Utils.Objects.GetValue,Wc=Gh,zc=Uh;class Fc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Xc(t,"text",""),this.x=Xc(t,"x",0),this.y=Xc(t,"y",0),this.width=Xc(t,"width",0);var e=Xc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Xc(t,"newLineMode",0),this.startIndex=Xc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===zc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Wc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===zc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const jc=Phaser.Utils.Objects.GetFastValue,Ic=Gh,Bc=$h;class Hc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=jc(t,"tagToText",Wt),this.tagToTextScope=jc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Nc={};const Vc=Phaser.Geom.Rectangle;var Gc=new tl;class Uc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&au(g)){""!==x?h.push(n.getLine(x,b,tu)):0===C&&r>0&&h.push(n.getLine("",0,tu)),h.push(...nu(g,e,su,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,tu)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},hu=function(t,e){var i;switch(e){case iu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==lu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Hc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return gp(this.sizerChildren,null),vh.call(this,t),this}},mp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)gp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Cp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,gp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)gp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Sp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Op=Phaser.Utils.Objects.IsPlainObject,Pp=Phaser.Utils.Objects.GetValue;class Tp extends th{constructor(t,e,i,s,r,n,h,a,o,l){Op(e)?(e=Pp(l=e,"x",0),i=Pp(l,"y",0),s=Pp(l,"width",void 0),r=Pp(l,"height",void 0),n=Pp(l,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(s)?(s=Pp(l=s,"width",void 0),r=Pp(l,"height",void 0),n=Pp(l,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(n)?(n=Pp(l=n,"column",l.col||0),h=Pp(l,"row",0),a=Pp(l,"columnProportions",0),o=Pp(l,"rowProportions",0)):Op(a)&&(a=Pp(l=a,"columnProportions",0),o=Pp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Pp(l,"createCellContainerCallback")),this.setIndentLeft(Pp(l,"space.indentLeftOdd",0),Pp(l,"space.indentLeftEven",0)),this.setIndentTop(Pp(l,"space.indentTopOdd",0),Pp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Pp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=wp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Sp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Tp.prototype,Cp);const _p=Phaser.Utils.Objects.GetValue,kp=Phaser.Math.Percent;var Ep=function(t,e,i){var s;return t.y===e.y?s=kp(i.x,t.x,e.x):t.x===e.x&&(s=kp(i.y,t.y,e.y)),s},Mp=function(t,e,i){var s,r;this.enable&&(Rp.x=e,Rp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Ep(s,r,Rp))},Rp={},Lp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Dp.x=t.worldX,Dp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Ep(s,r,Dp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Dp={},Ap=function(t,e){void 0===e&&(e=Yp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Yp={};const Xp=Phaser.Display.Align.LEFT_CENTER,Wp=Phaser.Display.Align.TOP_CENTER;var zp={};const Fp=Phaser.Display.Align.RIGHT_CENTER,jp=Phaser.Display.Align.BOTTOM_CENTER;var Ip={};const Bp=Phaser.Math.Linear;var Hp={};const Np=Phaser.Display.Align.LEFT_CENTER,Vp=Phaser.Display.Align.TOP_CENTER,Gp=Phaser.Display.Align.RIGHT_CENTER,Up=Phaser.Display.Align.BOTTOM_CENTER,$p=Phaser.Utils.Objects.GetValue,Jp=Phaser.Utils.Objects.IsPlainObject,Kp=Phaser.Math.Clamp,qp=Phaser.Math.Snap.To;class Zp extends(rd(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=$p(e,"reverseAxis",!1);var i=$p(e,"background",void 0),s=$p(e,"track",void 0),r=$p(e,"indicator",void 0),n=$p(e,"thumb",void 0);if(i&&(Jp(i)&&(i=xc(t,i)),this.addBackground(i)),s&&(Jp(s)&&(s=xc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Jp(r)&&(r=xc(t,r)),this.pin(r)),n){Jp(n)&&(n=xc(t,n)),this.pin(n);var h=$p(e,"thumbOffsetX",0),a=$p(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=$p(e,"input",0);switch("string"==typeof o&&(o=Qp[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Mp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Lp,this).on("pointermove",Lp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable($p(e,"enable",void 0)),this.setGap($p(e,"gap",void 0)),this.setValue($p(e,"value",0),$p(e,"min",void 0),$p(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=qp(t,this.gap));var e=this._value;this._value=Kp(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const Qp={pan:0,drag:0,click:1,none:-1};var tv={getStartPoint:function(t){if(void 0===t&&(t=zp),this.childrenMap.thumb){var e=0===this.orientation?Xp:Wp;Ap.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Ip),this.childrenMap.thumb){var e=0===this.orientation?Fp:jp;Ap.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Hp),s.x=Bp(e.x,i.x,t),s.y=Bp(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Gp:Up:0===this.orientation?Np:Vp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Zp.prototype,tv);const ev=Phaser.Utils.Objects.GetValue;class iv extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=ev(e,"background",void 0),n=ev(e,"buttons",void 0),h=ev(n,"top",ev(n,"left",void 0)),a=ev(n,"bottom",ev(n,"right",void 0)),o=ev(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===ev(o,"width",void 0)?1:0:void 0===ev(o,"height",void 0)?1:0,i=new Zp(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=ev(e,"valuechangeCallback",null);if(null!==d){var c=ev(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(ev(e,"enable",void 0)),this.setValue(ev(e,"value",0)),this.setScrollStep(ev(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class sv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Math.Distance.Between;class hv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=rv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(rv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(rv(t,"enable",!0)),this.holdThreshold=rv(t,"holdThreshold",50),this.pointerOutReleaseEnable=rv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:nv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const av=Phaser.Utils.Objects.GetValue;class ov{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(av(t,"value",0)),this.setSpeed(av(t,"speed",0)),this.setAcceleration(av(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class lv{constructor(){this.value,this.dir,this.movement=new ov}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const pv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},vv=Phaser.Utils.Objects.GetValue;class gv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=vv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(vv(e,"speed",.1)),this.setEnable(vv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(vv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const fv=Phaser.Utils.Objects.GetValue;var mv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?fv(s,l,void 0):fv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new iv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=fv(r,"position",0);"string"==typeof p&&(p=yv[p]);var v,g,f=fv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=fv(s,"space.slider",void 0))&&(a?f=0:v=fv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:fv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:fv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:fv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:fv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=fv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=fv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=fv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=fv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=fv(s,"scrollDetectionMode");"string"==typeof x&&(x=xv[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?fv(s,b,!0):fv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new uv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=fv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new gv(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const yv={right:0,left:1,bottom:0,top:1},xv={gameObject:0,rectBounds:1},bv=Phaser.Utils.Objects.GetValue;var Cv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=bv(e,"width"),h=bv(e,"height");n||bv(e,"child.expandWidth",!0)||(s[1]=0),h||bv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Tp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=_p(i,"child"),r=_p(s,"gameObject",void 0);if(r){var n=_p(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=_p(n,"top",0),h.bottom=_p(n,"bottom",0),a.left=_p(n,"left",0),a.right=_p(n,"right",0);break;case 1:h.top=_p(n,"left",0),h.bottom=_p(n,"right",0),a.top=_p(n,"top",0),a.bottom=_p(n,"bottom",0);break;default:h.top=_p(n,"top",0),h.bottom=_p(n,"bottom",0),h.left=_p(n,"left",0),h.right=_p(n,"right",0)}e.add(r,{column:1,row:1,align:_p(s,"align","center"),padding:a,expand:{width:_p(s,"expandWidth",!0),height:_p(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:mv(t,a,"y",e);break;case 1:mv(t,a,"x",e);break;default:mv(t,a,"y",e),mv(t,a,"x",e)}return a},wv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Sv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Ov=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Mv.call(this,-this.textOY)),0),e=Rv.call(this,t)+this.textOY,i=Lv.call(this,t);return function(t,e){switch(Ih(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Dv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Yv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Dv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Wv=Phaser.Utils.Objects.IsPlainObject,zv=Phaser.Utils.Objects.GetValue,Fv=Phaser.Display.Align.TOP_LEFT;class jv extends th{constructor(t,e,i,s,r,n){Wv(e)?(e=zv(n=e,"x",0),i=zv(n,"y",0),s=zv(n,"width",void 0),r=zv(n,"height",void 0)):Wv(s)&&(s=zv(n=s,"width",void 0),r=zv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=zv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(zv(n,"clampTextOY",!0)),this.alwaysScrollable=zv(n,"alwaysScrollable",!1);var h=zv(n,"background",void 0),a=zv(n,"text",void 0);void 0===a&&(a=Iv(t)),this.textCropEnable=zv(n,"textCrop",!!a.setCrop);var o=zv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Fv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Ih(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Mv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Rv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Iv=function(t){return t.add.text(0,0,"")};Object.assign(jv.prototype,Xv);var Bv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Hv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Nv=Phaser.Utils.Objects.GetValue;class Vv extends kv{constructor(t,e){void 0===e&&(e={});var i=Nv(e,"text",void 0),s=Nv(e,"textWidth",void 0),r=Nv(e,"textHeight",void 0),n=Nv(e,"textCrop",!!i.setCrop),h=Nv(e,"textMask",!n),a=Nv(e,"content",""),o=new jv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Nv(e,"clampChildOY",!1),alwaysScrollable:Nv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Nv(e,"space",void 0);l&&(l.child=Nv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Vv.prototype,Bv,Hv);const Gv=Phaser.Utils.Objects.GetValue;var Uv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new np(t,e);break;case"bbcodetext":case"bbcode":s=new ep(t,0,0,"",e);break;case"label":s=new Kv(t,e);break;case"textarea":s=function(t,e,i){e=e?yo(e):{};var s=Gv(i,"background",xc),r=Gv(i,"text",Uv),n=Gv(i,"track",xc),h=Gv(i,"thumb",xc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Vv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new wc(t,e)}return yc(s,e),t.add.existing(s),s},$v=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new fc(t,e):new $d(t,e);break;case"roundRectangle":s=new Hl(t,e);break;default:s=new Zd(t,e)}return yc(s,e),t.add.existing(s),s};const Jv=Phaser.Utils.Objects.GetValue;class Kv extends gl{constructor(t,e,i){e=function(t,e,i){e=e?yo(e):{};var s=Jv(i,"background",xc),r=Jv(i,"text",Uv),n=Jv(i,"icon",$v),h=Jv(i,"action",$v);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return qv(this.getChildren(),"setActiveState",t),this}setHoverState(t){return qv(this.getChildren(),"setHoverState",t),this}setDisableState(t){return qv(this.getChildren(),"setDisableState",t),this}}var qv=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(mg(this),yg(this)),this}setNumberInput(){return this.onUpdateCallback=fg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Cg=Phaser.Utils.Objects.GetValue,wg=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Sg=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Rg.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Lg(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Dg=new Rg,Ag=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Yg=/\S/,Xg=new Rg;Xg.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Yg.test(t)&&!Yg.test(e)},Xg.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(jg(t,null,null,i),i," ")},Fg.equals=function(t,e){return Rg.prototype.equals.call(Fg,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Ig=new Rg;Ig.tokenize=function(t){return t.slice()},Ig.join=Ig.removeEmpty=function(t){return t};const Bg=Phaser.Utils.Array.Remove;var Hg=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Bg(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Dg.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},$g={cursorMoveLeft(){if(!this.isOpened)return this;var t=Vg(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Vg(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Gg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Vg(Ug(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Gg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Vg(Ug(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Jg=Phaser.Utils.Objects.IsPlainObject;class Kg extends hl{constructor(t,e,i,s,r,n){Jg(e)?n=e:Jg(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Sg(e,"wrap.vAlign")||Xd(e,"wrap.vAlign",s=i?"center":"top"),Sg(e,"wrap.wrapMode")||Xd(e,"wrap.wrapMode","char"),Sg(e,"wrap.maxLines")||Xd(e,"wrap.maxLines",s=i?1:void 0),i&&Xd(e,"wrap.wrapWidth",1/0),Sg(e,"wrap.useDefaultTextHeight")||Xd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Sg(e.edit,"inputType")){var s=i?"text":"textarea";Xd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Pg(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Xl(n.background,"focus"),o=Xl(n.style,"cursor"),l=Xl(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Cg(e,"edit");return void 0===i&&(i={}),tg(e,i,wg),new bg(t,i)}(this,n),Tg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Mg.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),kg.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),_g(l)&&Object.assign(l,o),Eg.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -19213,7 +19235,7 @@ var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -19759,6 +19781,33 @@ }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -20407,6 +20456,7 @@ var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -20434,19 +20484,41 @@ } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -20641,6 +20713,11 @@ return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rexcolorinput.min.js b/dist/rexcolorinput.min.js index d0bc0abb59..350bf19aa7 100644 --- a/dist/rexcolorinput.min.js +++ b/dist/rexcolorinput.min.js @@ -1,6 +1,6 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let _i=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=ki(t,"x",this.parent.scaleX),this.startY=ki(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=ki(e,"x",void 0),this.endY=ki(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Gi=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Ni),Ui.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ds,As,Ys,zs);const Ws=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,Xs);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},Ks=function(t,e){Gi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=kr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class kn{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=_n,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _n:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=_n,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=_n,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(kn.prototype,$e);var Tn={};const _n=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(Wn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(Wn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},zr.call(t,e),Fr.call(t,e),Br.call(t,e),Nr.call(t,e),Vn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,uh,fh,mh,yh,xh,bh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Oh=function(t){return"string"==typeof t&&(t=Sh[t]),t};const Ph=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Ph(e)?(e=kh(h=e,"x",0),i=kh(h,"y",0),s=kh(h,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Ph(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Ph(n)&&(n=kh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(kh(h,"space.item",0)),this.setStartChildIndex(kh(h,"startChildIndex",0)),this.setRTL(kh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Oh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,Ch);var _h=Phaser.Renderer.WebGL.Utils,Eh=function(t,e,i,s,r,n){for(var h=_h.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Ah=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Yh=Phaser.Renderer.Canvas.SetTransform;var zh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Lh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Eh(r,h,e,l,a,o),e.isStroked&&Rh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Yh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Wh.prototype,zh);const Fh=Phaser.Utils.Objects.GetValue;let jh=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Fh(t,"x",0),i=Fh(t,"y",0));var s=this.cornerRadius;s.tl=Ih(Fh(t,"tl",void 0),e,i),s.tr=Ih(Fh(t,"tr",void 0),e,i),s.bl=Ih(Fh(t,"bl",void 0),e,i),s.br=Ih(Fh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bh(this.cornerRadius.br,t)}};var Ih=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Hh(t),t},Bh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Fh(e,"x",0),t.y=Fh(e,"y",0)),Hh(t)},Hh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Gh=function(t){return t.x>0&&t.y>0},Vh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Nh=Phaser.Math.DegToRad;var Uh=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ra.prototype,Ta);const La=Phaser.Utils.String.Pad;var Da=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${La(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ya=Phaser.Math.DegToRad;var za=function(t){return!t.hasOwnProperty("convex")||t.convex},Xa=function(t){return t.x>0&&t.y>0},Wa=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,o,l,o,l,180,270,!1,h):Wa(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,s-o,l,o,l,270,360,!1,h):Wa(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,s-o,r-l,o,l,0,90,!1,h):Wa(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,o,r-l,o,l,90,180,!1,h):Wa(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},ja=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Fa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ia=Phaser.Utils.Objects.GetValue;class Ba extends Ra{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ia(e,"color",null),Ia(e,"color2",null),Ia(e,"horizontalGradient",!0)),this.setStroke(Ia(e,"stroke",null),Ia(e,"strokeThickness",2)),this.setCornerRadius(Ia(e,"cornerRadius",0),Ia(e,"cornerIteration",null))}set color(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Da(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){ja(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ha=Phaser.Utils.Objects.GetValue;class Ga extends Ra{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ha(e,"color",null),Ha(e,"color2",null),Ha(e,"horizontalGradient",!0)),this.setStroke(Ha(e,"stroke",null),Ha(e,"strokeThickness",2))}set color(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Da(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ha(t,"color2",null),Ha(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ha(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Va=Phaser.Utils.Objects.GetValue;let Na=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Va(t,"bold",!1)),this.setItalic(Va(t,"italic",!1)),this.setFontSize(Va(t,"fontSize","16px")),this.setFontFamily(Va(t,"fontFamily","Courier")),this.setColor(Va(t,"color","#fff")),this.setStrokeStyle(Va(t,"stroke",null),Va(t,"strokeThickness",0)),this.setShadow(Va(t,"shadowColor",null),Va(t,"shadowOffsetX",0),Va(t,"shadowOffsetY",0),Va(t,"shadowBlur",0)),this.setOffset(Va(t,"offsetX",0),Va(t,"offsetY",0)),this.setSpace(Va(t,"leftSpace",0),Va(t,"rightSpace",0)),this.setAlign(Va(t,"align",void 0)),this.setBackgroundColor(Va(t,"backgroundColor",null)),this.setBackgroundHeight(Va(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Va(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Da(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Da(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Da(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Da(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ua=Phaser.Utils.Array.Remove,$a=Phaser.Utils.Array.Remove,Ja="text",qa="image",Ka="drawer",Za="space",Qa="command";var to=function(t){return t.type===Ja&&"\n"===t.text},eo=function(t){return t.type===Ja&&"\f"===t.text},io=function(t){return t.type===Ja};class so extends Ra{constructor(t,e,i){super(t,Ja),this.updateTextFlag=!1,this.style=new Na(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ro=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const no=Phaser.Display.Canvas.CanvasPool;var ho=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=no.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),no.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ao extends Ra{constructor(t,e,i){super(t,qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){ho(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class oo extends Ra{constructor(t,e,i,s){super(t,Ka),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class lo extends Ra{constructor(t,e){super(t,Za),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class co extends ca{constructor(t,e,i,s,r){super(t,Qa),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function uo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>uo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=uo(t[i]));return e}var po=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const vo={none:0,word:1,char:2,character:2,mix:3};var go=/^[\x00-\x7F]+$/,fo=function(t){return go.test(t)},mo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Co.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Co.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=So(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=So(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=So(t,"wrapMode");void 0===c&&(c=So(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=vo[c]);var u=So(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=So(t,"letterSpacing",0),v=So(t,"hAlign",0),g=So(t,"vAlign",0),f=So(t,"justifyPercentage",.25),m=po({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ko(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=ko(t,"maxLines",0);var a=0===i,o=ko(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=ko(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=ko(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ko(t,"letterSpacing",0),p=ko(t,"rtl",!0),v=ko(t,"hAlign",p?2:0),g=ko(t,"vAlign",0),f=po({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===k,f.maxLineHeight=R,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ua(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return $a(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ja);return null===i?i=new so(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ka(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ko=Phaser.Utils.Objects.GetFastValue;var Zo={};class Qo{constructor(t){this.pools=Ko(t,"pools",Zo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(wl(this),Sl(this)),this}setNumberInput(){return this.onUpdateCallback=Cl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const kl=Phaser.Utils.Objects.GetValue,Tl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var _l=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}jl.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Il(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Bl=new jl,Hl=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Gl=/\S/,Vl=new jl;Vl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Gl.test(t)&&!Gl.test(e)},Vl.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Jl(t,null,null,i),i," ")},$l.equals=function(t,e){return jl.prototype.equals.call($l,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const ql=new jl;ql.tokenize=function(t){return t.slice()},ql.join=ql.removeEmpty=function(t){return t};const Kl=Phaser.Utils.Array.Remove;var Zl=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Kl(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Bl.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},sd={cursorMoveLeft(){if(!this.isOpened)return this;var t=td(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=td(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=ed(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=td(id(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=ed(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=td(id(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const rd=Phaser.Utils.Objects.IsPlainObject;class nd extends il{constructor(t,e,i,s,r,n){rd(e)?n=e:rd(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(_l(e,"wrap.vAlign")||Ml(e,"wrap.vAlign",s=i?"center":"top"),_l(e,"wrap.wrapMode")||Ml(e,"wrap.wrapMode","char"),_l(e,"wrap.maxLines")||Ml(e,"wrap.maxLines",s=i?1:void 0),i&&Ml(e,"wrap.wrapWidth",1/0),_l(e,"wrap.useDefaultTextHeight")||Ml(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!_l(e.edit,"inputType")){var s=i?"text":"textarea";Ml(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ll(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Dl(n.background,"focus"),o=Dl(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=kl(e,"edit");return void 0===i&&(i={}),nl(e,i,Tl),new Pl(t,i)}(this,n),Al.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Fl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Wl.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),_d(r)?(u.expandWidth=Ed(r,"width",!1),u.expandHeight=Ed(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Dd={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return vh.call(this,t),this}},Ad={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,pr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(kd.width=e.aspectRatio,kd.height=1,Td.width=l,Td.height=d,l=(c=Sd(kd,Td,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),eh(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,vr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Ad,Ld,Dd);const Yd=Phaser.Utils.Objects.IsPlainObject,zd=Phaser.Utils.Objects.GetValue;class Xd extends th{constructor(t,e,i,s,r,n){Yd(e)?(e=zd(n=e,"x",0),i=zd(n,"y",0),s=zd(n,"width",void 0),r=zd(n,"height",void 0)):Yd(s)&&(s=zd(n=s,"width",void 0),r=zd(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Xd.prototype,Ad);var Wd={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Fd extends oa{}Object.assign(Fd.prototype,Wd);const jd=Phaser.Display.Color,Id=Phaser.Math.Percent,Bd=Phaser.Display.Color,Hd=Phaser.Math.Percent,Gd=Phaser.Display.Color.ColorToRGBA,Vd=Phaser.Display.Color.HSVToRGB;class Nd extends Fd{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=2),super(t,e,i,s,r),this.type="rexColorPicker.HPaletteCanvas",this.colorObject=new Bd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Oh(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new jd;if(i)for(var h=0;h0&&r.push(o.join("")),r},Oc=0,Pc=1,kc=2,Tc=0,_c=1,Ec=2,Mc=/(?:\r\n|\r|\n)/;const Rc={none:Tc,word:_c,char:Ec,character:Ec,mix:3};var Lc=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof il}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):bc(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return yc(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const Dc=65535;var Ac=function(t,e,i){if(null==e)return t;if(0===e)return Xc(t,0,i),t;var s=t.text.length;if(0===s)return Xc(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},h=zc(t,r,e,i,n),a=0;a<=Dc&&0!==h;a++){if((r+=h)<0){r=0;break}h=zc(t,r,e,i,n)}return a===Dc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Xc(t,e,i),t},Yc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},zc=function(t,e,i,s,r){var n,h=Yc(t,e,r),a=Yc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Xc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Wc=Phaser.Utils.Objects.GetValue,Fc=Phaser.Utils.Objects.GetValue;class jc extends cc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Fc(e,"background",void 0),r=Fc(e,"icon",void 0),n=Fc(e,"iconMask",void 0),h=Fc(e,"text",void 0),a=Fc(e,"action",void 0),o=Fc(e,"actionMask",void 0),l=Fc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Fc(e,"space.icon",0),top:Fc(e,"space.iconTop",0),bottom:Fc(e,"space.iconBottom",0),left:Fc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Fc(e,"space.icon",0),left:Fc(e,"space.iconLeft",0),right:Fc(e,"space.iconRight",0),top:Fc(e,"space.iconTop",0)});var d=Fc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=fc.call(this,r,r,1)),!d){var c=Fc(e,"iconSize",void 0);this.setIconSize(Fc(e,"iconWidth",c),Fc(e,"iconHeight",c))}}if(h){var u=Fc(e,"wrapText",!1),p=Fc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Cc(t)){case 0:switch("string"==typeof e&&(e=Rc[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=wc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Rc[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Lc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Wc(e,"minWidth",0),s=Wc(e,"minHeight",0),r=Wc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Ac(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Ac(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Fc(e,"space.text",0),m=Fc(e,"expandTextWidth",!1),y=Fc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Fc(e,"space.actionTop",0),bottom:Fc(e,"space.actionBottom",0),right:Fc(e,"space.actionRight",0)}:{left:Fc(e,"space.actionLeft",0),right:Fc(e,"space.actionRight",0),bottom:Fc(e,"space.actionBottom",0)},d=Fc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=fc.call(this,a,a,1)),!d)){var x=Fc(e,"actionSize");this.setActionSize(Fc(e,"actionWidth",x),Fc(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}const Ic=Phaser.Utils.Objects.GetValue;class Bc extends ii{constructor(t,e){super(t,e),this.style=Ic(e,"style",this);var i=Ic(e,"propertiesMap");this.activeStyle=Hc(e,"active",i),this.hoverStyle=Hc(e,"hover",i),this.disableStyle=Hc(e,"disable",i),this.onModifyStyle=Ic(e,"onModifyStyle")}getStyle(t){return zl(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Xl(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Gc.call(this,"active",t),this}setHoverState(t){return Gc.call(this,"hover",t),this}setDisableState(t){return Gc.call(this,"disable",t),this}}var Hc=function(t,e,i){var s=Dl(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Gc=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},Vc={addStyleManager(t){return this.styleManager=new Bc(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};class Nc extends Kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=Uc,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const Uc={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Nc.prototype,Vc);const $c=Phaser.GameObjects.GetCalcMatrix,Jc=Phaser.Renderer.Canvas.SetTransform;var qc={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=$c(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var d,c=e.geom,u=0,p=c.length;u0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Au=Phaser.Utils.Objects.GetValue,Yu=Phaser.Utils.Objects.IsPlainObject;class zu extends(au(Qc)){constructor(t,e,i,s,r,n,h,a){Yu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Yu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Yu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Lu).setName("trackFill")).addShape((new Lu).setName("bar")).addShape((new Lu).setName("trackStroke")),this.setTrackColor(Au(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Au(a,"trackStrokeThickness",2),Au(a,"trackStrokeColor",void 0)),this.setSkewX(Au(a,"skewX",0)),this.setRTL(Au(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Xu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Du(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Du(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Du(a,0,0,e,i,t)}};Object.assign(zu.prototype,Xu);class Wu extends zu{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Ml(e,"easeValue.duration",e.easeDuration),Ml(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Fu,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const Fu={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Wu.prototype,Vc);var ju=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Iu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Bu=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=uo(i),s=uo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return ep(t)?(this.stretchMode.edge=sp(ip(t,"edge",0)),this.stretchMode.internal=sp(ip(t,"internal",0))):(t=sp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return np.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const ap=Phaser.Utils.Objects.IsPlainObject,op=Phaser.Utils.Objects.GetValue,lp=Phaser.GameObjects;var dp=void 0,cp=function(t,e){if(dp||(dp={},ti(t).events.once("destroy",(function(){for(var t in dp)dp[t].destroy();dp=void 0}))),!dp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new lp[e](i)).setOrigin(0),dp[e]=t}return dp[e]};const up=Phaser.GameObjects.RenderTexture;class pp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ap(i)?(i=op(d=i,"x",0),s=op(d,"y",0),r=op(d,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(r)?(r=op(d=r,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(h)?(h=op(d=h,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(a)?(a=op(d=a,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=op(d,"baseFrame",void 0)):ap(o)&&(o=op(d=o,"columns",void 0),l=op(d,"rows",void 0)),void 0===a&&(a=op(d,"frame",void 0)),void 0===o){var c=op(d,"leftWidth",void 0),u=op(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=op(d,"topHeight",void 0),v=op(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(op(d,"getFrameNameCallback",void 0)),this.setStretchMode(op(d,"stretchMode",0)),this.setPreserveRatio(op(d,"preserveRatio",!0));var g=op(d,"maxFixedPartScale",1),f=op(d,"maxFixedPartScaleX",g),m=op(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,hp),i}(up,"rexNinePatch")){}var vp={_drawImage:function(t,e,i,s,r,n){var h=cp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=cp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(pp.prototype,vp);let gp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ju(t,e))return t[e];var i=t.parent;return ju(i,e)?i[e]:void 0}set(t,e,i){return ju(t,e)?t[e]=i:ju(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const fp=Phaser.Utils.Objects.GetValue;class mp extends pp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=fp(e,"effects",!0);i&&Vu(this,i),this.style=new gp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(mp.prototype,Vc);const yp=["alpha","tint","flipX","flipY"];var xp=function(t,e){if(!e)return t;for(var i=0,s=yp.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let _i=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=ki(t,"x",this.parent.scaleX),this.startY=ki(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=ki(e,"x",void 0),this.endY=ki(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,h):s.resetFromJSON(h),s.restart(),s},Gi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Ni),Ui.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ds,As,Ys,zs);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Xs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},Ks=function(t,e){Gi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=kr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class kn{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=_n,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _n:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=_n,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=_n,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(kn.prototype,$e);var Tn={};const _n=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(Wn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(Wn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},zr.call(t,e),jr.call(t,e),Br.call(t,e),Nr.call(t,e),Vn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,uh,fh,mh,yh,xh,bh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Oh=function(t){return"string"==typeof t&&(t=Sh[t]),t};const Ph=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Ph(e)?(e=kh(h=e,"x",0),i=kh(h,"y",0),s=kh(h,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Ph(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Ph(n)&&(n=kh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(kh(h,"space.item",0)),this.setStartChildIndex(kh(h,"startChildIndex",0)),this.setRTL(kh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Oh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,Ch);var _h=Phaser.Renderer.WebGL.Utils,Eh=function(t,e,i,s,r,n){for(var h=_h.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Ah=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Yh=Phaser.Renderer.Canvas.SetTransform;var zh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Lh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Eh(r,h,e,l,a,o),e.isStroked&&Rh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Yh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Wh.prototype,zh);const jh=Phaser.Utils.Objects.GetValue;let Fh=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=jh(t,"x",0),i=jh(t,"y",0));var s=this.cornerRadius;s.tl=Ih(jh(t,"tl",void 0),e,i),s.tr=Ih(jh(t,"tr",void 0),e,i),s.bl=Ih(jh(t,"bl",void 0),e,i),s.br=Ih(jh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bh(this.cornerRadius.br,t)}};var Ih=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Hh(t),t},Bh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=jh(e,"x",0),t.y=jh(e,"y",0)),Hh(t)},Hh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Gh=function(t){return t.x>0&&t.y>0},Vh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Nh=Phaser.Math.DegToRad;var Uh=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ra.prototype,Ta);const La=Phaser.Utils.String.Pad;var Da=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${La(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ya=Phaser.Math.DegToRad;var za=function(t){return!t.hasOwnProperty("convex")||t.convex},Xa=function(t){return t.x>0&&t.y>0},Wa=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,o,l,o,l,180,270,!1,h):Wa(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,s-o,l,o,l,270,360,!1,h):Wa(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,s-o,r-l,o,l,0,90,!1,h):Wa(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,o,r-l,o,l,90,180,!1,h):Wa(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Fa=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),ja(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ia=Phaser.Utils.Objects.GetValue;class Ba extends Ra{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ia(e,"color",null),Ia(e,"color2",null),Ia(e,"horizontalGradient",!0)),this.setStroke(Ia(e,"stroke",null),Ia(e,"strokeThickness",2)),this.setCornerRadius(Ia(e,"cornerRadius",0),Ia(e,"cornerIteration",null))}set color(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Da(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Fa(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ha=Phaser.Utils.Objects.GetValue;class Ga extends Ra{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ha(e,"color",null),Ha(e,"color2",null),Ha(e,"horizontalGradient",!0)),this.setStroke(Ha(e,"stroke",null),Ha(e,"strokeThickness",2))}set color(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Da(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ha(t,"color2",null),Ha(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ha(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Va=Phaser.Utils.Objects.GetValue;let Na=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Va(t,"bold",!1)),this.setItalic(Va(t,"italic",!1)),this.setFontSize(Va(t,"fontSize","16px")),this.setFontFamily(Va(t,"fontFamily","Courier")),this.setColor(Va(t,"color","#fff")),this.setStrokeStyle(Va(t,"stroke",null),Va(t,"strokeThickness",0)),this.setShadow(Va(t,"shadowColor",null),Va(t,"shadowOffsetX",0),Va(t,"shadowOffsetY",0),Va(t,"shadowBlur",0)),this.setOffset(Va(t,"offsetX",0),Va(t,"offsetY",0)),this.setSpace(Va(t,"leftSpace",0),Va(t,"rightSpace",0)),this.setAlign(Va(t,"align",void 0)),this.setBackgroundColor(Va(t,"backgroundColor",null)),this.setBackgroundHeight(Va(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Va(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Va(t,"backgroundLeftX",0)),this.setBackgroundRightX(Va(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Da(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Da(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Da(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Da(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ua=Phaser.Utils.Array.Remove,$a=Phaser.Utils.Array.Remove,Ja="text",qa="image",Ka="drawer",Za="space",Qa="command";var to=function(t){return t.type===Ja&&"\n"===t.text},eo=function(t){return t.type===Ja&&"\f"===t.text},io=function(t){return t.type===Ja};class so extends Ra{constructor(t,e,i){super(t,Ja),this.updateTextFlag=!1,this.style=new Na(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ro=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const no=Phaser.Display.Canvas.CanvasPool;var ho=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=no.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),no.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ao extends Ra{constructor(t,e,i){super(t,qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){ho(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class oo extends Ra{constructor(t,e,i,s){super(t,Ka),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class lo extends Ra{constructor(t,e){super(t,Za),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class co extends ca{constructor(t,e,i,s,r){super(t,Qa),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function uo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>uo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=uo(t[i]));return e}var po=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const vo={none:0,word:1,char:2,character:2,mix:3};var go=/^[\x00-\x7F]+$/,fo=function(t){return go.test(t)},mo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Co.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Co.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=So(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=So(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=So(t,"wrapMode");void 0===c&&(c=So(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=vo[c]);var u=So(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=So(t,"letterSpacing",0),v=So(t,"hAlign",0),g=So(t,"vAlign",0),f=So(t,"justifyPercentage",.25),m=po({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ko(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=ko(t,"maxLines",0);var a=0===i,o=ko(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=ko(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=ko(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ko(t,"letterSpacing",0),p=ko(t,"rtl",!0),v=ko(t,"hAlign",p?2:0),g=ko(t,"vAlign",0),f=po({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===k,f.maxLineHeight=R,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ua(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return $a(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ja);return null===i?i=new so(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ka(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ko=Phaser.Utils.Objects.GetFastValue;var Zo={};class Qo{constructor(t){this.pools=Ko(t,"pools",Zo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(wl(this),Sl(this)),this}setNumberInput(){return this.onUpdateCallback=Cl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const kl=Phaser.Utils.Objects.GetValue,Tl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var _l=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Il.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Bl(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Hl=new Il,Gl=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Vl=/\S/,Nl=new Il;Nl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Vl.test(t)&&!Vl.test(e)},Nl.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(ql(t,null,null,i),i," ")},Jl.equals=function(t,e){return Il.prototype.equals.call(Jl,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Kl=new Il;Kl.tokenize=function(t){return t.slice()},Kl.join=Kl.removeEmpty=function(t){return t};const Zl=Phaser.Utils.Array.Remove;var Ql=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Zl(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Hl.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},rd={cursorMoveLeft(){if(!this.isOpened)return this;var t=ed(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=ed(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=id(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=ed(sd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=id(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=ed(sd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const nd=Phaser.Utils.Objects.IsPlainObject;class hd extends il{constructor(t,e,i,s,r,n){nd(e)?n=e:nd(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(_l(e,"wrap.vAlign")||Ml(e,"wrap.vAlign",s=i?"center":"top"),_l(e,"wrap.wrapMode")||Ml(e,"wrap.wrapMode","char"),_l(e,"wrap.maxLines")||Ml(e,"wrap.maxLines",s=i?1:void 0),i&&Ml(e,"wrap.wrapWidth",1/0),_l(e,"wrap.useDefaultTextHeight")||Ml(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!_l(e.edit,"inputType")){var s=i?"text":"textarea";Ml(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ll(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Dl(n.background,"focus"),o=Dl(n.style,"cursor"),l=Dl(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=kl(e,"edit");return void 0===i&&(i={}),nl(e,i,Tl),new Pl(t,i)}(this,n),Al.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Fl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Wl.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Yl(l)&&Object.assign(l,o),jl.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Ed(r)?(u.expandWidth=Md(r,"width",!1),u.expandHeight=Md(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Ad={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return vh.call(this,t),this}},Yd={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,pr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Td.width=e.aspectRatio,Td.height=1,_d.width=l,_d.height=d,l=(c=Od(Td,_d,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),eh(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,vr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Yd,Dd,Ad);const zd=Phaser.Utils.Objects.IsPlainObject,Xd=Phaser.Utils.Objects.GetValue;class Wd extends th{constructor(t,e,i,s,r,n){zd(e)?(e=Xd(n=e,"x",0),i=Xd(n,"y",0),s=Xd(n,"width",void 0),r=Xd(n,"height",void 0)):zd(s)&&(s=Xd(n=s,"width",void 0),r=Xd(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Wd.prototype,Yd);var jd={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Fd extends oa{}Object.assign(Fd.prototype,jd);const Id=Phaser.Display.Color,Bd=Phaser.Math.Percent,Hd=Phaser.Display.Color,Gd=Phaser.Math.Percent,Vd=Phaser.Display.Color.ColorToRGBA,Nd=Phaser.Display.Color.HSVToRGB;class Ud extends Fd{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=2),super(t,e,i,s,r),this.type="rexColorPicker.HPaletteCanvas",this.colorObject=new Hd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Oh(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new Id;if(i)for(var h=0;h0&&r.push(o.join("")),r},Pc=0,kc=1,Tc=2,_c=0,Ec=1,Mc=2,Rc=/(?:\r\n|\r|\n)/;const Lc={none:_c,word:Ec,char:Mc,character:Mc,mix:3};var Dc=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof il}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Cc(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return xc(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const Ac=65535;var Yc=function(t,e,i){if(null==e)return t;if(0===e)return Wc(t,0,i),t;var s=t.text.length;if(0===s)return Wc(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},h=Xc(t,r,e,i,n),a=0;a<=Ac&&0!==h;a++){if((r+=h)<0){r=0;break}h=Xc(t,r,e,i,n)}return a===Ac&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wc(t,e,i),t},zc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Xc=function(t,e,i,s,r){var n,h=zc(t,e,r),a=zc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Wc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const jc=Phaser.Utils.Objects.GetValue,Fc=Phaser.Utils.Objects.GetValue;class Ic extends uc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Fc(e,"background",void 0),r=Fc(e,"icon",void 0),n=Fc(e,"iconMask",void 0),h=Fc(e,"text",void 0),a=Fc(e,"action",void 0),o=Fc(e,"actionMask",void 0),l=Fc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Fc(e,"space.icon",0),top:Fc(e,"space.iconTop",0),bottom:Fc(e,"space.iconBottom",0),left:Fc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Fc(e,"space.icon",0),left:Fc(e,"space.iconLeft",0),right:Fc(e,"space.iconRight",0),top:Fc(e,"space.iconTop",0)});var d=Fc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=mc.call(this,r,r,1)),!d){var c=Fc(e,"iconSize",void 0);this.setIconSize(Fc(e,"iconWidth",c),Fc(e,"iconHeight",c))}}if(h){var u=Fc(e,"wrapText",!1),p=Fc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(wc(t)){case 0:switch("string"==typeof e&&(e=Lc[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Sc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Lc[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Dc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=jc(e,"minWidth",0),s=jc(e,"minHeight",0),r=jc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Yc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Yc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Fc(e,"space.text",0),m=Fc(e,"expandTextWidth",!1),y=Fc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Fc(e,"space.actionTop",0),bottom:Fc(e,"space.actionBottom",0),right:Fc(e,"space.actionRight",0)}:{left:Fc(e,"space.actionLeft",0),right:Fc(e,"space.actionRight",0),bottom:Fc(e,"space.actionBottom",0)},d=Fc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=mc.call(this,a,a,1)),!d)){var x=Fc(e,"actionSize");this.setActionSize(Fc(e,"actionWidth",x),Fc(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}const Bc=Phaser.Utils.Objects.GetValue;class Hc extends ii{constructor(t,e){super(t,e),this.style=Bc(e,"style",this);var i=Bc(e,"propertiesMap");this.activeStyle=Gc(e,"active",i),this.hoverStyle=Gc(e,"hover",i),this.disableStyle=Gc(e,"disable",i),this.onModifyStyle=Bc(e,"onModifyStyle")}getStyle(t){return zl(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Xl(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Vc.call(this,"active",t),this}setHoverState(t){return Vc.call(this,"hover",t),this}setDisableState(t){return Vc.call(this,"disable",t),this}}var Gc=function(t,e,i){var s=Dl(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Vc=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},Nc={addStyleManager(t){return this.styleManager=new Hc(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};class Uc extends Kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=$c,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const $c={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Uc.prototype,Nc);const Jc=Phaser.GameObjects.GetCalcMatrix,qc=Phaser.Renderer.Canvas.SetTransform;var Kc={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Jc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var d,c=e.geom,u=0,p=c.length;u0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Yu=Phaser.Utils.Objects.GetValue,zu=Phaser.Utils.Objects.IsPlainObject;class Xu extends(ou(tu)){constructor(t,e,i,s,r,n,h,a){zu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):zu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):zu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Du).setName("trackFill")).addShape((new Du).setName("bar")).addShape((new Du).setName("trackStroke")),this.setTrackColor(Yu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Yu(a,"trackStrokeThickness",2),Yu(a,"trackStrokeColor",void 0)),this.setSkewX(Yu(a,"skewX",0)),this.setRTL(Yu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Wu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Au(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Au(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Au(a,0,0,e,i,t)}};Object.assign(Xu.prototype,Wu);class ju extends Xu{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Ml(e,"easeValue.duration",e.easeDuration),Ml(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Fu,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const Fu={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(ju.prototype,Nc);var Iu=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Bu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Hu=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=uo(i),s=uo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return ip(t)?(this.stretchMode.edge=rp(sp(t,"edge",0)),this.stretchMode.internal=rp(sp(t,"internal",0))):(t=rp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return hp.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const op=Phaser.Utils.Objects.IsPlainObject,lp=Phaser.Utils.Objects.GetValue,dp=Phaser.GameObjects;var cp=void 0,up=function(t,e){if(cp||(cp={},ti(t).events.once("destroy",(function(){for(var t in cp)cp[t].destroy();cp=void 0}))),!cp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new dp[e](i)).setOrigin(0),cp[e]=t}return cp[e]};const pp=Phaser.GameObjects.RenderTexture;class vp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(op(i)?(i=lp(d=i,"x",0),s=lp(d,"y",0),r=lp(d,"width",1),n=lp(d,"height",1),h=lp(d,"key",void 0),a=lp(d,"baseFrame",void 0),o=lp(d,"columns",void 0),l=lp(d,"rows",void 0)):op(r)?(r=lp(d=r,"width",1),n=lp(d,"height",1),h=lp(d,"key",void 0),a=lp(d,"baseFrame",void 0),o=lp(d,"columns",void 0),l=lp(d,"rows",void 0)):op(h)?(h=lp(d=h,"key",void 0),a=lp(d,"baseFrame",void 0),o=lp(d,"columns",void 0),l=lp(d,"rows",void 0)):op(a)?(a=lp(d=a,"baseFrame",void 0),o=lp(d,"columns",void 0),l=lp(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=lp(d,"baseFrame",void 0)):op(o)&&(o=lp(d=o,"columns",void 0),l=lp(d,"rows",void 0)),void 0===a&&(a=lp(d,"frame",void 0)),void 0===o){var c=lp(d,"leftWidth",void 0),u=lp(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=lp(d,"topHeight",void 0),v=lp(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(lp(d,"getFrameNameCallback",void 0)),this.setStretchMode(lp(d,"stretchMode",0)),this.setPreserveRatio(lp(d,"preserveRatio",!0));var g=lp(d,"maxFixedPartScale",1),f=lp(d,"maxFixedPartScaleX",g),m=lp(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,ap),i}(pp,"rexNinePatch")){}var gp={_drawImage:function(t,e,i,s,r,n){var h=up(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=up(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(vp.prototype,gp);let fp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Iu(t,e))return t[e];var i=t.parent;return Iu(i,e)?i[e]:void 0}set(t,e,i){return Iu(t,e)?t[e]=i:Iu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const mp=Phaser.Utils.Objects.GetValue;class yp extends vp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=mp(e,"effects",!0);i&&Nu(this,i),this.style=new fp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(yp.prototype,Nc);const xp=["alpha","tint","flipX","flipY"];var bp=function(t,e){if(!e)return t;for(var i=0,s=xp.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Rp=Phaser.Display.Canvas.CanvasPool;var Lp=function(t){var e=Rp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Rp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Rp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Tc&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Rc[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Ap(t,l,d);else{var u=Dp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Ap(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Ap(t,"fill",null);null!==v&&(this.color=Da(v));var g=Ap(t,"metrics",!1);return g?this.metrics={ascent:Ap(g,"ascent",0),descent:Ap(g,"descent",0),fontSize:Ap(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Lp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Lp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Ap(t,"fontFamily","Courier"),this.fontSize=Ap(t,"fontSize","16px"),this.fontStyle=Ap(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Da(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Da(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Da(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Rc[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Ap(e,"fontFamily",this.fontFamily),this.fontSize=Ap(e,"fontSize",this.fontSize),this.fontStyle=Ap(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var zp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),ja(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Xp=Phaser.Utils.Objects.GetValue,Wp=Oc,Fp=Pc;class jp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Xp(t,"text",""),this.x=Xp(t,"x",0),this.y=Xp(t,"y",0),this.width=Xp(t,"width",0);var e=Xp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Xp(t,"newLineMode",0),this.startIndex=Xp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Fp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Wp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Fp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Ip=Phaser.Utils.Objects.GetFastValue,Bp=Oc,Hp=kc;class Gp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Ip(t,"tagToText",Xt),this.tagToTextScope=Ip(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Vp={};const Np=Phaser.Geom.Rectangle;var Up=new qo;class $p{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ov(g)){""!==x?h.push(n.getLine(x,b,ev)):0===C&&r>0&&h.push(n.getLine("",0,ev)),h.push(...hv(g,e,rv,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,ev)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},av=function(t,e){var i;switch(e){case sv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==dv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Gp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return fg(this.sizerChildren,null),vh.call(this,t),this}},yg={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)fg(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},wg={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,fg(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)fg(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Og=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Pg=Phaser.Utils.Objects.IsPlainObject,kg=Phaser.Utils.Objects.GetValue;class Tg extends th{constructor(t,e,i,s,r,n,h,a,o,l){Pg(e)?(e=kg(l=e,"x",0),i=kg(l,"y",0),s=kg(l,"width",void 0),r=kg(l,"height",void 0),n=kg(l,"column",l.col||0),h=kg(l,"row",0),a=kg(l,"columnProportions",0),o=kg(l,"rowProportions",0)):Pg(s)?(s=kg(l=s,"width",void 0),r=kg(l,"height",void 0),n=kg(l,"column",l.col||0),h=kg(l,"row",0),a=kg(l,"columnProportions",0),o=kg(l,"rowProportions",0)):Pg(n)?(n=kg(l=n,"column",l.col||0),h=kg(l,"row",0),a=kg(l,"columnProportions",0),o=kg(l,"rowProportions",0)):Pg(a)&&(a=kg(l=a,"columnProportions",0),o=kg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(kg(l,"createCellContainerCallback")),this.setIndentLeft(kg(l,"space.indentLeftOdd",0),kg(l,"space.indentLeftEven",0)),this.setIndentTop(kg(l,"space.indentTopOdd",0),kg(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,kg(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Sg.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Og.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Tg.prototype,wg);const _g=Phaser.Utils.Objects.GetValue,Eg=Phaser.Math.Percent;var Mg=function(t,e,i){var s;return t.y===e.y?s=Eg(i.x,t.x,e.x):t.x===e.x&&(s=Eg(i.y,t.y,e.y)),s},Rg=function(t,e,i){var s,r;this.enable&&(Lg.x=e,Lg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Mg(s,r,Lg))},Lg={},Dg=function(t,e,i){if(this.enable&&t.isDown){var s,r;Ag.x=t.worldX,Ag.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Mg(s,r,Ag);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Ag={},Yg=function(t,e){void 0===e&&(e=zg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},zg={};const Xg=Phaser.Display.Align.LEFT_CENTER,Wg=Phaser.Display.Align.TOP_CENTER;var Fg={};const jg=Phaser.Display.Align.RIGHT_CENTER,Ig=Phaser.Display.Align.BOTTOM_CENTER;var Bg={};const Hg=Phaser.Math.Linear;var Gg={};const Vg=Phaser.Display.Align.LEFT_CENTER,Ng=Phaser.Display.Align.TOP_CENTER,Ug=Phaser.Display.Align.RIGHT_CENTER,$g=Phaser.Display.Align.BOTTOM_CENTER,Jg=Phaser.Utils.Objects.GetValue,qg=Phaser.Utils.Objects.IsPlainObject,Kg=Phaser.Math.Clamp,Zg=Phaser.Math.Snap.To;class Qg extends(au(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Jg(e,"reverseAxis",!1);var i=Jg(e,"background",void 0),s=Jg(e,"track",void 0),r=Jg(e,"indicator",void 0),n=Jg(e,"thumb",void 0);if(i&&(qg(i)&&(i=bp(t,i)),this.addBackground(i)),s&&(qg(s)&&(s=bp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(qg(r)&&(r=bp(t,r)),this.pin(r)),n){qg(n)&&(n=bp(t,n)),this.pin(n);var h=Jg(e,"thumbOffsetX",0),a=Jg(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Jg(e,"input",0);switch("string"==typeof o&&(o=tf[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Rg,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Dg,this).on("pointermove",Dg,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Jg(e,"enable",void 0)),this.setGap(Jg(e,"gap",void 0)),this.setValue(Jg(e,"value",0),Jg(e,"min",void 0),Jg(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Zg(t,this.gap));var e=this._value;this._value=Kg(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const tf={pan:0,drag:0,click:1,none:-1};var ef={getStartPoint:function(t){if(void 0===t&&(t=Fg),this.childrenMap.thumb){var e=0===this.orientation?Xg:Wg;Yg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Bg),this.childrenMap.thumb){var e=0===this.orientation?jg:Ig;Yg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Gg),s.x=Hg(e.x,i.x,t),s.y=Hg(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?Ug:$g:0===this.orientation?Vg:Ng,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Qg.prototype,ef);const sf=Phaser.Utils.Objects.GetValue;class rf extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=sf(e,"background",void 0),n=sf(e,"buttons",void 0),h=sf(n,"top",sf(n,"left",void 0)),a=sf(n,"bottom",sf(n,"right",void 0)),o=sf(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===sf(o,"width",void 0)?1:0:void 0===sf(o,"height",void 0)?1:0,i=new Qg(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=sf(e,"valuechangeCallback",null);if(null!==d){var c=sf(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(sf(e,"enable",void 0)),this.setValue(sf(e,"value",0)),this.setScrollStep(sf(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class nf extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const hf=Phaser.Utils.Objects.GetValue,af=Phaser.Math.Distance.Between;class of extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=hf(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(hf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(hf(t,"enable",!0)),this.holdThreshold=hf(t,"holdThreshold",50),this.pointerOutReleaseEnable=hf(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:af(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const lf=Phaser.Utils.Objects.GetValue;class df{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(lf(t,"value",0)),this.setSpeed(lf(t,"speed",0)),this.setAcceleration(lf(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class cf{constructor(){this.value,this.dir,this.movement=new df}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const gf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},ff=Phaser.Utils.Objects.GetValue;class mf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=ff(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(ff(e,"speed",.1)),this.setEnable(ff(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(ff(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const yf=Phaser.Utils.Objects.GetValue;var xf=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?yf(s,l,void 0):yf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new rf(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=yf(r,"position",0);"string"==typeof p&&(p=bf[p]);var v,g,f=yf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=yf(s,"space.slider",void 0))&&(a?f=0:v=yf(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:yf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:yf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:yf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:yf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=yf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=yf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=yf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=yf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=yf(s,"scrollDetectionMode");"string"==typeof x&&(x=Cf[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?yf(s,b,!0):yf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new vf(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,k=yf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==x&&(k.focus=1===x?2:0),C=new mf(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const bf={right:0,left:1,bottom:0,top:1},Cf={gameObject:0,rectBounds:1},wf=Phaser.Utils.Objects.GetValue;var Sf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=wf(e,"width"),h=wf(e,"height");n||wf(e,"child.expandWidth",!0)||(s[1]=0),h||wf(e,"child.expandHeight",!0)||(r[1]=0);var a=new Tg(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=_g(i,"child"),r=_g(s,"gameObject",void 0);if(r){var n=_g(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=_g(n,"top",0),h.bottom=_g(n,"bottom",0),a.left=_g(n,"left",0),a.right=_g(n,"right",0);break;case 1:h.top=_g(n,"left",0),h.bottom=_g(n,"right",0),a.top=_g(n,"top",0),a.bottom=_g(n,"bottom",0);break;default:h.top=_g(n,"top",0),h.bottom=_g(n,"bottom",0),h.left=_g(n,"left",0),h.right=_g(n,"right",0)}e.add(r,{column:1,row:1,align:_g(s,"align","center"),padding:a,expand:{width:_g(s,"expandWidth",!0),height:_g(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:xf(t,a,"y",e);break;case 1:xf(t,a,"x",e);break;default:xf(t,a,"y",e),xf(t,a,"x",e)}return a},Of=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Pf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},kf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Lf.call(this,-this.textOY)),0),e=Df.call(this,t)+this.textOY,i=Af.call(this,t);return function(t,e){switch(Cc(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Yf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Xf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Yf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Ff=Phaser.Utils.Objects.IsPlainObject,jf=Phaser.Utils.Objects.GetValue,If=Phaser.Display.Align.TOP_LEFT;class Bf extends th{constructor(t,e,i,s,r,n){Ff(e)?(e=jf(n=e,"x",0),i=jf(n,"y",0),s=jf(n,"width",void 0),r=jf(n,"height",void 0)):Ff(s)&&(s=jf(n=s,"width",void 0),r=jf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=jf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(jf(n,"clampTextOY",!0)),this.alwaysScrollable=jf(n,"alwaysScrollable",!1);var h=jf(n,"background",void 0),a=jf(n,"text",void 0);void 0===a&&(a=Hf(t)),this.textCropEnable=jf(n,"textCrop",!!a.setCrop);var o=jf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=If,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Cc(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=fc.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Lf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Df.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Hf=function(t){return t.add.text(0,0,"")};Object.assign(Bf.prototype,Wf);var Gf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Vf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Nf=Phaser.Utils.Objects.GetValue;class Uf extends Mf{constructor(t,e){void 0===e&&(e={});var i=Nf(e,"text",void 0),s=Nf(e,"textWidth",void 0),r=Nf(e,"textHeight",void 0),n=Nf(e,"textCrop",!!i.setCrop),h=Nf(e,"textMask",!n),a=Nf(e,"content",""),o=new Bf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Nf(e,"clampChildOY",!1),alwaysScrollable:Nf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Nf(e,"space",void 0);l&&(l.child=Nf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Uf.prototype,Gf,Vf);const $f=Phaser.Utils.Objects.GetValue;var Jf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new hg(t,e);break;case"bbcodetext":case"bbcode":s=new ig(t,0,0,"",e);break;case"label":s=new Zf(t,e);break;case"textarea":s=function(t,e,i){e=e?uo(e):{};var s=$f(i,"background",bp),r=$f(i,"text",Jf),n=$f(i,"track",bp),h=$f(i,"thumb",bp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Uf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Sp(t,e)}return xp(s,e),t.add.existing(s),s},qf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new mp(t,e):new Ju(t,e);break;case"roundRectangle":s=new Nc(t,e);break;default:s=new Qu(t,e)}return xp(s,e),t.add.existing(s),s};const Kf=Phaser.Utils.Objects.GetValue;class Zf extends jc{constructor(t,e,i){e=function(t,e,i){e=e?uo(e):{};var s=Kf(i,"background",bp),r=Kf(i,"text",Jf),n=Kf(i,"icon",qf),h=Kf(i,"action",qf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Qf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Qf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Qf(this.getChildren(),"setDisableState",t),this}}var Qf=function(t,e,i){for(var s=0,r=t.length;s0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var h=new am(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(h),h};const lm=Phaser.Utils.Objects.GetValue;var dm=function(t,e){var i=lm(e,"expandDirection",void 0);"string"==typeof i&&(i=cm[i]);var s,r,n,h,a,o,l,d=(n="alignTargetX",_l(s=e,r="alignTarget")?ks(s,r):n&&_l(s,n)?ks(s,n):h&&_l(s,h)?ks(s,h):a),c=lm(e,"alignTargetY",d),u=lm(e,"alignOffsetX",0),p=lm(e,"alignOffsetY",0),v=lm(e,"alignSide","").includes("right"),g=lm(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,x=f||m?0:1;t.setOrigin(y,x),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var b=g;b||(b=Dt(t.scene)),m&&t.getBottomLeft().y>b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const cm={down:0,up:1},um=Phaser.Utils.Objects.GetValue;class pm extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Mi(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new _i(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),dm(t,e),t.isRexSizer&&t.layout();var i=um(e,"touchOutsideClose",!1),s=um(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var vm={openColorPicker:function(){if(!this.colorPicker){var t=om.call(this).layout(),e=new pm(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(vm,Cd);const gm=Phaser.Utils.Objects.GetValue;class fm extends bd{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(gm(i,"width",160),gm(i,"height",170));var n=gm(i,"background");r=n?function(t){return bp(t,n)}:gm(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(gm(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(gm(i,"expandDirection")),this.setColorPickerEaseInDuration(gm(i,"easeIn",200)),this.setColorPickerEaseOutDuration(gm(i,"easeOut",200)),this.setColorPickerTransitInCallback(gm(i,"transitIn")),this.setColorPickerTransitOutCallback(gm(i,"transitOut")),this.setColorPickerBounds(gm(i,"bounds"));var h=gm(i,"space");void 0===h&&(h={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(h)}var a=e.colorComponents;if(s&&!1!==a&&null!==a){this.setColorComponentsHeight(gm(a,"height",30)),this.setColorComponentsFormatLabelConfig(gm(a,"formatLabel"));var o=gm(a,"inputText");o||(o=gm(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=gm(a,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}return Object.assign(fm.prototype,vm),fm},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e(); + */const Lp=Phaser.Display.Canvas.CanvasPool;var Dp=function(t){var e=Lp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Lp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Lp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==_c&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Lc[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Yp(t,l,d);else{var u=Ap(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Yp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Yp(t,"fill",null);null!==v&&(this.color=Da(v));var g=Yp(t,"metrics",!1);return g?this.metrics={ascent:Yp(g,"ascent",0),descent:Yp(g,"descent",0),fontSize:Yp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Dp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Dp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Yp(t,"fontFamily","Courier"),this.fontSize=Yp(t,"fontSize","16px"),this.fontStyle=Yp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Da(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Da(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Da(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Lc[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Yp(e,"fontFamily",this.fontFamily),this.fontSize=Yp(e,"fontSize",this.fontSize),this.fontStyle=Yp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Xp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Fa(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Wp=Phaser.Utils.Objects.GetValue,jp=Pc,Fp=kc;class Ip{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Wp(t,"text",""),this.x=Wp(t,"x",0),this.y=Wp(t,"y",0),this.width=Wp(t,"width",0);var e=Wp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Wp(t,"newLineMode",0),this.startIndex=Wp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Fp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==jp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Fp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Bp=Phaser.Utils.Objects.GetFastValue,Hp=Pc,Gp=Tc;class Vp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Bp(t,"tagToText",Xt),this.tagToTextScope=Bp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Np={};const Up=Phaser.Geom.Rectangle;var $p=new qo;class Jp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&lv(g)){""!==x?h.push(n.getLine(x,b,iv)):0===C&&r>0&&h.push(n.getLine("",0,iv)),h.push(...av(g,e,nv,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,iv)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},ov=function(t,e){var i;switch(e){case rv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==cv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Vp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return mg(this.sizerChildren,null),vh.call(this,t),this}},xg={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)mg(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Sg={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,mg(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)mg(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Pg=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const kg=Phaser.Utils.Objects.IsPlainObject,Tg=Phaser.Utils.Objects.GetValue;class _g extends th{constructor(t,e,i,s,r,n,h,a,o,l){kg(e)?(e=Tg(l=e,"x",0),i=Tg(l,"y",0),s=Tg(l,"width",void 0),r=Tg(l,"height",void 0),n=Tg(l,"column",l.col||0),h=Tg(l,"row",0),a=Tg(l,"columnProportions",0),o=Tg(l,"rowProportions",0)):kg(s)?(s=Tg(l=s,"width",void 0),r=Tg(l,"height",void 0),n=Tg(l,"column",l.col||0),h=Tg(l,"row",0),a=Tg(l,"columnProportions",0),o=Tg(l,"rowProportions",0)):kg(n)?(n=Tg(l=n,"column",l.col||0),h=Tg(l,"row",0),a=Tg(l,"columnProportions",0),o=Tg(l,"rowProportions",0)):kg(a)&&(a=Tg(l=a,"columnProportions",0),o=Tg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Tg(l,"createCellContainerCallback")),this.setIndentLeft(Tg(l,"space.indentLeftOdd",0),Tg(l,"space.indentLeftEven",0)),this.setIndentTop(Tg(l,"space.indentTopOdd",0),Tg(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Tg(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Og.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Pg.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(_g.prototype,Sg);const Eg=Phaser.Utils.Objects.GetValue,Mg=Phaser.Math.Percent;var Rg=function(t,e,i){var s;return t.y===e.y?s=Mg(i.x,t.x,e.x):t.x===e.x&&(s=Mg(i.y,t.y,e.y)),s},Lg=function(t,e,i){var s,r;this.enable&&(Dg.x=e,Dg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Rg(s,r,Dg))},Dg={},Ag=function(t,e,i){if(this.enable&&t.isDown){var s,r;Yg.x=t.worldX,Yg.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Rg(s,r,Yg);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Yg={},zg=function(t,e){void 0===e&&(e=Xg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Xg={};const Wg=Phaser.Display.Align.LEFT_CENTER,jg=Phaser.Display.Align.TOP_CENTER;var Fg={};const Ig=Phaser.Display.Align.RIGHT_CENTER,Bg=Phaser.Display.Align.BOTTOM_CENTER;var Hg={};const Gg=Phaser.Math.Linear;var Vg={};const Ng=Phaser.Display.Align.LEFT_CENTER,Ug=Phaser.Display.Align.TOP_CENTER,$g=Phaser.Display.Align.RIGHT_CENTER,Jg=Phaser.Display.Align.BOTTOM_CENTER,qg=Phaser.Utils.Objects.GetValue,Kg=Phaser.Utils.Objects.IsPlainObject,Zg=Phaser.Math.Clamp,Qg=Phaser.Math.Snap.To;class tf extends(ou(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=qg(e,"reverseAxis",!1);var i=qg(e,"background",void 0),s=qg(e,"track",void 0),r=qg(e,"indicator",void 0),n=qg(e,"thumb",void 0);if(i&&(Kg(i)&&(i=Cp(t,i)),this.addBackground(i)),s&&(Kg(s)&&(s=Cp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Kg(r)&&(r=Cp(t,r)),this.pin(r)),n){Kg(n)&&(n=Cp(t,n)),this.pin(n);var h=qg(e,"thumbOffsetX",0),a=qg(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=qg(e,"input",0);switch("string"==typeof o&&(o=ef[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Lg,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Ag,this).on("pointermove",Ag,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(qg(e,"enable",void 0)),this.setGap(qg(e,"gap",void 0)),this.setValue(qg(e,"value",0),qg(e,"min",void 0),qg(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Qg(t,this.gap));var e=this._value;this._value=Zg(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const ef={pan:0,drag:0,click:1,none:-1};var sf={getStartPoint:function(t){if(void 0===t&&(t=Fg),this.childrenMap.thumb){var e=0===this.orientation?Wg:jg;zg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Hg),this.childrenMap.thumb){var e=0===this.orientation?Ig:Bg;zg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Vg),s.x=Gg(e.x,i.x,t),s.y=Gg(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?$g:Jg:0===this.orientation?Ng:Ug,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(tf.prototype,sf);const rf=Phaser.Utils.Objects.GetValue;class nf extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=rf(e,"background",void 0),n=rf(e,"buttons",void 0),h=rf(n,"top",rf(n,"left",void 0)),a=rf(n,"bottom",rf(n,"right",void 0)),o=rf(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===rf(o,"width",void 0)?1:0:void 0===rf(o,"height",void 0)?1:0,i=new tf(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=rf(e,"valuechangeCallback",null);if(null!==d){var c=rf(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(rf(e,"enable",void 0)),this.setValue(rf(e,"value",0)),this.setScrollStep(rf(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class hf extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const af=Phaser.Utils.Objects.GetValue,of=Phaser.Math.Distance.Between;class lf extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=af(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(af(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(af(t,"enable",!0)),this.holdThreshold=af(t,"holdThreshold",50),this.pointerOutReleaseEnable=af(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:of(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const df=Phaser.Utils.Objects.GetValue;class cf{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(df(t,"value",0)),this.setSpeed(df(t,"speed",0)),this.setAcceleration(df(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class uf{constructor(){this.value,this.dir,this.movement=new cf}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const ff={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},mf=Phaser.Utils.Objects.GetValue;class yf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=mf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(mf(e,"speed",.1)),this.setEnable(mf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(mf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const xf=Phaser.Utils.Objects.GetValue;var bf=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?xf(s,l,void 0):xf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new nf(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=xf(r,"position",0);"string"==typeof p&&(p=Cf[p]);var v,g,f=xf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=xf(s,"space.slider",void 0))&&(a?f=0:v=xf(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:xf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:xf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:xf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:xf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=xf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=xf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=xf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=xf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=xf(s,"scrollDetectionMode");"string"==typeof x&&(x=wf[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?xf(s,b,!0):xf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new gf(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,k=xf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==x&&(k.focus=1===x?2:0),C=new yf(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const Cf={right:0,left:1,bottom:0,top:1},wf={gameObject:0,rectBounds:1},Sf=Phaser.Utils.Objects.GetValue;var Of=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Sf(e,"width"),h=Sf(e,"height");n||Sf(e,"child.expandWidth",!0)||(s[1]=0),h||Sf(e,"child.expandHeight",!0)||(r[1]=0);var a=new _g(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Eg(i,"child"),r=Eg(s,"gameObject",void 0);if(r){var n=Eg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Eg(n,"top",0),h.bottom=Eg(n,"bottom",0),a.left=Eg(n,"left",0),a.right=Eg(n,"right",0);break;case 1:h.top=Eg(n,"left",0),h.bottom=Eg(n,"right",0),a.top=Eg(n,"top",0),a.bottom=Eg(n,"bottom",0);break;default:h.top=Eg(n,"top",0),h.bottom=Eg(n,"bottom",0),h.left=Eg(n,"left",0),h.right=Eg(n,"right",0)}e.add(r,{column:1,row:1,align:Eg(s,"align","center"),padding:a,expand:{width:Eg(s,"expandWidth",!0),height:Eg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:bf(t,a,"y",e);break;case 1:bf(t,a,"x",e);break;default:bf(t,a,"y",e),bf(t,a,"x",e)}return a},Pf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},kf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Tf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Df.call(this,-this.textOY)),0),e=Af.call(this,t)+this.textOY,i=Yf.call(this,t);return function(t,e){switch(wc(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,zf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Wf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,zf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Ff=Phaser.Utils.Objects.IsPlainObject,If=Phaser.Utils.Objects.GetValue,Bf=Phaser.Display.Align.TOP_LEFT;class Hf extends th{constructor(t,e,i,s,r,n){Ff(e)?(e=If(n=e,"x",0),i=If(n,"y",0),s=If(n,"width",void 0),r=If(n,"height",void 0)):Ff(s)&&(s=If(n=s,"width",void 0),r=If(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=If(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(If(n,"clampTextOY",!0)),this.alwaysScrollable=If(n,"alwaysScrollable",!1);var h=If(n,"background",void 0),a=If(n,"text",void 0);void 0===a&&(a=Gf(t)),this.textCropEnable=If(n,"textCrop",!!a.setCrop);var o=If(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Bf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=wc(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=mc.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Df.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Af.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Gf=function(t){return t.add.text(0,0,"")};Object.assign(Hf.prototype,jf);var Vf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Nf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Uf=Phaser.Utils.Objects.GetValue;class $f extends Rf{constructor(t,e){void 0===e&&(e={});var i=Uf(e,"text",void 0),s=Uf(e,"textWidth",void 0),r=Uf(e,"textHeight",void 0),n=Uf(e,"textCrop",!!i.setCrop),h=Uf(e,"textMask",!n),a=Uf(e,"content",""),o=new Hf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Uf(e,"clampChildOY",!1),alwaysScrollable:Uf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Uf(e,"space",void 0);l&&(l.child=Uf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign($f.prototype,Vf,Nf);const Jf=Phaser.Utils.Objects.GetValue;var qf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new ag(t,e);break;case"bbcodetext":case"bbcode":s=new sg(t,0,0,"",e);break;case"label":s=new Qf(t,e);break;case"textarea":s=function(t,e,i){e=e?uo(e):{};var s=Jf(i,"background",Cp),r=Jf(i,"text",qf),n=Jf(i,"track",Cp),h=Jf(i,"thumb",Cp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new $f(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Op(t,e)}return bp(s,e),t.add.existing(s),s},Kf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new yp(t,e):new qu(t,e);break;case"roundRectangle":s=new Uc(t,e);break;default:s=new tp(t,e)}return bp(s,e),t.add.existing(s),s};const Zf=Phaser.Utils.Objects.GetValue;class Qf extends Ic{constructor(t,e,i){e=function(t,e,i){e=e?uo(e):{};var s=Zf(i,"background",Cp),r=Zf(i,"text",qf),n=Zf(i,"icon",Kf),h=Zf(i,"action",Kf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return tm(this.getChildren(),"setActiveState",t),this}setHoverState(t){return tm(this.getChildren(),"setHoverState",t),this}setDisableState(t){return tm(this.getChildren(),"setDisableState",t),this}}var tm=function(t,e,i){for(var s=0,r=t.length;s0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var h=new om(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(h),h};const dm=Phaser.Utils.Objects.GetValue;var cm=function(t,e){var i=dm(e,"expandDirection",void 0);"string"==typeof i&&(i=um[i]);var s,r,n,h,a,o,l,d=(n="alignTargetX",_l(s=e,r="alignTarget")?ks(s,r):n&&_l(s,n)?ks(s,n):h&&_l(s,h)?ks(s,h):a),c=dm(e,"alignTargetY",d),u=dm(e,"alignOffsetX",0),p=dm(e,"alignOffsetY",0),v=dm(e,"alignSide","").includes("right"),g=dm(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,x=f||m?0:1;t.setOrigin(y,x),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var b=g;b||(b=Dt(t.scene)),m&&t.getBottomLeft().y>b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const um={down:0,up:1},pm=Phaser.Utils.Objects.GetValue;class vm extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Mi(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new _i(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),cm(t,e),t.isRexSizer&&t.layout();var i=pm(e,"touchOutsideClose",!1),s=pm(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var gm={openColorPicker:function(){if(!this.colorPicker){var t=lm.call(this).layout(),e=new vm(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(gm,wd);const fm=Phaser.Utils.Objects.GetValue;class mm extends Cd{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(fm(i,"width",160),fm(i,"height",170));var n=fm(i,"background");r=n?function(t){return Cp(t,n)}:fm(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(fm(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(fm(i,"expandDirection")),this.setColorPickerEaseInDuration(fm(i,"easeIn",200)),this.setColorPickerEaseOutDuration(fm(i,"easeOut",200)),this.setColorPickerTransitInCallback(fm(i,"transitIn")),this.setColorPickerTransitOutCallback(fm(i,"transitOut")),this.setColorPickerBounds(fm(i,"bounds"));var h=fm(i,"space");void 0===h&&(h={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(h)}var a=e.colorComponents;if(s&&!1!==a&&null!==a){this.setColorComponentsHeight(fm(a,"height",30)),this.setColorComponentsFormatLabelConfig(fm(a,"formatLabel"));var o=fm(a,"inputText");o||(o=fm(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=fm(a,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}return Object.assign(mm.prototype,gm),mm},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e(); diff --git a/dist/rexconfirmdialog.js b/dist/rexconfirmdialog.js index 553255e6a5..0ded0431af 100644 --- a/dist/rexconfirmdialog.js +++ b/dist/rexconfirmdialog.js @@ -19681,6 +19681,8 @@ this.setBackgroundColor(GetValue$D(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$D(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$D(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$D(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$D(o, 'backgroundRightX', 0)); return this; } @@ -19751,6 +19753,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -19905,6 +19913,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -20332,20 +20350,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rexconfirmdialog.min.js b/dist/rexconfirmdialog.min.js index 272c727466..337462e2e2 100644 --- a/dist/rexconfirmdialog.min.js +++ b/dist/rexconfirmdialog.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},B=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},ze=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const zi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(zi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(zi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(zi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Ai),Yi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ws={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Ys,Xs,Bs,Ws);const Is=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,js);var Hs=function(t){if(t.parentContainer)return Hs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Hs(e):t};class Ns extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Hs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Gs=Phaser.GameObjects.Rectangle;class Vs extends Gs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Us=Phaser.Utils.Objects.GetValue;class $s extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Us(t,"hitAreaMode",0)),this.setEnable(Us(t,"enable",!0)),this.setStopMode(Us(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class qs extends Vs{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new $s(this,{hitAreaMode:1})}}var Zs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},tr=function(t,e){Ni(t,e,!1)},er=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const ir=Phaser.Utils.Objects.GetValue;let sr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=rr.popUp),null==e.transitOut&&(e.transitOut=rr.scaleDown),e.destroy=ir(e,"destroy",!0),super(t,e);var i=ir(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(ir(i,"transitIn",Qs)),this.setCoverTransitOutCallback(ir(i,"transitOut",tr)));var s=ir(e,"touchOutsideClose",!1),r=ir(e,"duration.hold",-1),n=ir(e,"timeOutClose",r>=0),h=ir(e,"anyTouchClose",!1);ir(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),ir(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&er(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.popUp:t=Zs.popUp;break;case rr.fadeIn:t=Zs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.scaleDown:t=Zs.scaleDown;break;case rr.fadeOut:t=Zs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const rr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var nr=function(t){return t&&"function"==typeof t},hr={modal(t,e){return nr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ar=function(t,e,i,s,r){nr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},or={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ar.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ar.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ar.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ar.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ar.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ar.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ar.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ar.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ar.call(this,"shutdown",t,e,i,s),this}},lr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},dr={},cr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?er(t,e.x,e.y,i,s):!!(r=lr(e,n,!0))&&er(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Cr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const kr=Phaser.Utils.Objects.GetValue;class Er extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=kr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(kr(t,"enable",!0)),this.setMode(kr(t,"mode",1)),this.setClickInterval(kr(t,"clickInterval",100)),this.setDragThreshold(kr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Mr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:cr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Mr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends zs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Dr=Phaser.Utils.Objects.GetValue;class zr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(Dr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Dr(t,"enable",!0)),this.setCooldown(Dr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===tn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=en,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&cr(t,s,e,i)}}const Qr=0,tn=1,en="IDLE",sn=Phaser.Utils.Objects.GetValue,rn=Phaser.Math.Distance.Between;class nn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(sn(t,"time",250)),this.setTapInterval(sn(t,"tapInterval",200)),this.setDragThreshold(sn(t,"threshold",9)),this.setTapOffset(sn(t,"tapOffset",10));var e=sn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(sn(t,"maxTaps",void 0)),this.setMinTaps(sn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=an;break;case an:var t=this.lastPointer;rn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=on,this.state=an);break;case on:this.state=an}}onDragEnd(){this.state===an&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=on))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===an){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=on:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&(this.state=hn)}get isTapped(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED",ln=Phaser.Utils.Objects.GetValue;class dn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=cn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ln(t,"threshold",9)),this.setHoldTime(ln(t,"time",251)),this}onDragStart(){this.state=un,0===this.holdTime&&(this.state=pn)}onDragEnd(){this.state=cn}onDrag(){this.state!==cn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=cn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===un&&t-this.pointer.downTime>=this.holdTime&&(this.state=pn)}get isPressed(){return this.state===pn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const cn="IDLE",un="BEGIN",pn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ti(t).loop.delta};const gn=Phaser.Math.Distance.Between,fn=Phaser.Math.Angle.Between;var mn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return gn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},bn={};const xn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class Cn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=wn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=wn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=wn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=bn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Cn.prototype,mn);const wn="IDLE",On="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,kn=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Mn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=zn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Dn:this.tracerState=Ln,this.onDrag1End();break;case zn:this.tracerState=Dn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Dn:this.onDrag1();break;case zn:this.onDrag2()}}}dragCancel(){return this.tracerState===zn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return kn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&cr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&cr(t,s,e,i)}}Object.assign(Mn.prototype,$e);var Rn={};const Ln=0,Dn=1,zn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},Bn={};const Wn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,Fn=Phaser.Math.RadToDeg,Hn=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Fn(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Un}break;case Un:t=jn(Fn(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Un}get rotation(){return Hn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Gn="IDLE",Vn="BEGIN",Un="RECOGNIZED",$n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new nn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new dn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t){var e=Zn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Cn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const th=Phaser.Utils.Objects.GetValue;var eh=function(t,e){return t.setInteractive(),th(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:th(e,"targets",[t]),targetMode:th(e,"targetMode","parent"),eventEmitter:th(e,"eventEmitter",t),eventNamePrefix:th(e,"inputEventPrefix","child.")},jr.call(t,e),Hr.call(t,e),Vr.call(t,e),Kr.call(t,e),Jn.call(t,e),qn.call(t,e),Qn.call(t,e),t},ih={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=vh[e];else if(ch(e)){var f;e=uh(f=e,"proportion",void 0),i=uh(f,"align",ph),s=uh(f,"padding",0),r=uh(f,"expand",!1),n=uh(f,"key",void 0),h=uh(f,"index",void 0),t.isRexSizer||(a=uh(f,"minWidth",void 0),o=uh(f,"minHeight",void 0)),l=uh(f,"fitRatio",0),d=uh(f,"offsetX",0),c=uh(f,"offsetY",0),u=uh(f,"offsetOriginX",0),p=uh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const mh=Et.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},Ch={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},wh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,S=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ah.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ah.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,fh,xh,Sh,Ch,wh,Oh);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},kh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Eh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,h){Eh(e)?(e=Mh(h=e,"x",0),i=Mh(h,"y",0),s=Mh(h,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(s)?(s=Mh(h=s,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(n)&&(n=Mh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Mh(h,"space.item",0)),this.setStartChildIndex(Mh(h,"startChildIndex",0)),this.setRTL(Mh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=kh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Ph);var Lh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Dh[i])}void 0===s?s={}:!0===s&&(s=zh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Dh={fit:0,FIT:0,envelop:1,ENVELOP:1};var zh={},Ah={},Yh={};const Xh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Display.Align.CENTER,jh=Phaser.Utils.String.UUID;var Ih={add:function(t,e,i,s,r,n,h,a,o,l){var d,c;me.call(this,t),Xh(e)&&(e=Bh(u=e,"key",void 0),i=Bh(u,"align",Wh),s=Bh(u,"padding",0),r=Bh(u,"expand",!0),t.isRexSizer||(n=Bh(u,"minWidth",t._minWidth),h=Bh(u,"minHeight",t._minHeighted)),a=Bh(u,"offsetX",0),o=Bh(u,"offsetY",0),d=Bh(u,"offsetOriginX",0),c=Bh(u,"offsetOriginY",0),l=Bh(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=jh()),"string"==typeof i&&(i=Yt[i]),void 0===i&&(i=Wh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Xh(r)?(u.expandWidth=Bh(r,"width",!1),u.expandHeight=Bh(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Fh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return yh.call(this,t),this}},Hh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ah.width=e.aspectRatio,Ah.height=1,Yh.width=l,Yh.height=d,l=(c=Lh(Ah,Yh,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),nh(t,this)):Ne(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Hh,Ih,Fh);const Nh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Vh extends rh{constructor(t,e,i,s,r,n){Nh(e)?(e=Gh(n=e,"x",0),i=Gh(n,"y",0),s=Gh(n,"width",void 0),r=Gh(n,"height",void 0)):Nh(s)&&(s=Gh(n=s,"width",void 0),r=Gh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Vh.prototype,Hh);const Uh=Rh.prototype.add,$h=Rh.prototype.addSpace;var Jh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&$h.call(this),Uh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&$h.call(this),this.hasTailSpace=s}else Uh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Uh.call(this,t,{index:r,proportion:i,expand:!0})}else Uh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Kh={addButton(t){if(ur(t))for(var e=t,i=0,s=e.length;i=0;i--)Qh.call(this,e[i],t);return this}},ea=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ia=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ea.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},sa={add(t){return this.buttons.push(t),t._click||(t._click=new Cr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ia.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=ma(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=ma(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue,Sa=Phaser.Display.Align.CENTER;var Ca=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(me.call(this,t),ba(e)&&(e=xa(o=e,"padding",0),i=xa(o,"key",void 0),s=xa(o,"index",void 0),r=xa(o,"offsetX",0),n=xa(o,"offsetY",0),h=xa(o,"offsetOriginX",0),a=xa(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Sa,o.padding=ge(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},wa={add(t,e,i){if(ur(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},_a={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Da.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Ba.call(this,e[i],t);return this}};const ja=Phaser.Utils.Objects.GetValue;class Ia extends Ra{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new da({parent:this,eventEmitter:ja(e,"eventEmitter",this),groupName:ja(e,"groupName",void 0),clickConfig:ja(e,"click",void 0)}).setButtonsType(e);var s=ja(e,"background",void 0),r=ja(e,"buttons",void 0);this.buttonsAlign=ja(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ia.prototype,Aa,Wa,la,ua);var Fa=function(){return Array.prototype.reduce.call(arguments,Ha,0)},Ha=function(t,e){return t+e};const Na=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Va=Phaser.Display.Align.CENTER;var Ua=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ja(this.sizerChildren,null),yh.call(this,t),this}},qa={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ja(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},eo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ja(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ja(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},so=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ro=Phaser.Utils.Objects.IsPlainObject,no=Phaser.Utils.Objects.GetValue;class ho extends rh{constructor(t,e,i,s,r,n,h,a,o,l){ro(e)?(e=no(l=e,"x",0),i=no(l,"y",0),s=no(l,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(s)?(s=no(l=s,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(n)?(n=no(l=n,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(a)&&(a=no(l=a,"columnProportions",0),o=no(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(no(l,"createCellContainerCallback")),this.setIndentLeft(no(l,"space.indentLeftOdd",0),no(l,"space.indentLeftEven",0)),this.setIndentTop(no(l,"space.indentTopOdd",0),no(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,no(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=io.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=so.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ho.prototype,eo);const ao=ho.prototype.add;var oo={addButton(t,e,i){return ao.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uo.call(this,e[i],t);return this}};const vo=Phaser.Utils.Objects.GetValue;class go extends ho{constructor(t,e){void 0===e&&(e={});var i=vo(e,"row",0),s=vo(e,"column",e.col||0),r=vo(e,"createCellContainerCallback"),n=vo(e,"buttons",void 0),h=vo(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},Ho=0,No=1,Go=2,Vo=0,Uo=1,$o=2,Jo=/(?:\r\n|\r|\n)/;const Ko={none:Vo,word:Uo,char:$o,character:$o,mix:3},qo=Phaser.Renderer.WebGL.Utils;var Zo={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=qo.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Qo=Phaser.Display.Color;var tl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Qo);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},el=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},il={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,el(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const sl=Phaser.Display.Canvas.CanvasPool,rl=Phaser.GameObjects.GameObject,nl=Phaser.Utils.String.UUID;class hl extends rl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=sl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=nl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){sl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const al=Phaser.GameObjects.Components;Phaser.Class.mixin(hl,[al.Alpha,al.BlendMode,al.Crop,al.Depth,al.Flip,al.GetBounds,al.Mask,al.Origin,al.Pipeline,al.PostPipeline,al.ScrollFactor,al.Tint,al.Transform,al.Visible,Zo,tl,il]);var ol={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ll{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ll.prototype,ol);var dl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const cl=Phaser.Math.RotateAround;var ul;const pl=Phaser.Geom.Rectangle;var vl,gl=function(t){void 0===vl&&(vl=new pl);var e=t.drawTLX,i=t.drawTLY;return vl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),vl};const fl=Phaser.Math.RotateAround;var ml,yl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ml&&(ml={}),s=ml),s.x=e,s.y=i,0!==t.rotation&&fl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const bl=Phaser.GameObjects.Components.TransformMatrix;var xl,Sl,Cl={},wl=function(t,e,i,s,r){var n=yl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Cl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===xl&&(xl=new bl,Sl=new bl),t.parentContainer?t.getWorldTransformMatrix(xl,Sl):xl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),xl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ol=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return wl(t,e,n,h,r)},Pl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ul&&(ul={}),s=ul),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&cl(s,0,0,-i.rotation),s}(t,e,this,!0);return gl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ol(this.parent,this,t,e,i)}};Object.assign(Pl,dl);const _l=Phaser.Math.DegToRad,Tl=Phaser.Math.RadToDeg,kl=Phaser.Utils.Objects.GetValue;class El extends ll{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Tl(this._rotation)}set angle(t){this.rotation=_l(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=kl(t,"width",void 0),i=kl(t,"height",void 0),s=kl(t,"scaleX",void 0),r=kl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(El.prototype,Pl);const Ml=Phaser.Utils.String.Pad;var Rl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ml(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ll=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Dl=Phaser.Utils.Objects.GetValue;let zl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Dl(t,"x",0),i=Dl(t,"y",0));var s=this.cornerRadius;s.tl=Al(Dl(t,"tl",void 0),e,i),s.tr=Al(Dl(t,"tr",void 0),e,i),s.bl=Al(Dl(t,"bl",void 0),e,i),s.br=Al(Dl(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Yl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Yl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Yl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Yl(this.cornerRadius.br,t)}};var Al=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xl(t),t},Yl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Dl(e,"x",0),t.y=Dl(e,"y",0)),Xl(t)},Xl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Bl=Phaser.Math.DegToRad;var Wl=function(t){return!t.hasOwnProperty("convex")||t.convex},jl=function(t){return t.x>0&&t.y>0},Il=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,jl(a)?(o=a.x*g,l=a.y*f,Wl(a)?Il(t,o,l,o,l,180,270,!1,h):Il(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,jl(a)?(o=a.x*g,l=a.y*f,Wl(a)?Il(t,s-o,l,o,l,270,360,!1,h):Il(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,jl(a)?(o=a.x*g,l=a.y*f,Wl(a)?Il(t,s-o,r-l,o,l,0,90,!1,h):Il(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,jl(a)?(o=a.x*g,l=a.y*f,Wl(a)?Il(t,o,r-l,o,l,90,180,!1,h):Il(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Hl=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Fl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Nl=Phaser.Utils.Objects.GetValue;class Gl extends El{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Nl(e,"color",null),Nl(e,"color2",null),Nl(e,"horizontalGradient",!0)),this.setStroke(Nl(e,"stroke",null),Nl(e,"strokeThickness",2)),this.setCornerRadius(Nl(e,"cornerRadius",0),Nl(e,"cornerIteration",null))}set color(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ll("color2",t,this),Ll("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ll("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ll("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Hl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Vl=Phaser.Utils.Objects.GetValue;class Ul extends El{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Vl(e,"color",null),Vl(e,"color2",null),Vl(e,"horizontalGradient",!0)),this.setStroke(Vl(e,"stroke",null),Vl(e,"strokeThickness",2))}set color(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Vl(t,"color2",null),Vl(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Vl(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const $l=Phaser.Utils.Objects.GetValue;let Jl=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold($l(t,"bold",!1)),this.setItalic($l(t,"italic",!1)),this.setFontSize($l(t,"fontSize","16px")),this.setFontFamily($l(t,"fontFamily","Courier")),this.setColor($l(t,"color","#fff")),this.setStrokeStyle($l(t,"stroke",null),$l(t,"strokeThickness",0)),this.setShadow($l(t,"shadowColor",null),$l(t,"shadowOffsetX",0),$l(t,"shadowOffsetY",0),$l(t,"shadowBlur",0)),this.setOffset($l(t,"offsetX",0),$l(t,"offsetY",0)),this.setSpace($l(t,"leftSpace",0),$l(t,"rightSpace",0)),this.setAlign($l(t,"align",void 0)),this.setBackgroundColor($l(t,"backgroundColor",null)),this.setBackgroundHeight($l(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($l(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ll("stroke",t,this),Ll("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ll("shadowOffsetX",t,this),Ll("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Rl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Rl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Rl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Rl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Kl=Phaser.Utils.Array.Remove,ql=Phaser.Utils.Array.Remove,Zl="text",Ql="image",td="drawer",ed="space",id="command";var sd=function(t){return t.type===Zl&&"\n"===t.text},rd=function(t){return t.type===Zl&&"\f"===t.text},nd=function(t){return t.type===Zl};class hd extends El{constructor(t,e,i){super(t,Zl),this.updateTextFlag=!1,this.style=new Jl(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ad=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const od=Phaser.Display.Canvas.CanvasPool;var ld=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=od.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),od.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class dd extends El{constructor(t,e,i){super(t,Ql),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){ld(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class cd extends El{constructor(t,e,i,s){super(t,td),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class ud extends El{constructor(t,e){super(t,ed),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class pd extends ll{constructor(t,e,i,s,r){super(t,id),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function vd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>vd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=vd(t[i]));return e}var gd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const fd={none:0,word:1,char:2,character:2,mix:3};var md=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Sd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Sd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=wd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=wd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=wd(t,"wrapMode");void 0===c&&(c=wd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=fd[c]);var u=wd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=wd(t,"letterSpacing",0),v=wd(t,"hAlign",0),g=wd(t,"vAlign",0),f=wd(t,"justifyPercentage",.25),m=gd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_d(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_d(t,"maxLines",0);var a=0===i,o=_d(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_d(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=_d(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_d(t,"letterSpacing",0),p=_d(t,"rtl",!0),v=_d(t,"hAlign",p?2:0),g=_d(t,"vAlign",0),f=gd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,B=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Kl(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ql(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Zl);return null===i?i=new hd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ol(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const qd=Phaser.Utils.Objects.GetFastValue;var Zd={};class Qd{constructor(t){this.pools=qd(t,"pools",Zd)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Kd),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=ac(t,r,e,i,n),a=0;a<=rc&&0!==h;a++){if((r+=h)<0){r=0;break}h=ac(t,r,e,i,n)}return a===rc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),oc(t,e,i),t},hc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ac=function(t,e,i,s,r){var n,h=hc(t,e,r),a=hc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},oc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const lc=Phaser.Utils.Objects.GetValue,dc=Phaser.Utils.Objects.GetValue;class cc extends To{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=dc(e,"background",void 0),r=dc(e,"icon",void 0),n=dc(e,"iconMask",void 0),h=dc(e,"text",void 0),a=dc(e,"action",void 0),o=dc(e,"actionMask",void 0),l=dc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:dc(e,"space.icon",0),top:dc(e,"space.iconTop",0),bottom:dc(e,"space.iconBottom",0),left:dc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:dc(e,"space.icon",0),left:dc(e,"space.iconLeft",0),right:dc(e,"space.iconRight",0),top:dc(e,"space.iconTop",0)});var d=dc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Do.call(this,r,r,1)),!d){var c=dc(e,"iconSize",void 0);this.setIconSize(dc(e,"iconWidth",c),dc(e,"iconHeight",c))}}if(h){var u=dc(e,"wrapText",!1),p=dc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Bo(t)){case 0:switch("string"==typeof e&&(e=Ko[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Io;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Ko[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,sc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=lc(e,"minWidth",0),s=lc(e,"minHeight",0),r=lc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return nc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),nc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=dc(e,"space.text",0),m=dc(e,"expandTextWidth",!1),y=dc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:dc(e,"space.actionTop",0),bottom:dc(e,"space.actionBottom",0),right:dc(e,"space.actionRight",0)}:{left:dc(e,"space.actionLeft",0),right:dc(e,"space.actionRight",0),bottom:dc(e,"space.actionBottom",0)},d=dc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Do.call(this,a,a,1)),!d)){var b=dc(e,"actionSize");this.setActionSize(dc(e,"actionWidth",b),dc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var uc=Phaser.Renderer.WebGL.Utils,pc=function(t,e,i,s,r,n){for(var h=uc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},yc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const bc=Phaser.Renderer.Canvas.SetTransform;var xc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=fc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&pc(r,h,e,l,a,o),e.isStroked&&gc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(bc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Cc.prototype,xc);var wc=function(t){return t.x>0&&t.y>0},Oc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Pc=Phaser.Math.DegToRad;var _c=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Pu=Phaser.Utils.Objects.GetValue,_u=Phaser.Utils.Objects.IsPlainObject;class Tu extends(Zc(Nc)){constructor(t,e,i,s,r,n,h,a){_u(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):_u(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):_u(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new wu).setName("trackFill")).addShape((new wu).setName("bar")).addShape((new wu).setName("trackStroke")),this.setTrackColor(Pu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Pu(a,"trackStrokeThickness",2),Pu(a,"trackStrokeColor",void 0)),this.setSkewX(Pu(a,"skewX",0)),this.setRTL(Pu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ku={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ou(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ou(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ou(a,0,0,e,i,t)}};Object.assign(Tu.prototype,ku);var Eu=function(t){return null==t||""===t||0===t.length},Mu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Eu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Eu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=vd(i),s=vd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return $u(t)?(this.stretchMode.edge=Ku(Ju(t,"edge",0)),this.stretchMode.internal=Ku(Ju(t,"internal",0))):(t=Ku(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Zu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const tp=Phaser.Utils.Objects.IsPlainObject,ep=Phaser.Utils.Objects.GetValue,ip=Phaser.GameObjects;var sp=void 0,rp=function(t,e){if(sp||(sp={},ti(t).events.once("destroy",(function(){for(var t in sp)sp[t].destroy();sp=void 0}))),!sp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new ip[e](i)).setOrigin(0),sp[e]=t}return sp[e]};const np=Phaser.GameObjects.RenderTexture;class hp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(tp(i)?(i=ep(d=i,"x",0),s=ep(d,"y",0),r=ep(d,"width",1),n=ep(d,"height",1),h=ep(d,"key",void 0),a=ep(d,"baseFrame",void 0),o=ep(d,"columns",void 0),l=ep(d,"rows",void 0)):tp(r)?(r=ep(d=r,"width",1),n=ep(d,"height",1),h=ep(d,"key",void 0),a=ep(d,"baseFrame",void 0),o=ep(d,"columns",void 0),l=ep(d,"rows",void 0)):tp(h)?(h=ep(d=h,"key",void 0),a=ep(d,"baseFrame",void 0),o=ep(d,"columns",void 0),l=ep(d,"rows",void 0)):tp(a)?(a=ep(d=a,"baseFrame",void 0),o=ep(d,"columns",void 0),l=ep(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ep(d,"baseFrame",void 0)):tp(o)&&(o=ep(d=o,"columns",void 0),l=ep(d,"rows",void 0)),void 0===a&&(a=ep(d,"frame",void 0)),void 0===o){var c=ep(d,"leftWidth",void 0),u=ep(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=ep(d,"topHeight",void 0),v=ep(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(ep(d,"getFrameNameCallback",void 0)),this.setStretchMode(ep(d,"stretchMode",0)),this.setPreserveRatio(ep(d,"preserveRatio",!0));var g=ep(d,"maxFixedPartScale",1),f=ep(d,"maxFixedPartScaleX",g),m=ep(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Qu),i}(np,"rexNinePatch")){}var ap={_drawImage:function(t,e,i,s,r,n){var h=rp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=rp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(hp.prototype,ap);let op=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Du(t,e))return t[e];var i=t.parent;return Du(i,e)?i[e]:void 0}set(t,e,i){return Du(t,e)?t[e]=i:Du(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const lp=Phaser.Utils.Objects.GetValue;class dp extends hp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=lp(e,"effects",!0);i&&Bu(this,i),this.style=new op(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(dp.prototype,Yc);const cp=["alpha","tint","flipX","flipY"];var up=function(t,e){if(!e)return t;for(var i=0,s=cp.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},B=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},ze=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const zi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(zi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(zi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(zi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Ai),Yi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ws={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Ys,Xs,Bs,Ws);const Is=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,js);var Hs=function(t){if(t.parentContainer)return Hs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Hs(e):t};class Ns extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Hs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Gs=Phaser.GameObjects.Rectangle;class Vs extends Gs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Us=Phaser.Utils.Objects.GetValue;class $s extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Us(t,"hitAreaMode",0)),this.setEnable(Us(t,"enable",!0)),this.setStopMode(Us(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class qs extends Vs{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new $s(this,{hitAreaMode:1})}}var Zs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},tr=function(t,e){Ni(t,e,!1)},er=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const ir=Phaser.Utils.Objects.GetValue;let sr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=rr.popUp),null==e.transitOut&&(e.transitOut=rr.scaleDown),e.destroy=ir(e,"destroy",!0),super(t,e);var i=ir(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(ir(i,"transitIn",Qs)),this.setCoverTransitOutCallback(ir(i,"transitOut",tr)));var s=ir(e,"touchOutsideClose",!1),r=ir(e,"duration.hold",-1),n=ir(e,"timeOutClose",r>=0),h=ir(e,"anyTouchClose",!1);ir(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),ir(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&er(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.popUp:t=Zs.popUp;break;case rr.fadeIn:t=Zs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.scaleDown:t=Zs.scaleDown;break;case rr.fadeOut:t=Zs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const rr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var nr=function(t){return t&&"function"==typeof t},hr={modal(t,e){return nr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ar=function(t,e,i,s,r){nr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},or={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ar.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ar.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ar.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ar.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ar.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ar.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ar.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ar.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ar.call(this,"shutdown",t,e,i,s),this}},lr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},dr={},cr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?er(t,e.x,e.y,i,s):!!(r=lr(e,n,!0))&&er(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Cr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const kr=Phaser.Utils.Objects.GetValue;class Er extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=kr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(kr(t,"enable",!0)),this.setMode(kr(t,"mode",1)),this.setClickInterval(kr(t,"clickInterval",100)),this.setDragThreshold(kr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Mr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:cr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Mr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends zs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Dr=Phaser.Utils.Objects.GetValue;class zr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(Dr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Dr(t,"enable",!0)),this.setCooldown(Dr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===tn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=en,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&cr(t,s,e,i)}}const Qr=0,tn=1,en="IDLE",sn=Phaser.Utils.Objects.GetValue,rn=Phaser.Math.Distance.Between;class nn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(sn(t,"time",250)),this.setTapInterval(sn(t,"tapInterval",200)),this.setDragThreshold(sn(t,"threshold",9)),this.setTapOffset(sn(t,"tapOffset",10));var e=sn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(sn(t,"maxTaps",void 0)),this.setMinTaps(sn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=an;break;case an:var t=this.lastPointer;rn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=on,this.state=an);break;case on:this.state=an}}onDragEnd(){this.state===an&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=on))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===an){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=on:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&(this.state=hn)}get isTapped(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED",ln=Phaser.Utils.Objects.GetValue;class dn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=cn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ln(t,"threshold",9)),this.setHoldTime(ln(t,"time",251)),this}onDragStart(){this.state=un,0===this.holdTime&&(this.state=pn)}onDragEnd(){this.state=cn}onDrag(){this.state!==cn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=cn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===un&&t-this.pointer.downTime>=this.holdTime&&(this.state=pn)}get isPressed(){return this.state===pn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const cn="IDLE",un="BEGIN",pn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ti(t).loop.delta};const gn=Phaser.Math.Distance.Between,fn=Phaser.Math.Angle.Between;var mn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return gn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},bn={};const xn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class Cn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=wn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=wn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=wn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=bn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Cn.prototype,mn);const wn="IDLE",On="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,kn=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Mn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=zn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Dn:this.tracerState=Ln,this.onDrag1End();break;case zn:this.tracerState=Dn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Dn:this.onDrag1();break;case zn:this.onDrag2()}}}dragCancel(){return this.tracerState===zn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return kn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&cr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&cr(t,s,e,i)}}Object.assign(Mn.prototype,$e);var Rn={};const Ln=0,Dn=1,zn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},Bn={};const Wn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,Fn=Phaser.Math.RadToDeg,Hn=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Fn(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Un}break;case Un:t=jn(Fn(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Un}get rotation(){return Hn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Gn="IDLE",Vn="BEGIN",Un="RECOGNIZED",$n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new nn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new dn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t){var e=Zn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Cn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const th=Phaser.Utils.Objects.GetValue;var eh=function(t,e){return t.setInteractive(),th(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:th(e,"targets",[t]),targetMode:th(e,"targetMode","parent"),eventEmitter:th(e,"eventEmitter",t),eventNamePrefix:th(e,"inputEventPrefix","child.")},jr.call(t,e),Hr.call(t,e),Vr.call(t,e),Kr.call(t,e),Jn.call(t,e),qn.call(t,e),Qn.call(t,e),t},ih={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=vh[e];else if(ch(e)){var f;e=uh(f=e,"proportion",void 0),i=uh(f,"align",ph),s=uh(f,"padding",0),r=uh(f,"expand",!1),n=uh(f,"key",void 0),h=uh(f,"index",void 0),t.isRexSizer||(a=uh(f,"minWidth",void 0),o=uh(f,"minHeight",void 0)),l=uh(f,"fitRatio",0),d=uh(f,"offsetX",0),c=uh(f,"offsetY",0),u=uh(f,"offsetOriginX",0),p=uh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const mh=Et.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},Ch={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},wh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,S=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ah.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ah.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,fh,xh,Sh,Ch,wh,Oh);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},kh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Eh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,h){Eh(e)?(e=Mh(h=e,"x",0),i=Mh(h,"y",0),s=Mh(h,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(s)?(s=Mh(h=s,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(n)&&(n=Mh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Mh(h,"space.item",0)),this.setStartChildIndex(Mh(h,"startChildIndex",0)),this.setRTL(Mh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=kh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Ph);var Lh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Dh[i])}void 0===s?s={}:!0===s&&(s=zh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Dh={fit:0,FIT:0,envelop:1,ENVELOP:1};var zh={},Ah={},Yh={};const Xh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Display.Align.CENTER,jh=Phaser.Utils.String.UUID;var Ih={add:function(t,e,i,s,r,n,h,a,o,l){var d,c;me.call(this,t),Xh(e)&&(e=Bh(u=e,"key",void 0),i=Bh(u,"align",Wh),s=Bh(u,"padding",0),r=Bh(u,"expand",!0),t.isRexSizer||(n=Bh(u,"minWidth",t._minWidth),h=Bh(u,"minHeight",t._minHeighted)),a=Bh(u,"offsetX",0),o=Bh(u,"offsetY",0),d=Bh(u,"offsetOriginX",0),c=Bh(u,"offsetOriginY",0),l=Bh(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=jh()),"string"==typeof i&&(i=Yt[i]),void 0===i&&(i=Wh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Xh(r)?(u.expandWidth=Bh(r,"width",!1),u.expandHeight=Bh(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Fh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return yh.call(this,t),this}},Hh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ah.width=e.aspectRatio,Ah.height=1,Yh.width=l,Yh.height=d,l=(c=Lh(Ah,Yh,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),nh(t,this)):Ne(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Hh,Ih,Fh);const Nh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Vh extends rh{constructor(t,e,i,s,r,n){Nh(e)?(e=Gh(n=e,"x",0),i=Gh(n,"y",0),s=Gh(n,"width",void 0),r=Gh(n,"height",void 0)):Nh(s)&&(s=Gh(n=s,"width",void 0),r=Gh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Vh.prototype,Hh);const Uh=Rh.prototype.add,$h=Rh.prototype.addSpace;var Jh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&$h.call(this),Uh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&$h.call(this),this.hasTailSpace=s}else Uh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Uh.call(this,t,{index:r,proportion:i,expand:!0})}else Uh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Kh={addButton(t){if(ur(t))for(var e=t,i=0,s=e.length;i=0;i--)Qh.call(this,e[i],t);return this}},ea=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ia=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ea.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},sa={add(t){return this.buttons.push(t),t._click||(t._click=new Cr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ia.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=ma(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=ma(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue,Sa=Phaser.Display.Align.CENTER;var Ca=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(me.call(this,t),ba(e)&&(e=xa(o=e,"padding",0),i=xa(o,"key",void 0),s=xa(o,"index",void 0),r=xa(o,"offsetX",0),n=xa(o,"offsetY",0),h=xa(o,"offsetOriginX",0),a=xa(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Sa,o.padding=ge(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},wa={add(t,e,i){if(ur(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},_a={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Da.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Ba.call(this,e[i],t);return this}};const ja=Phaser.Utils.Objects.GetValue;class Ia extends Ra{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new da({parent:this,eventEmitter:ja(e,"eventEmitter",this),groupName:ja(e,"groupName",void 0),clickConfig:ja(e,"click",void 0)}).setButtonsType(e);var s=ja(e,"background",void 0),r=ja(e,"buttons",void 0);this.buttonsAlign=ja(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ia.prototype,Aa,Wa,la,ua);var Fa=function(){return Array.prototype.reduce.call(arguments,Ha,0)},Ha=function(t,e){return t+e};const Na=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Va=Phaser.Display.Align.CENTER;var Ua=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ja(this.sizerChildren,null),yh.call(this,t),this}},qa={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ja(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},eo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ja(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ja(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},so=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ro=Phaser.Utils.Objects.IsPlainObject,no=Phaser.Utils.Objects.GetValue;class ho extends rh{constructor(t,e,i,s,r,n,h,a,o,l){ro(e)?(e=no(l=e,"x",0),i=no(l,"y",0),s=no(l,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(s)?(s=no(l=s,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(n)?(n=no(l=n,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(a)&&(a=no(l=a,"columnProportions",0),o=no(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(no(l,"createCellContainerCallback")),this.setIndentLeft(no(l,"space.indentLeftOdd",0),no(l,"space.indentLeftEven",0)),this.setIndentTop(no(l,"space.indentTopOdd",0),no(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,no(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=io.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=so.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ho.prototype,eo);const ao=ho.prototype.add;var oo={addButton(t,e,i){return ao.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uo.call(this,e[i],t);return this}};const vo=Phaser.Utils.Objects.GetValue;class go extends ho{constructor(t,e){void 0===e&&(e={});var i=vo(e,"row",0),s=vo(e,"column",e.col||0),r=vo(e,"createCellContainerCallback"),n=vo(e,"buttons",void 0),h=vo(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},Ho=0,No=1,Go=2,Vo=0,Uo=1,$o=2,Jo=/(?:\r\n|\r|\n)/;const Ko={none:Vo,word:Uo,char:$o,character:$o,mix:3},qo=Phaser.Renderer.WebGL.Utils;var Zo={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=qo.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Qo=Phaser.Display.Color;var tl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Qo);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},el=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},il={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,el(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const sl=Phaser.Display.Canvas.CanvasPool,rl=Phaser.GameObjects.GameObject,nl=Phaser.Utils.String.UUID;class hl extends rl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=sl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=nl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){sl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const al=Phaser.GameObjects.Components;Phaser.Class.mixin(hl,[al.Alpha,al.BlendMode,al.Crop,al.Depth,al.Flip,al.GetBounds,al.Mask,al.Origin,al.Pipeline,al.PostPipeline,al.ScrollFactor,al.Tint,al.Transform,al.Visible,Zo,tl,il]);var ol={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ll{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ll.prototype,ol);var dl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const cl=Phaser.Math.RotateAround;var ul;const pl=Phaser.Geom.Rectangle;var vl,gl=function(t){void 0===vl&&(vl=new pl);var e=t.drawTLX,i=t.drawTLY;return vl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),vl};const fl=Phaser.Math.RotateAround;var ml,yl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ml&&(ml={}),s=ml),s.x=e,s.y=i,0!==t.rotation&&fl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const bl=Phaser.GameObjects.Components.TransformMatrix;var xl,Sl,Cl={},wl=function(t,e,i,s,r){var n=yl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Cl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===xl&&(xl=new bl,Sl=new bl),t.parentContainer?t.getWorldTransformMatrix(xl,Sl):xl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),xl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ol=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return wl(t,e,n,h,r)},Pl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ul&&(ul={}),s=ul),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&cl(s,0,0,-i.rotation),s}(t,e,this,!0);return gl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ol(this.parent,this,t,e,i)}};Object.assign(Pl,dl);const _l=Phaser.Math.DegToRad,Tl=Phaser.Math.RadToDeg,kl=Phaser.Utils.Objects.GetValue;class El extends ll{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Tl(this._rotation)}set angle(t){this.rotation=_l(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=kl(t,"width",void 0),i=kl(t,"height",void 0),s=kl(t,"scaleX",void 0),r=kl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(El.prototype,Pl);const Ml=Phaser.Utils.String.Pad;var Rl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ml(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ll=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Dl=Phaser.Utils.Objects.GetValue;let zl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Dl(t,"x",0),i=Dl(t,"y",0));var s=this.cornerRadius;s.tl=Al(Dl(t,"tl",void 0),e,i),s.tr=Al(Dl(t,"tr",void 0),e,i),s.bl=Al(Dl(t,"bl",void 0),e,i),s.br=Al(Dl(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Yl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Yl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Yl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Yl(this.cornerRadius.br,t)}};var Al=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xl(t),t},Yl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Dl(e,"x",0),t.y=Dl(e,"y",0)),Xl(t)},Xl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Bl=Phaser.Math.DegToRad;var Wl=function(t){return!t.hasOwnProperty("convex")||t.convex},jl=function(t){return t.x>0&&t.y>0},Il=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,jl(a)?(o=a.x*g,l=a.y*f,Wl(a)?Il(t,o,l,o,l,180,270,!1,h):Il(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,jl(a)?(o=a.x*g,l=a.y*f,Wl(a)?Il(t,s-o,l,o,l,270,360,!1,h):Il(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,jl(a)?(o=a.x*g,l=a.y*f,Wl(a)?Il(t,s-o,r-l,o,l,0,90,!1,h):Il(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,jl(a)?(o=a.x*g,l=a.y*f,Wl(a)?Il(t,o,r-l,o,l,90,180,!1,h):Il(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Hl=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Fl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Nl=Phaser.Utils.Objects.GetValue;class Gl extends El{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Nl(e,"color",null),Nl(e,"color2",null),Nl(e,"horizontalGradient",!0)),this.setStroke(Nl(e,"stroke",null),Nl(e,"strokeThickness",2)),this.setCornerRadius(Nl(e,"cornerRadius",0),Nl(e,"cornerIteration",null))}set color(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ll("color2",t,this),Ll("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ll("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ll("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Hl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Vl=Phaser.Utils.Objects.GetValue;class Ul extends El{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Vl(e,"color",null),Vl(e,"color2",null),Vl(e,"horizontalGradient",!0)),this.setStroke(Vl(e,"stroke",null),Vl(e,"strokeThickness",2))}set color(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Rl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Vl(t,"color2",null),Vl(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Vl(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const $l=Phaser.Utils.Objects.GetValue;let Jl=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold($l(t,"bold",!1)),this.setItalic($l(t,"italic",!1)),this.setFontSize($l(t,"fontSize","16px")),this.setFontFamily($l(t,"fontFamily","Courier")),this.setColor($l(t,"color","#fff")),this.setStrokeStyle($l(t,"stroke",null),$l(t,"strokeThickness",0)),this.setShadow($l(t,"shadowColor",null),$l(t,"shadowOffsetX",0),$l(t,"shadowOffsetY",0),$l(t,"shadowBlur",0)),this.setOffset($l(t,"offsetX",0),$l(t,"offsetY",0)),this.setSpace($l(t,"leftSpace",0),$l(t,"rightSpace",0)),this.setAlign($l(t,"align",void 0)),this.setBackgroundColor($l(t,"backgroundColor",null)),this.setBackgroundHeight($l(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($l(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX($l(t,"backgroundLeftX",0)),this.setBackgroundRightX($l(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ll("stroke",t,this),Ll("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ll("shadowOffsetX",t,this),Ll("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Rl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Rl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Rl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Rl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Kl=Phaser.Utils.Array.Remove,ql=Phaser.Utils.Array.Remove,Zl="text",Ql="image",td="drawer",ed="space",id="command";var sd=function(t){return t.type===Zl&&"\n"===t.text},rd=function(t){return t.type===Zl&&"\f"===t.text},nd=function(t){return t.type===Zl};class hd extends El{constructor(t,e,i){super(t,Zl),this.updateTextFlag=!1,this.style=new Jl(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ad=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const od=Phaser.Display.Canvas.CanvasPool;var ld=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=od.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),od.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class dd extends El{constructor(t,e,i){super(t,Ql),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){ld(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class cd extends El{constructor(t,e,i,s){super(t,td),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class ud extends El{constructor(t,e){super(t,ed),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class pd extends ll{constructor(t,e,i,s,r){super(t,id),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function vd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>vd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=vd(t[i]));return e}var gd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const fd={none:0,word:1,char:2,character:2,mix:3};var md=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Sd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Sd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=wd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=wd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=wd(t,"wrapMode");void 0===c&&(c=wd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=fd[c]);var u=wd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=wd(t,"letterSpacing",0),v=wd(t,"hAlign",0),g=wd(t,"vAlign",0),f=wd(t,"justifyPercentage",.25),m=gd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_d(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_d(t,"maxLines",0);var a=0===i,o=_d(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_d(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=_d(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_d(t,"letterSpacing",0),p=_d(t,"rtl",!0),v=_d(t,"hAlign",p?2:0),g=_d(t,"vAlign",0),f=gd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,B=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Kl(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ql(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Zl);return null===i?i=new hd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ol(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const qd=Phaser.Utils.Objects.GetFastValue;var Zd={};class Qd{constructor(t){this.pools=qd(t,"pools",Zd)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Kd),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=ac(t,r,e,i,n),a=0;a<=rc&&0!==h;a++){if((r+=h)<0){r=0;break}h=ac(t,r,e,i,n)}return a===rc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),oc(t,e,i),t},hc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ac=function(t,e,i,s,r){var n,h=hc(t,e,r),a=hc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},oc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const lc=Phaser.Utils.Objects.GetValue,dc=Phaser.Utils.Objects.GetValue;class cc extends To{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=dc(e,"background",void 0),r=dc(e,"icon",void 0),n=dc(e,"iconMask",void 0),h=dc(e,"text",void 0),a=dc(e,"action",void 0),o=dc(e,"actionMask",void 0),l=dc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:dc(e,"space.icon",0),top:dc(e,"space.iconTop",0),bottom:dc(e,"space.iconBottom",0),left:dc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:dc(e,"space.icon",0),left:dc(e,"space.iconLeft",0),right:dc(e,"space.iconRight",0),top:dc(e,"space.iconTop",0)});var d=dc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Do.call(this,r,r,1)),!d){var c=dc(e,"iconSize",void 0);this.setIconSize(dc(e,"iconWidth",c),dc(e,"iconHeight",c))}}if(h){var u=dc(e,"wrapText",!1),p=dc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Bo(t)){case 0:switch("string"==typeof e&&(e=Ko[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Io;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Ko[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,sc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=lc(e,"minWidth",0),s=lc(e,"minHeight",0),r=lc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return nc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),nc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=dc(e,"space.text",0),m=dc(e,"expandTextWidth",!1),y=dc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:dc(e,"space.actionTop",0),bottom:dc(e,"space.actionBottom",0),right:dc(e,"space.actionRight",0)}:{left:dc(e,"space.actionLeft",0),right:dc(e,"space.actionRight",0),bottom:dc(e,"space.actionBottom",0)},d=dc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Do.call(this,a,a,1)),!d)){var b=dc(e,"actionSize");this.setActionSize(dc(e,"actionWidth",b),dc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var uc=Phaser.Renderer.WebGL.Utils,pc=function(t,e,i,s,r,n){for(var h=uc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},yc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const bc=Phaser.Renderer.Canvas.SetTransform;var xc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=fc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&pc(r,h,e,l,a,o),e.isStroked&&gc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(bc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Cc.prototype,xc);var wc=function(t){return t.x>0&&t.y>0},Oc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Pc=Phaser.Math.DegToRad;var _c=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Pu=Phaser.Utils.Objects.GetValue,_u=Phaser.Utils.Objects.IsPlainObject;class Tu extends(Zc(Nc)){constructor(t,e,i,s,r,n,h,a){_u(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):_u(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):_u(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new wu).setName("trackFill")).addShape((new wu).setName("bar")).addShape((new wu).setName("trackStroke")),this.setTrackColor(Pu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Pu(a,"trackStrokeThickness",2),Pu(a,"trackStrokeColor",void 0)),this.setSkewX(Pu(a,"skewX",0)),this.setRTL(Pu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ku={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ou(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ou(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ou(a,0,0,e,i,t)}};Object.assign(Tu.prototype,ku);var Eu=function(t){return null==t||""===t||0===t.length},Mu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Eu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Eu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=vd(i),s=vd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return $u(t)?(this.stretchMode.edge=Ku(Ju(t,"edge",0)),this.stretchMode.internal=Ku(Ju(t,"internal",0))):(t=Ku(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Zu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const tp=Phaser.Utils.Objects.IsPlainObject,ep=Phaser.Utils.Objects.GetValue,ip=Phaser.GameObjects;var sp=void 0,rp=function(t,e){if(sp||(sp={},ti(t).events.once("destroy",(function(){for(var t in sp)sp[t].destroy();sp=void 0}))),!sp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new ip[e](i)).setOrigin(0),sp[e]=t}return sp[e]};const np=Phaser.GameObjects.RenderTexture;class hp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(tp(i)?(i=ep(d=i,"x",0),s=ep(d,"y",0),r=ep(d,"width",1),n=ep(d,"height",1),h=ep(d,"key",void 0),a=ep(d,"baseFrame",void 0),o=ep(d,"columns",void 0),l=ep(d,"rows",void 0)):tp(r)?(r=ep(d=r,"width",1),n=ep(d,"height",1),h=ep(d,"key",void 0),a=ep(d,"baseFrame",void 0),o=ep(d,"columns",void 0),l=ep(d,"rows",void 0)):tp(h)?(h=ep(d=h,"key",void 0),a=ep(d,"baseFrame",void 0),o=ep(d,"columns",void 0),l=ep(d,"rows",void 0)):tp(a)?(a=ep(d=a,"baseFrame",void 0),o=ep(d,"columns",void 0),l=ep(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ep(d,"baseFrame",void 0)):tp(o)&&(o=ep(d=o,"columns",void 0),l=ep(d,"rows",void 0)),void 0===a&&(a=ep(d,"frame",void 0)),void 0===o){var c=ep(d,"leftWidth",void 0),u=ep(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=ep(d,"topHeight",void 0),v=ep(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(ep(d,"getFrameNameCallback",void 0)),this.setStretchMode(ep(d,"stretchMode",0)),this.setPreserveRatio(ep(d,"preserveRatio",!0));var g=ep(d,"maxFixedPartScale",1),f=ep(d,"maxFixedPartScaleX",g),m=ep(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Qu),i}(np,"rexNinePatch")){}var ap={_drawImage:function(t,e,i,s,r,n){var h=rp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=rp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(hp.prototype,ap);let op=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Du(t,e))return t[e];var i=t.parent;return Du(i,e)?i[e]:void 0}set(t,e,i){return Du(t,e)?t[e]=i:Du(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const lp=Phaser.Utils.Objects.GetValue;class dp extends hp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=lp(e,"effects",!0);i&&Bu(this,i),this.style=new op(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(dp.prototype,Yc);const cp=["alpha","tint","flipX","flipY"];var up=function(t,e){if(!e)return t;for(var i=0,s=cp.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexdropdownlist.js b/dist/rexdropdownlist.js index 546a0e0992..22e4ee55e9 100644 --- a/dist/rexdropdownlist.js +++ b/dist/rexdropdownlist.js @@ -15614,6 +15614,8 @@ this.setBackgroundColor(GetValue$E(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$E(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$E(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$E(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$E(o, 'backgroundRightX', 0)); return this; } @@ -15684,6 +15686,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -15838,6 +15846,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -16265,20 +16283,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rexdropdownlist.min.js b/dist/rexdropdownlist.min.js index 1645e8de9f..91eda93301 100644 --- a/dist/rexdropdownlist.min.js +++ b/dist/rexdropdownlist.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,De=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=De(e,"left",0),t.right=De(e,"right",0),t.top=De(e,"top",0),t.bottom=De(e,"bottom",0)),t},Xe={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==Ci&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=Ci):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case Ci:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===Ci}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,Ci=-1;class xi extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Oi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ki=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ki(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Di=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Xi=function(t){return Li(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Xi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Xi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Xi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Xi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,zi),Ai.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Gi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Xi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Xi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Xi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class Zi extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Xi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Xi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Xi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Xi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Xi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var As={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ws={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,As,Ws,Bs,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Is);var Vs=function(t){if(t.parentContainer)return Vs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Vs(e):t};class Gs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Vs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class Us extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Gs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=qs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var qs={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},er=function(t,e){Gi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},kr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Dr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?kr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Dr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends Ys{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Xr=Phaser.Utils.Objects.GetValue;class Yr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(Xr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Xr(t,"enable",!0)),this.setCooldown(Xr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Yr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Yr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Ar={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Wr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Cn={};const xn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class wn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=On},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=Pn}onDragEnd(){this.state=On}onDrag(){this.state===Pn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=kn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===kn&&(this.state=On)}get isSwiped(){return this.state===kn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=bn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(wn.prototype,yn);const On="IDLE",Pn="BEGIN",kn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Dn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=Xn,this.onDrag1Start();break;case Xn:this.tracerState=Yn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Xn:this.tracerState=Ln,this.onDrag1End();break;case Yn:this.tracerState=Xn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Xn:this.onDrag1();break;case Yn:this.onDrag2()}}}dragCancel(){return this.tracerState===Yn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Yn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Yn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=zn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Dn.prototype,Je);var Rn={};const Ln=0,Xn=1,Yn=2,zn="IDLE";Phaser.Utils.Objects.GetValue;const An=Phaser.Math.RotateAround;var Wn=function(t,e,i,s){return An(t,e,i,s),t.rotation+=s,t},Bn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Vn=Phaser.Math.DegToRad;var Gn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Vn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Gn);const Nn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new wn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Vr.call(t,e),Ur.call(t,e),Kr.call(t,e),qn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Dt(t)},getChildPrevState:function(t){var e=Dt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Xt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const yh=Mt.prototype.clear;var bh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),yh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},wh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Oh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ph={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},kh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(kh,mh,xh,Sh,wh,Oh,Ph);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue;class Rh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Dh(h=e,"x",0),i=Dh(h,"y",0),s=Dh(h,"width",void 0),r=Dh(h,"height",void 0),n=Dh(h,"orientation",0)):Mh(s)?(s=Dh(h=s,"width",void 0),r=Dh(h,"height",void 0),n=Dh(h,"orientation",0)):Mh(n)&&(n=Dh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Dh(h,"space.item",0)),this.setStartChildIndex(Dh(h,"startChildIndex",0)),this.setRTL(Dh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,kh);var Lh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Xh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Yh extends Rh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Lh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Lh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Lh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Lh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Yh.prototype,Xh);var zh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Ah=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Wh=Phaser.GameObjects.Graphics;class Bh extends Wh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=jh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=fe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Ah(this.padding,i);return r||n?(this.width=t,this.height=e,n&&yt(i,this.padding),this.originX=s.originX,this.originY=s.originY,zh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,zh.call(this,this.width,this.height,this.padding,t,e)),this}}const jh={rectangle:0,circle:1};var Ih=function(t,e,i,s){var r=new Bh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Fh=Phaser.GameObjects.Text;var Hh=function(t){return t instanceof Fh};const Vh=Phaser.GameObjects.BitmapText;var Gh=function(t){return t instanceof Vh},Nh=/^[\x00-\x7F]+$/,Uh=function(t){return Nh.test(t)},$h=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},qh=2;const Kh={none:0,word:1,char:qh,character:qh,mix:3};var Zh=function(t,e){var i=function(t){return Gh(t)?2:Hh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=$h;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}};const Qh=Phaser.Renderer.WebGL.Utils;var ta={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Qh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ea=Phaser.Display.Color;var ia={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ea);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},sa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ra=Phaser.Display.Canvas.CanvasPool,na=Phaser.GameObjects.GameObject,ha=Phaser.Utils.String.UUID;class aa extends na{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ra.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ha(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ra.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const oa=Phaser.GameObjects.Components;Phaser.Class.mixin(aa,[oa.Alpha,oa.BlendMode,oa.Crop,oa.Depth,oa.Flip,oa.GetBounds,oa.Mask,oa.Origin,oa.Pipeline,oa.PostPipeline,oa.ScrollFactor,oa.Tint,oa.Transform,oa.Visible,ta,ia,sa]);var la={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class da{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(da.prototype,la);var ca={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ua=Phaser.Math.RotateAround;var pa;const va=Phaser.Geom.Rectangle;var ga,fa=function(t){void 0===ga&&(ga=new va);var e=t.drawTLX,i=t.drawTLY;return ga.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ga};const ma=Phaser.Math.RotateAround;var ya,ba=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ya&&(ya={}),s=ya),s.x=e,s.y=i,0!==t.rotation&&ma(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ca=Phaser.GameObjects.Components.TransformMatrix;var xa,Sa,wa={},Oa=function(t,e,i,s,r){var n=ba(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=wa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===xa&&(xa=new Ca,Sa=new Ca),t.parentContainer?t.getWorldTransformMatrix(xa,Sa):xa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),xa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Pa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Oa(t,e,n,h,r)},ka={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===pa&&(pa={}),s=pa),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ua(s,0,0,-i.rotation),s}(t,e,this,!0);return fa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Pa(this.parent,this,t,e,i)}};Object.assign(ka,ca);const _a=Phaser.Math.DegToRad,Ta=Phaser.Math.RadToDeg,Ea=Phaser.Utils.Objects.GetValue;class Ma extends da{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ta(this._rotation)}set angle(t){this.rotation=_a(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ea(t,"width",void 0),i=Ea(t,"height",void 0),s=Ea(t,"scaleX",void 0),r=Ea(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ma.prototype,ka);const Da=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Da(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},La=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Xa=Phaser.Utils.Objects.GetValue;let Ya=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Xa(t,"x",0),i=Xa(t,"y",0));var s=this.cornerRadius;s.tl=za(Xa(t,"tl",void 0),e,i),s.tr=za(Xa(t,"tr",void 0),e,i),s.bl=za(Xa(t,"bl",void 0),e,i),s.br=za(Xa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Aa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Aa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Aa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Aa(this.cornerRadius.br,t)}};var za=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Wa(t),t},Aa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Xa(e,"x",0),t.y=Xa(e,"y",0)),Wa(t)},Wa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ba=Phaser.Math.DegToRad;var ja=function(t){return!t.hasOwnProperty("convex")||t.convex},Ia=function(t){return t.x>0&&t.y>0},Fa=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ia(a)?(o=a.x*g,l=a.y*f,ja(a)?Fa(t,o,l,o,l,180,270,!1,h):Fa(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ia(a)?(o=a.x*g,l=a.y*f,ja(a)?Fa(t,s-o,l,o,l,270,360,!1,h):Fa(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ia(a)?(o=a.x*g,l=a.y*f,ja(a)?Fa(t,s-o,r-l,o,l,0,90,!1,h):Fa(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ia(a)?(o=a.x*g,l=a.y*f,ja(a)?Fa(t,o,r-l,o,l,90,180,!1,h):Fa(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Va=Phaser.Utils.Objects.GetValue;class Ga extends Ma{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Va(e,"color",null),Va(e,"color2",null),Va(e,"horizontalGradient",!0)),this.setStroke(Va(e,"stroke",null),Va(e,"strokeThickness",2)),this.setCornerRadius(Va(e,"cornerRadius",0),Va(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,La("color2",t,this),La("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,La("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,La("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ha(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Na=Phaser.Utils.Objects.GetValue;class Ua extends Ma{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Na(t,"color2",null),Na(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Na(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const $a=Phaser.Utils.Objects.GetValue;class Ja{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(La("stroke",t,this),La("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(La("shadowOffsetX",t,this),La("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Ja(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ra(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const qa=Phaser.Utils.Array.Remove,Ka=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ma{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class lo extends Ma{constructor(t,e,i){super(t,Qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=oo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),oo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class co extends Ma{constructor(t,e,i,s){super(t,to),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class uo extends Ma{constructor(t,e){super(t,eo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class po extends da{constructor(t,e,i,s,r){super(t,io),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function vo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>vo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=vo(t[i]));return e}var go=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const fo={none:0,word:1,char:2,character:2,mix:3};var mo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=xo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=xo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=wo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=wo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=wo(t,"wrapMode");void 0===c&&(c=wo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=fo[c]);var u=wo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=wo(t,"letterSpacing",0),v=wo(t,"hAlign",0),g=wo(t,"vAlign",0),f=wo(t,"justifyPercentage",.25),m=go({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=T.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=R,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ko(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=ko(t,"maxLines",0);var a=0===i,o=ko(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=ko(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=ko(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ko(t,"letterSpacing",0),p=ko(t,"rtl",!0),v=ko(t,"hAlign",p?2:0),g=ko(t,"vAlign",0),f=go({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(T.push({children:E,height:M}),D=Math.max(D,M)),f.start+=_.length,f.isLastPage=f.start===k,f.maxLineHeight=D,f.linesWidth=T.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ka(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Za);return null===i?i=new ho(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Pa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ko=Phaser.Utils.Objects.GetFastValue;var Zo={};class Qo{constructor(t){this.pools=Ko(t,"pools",Zo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=al(t,r,e,i,n),a=0;a<=rl&&0!==h;a++){if((r+=h)<0){r=0;break}h=al(t,r,e,i,n)}return a===rl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ol(t,e,i),t},hl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},al=function(t,e,i,s,r){var n,h=hl(t,e,r),a=hl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ol=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const ll=Phaser.Utils.Objects.GetValue,dl=Phaser.Utils.Objects.GetValue;class cl extends Yh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=dl(e,"background",void 0),r=dl(e,"icon",void 0),n=dl(e,"iconMask",void 0),h=dl(e,"text",void 0),a=dl(e,"action",void 0),o=dl(e,"actionMask",void 0),l=dl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:dl(e,"space.icon",0),top:dl(e,"space.iconTop",0),bottom:dl(e,"space.iconBottom",0),left:dl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:dl(e,"space.icon",0),left:dl(e,"space.iconLeft",0),right:dl(e,"space.iconRight",0),top:dl(e,"space.iconTop",0)});var d=dl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Ih.call(this,r,r,1)),!d){var c=dl(e,"iconSize",void 0);this.setIconSize(dl(e,"iconWidth",c),dl(e,"iconHeight",c))}}if(h){var u=dl(e,"wrapText",!1),p=dl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Zh(h,u),e.expandTextWidth=!0,sl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=ll(e,"minWidth",0),s=ll(e,"minHeight",0),r=ll(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return nl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),nl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=dl(e,"space.text",0),m=dl(e,"expandTextWidth",!1),y=dl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:dl(e,"space.actionTop",0),bottom:dl(e,"space.actionBottom",0),right:dl(e,"space.actionRight",0)}:{left:dl(e,"space.actionLeft",0),right:dl(e,"space.actionRight",0),bottom:dl(e,"space.actionBottom",0)},d=dl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Ih.call(this,a,a,1)),!d)){var b=dl(e,"actionSize");this.setActionSize(dl(e,"actionWidth",b),dl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var ul={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=pl[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const pl={down:0,up:1},vl=Rh.prototype.add,gl=Rh.prototype.addSpace;var fl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&gl.call(this),vl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&gl.call(this),this.hasTailSpace=s}else vl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;vl.call(this,t,{index:r,proportion:i,expand:!0})}else vl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},ml={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Cl.call(this,e[i],t);return this}},Sl=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},wl=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Sl.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Ol={add(t){return this.buttons.push(t),t._click||(t._click=new wr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),wl.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Wl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Wl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const jl=Phaser.Utils.Objects.IsPlainObject,Il=Phaser.Utils.Objects.GetValue,Fl=Phaser.Display.Align.CENTER;var Hl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),jl(e)&&(e=Il(o=e,"padding",0),i=Il(o,"key",void 0),s=Il(o,"index",void 0),r=Il(o,"offsetX",0),n=Il(o,"offsetY",0),h=Il(o,"offsetOriginX",0),a=Il(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Fl,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},Vl={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},Ul={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&td.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)nd.call(this,e[i],t);return this}};const ad=Phaser.Utils.Objects.GetValue;class od extends Zl{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Dl({parent:this,eventEmitter:ad(e,"eventEmitter",this),groupName:ad(e,"groupName",void 0),clickConfig:ad(e,"click",void 0)}).setButtonsType(e);var s=ad(e,"background",void 0),r=ad(e,"buttons",void 0);this.buttonsAlign=ad(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(od.prototype,id,hd,Ml,Ll);var ld={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},dd=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=cd(t));var i=t[e];return"string"==typeof i&&(i=ld[i]),i},cd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},ud=function(){return Array.prototype.reduce.call(arguments,pd,0)},pd=function(t,e){return t+e};const vd=Phaser.Utils.Objects.IsPlainObject,gd=Phaser.Utils.Objects.GetValue,fd=Phaser.Display.Align.CENTER;var md=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return bd(this.sizerChildren,null),bh.call(this,t),this}},xd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)bd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Pd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,bd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)bd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},_d=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Td=Phaser.Utils.Objects.IsPlainObject,Ed=Phaser.Utils.Objects.GetValue;class Md extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Td(e)?(e=Ed(l=e,"x",0),i=Ed(l,"y",0),s=Ed(l,"width",void 0),r=Ed(l,"height",void 0),n=Ed(l,"column",l.col||0),h=Ed(l,"row",0),a=Ed(l,"columnProportions",0),o=Ed(l,"rowProportions",0)):Td(s)?(s=Ed(l=s,"width",void 0),r=Ed(l,"height",void 0),n=Ed(l,"column",l.col||0),h=Ed(l,"row",0),a=Ed(l,"columnProportions",0),o=Ed(l,"rowProportions",0)):Td(n)?(n=Ed(l=n,"column",l.col||0),h=Ed(l,"row",0),a=Ed(l,"columnProportions",0),o=Ed(l,"rowProportions",0)):Td(a)&&(a=Ed(l=a,"columnProportions",0),o=Ed(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Ed(l,"createCellContainerCallback")),this.setIndentLeft(Ed(l,"space.indentLeftOdd",0),Ed(l,"space.indentLeftEven",0)),this.setIndentTop(Ed(l,"space.indentTopOdd",0),Ed(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Ed(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=kd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=_d.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Md.prototype,Pd);const Dd=Phaser.Utils.Objects.GetValue;var Rd=Phaser.Renderer.WebGL.Utils,Ld=function(t,e,i,s,r,n){for(var h=Rd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Wd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Bd=Phaser.Renderer.Canvas.SetTransform;var jd={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=zd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Ld(r,h,e,l,a,o),e.isStroked&&Yd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Bd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Fd.prototype,jd);var Hd=function(t){return t.x>0&&t.y>0},Vd=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Gd=Phaser.Math.DegToRad;var Nd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Gc=Phaser.Utils.Objects.GetValue,Nc=Phaser.Utils.Objects.IsPlainObject;class Uc extends(yc(dc)){constructor(t,e,i,s,r,n,h,a){Nc(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Nc(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Nc(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Hc).setName("trackFill")).addShape((new Hc).setName("bar")).addShape((new Hc).setName("trackStroke")),this.setTrackColor(Gc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Gc(a,"trackStrokeThickness",2),Gc(a,"trackStrokeColor",void 0)),this.setSkewX(Gc(a,"skewX",0)),this.setRTL(Gc(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var $c={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Vc(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Vc(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Vc(a,0,0,e,i,t)}};Object.assign(Uc.prototype,$c);var Jc=function(t){return null==t||""===t||0===t.length},qc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Jc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Jc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=vo(i),s=vo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return vu(t)?(this.stretchMode.edge=fu(gu(t,"edge",0)),this.stretchMode.internal=fu(gu(t,"internal",0))):(t=fu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return yu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Cu=Phaser.Utils.Objects.IsPlainObject,xu=Phaser.Utils.Objects.GetValue,Su=Phaser.GameObjects;var wu=void 0,Ou=function(t,e){if(wu||(wu={},ei(t).events.once("destroy",(function(){for(var t in wu)wu[t].destroy();wu=void 0}))),!wu.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Su[e](i)).setOrigin(0),wu[e]=t}return wu[e]};const Pu=Phaser.GameObjects.RenderTexture;class ku extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Cu(i)?(i=xu(d=i,"x",0),s=xu(d,"y",0),r=xu(d,"width",1),n=xu(d,"height",1),h=xu(d,"key",void 0),a=xu(d,"baseFrame",void 0),o=xu(d,"columns",void 0),l=xu(d,"rows",void 0)):Cu(r)?(r=xu(d=r,"width",1),n=xu(d,"height",1),h=xu(d,"key",void 0),a=xu(d,"baseFrame",void 0),o=xu(d,"columns",void 0),l=xu(d,"rows",void 0)):Cu(h)?(h=xu(d=h,"key",void 0),a=xu(d,"baseFrame",void 0),o=xu(d,"columns",void 0),l=xu(d,"rows",void 0)):Cu(a)?(a=xu(d=a,"baseFrame",void 0),o=xu(d,"columns",void 0),l=xu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=xu(d,"baseFrame",void 0)):Cu(o)&&(o=xu(d=o,"columns",void 0),l=xu(d,"rows",void 0)),void 0===a&&(a=xu(d,"frame",void 0)),void 0===o){var c=xu(d,"leftWidth",void 0),u=xu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=xu(d,"topHeight",void 0),v=xu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(xu(d,"getFrameNameCallback",void 0)),this.setStretchMode(xu(d,"stretchMode",0)),this.setPreserveRatio(xu(d,"preserveRatio",!0));var g=xu(d,"maxFixedPartScale",1),f=xu(d,"maxFixedPartScaleX",g),m=xu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,bu),i}(Pu,"rexNinePatch")){}var _u={_drawImage:function(t,e,i,s,r,n){var h=Ou(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ou(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(ku.prototype,_u);class Tu extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Qc(t,e))return t[e];var i=t.parent;return Qc(i,e)?i[e]:void 0}set(t,e,i){return Qc(t,e)?t[e]=i:Qc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Eu=Phaser.Utils.Objects.GetValue;class Mu extends ku{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Eu(e,"effects",!0);i&&ru(this,i),this.style=new Tu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Mu.prototype,ic);const Du=["alpha","tint","flipX","flipY"];var Ru=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Kc(t,e);break;case"image":s=new uu(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Mu(t,e):new ou(t,e);break;default:s=new sc(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Du.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const lp=Phaser.Utils.Objects.GetValue,dp=Phaser.Math.Distance.Between;class cp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=lp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(lp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(lp(t,"enable",!0)),this.holdThreshold=lp(t,"holdThreshold",50),this.pointerOutReleaseEnable=lp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:dp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const up=Phaser.Utils.Objects.GetValue;class pp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(up(t,"value",0)),this.setSpeed(up(t,"speed",0)),this.setAcceleration(up(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class vp{constructor(){this.value,this.dir,this.movement=new pp}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const yp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},bp=Phaser.Utils.Objects.GetValue;class Cp extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=bp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(bp(e,"speed",.1)),this.setEnable(bp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(bp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const xp=Phaser.Utils.Objects.GetValue;var Sp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?xp(s,l,void 0):xp(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new ap(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=xp(r,"position",0);"string"==typeof p&&(p=wp[p]);var v,g,f=xp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=xp(s,"space.slider",void 0))&&(a?f=0:v=xp(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:xp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:xp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:xp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:xp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=xp(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=xp(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=xp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=xp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=xp(s,"scrollDetectionMode");"string"==typeof b&&(b=Op[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?xp(s,C,!0):xp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new mp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,O,P,k=xp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==b&&(k.focus=1===b?2:0),x=new Cp(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const wp={right:0,left:1,bottom:0,top:1},Op={gameObject:0,rectBounds:1},Pp=Phaser.Utils.Objects.GetValue;var kp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Pp(e,"width"),h=Pp(e,"height");n||Pp(e,"child.expandWidth",!0)||(s[1]=0),h||Pp(e,"child.expandHeight",!0)||(r[1]=0);var a=new Md(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Dd(i,"child"),r=Dd(s,"gameObject",void 0);if(r){var n=Dd(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Dd(n,"top",0),h.bottom=Dd(n,"bottom",0),a.left=Dd(n,"left",0),a.right=Dd(n,"right",0);break;case 1:h.top=Dd(n,"left",0),h.bottom=Dd(n,"right",0),a.top=Dd(n,"top",0),a.bottom=Dd(n,"bottom",0);break;default:h.top=Dd(n,"top",0),h.bottom=Dd(n,"bottom",0),h.left=Dd(n,"left",0),h.right=Dd(n,"right",0)}e.add(r,{column:1,row:1,align:Dd(s,"align","center"),padding:a,expand:{width:Dd(s,"expandWidth",!0),height:Dd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Sp(t,a,"y",e);break;case 1:Sp(t,a,"x",e);break;default:Sp(t,a,"y",e),Sp(t,a,"x",e)}return a},_p=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Tp=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Ep=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(qp.prototype,Np);const Kp=["top","bottom","centerY","center"],Zp=["left","right","centerX","center"];var Qp=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=Kp.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=Zp.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const tv=Phaser.Utils.Objects.GetValue;class ev extends Lp{constructor(t,e){void 0===e&&(e={});var i=dd(e),s=tv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=tv(e,"clampChildOY",!1),s.clampChildOX=tv(e,"clampChildOX",!1);var r,n,h=new qp(t,s);switch(t.add.existing(h),i){case 0:r=tv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=tv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:tv(e,"align.panel","center")};var a=tv(e,"space",void 0);a&&(a.child=tv(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ih(this.childrenMap.child,t),this}}var iv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Qp.call(this,t,"y",e);break;case 1:Qp.call(this,t,"x",e);break;default:Qp.call(this,t,"y",e),Qp.call(this,t,"x",e)}return this}};Object.assign(ev.prototype,iv);const sv=Phaser.Utils.Objects.GetValue;var rv=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=nv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=hv(e,this.listCreateSliderTrackCallback),v=hv(e,this.listCreateSliderThumbCallback);d=new ev(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:sv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=nv(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},nv=function(t,e,i){var s;return i?(e.orientation="x",s=new od(t,e)):(e.orientation="y",s=new Yl(t,e)),t.add.existing(s),s},hv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},av=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rC.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const dv={down:0,up:1},cv=Phaser.Utils.Objects.GetValue;class uv extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Di(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),lv(t,e),t.isRexSizer&&t.layout();var i=cv(e,"touchOutsideClose",!1),s=cv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var pv={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},vv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=rv.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new uv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(vv,ul,pv);const gv=Phaser.Utils.Objects.GetValue;class fv extends cl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(gv(e,"options"));var i=gv(e,"list");this.setWrapEnable(gv(i,"wrap",!1)),this.setCreateButtonCallback(gv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(gv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(gv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(gv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(gv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(gv(i,"scroller")),this.setListMouseWheelScrollerConfig(gv(i,"mouseWheelScroller")),this.setButtonClickCallback(gv(i,"onButtonClick")),this.setButtonOverCallback(gv(i,"onButtonOver")),this.setButtonOutCallback(gv(i,"onButtonOut")),this.setListExpandDirection(gv(i,"expandDirection")),this.setListEaseInDuration(gv(i,"easeIn",500)),this.setListEaseOutDuration(gv(i,"easeOut",100)),this.setListTransitInCallback(gv(i,"transitIn")),this.settListTransitOutCallback(gv(i,"transitOut")),this.setListMaxHeight(gv(i,"maxHeight",0)),this.setListSize(gv(i,"width"),gv(i,"height",0)),this.setListAlignmentMode(gv(i,"alignParent","text")),this.setListAlignmentSide(gv(i,"alignSide","")),this.setListBounds(gv(i,"bounds")),this.setListSpace(gv(i,"space")),this.setListDraggable(gv(i,"draggable",!1)),this.setValueChangeCallback(gv(e,"setValueCallback"),gv(e,"setValueCallbackScope")),this.setValue(gv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}return Object.assign(fv.prototype,vv),fv},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdropdownlist=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},X={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},L={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},B=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,De=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Xe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=De(e,"left",0),t.right=De(e,"right",0),t.top=De(e,"top",0),t.bottom=De(e,"bottom",0)),t},Le={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Xe(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Xe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Xe(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Be=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?bi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==Ci&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=Ci):this.nowTime>=0&&(this.state=bi))}get t(){var t;switch(this.state){case fi:case mi:case yi:t=0;break;case bi:t=this.nowTime/this.duration;break;case Ci:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=bi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===bi}get isRunning(){return this.state===mi||this.state===bi}get isDone(){return this.state===Ci}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,bi=2,yi=3,Ci=-1;class xi extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Oi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ki=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ki(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Di=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Xi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Li=function(t){return Xi(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Li(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Li(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,zi),Ai.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Gi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Li(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Li(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class Zi extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Li(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Li(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Li(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Li(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Li(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Xi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},bs=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var As={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Bs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Bt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Bt),this.transitOutCallback=t,this}},Ws={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,As,Bs,Ws,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Is);var Vs=function(t){if(t.parentContainer)return Vs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Vs(e):t};class Gs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Vs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class Us extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Gs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=qs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var qs={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},er=function(t,e){Gi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},kr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Dr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?kr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Dr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Xr extends Ys{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Lr=Phaser.Utils.Objects.GetValue;class Yr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Xr,this.parent.setInteractive(Lr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Lr(t,"enable",!0)),this.setCooldown(Lr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Yr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Yr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Ar={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Br=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var bn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Cn={};const xn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class wn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=On},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=Pn}onDragEnd(){this.state=On}onDrag(){this.state===Pn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=kn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===kn&&(this.state=On)}get isSwiped(){return this.state===kn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(wn.prototype,bn);const On="IDLE",Pn="BEGIN",kn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Dn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Xn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Xn:this.tracerState=Ln,this.onDrag1Start();break;case Ln:this.tracerState=Yn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Ln:this.tracerState=Xn,this.onDrag1End();break;case Yn:this.tracerState=Ln,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Ln:this.onDrag1();break;case Yn:this.onDrag2()}}}dragCancel(){return this.tracerState===Yn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Xn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Yn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Yn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=zn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Dn.prototype,Je);var Rn={};const Xn=0,Ln=1,Yn=2,zn="IDLE";Phaser.Utils.Objects.GetValue;const An=Phaser.Math.RotateAround;var Bn=function(t,e,i,s){return An(t,e,i,s),t.rotation+=s,t},Wn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Vn=Phaser.Math.DegToRad;var Gn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Wn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Vn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Gn);const Nn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new wn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Wr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Vr.call(t,e),Ur.call(t,e),Kr.call(t,e),qn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Dt(t)},getChildPrevState:function(t){var e=Dt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;be.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const bh=Mt.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),bh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},wh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Oh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ph={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},kh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,b=v,y=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Be.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(kh,mh,xh,Sh,wh,Oh,Ph);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue;class Rh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Dh(h=e,"x",0),i=Dh(h,"y",0),s=Dh(h,"width",void 0),r=Dh(h,"height",void 0),n=Dh(h,"orientation",0)):Mh(s)?(s=Dh(h=s,"width",void 0),r=Dh(h,"height",void 0),n=Dh(h,"orientation",0)):Mh(n)&&(n=Dh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Dh(h,"space.item",0)),this.setStartChildIndex(Dh(h,"startChildIndex",0)),this.setRTL(Dh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,kh);var Xh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Lh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Yh extends Rh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Xh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Xh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Xh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Xh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Yh.prototype,Lh);var zh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Ah=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Bh=Phaser.GameObjects.Graphics;class Wh extends Bh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=jh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=fe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Ah(this.padding,i);return r||n?(this.width=t,this.height=e,n&&bt(i,this.padding),this.originX=s.originX,this.originY=s.originY,zh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,zh.call(this,this.width,this.height,this.padding,t,e)),this}}const jh={rectangle:0,circle:1};var Ih=function(t,e,i,s){var r=new Wh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Fh=Phaser.GameObjects.Text;var Hh=function(t){return t instanceof Fh};const Vh=Phaser.GameObjects.BitmapText;var Gh=function(t){return t instanceof Vh},Nh=/^[\x00-\x7F]+$/,Uh=function(t){return Nh.test(t)},$h=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},qh=2;const Kh={none:0,word:1,char:qh,character:qh,mix:3};var Zh=function(t,e){var i=function(t){return Gh(t)?2:Hh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=$h;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}};const Qh=Phaser.Renderer.WebGL.Utils;var ta={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Qh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ea=Phaser.Display.Color;var ia={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ea);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},sa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ra=Phaser.Display.Canvas.CanvasPool,na=Phaser.GameObjects.GameObject,ha=Phaser.Utils.String.UUID;class aa extends na{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ra.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ha(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ra.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const oa=Phaser.GameObjects.Components;Phaser.Class.mixin(aa,[oa.Alpha,oa.BlendMode,oa.Crop,oa.Depth,oa.Flip,oa.GetBounds,oa.Mask,oa.Origin,oa.Pipeline,oa.PostPipeline,oa.ScrollFactor,oa.Tint,oa.Transform,oa.Visible,ta,ia,sa]);var la={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class da{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(da.prototype,la);var ca={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ua=Phaser.Math.RotateAround;var pa;const va=Phaser.Geom.Rectangle;var ga,fa=function(t){void 0===ga&&(ga=new va);var e=t.drawTLX,i=t.drawTLY;return ga.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ga};const ma=Phaser.Math.RotateAround;var ba,ya=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ba&&(ba={}),s=ba),s.x=e,s.y=i,0!==t.rotation&&ma(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ca=Phaser.GameObjects.Components.TransformMatrix;var xa,Sa,wa={},Oa=function(t,e,i,s,r){var n=ya(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=wa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===xa&&(xa=new Ca,Sa=new Ca),t.parentContainer?t.getWorldTransformMatrix(xa,Sa):xa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),xa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Pa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Oa(t,e,n,h,r)},ka={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===pa&&(pa={}),s=pa),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ua(s,0,0,-i.rotation),s}(t,e,this,!0);return fa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Pa(this.parent,this,t,e,i)}};Object.assign(ka,ca);const _a=Phaser.Math.DegToRad,Ta=Phaser.Math.RadToDeg,Ea=Phaser.Utils.Objects.GetValue;class Ma extends da{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ta(this._rotation)}set angle(t){this.rotation=_a(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ea(t,"width",void 0),i=Ea(t,"height",void 0),s=Ea(t,"scaleX",void 0),r=Ea(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ma.prototype,ka);const Da=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Da(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Xa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const La=Phaser.Utils.Objects.GetValue;let Ya=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=La(t,"x",0),i=La(t,"y",0));var s=this.cornerRadius;s.tl=za(La(t,"tl",void 0),e,i),s.tr=za(La(t,"tr",void 0),e,i),s.bl=za(La(t,"bl",void 0),e,i),s.br=za(La(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Aa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Aa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Aa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Aa(this.cornerRadius.br,t)}};var za=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ba(t),t},Aa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=La(e,"x",0),t.y=La(e,"y",0)),Ba(t)},Ba=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Wa=Phaser.Math.DegToRad;var ja=function(t){return!t.hasOwnProperty("convex")||t.convex},Ia=function(t){return t.x>0&&t.y>0},Fa=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ia(a)?(o=a.x*g,l=a.y*f,ja(a)?Fa(t,o,l,o,l,180,270,!1,h):Fa(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ia(a)?(o=a.x*g,l=a.y*f,ja(a)?Fa(t,s-o,l,o,l,270,360,!1,h):Fa(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ia(a)?(o=a.x*g,l=a.y*f,ja(a)?Fa(t,s-o,r-l,o,l,0,90,!1,h):Fa(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ia(a)?(o=a.x*g,l=a.y*f,ja(a)?Fa(t,o,r-l,o,l,90,180,!1,h):Fa(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Va=Phaser.Utils.Objects.GetValue;class Ga extends Ma{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Va(e,"color",null),Va(e,"color2",null),Va(e,"horizontalGradient",!0)),this.setStroke(Va(e,"stroke",null),Va(e,"strokeThickness",2)),this.setCornerRadius(Va(e,"cornerRadius",0),Va(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Xa("color2",t,this),Xa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Xa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Xa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ha(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Na=Phaser.Utils.Objects.GetValue;class Ua extends Ma{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Na(t,"color2",null),Na(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Na(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const $a=Phaser.Utils.Objects.GetValue;class Ja{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX($a(t,"backgroundLeftX",0)),this.setBackgroundRightX($a(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Xa("stroke",t,this),Xa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Xa("shadowOffsetX",t,this),Xa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Ja(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ra(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const qa=Phaser.Utils.Array.Remove,Ka=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ma{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class lo extends Ma{constructor(t,e,i){super(t,Qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=oo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),oo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class co extends Ma{constructor(t,e,i,s){super(t,to),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class uo extends Ma{constructor(t,e){super(t,eo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class po extends da{constructor(t,e,i,s,r){super(t,io),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function vo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>vo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=vo(t[i]));return e}var go=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const fo={none:0,word:1,char:2,character:2,mix:3};var mo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=xo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=xo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=wo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=wo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=wo(t,"wrapMode");void 0===c&&(c=wo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=fo[c]);var u=wo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=wo(t,"letterSpacing",0),v=wo(t,"hAlign",0),g=wo(t,"vAlign",0),f=wo(t,"justifyPercentage",.25),m=go({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),b=this.children,y=0,C=b.length;y0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=T.length,m.isLastPage=!X&&m.start===_,m.maxLineWidth=R,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ko(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=ko(t,"maxLines",0);var a=0===i,o=ko(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=ko(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=ko(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ko(t,"letterSpacing",0),p=ko(t,"rtl",!0),v=ko(t,"hAlign",p?2:0),g=ko(t,"vAlign",0),f=go({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,b=0,y=m.length;b0&&(T.push({children:E,height:M}),D=Math.max(D,M)),f.start+=_.length,f.isLastPage=f.start===k,f.maxLineHeight=D,f.linesWidth=T.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,B=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Xe(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ka(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Za);return null===i?i=new ho(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Pa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ko=Phaser.Utils.Objects.GetFastValue;var Zo={};class Qo{constructor(t){this.pools=Ko(t,"pools",Zo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=al(t,r,e,i,n),a=0;a<=rl&&0!==h;a++){if((r+=h)<0){r=0;break}h=al(t,r,e,i,n)}return a===rl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ol(t,e,i),t},hl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},al=function(t,e,i,s,r){var n,h=hl(t,e,r),a=hl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ol=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const ll=Phaser.Utils.Objects.GetValue,dl=Phaser.Utils.Objects.GetValue;class cl extends Yh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=dl(e,"background",void 0),r=dl(e,"icon",void 0),n=dl(e,"iconMask",void 0),h=dl(e,"text",void 0),a=dl(e,"action",void 0),o=dl(e,"actionMask",void 0),l=dl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:dl(e,"space.icon",0),top:dl(e,"space.iconTop",0),bottom:dl(e,"space.iconBottom",0),left:dl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:dl(e,"space.icon",0),left:dl(e,"space.iconLeft",0),right:dl(e,"space.iconRight",0),top:dl(e,"space.iconTop",0)});var d=dl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Ih.call(this,r,r,1)),!d){var c=dl(e,"iconSize",void 0);this.setIconSize(dl(e,"iconWidth",c),dl(e,"iconHeight",c))}}if(h){var u=dl(e,"wrapText",!1),p=dl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Zh(h,u),e.expandTextWidth=!0,sl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=ll(e,"minWidth",0),s=ll(e,"minHeight",0),r=ll(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return nl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),nl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=dl(e,"space.text",0),m=dl(e,"expandTextWidth",!1),b=dl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=b):(v=b?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:dl(e,"space.actionTop",0),bottom:dl(e,"space.actionBottom",0),right:dl(e,"space.actionRight",0)}:{left:dl(e,"space.actionLeft",0),right:dl(e,"space.actionRight",0),bottom:dl(e,"space.actionBottom",0)},d=dl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Ih.call(this,a,a,1)),!d)){var y=dl(e,"actionSize");this.setActionSize(dl(e,"actionWidth",y),dl(e,"actionHeight",y))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var ul={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=pl[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const pl={down:0,up:1},vl=Rh.prototype.add,gl=Rh.prototype.addSpace;var fl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&gl.call(this),vl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&gl.call(this),this.hasTailSpace=s}else vl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;vl.call(this,t,{index:r,proportion:i,expand:!0})}else vl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},ml={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Cl.call(this,e[i],t);return this}},Sl=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},wl=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Sl.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Ol={add(t){return this.buttons.push(t),t._click||(t._click=new wr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),wl.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Bl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Bl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const jl=Phaser.Utils.Objects.IsPlainObject,Il=Phaser.Utils.Objects.GetValue,Fl=Phaser.Display.Align.CENTER;var Hl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(be.call(this,t),jl(e)&&(e=Il(o=e,"padding",0),i=Il(o,"key",void 0),s=Il(o,"index",void 0),r=Il(o,"offsetX",0),n=Il(o,"offsetY",0),h=Il(o,"offsetOriginX",0),a=Il(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Fl,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},Vl={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ul={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&td.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)nd.call(this,e[i],t);return this}};const ad=Phaser.Utils.Objects.GetValue;class od extends Zl{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Dl({parent:this,eventEmitter:ad(e,"eventEmitter",this),groupName:ad(e,"groupName",void 0),clickConfig:ad(e,"click",void 0)}).setButtonsType(e);var s=ad(e,"background",void 0),r=ad(e,"buttons",void 0);this.buttonsAlign=ad(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(od.prototype,id,hd,Ml,Xl);var ld={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},dd=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=cd(t));var i=t[e];return"string"==typeof i&&(i=ld[i]),i},cd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},ud=function(){return Array.prototype.reduce.call(arguments,pd,0)},pd=function(t,e){return t+e};const vd=Phaser.Utils.Objects.IsPlainObject,gd=Phaser.Utils.Objects.GetValue,fd=Phaser.Display.Align.CENTER;var md=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return yd(this.sizerChildren,null),yh.call(this,t),this}},xd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)yd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Pd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Be.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,yd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)yd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},_d=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Td=Phaser.Utils.Objects.IsPlainObject,Ed=Phaser.Utils.Objects.GetValue;class Md extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Td(e)?(e=Ed(l=e,"x",0),i=Ed(l,"y",0),s=Ed(l,"width",void 0),r=Ed(l,"height",void 0),n=Ed(l,"column",l.col||0),h=Ed(l,"row",0),a=Ed(l,"columnProportions",0),o=Ed(l,"rowProportions",0)):Td(s)?(s=Ed(l=s,"width",void 0),r=Ed(l,"height",void 0),n=Ed(l,"column",l.col||0),h=Ed(l,"row",0),a=Ed(l,"columnProportions",0),o=Ed(l,"rowProportions",0)):Td(n)?(n=Ed(l=n,"column",l.col||0),h=Ed(l,"row",0),a=Ed(l,"columnProportions",0),o=Ed(l,"rowProportions",0)):Td(a)&&(a=Ed(l=a,"columnProportions",0),o=Ed(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Ed(l,"createCellContainerCallback")),this.setIndentLeft(Ed(l,"space.indentLeftOdd",0),Ed(l,"space.indentLeftEven",0)),this.setIndentTop(Ed(l,"space.indentTopOdd",0),Ed(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Ed(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=kd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=_d.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Md.prototype,Pd);const Dd=Phaser.Utils.Objects.GetValue;var Rd=Phaser.Renderer.WebGL.Utils,Xd=function(t,e,i,s,r,n){for(var h=Rd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Bd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Wd=Phaser.Renderer.Canvas.SetTransform;var jd={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=zd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Xd(r,h,e,l,a,o),e.isStroked&&Yd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Wd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Fd.prototype,jd);var Hd=function(t){return t.x>0&&t.y>0},Vd=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Gd=Phaser.Math.DegToRad;var Nd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Gc=Phaser.Utils.Objects.GetValue,Nc=Phaser.Utils.Objects.IsPlainObject;class Uc extends(bc(dc)){constructor(t,e,i,s,r,n,h,a){Nc(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Nc(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Nc(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Hc).setName("trackFill")).addShape((new Hc).setName("bar")).addShape((new Hc).setName("trackStroke")),this.setTrackColor(Gc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Gc(a,"trackStrokeThickness",2),Gc(a,"trackStrokeColor",void 0)),this.setSkewX(Gc(a,"skewX",0)),this.setRTL(Gc(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var $c={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Vc(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Vc(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Vc(a,0,0,e,i,t)}};Object.assign(Uc.prototype,$c);var Jc=function(t){return null==t||""===t||0===t.length},qc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Jc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Jc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=vo(i),s=vo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,y=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==O&&"number"!==O||r.add(m,0,y+n.cutX,C+n.cutY,f,g)}y+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,b=0;this._beginDraw();for(var y=0,C=this.rows.count;y0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,y)?0:1)?this._drawImage(this.textureKey,s,m,b,h,a):this._drawTileSprite(this.textureKey,s,m,b,h,a)),m+=h;b+=a}this._endDraw()},setStretchMode:function(t){return vu(t)?(this.stretchMode.edge=fu(gu(t,"edge",0)),this.stretchMode.internal=fu(gu(t,"internal",0))):(t=fu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return bu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Cu=Phaser.Utils.Objects.IsPlainObject,xu=Phaser.Utils.Objects.GetValue,Su=Phaser.GameObjects;var wu=void 0,Ou=function(t,e){if(wu||(wu={},ei(t).events.once("destroy",(function(){for(var t in wu)wu[t].destroy();wu=void 0}))),!wu.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Su[e](i)).setOrigin(0),wu[e]=t}return wu[e]};const Pu=Phaser.GameObjects.RenderTexture;class ku extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Cu(i)?(i=xu(d=i,"x",0),s=xu(d,"y",0),r=xu(d,"width",1),n=xu(d,"height",1),h=xu(d,"key",void 0),a=xu(d,"baseFrame",void 0),o=xu(d,"columns",void 0),l=xu(d,"rows",void 0)):Cu(r)?(r=xu(d=r,"width",1),n=xu(d,"height",1),h=xu(d,"key",void 0),a=xu(d,"baseFrame",void 0),o=xu(d,"columns",void 0),l=xu(d,"rows",void 0)):Cu(h)?(h=xu(d=h,"key",void 0),a=xu(d,"baseFrame",void 0),o=xu(d,"columns",void 0),l=xu(d,"rows",void 0)):Cu(a)?(a=xu(d=a,"baseFrame",void 0),o=xu(d,"columns",void 0),l=xu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=xu(d,"baseFrame",void 0)):Cu(o)&&(o=xu(d=o,"columns",void 0),l=xu(d,"rows",void 0)),void 0===a&&(a=xu(d,"frame",void 0)),void 0===o){var c=xu(d,"leftWidth",void 0),u=xu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=xu(d,"topHeight",void 0),v=xu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(xu(d,"getFrameNameCallback",void 0)),this.setStretchMode(xu(d,"stretchMode",0)),this.setPreserveRatio(xu(d,"preserveRatio",!0));var g=xu(d,"maxFixedPartScale",1),f=xu(d,"maxFixedPartScaleX",g),m=xu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,yu),i}(Pu,"rexNinePatch")){}var _u={_drawImage:function(t,e,i,s,r,n){var h=Ou(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ou(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(ku.prototype,_u);class Tu extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Qc(t,e))return t[e];var i=t.parent;return Qc(i,e)?i[e]:void 0}set(t,e,i){return Qc(t,e)?t[e]=i:Qc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Eu=Phaser.Utils.Objects.GetValue;class Mu extends ku{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Eu(e,"effects",!0);i&&ru(this,i),this.style=new Tu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Mu.prototype,ic);const Du=["alpha","tint","flipX","flipY"];var Ru=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Kc(t,e);break;case"image":s=new uu(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Mu(t,e):new ou(t,e);break;default:s=new sc(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Du.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const lp=Phaser.Utils.Objects.GetValue,dp=Phaser.Math.Distance.Between;class cp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=lp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(lp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(lp(t,"enable",!0)),this.holdThreshold=lp(t,"holdThreshold",50),this.pointerOutReleaseEnable=lp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:dp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const up=Phaser.Utils.Objects.GetValue;class pp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(up(t,"value",0)),this.setSpeed(up(t,"speed",0)),this.setAcceleration(up(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class vp{constructor(){this.value,this.dir,this.movement=new pp}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const bp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},yp=Phaser.Utils.Objects.GetValue;class Cp extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=yp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(yp(e,"speed",.1)),this.setEnable(yp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(yp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const xp=Phaser.Utils.Objects.GetValue;var Sp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?xp(s,l,void 0):xp(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=bt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new ap(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=xp(r,"position",0);"string"==typeof p&&(p=wp[p]);var v,g,f=xp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=xp(s,"space.slider",void 0))&&(a?f=0:v=xp(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:xp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:xp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:xp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:xp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=xp(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=xp(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=xp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=xp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,b,y=xp(s,"scrollDetectionMode");"string"==typeof y&&(y=Op[y]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?xp(s,C,!0):xp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==y&&(m.rectBoundsInteractive=1===y),b=new mp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,O,P,k=xp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==y&&(k.focus=1===y?2:0),x=new Cp(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,b),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",b),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),b&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),b.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const wp={right:0,left:1,bottom:0,top:1},Op={gameObject:0,rectBounds:1},Pp=Phaser.Utils.Objects.GetValue;var kp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Pp(e,"width"),h=Pp(e,"height");n||Pp(e,"child.expandWidth",!0)||(s[1]=0),h||Pp(e,"child.expandHeight",!0)||(r[1]=0);var a=new Md(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Dd(i,"child"),r=Dd(s,"gameObject",void 0);if(r){var n=Dd(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Dd(n,"top",0),h.bottom=Dd(n,"bottom",0),a.left=Dd(n,"left",0),a.right=Dd(n,"right",0);break;case 1:h.top=Dd(n,"left",0),h.bottom=Dd(n,"right",0),a.top=Dd(n,"top",0),a.bottom=Dd(n,"bottom",0);break;default:h.top=Dd(n,"top",0),h.bottom=Dd(n,"bottom",0),h.left=Dd(n,"left",0),h.right=Dd(n,"right",0)}e.add(r,{column:1,row:1,align:Dd(s,"align","center"),padding:a,expand:{width:Dd(s,"expandWidth",!0),height:Dd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Sp(t,a,"y",e);break;case 1:Sp(t,a,"x",e);break;default:Sp(t,a,"y",e),Sp(t,a,"x",e)}return a},_p=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Tp=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Ep=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(qp.prototype,Np);const Kp=["top","bottom","centerY","center"],Zp=["left","right","centerX","center"];var Qp=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=Kp.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=Zp.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const tv=Phaser.Utils.Objects.GetValue;class ev extends Xp{constructor(t,e){void 0===e&&(e={});var i=dd(e),s=tv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=tv(e,"clampChildOY",!1),s.clampChildOX=tv(e,"clampChildOX",!1);var r,n,h=new qp(t,s);switch(t.add.existing(h),i){case 0:r=tv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=tv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:tv(e,"align.panel","center")};var a=tv(e,"space",void 0);a&&(a.child=tv(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ih(this.childrenMap.child,t),this}}var iv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Qp.call(this,t,"y",e);break;case 1:Qp.call(this,t,"x",e);break;default:Qp.call(this,t,"y",e),Qp.call(this,t,"x",e)}return this}};Object.assign(ev.prototype,iv);const sv=Phaser.Utils.Objects.GetValue;var rv=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=nv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=hv(e,this.listCreateSliderTrackCallback),v=hv(e,this.listCreateSliderThumbCallback);d=new ev(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:sv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=nv(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},nv=function(t,e,i){var s;return i?(e.orientation="x",s=new od(t,e)):(e.orientation="y",s=new Yl(t,e)),t.add.existing(s),s},hv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},av=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rC.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const dv={down:0,up:1},cv=Phaser.Utils.Objects.GetValue;class uv extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Di(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),lv(t,e),t.isRexSizer&&t.layout();var i=cv(e,"touchOutsideClose",!1),s=cv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var pv={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},vv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=rv.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new uv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(vv,ul,pv);const gv=Phaser.Utils.Objects.GetValue;class fv extends cl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(gv(e,"options"));var i=gv(e,"list");this.setWrapEnable(gv(i,"wrap",!1)),this.setCreateButtonCallback(gv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(gv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(gv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(gv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(gv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(gv(i,"scroller")),this.setListMouseWheelScrollerConfig(gv(i,"mouseWheelScroller")),this.setButtonClickCallback(gv(i,"onButtonClick")),this.setButtonOverCallback(gv(i,"onButtonOver")),this.setButtonOutCallback(gv(i,"onButtonOut")),this.setListExpandDirection(gv(i,"expandDirection")),this.setListEaseInDuration(gv(i,"easeIn",500)),this.setListEaseOutDuration(gv(i,"easeOut",100)),this.setListTransitInCallback(gv(i,"transitIn")),this.settListTransitOutCallback(gv(i,"transitOut")),this.setListMaxHeight(gv(i,"maxHeight",0)),this.setListSize(gv(i,"width"),gv(i,"height",0)),this.setListAlignmentMode(gv(i,"alignParent","text")),this.setListAlignmentSide(gv(i,"alignSide","")),this.setListBounds(gv(i,"bounds")),this.setListSpace(gv(i,"space")),this.setListDraggable(gv(i,"draggable",!1)),this.setValueChangeCallback(gv(e,"setValueCallback"),gv(e,"setValueCallbackScope")),this.setValue(gv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}return Object.assign(fv.prototype,vv),fv},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdropdownlist=e(); diff --git a/dist/rexdynamictext.js b/dist/rexdynamictext.js index b71871656b..3a086b495f 100644 --- a/dist/rexdynamictext.js +++ b/dist/rexdynamictext.js @@ -2064,6 +2064,8 @@ this.setBackgroundColor(GetValue$4(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$4(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$4(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$4(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$4(o, 'backgroundRightX', 0)); return this; } @@ -2134,6 +2136,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -2288,6 +2296,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -2715,20 +2733,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rexdynamictext.min.js b/dist/rexdynamictext.min.js index 91e4779591..4bf0110519 100644 --- a/dist/rexdynamictext.min.js +++ b/dist/rexdynamictext.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.Renderer.WebGL.Utils;var e={renderWebGL:function(e,i,s,r){if(i.dirty&&(i.updateTexture(),i.dirty=!1),0!==i.width&&0!==i.height){s.addToRenderList(i);var h=i.frame,a=h.width,n=h.height,o=t.getTintAppendFloatAlpha,l=e.pipelines.set(i.pipeline,i),d=l.setTexture2D(h.glTexture,i);e.pipelines.preBatch(i),l.batchTexture(i,h.glTexture,a,n,i.x,i.y,a/i.resolution,n/i.resolution,i.scaleX,i.scaleY,i.rotation,i.flipX,i.flipY,i.scrollFactorX,i.scrollFactorY,i.displayOriginX,i.displayOriginY,0,0,a,n,o(i.tintTopLeft,s.alpha*i._alphaTL),o(i.tintTopRight,s.alpha*i._alphaTR),o(i.tintBottomLeft,s.alpha*i._alphaBL),o(i.tintBottomRight,s.alpha*i._alphaBR),i.tintFill,0,0,s,r,!1,d),e.pipelines.postBatch(i)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const i=Phaser.Display.Color;var s,r={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,h,a,n,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===h&&(h=u),void 0===a&&(a=0),void 0===n&&(n=0),void 0===o&&(o=c),void 0===l&&(l=u);var g=d.cutX+a,f=d.cutY+n;return this.context.drawImage(d.source.image,g,f,o,l,i,s,r,h),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,s){void 0===s&&(s=new i);var r=this.context.getImageData(t,e,1,1);return s.setTo(r.data[0],r.data[1],r.data[2],r.data[3]),s},setPixel(t,e,i,s,r,h){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,h=a.alpha}void 0===h&&(h=0!==i||0!==s||0!==r?255:0);var n=this.context.createImageData(1,1);return n.data[0]=i,n.data[1]=s,n.data[2]=r,n.data[3]=h,this.context.putImageData(n,t,e),this.dirty=!0,this}},h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var h=this.canvas;return void 0===s?s=h.width:s*=this.resolution,void 0===r?r=h.height:r*=this.resolution,function(t,e,i,s,r,h,a){var n,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===h&&(h=e.width),void 0===a&&(a=e.height);var d=(n=o.exists(i)?o.get(i):o.createCanvas(i,h,a)).getSourceImage();d.width!==h&&(d.width=h),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,h,a),c.drawImage(e,s,r,h,a),l.gl&&n&&l.canvasToTexture(d,n.source[0].glTexture,!0,0)}(this.scene,h,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}},a=!1;a||(void 0===s&&(s=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(D.prototype,R);const M=Phaser.Utils.String.Pad;var H=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${M(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},L=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const F=Phaser.Utils.Objects.GetValue;class z{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=F(t,"x",0),i=F(t,"y",0));var s=this.cornerRadius;s.tl=j(F(t,"tl",void 0),e,i),s.tr=j(F(t,"tr",void 0),e,i),s.bl=j(F(t,"bl",void 0),e,i),s.br=j(F(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){I(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){I(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){I(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){I(this.cornerRadius.br,t)}}var j=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),G(t),t},I=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=F(e,"x",0),t.y=F(e,"y",0)),G(t)},G=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const U=Phaser.Math.DegToRad;var $=function(t){return!t.hasOwnProperty("convex")||t.convex},V=function(t){return t.x>0&&t.y>0},E=function(t,e,i,s,r,h,a,n,o){if(n&&a>h?a-=360:!n&&a=g?1:s/g,v=r>=f?1:r/f,y=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),n=y.tl,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,o,l,o,l,180,270,!1,a):E(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),n=y.tr,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,s-o,l,o,l,270,360,!1,a):E(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),n=y.br,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,s-o,r-l,o,l,0,90,!1,a):E(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),n=y.bl,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,o,r-l,o,l,90,180,!1,a):E(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,h,a,u),null!=n)&&(null!=d&&((g=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,h)).addColorStop(0,n),g.addColorStop(1,d),n=g),e.fillStyle=n,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const q=Phaser.Utils.Objects.GetValue;class J extends D{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(q(e,"color",null),q(e,"color2",null),q(e,"horizontalGradient",!0)),this.setStroke(q(e,"stroke",null),q(e,"strokeThickness",2)),this.setCornerRadius(q(e,"cornerRadius",0),q(e,"cornerIteration",null))}set color(t){t=H(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=H(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=H(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,L("color2",t,this),L("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,L("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,L("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,h,a,n){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),N(t.canvas,t.context,d,d,o,l,r,e,i,s,h,a,n)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const K=Phaser.Utils.Objects.GetValue;class Q extends D{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(K(e,"color",null),K(e,"color2",null),K(e,"horizontalGradient",!0)),this.setStroke(K(e,"stroke",null),K(e,"strokeThickness",2))}set color(t){t=H(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=H(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=H(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,K(t,"color2",null),K(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,K(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,h=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,n=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?n.createLinearGradient(0,0,h,0):n.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,n.fillStyle=t,n.fillRect(s,r,h,a));null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(s,r,h,a))}}const Z=Phaser.Utils.Objects.GetValue;class tt{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Z(t,"bold",!1)),this.setItalic(Z(t,"italic",!1)),this.setFontSize(Z(t,"fontSize","16px")),this.setFontFamily(Z(t,"fontFamily","Courier")),this.setColor(Z(t,"color","#fff")),this.setStrokeStyle(Z(t,"stroke",null),Z(t,"strokeThickness",0)),this.setShadow(Z(t,"shadowColor",null),Z(t,"shadowOffsetX",0),Z(t,"shadowOffsetY",0),Z(t,"shadowBlur",0)),this.setOffset(Z(t,"offsetX",0),Z(t,"offsetY",0)),this.setSpace(Z(t,"leftSpace",0),Z(t,"rightSpace",0)),this.setAlign(Z(t,"align",void 0)),this.setBackgroundColor(Z(t,"backgroundColor",null)),this.setBackgroundHeight(Z(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Z(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(L("stroke",t,this),L("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(L("shadowOffsetX",t,this),L("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tt(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=H(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=H(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=H(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=H(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const et=Phaser.Utils.Array.Remove,it=Phaser.Utils.Array.Remove,st="text",rt="image",ht="drawer",at="space",nt="command";var ot=function(t){return t.type===st&&"\n"===t.text},lt=function(t){return t.type===st&&"\f"===t.text},dt=function(t){return t.type===st};class ct extends D{constructor(t,e,i){super(t,st),this.updateTextFlag=!1,this.style=new tt(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=r-this.drawTLY);var a=r-h;t.fillRect(i,a,s,h)}var n=e.hasFill,o=e.hasStroke;(n||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),n&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ut=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const gt=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class ft extends D{constructor(t,e,i){super(t,rt),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,h,a,n){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===h&&(h=t.cutHeight),void 0===n&&(n=!1),n&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=gt.create(null,r,h,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,h),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,h),o.drawImage(l,0,0,r,h,i,s,r,h),gt.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,h)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class pt extends D{constructor(t,e,i,s){super(t,ht),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class vt extends D{constructor(t,e){super(t,at),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class yt extends p{constructor(t,e,i,s,r){super(t,nt),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function xt(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>xt(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=xt(t[i]));return e}var wt=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const mt={none:0,word:1,char:2,character:2,mix:3};var bt=/^[\x00-\x7F]+$/,St=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,h=2===i,a=3===i,n=!h&&!a,o=t.length,l=e,d=s.word,c=0,u=!1;l0&&!n){var o=this.fixedHeight-s;i>0?h=o/i:(h=(l=Tt.call(this)).height,a=l.ascent,i=Math.floor((o-a)/h))}else{var l;h=(l=Tt.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Yt(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/h)):i=Yt(t,"maxLines",0);void 0===a&&(a=h);var d=0===i,c=Yt(t,"wrapMode");void 0===c&&(c=Yt(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mt[c]);var u=Yt(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var f=Yt(t,"letterSpacing",0),p=Yt(t,"hAlign",0),v=Yt(t,"vAlign",0),y=Yt(t,"justifyPercentage",.25),x=wt({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:f,maxLines:i,hAlign:p,vAlign:v,justifyPercentage:y,ascent:a,lineHeight:h,wrapWidth:u,wrapMode:c}),w=this.children,m=0,b=w.length;m0&&(_.push({children:R,width:B}),W=Math.max(W,B)),x.start+=X.length,x.isLastPage=!A&&x.start===Y,x.maxLineWidth=W,x.linesHeight=_.length*h;var j=this.fixedWidth>0?this.fixedWidth:x.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:x.linesHeight+s;for(function(t,e,i){for(var s,r,h=t.hAlign,a=t.vAlign,n=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Rt(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/h)+1}}else i=Rt(t,"maxLines",0);var n=0===i,o=Rt(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Rt(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Rt(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Rt(t,"letterSpacing",0),f=Rt(t,"rtl",!0),p=Rt(t,"hAlign",f?2:0),v=Rt(t,"vAlign",0),y=wt({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:p,vAlign:v,lineWidth:h,fixedCharacterHeight:o,wrapHeight:c,rtl:f}),x=this.children,w=0,m=x.length;w0&&(X.push({children:_,height:R}),B=Math.max(B,R)),y.start+=Y.length,y.isLastPage=y.start===O,y.maxLineHeight=B,y.linesWidth=X.length*h;var L=this.fixedWidth>0?this.fixedWidth:y.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:y.maxLineHeight+s;for(function(t,e,i){var s,r,h=t.hAlign,a=t.vAlign,n=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(h){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}n&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,h=i.top,a=i.bottom;return g(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||h!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),et(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return it(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(st);return null===i?i=new ct(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),_(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ie=Phaser.Utils.Objects.GetFastValue;var se={};class re{constructor(t){this.pools=ie(t,"pools",se)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ee),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(D.prototype,_);const L=Phaser.Utils.String.Pad;var M=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${L(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},H=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const F=Phaser.Utils.Objects.GetValue;class z{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=F(t,"x",0),i=F(t,"y",0));var s=this.cornerRadius;s.tl=j(F(t,"tl",void 0),e,i),s.tr=j(F(t,"tr",void 0),e,i),s.bl=j(F(t,"bl",void 0),e,i),s.br=j(F(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){I(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){I(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){I(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){I(this.cornerRadius.br,t)}}var j=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),G(t),t},I=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=F(e,"x",0),t.y=F(e,"y",0)),G(t)},G=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const U=Phaser.Math.DegToRad;var $=function(t){return!t.hasOwnProperty("convex")||t.convex},V=function(t){return t.x>0&&t.y>0},E=function(t,e,i,s,r,h,a,n,o){if(n&&a>h?a-=360:!n&&a=g?1:s/g,v=r>=f?1:r/f,y=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),n=y.tl,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,o,l,o,l,180,270,!1,a):E(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),n=y.tr,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,s-o,l,o,l,270,360,!1,a):E(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),n=y.br,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,s-o,r-l,o,l,0,90,!1,a):E(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),n=y.bl,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,o,r-l,o,l,90,180,!1,a):E(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,h,a,u),null!=n)&&(null!=d&&((g=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,h)).addColorStop(0,n),g.addColorStop(1,d),n=g),e.fillStyle=n,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const q=Phaser.Utils.Objects.GetValue;class J extends D{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(q(e,"color",null),q(e,"color2",null),q(e,"horizontalGradient",!0)),this.setStroke(q(e,"stroke",null),q(e,"strokeThickness",2)),this.setCornerRadius(q(e,"cornerRadius",0),q(e,"cornerIteration",null))}set color(t){t=M(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=M(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=M(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,H("color2",t,this),H("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,H("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,H("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,h,a,n){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),N(t.canvas,t.context,d,d,o,l,r,e,i,s,h,a,n)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const K=Phaser.Utils.Objects.GetValue;class Q extends D{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(K(e,"color",null),K(e,"color2",null),K(e,"horizontalGradient",!0)),this.setStroke(K(e,"stroke",null),K(e,"strokeThickness",2))}set color(t){t=M(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=M(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=M(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,K(t,"color2",null),K(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,K(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,h=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,n=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?n.createLinearGradient(0,0,h,0):n.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,n.fillStyle=t,n.fillRect(s,r,h,a));null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(s,r,h,a))}}const Z=Phaser.Utils.Objects.GetValue;class tt{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Z(t,"bold",!1)),this.setItalic(Z(t,"italic",!1)),this.setFontSize(Z(t,"fontSize","16px")),this.setFontFamily(Z(t,"fontFamily","Courier")),this.setColor(Z(t,"color","#fff")),this.setStrokeStyle(Z(t,"stroke",null),Z(t,"strokeThickness",0)),this.setShadow(Z(t,"shadowColor",null),Z(t,"shadowOffsetX",0),Z(t,"shadowOffsetY",0),Z(t,"shadowBlur",0)),this.setOffset(Z(t,"offsetX",0),Z(t,"offsetY",0)),this.setSpace(Z(t,"leftSpace",0),Z(t,"rightSpace",0)),this.setAlign(Z(t,"align",void 0)),this.setBackgroundColor(Z(t,"backgroundColor",null)),this.setBackgroundHeight(Z(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Z(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Z(t,"backgroundLeftX",0)),this.setBackgroundRightX(Z(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(H("stroke",t,this),H("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(H("shadowOffsetX",t,this),H("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tt(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=M(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=M(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=M(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=M(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const et=Phaser.Utils.Array.Remove,it=Phaser.Utils.Array.Remove,st="text",rt="image",ht="drawer",at="space",nt="command";var ot=function(t){return t.type===st&&"\n"===t.text},lt=function(t){return t.type===st&&"\f"===t.text},dt=function(t){return t.type===st};class ct extends D{constructor(t,e,i){super(t,st),this.updateTextFlag=!1,this.style=new tt(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var h=e.backgroundBottomY;null==h&&(h=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=h-this.drawTLY);var n=h-a;t.fillRect(s,n,r,a)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ut=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const gt=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class ft extends D{constructor(t,e,i){super(t,rt),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,h,a,n){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===h&&(h=t.cutHeight),void 0===n&&(n=!1),n&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=gt.create(null,r,h,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,h),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,h),o.drawImage(l,0,0,r,h,i,s,r,h),gt.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,h)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class pt extends D{constructor(t,e,i,s){super(t,ht),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class vt extends D{constructor(t,e){super(t,at),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class yt extends p{constructor(t,e,i,s,r){super(t,nt),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function xt(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>xt(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=xt(t[i]));return e}var wt=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const mt={none:0,word:1,char:2,character:2,mix:3};var bt=/^[\x00-\x7F]+$/,kt=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,h=2===i,a=3===i,n=!h&&!a,o=t.length,l=e,d=s.word,c=0,u=!1;l0&&!n){var o=this.fixedHeight-s;i>0?h=o/i:(h=(l=Ot.call(this)).height,a=l.ascent,i=Math.floor((o-a)/h))}else{var l;h=(l=Ot.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Xt(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/h)):i=Xt(t,"maxLines",0);void 0===a&&(a=h);var d=0===i,c=Xt(t,"wrapMode");void 0===c&&(c=Xt(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mt[c]);var u=Xt(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var f=Xt(t,"letterSpacing",0),p=Xt(t,"hAlign",0),v=Xt(t,"vAlign",0),y=Xt(t,"justifyPercentage",.25),x=wt({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:f,maxLines:i,hAlign:p,vAlign:v,justifyPercentage:y,ascent:a,lineHeight:h,wrapWidth:u,wrapMode:c}),w=this.children,m=0,b=w.length;m0&&(R.push({children:_,width:B}),W=Math.max(W,B)),x.start+=Y.length,x.isLastPage=!A&&x.start===X,x.maxLineWidth=W,x.linesHeight=R.length*h;var j=this.fixedWidth>0?this.fixedWidth:x.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:x.linesHeight+s;for(function(t,e,i){for(var s,r,h=t.hAlign,a=t.vAlign,n=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_t(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/h)+1}}else i=_t(t,"maxLines",0);var n=0===i,o=_t(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_t(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=_t(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_t(t,"letterSpacing",0),f=_t(t,"rtl",!0),p=_t(t,"hAlign",f?2:0),v=_t(t,"vAlign",0),y=wt({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:p,vAlign:v,lineWidth:h,fixedCharacterHeight:o,wrapHeight:c,rtl:f}),x=this.children,w=0,m=x.length;w0&&(Y.push({children:R,height:_}),B=Math.max(B,_)),y.start+=X.length,y.isLastPage=y.start===T,y.maxLineHeight=B,y.linesWidth=Y.length*h;var H=this.fixedWidth>0?this.fixedWidth:y.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:y.maxLineHeight+s;for(function(t,e,i){var s,r,h=t.hAlign,a=t.vAlign,n=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(h){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}n&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,h=i.top,a=i.bottom;return g(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||h!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),et(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return it(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(st);return null===i?i=new ct(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),R(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ie=Phaser.Utils.Objects.GetFastValue;var se={};class re{constructor(t){this.pools=ie(t,"pools",se)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ee),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rexdynamictextplugin.min.js b/dist/rexdynamictextplugin.min.js index ea0a6aca74..c61cb96877 100644 --- a/dist/rexdynamictextplugin.min.js +++ b/dist/rexdynamictextplugin.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.Renderer.WebGL.Utils;var e={renderWebGL:function(e,i,s,r){if(i.dirty&&(i.updateTexture(),i.dirty=!1),0!==i.width&&0!==i.height){s.addToRenderList(i);var h=i.frame,a=h.width,n=h.height,o=t.getTintAppendFloatAlpha,l=e.pipelines.set(i.pipeline,i),d=l.setTexture2D(h.glTexture,i);e.pipelines.preBatch(i),l.batchTexture(i,h.glTexture,a,n,i.x,i.y,a/i.resolution,n/i.resolution,i.scaleX,i.scaleY,i.rotation,i.flipX,i.flipY,i.scrollFactorX,i.scrollFactorY,i.displayOriginX,i.displayOriginY,0,0,a,n,o(i.tintTopLeft,s.alpha*i._alphaTL),o(i.tintTopRight,s.alpha*i._alphaTR),o(i.tintBottomLeft,s.alpha*i._alphaBL),o(i.tintBottomRight,s.alpha*i._alphaBR),i.tintFill,0,0,s,r,!1,d),e.pipelines.postBatch(i)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const i=Phaser.Display.Color;var s,r={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,h,a,n,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===h&&(h=u),void 0===a&&(a=0),void 0===n&&(n=0),void 0===o&&(o=c),void 0===l&&(l=u);var g=d.cutX+a,f=d.cutY+n;return this.context.drawImage(d.source.image,g,f,o,l,i,s,r,h),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,s){void 0===s&&(s=new i);var r=this.context.getImageData(t,e,1,1);return s.setTo(r.data[0],r.data[1],r.data[2],r.data[3]),s},setPixel(t,e,i,s,r,h){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,h=a.alpha}void 0===h&&(h=0!==i||0!==s||0!==r?255:0);var n=this.context.createImageData(1,1);return n.data[0]=i,n.data[1]=s,n.data[2]=r,n.data[3]=h,this.context.putImageData(n,t,e),this.dirty=!0,this}},h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var h=this.canvas;return void 0===s?s=h.width:s*=this.resolution,void 0===r?r=h.height:r*=this.resolution,function(t,e,i,s,r,h,a){var n,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===h&&(h=e.width),void 0===a&&(a=e.height);var d=(n=o.exists(i)?o.get(i):o.createCanvas(i,h,a)).getSourceImage();d.width!==h&&(d.width=h),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,h,a),c.drawImage(e,s,r,h,a),l.gl&&n&&l.canvasToTexture(d,n.source[0].glTexture,!0,0)}(this.scene,h,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}},a=!1;a||(void 0===s&&(s=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(D.prototype,R);const M=Phaser.Utils.String.Pad;var H=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${M(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},L=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const F=Phaser.Utils.Objects.GetValue;class z{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=F(t,"x",0),i=F(t,"y",0));var s=this.cornerRadius;s.tl=j(F(t,"tl",void 0),e,i),s.tr=j(F(t,"tr",void 0),e,i),s.bl=j(F(t,"bl",void 0),e,i),s.br=j(F(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){G(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){G(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){G(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){G(this.cornerRadius.br,t)}}var j=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),I(t),t},G=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=F(e,"x",0),t.y=F(e,"y",0)),I(t)},I=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const U=Phaser.Math.DegToRad;var $=function(t){return!t.hasOwnProperty("convex")||t.convex},V=function(t){return t.x>0&&t.y>0},E=function(t,e,i,s,r,h,a,n,o){if(n&&a>h?a-=360:!n&&a=g?1:s/g,v=r>=f?1:r/f,y=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),n=y.tl,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,o,l,o,l,180,270,!1,a):E(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),n=y.tr,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,s-o,l,o,l,270,360,!1,a):E(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),n=y.br,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,s-o,r-l,o,l,0,90,!1,a):E(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),n=y.bl,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,o,r-l,o,l,90,180,!1,a):E(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,h,a,u),null!=n)&&(null!=d&&((g=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,h)).addColorStop(0,n),g.addColorStop(1,d),n=g),e.fillStyle=n,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const q=Phaser.Utils.Objects.GetValue;class J extends D{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(q(e,"color",null),q(e,"color2",null),q(e,"horizontalGradient",!0)),this.setStroke(q(e,"stroke",null),q(e,"strokeThickness",2)),this.setCornerRadius(q(e,"cornerRadius",0),q(e,"cornerIteration",null))}set color(t){t=H(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=H(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=H(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,L("color2",t,this),L("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,L("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,L("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,h,a,n){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),N(t.canvas,t.context,d,d,o,l,r,e,i,s,h,a,n)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const K=Phaser.Utils.Objects.GetValue;class Q extends D{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(K(e,"color",null),K(e,"color2",null),K(e,"horizontalGradient",!0)),this.setStroke(K(e,"stroke",null),K(e,"strokeThickness",2))}set color(t){t=H(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=H(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=H(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,K(t,"color2",null),K(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,K(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,h=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,n=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?n.createLinearGradient(0,0,h,0):n.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,n.fillStyle=t,n.fillRect(s,r,h,a));null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(s,r,h,a))}}const Z=Phaser.Utils.Objects.GetValue;class tt{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Z(t,"bold",!1)),this.setItalic(Z(t,"italic",!1)),this.setFontSize(Z(t,"fontSize","16px")),this.setFontFamily(Z(t,"fontFamily","Courier")),this.setColor(Z(t,"color","#fff")),this.setStrokeStyle(Z(t,"stroke",null),Z(t,"strokeThickness",0)),this.setShadow(Z(t,"shadowColor",null),Z(t,"shadowOffsetX",0),Z(t,"shadowOffsetY",0),Z(t,"shadowBlur",0)),this.setOffset(Z(t,"offsetX",0),Z(t,"offsetY",0)),this.setSpace(Z(t,"leftSpace",0),Z(t,"rightSpace",0)),this.setAlign(Z(t,"align",void 0)),this.setBackgroundColor(Z(t,"backgroundColor",null)),this.setBackgroundHeight(Z(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Z(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(L("stroke",t,this),L("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(L("shadowOffsetX",t,this),L("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tt(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=H(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=H(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=H(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=H(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const et=Phaser.Utils.Array.Remove,it=Phaser.Utils.Array.Remove,st="text",rt="image",ht="drawer",at="space",nt="command";var ot=function(t){return t.type===st&&"\n"===t.text},lt=function(t){return t.type===st&&"\f"===t.text},dt=function(t){return t.type===st};class ct extends D{constructor(t,e,i){super(t,st),this.updateTextFlag=!1,this.style=new tt(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=r-this.drawTLY);var a=r-h;t.fillRect(i,a,s,h)}var n=e.hasFill,o=e.hasStroke;(n||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),n&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ut=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const gt=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class ft extends D{constructor(t,e,i){super(t,rt),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,h,a,n){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===h&&(h=t.cutHeight),void 0===n&&(n=!1),n&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=gt.create(null,r,h,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,h),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,h),o.drawImage(l,0,0,r,h,i,s,r,h),gt.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,h)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class pt extends D{constructor(t,e,i,s){super(t,ht),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class vt extends D{constructor(t,e){super(t,at),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class yt extends p{constructor(t,e,i,s,r){super(t,nt),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function xt(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>xt(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=xt(t[i]));return e}var wt=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const mt={none:0,word:1,char:2,character:2,mix:3};var bt=/^[\x00-\x7F]+$/,St=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,h=2===i,a=3===i,n=!h&&!a,o=t.length,l=e,d=s.word,c=0,u=!1;l0&&!n){var o=this.fixedHeight-s;i>0?h=o/i:(h=(l=Ot.call(this)).height,a=l.ascent,i=Math.floor((o-a)/h))}else{var l;h=(l=Ot.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Yt(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/h)):i=Yt(t,"maxLines",0);void 0===a&&(a=h);var d=0===i,c=Yt(t,"wrapMode");void 0===c&&(c=Yt(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mt[c]);var u=Yt(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var f=Yt(t,"letterSpacing",0),p=Yt(t,"hAlign",0),v=Yt(t,"vAlign",0),y=Yt(t,"justifyPercentage",.25),x=wt({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:f,maxLines:i,hAlign:p,vAlign:v,justifyPercentage:y,ascent:a,lineHeight:h,wrapWidth:u,wrapMode:c}),w=this.children,m=0,b=w.length;m0&&(_.push({children:R,width:B}),W=Math.max(W,B)),x.start+=X.length,x.isLastPage=!A&&x.start===Y,x.maxLineWidth=W,x.linesHeight=_.length*h;var j=this.fixedWidth>0?this.fixedWidth:x.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:x.linesHeight+s;for(function(t,e,i){for(var s,r,h=t.hAlign,a=t.vAlign,n=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Rt(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/h)+1}}else i=Rt(t,"maxLines",0);var n=0===i,o=Rt(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Rt(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Rt(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Rt(t,"letterSpacing",0),f=Rt(t,"rtl",!0),p=Rt(t,"hAlign",f?2:0),v=Rt(t,"vAlign",0),y=wt({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:p,vAlign:v,lineWidth:h,fixedCharacterHeight:o,wrapHeight:c,rtl:f}),x=this.children,w=0,m=x.length;w0&&(X.push({children:_,height:R}),B=Math.max(B,R)),y.start+=Y.length,y.isLastPage=y.start===T,y.maxLineHeight=B,y.linesWidth=X.length*h;var L=this.fixedWidth>0?this.fixedWidth:y.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:y.maxLineHeight+s;for(function(t,e,i){var s,r,h=t.hAlign,a=t.vAlign,n=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(h){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}n&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,h=i.top,a=i.bottom;return g(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||h!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),et(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return it(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(st);return null===i?i=new ct(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),_(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ie=Phaser.Utils.Objects.GetFastValue;var se={};class re{constructor(t){this.pools=ie(t,"pools",se)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ee),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(D.prototype,_);const L=Phaser.Utils.String.Pad;var M=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${L(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},H=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const F=Phaser.Utils.Objects.GetValue;class z{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=F(t,"x",0),i=F(t,"y",0));var s=this.cornerRadius;s.tl=j(F(t,"tl",void 0),e,i),s.tr=j(F(t,"tr",void 0),e,i),s.bl=j(F(t,"bl",void 0),e,i),s.br=j(F(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){G(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){G(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){G(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){G(this.cornerRadius.br,t)}}var j=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),I(t),t},G=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=F(e,"x",0),t.y=F(e,"y",0)),I(t)},I=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const U=Phaser.Math.DegToRad;var $=function(t){return!t.hasOwnProperty("convex")||t.convex},V=function(t){return t.x>0&&t.y>0},E=function(t,e,i,s,r,h,a,n,o){if(n&&a>h?a-=360:!n&&a=g?1:s/g,v=r>=f?1:r/f,y=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),n=y.tl,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,o,l,o,l,180,270,!1,a):E(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),n=y.tr,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,s-o,l,o,l,270,360,!1,a):E(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),n=y.br,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,s-o,r-l,o,l,0,90,!1,a):E(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),n=y.bl,V(n)?(o=n.x*p,l=n.y*v,$(n)?E(t,o,r-l,o,l,90,180,!1,a):E(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,h,a,u),null!=n)&&(null!=d&&((g=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,h)).addColorStop(0,n),g.addColorStop(1,d),n=g),e.fillStyle=n,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const q=Phaser.Utils.Objects.GetValue;class J extends D{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(q(e,"color",null),q(e,"color2",null),q(e,"horizontalGradient",!0)),this.setStroke(q(e,"stroke",null),q(e,"strokeThickness",2)),this.setCornerRadius(q(e,"cornerRadius",0),q(e,"cornerIteration",null))}set color(t){t=M(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=M(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=M(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,H("color2",t,this),H("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,H("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,H("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,h,a,n){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),N(t.canvas,t.context,d,d,o,l,r,e,i,s,h,a,n)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const K=Phaser.Utils.Objects.GetValue;class Q extends D{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(K(e,"color",null),K(e,"color2",null),K(e,"horizontalGradient",!0)),this.setStroke(K(e,"stroke",null),K(e,"strokeThickness",2))}set color(t){t=M(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=M(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=M(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,K(t,"color2",null),K(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,K(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,h=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,n=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?n.createLinearGradient(0,0,h,0):n.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,n.fillStyle=t,n.fillRect(s,r,h,a));null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(s,r,h,a))}}const Z=Phaser.Utils.Objects.GetValue;class tt{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Z(t,"bold",!1)),this.setItalic(Z(t,"italic",!1)),this.setFontSize(Z(t,"fontSize","16px")),this.setFontFamily(Z(t,"fontFamily","Courier")),this.setColor(Z(t,"color","#fff")),this.setStrokeStyle(Z(t,"stroke",null),Z(t,"strokeThickness",0)),this.setShadow(Z(t,"shadowColor",null),Z(t,"shadowOffsetX",0),Z(t,"shadowOffsetY",0),Z(t,"shadowBlur",0)),this.setOffset(Z(t,"offsetX",0),Z(t,"offsetY",0)),this.setSpace(Z(t,"leftSpace",0),Z(t,"rightSpace",0)),this.setAlign(Z(t,"align",void 0)),this.setBackgroundColor(Z(t,"backgroundColor",null)),this.setBackgroundHeight(Z(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Z(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Z(t,"backgroundLeftX",0)),this.setBackgroundRightX(Z(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(H("stroke",t,this),H("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(H("shadowOffsetX",t,this),H("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tt(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=M(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=M(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=M(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=M(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const et=Phaser.Utils.Array.Remove,it=Phaser.Utils.Array.Remove,st="text",rt="image",ht="drawer",at="space",nt="command";var ot=function(t){return t.type===st&&"\n"===t.text},lt=function(t){return t.type===st&&"\f"===t.text},dt=function(t){return t.type===st};class ct extends D{constructor(t,e,i){super(t,st),this.updateTextFlag=!1,this.style=new tt(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var h=e.backgroundBottomY;null==h&&(h=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=h-this.drawTLY);var n=h-a;t.fillRect(s,n,r,a)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ut=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const gt=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class ft extends D{constructor(t,e,i){super(t,rt),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,h,a,n){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===h&&(h=t.cutHeight),void 0===n&&(n=!1),n&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=gt.create(null,r,h,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,h),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,h),o.drawImage(l,0,0,r,h,i,s,r,h),gt.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,h)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class pt extends D{constructor(t,e,i,s){super(t,ht),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class vt extends D{constructor(t,e){super(t,at),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class yt extends p{constructor(t,e,i,s,r){super(t,nt),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function xt(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>xt(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=xt(t[i]));return e}var wt=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const mt={none:0,word:1,char:2,character:2,mix:3};var bt=/^[\x00-\x7F]+$/,kt=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,h=2===i,a=3===i,n=!h&&!a,o=t.length,l=e,d=s.word,c=0,u=!1;l0&&!n){var o=this.fixedHeight-s;i>0?h=o/i:(h=(l=Ot.call(this)).height,a=l.ascent,i=Math.floor((o-a)/h))}else{var l;h=(l=Ot.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Xt(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/h)):i=Xt(t,"maxLines",0);void 0===a&&(a=h);var d=0===i,c=Xt(t,"wrapMode");void 0===c&&(c=Xt(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mt[c]);var u=Xt(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var f=Xt(t,"letterSpacing",0),p=Xt(t,"hAlign",0),v=Xt(t,"vAlign",0),y=Xt(t,"justifyPercentage",.25),x=wt({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:f,maxLines:i,hAlign:p,vAlign:v,justifyPercentage:y,ascent:a,lineHeight:h,wrapWidth:u,wrapMode:c}),w=this.children,m=0,b=w.length;m0&&(R.push({children:_,width:B}),W=Math.max(W,B)),x.start+=Y.length,x.isLastPage=!A&&x.start===X,x.maxLineWidth=W,x.linesHeight=R.length*h;var j=this.fixedWidth>0?this.fixedWidth:x.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:x.linesHeight+s;for(function(t,e,i){for(var s,r,h=t.hAlign,a=t.vAlign,n=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_t(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/h)+1}}else i=_t(t,"maxLines",0);var n=0===i,o=_t(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_t(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=_t(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_t(t,"letterSpacing",0),f=_t(t,"rtl",!0),p=_t(t,"hAlign",f?2:0),v=_t(t,"vAlign",0),y=wt({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:p,vAlign:v,lineWidth:h,fixedCharacterHeight:o,wrapHeight:c,rtl:f}),x=this.children,w=0,m=x.length;w0&&(Y.push({children:R,height:_}),B=Math.max(B,_)),y.start+=X.length,y.isLastPage=y.start===T,y.maxLineHeight=B,y.linesWidth=Y.length*h;var H=this.fixedWidth>0?this.fixedWidth:y.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:y.maxLineHeight+s;for(function(t,e,i){var s,r,h=t.hAlign,a=t.vAlign,n=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(h){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}n&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,h=i.top,a=i.bottom;return g(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||h!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),et(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return it(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(st);return null===i?i=new ct(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),R(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ie=Phaser.Utils.Objects.GetFastValue;var se={};class re{constructor(t){this.pools=ie(t,"pools",se)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ee),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rexfileselectorbutton.min.js b/dist/rexfileselectorbutton.min.js index 983ab71621..ca5953cd00 100644 --- a/dist/rexfileselectorbutton.min.js +++ b/dist/rexfileselectorbutton.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},z=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const ke=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?fi:gi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=fi))}get t(){var t;switch(this.state){case vi:case gi:case mi:t=0;break;case fi:t=this.nowTime/this.duration;break;case yi:t=1}return ui(t,0,1)}set t(t){(t=ui(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===fi}get isRunning(){return this.state===gi||this.state===fi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,gi=1,fi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;class _i extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const ki={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Ii extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Bi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,Ji=Phaser.Math.Linear;class qi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=$i(t,"x",void 0),i=$i(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=$i(i,"startX",void 0),this.startY=$i(i,"startY",void 0),this.endX=$i(i,"endX",void 0),this.endY=$i(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ji(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ji(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends hi{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,cs=Phaser.Math.Linear;class us extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=cs(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new us(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},fs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ds,Ls,Ys,zs);const As=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,Xs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Is(e):t};class Ws extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;class Bs extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends Bs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var $s={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha)},qs=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Js)),this.setCoverTransitOutCallback(Ks(i,"transitOut",qs)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=$s.popUp;break;case tr.fadeIn:t=$s.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=$s.scaleDown;break;case tr.fadeOut:t=$s.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return wr.length=0,!0;return wr.length=0,!1},wr=[];const Sr=Phaser.Utils.Objects.GetValue;class Pr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Or[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Ms{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Er extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Mr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Jr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const $r=0,Jr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=an,0===this.holdTime&&(this.state=on)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&t-this.pointer.downTime>=this.holdTime&&(this.state=on)}get isPressed(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=kn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case _n:this.tracerState=Tn,this.onDrag1End();break;case kn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case kn:this.onDrag2()}}}dragCancel(){return this.tracerState===kn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(Pn.prototype,Ve);var On={};const Tn=0,_n=1,kn=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Dn={};const Ln=Phaser.Utils.Objects.GetValue,Yn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Yn(Xn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Yn(Xn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Wn="BEGIN",jn="RECOGNIZED",Bn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Bn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},zr.call(t,e),Fr.call(t,e),jr.call(t,e),Ur.call(t,e),Hn.call(t,e),Un.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",de),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ce(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;fe.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=oh[e];else if(nh(e)){var f;e=hh(f=e,"proportion",void 0),i=hh(f,"align",ah),s=hh(f,"padding",0),r=hh(f,"expand",!1),n=hh(f,"key",void 0),h=hh(f,"index",void 0),t.isRexSizer||(a=hh(f,"minWidth",void 0),o=hh(f,"minHeight",void 0)),l=hh(f,"fitRatio",0),d=hh(f,"offsetX",0),c=hh(f,"offsetY",0),u=hh(f,"offsetOriginX",0),p=hh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ve(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Et.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(bh,dh,vh,gh,fh,mh,yh);var Ch=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=xh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ch.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,bh);var Oh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Th={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class _h extends Ph{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Oh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Oh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(_h.prototype,Th);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Eh=Phaser.GameObjects.Graphics;class Mh extends Eh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Rh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Rh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Mh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Lh=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Lh};const zh=Phaser.GameObjects.BitmapText;var Xh=function(t){return t instanceof zh},Ah=/^[\x00-\x7F]+$/,Fh=function(t){return Ah.test(t)},Ih=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},jh=2;const Bh={none:0,word:1,char:jh,character:jh,mix:3};var Hh=function(t,e){var i=function(t){return Xh(t)?2:Yh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e}};const Nh=Phaser.Renderer.WebGL.Utils;var Uh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Nh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Gh=Phaser.Display.Color;var Vh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Gh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},$h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Jh=Phaser.Display.Canvas.CanvasPool,qh=Phaser.GameObjects.GameObject,Zh=Phaser.Utils.String.UUID;class Kh extends qh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Jh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Zh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Jh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Qh=Phaser.GameObjects.Components;Phaser.Class.mixin(Kh,[Qh.Alpha,Qh.BlendMode,Qh.Crop,Qh.Depth,Qh.Flip,Qh.GetBounds,Qh.Mask,Qh.Origin,Qh.Pipeline,Qh.PostPipeline,Qh.ScrollFactor,Qh.Tint,Qh.Transform,Qh.Visible,Uh,Vh,$h]);var ta={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Os(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ea{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ea.prototype,ta);var ia={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const sa=Phaser.Math.RotateAround;var ra;const na=Phaser.Geom.Rectangle;var ha,aa=function(t){void 0===ha&&(ha=new na);var e=t.drawTLX,i=t.drawTLY;return ha.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ha};const oa=Phaser.Math.RotateAround;var la,da=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===la&&(la={}),s=la),s.x=e,s.y=i,0!==t.rotation&&oa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ca=Phaser.GameObjects.Components.TransformMatrix;var ua,pa,va={},ga=function(t,e,i,s,r){var n=da(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=va);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ua&&(ua=new ca,pa=new ca),t.parentContainer?t.getWorldTransformMatrix(ua,pa):ua.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ua.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},fa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ga(t,e,n,h,r)},ma={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ra&&(ra={}),s=ra),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&sa(s,0,0,-i.rotation),s}(t,e,this,!0);return aa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return fa(this.parent,this,t,e,i)}};Object.assign(ma,ia);const ya=Phaser.Math.DegToRad,ba=Phaser.Math.RadToDeg,Ca=Phaser.Utils.Objects.GetValue;class xa extends ea{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ba(this._rotation)}set angle(t){this.rotation=ya(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ca(t,"width",void 0),i=Ca(t,"height",void 0),s=Ca(t,"scaleX",void 0),r=Ca(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(xa.prototype,ma);const wa=Phaser.Utils.String.Pad;var Sa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${wa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Pa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Oa=Phaser.Utils.Objects.GetValue;class Ta{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Oa(t,"x",0),i=Oa(t,"y",0));var s=this.cornerRadius;s.tl=_a(Oa(t,"tl",void 0),e,i),s.tr=_a(Oa(t,"tr",void 0),e,i),s.bl=_a(Oa(t,"bl",void 0),e,i),s.br=_a(Oa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ka(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ka(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ka(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ka(this.cornerRadius.br,t)}}var _a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ea(t),t},ka=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Oa(e,"x",0),t.y=Oa(e,"y",0)),Ea(t)},Ea=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ma=Phaser.Math.DegToRad;var Ra=function(t){return!t.hasOwnProperty("convex")||t.convex},Da=function(t){return t.x>0&&t.y>0},La=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,o,l,o,l,180,270,!1,h):La(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,s-o,l,o,l,270,360,!1,h):La(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,s-o,r-l,o,l,0,90,!1,h):La(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,o,r-l,o,l,90,180,!1,h):La(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const za=Phaser.Utils.Objects.GetValue;class Xa extends xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2)),this.setCornerRadius(za(e,"cornerRadius",0),za(e,"cornerIteration",null))}set color(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Pa("color2",t,this),Pa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Pa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Pa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ya(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Aa=Phaser.Utils.Objects.GetValue;class Fa extends xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Aa(e,"color",null),Aa(e,"color2",null),Aa(e,"horizontalGradient",!0)),this.setStroke(Aa(e,"stroke",null),Aa(e,"strokeThickness",2))}set color(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Aa(t,"color2",null),Aa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ia=Phaser.Utils.Objects.GetValue;class Wa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ia(t,"bold",!1)),this.setItalic(Ia(t,"italic",!1)),this.setFontSize(Ia(t,"fontSize","16px")),this.setFontFamily(Ia(t,"fontFamily","Courier")),this.setColor(Ia(t,"color","#fff")),this.setStrokeStyle(Ia(t,"stroke",null),Ia(t,"strokeThickness",0)),this.setShadow(Ia(t,"shadowColor",null),Ia(t,"shadowOffsetX",0),Ia(t,"shadowOffsetY",0),Ia(t,"shadowBlur",0)),this.setOffset(Ia(t,"offsetX",0),Ia(t,"offsetY",0)),this.setSpace(Ia(t,"leftSpace",0),Ia(t,"rightSpace",0)),this.setAlign(Ia(t,"align",void 0)),this.setBackgroundColor(Ia(t,"backgroundColor",null)),this.setBackgroundHeight(Ia(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ia(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Pa("stroke",t,this),Pa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Pa("shadowOffsetX",t,this),Pa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Wa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Sa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Sa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Sa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Sa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const ja=Phaser.Utils.Array.Remove,Ba=Phaser.Utils.Array.Remove,Ha="text",Na="image",Ua="drawer",Ga="space",Va="command";var $a=function(t){return t.type===Ha&&"\n"===t.text},Ja=function(t){return t.type===Ha&&"\f"===t.text},qa=function(t){return t.type===Ha};class Za extends xa{constructor(t,e,i){super(t,Ha),this.updateTextFlag=!1,this.style=new Wa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ka=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Qa=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class to extends xa{constructor(t,e,i){super(t,Na),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Qa.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Qa.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class eo extends xa{constructor(t,e,i,s){super(t,Ua),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class io extends xa{constructor(t,e){super(t,Ga),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class so extends ea{constructor(t,e,i,s,r){super(t,Va),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function ro(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ro(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ro(t[i]));return e}var no=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const ho={none:0,word:1,char:2,character:2,mix:3};var ao=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=uo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=uo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=vo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=vo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=vo(t,"wrapMode");void 0===c&&(c=vo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=ho[c]);var u=vo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=vo(t,"letterSpacing",0),v=vo(t,"hAlign",0),g=vo(t,"vAlign",0),f=vo(t,"justifyPercentage",.25),m=no({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=k.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=D,m.linesHeight=E.length*n;var W=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=mo(t,"maxLines",0);var a=0===i,o=mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=mo(t,"letterSpacing",0),p=mo(t,"rtl",!0),v=mo(t,"hAlign",p?2:0),g=mo(t,"vAlign",0),f=no({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Me(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ja(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ba(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ha);return null===i?i=new Za(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),fa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Bo=Phaser.Utils.Objects.GetFastValue;var Ho={};class No{constructor(t){this.pools=Bo(t,"pools",Ho)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new jo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Ko(t,r,e,i,n),a=0;a<=Jo&&0!==h;a++){if((r+=h)<0){r=0;break}h=Ko(t,r,e,i,n)}return a===Jo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Qo(t,e,i),t},Zo=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ko=function(t,e,i,s,r){var n,h=Zo(t,e,r),a=Zo(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Qo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const tl=Phaser.Utils.Objects.GetValue,el=Phaser.Utils.Objects.GetValue;class il extends _h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=el(e,"background",void 0),r=el(e,"icon",void 0),n=el(e,"iconMask",void 0),h=el(e,"text",void 0),a=el(e,"action",void 0),o=el(e,"actionMask",void 0),l=el(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:el(e,"space.icon",0),top:el(e,"space.iconTop",0),bottom:el(e,"space.iconBottom",0),left:el(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:el(e,"space.icon",0),left:el(e,"space.iconLeft",0),right:el(e,"space.iconRight",0),top:el(e,"space.iconTop",0)});var d=el(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var c=el(e,"iconSize",void 0);this.setIconSize(el(e,"iconWidth",c),el(e,"iconHeight",c))}}if(h){var u=el(e,"wrapText",!1),p=el(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Hh(h,u),e.expandTextWidth=!0,$o(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=tl(e,"minWidth",0),s=tl(e,"minHeight",0),r=tl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return qo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),qo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=el(e,"space.text",0),m=el(e,"expandTextWidth",!1),y=el(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:el(e,"space.actionTop",0),bottom:el(e,"space.actionBottom",0),right:el(e,"space.actionRight",0)}:{left:el(e,"space.actionLeft",0),right:el(e,"space.actionRight",0),bottom:el(e,"space.actionBottom",0)},d=el(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var b=el(e,"actionSize");this.setActionSize(el(e,"actionWidth",b),el(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}Phaser.Utils.Objects.GetValue;var sl=function({game:t,fileInput:e,closeDelay:i}){return Ri(Qe(t).events,"focus").then((function(){return void 0===(t=i)&&(t=0),new Promise((function(i,s){setTimeout((function(){i(e)}),t)}));var t,e})).then((function(){var t={files:e.files};return Promise.resolve(t)}))};Phaser.Utils.Objects.GetValue,Phaser.DOM.RemoveFromDOM;var rl=function(t,e,i,s,r,n){if(null===r||!1===r);else if(er(r))r();else{var h=function(t,e,i){if(void 0===i)switch(e){case"image":case"svg":i="textures";break;case"animation":i="json";break;case"tilemapTiledJSON":case"tilemapCSV":i="tilemap";break;case"glsl":i="shader";break;default:i=e}return t=Qe(t),"textures"===i?t.textures:t.cache[i]}(t,i,r);h.exists(s)&&h.remove(s)}var a=t.load;if(n&&a.once(`filecomplete-${i}-${s}`,(function(t,e,i){n(i)})),er(e))e();else{var o=window.URL.createObjectURL(e);a[i](s,o)}a.start()},nl={loadFile:function(t,e,i,s,r){var n=this.scene;return rl(n,t,e,i,s,r),this},loadFilePromise:function(t,e,i,s){var r=this.scene;return new Promise((function(n,h){rl(r,t,e,i,s,(function(t){n(t)}))}))}};const hl=Phaser.GameObjects.DOMElement,al=Phaser.Utils.Objects.IsPlainObject,ol=Phaser.Utils.Objects.GetValue;class ll extends hl{constructor(t,e,i,s,r,n){al(e)?(e=ol(n=e,"x",0),i=ol(n,"y",0),s=ol(n,"width",0),r=ol(n,"height",0)):al(s)&&(s=ol(n=s,"width",0),r=ol(n,"height",0));var h=document.createElement("input");h.type="file",h.style.display="none";var a=document.createElement("label");a.appendChild(h);var o=ol(n,"style",void 0);super(t,e,i,a,o),this.type="rexFileChooser",this.resetFromJSON(n),this.resize(s,r);var l=this;h.onchange=function(){l.emit("change",l)},this.setCloseDelay(ol(n,"closeDelay",200)),h.onclick=function(){sl({game:t,fileInput:h,closeDelay:l.closeDelay}).then((function(){l.emit("select",l)}))}}resetFromJSON(t){return this.setAccept(ol(t,"accept","")),this.setMultiple(ol(t,"multiple",!1)),this}setAccept(t){return void 0===t&&(t=""),this.fileInput.setAttribute("accept",t),this}setMultiple(t){return void 0===t&&(t=!0),t?this.fileInput.setAttribute("multiple",""):this.fileInput.removeAttribute("multiple"),this}setCloseDelay(t){return void 0===t&&(t=200),this.closeDelay=t,this}get fileInput(){return this.node.children[0]}open(){return this.fileInput.click(),this}get files(){return this.fileInput.files}setOpenEnable(t){return void 0===t&&(t=!0),this.fileInput.disabled=!t,this}}var dl={resize:function(t,e){if(this.scene.sys.scale.autoRound&&(t=Math.floor(t),e=Math.floor(e)),this.width===t&&this.height===e)return this;var i=this.node.style;return i.width=`${t}px`,i.height=`${e}px`,this.updateSize(),this},syncTo:function(t){return this.setOrigin(t.originX,t.originY),this.setPosition(t.x,t.y),this.resize(t.displayWidth,t.displayHeight),this}};Object.assign(ll.prototype,dl,nl);var cl={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const ul=Phaser.Utils.Objects.GetValue;class pl extends il{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new ll(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(ul(e,"accept","")),this.setMultiple(ul(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}return Object.assign(pl.prototype,cl),pl},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexfileselectorbutton=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const _e=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Xe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?fi:gi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=fi))}get t(){var t;switch(this.state){case vi:case gi:case mi:t=0;break;case fi:t=this.nowTime/this.duration;break;case yi:t=1}return ui(t,0,1)}set t(t){(t=ui(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===fi}get isRunning(){return this.state===gi||this.state===fi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,gi=1,fi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;class ki extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const _i={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Xi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Xi),Yi.onInitScale=function(){Xi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Ii extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Bi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,Ji=Phaser.Math.Linear;class qi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=$i(t,"x",void 0),i=$i(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=$i(i,"startX",void 0),this.startY=$i(i,"startY",void 0),this.endX=$i(i,"endX",void 0),this.endY=$i(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ji(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ji(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends hi{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,cs=Phaser.Math.Linear;class us extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=cs(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new us(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},fs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Xs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ys={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ds,Ls,Xs,Ys);const As=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Is(e):t};class Ws extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;class Bs extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends Bs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var $s={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha)},qs=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Js)),this.setCoverTransitOutCallback(Ks(i,"transitOut",qs)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=$s.popUp;break;case tr.fadeIn:t=$s.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=$s.scaleDown;break;case tr.fadeOut:t=$s.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return wr.length=0,!0;return wr.length=0,!1},wr=[];const Sr=Phaser.Utils.Objects.GetValue;class Pr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Or[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Ms{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class Er extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Mr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Jr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const $r=0,Jr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=an,0===this.holdTime&&(this.state=on)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&t-this.pointer.downTime>=this.holdTime&&(this.state=on)}get isPressed(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case kn:this.tracerState=Tn,this.onDrag1End();break;case _n:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(Pn.prototype,Ve);var On={};const Tn=0,kn=1,_n=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Dn={};const Ln=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Xn(zn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Wn="BEGIN",jn="RECOGNIZED",Bn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Bn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},Yr.call(t,e),Fr.call(t,e),jr.call(t,e),Ur.call(t,e),Hn.call(t,e),Un.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",de),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ce(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;fe.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=oh[e];else if(nh(e)){var f;e=hh(f=e,"proportion",void 0),i=hh(f,"align",ah),s=hh(f,"padding",0),r=hh(f,"expand",!1),n=hh(f,"key",void 0),h=hh(f,"index",void 0),t.isRexSizer||(a=hh(f,"minWidth",void 0),o=hh(f,"minHeight",void 0)),l=hh(f,"fitRatio",0),d=hh(f,"offsetX",0),c=hh(f,"offsetY",0),u=hh(f,"offsetOriginX",0),p=hh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ve(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Et.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Xe.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(bh,dh,vh,gh,fh,mh,yh);var Ch=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=xh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ch.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,bh);var Oh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Th={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class kh extends Ph{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Oh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Oh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(kh.prototype,Th);var _h=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Eh=Phaser.GameObjects.Graphics;class Mh extends Eh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Rh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,_h.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,_h.call(this,this.width,this.height,this.padding,t,e)),this}}const Rh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Mh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Lh=Phaser.GameObjects.Text;var Xh=function(t){return t instanceof Lh};const Yh=Phaser.GameObjects.BitmapText;var zh=function(t){return t instanceof Yh},Ah=/^[\x00-\x7F]+$/,Fh=function(t){return Ah.test(t)},Ih=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},jh=2;const Bh={none:0,word:1,char:jh,character:jh,mix:3};var Hh=function(t,e){var i=function(t){return zh(t)?2:Xh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e}};const Nh=Phaser.Renderer.WebGL.Utils;var Uh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Nh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Gh=Phaser.Display.Color;var Vh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Gh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},$h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Jh=Phaser.Display.Canvas.CanvasPool,qh=Phaser.GameObjects.GameObject,Zh=Phaser.Utils.String.UUID;class Kh extends qh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Jh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Zh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Jh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Qh=Phaser.GameObjects.Components;Phaser.Class.mixin(Kh,[Qh.Alpha,Qh.BlendMode,Qh.Crop,Qh.Depth,Qh.Flip,Qh.GetBounds,Qh.Mask,Qh.Origin,Qh.Pipeline,Qh.PostPipeline,Qh.ScrollFactor,Qh.Tint,Qh.Transform,Qh.Visible,Uh,Vh,$h]);var ta={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Os(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ea{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ea.prototype,ta);var ia={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const sa=Phaser.Math.RotateAround;var ra;const na=Phaser.Geom.Rectangle;var ha,aa=function(t){void 0===ha&&(ha=new na);var e=t.drawTLX,i=t.drawTLY;return ha.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ha};const oa=Phaser.Math.RotateAround;var la,da=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===la&&(la={}),s=la),s.x=e,s.y=i,0!==t.rotation&&oa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ca=Phaser.GameObjects.Components.TransformMatrix;var ua,pa,va={},ga=function(t,e,i,s,r){var n=da(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=va);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ua&&(ua=new ca,pa=new ca),t.parentContainer?t.getWorldTransformMatrix(ua,pa):ua.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ua.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},fa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ga(t,e,n,h,r)},ma={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ra&&(ra={}),s=ra),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&sa(s,0,0,-i.rotation),s}(t,e,this,!0);return aa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return fa(this.parent,this,t,e,i)}};Object.assign(ma,ia);const ya=Phaser.Math.DegToRad,ba=Phaser.Math.RadToDeg,Ca=Phaser.Utils.Objects.GetValue;class xa extends ea{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ba(this._rotation)}set angle(t){this.rotation=ya(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ca(t,"width",void 0),i=Ca(t,"height",void 0),s=Ca(t,"scaleX",void 0),r=Ca(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(xa.prototype,ma);const wa=Phaser.Utils.String.Pad;var Sa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${wa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Pa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Oa=Phaser.Utils.Objects.GetValue;class Ta{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Oa(t,"x",0),i=Oa(t,"y",0));var s=this.cornerRadius;s.tl=ka(Oa(t,"tl",void 0),e,i),s.tr=ka(Oa(t,"tr",void 0),e,i),s.bl=ka(Oa(t,"bl",void 0),e,i),s.br=ka(Oa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){_a(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){_a(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){_a(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){_a(this.cornerRadius.br,t)}}var ka=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ea(t),t},_a=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Oa(e,"x",0),t.y=Oa(e,"y",0)),Ea(t)},Ea=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ma=Phaser.Math.DegToRad;var Ra=function(t){return!t.hasOwnProperty("convex")||t.convex},Da=function(t){return t.x>0&&t.y>0},La=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,o,l,o,l,180,270,!1,h):La(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,s-o,l,o,l,270,360,!1,h):La(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,s-o,r-l,o,l,0,90,!1,h):La(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,o,r-l,o,l,90,180,!1,h):La(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Ya=Phaser.Utils.Objects.GetValue;class za extends xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ya(e,"color",null),Ya(e,"color2",null),Ya(e,"horizontalGradient",!0)),this.setStroke(Ya(e,"stroke",null),Ya(e,"strokeThickness",2)),this.setCornerRadius(Ya(e,"cornerRadius",0),Ya(e,"cornerIteration",null))}set color(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Pa("color2",t,this),Pa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Pa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Pa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Xa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Aa=Phaser.Utils.Objects.GetValue;class Fa extends xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Aa(e,"color",null),Aa(e,"color2",null),Aa(e,"horizontalGradient",!0)),this.setStroke(Aa(e,"stroke",null),Aa(e,"strokeThickness",2))}set color(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Aa(t,"color2",null),Aa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ia=Phaser.Utils.Objects.GetValue;class Wa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ia(t,"bold",!1)),this.setItalic(Ia(t,"italic",!1)),this.setFontSize(Ia(t,"fontSize","16px")),this.setFontFamily(Ia(t,"fontFamily","Courier")),this.setColor(Ia(t,"color","#fff")),this.setStrokeStyle(Ia(t,"stroke",null),Ia(t,"strokeThickness",0)),this.setShadow(Ia(t,"shadowColor",null),Ia(t,"shadowOffsetX",0),Ia(t,"shadowOffsetY",0),Ia(t,"shadowBlur",0)),this.setOffset(Ia(t,"offsetX",0),Ia(t,"offsetY",0)),this.setSpace(Ia(t,"leftSpace",0),Ia(t,"rightSpace",0)),this.setAlign(Ia(t,"align",void 0)),this.setBackgroundColor(Ia(t,"backgroundColor",null)),this.setBackgroundHeight(Ia(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ia(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Ia(t,"backgroundLeftX",0)),this.setBackgroundRightX(Ia(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Pa("stroke",t,this),Pa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Pa("shadowOffsetX",t,this),Pa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Wa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Sa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Sa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Sa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Sa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const ja=Phaser.Utils.Array.Remove,Ba=Phaser.Utils.Array.Remove,Ha="text",Na="image",Ua="drawer",Ga="space",Va="command";var $a=function(t){return t.type===Ha&&"\n"===t.text},Ja=function(t){return t.type===Ha&&"\f"===t.text},qa=function(t){return t.type===Ha};class Za extends xa{constructor(t,e,i){super(t,Ha),this.updateTextFlag=!1,this.style=new Wa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ka=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Qa=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class to extends xa{constructor(t,e,i){super(t,Na),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Qa.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Qa.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class eo extends xa{constructor(t,e,i,s){super(t,Ua),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class io extends xa{constructor(t,e){super(t,Ga),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class so extends ea{constructor(t,e,i,s,r){super(t,Va),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function ro(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ro(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ro(t[i]));return e}var no=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const ho={none:0,word:1,char:2,character:2,mix:3};var ao=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=uo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=uo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=vo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=vo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=vo(t,"wrapMode");void 0===c&&(c=vo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=ho[c]);var u=vo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=vo(t,"letterSpacing",0),v=vo(t,"hAlign",0),g=vo(t,"vAlign",0),f=vo(t,"justifyPercentage",.25),m=no({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var W=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=mo(t,"maxLines",0);var a=0===i,o=mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=mo(t,"letterSpacing",0),p=mo(t,"rtl",!0),v=mo(t,"hAlign",p?2:0),g=mo(t,"vAlign",0),f=no({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Me(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ja(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ba(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ha);return null===i?i=new Za(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),fa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Bo=Phaser.Utils.Objects.GetFastValue;var Ho={};class No{constructor(t){this.pools=Bo(t,"pools",Ho)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new jo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Ko(t,r,e,i,n),a=0;a<=Jo&&0!==h;a++){if((r+=h)<0){r=0;break}h=Ko(t,r,e,i,n)}return a===Jo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Qo(t,e,i),t},Zo=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ko=function(t,e,i,s,r){var n,h=Zo(t,e,r),a=Zo(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Qo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const tl=Phaser.Utils.Objects.GetValue,el=Phaser.Utils.Objects.GetValue;class il extends kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=el(e,"background",void 0),r=el(e,"icon",void 0),n=el(e,"iconMask",void 0),h=el(e,"text",void 0),a=el(e,"action",void 0),o=el(e,"actionMask",void 0),l=el(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:el(e,"space.icon",0),top:el(e,"space.iconTop",0),bottom:el(e,"space.iconBottom",0),left:el(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:el(e,"space.icon",0),left:el(e,"space.iconLeft",0),right:el(e,"space.iconRight",0),top:el(e,"space.iconTop",0)});var d=el(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var c=el(e,"iconSize",void 0);this.setIconSize(el(e,"iconWidth",c),el(e,"iconHeight",c))}}if(h){var u=el(e,"wrapText",!1),p=el(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Hh(h,u),e.expandTextWidth=!0,$o(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=tl(e,"minWidth",0),s=tl(e,"minHeight",0),r=tl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return qo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),qo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=el(e,"space.text",0),m=el(e,"expandTextWidth",!1),y=el(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:el(e,"space.actionTop",0),bottom:el(e,"space.actionBottom",0),right:el(e,"space.actionRight",0)}:{left:el(e,"space.actionLeft",0),right:el(e,"space.actionRight",0),bottom:el(e,"space.actionBottom",0)},d=el(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var b=el(e,"actionSize");this.setActionSize(el(e,"actionWidth",b),el(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}Phaser.Utils.Objects.GetValue;var sl=function({game:t,fileInput:e,closeDelay:i}){return Ri(Qe(t).events,"focus").then((function(){return void 0===(t=i)&&(t=0),new Promise((function(i,s){setTimeout((function(){i(e)}),t)}));var t,e})).then((function(){var t={files:e.files};return Promise.resolve(t)}))};Phaser.Utils.Objects.GetValue,Phaser.DOM.RemoveFromDOM;var rl=function(t,e,i,s,r,n){if(null===r||!1===r);else if(er(r))r();else{var h=function(t,e,i){if(void 0===i)switch(e){case"image":case"svg":i="textures";break;case"animation":i="json";break;case"tilemapTiledJSON":case"tilemapCSV":i="tilemap";break;case"glsl":i="shader";break;default:i=e}return t=Qe(t),"textures"===i?t.textures:t.cache[i]}(t,i,r);h.exists(s)&&h.remove(s)}var a=t.load;if(n&&a.once(`filecomplete-${i}-${s}`,(function(t,e,i){n(i)})),er(e))e();else{var o=window.URL.createObjectURL(e);a[i](s,o)}a.start()},nl={loadFile:function(t,e,i,s,r){var n=this.scene;return rl(n,t,e,i,s,r),this},loadFilePromise:function(t,e,i,s){var r=this.scene;return new Promise((function(n,h){rl(r,t,e,i,s,(function(t){n(t)}))}))}};const hl=Phaser.GameObjects.DOMElement,al=Phaser.Utils.Objects.IsPlainObject,ol=Phaser.Utils.Objects.GetValue;class ll extends hl{constructor(t,e,i,s,r,n){al(e)?(e=ol(n=e,"x",0),i=ol(n,"y",0),s=ol(n,"width",0),r=ol(n,"height",0)):al(s)&&(s=ol(n=s,"width",0),r=ol(n,"height",0));var h=document.createElement("input");h.type="file",h.style.display="none";var a=document.createElement("label");a.appendChild(h);var o=ol(n,"style",void 0);super(t,e,i,a,o),this.type="rexFileChooser",this.resetFromJSON(n),this.resize(s,r);var l=this;h.onchange=function(){l.emit("change",l)},this.setCloseDelay(ol(n,"closeDelay",200)),h.onclick=function(){sl({game:t,fileInput:h,closeDelay:l.closeDelay}).then((function(){l.emit("select",l)}))}}resetFromJSON(t){return this.setAccept(ol(t,"accept","")),this.setMultiple(ol(t,"multiple",!1)),this}setAccept(t){return void 0===t&&(t=""),this.fileInput.setAttribute("accept",t),this}setMultiple(t){return void 0===t&&(t=!0),t?this.fileInput.setAttribute("multiple",""):this.fileInput.removeAttribute("multiple"),this}setCloseDelay(t){return void 0===t&&(t=200),this.closeDelay=t,this}get fileInput(){return this.node.children[0]}open(){return this.fileInput.click(),this}get files(){return this.fileInput.files}setOpenEnable(t){return void 0===t&&(t=!0),this.fileInput.disabled=!t,this}}var dl={resize:function(t,e){if(this.scene.sys.scale.autoRound&&(t=Math.floor(t),e=Math.floor(e)),this.width===t&&this.height===e)return this;var i=this.node.style;return i.width=`${t}px`,i.height=`${e}px`,this.updateSize(),this},syncTo:function(t){return this.setOrigin(t.originX,t.originY),this.setPosition(t.x,t.y),this.resize(t.displayWidth,t.displayHeight),this}};Object.assign(ll.prototype,dl,nl);var cl={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const ul=Phaser.Utils.Objects.GetValue;class pl extends il{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new ll(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(ul(e,"accept","")),this.setMultiple(ul(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}return Object.assign(pl.prototype,cl),pl},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexfileselectorbutton=e(); diff --git a/dist/rexgameobjectshellplugin.js b/dist/rexgameobjectshellplugin.js index dbbca9f3d0..8459653c14 100644 --- a/dist/rexgameobjectshellplugin.js +++ b/dist/rexgameobjectshellplugin.js @@ -21897,6 +21897,8 @@ this.setBackgroundColor(GetValue$1B(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$1B(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$1B(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$1B(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$1B(o, 'backgroundRightX', 0)); return this; } @@ -21967,6 +21969,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -22121,6 +22129,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -22548,20 +22566,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -43510,7 +43532,7 @@ var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -43910,6 +43932,33 @@ }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -44558,6 +44607,7 @@ var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -44585,19 +44635,41 @@ } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -44792,6 +44864,11 @@ return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rexgameobjectshellplugin.min.js b/dist/rexgameobjectshellplugin.min.js index f31b5baf48..e583bb7064 100644 --- a/dist/rexgameobjectshellplugin.min.js +++ b/dist/rexgameobjectshellplugin.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,this.displayList=t.sys.displayList,this.updateList=t.sys.updateList,t.events.once("destroy",this.destroy,this)}destroy(){this.scene=null,this.displayList=null,this.updateList=null}static register(e,i){t.prototype[e]=i}}var e={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const i=Phaser.Scene;var s=function(t){return t instanceof i},r=function(t){return null==t||"object"!=typeof t?null:s(t)?t:t.scene&&s(t.scene)?t.scene:t.parent&&t.parent.scene&&s(t.parent.scene)?t.parent.scene:null};const n=Phaser.Game;var a=function(t){return t instanceof n},o=function(t){return null==t||"object"!=typeof t?null:a(t)?t:a(t.game)?t.game:s(t)?t.sys.game:s(t.scene)?t.scene.sys.game:void 0};const h=Phaser.Utils.Objects.GetValue;class l{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(h(e,"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))}shutdown(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)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){return this.parent=t,this.scene=r(t),this.game=o(t),this}}Object.assign(l.prototype,e);const d=Phaser.Utils.Objects.GetValue;class c extends l{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(d(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=u[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const u={no:0,lazy:1,always:2};var p=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},g=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const v=Phaser.Geom.Rectangle,f=Phaser.Math.Vector2,m=Phaser.Math.RotateAround,y=Phaser.GameObjects.Container;var b=function(t,e){if(void 0===e?e=new v:!0===e&&(void 0===x&&(x=new v),e=x),t.getBounds&&!(t instanceof y))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();C(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,w(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,S(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,O(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else C(t,e),i=e.x,s=e.y,w(t,e),r=e.x,n=e.y,S(t,e),a=e.x,o=e.y,O(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},x=void 0,C=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-p(t)*t.originX,e.y=t.y-g(t)*t.originY,T(t,e,i))},w=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P),t.getTopRight?t.getTopRight(e):(e.x=t.x-p(t)*t.originX+p(t),e.y=t.y-g(t)*t.originY,T(t,e,i))},S=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-p(t)*t.originX,e.y=t.y-g(t)*t.originY+g(t),T(t,e,i))},O=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-p(t)*t.originX+p(t),e.y=t.y-g(t)*t.originY+g(t),T(t,e,i))},k=function(t,e,i){void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P);var s=p(t),r=g(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),T(t,e,i)},P=void 0,T=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&m(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e},_=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!b(t,!0).contains(e,i)||r&&!r(t,e,i))},M=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=E),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},E={},R=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?_(t,e.x,e.y,i,s):!!(r=M(e,n,!0))&&_(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=A,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===B&&this.onDragEnd(),this.pointer=void 0,this.tracerState=A,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=j,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&R(t,s,e,i)}}const A=0,B=1,j="IDLE";function z(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var W={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,s,n,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new r(s,n||t,a),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,r=[];if(0===this._eventsCount)return r;for(s in t=this._events)e.call(t,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,n=s.length,a=new Array(n);rthis.tapOffset&&(this.state=Q,this.state=q);break;case Q:this.state=q}}onDragEnd(){this.state===q&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Q))}onDrag(){this.state!==J&&this.pointer.getDistance()>this.dragThreshold&&(this.state=J)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===q){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=J):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Q:this.state=J)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Q&&(this.state=J)}get isTapped(){return this.state===Q}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const J="IDLE",q="BEGIN",Q="RECOGNIZED",tt=Phaser.Utils.Objects.GetValue;class et extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=it},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tt(t,"threshold",9)),this.setHoldTime(tt(t,"time",251)),this}onDragStart(){this.state=st,0===this.holdTime&&(this.state=rt)}onDragEnd(){this.state=it}onDrag(){this.state!==it&&this.pointer.getDistance()>this.dragThreshold&&(this.state=it)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===st&&t-this.pointer.downTime>=this.holdTime&&(this.state=rt)}get isPressed(){return this.state===rt}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const it="IDLE",st="BEGIN",rt="RECOGNIZED",nt=Phaser.Utils.Objects.GetValue;class at extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=M(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ot},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nt(t,"threshold",10)),this}onDragStart(){this.state=ht,0===this.dragThreshold&&(this.state=lt)}onDragEnd(){this.state=ot}onDrag(){switch(this.state){case ht:if(this.pointer.getDistance()>=this.dragThreshold){this.state=lt,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case lt:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=M(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===lt}setDragThreshold(t){return this.dragThreshold=t,this}}const ot="IDLE",ht="BEGIN",lt="RECOGNIZED";var dt=function(t){return o(t).loop.delta};const ct=Phaser.Math.Distance.Between,ut=Phaser.Math.Angle.Between;var pt={getDt:function(){return dt(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ct(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ut(e.x,e.y,t.x,t.y)}},gt={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vt={};const ft=Phaser.Utils.Objects.GetValue,mt=Phaser.Math.RadToDeg;class yt extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bt},eventEmitter:!1};this.setRecongizedStateObject(new N(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ft(t,"threshold",10)),this.setVelocityThreshold(ft(t,"velocityThreshold",1e3)),this.setDirectionMode(ft(t,"dir","8dir")),this}onDragStart(){this.state=xt}onDragEnd(){this.state=bt}onDrag(){this.state===xt&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Ct))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Ct&&(this.state=bt)}get isSwiped(){return this.state===Ct}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gt[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vt),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mt(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yt.prototype,pt);const bt="IDLE",xt="BEGIN",Ct="RECOGNIZED";var wt=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t};const St=Phaser.Utils.Objects.GetValue,Ot=Phaser.Utils.Array.SpliceOne,kt=Phaser.Math.Distance.Between,Pt=Phaser.Math.Angle.Between;class Tt{constructor(t,e){var i=r(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(St(e,"inputConfig",void 0)),this.setEventEmitter(St(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(St(t,"enable",!0)),this.bounds=St(t,"bounds",void 0),this.tracerState=Mt,this.pointers.length=0,wt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,wt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mt:this.tracerState=Et,this.onDrag1Start();break;case Et:this.tracerState=Rt,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Ot(this.pointers,e),this.tracerState){case Et:this.tracerState=Mt,this.onDrag1End();break;case Rt:this.tracerState=Et,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Et:this.onDrag1();break;case Rt:this.onDrag2()}}}dragCancel(){return this.tracerState===Rt&&this.onDrag2End(),this.pointers.length=0,wt(this.movedState),this.tracerState=Mt,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0],e=this.pointers[1];return kt(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0],e=this.pointers[1];return Pt(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_t.x=e.x-i.x,_t.y=e.y-i.y}else _t.x=0,_t.y=0;return _t}get centerX(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rt)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rt)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Lt,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&R(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&R(t,s,e,i)}}Object.assign(Tt.prototype,e);var _t={};const Mt=0,Et=1,Rt=2,Lt="IDLE",Dt=Phaser.Utils.Objects.GetValue;class At extends Tt{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=Bt},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Dt(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=jt,0===this.dragThreshold&&(this.state=zt)}onDrag2End(){this.state=Bt}onDrag2(){switch(this.state){case jt:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=zt}break;case zt:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===zt}setDragThreshold(t){return this.dragThreshold=t,this}}const Bt="IDLE",jt="BEGIN",zt="RECOGNIZED",Wt=Phaser.Math.RotateAround;var Yt=function(t,e,i,s){return Wt(t,e,i,s),t.rotation+=s,t},It={};const Xt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.Angle.WrapDegrees,Vt=Phaser.Math.Angle.ShortestBetween,Gt=Phaser.Math.RadToDeg,Ht=Phaser.Math.DegToRad;var Ut={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=It),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ft(Gt(this.angleBetween));this.angle=Vt(this.prevAngle,t),this.prevAngle=t,this.state=Kt}break;case Kt:t=Ft(Gt(this.angleBetween)),this.angle=Vt(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Kt}get rotation(){return Ht(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ut);const Nt="IDLE",$t="BEGIN",Kt="RECOGNIZED";var Zt=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i};const Jt=Phaser.Utils.Objects.GetValue;class qt extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Jt(e,"inputTarget",t),this.pan=new at(this.inputTarget);var i=Zt(t,Jt(e,"camera"));this.setCamera(i).setEnable(Jt(e,"enable",!0)),this.boot()}boot(){this.pan.on("pan",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom;e.scrollX-=t.dx/i,e.scrollY-=t.dy/i}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pan.destroy(),this.pan=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this}}var Qt=function(t,e,i,s){if(void 0!==i){var r=t.getWorldPoint(i,s);t.zoom=e,function(t){var e=t.width,i=t.height,s=t.zoomX,r=t.zoomY,n=t.matrix,a=t.scrollX,o=t.scrollY;t.useBounds&&(a=t.clampX(a),o=t.clampY(o)),t.scrollX=a,t.scrollY=o;var h=a+.5*e,l=o+.5*i;t.midPoint.set(h,l);var d=e/s,c=i/r;t.worldView.setTo(h-d/2,l-c/2,d,c);var u=e*t.originX,p=i*t.originY;n.applyITRS(t.x+u,t.y+p,t.rotation,s,r),n.translate(-u,-p)}(t);var n=t.getWorldPoint(i,s);t.scrollX-=n.x-r.x,t.scrollY-=n.y-r.y}else t.zoom=e};const te=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class ee extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=te(e,"inputTarget",t),this.pinch=new At(this.inputTarget);var i=Zt(t,te(e,"camera"));this.setCamera(i).setEnable(te(e,"enable",!0)).setMinZoom(te(e,"minZoom",void 0)).setMaxZoom(te(e,"maxZoom",void 0)),this.boot()}boot(){this.pinch.on("pinch",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom*t.scaleFactor;void 0!==this.minZoom&&ithis.maxZoom&&(i=this.maxZoom);var s=t.pointers[0],r=t.pointers[1],n=(s.x+r.x)/2,a=(s.y+r.y)/2;Qt(e,i,n,a)}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pinch.destroy(),this.pinch=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}}const ie=Phaser.Input.Keyboard.Key,se=Phaser.Input.Keyboard.KeyCodes,re=["up","down","left","right"];class ne{constructor(t){this.scene=t,this.keys={},this.cursorKeys={},this.noKeyDown=!0;for(var e=0,i=re.length;e=s&&e<=s+o,l=e<=r&&e>=r-o,d=i>=n&&i<=n+o,c=i<=a&&i>=a-o;this.pointerOutBoundsReleaseEnable||(h|=er,d|=ia),this.setKeyState("left",h),this.setKeyState("right",l),this.setKeyState("up",d),this.setKeyState("down",c)}}get up(){return this.upKeyDown}get down(){return this.downKeyDown}get left(){return this.leftKeyDown}get right(){return this.rightKeyDown}get noKey(){return this.noKeyDown}}const pe=Phaser.Utils.Objects.GetValue;class ge extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.cursorAtBounds=new ue(t);var i=this.cursorAtBounds.createCursorKeys();this.cameraController=new Phaser.Cameras.Controls.SmoothedKeyControl({left:i.left,right:i.right,up:i.up,down:i.down,acceleration:.06,drag:.003,maxSpeed:.3});var s=Zt(t,pe(e,"camera"));this.setCamera(s).setEnable(pe(e,"enable",!0)),this.boot()}boot(){this.scene.events.on("preupdate",this.updateCameraController,this)}shutdown(t){this.isShutdown||(this.scene.events.off("preupdate",this.updateCameraController,this),this.cursorAtBounds.destroy(),this.cameraController.destroy(),super.shutdown(t))}get camera(){return this.cameraController.camera}set camera(t){this.cameraController.setCamera(t),t?this.cameraController.start():this.cameraController.stop()}setCamera(t){return this.camera=t,this}get enable(){return this.cursorAtBounds.enable}set enable(t){this.cursorAtBounds.enable=t}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}updateCameraController(t,e){this.cameraController.update(e)}}const ve=Phaser.Utils.Objects.GetValue;class fe extends c{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=ve(e,"tickEventName",i),this.isSceneTicker=!me(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),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)}}var me=function(t){return"step"===t||"poststep"===t};const ye=Phaser.Utils.Objects.GetValue,be=Phaser.Math.Clamp;class xe{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=ye(t,"state",Ce),this.timeScale=ye(t,"timeScale",1),this.delay=ye(t,"delay",0),this.repeat=ye(t,"repeat",0),this.repeatCounter=ye(t,"repeatCounter",0),this.repeatDelay=ye(t,"repeatDelay",0),this.duration=ye(t,"duration",0),this.nowTime=ye(t,"nowTime",0),this.justRestart=ye(t,"justRestart",!1)}toJSON(){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}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?Se:we,this.repeatCounter=0,this}stop(){return this.state=Ce,this}update(t,e){this.state!==Ce&&this.state!==ke&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Oe)):(this.nowTime=this.duration,this.state=ke):this.nowTime>=0&&(this.state=Se))}get t(){var t;switch(this.state){case Ce:case we:case Oe:t=0;break;case Se:t=this.nowTime/this.duration;break;case ke:t=1}return be(t,0,1)}set t(t){(t=be(t,-1,1))<0?(this.state=we,this.nowTime=-this.delay*t):(this.state=Se,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Ce}get isDelay(){return this.state===we}get isCountDown(){return this.state===Se}get isRunning(){return this.state===we||this.state===Se}get isDone(){return this.state===ke}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Ce=0,we=1,Se=2,Oe=3,ke=-1;class Pe extends fe{constructor(t,e){super(t,e),this.timer=new xe}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Te=Phaser.Utils.Objects.GetValue,_e=Phaser.Utils.Objects.GetAdvancedValue,Me=Phaser.Tweens.Builders.GetEaseFunction;class Ee extends Pe{resetFromJSON(t){return this.timer.resetFromJSON(Te(t,"timer")),this.setEnable(Te(t,"enable",!0)),this.setTarget(Te(t,"target",this.parent)),this.setDelay(_e(t,"delay",0)),this.setDuration(_e(t,"duration",1e3)),this.setEase(Te(t,"ease","Linear")),this.setRepeat(Te(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Me(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Re=Phaser.Math.Linear;class Le extends Ee{constructor(t,e){super(t,e),this.resetFromJSON(e)}start(t){return this.stop(),this.startZoomValue=this.target.zoom,this.endZoomValue=t,this.timer.setDuration(this.duration),super.start(),this}updateTarget(t,e){var i=this.parent,s=Re(this.startZoomValue,this.endZoomValue,e.t);Qt(t,s,i.focusLocalX,i.focusLocalY)}}const De=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Ae extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.easeZoom=new Le(this);var i=Zt(t,De(e,"camera"));this.setEnable(De(e,"enable",!0)).setMinZoom(De(e,"minZoom")).setMaxZoom(De(e,"maxZoom")).setZoomStep(De(e,"zoomStep",.1)).setEaseDuration(De(e,"easeDuration",200)).setCamera(i),this.boot()}boot(){this.scene.input.on("wheel",this.onWheel,this)}shutdown(t){this.isShutdown||(this.scene.input.off("wheel",this.onWheel,this),this.easeZoom.destroy(),this.easeZoom=void 0,this.inputTarget=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this.resetZoomLevel(),this.easeZoom.stop().setTarget(t||null),this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}setZoomStep(t){return this.zoomStep=t,this}setEaseDuration(t){return this.easeDuration=t,this.easeZoom.setDuration(t),this}resetZoomLevel(){var t=this.camera;return t?(this.zoomLevel=Math.round(Be(t.zoom,this.zoomStep)),this.zoom=t.zoom,this):(this.zoomLevel=void 0,this)}onWheel(t,e,i,s,r,n){var a=this.camera;if(this.enable&&a){var o=void 0!==this.minZoom,h=void 0!==this.maxZoom;o&&this.zoom<=this.minZoom&&s>0||h&&this.zoom>=this.maxZoom&&s<0||(this.zoomLevel+=s<0?1:-1,this.zoom=je(this.zoomLevel,this.zoomStep),o&&this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.focusLocalX=t.x,this.focusLocalY=t.y,this.easeZoom.start(this.zoom))}}}var Be=function(t,e){return t>=1?Math.log(t)/Math.log(1+e):-Math.log(t)/Math.log(1-e)},je=function(t,e){return t>=0?Math.pow(1+e,t):Math.pow(1-e,-t)};function ze(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ze(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ze(t[i]));return e}const We=Phaser.Utils.Objects.GetValue;class Ye extends l{constructor(t,e){super(t,e=void 0===e?{}:ze(e)),this._enable=!0,this._camera=void 0;var i=We(e,"enable",!0),s=We(e,"minZoom"),r=We(e,"maxZoom");We(e,"panScroll",!0)&&(this.panScroll=new qt(t,{camera:We(e,"camera"),inputTarget:We(e,"inputTarget",t),enable:We(e,"panScrollEnable",!0)})),We(e,"pinchZoom",!0)&&(this.pinchZoom=new ee(t,{camera:We(e,"camera"),inputTarget:We(e,"inputTarget",t),enable:We(e,"pinchZoomEnable",!0),minZoom:We(e,"pinchZoomMin",s),maxZoom:We(e,"pinchZoomMax",r)})),We(e,"boundsScroll",!0)&&(this.boundsScroll=new ge(t,{camera:We(e,"camera"),enable:We(e,"boundsScrollEnable",!0)})),We(e,"mouseWheelZoom",!0)&&(this.mouseWheelZoom=new Ae(t,{camera:We(e,"camera"),enable:We(e,"mouseWheelZoomEnable",!0),zoomStep:We(e,"mouseWheelZoomStep",.1),minZoom:We(e,"mouseWheelZoomMin",s),maxZoom:We(e,"mouseWheelZoomMax",r)})),this.setEnable(i)}destroy(t){this.panScroll&&this.panScroll.destroy(t),this.pinchZoom&&this.pinchZoom.destroy(t),this.boundsScroll&&this.boundsScroll.destroy(t),this.mouseWheelZoom&&this.mouseWheelZoom.destroy(t),super.destroy(t)}set camera(t){this.panScroll&&this.panScroll.setCamera(t),this.pinchZoom&&this.pinchZoom.setCamera(t),this.boundsScroll&&this.boundsScroll.setCamera(t),this.mouseWheelZoom&&this.mouseWheelZoom.setCamera(t)}get camera(){return this.panScroll?this.panScroll.camera:this.pinchZoom?this.pinchZoom.camera:this.boundsScroll?this.boundsScroll.camera:this.mouseWheelZoom?this.mouseWheelZoom.camera:void 0}setCamera(t){return this.camera=t,this}set panScrollEnable(t){this.panScroll&&(this.panScroll.enable=t)}get panScrollEnable(){return!!this.panScroll&&this.panScroll.enable}setPanScrollEnable=function(t){return void 0===t&&(t=!0),this.panScrollEnable=t,this};set pinchZoomEnable(t){this.pinchZoom&&(this.pinchZoom.enable=t)}get pinchZoomEnable(){return!!this.pinchZoom&&this.pinchZoom.enable}setPinchZoomEnable=function(t){return void 0===t&&(t=!0),this.pinchZoomEnable=t,this};set boundsScrollEnable(t){this.boundsScroll&&(this.boundsScroll.enable=t)}get boundsScrollEnable(){return!!this.boundsScroll&&this.boundsScroll.enable}setBoundsScrollEnable=function(t){return void 0===t&&(t=!0),this.boundsScrollEnable=t,this};set mouseWheelZoomEnable(t){this.mouseWheelZoom&&(this.mouseWheelZoom.enable=t)}get mouseWheelZoomEnable(){if(this.mouseWheelZoom)return this.mouseWheelZoom.enable}setMouseWheelZoomEnable(t){return void 0===t&&(t=!0),this.mouseWheelZoom=t,this}set enable(t){t=!!t,this._enable!==t&&(t?(this.panScrollEnable=this.panScrollEnableSave,this.pinchZoomEnable=this.pinchZoomEnableSave,this.boundsScrollEnable=this.boundsScrollEnableSave,this.mouseWheelZoomEnable=this.mouseWheelZoomEnableSave):(this.panScrollEnableSave=this.panScrollEnable,this.pinchZoomEnableSave=this.pinchZoomEnable,this.boundsScrollEnableSave=this.boundsScrollEnable,this.mouseWheelZoomEnableSave=this.mouseWheelZoomEnable,this.panScrollEnable=!1,this.pinchZoomEnable=!1,this.boundsScrollEnable=!1,this.mouseWheelZoomEnable=!1),this._enable=t)}get enable(){return this._enable}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.enable=!this.enable,this}}var Ie=function(t){return null==t||""===t||0===t.length},Xe=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ie(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Ie(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return He(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Ue(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iqe(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eqe(t).x,getChildLocalY:t=>qe(t).y};const gi=Phaser.Math.DegToRad;var vi={updateChildRotation(t){var e=qe(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=qe(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return qe(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return qe(t).rotation=gi(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=qe(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>qe(t).rotation},fi={updateChildScale(t){var e=qe(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=qe(t),i=e.parent;return e.scaleX=ui(t.scaleX,i.scaleX),e.scaleY=ui(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=qe(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=qe(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>qe(t).scaleX,getChildLocalScaleY:t=>qe(t).scaleY},mi={updateChildVisible(t){var e=qe(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=qe(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),qe(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),qe(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=qe(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>qe(t).visible},yi={updateChildAlpha(t){var e=qe(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=qe(t),i=e.parent;return e.alpha=ui(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return qe(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=qe(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>qe(t).alpha},bi={updateChildActive(t){var e=qe(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return qe(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),qe(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=qe(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>qe(t).active},xi={updateChildScrollFactor(t){var e=qe(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Ci={updateCameraFilter(t){var e=qe(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},wi={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Si=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Pi=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const _i=Phaser.Utils.Array;var Mi={getChildren(t){if(t)for(var e=0,i=this.children.length;e0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let js=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};t.register("fullWindowRectangle",(function(t,e){var i=new js(this.scene,t,e);return this.scene.add.existing(i),i})),Xe(window,"RexPlugins.GameObjectShell.FullWindowRectangle",js);var zs={hasProperty(t){var e=this.gameObject;return!!e.hasOwnProperty(t)||void 0!==e[t]},getProperty(t){return this.gameObject[t]},setProperty(t,e){return this.gameObject[t]=e,this},easeProperty(t){var e=t.property,i=t.value,s=t.duration,r=t.delay,n=t.ease,a=t.repeat,o=t.yoyo,h=t.from,l=t.complete,d=t.target;if(void 0===s&&(s=1e3),void 0===r&&(r=0),void 0===n&&(n="Linear"),void 0===a&&(a=0),void 0===o&&(o=!1),void 0===d&&(d=this.gameObject),h){var c=i;i=d[e],d[e]=c}return(t={targets:d,duration:s,delay:r,ease:n,repeat:a,yoyo:o,onComplete:l})[e]=i,this.addTweenTask(e,t),this},addTweenTask(t,e){var i=this.tweens,s=i[t];s&&s.remove();var r=e.onComplete;return e.onComplete=function(){i[t].remove(),i[t]=null,r&&r(e.targets,t)},(s=this.scene.tweens.add(e)).timeScale=this.timeScale,i[t]=s,this},getTweenTask(t){return this.tweens[t]},freeTweens(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},Ws={hasMethod(t){return"function"==typeof this.gameObject[t]},call(t,...e){if(!this.hasMethod(t))return console.warn(`[GameObjectManager] Game object '${this.name}' does not have method '${t}'`),this;var i=this.gameObject;return i[t].apply(i,e),this}},Ys={hasData(t){var e=this.gameObject;return!!e.data&&e.data.has(t)},getData(t){return this.gameObject.getData(t)},setData(t,e){return this.gameObject.setData(t,e),this}};class Is{constructor(t,e,i){this.GOManager=t,this.tweens={},this.effects={},this.setGO(e,i)}get scene(){return this.GOManager.scene}get timeScale(){return this.GOManager.timeScale}destroy(){this.freeGO(),this.GOManager=void 0}freeGO(){return this.freeTweens(),this.gameObject.bob=void 0,this.gameObject.destroy(),this.gameObject=void 0,this}setGO(t,e){return t.goName=e,t.goType=this.GOManager.name,t.bob=this,this.gameObject=t,this.name=e,this.freeTweens(),this}setTimeScale(t){var e=this.tweens;for(var i in e){var s=e[i];s&&(s.timeScale=t)}return this}}Object.assign(Is.prototype,zs,Ws,Ys);var Xs=function(t){for(var e in t)return!1;return!0},Fs=function(t){return t&&"!"!==t.charAt(0)},Vs={has(t){return this.bobs.hasOwnProperty(t)},exists(t){return this.bobs.hasOwnProperty(t)},get(t,e){if(Fs(t))return this.bobs[t];for(var i in void 0===e&&(e=[]),t&&(t=t.substring(1)),this.bobs)t&&i===t||e.push(this.bobs[i]);return e},getFitst(t){for(var e in t&&"!"===t.charAt(0)&&(t=t.substring(1)),this.bobs)if(!t||t!==e)return this.bobs[e];return null},getGO(t,e){var i=this.get(t);return i?Array.isArray(i)?(void 0===e&&(e=[]),i.forEach((function(t){e.push(t.gameObject)})),e):i.gameObject:null},forEachGO(t,e){for(var i in this.bobs){var s=this.bobs[i].gameObject;if(e?t.call(e,s,i,this):t(s,i,this))break}return this},getAllGO(t){for(var e in void 0===t&&(t=[]),this.bobs){var i=this.bobs[e].gameObject;t.push(i)}return t}},Gs=function(t){return t>>16&255},Hs=function(t){return t>>8&255},Us=function(t){return 255&t};const Ns=Phaser.Events.EventEmitter;var $s=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Ks),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Ks={},Zs=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=$s),function(t){if(t.events)return t;var e=new Ns,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Js=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},qs=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Qs=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(ir(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},cr={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=Zt(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},ur={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):Ji(i,t,e)})),this}};Object.assign(ur,Vs,rr,nr,ar,or,hr,dr,cr);const pr=Phaser.Utils.Objects.GetValue;class gr{constructor(t,e){this.scene=t,this.BobClass=pr(e,"BobClass",Is),this.setCreateGameObjectCallback(pr(e,"createGameObject"),pr(e,"createGameObjectScope")),this.setEventEmitter(pr(e,"eventEmitter",void 0)),this.setGameObjectDepth(pr(e,"depth",void 0));var i=pr(e,"fade",500);"number"==typeof i?(this.setGOFadeMode(),this.setGOFadeTime(i)):(this.setGOFadeMode(pr(i,"mode")),this.setGOFadeTime(pr(i,"time",500)));var s=pr(e,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(pr(e,"enable",!0)),this.setViewport(pr(s,"viewport"))):this.setViewportCoordinateEnable(!1);var r=pr(e,"effectProperties",!1);this.setEffectPropertiesConfig(r),this.setSymbols(pr(e,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1,this.name=pr(e,"name")}destroy(t){this.clear(!t),this.createGameObjectCallback=void 0,this.viewport=void 0,this.scene=void 0}set timeScale(t){if(this._timeScale!==t){this._timeScale=t;var e=this.bobs;for(var i in e)e[i].setTimeScale(t)}}get timeScale(){return this._timeScale}setTimeScale(t){return this.timeScale=t,this}setCreateGameObjectCallback(t,e){return this.createGameObjectCallback=t,this.createGameObjectScope=e,this}setGameObjectDepth(t){return this.gameObjectDepth=t,this}setViewportCoordinateEnable(t){return void 0===t&&(t=!0),this.viewportCoordinateEnable=t,this}setEffectPropertiesConfig(t){return void 0===t&&(t=!0),this.effectPropertiesConfig=t,this}setViewport(t){return void 0===t&&(t=le(this.scene,this.scene.cameras.main)),this.viewport=t,this}setSymbols(t){return this.symbols=t,this}get isEmpty(){return Xs(this.bobs)&&0===this.removedGOs.length}}Object.assign(gr.prototype,e,ur);var vr={getLayer(t){return this.getGO(t)},getLayers(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(e)})),Si(t,!1),t},addToLayer(t,e){var i=this.getGO(t);if(i){Array.isArray(e)||(e=[e]);for(var s=0,r=e.length;s=0;e--)this.remove(this.backgroundChildren[e],t);return this}};const Sn=Phaser.Utils.Objects.GetValue;var On=function(t,e){return void 0===e?t:t[e]},kn=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Sn(e,"left",0),t.right=Sn(e,"right",0),t.top=Sn(e,"top",0),t.bottom=Sn(e,"bottom",0)),t},Pn={getInnerPadding(t){return On(this.space,t)},setInnerPadding(t,e){return kn(this.space,t,e),this},getOuterPadding(t){return On(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return kn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),On(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),kn(this.getSizerConfig(t).padding,e,i),this}},Tn=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},_n=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Mn=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},En=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Rn=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ln=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Dn={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},An=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ga={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,n){var a=r(t);return a.time.delayedCall(e,(function(){a.game.events.once("poststep",(function(){i.call(s,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ha={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Rr),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Rr),this.transitOutCallback=t,this}},Ua={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Na={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},$a={};Object.assign($a,Ga,Ha,Ua,Na);const Ka=Phaser.Utils.Objects.GetValue;class Za extends l{constructor(t,e){super(t,e),this.setTransitInTime(Ka(e,"duration.in",200)),this.setTransitOutTime(Ka(e,"duration.out",200)),this.setTransitInCallback(Ka(e,"transitIn")),this.setTransitOutCallback(Ka(e,"transitOut")),this.oneShotMode=Ka(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Va(this,{eventEmitter:!1,initState:Ka(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Za.prototype,$a);const Ja=Phaser.Utils.Objects.GetValue;class qa extends l{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ja(t,"hitAreaMode",0)),this.setEnable(Ja(t,"enable",!0)),this.setStopMode(Ja(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Qa[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Qa={default:0,fullWindow:1};const to=Phaser.Utils.Objects.GetValue;class eo extends js{constructor(t,e){super(t,to(e,"color",0),to(e,"alpha",.8)),this.touchEventStop=new qa(this,{hitAreaMode:1})}}var io={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Kn(t,e)},scaleDown(t,e){Zn(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ha(t,e)},fadeOut(t,e){la(t,e,!1)}},so=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ha(t,e,t.alpha)},ro=function(t,e){la(t,e,!1)};const no=Phaser.Utils.Objects.GetValue;let ao=class extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=oo.popUp),null==e.transitOut&&(e.transitOut=oo.scaleDown),e.destroy=no(e,"destroy",!0),super(t,e);var i=no(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new eo(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(no(i,"transitIn",so)),this.setCoverTransitOutCallback(no(i,"transitOut",ro)));var s=no(e,"touchOutsideClose",!1),r=no(e,"duration.hold",-1),n=no(e,"timeOutClose",r>=0),a=no(e,"anyTouchClose",!1);no(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),no(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=oo[t]),t){case oo.popUp:t=io.popUp;break;case oo.fadeIn:t=io.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=oo[t]),t){case oo.scaleDown:t=io.scaleDown;break;case oo.fadeOut:t=io.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const oo={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ho={modal(t,e){return ws(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new ao(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},lo=function(t,e,i,s,r){ws(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},co={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return lo.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return lo.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return lo.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return lo.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return lo.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return lo.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return lo.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return lo.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return lo.call(this,"shutdown",t,e,i,s),this}},uo=function(t){return"[object Array]"===Object.prototype.toString.call(t)},po=function(t,e,i,s,r){return _(t,e,i,vo(s),r)},go=function(t){return!(t.rexSizer&&t.rexSizer.hidden)},vo=function(t){return t?function(e,i,s){return!!go(e)&&(t(e,i,s),!0)}:go},fo={},mo=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=fo),i.x=e.x,i.y=e.y,i.scaleX=e.scaleX,i.scaleY=e.scaleY,i.width=e.width,i.height=e.height,i.displayWidth=e.displayWidth,i.displayHeight=e.displayHeight,this.layoutedChildren.push(t))},yo=function(t,e,i,s,r,n,a,o){void 0===a&&(a=0),void 0===o&&(o=0),en(t,e,i,s,r,n),t.x+=a,t.y+=o,this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)};const bo=Phaser.Display.Align.CENTER,xo=Phaser.Utils.Objects.IsPlainObject,Co=Phaser.Utils.Objects.GetValue;class wo extends l{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(Co(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(Co(t,"enable",!0)),this.setMode(Co(t,"mode",1)),this.setClickInterval(Co(t,"clickInterval",100)),this.setDragThreshold(Co(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=So[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const So={press:0,pointerdown:0,release:1,pointerup:1};var Oo={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wo(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},ko=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Po(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return To.length=0,!0;return To.length=0,!1},To=[];const _o=Phaser.Utils.Objects.GetValue;class Mo extends l{constructor(t,e){super(t,e),this._enable=void 0;var i=_o(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_o(t,"enable",!0)),this.setMode(_o(t,"mode",1)),this.setClickInterval(_o(t,"clickInterval",100)),this.setDragThreshold(_o(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Eo[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?ko:R)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Eo={press:0,pointerdown:0,release:1,pointerup:1};var Ro={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mo(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lo extends N{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Do=Phaser.Utils.Objects.GetValue;class Ao extends l{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lo,this.parent.setInteractive(Do(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Do(t,"enable",!0)),this.setCooldown(Do(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Bo={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&R(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ao(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ao(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},jo={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},zo=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const gh=Phaser.Utils.Objects.IsPlainObject,vh=Phaser.Utils.Objects.GetValue,fh=Phaser.Display.Align.CENTER,mh={min:0,full:-1};var yh=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,v;un.call(this,t);var f=t.isRexSpace,m=typeof e;if(null===e)return this;if("number"===m);else if("string"===m)e=mh[e];else if(gh(e)){var y;e=vh(y=e,"proportion",void 0),i=vh(y,"align",fh),s=vh(y,"padding",0),r=vh(y,"expand",!1),n=vh(y,"key",void 0),a=vh(y,"index",void 0),t.isRexSizer||(o=vh(y,"minWidth",void 0),h=vh(y,"minHeight",void 0)),l=vh(y,"fitRatio",0),d=vh(y,"offsetX",0),c=vh(y,"offsetY",0),u=vh(y,"offsetOriginX",0),v=vh(y,"offsetOriginY",0)}return"string"==typeof i&&(i=Er[i]),void 0===e&&(e=f?1:0),void 0===i&&(i=fh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(f?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(f?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=p(t)/g(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===v&&(v=0),(y=this.getSizerConfig(t)).proportion=e,y.align=i,y.padding=dn(s),y.expand=r,y.fitRatio=0===e?l:0,y.alignOffsetX=d,y.alignOffsetY=c,y.alignOffsetOriginX=u,y.alignOffsetOriginY=v,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?p(t):o:t.minHeight=void 0===h?g(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},bh={add:yh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),yh.call(this,new uh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return gh(i)&&(i.index=t),yh.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ph.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const xh=ss.prototype.clear;var Ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),xh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Ch.call(this,t),this}},Oh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Er[e]),this.getSizerConfig(t).align=e,this}},kh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ph={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Th={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},_h={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(zn(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,An.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,v=this.innerLeft,f=this.innerTop,m=this.innerWidth,y=this.innerHeight,b=v,x=f,C=this.startChildIndex,w=0,S=u.length;w0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=En.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||_n.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&dh.call(this,t,void 0),Mn.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Rn.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&dh.call(this,void 0,t),Ln.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(_h,bh,Sh,Oh,kh,Ph,Th);var Mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Eh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Rh=function(t){return"string"==typeof t&&(t=Eh[t]),t};const Lh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue;class Ah extends oh{constructor(t,e,i,s,r,n,a){Lh(e)?(e=Dh(a=e,"x",0),i=Dh(a,"y",0),s=Dh(a,"width",void 0),r=Dh(a,"height",void 0),n=Dh(a,"orientation",0)):Lh(s)?(s=Dh(a=s,"width",void 0),r=Dh(a,"height",void 0),n=Dh(a,"orientation",0)):Lh(n)&&(n=Dh(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Dh(a,"space.item",0)),this.setStartChildIndex(Dh(a,"startChildIndex",0)),this.setRTL(Dh(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Rh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Mh.call(this)),this._childrenProportion}}Object.assign(Ah.prototype,_h);var Bh=function(t,e,i,s){return e/t<=i?e/(s-1):0},jh=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=zh(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=zh(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const Yh=Phaser.Utils.Objects.IsPlainObject,Ih=Phaser.Utils.Objects.GetValue,Xh=Phaser.Display.Align.CENTER;var Fh=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(un.call(this,t),Yh(e)&&(e=Ih(h=e,"padding",0),i=Ih(h,"key",void 0),s=Ih(h,"index",void 0),r=Ih(h,"offsetX",0),n=Ih(h,"offsetY",0),a=Ih(h,"offsetOriginX",0),o=Ih(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=Xh,h.padding=dn(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},Vh={add(t,e,i){if(uo(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Ch.call(this,t),this}},Uh={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(h.join("")),r},xl=0,Cl=1,wl=2,Sl=0,Ol=1,kl=2,Pl=/(?:\r\n|\r|\n)/;const Tl={none:Sl,word:Ol,char:kl,character:kl,mix:3},_l=Phaser.Renderer.WebGL.Utils;var Ml={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=_l.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const El=Phaser.Display.Color;var Rl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=u);var p=d.cutX+a,g=d.cutY+o;return this.context.drawImage(d.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new El);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Ll=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(d,o.source[0].glTexture,!0,0)},Dl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Ll(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Ve();const Al=Phaser.Display.Canvas.CanvasPool,Bl=Phaser.GameObjects.GameObject,jl=Phaser.Utils.String.UUID;let zl=class extends Bl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Al.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=jl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Al.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Wl=Phaser.GameObjects.Components;Phaser.Class.mixin(zl,[Wl.Alpha,Wl.BlendMode,Wl.Crop,Wl.Depth,Wl.Flip,Wl.GetBounds,Wl.Mask,Wl.Origin,Wl.Pipeline,Wl.PostPipeline,Wl.ScrollFactor,Wl.Tint,Wl.Transform,Wl.Visible,Ml,Rl,Dl]);var Yl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:F(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&wt(this.data),this}};class Il{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Il.prototype,Yl);var Xl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Fl=Phaser.Math.RotateAround;var Vl;const Gl=Phaser.Geom.Rectangle;var Hl,Ul=function(t){void 0===Hl&&(Hl=new Gl);var e=t.drawTLX,i=t.drawTLY;return Hl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Hl};const Nl=Phaser.Math.RotateAround;var $l,Kl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===$l&&($l={}),s=$l),s.x=e,s.y=i,0!==t.rotation&&Nl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Zl=Phaser.GameObjects.Components.TransformMatrix;var Jl,ql,Ql={},td=function(t,e,i,s,r){var n=Kl(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ql);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Jl&&(Jl=new Zl,ql=new Zl),t.parentContainer?t.getWorldTransformMatrix(Jl,ql):Jl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Jl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ed=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return td(t,e,n,a,r)},id={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Vl&&(Vl={}),s=Vl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Fl(s,0,0,-i.rotation),s}(t,e,this,!0);return Ul(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ed(this.parent,this,t,e,i)}};Object.assign(id,Xl);const sd=Phaser.Math.DegToRad,rd=Phaser.Math.RadToDeg,nd=Phaser.Utils.Objects.GetValue;class ad extends Il{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return rd(this._rotation)}set angle(t){this.rotation=sd(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=nd(t,"width",void 0),i=nd(t,"height",void 0),s=nd(t,"scaleX",void 0),r=nd(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ad.prototype,id);const od=Phaser.Utils.String.Pad;var hd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${od(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ld=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const dd=Phaser.Utils.Objects.GetValue;let cd=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=dd(t,"x",0),i=dd(t,"y",0));var s=this.cornerRadius;s.tl=ud(dd(t,"tl",void 0),e,i),s.tr=ud(dd(t,"tr",void 0),e,i),s.bl=ud(dd(t,"bl",void 0),e,i),s.br=ud(dd(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){pd(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){pd(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){pd(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){pd(this.cornerRadius.br,t)}};var ud=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),gd(t),t},pd=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=dd(e,"x",0),t.y=dd(e,"y",0)),gd(t)},gd=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vd=Phaser.Math.DegToRad;var fd=function(t){return!t.hasOwnProperty("convex")||t.convex},md=function(t){return t.x>0&&t.y>0},yd=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,md(o)?(h=o.x*v,l=o.y*f,fd(o)?yd(t,h,l,h,l,180,270,!1,a):yd(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,md(o)?(h=o.x*v,l=o.y*f,fd(o)?yd(t,s-h,l,h,l,270,360,!1,a):yd(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,md(o)?(h=o.x*v,l=o.y*f,fd(o)?yd(t,s-h,r-l,h,l,0,90,!1,a):yd(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,md(o)?(h=o.x*v,l=o.y*f,fd(o)?yd(t,h,r-l,h,l,90,180,!1,a):yd(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},xd=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),bd(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}};const Cd=Phaser.Utils.Objects.GetValue;class wd extends ad{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Cd(e,"color",null),Cd(e,"color2",null),Cd(e,"horizontalGradient",!0)),this.setStroke(Cd(e,"stroke",null),Cd(e,"strokeThickness",2)),this.setCornerRadius(Cd(e,"cornerRadius",0),Cd(e,"cornerIteration",null))}set color(t){t=hd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=hd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=hd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ld("color2",t,this),ld("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ld("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ld("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){xd(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Sd=Phaser.Utils.Objects.GetValue;class Od extends ad{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Sd(e,"color",null),Sd(e,"color2",null),Sd(e,"horizontalGradient",!0)),this.setStroke(Sd(e,"stroke",null),Sd(e,"strokeThickness",2))}set color(t){t=hd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=hd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=hd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Sd(t,"color2",null),Sd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Sd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const kd=Phaser.Utils.Objects.GetValue;let Pd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(kd(t,"bold",!1)),this.setItalic(kd(t,"italic",!1)),this.setFontSize(kd(t,"fontSize","16px")),this.setFontFamily(kd(t,"fontFamily","Courier")),this.setColor(kd(t,"color","#fff")),this.setStrokeStyle(kd(t,"stroke",null),kd(t,"strokeThickness",0)),this.setShadow(kd(t,"shadowColor",null),kd(t,"shadowOffsetX",0),kd(t,"shadowOffsetY",0),kd(t,"shadowBlur",0)),this.setOffset(kd(t,"offsetX",0),kd(t,"offsetY",0)),this.setSpace(kd(t,"leftSpace",0),kd(t,"rightSpace",0)),this.setAlign(kd(t,"align",void 0)),this.setBackgroundColor(kd(t,"backgroundColor",null)),this.setBackgroundHeight(kd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(kd(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ld("stroke",t,this),ld("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ld("shadowOffsetX",t,this),ld("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=hd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=hd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=hd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=hd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Td=Phaser.Utils.Array.Remove,_d=Phaser.Utils.Array.Remove,Md="text",Ed="image",Rd="drawer",Ld="space",Dd="command";var Ad=function(t){return t.type===Md&&"\n"===t.text},Bd=function(t){return t.type===Md&&"\f"===t.text},jd=function(t){return t.type===Md};class zd extends ad{constructor(t,e,i){super(t,Md),this.updateTextFlag=!1,this.style=new Pd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Wd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yd=Phaser.Display.Canvas.CanvasPool;var Id=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Yd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Yd.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Xd extends ad{constructor(t,e,i){super(t,Ed),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Id(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Fd extends ad{constructor(t,e,i,s){super(t,Rd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Vd extends ad{constructor(t,e){super(t,Ld),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Gd extends Il{constructor(t,e,i,s,r){super(t,Dd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Hd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ud={none:0,word:1,char:2,character:2,mix:3};var Nd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Jd.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Jd.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Qd(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Qd(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Qd(t,"wrapMode");void 0===c&&(c=Qd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ud[c]);var u=Qd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Qd(t,"letterSpacing",0),g=Qd(t,"hAlign",0),v=Qd(t,"vAlign",0),f=Qd(t,"justifyPercentage",.25),m=Hd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ic(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ic(t,"maxLines",0);var o=0===i,h=ic(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ic(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=ic(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ic(t,"letterSpacing",0),p=ic(t,"rtl",!0),g=ic(t,"hAlign",p?2:0),v=ic(t,"vAlign",0),f=Hd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return kn(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return On(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Td(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return _d(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Md);return null===i?i=new zd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ed(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Tc=Phaser.Utils.Objects.GetFastValue;var _c={};class Mc{constructor(t){this.pools=Tc(t,"pools",_c)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Pc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=zc(t,r,e,i,n),o=0;o<=Ac&&0!==a;o++){if((r+=a)<0){r=0;break}a=zc(t,r,e,i,n)}return o===Ac&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wc(t,e,i),t},jc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},zc=function(t,e,i,s,r){var n,a=jc(t,e,r),o=jc(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Wc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Yc=Phaser.Utils.Objects.GetValue,Ic=Phaser.Utils.Objects.GetValue;class Xc extends rl{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Ic(e,"background",void 0),r=Ic(e,"icon",void 0),n=Ic(e,"iconMask",void 0),a=Ic(e,"text",void 0),o=Ic(e,"action",void 0),h=Ic(e,"actionMask",void 0),l=Ic(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:Ic(e,"space.icon",0),top:Ic(e,"space.iconTop",0),bottom:Ic(e,"space.iconBottom",0),left:Ic(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:Ic(e,"space.icon",0),left:Ic(e,"space.iconLeft",0),right:Ic(e,"space.iconRight",0),top:Ic(e,"space.iconTop",0)});var d=Ic(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=dl.call(this,r,r,1)),!d){var c=Ic(e,"iconSize",void 0);this.setIconSize(Ic(e,"iconWidth",c),Ic(e,"iconHeight",c))}}if(a){var u=Ic(e,"wrapText",!1),p=Ic(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(vl(t)){case 0:switch("string"==typeof e&&(e=Tl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=yl;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Tl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Dc(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Yc(e,"minWidth",0),s=Yc(e,"minHeight",0),r=Yc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Bc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Bc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var g,v,f=Ic(e,"space.text",0),m=Ic(e,"expandTextWidth",!1),y=Ic(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:Ic(e,"space.actionTop",0),bottom:Ic(e,"space.actionBottom",0),right:Ic(e,"space.actionRight",0)}:{left:Ic(e,"space.actionLeft",0),right:Ic(e,"space.actionRight",0),bottom:Ic(e,"space.actionBottom",0)},d=Ic(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=dl.call(this,o,o,1)),!d)){var b=Ic(e,"actionSize");this.setActionSize(Ic(e,"actionWidth",b),Ic(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}var Fc=Phaser.Renderer.WebGL.Utils,Vc=function(t,e,i,s,r,n){for(var a=Fc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,h=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},$c=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const Kc=Phaser.Renderer.Canvas.SetTransform;var Zc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Uc(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Vc(r,a,e,l,o,h),e.isStroked&&Hc(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Kc(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(qc.prototype,Zc);var Qc=function(t){return t.x>0&&t.y>0},tu=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const eu=Phaser.Math.DegToRad;var iu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=sp(t,"tl",0),this.radiusTR=sp(t,"tr",0),this.radiusBL=sp(t,"bl",0),this.radiusBR=sp(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?iu(e,e,e,e,180,270,!1,r,t):iu(0,0,e,e,90,0,!0,r,t):tu(0,0,t),(e=this.radiusTR)>0?this._convexTR?iu(i-e,e,e,e,270,360,!1,r,t):iu(i,0,e,e,180,90,!0,r,t):tu(i,0,t),(e=this.radiusBR)>0?this._convexBR?iu(i-e,s-e,e,e,0,90,!1,r,t):iu(i,s,e,e,270,180,!0,r,t):tu(i,s,t),(e=this.radiusBL)>0?this._convexBL?iu(e,s-e,e,e,90,180,!1,r,t):iu(0,s,e,e,360,270,!0,r,t):tu(0,s,t),t.push(t[0],t[1]),Iu(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var np=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const ap=Phaser.Utils.Objects.GetValue,op=Phaser.Utils.Objects.IsPlainObject;class hp extends(Eu(wu)){constructor(t,e,i,s,r,n,a,o){op(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):op(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):op(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new ip).setName("trackFill")).addShape((new ip).setName("bar")).addShape((new ip).setName("trackStroke")),this.setTrackColor(ap(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ap(o,"trackStrokeThickness",2),ap(o,"trackStrokeColor",void 0)),this.setSkewX(ap(o,"skewX",0)),this.setRTL(ap(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var lp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&np(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),np(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&np(o,0,0,e,i,t)}};Object.assign(hp.prototype,lp);class dp extends hp{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Xe(e,"easeValue.duration",e.easeDuration),Xe(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=cp,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const cp={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(dp.prototype,gu);let up=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const pp=Phaser.GameObjects.NineSlice,gp=Phaser.Utils.Objects.GetValue;class vp extends pp{constructor(t,e){void 0===e&&(e={}),super(t,gp(e,"x",0),gp(e,"y",0),gp(e,"key",null),gp(e,"frame",null),gp(e,"width",0),gp(e,"height",0),gp(e,"leftWidth",0),gp(e,"rightWidth",0),gp(e,"topHeight",0),gp(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=gp(e,"effects",!0);i&&ir(this,i),this.style=new up(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vp.prototype,gu);let fp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const mp=Phaser.GameObjects.Image,yp=Phaser.Utils.Objects.GetValue;class bp extends mp{constructor(t,e){void 0===e&&(e={}),super(t,yp(e,"x",0),yp(e,"y",0),yp(e,"key",""),yp(e,"frame",void 0)),this.type="rexStatesImage";var i=yp(e,"effects",!0);i&&ir(this,i),this.style=new fp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(bp.prototype,gu);var xp=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Cp=Phaser.Utils.Objects.IsPlainObject,wp=Phaser.Utils.Objects.GetValue;var Sp=function(t){return"string"==typeof t&&(t=Op[t]),t};const Op={scale:0,repeat:1};var kp=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Pp={_beginDraw:Rr,_drawImage:Rr,_drawTileSprite:Rr,_endDraw:Rr,setGetFrameNameCallback:function(t){return void 0===t&&(t=xp),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=ze(i),s=ze(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,u=0;for(h=0,l=s.length;h0?0:v,b=0,h=0;for(var S=i.length;h0?0:f),f>=1&&v>=1){var O=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,v)}b+=f}x+=v}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(u,p);if(u>g){var v=(u-g)*h;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Cp(t)?(this.stretchMode.edge=Sp(wp(t,"edge",0)),this.stretchMode.internal=Sp(wp(t,"internal",0))):(t=Sp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return kp.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Tp=Phaser.Utils.Objects.IsPlainObject,_p=Phaser.Utils.Objects.GetValue,Mp=Phaser.GameObjects;var Ep=void 0,Rp=function(t,e){if(Ep||(Ep={},o(t).events.once("destroy",(function(){for(var t in Ep)Ep[t].destroy();Ep=void 0}))),!Ep.hasOwnProperty(e)){var i=o(t).scene.systemScene;(t=new Mp[e](i)).setOrigin(0),Ep[e]=t}return Ep[e]};const Lp=Phaser.GameObjects.RenderTexture;class Dp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(Tp(i)?(i=_p(d=i,"x",0),s=_p(d,"y",0),r=_p(d,"width",1),n=_p(d,"height",1),a=_p(d,"key",void 0),o=_p(d,"baseFrame",void 0),h=_p(d,"columns",void 0),l=_p(d,"rows",void 0)):Tp(r)?(r=_p(d=r,"width",1),n=_p(d,"height",1),a=_p(d,"key",void 0),o=_p(d,"baseFrame",void 0),h=_p(d,"columns",void 0),l=_p(d,"rows",void 0)):Tp(a)?(a=_p(d=a,"key",void 0),o=_p(d,"baseFrame",void 0),h=_p(d,"columns",void 0),l=_p(d,"rows",void 0)):Tp(o)?(o=_p(d=o,"baseFrame",void 0),h=_p(d,"columns",void 0),l=_p(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=_p(d,"baseFrame",void 0)):Tp(h)&&(h=_p(d=h,"columns",void 0),l=_p(d,"rows",void 0)),void 0===o&&(o=_p(d,"frame",void 0)),void 0===h){var c=_p(d,"leftWidth",void 0),u=_p(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(h=[c,void 0,u])}if(void 0===l){var p=_p(d,"topHeight",void 0),g=_p(d,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(_p(d,"getFrameNameCallback",void 0)),this.setStretchMode(_p(d,"stretchMode",0)),this.setPreserveRatio(_p(d,"preserveRatio",!0));var v=_p(d,"maxFixedPartScale",1),f=_p(d,"maxFixedPartScaleX",v),m=_p(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Pp),i}(Lp,"rexNinePatch")){}var Ap={_drawImage:function(t,e,i,s,r,n){var a=Rp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Rp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Dp.prototype,Ap);let Bp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const jp=Phaser.Utils.Objects.GetValue;class zp extends Dp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=jp(e,"effects",!0);i&&ir(this,i),this.style=new Bp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(zp.prototype,gu);const Wp=["alpha","tint","flipX","flipY"];var Yp=function(t,e){if(!e)return t;for(var i=0,s=Wp.length;i0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=A,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===B&&this.onDragEnd(),this.pointer=void 0,this.tracerState=A,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=j,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&R(t,s,e,i)}}const A=0,B=1,j="IDLE";function z(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var W={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,s,n,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new r(s,n||t,a),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,r=[];if(0===this._eventsCount)return r;for(s in t=this._events)e.call(t,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,n=s.length,a=new Array(n);rthis.tapOffset&&(this.state=Q,this.state=q);break;case Q:this.state=q}}onDragEnd(){this.state===q&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Q))}onDrag(){this.state!==J&&this.pointer.getDistance()>this.dragThreshold&&(this.state=J)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===q){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=J):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Q:this.state=J)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Q&&(this.state=J)}get isTapped(){return this.state===Q}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const J="IDLE",q="BEGIN",Q="RECOGNIZED",tt=Phaser.Utils.Objects.GetValue;class et extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=it},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tt(t,"threshold",9)),this.setHoldTime(tt(t,"time",251)),this}onDragStart(){this.state=st,0===this.holdTime&&(this.state=rt)}onDragEnd(){this.state=it}onDrag(){this.state!==it&&this.pointer.getDistance()>this.dragThreshold&&(this.state=it)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===st&&t-this.pointer.downTime>=this.holdTime&&(this.state=rt)}get isPressed(){return this.state===rt}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const it="IDLE",st="BEGIN",rt="RECOGNIZED",nt=Phaser.Utils.Objects.GetValue;class at extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=M(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ot},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nt(t,"threshold",10)),this}onDragStart(){this.state=ht,0===this.dragThreshold&&(this.state=lt)}onDragEnd(){this.state=ot}onDrag(){switch(this.state){case ht:if(this.pointer.getDistance()>=this.dragThreshold){this.state=lt,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case lt:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=M(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===lt}setDragThreshold(t){return this.dragThreshold=t,this}}const ot="IDLE",ht="BEGIN",lt="RECOGNIZED";var dt=function(t){return o(t).loop.delta};const ct=Phaser.Math.Distance.Between,ut=Phaser.Math.Angle.Between;var pt={getDt:function(){return dt(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ct(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ut(e.x,e.y,t.x,t.y)}},gt={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vt={};const ft=Phaser.Utils.Objects.GetValue,mt=Phaser.Math.RadToDeg;class yt extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bt},eventEmitter:!1};this.setRecongizedStateObject(new N(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ft(t,"threshold",10)),this.setVelocityThreshold(ft(t,"velocityThreshold",1e3)),this.setDirectionMode(ft(t,"dir","8dir")),this}onDragStart(){this.state=xt}onDragEnd(){this.state=bt}onDrag(){this.state===xt&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Ct))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Ct&&(this.state=bt)}get isSwiped(){return this.state===Ct}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gt[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vt),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mt(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yt.prototype,pt);const bt="IDLE",xt="BEGIN",Ct="RECOGNIZED";var wt=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t};const St=Phaser.Utils.Objects.GetValue,Ot=Phaser.Utils.Array.SpliceOne,kt=Phaser.Math.Distance.Between,Pt=Phaser.Math.Angle.Between;class Tt{constructor(t,e){var i=r(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(St(e,"inputConfig",void 0)),this.setEventEmitter(St(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(St(t,"enable",!0)),this.bounds=St(t,"bounds",void 0),this.tracerState=Mt,this.pointers.length=0,wt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,wt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mt:this.tracerState=Et,this.onDrag1Start();break;case Et:this.tracerState=Rt,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Ot(this.pointers,e),this.tracerState){case Et:this.tracerState=Mt,this.onDrag1End();break;case Rt:this.tracerState=Et,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Et:this.onDrag1();break;case Rt:this.onDrag2()}}}dragCancel(){return this.tracerState===Rt&&this.onDrag2End(),this.pointers.length=0,wt(this.movedState),this.tracerState=Mt,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0],e=this.pointers[1];return kt(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0],e=this.pointers[1];return Pt(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_t.x=e.x-i.x,_t.y=e.y-i.y}else _t.x=0,_t.y=0;return _t}get centerX(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rt)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rt)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Lt,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&R(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&R(t,s,e,i)}}Object.assign(Tt.prototype,e);var _t={};const Mt=0,Et=1,Rt=2,Lt="IDLE",Dt=Phaser.Utils.Objects.GetValue;class At extends Tt{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=Bt},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Dt(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=jt,0===this.dragThreshold&&(this.state=zt)}onDrag2End(){this.state=Bt}onDrag2(){switch(this.state){case jt:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=zt}break;case zt:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===zt}setDragThreshold(t){return this.dragThreshold=t,this}}const Bt="IDLE",jt="BEGIN",zt="RECOGNIZED",Wt=Phaser.Math.RotateAround;var Yt=function(t,e,i,s){return Wt(t,e,i,s),t.rotation+=s,t},It={};const Xt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.Angle.WrapDegrees,Vt=Phaser.Math.Angle.ShortestBetween,Gt=Phaser.Math.RadToDeg,Ht=Phaser.Math.DegToRad;var Ut={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=It),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ft(Gt(this.angleBetween));this.angle=Vt(this.prevAngle,t),this.prevAngle=t,this.state=Kt}break;case Kt:t=Ft(Gt(this.angleBetween)),this.angle=Vt(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Kt}get rotation(){return Ht(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ut);const Nt="IDLE",$t="BEGIN",Kt="RECOGNIZED";var Zt=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i};const Jt=Phaser.Utils.Objects.GetValue;class qt extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Jt(e,"inputTarget",t),this.pan=new at(this.inputTarget);var i=Zt(t,Jt(e,"camera"));this.setCamera(i).setEnable(Jt(e,"enable",!0)),this.boot()}boot(){this.pan.on("pan",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom;e.scrollX-=t.dx/i,e.scrollY-=t.dy/i}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pan.destroy(),this.pan=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this}}var Qt=function(t,e,i,s){if(void 0!==i){var r=t.getWorldPoint(i,s);t.zoom=e,function(t){var e=t.width,i=t.height,s=t.zoomX,r=t.zoomY,n=t.matrix,a=t.scrollX,o=t.scrollY;t.useBounds&&(a=t.clampX(a),o=t.clampY(o)),t.scrollX=a,t.scrollY=o;var h=a+.5*e,l=o+.5*i;t.midPoint.set(h,l);var d=e/s,c=i/r;t.worldView.setTo(h-d/2,l-c/2,d,c);var u=e*t.originX,p=i*t.originY;n.applyITRS(t.x+u,t.y+p,t.rotation,s,r),n.translate(-u,-p)}(t);var n=t.getWorldPoint(i,s);t.scrollX-=n.x-r.x,t.scrollY-=n.y-r.y}else t.zoom=e};const te=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class ee extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=te(e,"inputTarget",t),this.pinch=new At(this.inputTarget);var i=Zt(t,te(e,"camera"));this.setCamera(i).setEnable(te(e,"enable",!0)).setMinZoom(te(e,"minZoom",void 0)).setMaxZoom(te(e,"maxZoom",void 0)),this.boot()}boot(){this.pinch.on("pinch",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom*t.scaleFactor;void 0!==this.minZoom&&ithis.maxZoom&&(i=this.maxZoom);var s=t.pointers[0],r=t.pointers[1],n=(s.x+r.x)/2,a=(s.y+r.y)/2;Qt(e,i,n,a)}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pinch.destroy(),this.pinch=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}}const ie=Phaser.Input.Keyboard.Key,se=Phaser.Input.Keyboard.KeyCodes,re=["up","down","left","right"];class ne{constructor(t){this.scene=t,this.keys={},this.cursorKeys={},this.noKeyDown=!0;for(var e=0,i=re.length;e=s&&e<=s+o,l=e<=r&&e>=r-o,d=i>=n&&i<=n+o,c=i<=a&&i>=a-o;this.pointerOutBoundsReleaseEnable||(h|=er,d|=ia),this.setKeyState("left",h),this.setKeyState("right",l),this.setKeyState("up",d),this.setKeyState("down",c)}}get up(){return this.upKeyDown}get down(){return this.downKeyDown}get left(){return this.leftKeyDown}get right(){return this.rightKeyDown}get noKey(){return this.noKeyDown}}const pe=Phaser.Utils.Objects.GetValue;class ge extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.cursorAtBounds=new ue(t);var i=this.cursorAtBounds.createCursorKeys();this.cameraController=new Phaser.Cameras.Controls.SmoothedKeyControl({left:i.left,right:i.right,up:i.up,down:i.down,acceleration:.06,drag:.003,maxSpeed:.3});var s=Zt(t,pe(e,"camera"));this.setCamera(s).setEnable(pe(e,"enable",!0)),this.boot()}boot(){this.scene.events.on("preupdate",this.updateCameraController,this)}shutdown(t){this.isShutdown||(this.scene.events.off("preupdate",this.updateCameraController,this),this.cursorAtBounds.destroy(),this.cameraController.destroy(),super.shutdown(t))}get camera(){return this.cameraController.camera}set camera(t){this.cameraController.setCamera(t),t?this.cameraController.start():this.cameraController.stop()}setCamera(t){return this.camera=t,this}get enable(){return this.cursorAtBounds.enable}set enable(t){this.cursorAtBounds.enable=t}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}updateCameraController(t,e){this.cameraController.update(e)}}const ve=Phaser.Utils.Objects.GetValue;class fe extends c{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=ve(e,"tickEventName",i),this.isSceneTicker=!me(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),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)}}var me=function(t){return"step"===t||"poststep"===t};const ye=Phaser.Utils.Objects.GetValue,be=Phaser.Math.Clamp;class xe{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=ye(t,"state",Ce),this.timeScale=ye(t,"timeScale",1),this.delay=ye(t,"delay",0),this.repeat=ye(t,"repeat",0),this.repeatCounter=ye(t,"repeatCounter",0),this.repeatDelay=ye(t,"repeatDelay",0),this.duration=ye(t,"duration",0),this.nowTime=ye(t,"nowTime",0),this.justRestart=ye(t,"justRestart",!1)}toJSON(){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}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?Se:we,this.repeatCounter=0,this}stop(){return this.state=Ce,this}update(t,e){this.state!==Ce&&this.state!==ke&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Oe)):(this.nowTime=this.duration,this.state=ke):this.nowTime>=0&&(this.state=Se))}get t(){var t;switch(this.state){case Ce:case we:case Oe:t=0;break;case Se:t=this.nowTime/this.duration;break;case ke:t=1}return be(t,0,1)}set t(t){(t=be(t,-1,1))<0?(this.state=we,this.nowTime=-this.delay*t):(this.state=Se,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Ce}get isDelay(){return this.state===we}get isCountDown(){return this.state===Se}get isRunning(){return this.state===we||this.state===Se}get isDone(){return this.state===ke}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Ce=0,we=1,Se=2,Oe=3,ke=-1;class Pe extends fe{constructor(t,e){super(t,e),this.timer=new xe}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Te=Phaser.Utils.Objects.GetValue,_e=Phaser.Utils.Objects.GetAdvancedValue,Me=Phaser.Tweens.Builders.GetEaseFunction;class Ee extends Pe{resetFromJSON(t){return this.timer.resetFromJSON(Te(t,"timer")),this.setEnable(Te(t,"enable",!0)),this.setTarget(Te(t,"target",this.parent)),this.setDelay(_e(t,"delay",0)),this.setDuration(_e(t,"duration",1e3)),this.setEase(Te(t,"ease","Linear")),this.setRepeat(Te(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Me(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Re=Phaser.Math.Linear;class Le extends Ee{constructor(t,e){super(t,e),this.resetFromJSON(e)}start(t){return this.stop(),this.startZoomValue=this.target.zoom,this.endZoomValue=t,this.timer.setDuration(this.duration),super.start(),this}updateTarget(t,e){var i=this.parent,s=Re(this.startZoomValue,this.endZoomValue,e.t);Qt(t,s,i.focusLocalX,i.focusLocalY)}}const De=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Ae extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.easeZoom=new Le(this);var i=Zt(t,De(e,"camera"));this.setEnable(De(e,"enable",!0)).setMinZoom(De(e,"minZoom")).setMaxZoom(De(e,"maxZoom")).setZoomStep(De(e,"zoomStep",.1)).setEaseDuration(De(e,"easeDuration",200)).setCamera(i),this.boot()}boot(){this.scene.input.on("wheel",this.onWheel,this)}shutdown(t){this.isShutdown||(this.scene.input.off("wheel",this.onWheel,this),this.easeZoom.destroy(),this.easeZoom=void 0,this.inputTarget=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this.resetZoomLevel(),this.easeZoom.stop().setTarget(t||null),this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}setZoomStep(t){return this.zoomStep=t,this}setEaseDuration(t){return this.easeDuration=t,this.easeZoom.setDuration(t),this}resetZoomLevel(){var t=this.camera;return t?(this.zoomLevel=Math.round(Be(t.zoom,this.zoomStep)),this.zoom=t.zoom,this):(this.zoomLevel=void 0,this)}onWheel(t,e,i,s,r,n){var a=this.camera;if(this.enable&&a){var o=void 0!==this.minZoom,h=void 0!==this.maxZoom;o&&this.zoom<=this.minZoom&&s>0||h&&this.zoom>=this.maxZoom&&s<0||(this.zoomLevel+=s<0?1:-1,this.zoom=je(this.zoomLevel,this.zoomStep),o&&this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.focusLocalX=t.x,this.focusLocalY=t.y,this.easeZoom.start(this.zoom))}}}var Be=function(t,e){return t>=1?Math.log(t)/Math.log(1+e):-Math.log(t)/Math.log(1-e)},je=function(t,e){return t>=0?Math.pow(1+e,t):Math.pow(1-e,-t)};function ze(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ze(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ze(t[i]));return e}const We=Phaser.Utils.Objects.GetValue;class Ye extends l{constructor(t,e){super(t,e=void 0===e?{}:ze(e)),this._enable=!0,this._camera=void 0;var i=We(e,"enable",!0),s=We(e,"minZoom"),r=We(e,"maxZoom");We(e,"panScroll",!0)&&(this.panScroll=new qt(t,{camera:We(e,"camera"),inputTarget:We(e,"inputTarget",t),enable:We(e,"panScrollEnable",!0)})),We(e,"pinchZoom",!0)&&(this.pinchZoom=new ee(t,{camera:We(e,"camera"),inputTarget:We(e,"inputTarget",t),enable:We(e,"pinchZoomEnable",!0),minZoom:We(e,"pinchZoomMin",s),maxZoom:We(e,"pinchZoomMax",r)})),We(e,"boundsScroll",!0)&&(this.boundsScroll=new ge(t,{camera:We(e,"camera"),enable:We(e,"boundsScrollEnable",!0)})),We(e,"mouseWheelZoom",!0)&&(this.mouseWheelZoom=new Ae(t,{camera:We(e,"camera"),enable:We(e,"mouseWheelZoomEnable",!0),zoomStep:We(e,"mouseWheelZoomStep",.1),minZoom:We(e,"mouseWheelZoomMin",s),maxZoom:We(e,"mouseWheelZoomMax",r)})),this.setEnable(i)}destroy(t){this.panScroll&&this.panScroll.destroy(t),this.pinchZoom&&this.pinchZoom.destroy(t),this.boundsScroll&&this.boundsScroll.destroy(t),this.mouseWheelZoom&&this.mouseWheelZoom.destroy(t),super.destroy(t)}set camera(t){this.panScroll&&this.panScroll.setCamera(t),this.pinchZoom&&this.pinchZoom.setCamera(t),this.boundsScroll&&this.boundsScroll.setCamera(t),this.mouseWheelZoom&&this.mouseWheelZoom.setCamera(t)}get camera(){return this.panScroll?this.panScroll.camera:this.pinchZoom?this.pinchZoom.camera:this.boundsScroll?this.boundsScroll.camera:this.mouseWheelZoom?this.mouseWheelZoom.camera:void 0}setCamera(t){return this.camera=t,this}set panScrollEnable(t){this.panScroll&&(this.panScroll.enable=t)}get panScrollEnable(){return!!this.panScroll&&this.panScroll.enable}setPanScrollEnable=function(t){return void 0===t&&(t=!0),this.panScrollEnable=t,this};set pinchZoomEnable(t){this.pinchZoom&&(this.pinchZoom.enable=t)}get pinchZoomEnable(){return!!this.pinchZoom&&this.pinchZoom.enable}setPinchZoomEnable=function(t){return void 0===t&&(t=!0),this.pinchZoomEnable=t,this};set boundsScrollEnable(t){this.boundsScroll&&(this.boundsScroll.enable=t)}get boundsScrollEnable(){return!!this.boundsScroll&&this.boundsScroll.enable}setBoundsScrollEnable=function(t){return void 0===t&&(t=!0),this.boundsScrollEnable=t,this};set mouseWheelZoomEnable(t){this.mouseWheelZoom&&(this.mouseWheelZoom.enable=t)}get mouseWheelZoomEnable(){if(this.mouseWheelZoom)return this.mouseWheelZoom.enable}setMouseWheelZoomEnable(t){return void 0===t&&(t=!0),this.mouseWheelZoom=t,this}set enable(t){t=!!t,this._enable!==t&&(t?(this.panScrollEnable=this.panScrollEnableSave,this.pinchZoomEnable=this.pinchZoomEnableSave,this.boundsScrollEnable=this.boundsScrollEnableSave,this.mouseWheelZoomEnable=this.mouseWheelZoomEnableSave):(this.panScrollEnableSave=this.panScrollEnable,this.pinchZoomEnableSave=this.pinchZoomEnable,this.boundsScrollEnableSave=this.boundsScrollEnable,this.mouseWheelZoomEnableSave=this.mouseWheelZoomEnable,this.panScrollEnable=!1,this.pinchZoomEnable=!1,this.boundsScrollEnable=!1,this.mouseWheelZoomEnable=!1),this._enable=t)}get enable(){return this._enable}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.enable=!this.enable,this}}var Ie=function(t){return null==t||""===t||0===t.length},Xe=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ie(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Ie(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return He(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Ue(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iqe(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eqe(t).x,getChildLocalY:t=>qe(t).y};const gi=Phaser.Math.DegToRad;var vi={updateChildRotation(t){var e=qe(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=qe(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return qe(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return qe(t).rotation=gi(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=qe(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>qe(t).rotation},fi={updateChildScale(t){var e=qe(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=qe(t),i=e.parent;return e.scaleX=ui(t.scaleX,i.scaleX),e.scaleY=ui(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=qe(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=qe(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>qe(t).scaleX,getChildLocalScaleY:t=>qe(t).scaleY},mi={updateChildVisible(t){var e=qe(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=qe(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),qe(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),qe(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=qe(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>qe(t).visible},yi={updateChildAlpha(t){var e=qe(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=qe(t),i=e.parent;return e.alpha=ui(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return qe(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=qe(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>qe(t).alpha},bi={updateChildActive(t){var e=qe(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return qe(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),qe(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=qe(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>qe(t).active},xi={updateChildScrollFactor(t){var e=qe(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Ci={updateCameraFilter(t){var e=qe(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},wi={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Si=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Pi=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const _i=Phaser.Utils.Array;var Mi={getChildren(t){if(t)for(var e=0,i=this.children.length;e0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let js=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};t.register("fullWindowRectangle",(function(t,e){var i=new js(this.scene,t,e);return this.scene.add.existing(i),i})),Xe(window,"RexPlugins.GameObjectShell.FullWindowRectangle",js);var zs={hasProperty(t){var e=this.gameObject;return!!e.hasOwnProperty(t)||void 0!==e[t]},getProperty(t){return this.gameObject[t]},setProperty(t,e){return this.gameObject[t]=e,this},easeProperty(t){var e=t.property,i=t.value,s=t.duration,r=t.delay,n=t.ease,a=t.repeat,o=t.yoyo,h=t.from,l=t.complete,d=t.target;if(void 0===s&&(s=1e3),void 0===r&&(r=0),void 0===n&&(n="Linear"),void 0===a&&(a=0),void 0===o&&(o=!1),void 0===d&&(d=this.gameObject),h){var c=i;i=d[e],d[e]=c}return(t={targets:d,duration:s,delay:r,ease:n,repeat:a,yoyo:o,onComplete:l})[e]=i,this.addTweenTask(e,t),this},addTweenTask(t,e){var i=this.tweens,s=i[t];s&&s.remove();var r=e.onComplete;return e.onComplete=function(){i[t].remove(),i[t]=null,r&&r(e.targets,t)},(s=this.scene.tweens.add(e)).timeScale=this.timeScale,i[t]=s,this},getTweenTask(t){return this.tweens[t]},freeTweens(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},Ws={hasMethod(t){return"function"==typeof this.gameObject[t]},call(t,...e){if(!this.hasMethod(t))return console.warn(`[GameObjectManager] Game object '${this.name}' does not have method '${t}'`),this;var i=this.gameObject;return i[t].apply(i,e),this}},Ys={hasData(t){var e=this.gameObject;return!!e.data&&e.data.has(t)},getData(t){return this.gameObject.getData(t)},setData(t,e){return this.gameObject.setData(t,e),this}};class Is{constructor(t,e,i){this.GOManager=t,this.tweens={},this.effects={},this.setGO(e,i)}get scene(){return this.GOManager.scene}get timeScale(){return this.GOManager.timeScale}destroy(){this.freeGO(),this.GOManager=void 0}freeGO(){return this.freeTweens(),this.gameObject.bob=void 0,this.gameObject.destroy(),this.gameObject=void 0,this}setGO(t,e){return t.goName=e,t.goType=this.GOManager.name,t.bob=this,this.gameObject=t,this.name=e,this.freeTweens(),this}setTimeScale(t){var e=this.tweens;for(var i in e){var s=e[i];s&&(s.timeScale=t)}return this}}Object.assign(Is.prototype,zs,Ws,Ys);var Xs=function(t){for(var e in t)return!1;return!0},Fs=function(t){return t&&"!"!==t.charAt(0)},Vs={has(t){return this.bobs.hasOwnProperty(t)},exists(t){return this.bobs.hasOwnProperty(t)},get(t,e){if(Fs(t))return this.bobs[t];for(var i in void 0===e&&(e=[]),t&&(t=t.substring(1)),this.bobs)t&&i===t||e.push(this.bobs[i]);return e},getFitst(t){for(var e in t&&"!"===t.charAt(0)&&(t=t.substring(1)),this.bobs)if(!t||t!==e)return this.bobs[e];return null},getGO(t,e){var i=this.get(t);return i?Array.isArray(i)?(void 0===e&&(e=[]),i.forEach((function(t){e.push(t.gameObject)})),e):i.gameObject:null},forEachGO(t,e){for(var i in this.bobs){var s=this.bobs[i].gameObject;if(e?t.call(e,s,i,this):t(s,i,this))break}return this},getAllGO(t){for(var e in void 0===t&&(t=[]),this.bobs){var i=this.bobs[e].gameObject;t.push(i)}return t}},Gs=function(t){return t>>16&255},Hs=function(t){return t>>8&255},Us=function(t){return 255&t};const Ns=Phaser.Events.EventEmitter;var $s=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Ks),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Ks={},Zs=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=$s),function(t){if(t.events)return t;var e=new Ns,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Js=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},qs=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Qs=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(ir(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},cr={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=Zt(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},ur={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):Ji(i,t,e)})),this}};Object.assign(ur,Vs,rr,nr,ar,or,hr,dr,cr);const pr=Phaser.Utils.Objects.GetValue;class gr{constructor(t,e){this.scene=t,this.BobClass=pr(e,"BobClass",Is),this.setCreateGameObjectCallback(pr(e,"createGameObject"),pr(e,"createGameObjectScope")),this.setEventEmitter(pr(e,"eventEmitter",void 0)),this.setGameObjectDepth(pr(e,"depth",void 0));var i=pr(e,"fade",500);"number"==typeof i?(this.setGOFadeMode(),this.setGOFadeTime(i)):(this.setGOFadeMode(pr(i,"mode")),this.setGOFadeTime(pr(i,"time",500)));var s=pr(e,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(pr(e,"enable",!0)),this.setViewport(pr(s,"viewport"))):this.setViewportCoordinateEnable(!1);var r=pr(e,"effectProperties",!1);this.setEffectPropertiesConfig(r),this.setSymbols(pr(e,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1,this.name=pr(e,"name")}destroy(t){this.clear(!t),this.createGameObjectCallback=void 0,this.viewport=void 0,this.scene=void 0}set timeScale(t){if(this._timeScale!==t){this._timeScale=t;var e=this.bobs;for(var i in e)e[i].setTimeScale(t)}}get timeScale(){return this._timeScale}setTimeScale(t){return this.timeScale=t,this}setCreateGameObjectCallback(t,e){return this.createGameObjectCallback=t,this.createGameObjectScope=e,this}setGameObjectDepth(t){return this.gameObjectDepth=t,this}setViewportCoordinateEnable(t){return void 0===t&&(t=!0),this.viewportCoordinateEnable=t,this}setEffectPropertiesConfig(t){return void 0===t&&(t=!0),this.effectPropertiesConfig=t,this}setViewport(t){return void 0===t&&(t=le(this.scene,this.scene.cameras.main)),this.viewport=t,this}setSymbols(t){return this.symbols=t,this}get isEmpty(){return Xs(this.bobs)&&0===this.removedGOs.length}}Object.assign(gr.prototype,e,ur);var vr={getLayer(t){return this.getGO(t)},getLayers(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(e)})),Si(t,!1),t},addToLayer(t,e){var i=this.getGO(t);if(i){Array.isArray(e)||(e=[e]);for(var s=0,r=e.length;s=0;e--)this.remove(this.backgroundChildren[e],t);return this}};const Sn=Phaser.Utils.Objects.GetValue;var On=function(t,e){return void 0===e?t:t[e]},kn=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Sn(e,"left",0),t.right=Sn(e,"right",0),t.top=Sn(e,"top",0),t.bottom=Sn(e,"bottom",0)),t},Pn={getInnerPadding(t){return On(this.space,t)},setInnerPadding(t,e){return kn(this.space,t,e),this},getOuterPadding(t){return On(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return kn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),On(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),kn(this.getSizerConfig(t).padding,e,i),this}},Tn=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},_n=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Mn=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},En=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Rn=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ln=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Dn={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},An=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ga={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,n){var a=r(t);return a.time.delayedCall(e,(function(){a.game.events.once("poststep",(function(){i.call(s,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ha={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Rr),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Rr),this.transitOutCallback=t,this}},Ua={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Na={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},$a={};Object.assign($a,Ga,Ha,Ua,Na);const Ka=Phaser.Utils.Objects.GetValue;class Za extends l{constructor(t,e){super(t,e),this.setTransitInTime(Ka(e,"duration.in",200)),this.setTransitOutTime(Ka(e,"duration.out",200)),this.setTransitInCallback(Ka(e,"transitIn")),this.setTransitOutCallback(Ka(e,"transitOut")),this.oneShotMode=Ka(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Va(this,{eventEmitter:!1,initState:Ka(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Za.prototype,$a);const Ja=Phaser.Utils.Objects.GetValue;class qa extends l{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ja(t,"hitAreaMode",0)),this.setEnable(Ja(t,"enable",!0)),this.setStopMode(Ja(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Qa[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Qa={default:0,fullWindow:1};const to=Phaser.Utils.Objects.GetValue;class eo extends js{constructor(t,e){super(t,to(e,"color",0),to(e,"alpha",.8)),this.touchEventStop=new qa(this,{hitAreaMode:1})}}var io={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Kn(t,e)},scaleDown(t,e){Zn(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ha(t,e)},fadeOut(t,e){la(t,e,!1)}},so=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ha(t,e,t.alpha)},ro=function(t,e){la(t,e,!1)};const no=Phaser.Utils.Objects.GetValue;let ao=class extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=oo.popUp),null==e.transitOut&&(e.transitOut=oo.scaleDown),e.destroy=no(e,"destroy",!0),super(t,e);var i=no(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new eo(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(no(i,"transitIn",so)),this.setCoverTransitOutCallback(no(i,"transitOut",ro)));var s=no(e,"touchOutsideClose",!1),r=no(e,"duration.hold",-1),n=no(e,"timeOutClose",r>=0),a=no(e,"anyTouchClose",!1);no(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),no(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=oo[t]),t){case oo.popUp:t=io.popUp;break;case oo.fadeIn:t=io.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=oo[t]),t){case oo.scaleDown:t=io.scaleDown;break;case oo.fadeOut:t=io.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const oo={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ho={modal(t,e){return ws(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new ao(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},lo=function(t,e,i,s,r){ws(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},co={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return lo.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return lo.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return lo.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return lo.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return lo.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return lo.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return lo.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return lo.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return lo.call(this,"shutdown",t,e,i,s),this}},uo=function(t){return"[object Array]"===Object.prototype.toString.call(t)},po=function(t,e,i,s,r){return _(t,e,i,vo(s),r)},go=function(t){return!(t.rexSizer&&t.rexSizer.hidden)},vo=function(t){return t?function(e,i,s){return!!go(e)&&(t(e,i,s),!0)}:go},fo={},mo=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=fo),i.x=e.x,i.y=e.y,i.scaleX=e.scaleX,i.scaleY=e.scaleY,i.width=e.width,i.height=e.height,i.displayWidth=e.displayWidth,i.displayHeight=e.displayHeight,this.layoutedChildren.push(t))},yo=function(t,e,i,s,r,n,a,o){void 0===a&&(a=0),void 0===o&&(o=0),en(t,e,i,s,r,n),t.x+=a,t.y+=o,this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)};const bo=Phaser.Display.Align.CENTER,xo=Phaser.Utils.Objects.IsPlainObject,Co=Phaser.Utils.Objects.GetValue;class wo extends l{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(Co(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(Co(t,"enable",!0)),this.setMode(Co(t,"mode",1)),this.setClickInterval(Co(t,"clickInterval",100)),this.setDragThreshold(Co(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=So[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const So={press:0,pointerdown:0,release:1,pointerup:1};var Oo={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wo(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},ko=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Po(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return To.length=0,!0;return To.length=0,!1},To=[];const _o=Phaser.Utils.Objects.GetValue;class Mo extends l{constructor(t,e){super(t,e),this._enable=void 0;var i=_o(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_o(t,"enable",!0)),this.setMode(_o(t,"mode",1)),this.setClickInterval(_o(t,"clickInterval",100)),this.setDragThreshold(_o(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Eo[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?ko:R)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Eo={press:0,pointerdown:0,release:1,pointerup:1};var Ro={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mo(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lo extends N{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Do=Phaser.Utils.Objects.GetValue;class Ao extends l{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lo,this.parent.setInteractive(Do(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Do(t,"enable",!0)),this.setCooldown(Do(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Bo={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&R(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ao(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ao(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},jo={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},zo=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const gh=Phaser.Utils.Objects.IsPlainObject,vh=Phaser.Utils.Objects.GetValue,fh=Phaser.Display.Align.CENTER,mh={min:0,full:-1};var yh=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,v;un.call(this,t);var f=t.isRexSpace,m=typeof e;if(null===e)return this;if("number"===m);else if("string"===m)e=mh[e];else if(gh(e)){var y;e=vh(y=e,"proportion",void 0),i=vh(y,"align",fh),s=vh(y,"padding",0),r=vh(y,"expand",!1),n=vh(y,"key",void 0),a=vh(y,"index",void 0),t.isRexSizer||(o=vh(y,"minWidth",void 0),h=vh(y,"minHeight",void 0)),l=vh(y,"fitRatio",0),d=vh(y,"offsetX",0),c=vh(y,"offsetY",0),u=vh(y,"offsetOriginX",0),v=vh(y,"offsetOriginY",0)}return"string"==typeof i&&(i=Er[i]),void 0===e&&(e=f?1:0),void 0===i&&(i=fh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(f?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(f?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=p(t)/g(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===v&&(v=0),(y=this.getSizerConfig(t)).proportion=e,y.align=i,y.padding=dn(s),y.expand=r,y.fitRatio=0===e?l:0,y.alignOffsetX=d,y.alignOffsetY=c,y.alignOffsetOriginX=u,y.alignOffsetOriginY=v,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?p(t):o:t.minHeight=void 0===h?g(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},bh={add:yh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),yh.call(this,new uh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return gh(i)&&(i.index=t),yh.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ph.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const xh=ss.prototype.clear;var Ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),xh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Ch.call(this,t),this}},Oh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Er[e]),this.getSizerConfig(t).align=e,this}},kh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ph={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Th={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},_h={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(zn(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,An.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,v=this.innerLeft,f=this.innerTop,m=this.innerWidth,y=this.innerHeight,b=v,x=f,C=this.startChildIndex,w=0,S=u.length;w0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=En.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||_n.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&dh.call(this,t,void 0),Mn.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Rn.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&dh.call(this,void 0,t),Ln.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(_h,bh,Sh,Oh,kh,Ph,Th);var Mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Eh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Rh=function(t){return"string"==typeof t&&(t=Eh[t]),t};const Lh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue;class Ah extends oh{constructor(t,e,i,s,r,n,a){Lh(e)?(e=Dh(a=e,"x",0),i=Dh(a,"y",0),s=Dh(a,"width",void 0),r=Dh(a,"height",void 0),n=Dh(a,"orientation",0)):Lh(s)?(s=Dh(a=s,"width",void 0),r=Dh(a,"height",void 0),n=Dh(a,"orientation",0)):Lh(n)&&(n=Dh(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Dh(a,"space.item",0)),this.setStartChildIndex(Dh(a,"startChildIndex",0)),this.setRTL(Dh(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Rh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Mh.call(this)),this._childrenProportion}}Object.assign(Ah.prototype,_h);var Bh=function(t,e,i,s){return e/t<=i?e/(s-1):0},jh=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=zh(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=zh(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const Yh=Phaser.Utils.Objects.IsPlainObject,Ih=Phaser.Utils.Objects.GetValue,Xh=Phaser.Display.Align.CENTER;var Fh=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(un.call(this,t),Yh(e)&&(e=Ih(h=e,"padding",0),i=Ih(h,"key",void 0),s=Ih(h,"index",void 0),r=Ih(h,"offsetX",0),n=Ih(h,"offsetY",0),a=Ih(h,"offsetOriginX",0),o=Ih(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=Xh,h.padding=dn(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},Vh={add(t,e,i){if(uo(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Ch.call(this,t),this}},Uh={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(h.join("")),r},xl=0,Cl=1,wl=2,Sl=0,Ol=1,kl=2,Pl=/(?:\r\n|\r|\n)/;const Tl={none:Sl,word:Ol,char:kl,character:kl,mix:3},_l=Phaser.Renderer.WebGL.Utils;var Ml={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=_l.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const El=Phaser.Display.Color;var Rl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=u);var p=d.cutX+a,g=d.cutY+o;return this.context.drawImage(d.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new El);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Ll=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(d,o.source[0].glTexture,!0,0)},Dl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Ll(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Ve();const Al=Phaser.Display.Canvas.CanvasPool,Bl=Phaser.GameObjects.GameObject,jl=Phaser.Utils.String.UUID;let zl=class extends Bl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Al.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=jl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Al.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Wl=Phaser.GameObjects.Components;Phaser.Class.mixin(zl,[Wl.Alpha,Wl.BlendMode,Wl.Crop,Wl.Depth,Wl.Flip,Wl.GetBounds,Wl.Mask,Wl.Origin,Wl.Pipeline,Wl.PostPipeline,Wl.ScrollFactor,Wl.Tint,Wl.Transform,Wl.Visible,Ml,Rl,Dl]);var Yl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:F(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&wt(this.data),this}};class Il{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Il.prototype,Yl);var Xl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Fl=Phaser.Math.RotateAround;var Vl;const Gl=Phaser.Geom.Rectangle;var Hl,Ul=function(t){void 0===Hl&&(Hl=new Gl);var e=t.drawTLX,i=t.drawTLY;return Hl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Hl};const Nl=Phaser.Math.RotateAround;var $l,Kl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===$l&&($l={}),s=$l),s.x=e,s.y=i,0!==t.rotation&&Nl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Zl=Phaser.GameObjects.Components.TransformMatrix;var Jl,ql,Ql={},td=function(t,e,i,s,r){var n=Kl(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ql);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Jl&&(Jl=new Zl,ql=new Zl),t.parentContainer?t.getWorldTransformMatrix(Jl,ql):Jl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Jl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ed=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return td(t,e,n,a,r)},id={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Vl&&(Vl={}),s=Vl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Fl(s,0,0,-i.rotation),s}(t,e,this,!0);return Ul(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ed(this.parent,this,t,e,i)}};Object.assign(id,Xl);const sd=Phaser.Math.DegToRad,rd=Phaser.Math.RadToDeg,nd=Phaser.Utils.Objects.GetValue;class ad extends Il{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return rd(this._rotation)}set angle(t){this.rotation=sd(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=nd(t,"width",void 0),i=nd(t,"height",void 0),s=nd(t,"scaleX",void 0),r=nd(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ad.prototype,id);const od=Phaser.Utils.String.Pad;var hd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${od(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ld=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const dd=Phaser.Utils.Objects.GetValue;let cd=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=dd(t,"x",0),i=dd(t,"y",0));var s=this.cornerRadius;s.tl=ud(dd(t,"tl",void 0),e,i),s.tr=ud(dd(t,"tr",void 0),e,i),s.bl=ud(dd(t,"bl",void 0),e,i),s.br=ud(dd(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){pd(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){pd(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){pd(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){pd(this.cornerRadius.br,t)}};var ud=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),gd(t),t},pd=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=dd(e,"x",0),t.y=dd(e,"y",0)),gd(t)},gd=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vd=Phaser.Math.DegToRad;var fd=function(t){return!t.hasOwnProperty("convex")||t.convex},md=function(t){return t.x>0&&t.y>0},yd=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,md(o)?(h=o.x*v,l=o.y*f,fd(o)?yd(t,h,l,h,l,180,270,!1,a):yd(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,md(o)?(h=o.x*v,l=o.y*f,fd(o)?yd(t,s-h,l,h,l,270,360,!1,a):yd(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,md(o)?(h=o.x*v,l=o.y*f,fd(o)?yd(t,s-h,r-l,h,l,0,90,!1,a):yd(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,md(o)?(h=o.x*v,l=o.y*f,fd(o)?yd(t,h,r-l,h,l,90,180,!1,a):yd(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},xd=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),bd(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}};const Cd=Phaser.Utils.Objects.GetValue;class wd extends ad{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Cd(e,"color",null),Cd(e,"color2",null),Cd(e,"horizontalGradient",!0)),this.setStroke(Cd(e,"stroke",null),Cd(e,"strokeThickness",2)),this.setCornerRadius(Cd(e,"cornerRadius",0),Cd(e,"cornerIteration",null))}set color(t){t=hd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=hd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=hd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ld("color2",t,this),ld("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ld("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ld("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){xd(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Sd=Phaser.Utils.Objects.GetValue;class Od extends ad{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Sd(e,"color",null),Sd(e,"color2",null),Sd(e,"horizontalGradient",!0)),this.setStroke(Sd(e,"stroke",null),Sd(e,"strokeThickness",2))}set color(t){t=hd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=hd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=hd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Sd(t,"color2",null),Sd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Sd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const kd=Phaser.Utils.Objects.GetValue;let Pd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(kd(t,"bold",!1)),this.setItalic(kd(t,"italic",!1)),this.setFontSize(kd(t,"fontSize","16px")),this.setFontFamily(kd(t,"fontFamily","Courier")),this.setColor(kd(t,"color","#fff")),this.setStrokeStyle(kd(t,"stroke",null),kd(t,"strokeThickness",0)),this.setShadow(kd(t,"shadowColor",null),kd(t,"shadowOffsetX",0),kd(t,"shadowOffsetY",0),kd(t,"shadowBlur",0)),this.setOffset(kd(t,"offsetX",0),kd(t,"offsetY",0)),this.setSpace(kd(t,"leftSpace",0),kd(t,"rightSpace",0)),this.setAlign(kd(t,"align",void 0)),this.setBackgroundColor(kd(t,"backgroundColor",null)),this.setBackgroundHeight(kd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(kd(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(kd(t,"backgroundLeftX",0)),this.setBackgroundRightX(kd(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ld("stroke",t,this),ld("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ld("shadowOffsetX",t,this),ld("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=hd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=hd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=hd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=hd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Td=Phaser.Utils.Array.Remove,_d=Phaser.Utils.Array.Remove,Md="text",Ed="image",Rd="drawer",Ld="space",Dd="command";var Ad=function(t){return t.type===Md&&"\n"===t.text},Bd=function(t){return t.type===Md&&"\f"===t.text},jd=function(t){return t.type===Md};class zd extends ad{constructor(t,e,i){super(t,Md),this.updateTextFlag=!1,this.style=new Pd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Wd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yd=Phaser.Display.Canvas.CanvasPool;var Id=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Yd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Yd.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Xd extends ad{constructor(t,e,i){super(t,Ed),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Id(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Fd extends ad{constructor(t,e,i,s){super(t,Rd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Vd extends ad{constructor(t,e){super(t,Ld),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Gd extends Il{constructor(t,e,i,s,r){super(t,Dd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Hd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ud={none:0,word:1,char:2,character:2,mix:3};var Nd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Jd.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Jd.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Qd(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Qd(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Qd(t,"wrapMode");void 0===c&&(c=Qd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ud[c]);var u=Qd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Qd(t,"letterSpacing",0),g=Qd(t,"hAlign",0),v=Qd(t,"vAlign",0),f=Qd(t,"justifyPercentage",.25),m=Hd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ic(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ic(t,"maxLines",0);var o=0===i,h=ic(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ic(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=ic(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ic(t,"letterSpacing",0),p=ic(t,"rtl",!0),g=ic(t,"hAlign",p?2:0),v=ic(t,"vAlign",0),f=Hd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return kn(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return On(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Td(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return _d(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Md);return null===i?i=new zd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ed(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Tc=Phaser.Utils.Objects.GetFastValue;var _c={};class Mc{constructor(t){this.pools=Tc(t,"pools",_c)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Pc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=zc(t,r,e,i,n),o=0;o<=Ac&&0!==a;o++){if((r+=a)<0){r=0;break}a=zc(t,r,e,i,n)}return o===Ac&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wc(t,e,i),t},jc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},zc=function(t,e,i,s,r){var n,a=jc(t,e,r),o=jc(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Wc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Yc=Phaser.Utils.Objects.GetValue,Ic=Phaser.Utils.Objects.GetValue;class Xc extends rl{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Ic(e,"background",void 0),r=Ic(e,"icon",void 0),n=Ic(e,"iconMask",void 0),a=Ic(e,"text",void 0),o=Ic(e,"action",void 0),h=Ic(e,"actionMask",void 0),l=Ic(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:Ic(e,"space.icon",0),top:Ic(e,"space.iconTop",0),bottom:Ic(e,"space.iconBottom",0),left:Ic(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:Ic(e,"space.icon",0),left:Ic(e,"space.iconLeft",0),right:Ic(e,"space.iconRight",0),top:Ic(e,"space.iconTop",0)});var d=Ic(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=dl.call(this,r,r,1)),!d){var c=Ic(e,"iconSize",void 0);this.setIconSize(Ic(e,"iconWidth",c),Ic(e,"iconHeight",c))}}if(a){var u=Ic(e,"wrapText",!1),p=Ic(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(vl(t)){case 0:switch("string"==typeof e&&(e=Tl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=yl;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Tl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Dc(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Yc(e,"minWidth",0),s=Yc(e,"minHeight",0),r=Yc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Bc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Bc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var g,v,f=Ic(e,"space.text",0),m=Ic(e,"expandTextWidth",!1),y=Ic(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:Ic(e,"space.actionTop",0),bottom:Ic(e,"space.actionBottom",0),right:Ic(e,"space.actionRight",0)}:{left:Ic(e,"space.actionLeft",0),right:Ic(e,"space.actionRight",0),bottom:Ic(e,"space.actionBottom",0)},d=Ic(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=dl.call(this,o,o,1)),!d)){var b=Ic(e,"actionSize");this.setActionSize(Ic(e,"actionWidth",b),Ic(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}var Fc=Phaser.Renderer.WebGL.Utils,Vc=function(t,e,i,s,r,n){for(var a=Fc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,h=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},$c=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const Kc=Phaser.Renderer.Canvas.SetTransform;var Zc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Uc(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Vc(r,a,e,l,o,h),e.isStroked&&Hc(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Kc(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(qc.prototype,Zc);var Qc=function(t){return t.x>0&&t.y>0},tu=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const eu=Phaser.Math.DegToRad;var iu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=sp(t,"tl",0),this.radiusTR=sp(t,"tr",0),this.radiusBL=sp(t,"bl",0),this.radiusBR=sp(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?iu(e,e,e,e,180,270,!1,r,t):iu(0,0,e,e,90,0,!0,r,t):tu(0,0,t),(e=this.radiusTR)>0?this._convexTR?iu(i-e,e,e,e,270,360,!1,r,t):iu(i,0,e,e,180,90,!0,r,t):tu(i,0,t),(e=this.radiusBR)>0?this._convexBR?iu(i-e,s-e,e,e,0,90,!1,r,t):iu(i,s,e,e,270,180,!0,r,t):tu(i,s,t),(e=this.radiusBL)>0?this._convexBL?iu(e,s-e,e,e,90,180,!1,r,t):iu(0,s,e,e,360,270,!0,r,t):tu(0,s,t),t.push(t[0],t[1]),Iu(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var np=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const ap=Phaser.Utils.Objects.GetValue,op=Phaser.Utils.Objects.IsPlainObject;class hp extends(Eu(wu)){constructor(t,e,i,s,r,n,a,o){op(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):op(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):op(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new ip).setName("trackFill")).addShape((new ip).setName("bar")).addShape((new ip).setName("trackStroke")),this.setTrackColor(ap(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ap(o,"trackStrokeThickness",2),ap(o,"trackStrokeColor",void 0)),this.setSkewX(ap(o,"skewX",0)),this.setRTL(ap(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var lp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&np(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),np(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&np(o,0,0,e,i,t)}};Object.assign(hp.prototype,lp);class dp extends hp{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Xe(e,"easeValue.duration",e.easeDuration),Xe(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=cp,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const cp={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(dp.prototype,gu);let up=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const pp=Phaser.GameObjects.NineSlice,gp=Phaser.Utils.Objects.GetValue;class vp extends pp{constructor(t,e){void 0===e&&(e={}),super(t,gp(e,"x",0),gp(e,"y",0),gp(e,"key",null),gp(e,"frame",null),gp(e,"width",0),gp(e,"height",0),gp(e,"leftWidth",0),gp(e,"rightWidth",0),gp(e,"topHeight",0),gp(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=gp(e,"effects",!0);i&&ir(this,i),this.style=new up(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vp.prototype,gu);let fp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const mp=Phaser.GameObjects.Image,yp=Phaser.Utils.Objects.GetValue;class bp extends mp{constructor(t,e){void 0===e&&(e={}),super(t,yp(e,"x",0),yp(e,"y",0),yp(e,"key",""),yp(e,"frame",void 0)),this.type="rexStatesImage";var i=yp(e,"effects",!0);i&&ir(this,i),this.style=new fp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(bp.prototype,gu);var xp=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Cp=Phaser.Utils.Objects.IsPlainObject,wp=Phaser.Utils.Objects.GetValue;var Sp=function(t){return"string"==typeof t&&(t=Op[t]),t};const Op={scale:0,repeat:1};var kp=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Pp={_beginDraw:Rr,_drawImage:Rr,_drawTileSprite:Rr,_endDraw:Rr,setGetFrameNameCallback:function(t){return void 0===t&&(t=xp),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=ze(i),s=ze(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,u=0;for(h=0,l=s.length;h0?0:v,b=0,h=0;for(var S=i.length;h0?0:f),f>=1&&v>=1){var O=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,v)}b+=f}x+=v}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(u,p);if(u>g){var v=(u-g)*h;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Cp(t)?(this.stretchMode.edge=Sp(wp(t,"edge",0)),this.stretchMode.internal=Sp(wp(t,"internal",0))):(t=Sp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return kp.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Tp=Phaser.Utils.Objects.IsPlainObject,_p=Phaser.Utils.Objects.GetValue,Mp=Phaser.GameObjects;var Ep=void 0,Rp=function(t,e){if(Ep||(Ep={},o(t).events.once("destroy",(function(){for(var t in Ep)Ep[t].destroy();Ep=void 0}))),!Ep.hasOwnProperty(e)){var i=o(t).scene.systemScene;(t=new Mp[e](i)).setOrigin(0),Ep[e]=t}return Ep[e]};const Lp=Phaser.GameObjects.RenderTexture;class Dp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(Tp(i)?(i=_p(d=i,"x",0),s=_p(d,"y",0),r=_p(d,"width",1),n=_p(d,"height",1),a=_p(d,"key",void 0),o=_p(d,"baseFrame",void 0),h=_p(d,"columns",void 0),l=_p(d,"rows",void 0)):Tp(r)?(r=_p(d=r,"width",1),n=_p(d,"height",1),a=_p(d,"key",void 0),o=_p(d,"baseFrame",void 0),h=_p(d,"columns",void 0),l=_p(d,"rows",void 0)):Tp(a)?(a=_p(d=a,"key",void 0),o=_p(d,"baseFrame",void 0),h=_p(d,"columns",void 0),l=_p(d,"rows",void 0)):Tp(o)?(o=_p(d=o,"baseFrame",void 0),h=_p(d,"columns",void 0),l=_p(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=_p(d,"baseFrame",void 0)):Tp(h)&&(h=_p(d=h,"columns",void 0),l=_p(d,"rows",void 0)),void 0===o&&(o=_p(d,"frame",void 0)),void 0===h){var c=_p(d,"leftWidth",void 0),u=_p(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(h=[c,void 0,u])}if(void 0===l){var p=_p(d,"topHeight",void 0),g=_p(d,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(_p(d,"getFrameNameCallback",void 0)),this.setStretchMode(_p(d,"stretchMode",0)),this.setPreserveRatio(_p(d,"preserveRatio",!0));var v=_p(d,"maxFixedPartScale",1),f=_p(d,"maxFixedPartScaleX",v),m=_p(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Pp),i}(Lp,"rexNinePatch")){}var Ap={_drawImage:function(t,e,i,s,r,n){var a=Rp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Rp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Dp.prototype,Ap);let Bp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const jp=Phaser.Utils.Objects.GetValue;class zp extends Dp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=jp(e,"effects",!0);i&&ir(this,i),this.style=new Bp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(zp.prototype,gu);const Wp=["alpha","tint","flipX","flipY"];var Yp=function(t,e){if(!e)return t;for(var i=0,s=Wp.length;i * @copyright 2018 Photon Storm Ltd. @@ -8,4 +8,4 @@ var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,this.displayLi * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var zm=function(t,e){var i=Gi(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},Wm=function(t,e,i){return Ip(t,zm(e,i))};class Ym extends Za{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Im={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Xm=function(t,e){ea.popUp.call(t,e,this.expandDirection)},Fm=function(t,e){ea.scaleDown.call(t,e,this.expandDirection)},Vm={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Xm.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Fm.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Gm=Phaser.Utils.Objects.GetValue;let Hm=class extends Ah{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=Gm(e,"space"),a=1===this.orientation?"left":"top",o=Gm(e,"align.title",a),h=Gm(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:Gm(n,"titleLeft",0),right:Gm(n,"titleRight",0),top:Gm(n,"titleTop",0),bottom:Gm(n,"titleBottom",0)}});var l=Gm(e,"toggleByTarget",void 0),d=Gm(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&Oo.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Ym(r),!Gm(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=Gm(e,"align.child","left");var u=(h=Gm(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:o,expand:h,padding:{left:Gm(n,"childLeft",0),right:Gm(n,"childRight",0),top:Gm(n,"childTop",0),bottom:Gm(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Gm(p,"duration",200)),this.setExpandCallback(Gm(p,"expandCallback",void 0)),this.setCollapseCallback(Gm(p,"collapseCallback",void 0)),this.reLayoutTarget=Gm(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var v=e.onExpandComplete;v&&this.on("expand.complete",v);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=Gm(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(Hm.prototype,Im,Vm);var Um={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},Nm={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class $m extends Hm{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign($m.prototype,Um,Nm);const Km=Phaser.Utils.Objects.GetValue,Zm=Phaser.Utils.Objects.GetValue,Jm=Ah.prototype.add,qm=Ah.prototype.addSpace;var Qm=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&qm.call(this),Jm.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&qm.call(this),this.hasTailSpace=s}else Jm.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Jm.call(this,t,{index:r,proportion:i,expand:!0})}else Jm.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},ty={addButton(t){if(uo(t))for(var e=t,i=0,s=e.length;i=0;i--)sy.call(this,e[i],t);return this}},ny=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ay=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ny.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},oy={add(t){return this.buttons.push(t),t._click||(t._click=new wo(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ay.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&by.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Oy.call(this,e[i],t);return this}};const Py=Phaser.Utils.Objects.GetValue;class Ty extends Jh{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new gy({parent:this,eventEmitter:Py(e,"eventEmitter",this),groupName:Py(e,"groupName",void 0),clickConfig:Py(e,"click",void 0)}).setButtonsType(e);var s=Py(e,"background",void 0),r=Py(e,"buttons",void 0);this.buttonsAlign=Py(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ty.prototype,Cy,ky,py,fy);var _y=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=My[i])}void 0===s?s={}:!0===s&&(s=Ey);var n=e.width/t.width,a=e.height/t.height,o=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*o,s.height=t.height*o,s};const My={fit:0,FIT:0,envelop:1,ENVELOP:1};var Ey={},Ry={},Ly={};const Dy=Phaser.Utils.Objects.IsPlainObject,Ay=Phaser.Utils.Objects.GetValue,By=Phaser.Display.Align.CENTER,jy=Phaser.Utils.String.UUID;var zy={add:function(t,e,i,s,r,n,a,o,h,l){var d,c;un.call(this,t),Dy(e)&&(e=Ay(u=e,"key",void 0),i=Ay(u,"align",By),s=Ay(u,"padding",0),r=Ay(u,"expand",!0),t.isRexSizer||(n=Ay(u,"minWidth",t._minWidth),a=Ay(u,"minHeight",t._minHeighted)),o=Ay(u,"offsetX",0),h=Ay(u,"offsetY",0),d=Ay(u,"offsetOriginX",0),c=Ay(u,"offsetOriginY",0),l=Ay(u,"aspectRatio",0));var u,v=void 0!==e;return v||(e=jy()),"string"==typeof i&&(i=Er[i]),void 0===i&&(i=By),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===o&&(o=0),void 0===h&&(h=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=p(t)/g(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=dn(s),Dy(r)?(u.expandWidth=Ay(r,"width",!1),u.expandHeight=Ay(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?p(t):n),u.expandHeight&&(t.minHeight=void 0===a?g(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,v&&this.addChildrenMap(e,t),this}},Wy={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),bn.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Ch.call(this,t),this}},Yy={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,d,c,u=this.innerLeft,v=this.innerTop,f=this.innerWidth,m=this.innerHeight,y=this.sizerChildren;for(var b in y)(t=y[b]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mo.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ry.width=e.aspectRatio,Ry.height=1,Ly.width=l,Ly.height=d,l=(c=_y(Ry,Ly,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),hh(t,this)):zn(t,l,d),s=u+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=v+i.top*this.scaleY,a=m-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=p(t)),void 0===d&&(d=g(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yo.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(Yy,zy,Wy);const Iy=Phaser.Utils.Objects.IsPlainObject,Xy=Phaser.Utils.Objects.GetValue;class Fy extends oh{constructor(t,e,i,s,r,n){Iy(e)?(e=Xy(n=e,"x",0),i=Xy(n,"y",0),s=Xy(n,"width",void 0),r=Xy(n,"height",void 0)):Iy(s)&&(s=Xy(n=s,"width",void 0),r=Xy(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Fy.prototype,Yy);const Vy=Fy.prototype.add;var Gy=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),Vy.call(this,t,e,i,s,r,n,a,o,h),this},Hy={add:Gy,addPage:Gy};const Uy=ss.prototype.setChildVisible;var Ny={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(Uy.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(Uy.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(Ny,Hy);const $y=Phaser.Utils.Objects.GetValue;class Ky extends Fy{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode($y(e,"swapMode",0)),this.setFadeInDuration($y(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=Zy[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(Ky.prototype,Ny);const Zy={invisible:0,destroy:1},Jy=Phaser.Utils.Objects.IsPlainObject,qy=Phaser.Utils.Objects.GetValue,Qy=Phaser.Utils.String.UUID;var tb={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},eb={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},ib={top:1,left:3,right:5,bottom:7},sb={top:"bottom",left:"right",right:"left",bottom:"top"},rb={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},nb={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Sb=Phaser.Utils.Objects.GetValue;class Ob extends Ah{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Sb(e,"background",void 0),s=Sb(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Sb(e,"space.title",0)}});var r=Sb(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Ob.prototype,Cb,wb);const kb=Phaser.Utils.Objects.GetValue,Pb=Phaser.Utils.Objects.GetValue;var Tb=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const _b=Phaser.Geom.Intersects.RectangleToRectangle,Mb=Phaser.Geom.Rectangle.Overlaps;var Eb=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Rb=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},Lb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Db=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Ab=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Bb=Phaser.Utils.Objects.GetValue,jb={update:0,everyTick:1};var zb={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Bb(t,"updateMode",0)),this.enableChildrenMask(Bb(t,"padding",0)),this.setMaskLayer(Bb(t,"layer",void 0)),this.onMaskGameObjectVisible=Bb(t,"onVisible"),this.onMaskGameObjectInvisible=Bb(t,"onInvisible"),this.maskGameObjectCallbackScope=Bb(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=jb[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=dl.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,d=t.getBounds(),c=Tb(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Fb.prototype,Wb);const Vb=["top","bottom","centerY","center"],Gb=["left","right","centerX","center"];var Hb=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Vb.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=Gb.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Ub=Phaser.Utils.Objects.GetValue;class Nb extends Qf{constructor(t,e){void 0===e&&(e={});var i=Ev(e),s=Ub(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Ub(e,"clampChildOY",!1),s.clampChildOX=Ub(e,"clampChildOX",!1);var r,n,a=new Fb(t,s);switch(t.add.existing(a),i){case 0:r=Ub(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Ub(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Ub(e,"align.panel","center")};var o=Ub(e,"space",void 0);o&&(o.child=Ub(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),rh(this.childrenMap.child,t),this}}var $b={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Hb.call(this,t,"y",e);break;case 1:Hb.call(this,t,"x",e);break;default:Hb.call(this,t,"y",e),Hb.call(this,t,"x",e)}return this}};Object.assign(Nb.prototype,$b);var Kb={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},Zb={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class Jb extends Nb{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Jb.prototype,Kb,Zb);const qb=Phaser.Utils.Objects.GetValue,Qb=Phaser.Utils.Objects.GetValue,tx=Phaser.Utils.Objects.GetValue;var ex={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=tx(t,"onGetValue"),this.onSetValue=tx(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},ix={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},sx={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const rx=Phaser.Utils.Objects.GetValue;class nx extends Ah{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=rx(e,"proportion.title",0),o=rx(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=rx(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(nx.prototype,ex,ix,sx);var ax=function(t,e,i){var s=new wm(t,i);return t.add.existing(s),s},ox=function(t){return void 0===t&&(t=Ah),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},hx=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=gx(this.styles,"inputRow")||{},r=px(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Ip(t,zm(e,i))}(this.scene,t,vx(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),fx(this,ze(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(jx(this),zx(this)),this}setNumberInput(){return this.onUpdateCallback=Bx,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Ix=Phaser.Utils.Objects.GetValue,Xx=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Fx=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}$x.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(Kx(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Zx=new $x,Jx=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,qx=/\S/,Qx=new $x;Qx.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!qx.test(t)&&!qx.test(e)},Qx.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(sC(t,null,null,i),i," ")},iC.equals=function(t,e){return $x.prototype.equals.call(iC,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const rC=new $x;rC.tokenize=function(t){return t.slice()},rC.join=rC.removeEmpty=function(t){return t};const nC=Phaser.Utils.Array.Remove;var aC=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),nC(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Zx.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},cC={cursorMoveLeft(){if(!this.isOpened)return this;var t=hC(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=hC(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=lC(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=hC(dC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=lC(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=hC(dC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const uC=Phaser.Utils.Objects.IsPlainObject;class pC extends Lc{constructor(t,e,i,s,r,n){uC(e)?n=e:uC(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Fx(e,"wrap.vAlign")||Xe(e,"wrap.vAlign",s=i?"center":"top"),Fx(e,"wrap.wrapMode")||Xe(e,"wrap.wrapMode","char"),Fx(e,"wrap.maxLines")||Xe(e,"wrap.maxLines",s=i?1:void 0),i&&Xe(e,"wrap.wrapWidth",1/0),Fx(e,"wrap.useDefaultTextHeight")||Xe(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Fx(e.edit,"inputType")){var s=i?"text":"textarea";Xe(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Gx(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=hu(n.background,"focus"),h=hu(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Ix(e,"edit");return void 0===i&&(i={}),wx(e,i,Xx),new Yx(t,i)}(this,n),Hx.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Nx.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Ux.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=vC(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},mC={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},yC={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const bC=Phaser.Utils.Objects.GetValue;class xC extends Qf{constructor(t,e){void 0===e&&(e={});var i,s=bC(e,"text");Ui(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new pC(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=bC(e,"space",void 0);h&&(h.child=bC(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=bC(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(xC.prototype,mC,yC);var CC={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?ze(e):{}:e||(e={});var s=new xC(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},wC={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=vC(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const SC=Phaser.Utils.Objects.GetValue,OC=Phaser.Math.Linear,kC=Phaser.Math.Snap.Floor;var PC={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=SC(s,r),a=function(t,e){var i=new Sf(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=SC(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=vC(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=SC(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=OC(t.minValue,t.maxValue,a.value);t.step&&(e=kC(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},TC=function(t,e){var i=new yy(t,e);return t.add.existing(i),i};const _C=Phaser.Utils.Objects.GetValue;var MC={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=_C(e,"incDec")||{},r={text:null,action:null},n=TC(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=vC(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(ze(r),s.incButton||{}),d=ub(i,l),c=Object.assign(ze(r),s.decButton||{}),u=ub(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new ww(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const Ow=Phaser.Utils.Objects.GetValue;var kw=function(t,e){var i=Ow(e,"expandDirection",void 0);"string"==typeof i&&(i=Pw[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Fx(s=e,r="alignTarget")?F(s,r):n&&Fx(s,n)?F(s,n):a&&Fx(s,a)?F(s,a):o),c=Ow(e,"alignTargetY",d),u=Ow(e,"alignOffsetX",0),p=Ow(e,"alignOffsetY",0),g=Ow(e,"alignSide","").includes("right"),v=Ow(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=le(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Pw={down:0,up:1},Tw=Phaser.Utils.Objects.GetValue;class _w extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Kn(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Nn(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),kw(t,e),t.isRexSizer&&t.layout();var i=Tw(e,"touchOutsideClose",!1),s=Tw(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Mw={openColorPicker:function(){if(!this.colorPicker){var t=Sw.call(this).layout(),e=new _w(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Mw,VC);const Ew=Phaser.Utils.Objects.GetValue;class Rw extends FC{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Ew(i,"width",160),Ew(i,"height",170));var n=Ew(i,"background");r=n?function(t){return Ip(t,n)}:Ew(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Ew(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Ew(i,"expandDirection")),this.setColorPickerEaseInDuration(Ew(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Ew(i,"easeOut",200)),this.setColorPickerTransitInCallback(Ew(i,"transitIn")),this.setColorPickerTransitOutCallback(Ew(i,"transitOut")),this.setColorPickerBounds(Ew(i,"bounds"));var a=Ew(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(Ew(o,"height",30)),this.setColorComponentsFormatLabelConfig(Ew(o,"formatLabel"));var h=Ew(o,"inputText");h||(h=Ew(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=Ew(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(Rw.prototype,Mw);var Lw={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?ze(e):{}:e||(e={});var s=new Rw(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Dw={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Aw={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Bw={buildShapes(){this.addShape((new rp).setName("box")).addShape((new ip).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},jw={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new La(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},zw={};Object.assign(zw,Dw,Aw,Bw,jw);const Ww=23730,Yw=Phaser.Utils.Objects.GetValue,Iw=Phaser.Utils.Objects.IsPlainObject;class Xw extends wu{constructor(t,e,i,s,r,n,a){Iw(e)?(e=Yw(a=e,"x",0),i=Yw(a,"y",0),s=Yw(a,"width",2),r=Yw(a,"height",2),n=Yw(a,"color",Ww)):Iw(n)&&(n=Yw(a=n,"color",Ww)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Ww),this.setBoxShape(Yw(a,"circleBox",!1)),this.setBoxFillStyle(n,Yw(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(Yw(a,"uncheckedColor",null),Yw(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(Yw(a,"boxLineWidth",4),Yw(a,"boxStrokeColor",n),Yw(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,Yw(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),Yw(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(Yw(a,"checkerColor",16777215),Yw(a,"checkerAlpha",1)),this.setBoxSize(Yw(a,"boxSize",1)),this.setCheckerSize(Yw(a,"checkerSize",1)),this.setCheckerAnimationDuration(Yw(a,"animationDuration",150)),this.buildShapes();var o=Yw(a,"checked");void 0===o&&(o=Yw(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(Xw.prototype,zw);const Fw=Phaser.Utils.Objects.GetValue,Vw=Phaser.Utils.Objects.IsPlainObject;class Gw extends Xw{constructor(t,e,i,s,r,n,a){Vw(e)?(e=Fw(a=e,"x",0),i=Fw(a,"y",0),s=Fw(a,"width",2),r=Fw(a,"height",2),n=Fw(a,"color",Ww)):Vw(n)&&(n=Fw(a=n,"color",Ww)),super(t,e,i,s,r,n,a),this._click=new wo(this,Fw(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Fw(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var Hw={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new Gw(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},Uw={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},Nw={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},$w={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},Kw=function(t,e,i){return(e-t)*i+t};const Zw=Phaser.Math.Linear;var Jw={buildShapes(){this.addShape((new rp).setName("track")).addShape((new rp).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&Kw(Gs(l),Gs(d),c))<<16|(255&Kw(Hs(l),Hs(d),c))<<8|255&Kw(Us(l),Us(d),c)),p=Zw(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=Zw(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},qw={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new La(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},Qw={};Object.assign(Qw,Uw,Nw,$w,Jw,qw);const tS=Phaser.Utils.Objects.GetValue,eS=Phaser.Utils.Objects.IsPlainObject,iS=23730;class sS extends wu{constructor(t,e,i,s,r,n,a){eS(e)?(e=tS(a=e,"x",0),i=tS(a,"y",0),s=tS(a,"width",2),r=tS(a,"height",2),n=tS(a,"color",iS)):eS(n)&&(n=tS(a=n,"color",iS)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=iS),this.setTrackFillStyle(n,tS(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(tS(a,"falseValueTrackColor",function(t){var e=.3*Gs(t)+.59*Hs(t)+.11*Us(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),tS(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(tS(a,"thumbColor",16777215),tS(a,"thumbAlpha",1)),this.setTrackSize(tS(a,"trackWidth",.9),tS(a,"trackHeight",.5)),this.setTrackRadius(tS(a,"trackRadius",.5*this.trackHeight));var o=tS(a,"thumbHeight",void 0),h=tS(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(tS(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(tS(a,"thumbLeft",.3),tS(a,"thumbRight",void 0)),this.setRTL(tS(a,"rtl",!1)),this.setToggleAnimationDuration(tS(a,"animationDuration",150)),this.buildShapes(),this.setValue(tS(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(sS.prototype,Qw);const rS=Phaser.Utils.Objects.GetValue;class nS extends sS{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new wo(this,rS(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(rS(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var aS={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new nS(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},oS={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=hS[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const hS={down:0,up:1},lS=Phaser.Utils.Objects.GetValue;var dS=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=cS(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=uS(e,this.listCreateSliderTrackCallback),g=uS(e,this.listCreateSliderThumbCallback);d=new Nb(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:lS(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=cS(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},cS=function(t,e,i){var s;return i?(e.orientation="x",s=new Ty(t,e)):(e.orientation="y",s=new yy(t,e)),t.add.existing(s),s},uS=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},pS={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},gS={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=dS.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new _w(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(gS,oS,pS);const vS=Phaser.Utils.Objects.GetValue;class fS extends Xc{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(vS(e,"options"));var i=vS(e,"list");this.setWrapEnable(vS(i,"wrap",!1)),this.setCreateButtonCallback(vS(i,"createButtonCallback")),this.setCreateListBackgroundCallback(vS(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(vS(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(vS(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(vS(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(vS(i,"scroller")),this.setListMouseWheelScrollerConfig(vS(i,"mouseWheelScroller")),this.setButtonClickCallback(vS(i,"onButtonClick")),this.setButtonOverCallback(vS(i,"onButtonOver")),this.setButtonOutCallback(vS(i,"onButtonOut")),this.setListExpandDirection(vS(i,"expandDirection")),this.setListEaseInDuration(vS(i,"easeIn",500)),this.setListEaseOutDuration(vS(i,"easeOut",100)),this.setListTransitInCallback(vS(i,"transitIn")),this.settListTransitOutCallback(vS(i,"transitOut")),this.setListMaxHeight(vS(i,"maxHeight",0)),this.setListSize(vS(i,"width"),vS(i,"height",0)),this.setListAlignmentMode(vS(i,"alignParent","text")),this.setListAlignmentSide(vS(i,"alignSide","")),this.setListBounds(vS(i,"bounds")),this.setListSpace(vS(i,"space")),this.setListDraggable(vS(i,"draggable",!1)),this.setValueChangeCallback(vS(e,"setValueCallback"),vS(e,"setValueCallbackScope")),this.setValue(vS(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(fS.prototype,gS);var mS=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?ze(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Cm(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=ub(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Ip(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Ip(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new fS(t,e);return t.add.existing(i),i},yS=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=mS(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=yS(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const xS=Phaser.Utils.Objects.GetValue;var CS={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?ze(e.button):{},r=xS(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=TC(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n=0;i--)sy.call(this,e[i],t);return this}},ny=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ay=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ny.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},oy={add(t){return this.buttons.push(t),t._click||(t._click=new wo(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ay.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&by.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Oy.call(this,e[i],t);return this}};const Py=Phaser.Utils.Objects.GetValue;class Ty extends Jh{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new gy({parent:this,eventEmitter:Py(e,"eventEmitter",this),groupName:Py(e,"groupName",void 0),clickConfig:Py(e,"click",void 0)}).setButtonsType(e);var s=Py(e,"background",void 0),r=Py(e,"buttons",void 0);this.buttonsAlign=Py(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ty.prototype,Cy,ky,py,fy);var _y=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=My[i])}void 0===s?s={}:!0===s&&(s=Ey);var n=e.width/t.width,a=e.height/t.height,o=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*o,s.height=t.height*o,s};const My={fit:0,FIT:0,envelop:1,ENVELOP:1};var Ey={},Ry={},Ly={};const Dy=Phaser.Utils.Objects.IsPlainObject,Ay=Phaser.Utils.Objects.GetValue,By=Phaser.Display.Align.CENTER,jy=Phaser.Utils.String.UUID;var zy={add:function(t,e,i,s,r,n,a,o,h,l){var d,c;un.call(this,t),Dy(e)&&(e=Ay(u=e,"key",void 0),i=Ay(u,"align",By),s=Ay(u,"padding",0),r=Ay(u,"expand",!0),t.isRexSizer||(n=Ay(u,"minWidth",t._minWidth),a=Ay(u,"minHeight",t._minHeighted)),o=Ay(u,"offsetX",0),h=Ay(u,"offsetY",0),d=Ay(u,"offsetOriginX",0),c=Ay(u,"offsetOriginY",0),l=Ay(u,"aspectRatio",0));var u,v=void 0!==e;return v||(e=jy()),"string"==typeof i&&(i=Er[i]),void 0===i&&(i=By),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===o&&(o=0),void 0===h&&(h=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=p(t)/g(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=dn(s),Dy(r)?(u.expandWidth=Ay(r,"width",!1),u.expandHeight=Ay(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?p(t):n),u.expandHeight&&(t.minHeight=void 0===a?g(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,v&&this.addChildrenMap(e,t),this}},Wy={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),bn.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Ch.call(this,t),this}},Yy={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,d,c,u=this.innerLeft,v=this.innerTop,f=this.innerWidth,m=this.innerHeight,y=this.sizerChildren;for(var b in y)(t=y[b]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mo.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ry.width=e.aspectRatio,Ry.height=1,Ly.width=l,Ly.height=d,l=(c=_y(Ry,Ly,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),hh(t,this)):zn(t,l,d),s=u+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=v+i.top*this.scaleY,a=m-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=p(t)),void 0===d&&(d=g(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yo.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(Yy,zy,Wy);const Iy=Phaser.Utils.Objects.IsPlainObject,Xy=Phaser.Utils.Objects.GetValue;class Fy extends oh{constructor(t,e,i,s,r,n){Iy(e)?(e=Xy(n=e,"x",0),i=Xy(n,"y",0),s=Xy(n,"width",void 0),r=Xy(n,"height",void 0)):Iy(s)&&(s=Xy(n=s,"width",void 0),r=Xy(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Fy.prototype,Yy);const Vy=Fy.prototype.add;var Gy=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),Vy.call(this,t,e,i,s,r,n,a,o,h),this},Hy={add:Gy,addPage:Gy};const Uy=ss.prototype.setChildVisible;var Ny={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(Uy.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(Uy.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(Ny,Hy);const $y=Phaser.Utils.Objects.GetValue;class Ky extends Fy{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode($y(e,"swapMode",0)),this.setFadeInDuration($y(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=Zy[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(Ky.prototype,Ny);const Zy={invisible:0,destroy:1},Jy=Phaser.Utils.Objects.IsPlainObject,qy=Phaser.Utils.Objects.GetValue,Qy=Phaser.Utils.String.UUID;var tb={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},eb={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},ib={top:1,left:3,right:5,bottom:7},sb={top:"bottom",left:"right",right:"left",bottom:"top"},rb={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},nb={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Sb=Phaser.Utils.Objects.GetValue;class Ob extends Ah{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Sb(e,"background",void 0),s=Sb(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Sb(e,"space.title",0)}});var r=Sb(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Ob.prototype,Cb,wb);const kb=Phaser.Utils.Objects.GetValue,Pb=Phaser.Utils.Objects.GetValue;var Tb=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const _b=Phaser.Geom.Intersects.RectangleToRectangle,Mb=Phaser.Geom.Rectangle.Overlaps;var Eb=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Rb=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},Lb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Db=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Ab=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Bb=Phaser.Utils.Objects.GetValue,jb={update:0,everyTick:1};var zb={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Bb(t,"updateMode",0)),this.enableChildrenMask(Bb(t,"padding",0)),this.setMaskLayer(Bb(t,"layer",void 0)),this.onMaskGameObjectVisible=Bb(t,"onVisible"),this.onMaskGameObjectInvisible=Bb(t,"onInvisible"),this.maskGameObjectCallbackScope=Bb(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=jb[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=dl.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,d=t.getBounds(),c=Tb(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Fb.prototype,Wb);const Vb=["top","bottom","centerY","center"],Gb=["left","right","centerX","center"];var Hb=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Vb.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=Gb.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Ub=Phaser.Utils.Objects.GetValue;class Nb extends Qf{constructor(t,e){void 0===e&&(e={});var i=Ev(e),s=Ub(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Ub(e,"clampChildOY",!1),s.clampChildOX=Ub(e,"clampChildOX",!1);var r,n,a=new Fb(t,s);switch(t.add.existing(a),i){case 0:r=Ub(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Ub(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Ub(e,"align.panel","center")};var o=Ub(e,"space",void 0);o&&(o.child=Ub(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),rh(this.childrenMap.child,t),this}}var $b={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Hb.call(this,t,"y",e);break;case 1:Hb.call(this,t,"x",e);break;default:Hb.call(this,t,"y",e),Hb.call(this,t,"x",e)}return this}};Object.assign(Nb.prototype,$b);var Kb={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},Zb={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class Jb extends Nb{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Jb.prototype,Kb,Zb);const qb=Phaser.Utils.Objects.GetValue,Qb=Phaser.Utils.Objects.GetValue,tx=Phaser.Utils.Objects.GetValue;var ex={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=tx(t,"onGetValue"),this.onSetValue=tx(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},ix={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},sx={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const rx=Phaser.Utils.Objects.GetValue;class nx extends Ah{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=rx(e,"proportion.title",0),o=rx(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=rx(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(nx.prototype,ex,ix,sx);var ax=function(t,e,i){var s=new wm(t,i);return t.add.existing(s),s},ox=function(t){return void 0===t&&(t=Ah),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},hx=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=gx(this.styles,"inputRow")||{},r=px(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Ip(t,zm(e,i))}(this.scene,t,vx(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),fx(this,ze(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(jx(this),zx(this)),this}setNumberInput(){return this.onUpdateCallback=Bx,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Ix=Phaser.Utils.Objects.GetValue,Xx=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Fx=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Kx.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(Zx(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Jx=new Kx,qx=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Qx=/\S/,tC=new Kx;tC.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Qx.test(t)&&!Qx.test(e)},tC.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(rC(t,null,null,i),i," ")},sC.equals=function(t,e){return Kx.prototype.equals.call(sC,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const nC=new Kx;nC.tokenize=function(t){return t.slice()},nC.join=nC.removeEmpty=function(t){return t};const aC=Phaser.Utils.Array.Remove;var oC=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),aC(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Jx.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},uC={cursorMoveLeft(){if(!this.isOpened)return this;var t=lC(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=lC(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=dC(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=lC(cC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=dC(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=lC(cC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const pC=Phaser.Utils.Objects.IsPlainObject;class gC extends Lc{constructor(t,e,i,s,r,n){pC(e)?n=e:pC(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Fx(e,"wrap.vAlign")||Xe(e,"wrap.vAlign",s=i?"center":"top"),Fx(e,"wrap.wrapMode")||Xe(e,"wrap.wrapMode","char"),Fx(e,"wrap.maxLines")||Xe(e,"wrap.maxLines",s=i?1:void 0),i&&Xe(e,"wrap.wrapWidth",1/0),Fx(e,"wrap.useDefaultTextHeight")||Xe(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Fx(e.edit,"inputType")){var s=i?"text":"textarea";Xe(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Gx(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=hu(n.background,"focus"),h=hu(n.style,"cursor"),l=hu(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Ix(e,"edit");return void 0===i&&(i={}),wx(e,i,Xx),new Yx(t,i)}(this,n),Hx.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),$x.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Ux.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),Xs(l)&&Object.assign(l,h),Nx.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=fC(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},yC={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},bC={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const xC=Phaser.Utils.Objects.GetValue;class CC extends Qf{constructor(t,e){void 0===e&&(e={});var i,s=xC(e,"text");Ui(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new gC(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=xC(e,"space",void 0);h&&(h.child=xC(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=xC(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(CC.prototype,yC,bC);var wC={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?ze(e):{}:e||(e={});var s=new CC(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},SC={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=fC(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const OC=Phaser.Utils.Objects.GetValue,kC=Phaser.Math.Linear,PC=Phaser.Math.Snap.Floor;var TC={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=OC(s,r),a=function(t,e){var i=new Sf(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=OC(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=fC(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=OC(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=kC(t.minValue,t.maxValue,a.value);t.step&&(e=PC(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},_C=function(t,e){var i=new yy(t,e);return t.add.existing(i),i};const MC=Phaser.Utils.Objects.GetValue;var EC={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=MC(e,"incDec")||{},r={text:null,action:null},n=_C(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=fC(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(ze(r),s.incButton||{}),d=ub(i,l),c=Object.assign(ze(r),s.decButton||{}),u=ub(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Sw(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const kw=Phaser.Utils.Objects.GetValue;var Pw=function(t,e){var i=kw(e,"expandDirection",void 0);"string"==typeof i&&(i=Tw[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Fx(s=e,r="alignTarget")?F(s,r):n&&Fx(s,n)?F(s,n):a&&Fx(s,a)?F(s,a):o),c=kw(e,"alignTargetY",d),u=kw(e,"alignOffsetX",0),p=kw(e,"alignOffsetY",0),g=kw(e,"alignSide","").includes("right"),v=kw(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=le(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Tw={down:0,up:1},_w=Phaser.Utils.Objects.GetValue;class Mw extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Kn(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Nn(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Pw(t,e),t.isRexSizer&&t.layout();var i=_w(e,"touchOutsideClose",!1),s=_w(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ew={openColorPicker:function(){if(!this.colorPicker){var t=Ow.call(this).layout(),e=new Mw(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Ew,GC);const Rw=Phaser.Utils.Objects.GetValue;class Lw extends VC{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Rw(i,"width",160),Rw(i,"height",170));var n=Rw(i,"background");r=n?function(t){return Ip(t,n)}:Rw(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Rw(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Rw(i,"expandDirection")),this.setColorPickerEaseInDuration(Rw(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Rw(i,"easeOut",200)),this.setColorPickerTransitInCallback(Rw(i,"transitIn")),this.setColorPickerTransitOutCallback(Rw(i,"transitOut")),this.setColorPickerBounds(Rw(i,"bounds"));var a=Rw(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(Rw(o,"height",30)),this.setColorComponentsFormatLabelConfig(Rw(o,"formatLabel"));var h=Rw(o,"inputText");h||(h=Rw(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=Rw(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(Lw.prototype,Ew);var Dw={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?ze(e):{}:e||(e={});var s=new Lw(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Aw={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Bw={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},jw={buildShapes(){this.addShape((new rp).setName("box")).addShape((new ip).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},zw={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new La(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},Ww={};Object.assign(Ww,Aw,Bw,jw,zw);const Yw=23730,Iw=Phaser.Utils.Objects.GetValue,Xw=Phaser.Utils.Objects.IsPlainObject;class Fw extends wu{constructor(t,e,i,s,r,n,a){Xw(e)?(e=Iw(a=e,"x",0),i=Iw(a,"y",0),s=Iw(a,"width",2),r=Iw(a,"height",2),n=Iw(a,"color",Yw)):Xw(n)&&(n=Iw(a=n,"color",Yw)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Yw),this.setBoxShape(Iw(a,"circleBox",!1)),this.setBoxFillStyle(n,Iw(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(Iw(a,"uncheckedColor",null),Iw(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(Iw(a,"boxLineWidth",4),Iw(a,"boxStrokeColor",n),Iw(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,Iw(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),Iw(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(Iw(a,"checkerColor",16777215),Iw(a,"checkerAlpha",1)),this.setBoxSize(Iw(a,"boxSize",1)),this.setCheckerSize(Iw(a,"checkerSize",1)),this.setCheckerAnimationDuration(Iw(a,"animationDuration",150)),this.buildShapes();var o=Iw(a,"checked");void 0===o&&(o=Iw(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(Fw.prototype,Ww);const Vw=Phaser.Utils.Objects.GetValue,Gw=Phaser.Utils.Objects.IsPlainObject;class Hw extends Fw{constructor(t,e,i,s,r,n,a){Gw(e)?(e=Vw(a=e,"x",0),i=Vw(a,"y",0),s=Vw(a,"width",2),r=Vw(a,"height",2),n=Vw(a,"color",Yw)):Gw(n)&&(n=Vw(a=n,"color",Yw)),super(t,e,i,s,r,n,a),this._click=new wo(this,Vw(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Vw(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var Uw={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new Hw(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},Nw={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},$w={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},Kw={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},Zw=function(t,e,i){return(e-t)*i+t};const Jw=Phaser.Math.Linear;var qw={buildShapes(){this.addShape((new rp).setName("track")).addShape((new rp).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&Zw(Gs(l),Gs(d),c))<<16|(255&Zw(Hs(l),Hs(d),c))<<8|255&Zw(Us(l),Us(d),c)),p=Jw(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=Jw(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},Qw={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new La(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},tS={};Object.assign(tS,Nw,$w,Kw,qw,Qw);const eS=Phaser.Utils.Objects.GetValue,iS=Phaser.Utils.Objects.IsPlainObject,sS=23730;class rS extends wu{constructor(t,e,i,s,r,n,a){iS(e)?(e=eS(a=e,"x",0),i=eS(a,"y",0),s=eS(a,"width",2),r=eS(a,"height",2),n=eS(a,"color",sS)):iS(n)&&(n=eS(a=n,"color",sS)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=sS),this.setTrackFillStyle(n,eS(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(eS(a,"falseValueTrackColor",function(t){var e=.3*Gs(t)+.59*Hs(t)+.11*Us(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),eS(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(eS(a,"thumbColor",16777215),eS(a,"thumbAlpha",1)),this.setTrackSize(eS(a,"trackWidth",.9),eS(a,"trackHeight",.5)),this.setTrackRadius(eS(a,"trackRadius",.5*this.trackHeight));var o=eS(a,"thumbHeight",void 0),h=eS(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(eS(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(eS(a,"thumbLeft",.3),eS(a,"thumbRight",void 0)),this.setRTL(eS(a,"rtl",!1)),this.setToggleAnimationDuration(eS(a,"animationDuration",150)),this.buildShapes(),this.setValue(eS(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(rS.prototype,tS);const nS=Phaser.Utils.Objects.GetValue;class aS extends rS{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new wo(this,nS(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(nS(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var oS={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new aS(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},hS={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=lS[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const lS={down:0,up:1},dS=Phaser.Utils.Objects.GetValue;var cS=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=uS(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=pS(e,this.listCreateSliderTrackCallback),g=pS(e,this.listCreateSliderThumbCallback);d=new Nb(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:dS(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=uS(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},uS=function(t,e,i){var s;return i?(e.orientation="x",s=new Ty(t,e)):(e.orientation="y",s=new yy(t,e)),t.add.existing(s),s},pS=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},gS={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},vS={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=cS.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Mw(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(vS,hS,gS);const fS=Phaser.Utils.Objects.GetValue;class mS extends Xc{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(fS(e,"options"));var i=fS(e,"list");this.setWrapEnable(fS(i,"wrap",!1)),this.setCreateButtonCallback(fS(i,"createButtonCallback")),this.setCreateListBackgroundCallback(fS(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(fS(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(fS(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(fS(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(fS(i,"scroller")),this.setListMouseWheelScrollerConfig(fS(i,"mouseWheelScroller")),this.setButtonClickCallback(fS(i,"onButtonClick")),this.setButtonOverCallback(fS(i,"onButtonOver")),this.setButtonOutCallback(fS(i,"onButtonOut")),this.setListExpandDirection(fS(i,"expandDirection")),this.setListEaseInDuration(fS(i,"easeIn",500)),this.setListEaseOutDuration(fS(i,"easeOut",100)),this.setListTransitInCallback(fS(i,"transitIn")),this.settListTransitOutCallback(fS(i,"transitOut")),this.setListMaxHeight(fS(i,"maxHeight",0)),this.setListSize(fS(i,"width"),fS(i,"height",0)),this.setListAlignmentMode(fS(i,"alignParent","text")),this.setListAlignmentSide(fS(i,"alignSide","")),this.setListBounds(fS(i,"bounds")),this.setListSpace(fS(i,"space")),this.setListDraggable(fS(i,"draggable",!1)),this.setValueChangeCallback(fS(e,"setValueCallback"),fS(e,"setValueCallbackScope")),this.setValue(fS(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(mS.prototype,vS);var yS=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?ze(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Cm(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=ub(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Ip(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Ip(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new mS(t,e);return t.add.existing(i),i},bS=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=yS(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=bS(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const CS=Phaser.Utils.Objects.GetValue;var wS={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?ze(e.button):{},r=CS(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=_C(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rexlabel.min.js b/dist/rexlabel.min.js index a92cd3f051..1f4dc3c7a2 100644 --- a/dist/rexlabel.min.js +++ b/dist/rexlabel.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},z=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const ke=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?fi:gi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=fi))}get t(){var t;switch(this.state){case vi:case gi:case mi:t=0;break;case fi:t=this.nowTime/this.duration;break;case yi:t=1}return ui(t,0,1)}set t(t){(t=ui(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===fi}get isRunning(){return this.state===gi||this.state===fi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,gi=1,fi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;class _i extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const ki={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Wi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Bi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,Ji=Phaser.Math.Linear;class qi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=$i(t,"x",void 0),i=$i(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=$i(i,"startX",void 0),this.startY=$i(i,"startY",void 0),this.endX=$i(i,"endX",void 0),this.endY=$i(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ji(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ji(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends hi{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,cs=Phaser.Math.Linear;class us extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=cs(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new us(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},fs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ds,Ls,Ys,zs);const As=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,Xs);var Ws=function(t){if(t.parentContainer)return Ws(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Ws(e):t};class Is extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ws(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;class Bs extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends Bs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var $s={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha)},qs=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Js)),this.setCoverTransitOutCallback(Ks(i,"transitOut",qs)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=$s.popUp;break;case tr.fadeIn:t=$s.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=$s.scaleDown;break;case tr.fadeOut:t=$s.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return wr.length=0,!0;return wr.length=0,!1},wr=[];const Sr=Phaser.Utils.Objects.GetValue;class Pr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Ms{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Er extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Mr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Jr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const $r=0,Jr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=an,0===this.holdTime&&(this.state=on)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&t-this.pointer.downTime>=this.holdTime&&(this.state=on)}get isPressed(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=kn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case _n:this.tracerState=On,this.onDrag1End();break;case kn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case kn:this.onDrag2()}}}dragCancel(){return this.tracerState===kn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(Pn.prototype,Ve);var Tn={};const On=0,_n=1,kn=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Dn={};const Ln=Phaser.Utils.Objects.GetValue,Yn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Yn(Xn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Yn(Xn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Wn="IDLE",In="BEGIN",jn="RECOGNIZED",Bn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Bn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},zr.call(t,e),Fr.call(t,e),jr.call(t,e),Ur.call(t,e),Hn.call(t,e),Un.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",de),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ce(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;fe.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=oh[e];else if(nh(e)){var f;e=hh(f=e,"proportion",void 0),i=hh(f,"align",ah),s=hh(f,"padding",0),r=hh(f,"expand",!1),n=hh(f,"key",void 0),h=hh(f,"index",void 0),t.isRexSizer||(a=hh(f,"minWidth",void 0),o=hh(f,"minHeight",void 0)),l=hh(f,"fitRatio",0),d=hh(f,"offsetX",0),c=hh(f,"offsetY",0),u=hh(f,"offsetOriginX",0),p=hh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ve(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Et.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(bh,dh,vh,gh,fh,mh,yh);var Ch=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=xh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ch.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,bh);var Th=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Oh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class _h extends Ph{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Th(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Th(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Th(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Th(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(_h.prototype,Oh);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Eh=Phaser.GameObjects.Graphics;class Mh extends Eh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Rh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Rh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Mh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Lh=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Lh};const zh=Phaser.GameObjects.BitmapText;var Xh=function(t){return t instanceof zh},Ah=/^[\x00-\x7F]+$/,Fh=function(t){return Ah.test(t)},Wh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},jh=2;const Bh={none:0,word:1,char:jh,character:jh,mix:3};var Hh=function(t,e){var i=function(t){return Xh(t)?2:Yh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Wh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e}};const Nh=Phaser.Renderer.WebGL.Utils;var Uh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Nh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Gh=Phaser.Display.Color;var Vh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Gh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},$h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Jh=Phaser.Display.Canvas.CanvasPool,qh=Phaser.GameObjects.GameObject,Zh=Phaser.Utils.String.UUID;class Kh extends qh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Jh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Zh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Jh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Qh=Phaser.GameObjects.Components;Phaser.Class.mixin(Kh,[Qh.Alpha,Qh.BlendMode,Qh.Crop,Qh.Depth,Qh.Flip,Qh.GetBounds,Qh.Mask,Qh.Origin,Qh.Pipeline,Qh.PostPipeline,Qh.ScrollFactor,Qh.Tint,Qh.Transform,Qh.Visible,Uh,Vh,$h]);var ta={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ea{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ea.prototype,ta);var ia={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const sa=Phaser.Math.RotateAround;var ra;const na=Phaser.Geom.Rectangle;var ha,aa=function(t){void 0===ha&&(ha=new na);var e=t.drawTLX,i=t.drawTLY;return ha.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ha};const oa=Phaser.Math.RotateAround;var la,da=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===la&&(la={}),s=la),s.x=e,s.y=i,0!==t.rotation&&oa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ca=Phaser.GameObjects.Components.TransformMatrix;var ua,pa,va={},ga=function(t,e,i,s,r){var n=da(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=va);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ua&&(ua=new ca,pa=new ca),t.parentContainer?t.getWorldTransformMatrix(ua,pa):ua.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ua.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},fa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ga(t,e,n,h,r)},ma={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ra&&(ra={}),s=ra),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&sa(s,0,0,-i.rotation),s}(t,e,this,!0);return aa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return fa(this.parent,this,t,e,i)}};Object.assign(ma,ia);const ya=Phaser.Math.DegToRad,ba=Phaser.Math.RadToDeg,Ca=Phaser.Utils.Objects.GetValue;class xa extends ea{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ba(this._rotation)}set angle(t){this.rotation=ya(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ca(t,"width",void 0),i=Ca(t,"height",void 0),s=Ca(t,"scaleX",void 0),r=Ca(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(xa.prototype,ma);const wa=Phaser.Utils.String.Pad;var Sa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${wa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Pa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ta=Phaser.Utils.Objects.GetValue;class Oa{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ta(t,"x",0),i=Ta(t,"y",0));var s=this.cornerRadius;s.tl=_a(Ta(t,"tl",void 0),e,i),s.tr=_a(Ta(t,"tr",void 0),e,i),s.bl=_a(Ta(t,"bl",void 0),e,i),s.br=_a(Ta(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ka(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ka(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ka(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ka(this.cornerRadius.br,t)}}var _a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ea(t),t},ka=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ta(e,"x",0),t.y=Ta(e,"y",0)),Ea(t)},Ea=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ma=Phaser.Math.DegToRad;var Ra=function(t){return!t.hasOwnProperty("convex")||t.convex},Da=function(t){return t.x>0&&t.y>0},La=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,o,l,o,l,180,270,!1,h):La(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,s-o,l,o,l,270,360,!1,h):La(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,s-o,r-l,o,l,0,90,!1,h):La(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Da(a)?(o=a.x*g,l=a.y*f,Ra(a)?La(t,o,r-l,o,l,90,180,!1,h):La(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const za=Phaser.Utils.Objects.GetValue;class Xa extends xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2)),this.setCornerRadius(za(e,"cornerRadius",0),za(e,"cornerIteration",null))}set color(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Pa("color2",t,this),Pa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Pa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Pa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ya(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Aa=Phaser.Utils.Objects.GetValue;class Fa extends xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Aa(e,"color",null),Aa(e,"color2",null),Aa(e,"horizontalGradient",!0)),this.setStroke(Aa(e,"stroke",null),Aa(e,"strokeThickness",2))}set color(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Aa(t,"color2",null),Aa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Wa=Phaser.Utils.Objects.GetValue;class Ia{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Wa(t,"bold",!1)),this.setItalic(Wa(t,"italic",!1)),this.setFontSize(Wa(t,"fontSize","16px")),this.setFontFamily(Wa(t,"fontFamily","Courier")),this.setColor(Wa(t,"color","#fff")),this.setStrokeStyle(Wa(t,"stroke",null),Wa(t,"strokeThickness",0)),this.setShadow(Wa(t,"shadowColor",null),Wa(t,"shadowOffsetX",0),Wa(t,"shadowOffsetY",0),Wa(t,"shadowBlur",0)),this.setOffset(Wa(t,"offsetX",0),Wa(t,"offsetY",0)),this.setSpace(Wa(t,"leftSpace",0),Wa(t,"rightSpace",0)),this.setAlign(Wa(t,"align",void 0)),this.setBackgroundColor(Wa(t,"backgroundColor",null)),this.setBackgroundHeight(Wa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Wa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Pa("stroke",t,this),Pa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Pa("shadowOffsetX",t,this),Pa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Ia(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Sa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Sa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Sa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Sa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const ja=Phaser.Utils.Array.Remove,Ba=Phaser.Utils.Array.Remove,Ha="text",Na="image",Ua="drawer",Ga="space",Va="command";var $a=function(t){return t.type===Ha&&"\n"===t.text},Ja=function(t){return t.type===Ha&&"\f"===t.text},qa=function(t){return t.type===Ha};class Za extends xa{constructor(t,e,i){super(t,Ha),this.updateTextFlag=!1,this.style=new Ia(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ka=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Qa=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class to extends xa{constructor(t,e,i){super(t,Na),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Qa.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Qa.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class eo extends xa{constructor(t,e,i,s){super(t,Ua),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class io extends xa{constructor(t,e){super(t,Ga),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class so extends ea{constructor(t,e,i,s,r){super(t,Va),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function ro(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ro(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ro(t[i]));return e}var no=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const ho={none:0,word:1,char:2,character:2,mix:3};var ao=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=uo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=uo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=vo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=vo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=vo(t,"wrapMode");void 0===c&&(c=vo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=ho[c]);var u=vo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=vo(t,"letterSpacing",0),v=vo(t,"hAlign",0),g=vo(t,"vAlign",0),f=vo(t,"justifyPercentage",.25),m=no({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=k.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=D,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=mo(t,"maxLines",0);var a=0===i,o=mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=mo(t,"letterSpacing",0),p=mo(t,"rtl",!0),v=mo(t,"hAlign",p?2:0),g=mo(t,"vAlign",0),f=no({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=k.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Me(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ja(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ba(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ha);return null===i?i=new Za(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),fa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Bo=Phaser.Utils.Objects.GetFastValue;var Ho={};class No{constructor(t){this.pools=Bo(t,"pools",Ho)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new jo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Ko(t,r,e,i,n),a=0;a<=Jo&&0!==h;a++){if((r+=h)<0){r=0;break}h=Ko(t,r,e,i,n)}return a===Jo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Qo(t,e,i),t},Zo=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ko=function(t,e,i,s,r){var n,h=Zo(t,e,r),a=Zo(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Qo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const tl=Phaser.Utils.Objects.GetValue,el=Phaser.Utils.Objects.GetValue;return class extends _h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=el(e,"background",void 0),r=el(e,"icon",void 0),n=el(e,"iconMask",void 0),h=el(e,"text",void 0),a=el(e,"action",void 0),o=el(e,"actionMask",void 0),l=el(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:el(e,"space.icon",0),top:el(e,"space.iconTop",0),bottom:el(e,"space.iconBottom",0),left:el(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:el(e,"space.icon",0),left:el(e,"space.iconLeft",0),right:el(e,"space.iconRight",0),top:el(e,"space.iconTop",0)});var d=el(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var c=el(e,"iconSize",void 0);this.setIconSize(el(e,"iconWidth",c),el(e,"iconHeight",c))}}if(h){var u=el(e,"wrapText",!1),p=el(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Hh(h,u),e.expandTextWidth=!0,$o(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=tl(e,"minWidth",0),s=tl(e,"minHeight",0),r=tl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return qo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),qo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=el(e,"space.text",0),m=el(e,"expandTextWidth",!1),y=el(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:el(e,"space.actionTop",0),bottom:el(e,"space.actionBottom",0),right:el(e,"space.actionRight",0)}:{left:el(e,"space.actionLeft",0),right:el(e,"space.actionRight",0),bottom:el(e,"space.actionBottom",0)},d=el(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var b=el(e,"actionSize");this.setActionSize(el(e,"actionWidth",b),el(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexlabel=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},R={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var B={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const _e=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Xe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?fi:gi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=fi))}get t(){var t;switch(this.state){case vi:case gi:case mi:t=0;break;case fi:t=this.nowTime/this.duration;break;case yi:t=1}return ui(t,0,1)}set t(t){(t=ui(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===fi}get isRunning(){return this.state===gi||this.state===fi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,gi=1,fi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;class ki extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const _i={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Mi(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Xi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Xi),Yi.onInitScale=function(){Xi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Wi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,Ji=Phaser.Math.Linear;class qi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=$i(t,"x",void 0),i=$i(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=$i(i,"startX",void 0),this.startY=$i(i,"startY",void 0),this.endX=$i(i,"endX",void 0),this.endY=$i(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ji(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ji(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends hi{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,cs=Phaser.Math.Linear;class us extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=cs(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new us(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},fs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Xs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ys={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ds,Ls,Xs,Ys);const As=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ms(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var Ws=function(t){if(t.parentContainer)return Ws(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Ws(e):t};class Is extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ws(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class js extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends js{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var $s={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Js)),this.setCoverTransitOutCallback(Ks(i,"transitOut",qs)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=$s.popUp;break;case tr.fadeIn:t=$s.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=$s.scaleDown;break;case tr.fadeOut:t=$s.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return wr.length=0,!0;return wr.length=0,!1},wr=[];const Sr=Phaser.Utils.Objects.GetValue;class Pr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class Er extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Jr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const $r=0,Jr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=an,0===this.holdTime&&(this.state=on)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&t-this.pointer.downTime>=this.holdTime&&(this.state=on)}get isPressed(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case kn:this.tracerState=On,this.onDrag1End();break;case _n:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(Pn.prototype,Ve);var Tn={};const On=0,kn=1,_n=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Dn={};const Ln=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Bn}break;case Bn:t=Xn(zn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Bn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Wn="IDLE",In="BEGIN",Bn="RECOGNIZED",jn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},Yr.call(t,e),Fr.call(t,e),Br.call(t,e),Ur.call(t,e),Hn.call(t,e),Un.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",de),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ce(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;fe.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=oh[e];else if(nh(e)){var f;e=hh(f=e,"proportion",void 0),i=hh(f,"align",ah),s=hh(f,"padding",0),r=hh(f,"expand",!1),n=hh(f,"key",void 0),h=hh(f,"index",void 0),t.isRexSizer||(a=hh(f,"minWidth",void 0),o=hh(f,"minHeight",void 0)),l=hh(f,"fitRatio",0),d=hh(f,"offsetX",0),c=hh(f,"offsetY",0),u=hh(f,"offsetOriginX",0),p=hh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ve(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Et.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Xe.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(bh,dh,vh,gh,fh,mh,yh);var Ch=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=xh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ch.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,bh);var Th=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Oh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class kh extends Ph{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Th(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Th(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Th(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Th(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(kh.prototype,Oh);var _h=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Eh=Phaser.GameObjects.Graphics;class Rh extends Eh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Mh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,_h.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,_h.call(this,this.width,this.height,this.padding,t,e)),this}}const Mh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Rh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Lh=Phaser.GameObjects.Text;var Xh=function(t){return t instanceof Lh};const Yh=Phaser.GameObjects.BitmapText;var zh=function(t){return t instanceof Yh},Ah=/^[\x00-\x7F]+$/,Fh=function(t){return Ah.test(t)},Wh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Bh=2;const jh={none:0,word:1,char:Bh,character:Bh,mix:3};var Hh=function(t,e){var i=function(t){return zh(t)?2:Xh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=jh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Wh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=jh[e]||0),t.style.wrapMode=e}};const Nh=Phaser.Renderer.WebGL.Utils;var Uh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Nh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Gh=Phaser.Display.Color;var Vh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Gh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},$h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Jh=Phaser.Display.Canvas.CanvasPool,qh=Phaser.GameObjects.GameObject,Zh=Phaser.Utils.String.UUID;class Kh extends qh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Jh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Zh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Jh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Qh=Phaser.GameObjects.Components;Phaser.Class.mixin(Kh,[Qh.Alpha,Qh.BlendMode,Qh.Crop,Qh.Depth,Qh.Flip,Qh.GetBounds,Qh.Mask,Qh.Origin,Qh.Pipeline,Qh.PostPipeline,Qh.ScrollFactor,Qh.Tint,Qh.Transform,Qh.Visible,Uh,Vh,$h]);var ta={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ea{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ea.prototype,ta);var ia={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const sa=Phaser.Math.RotateAround;var ra;const na=Phaser.Geom.Rectangle;var ha,aa=function(t){void 0===ha&&(ha=new na);var e=t.drawTLX,i=t.drawTLY;return ha.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ha};const oa=Phaser.Math.RotateAround;var la,da=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===la&&(la={}),s=la),s.x=e,s.y=i,0!==t.rotation&&oa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ca=Phaser.GameObjects.Components.TransformMatrix;var ua,pa,va={},ga=function(t,e,i,s,r){var n=da(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=va);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ua&&(ua=new ca,pa=new ca),t.parentContainer?t.getWorldTransformMatrix(ua,pa):ua.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ua.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},fa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ga(t,e,n,h,r)},ma={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ra&&(ra={}),s=ra),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&sa(s,0,0,-i.rotation),s}(t,e,this,!0);return aa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return fa(this.parent,this,t,e,i)}};Object.assign(ma,ia);const ya=Phaser.Math.DegToRad,ba=Phaser.Math.RadToDeg,Ca=Phaser.Utils.Objects.GetValue;class xa extends ea{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ba(this._rotation)}set angle(t){this.rotation=ya(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ca(t,"width",void 0),i=Ca(t,"height",void 0),s=Ca(t,"scaleX",void 0),r=Ca(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(xa.prototype,ma);const wa=Phaser.Utils.String.Pad;var Sa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${wa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Pa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ta=Phaser.Utils.Objects.GetValue;class Oa{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ta(t,"x",0),i=Ta(t,"y",0));var s=this.cornerRadius;s.tl=ka(Ta(t,"tl",void 0),e,i),s.tr=ka(Ta(t,"tr",void 0),e,i),s.bl=ka(Ta(t,"bl",void 0),e,i),s.br=ka(Ta(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){_a(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){_a(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){_a(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){_a(this.cornerRadius.br,t)}}var ka=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ea(t),t},_a=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ta(e,"x",0),t.y=Ta(e,"y",0)),Ea(t)},Ea=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ra=Phaser.Math.DegToRad;var Ma=function(t){return!t.hasOwnProperty("convex")||t.convex},Da=function(t){return t.x>0&&t.y>0},La=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Da(a)?(o=a.x*g,l=a.y*f,Ma(a)?La(t,o,l,o,l,180,270,!1,h):La(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Da(a)?(o=a.x*g,l=a.y*f,Ma(a)?La(t,s-o,l,o,l,270,360,!1,h):La(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Da(a)?(o=a.x*g,l=a.y*f,Ma(a)?La(t,s-o,r-l,o,l,0,90,!1,h):La(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Da(a)?(o=a.x*g,l=a.y*f,Ma(a)?La(t,o,r-l,o,l,90,180,!1,h):La(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Ya=Phaser.Utils.Objects.GetValue;class za extends xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ya(e,"color",null),Ya(e,"color2",null),Ya(e,"horizontalGradient",!0)),this.setStroke(Ya(e,"stroke",null),Ya(e,"strokeThickness",2)),this.setCornerRadius(Ya(e,"cornerRadius",0),Ya(e,"cornerIteration",null))}set color(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Pa("color2",t,this),Pa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Pa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Pa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Xa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Aa=Phaser.Utils.Objects.GetValue;class Fa extends xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Aa(e,"color",null),Aa(e,"color2",null),Aa(e,"horizontalGradient",!0)),this.setStroke(Aa(e,"stroke",null),Aa(e,"strokeThickness",2))}set color(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Sa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Aa(t,"color2",null),Aa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Wa=Phaser.Utils.Objects.GetValue;class Ia{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Wa(t,"bold",!1)),this.setItalic(Wa(t,"italic",!1)),this.setFontSize(Wa(t,"fontSize","16px")),this.setFontFamily(Wa(t,"fontFamily","Courier")),this.setColor(Wa(t,"color","#fff")),this.setStrokeStyle(Wa(t,"stroke",null),Wa(t,"strokeThickness",0)),this.setShadow(Wa(t,"shadowColor",null),Wa(t,"shadowOffsetX",0),Wa(t,"shadowOffsetY",0),Wa(t,"shadowBlur",0)),this.setOffset(Wa(t,"offsetX",0),Wa(t,"offsetY",0)),this.setSpace(Wa(t,"leftSpace",0),Wa(t,"rightSpace",0)),this.setAlign(Wa(t,"align",void 0)),this.setBackgroundColor(Wa(t,"backgroundColor",null)),this.setBackgroundHeight(Wa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Wa(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Wa(t,"backgroundLeftX",0)),this.setBackgroundRightX(Wa(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Pa("stroke",t,this),Pa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Pa("shadowOffsetX",t,this),Pa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Ia(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Sa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Sa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Sa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Sa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ba=Phaser.Utils.Array.Remove,ja=Phaser.Utils.Array.Remove,Ha="text",Na="image",Ua="drawer",Ga="space",Va="command";var $a=function(t){return t.type===Ha&&"\n"===t.text},Ja=function(t){return t.type===Ha&&"\f"===t.text},qa=function(t){return t.type===Ha};class Za extends xa{constructor(t,e,i){super(t,Ha),this.updateTextFlag=!1,this.style=new Ia(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ka=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Qa=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class to extends xa{constructor(t,e,i){super(t,Na),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Qa.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Qa.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class eo extends xa{constructor(t,e,i,s){super(t,Ua),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class io extends xa{constructor(t,e){super(t,Ga),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class so extends ea{constructor(t,e,i,s,r){super(t,Va),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function ro(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ro(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ro(t[i]));return e}var no=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const ho={none:0,word:1,char:2,character:2,mix:3};var ao=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=uo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=uo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=vo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=vo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=vo(t,"wrapMode");void 0===c&&(c=vo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=ho[c]);var u=vo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=vo(t,"letterSpacing",0),v=vo(t,"hAlign",0),g=vo(t,"vAlign",0),f=vo(t,"justifyPercentage",.25),m=no({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:R,width:M}),D=Math.max(D,M)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=mo(t,"maxLines",0);var a=0===i,o=mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=mo(t,"letterSpacing",0),p=mo(t,"rtl",!0),v=mo(t,"hAlign",p?2:0),g=mo(t,"vAlign",0),f=no({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:R}),M=Math.max(M,R)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=M,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Me(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ba(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ja(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ha);return null===i?i=new Za(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),fa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const jo=Phaser.Utils.Objects.GetFastValue;var Ho={};class No{constructor(t){this.pools=jo(t,"pools",Ho)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Bo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Ko(t,r,e,i,n),a=0;a<=Jo&&0!==h;a++){if((r+=h)<0){r=0;break}h=Ko(t,r,e,i,n)}return a===Jo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Qo(t,e,i),t},Zo=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ko=function(t,e,i,s,r){var n,h=Zo(t,e,r),a=Zo(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Qo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const tl=Phaser.Utils.Objects.GetValue,el=Phaser.Utils.Objects.GetValue;return class extends kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=el(e,"background",void 0),r=el(e,"icon",void 0),n=el(e,"iconMask",void 0),h=el(e,"text",void 0),a=el(e,"action",void 0),o=el(e,"actionMask",void 0),l=el(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:el(e,"space.icon",0),top:el(e,"space.iconTop",0),bottom:el(e,"space.iconBottom",0),left:el(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:el(e,"space.icon",0),left:el(e,"space.iconLeft",0),right:el(e,"space.iconRight",0),top:el(e,"space.iconTop",0)});var d=el(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var c=el(e,"iconSize",void 0);this.setIconSize(el(e,"iconWidth",c),el(e,"iconHeight",c))}}if(h){var u=el(e,"wrapText",!1),p=el(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Hh(h,u),e.expandTextWidth=!0,$o(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=tl(e,"minWidth",0),s=tl(e,"minHeight",0),r=tl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return qo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),qo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=el(e,"space.text",0),m=el(e,"expandTextWidth",!1),y=el(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:el(e,"space.actionTop",0),bottom:el(e,"space.actionBottom",0),right:el(e,"space.actionRight",0)}:{left:el(e,"space.actionLeft",0),right:el(e,"space.actionRight",0),bottom:el(e,"space.actionBottom",0)},d=el(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var b=el(e,"actionSize");this.setActionSize(el(e,"actionWidth",b),el(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexlabel=e(); diff --git a/dist/rexmdscenario.js b/dist/rexmdscenario.js index cb0b82ef15..c4d44931b2 100644 --- a/dist/rexmdscenario.js +++ b/dist/rexmdscenario.js @@ -45777,6 +45777,8 @@ void main () { this.setBackgroundColor(GetValue$11(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$11(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$11(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$11(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$11(o, 'backgroundRightX', 0)); return this; } @@ -45847,6 +45849,12 @@ void main () { if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -46001,6 +46009,16 @@ void main () { return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -46428,20 +46446,24 @@ void main () { if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -65852,7 +65874,7 @@ void main () { var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -66213,6 +66235,33 @@ void main () { }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -66861,6 +66910,7 @@ void main () { var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -66888,19 +66938,41 @@ void main () { } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -67095,6 +67167,11 @@ void main () { return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rexmdscenario.min.js b/dist/rexmdscenario.min.js index 8c363c216a..0c6f0fc394 100644 --- a/dist/rexmdscenario.min.js +++ b/dist/rexmdscenario.min.js @@ -8,21 +8,21 @@ * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */class Y extends L{constructor({expression:t="true",conditionEvalBreak:e=!1,children:i=[],services:s,title:r,name:n="IfSelector"}={},a){super({children:i,services:s,title:r,name:n,properties:{expression:t,conditionEvalBreak:e}},a),this.expression=this.addBooleanExpression(t),this.conditionEvalBreak=e,this.forceSelectChildIndex=void 0}open(t){this.getNodeMemory(t).$runningChild=-1}setSelectChildIndex(t){return this.forceSelectChildIndex=t,this}evalCondition(t){return void 0!==this.forceSelectChildIndex?this.forceSelectChildIndex:t.evalExpression(this.expression)?0:1}tick(t){if(0===this.children.length)return 9;var e=this.getNodeMemory(t),i=e.$runningChild;if(i<0&&(i=this.evalCondition(t),this.conditionEvalBreak))return e.$runningChild=i,3;var s=this.children[i]._execute(t);return e.$runningChild=3===s?i:-1,s}abortChildren(t){var e=this.getNodeMemory(t),i=this.children[e.$runningChild];i&&(i._abort(t),e.$runningChild=-1)}}class X extends R{constructor({child:t=null,title:e,name:i="ForceFailure"}={},s){super({child:t,title:e,name:i,properties:{}},s)}tick(t){if(!this.child)return 9;var e=this.child._execute(t);return 1===e?2:e}}class W extends R{constructor({maxLoop:t=-1,child:e=null,title:i,name:s="Repeat"}={},r){super({child:e,title:i,name:s,properties:{maxLoop:t}},r),this.maxLoopExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;for(var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i,r=1;(i<0||s=i)return 2;var r=this.child._execute(t);return 1!==r&&2!==r||(e.$i=s+1),r}},Parallel:class extends L{constructor({finishMode:t=0,returnSuccess:e=!0,children:i=[],services:s,title:r,name:n="Parallel"}={},a){super({children:i,services:s,title:r,name:n,properties:{finishMode:t,returnSuccess:e}},a),this.finishMode=t,this.returnSuccess=e}open(t){this.getNodeMemory(t).$runningChildren=this.children.map(((t,e)=>e))}tick(t){if(0===this.children.length)return 9;for(var e=this.getNodeMemory(t),i=e.$runningChildren,s={},r=!1,n=!1,a=!1,o=!1,h=0,l=i.length;h=i)return 2;var r=this.child._execute(t);return 1!==r&&2!==r||(e.$i=s+1),r}},Parallel:class extends L{constructor({finishMode:t=0,returnSuccess:e=!0,children:i=[],services:s,title:r,name:n="Parallel"}={},a){super({children:i,services:s,title:r,name:n,properties:{finishMode:t,returnSuccess:e}},a),this.finishMode=t,this.returnSuccess=e}open(t){this.getNodeMemory(t).$runningChildren=this.children.map(((t,e)=>e))}tick(t){if(0===this.children.length)return 9;for(var e=this.getNodeMemory(t),i=e.$runningChildren,s={},r=!1,n=!1,a=!1,o=!1,h=0,l=i.length;h * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */,Repeat:W,RepeatUntilFailure:$,RepeatUntilSuccess:class extends R{constructor({maxLoop:t=-1,child:e=null,title:i,name:s="RepeatUntilSuccess"}={},r){super({child:e,title:i,name:s,properties:{maxLoop:t}},r),this.maxLoopExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;for(var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i,r=9;(i<0||s=r;if(n){e.$lastEndTime=i;r=t.evalExpression(this.intervalExpression);var a=t.evalExpression(this.randomDeviationExpression);a>0&&(r+=(.5-Math.random())*a),e.$interval=r}return n}},ShuffleSelector:class extends L{constructor({children:t=[],services:e,title:i,name:s="ShuffleSelector"}={},r){super({children:t,services:e,title:i,name:s},r)}open(t){var e=this.getNodeMemory(t);e.$runningChild=0,e.$children||(e.$children=this.children.map(((t,e)=>e))),function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[i],t[i]=s}}(e.$children)}tick(t){if(0===this.children.length)return 9;for(var e,i=this.getNodeMemory(t),s=i.$runningChild,r=i.$children,n=s,a=r.length;n=e.$duration?this.returnSuccess?SUCCESS:2:this.child._execute(t)}},Wait:class extends A{constructor({duration:t=0,services:e,title:i,name:s="Wait"}={}){super({title:i,name:s,properties:{duration:t},services:e}),this.durationExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$startTime=t.currentTime,e.$duration=t.evalExpression(this.durationExpression)}tick(t){var e=this.getNodeMemory(t),i=t.currentTime,s=e.$startTime,r=e.$duration;if(r>0){if(i-st.id)),r.services&&(n.services=r.services.map((t=>t.id)));break;case o:r.child&&(n.child=r.child.id);break;case h:r.services&&(n.services=r.services.map((t=>t.id)))}t.nodes.push(n)}return t},load:function(t,e){var i=t.sn;null!=i&&p(Math.max(g(),i)),e=e||{},this.title=t.title||this.title,this.description=t.description||this.description,this.properties=t.properties||this.properties;for(var s=t.nodes,r={},n=s.length-1;n>=0;n--){var a,o=s[n],h=o.name;if(h in e)a=e[h];else{if(!(h in H))throw new EvalError(`BehaviorTree.load: Invalid node name "${h}".`);a=H[h]}var l={};o.hasOwnProperty("children")&&(l.children=o.children),o.hasOwnProperty("child")&&(l.child=o.child),o.hasOwnProperty("services")&&(l.services=o.services);var u=new a(l=Object.assign(l,o.properties),r);u.id=o.id||u.id,u.title=o.title||u.title,u.description=o.description||u.description,u.properties=o.properties||u.properties,r[u.id]=u}return this.root=r[t.root],this}};Object.assign(q.prototype,K,v);var J=function(t){return null==t||""===t||0===t.length},Z=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(J(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(J(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n0&&(G(this.trees,e),G(this.pendingTrees,e)),this}},lt={getTreeActiveState(t){var e=this.getTree(t);return e?e.active:null},setTreeActiveState(t,e){var i=this.getTree(t);return i&&i.setActive(e),this}};class ut extends z{open(t){super.open(t);var e=t.blackboard.eventSheetManager,i=t.tree,s=i.eventSheetGroup;e.emit("label.enter",this.title,i.title,s.name,e)}tick(t){var e=super.tick(t);return 2===e&&(e=1),e}close(t){super.close(t);var e=t.blackboard.eventSheetManager,i=t.tree,s=i.eventSheetGroup;e.emit("label.exit",this.title,i.title,s.name,e)}}var ct={pauseEventSheet(t){var e=t.tree.eventSheetGroup;this.isRunning=!0;var i=this,s=this.waitId;return function(){s":">",'"':""","'":"'","/":"/","`":"`","=":"="};var Ct=/\s*/,kt=/\s+/,St=/\s*=/,wt=/\s*\}/,_t=/#|\^|\/|>|\{|&|=|!/;function Et(t){this.string=t,this.tail=t,this.pos=0}function Tt(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Ot(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Et.prototype.eos=function(){return""===this.tail},Et.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},Et.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},Tt.prototype.push=function(t){return new Tt(t,this)},Tt.prototype.lookup=function(t){var e,i,s,r=this.cache;if(r.hasOwnProperty(t))e=r[t];else{for(var n,a,o,h=this,l=!1;h;){if(t.indexOf(".")>0)for(n=h.view,a=t.split("."),o=0;null!=n&&o0?r[r.length-1][4]:i;break;default:s.push(e)}return i}(function(t){for(var e,i,s=[],r=0,n=t.length;r"===a?o=this.renderPartial(n,e,i,r):"&"===a?o=this.unescapedValue(n,e):"name"===a?o=this.escapedValue(n,e,r):"text"===a&&(o=this.rawValue(n)),void 0!==o&&(h+=o);return h},Ot.prototype.renderSection=function(t,e,i,s,r){var n=this,a="",o=e.lookup(t[1]);if(o){if(pt(o))for(var h=0,l=o.length;h0||!i)&&(r[n]=s+r[n]);return r.join("\n")},Ot.prototype.renderPartial=function(t,e,i,s){if(i){var r=this.getConfigTags(s),n=gt(i)?i(t[1]):i[t[1]];if(null!=n){var a=t[6],o=t[5],h=t[4],l=n;0==o&&h&&(l=this.indentPartial(n,h,a));var u=this.parse(l,r);return this.renderTokens(u,e,i,l,s)}}},Ot.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);if(null!=i)return i},Ot.prototype.escapedValue=function(t,e,i){var s=this.getConfigEscape(i)||Pt.escape,r=e.lookup(t[1]);if(null!=r)return"number"==typeof r&&s===Pt.escape?String(r):s(r)},Ot.prototype.rawValue=function(t){return t[1]},Ot.prototype.getConfigTags=function(t){return pt(t)?t:t&&"object"==typeof t?t.tags:void 0},Ot.prototype.getConfigEscape=function(t){return t&&"object"==typeof t&&!pt(t)?t.escape:void 0};var Pt={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Mt.templateCache=t},get templateCache(){return Mt.templateCache}},Mt=new Ot;Pt.clearCache=function(){return Mt.clearCache()},Pt.parse=function(t,e){return Mt.parse(t,e)},Pt.render=function(t,e,i,s){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+((pt(r=t)?"array":typeof r)+'" was given as the first argument for mustache#render(template, view, partials)'));var r;return Mt.render(t,e,i,s)},Pt.escape=function(t){return String(t).replace(/[&<>"'`=\/]/g,(function(t){return xt[t]}))},Pt.Scanner=Et,Pt.Context=Tt,Pt.Writer=Ot;class Dt extends A{constructor(t){super({name:"TaskAction",title:t.name,properties:t});var e=t.parameters,i={};for(var s in e)i[s]=At(e[s]);this.taskParameters=i,this.isRunning=!1,this.waitId=0}open(t){this.isRunning=!1;var e=this.properties.name;if(e){var i=t.blackboard.eventSheetManager,s=t.tree,r=i.memory,n=this.taskParameters,a={};for(var o in n){var h=n[o];"function"==typeof h&&(h=h(r)),a[o]=h}i.bindTaskActionNode(t,this);var l,u,c=t.target,d=c[e];d?l=d.call(c,a,i,s):(d=c.defaultHandler)&&(l=d.call(c,e,a,i,s)),i.unBindTaskAction(t,this),!this.isRunning&&((u=l)&&"object"==typeof u&&u.on)&&this.pauseEventSheetUnitlEvent(t,l)}}tick(t){return this.isRunning?this.RUNNING:this.SUCCESS}close(t){}abort(t){this.removeTaskCompleteCallback&&this.removeTaskCompleteCallback()}}var At=function(t){if("string"==typeof t)if(t.startsWith("#(")&&t.endsWith(")"))t=E(t.substring(2,t.length-1));else if(t.indexOf("{{")>-1&&t.indexOf("}}")>-1){var e=t;t=function(t){return Pt.render(e,t)}}return t};Object.assign(Dt.prototype,ct);class Lt extends A{constructor({activateTreeTitle:t,services:e,title:i,name:s="ActivateTree"}={}){super({name:s,title:i,properties:{activateTreeTitle:t},services:e}),this.activateTreeTitle=t}tick(t){var e=this.getTree(t);return this.activateTreeTitle&&""!==this.activateTreeTitle?e.eventSheetManager.setEventSheetActiveState(this.activateTreeTitle,e.groupName,!0):e.setActive(!0),this.SUCCESS}}class Rt extends A{constructor({deactivateTreeTitle:t,services:e,title:i,name:s="DeactivateTree"}={}){super({name:s,title:i,properties:{deactivateTreeTitle:t},services:e}),this.deactivateTreeTitle=t}tick(t){var e=this.getTree(t);return this.deactivateTreeTitle&&""!==this.deactivateTreeTitle?e.eventSheetManager.setEventSheetActiveState(this.deactivateTreeTitle,e.groupName,!1):e.setActive(!1),this.SUCCESS}}var Ft={TaskSequence:ut,TaskAction:Dt,ActivateAction:Lt,DeactivateAction:Rt},Bt={dumpEventSheetGroup(){return this.trees.map((function(t){return t.dump()}))},loadEventSheetGroup(t){return t.forEach((function(t){var e=new q({id:t.id,title:t.title,properties:y(t.properties)});e.load(t,Ft),this.trees.push(e)}),this),this}},It={dumpState(t=!1){var e={isRunning:this.isRunning,pendingTrees:this.pendingTrees.filter((function(t){return!t.roundComplete})).map((function(t){return t.id}))};return t&&(e.trees=this.dumpEventSheetGroup()),e},loadState(t){this.stop(),t.trees&&(this.trees.length=0,this.loadEventSheetGroup(t.trees)),this.isRunning=t.isRunning;var e=this.pendingTrees;return e.length=0,this.trees.forEach((function(i){t.pendingTrees.indexOf(i.id)>-1&&e.push(i)})),this}},jt=function(t,e){var i=t.blackboard,s=t.commandExecutor;e.start(i,s)&&(e.conditionPassed?t.emit("eventsheet.enter",e.title,this.name,t):t.emit("eventsheet.catch",e.title,this.name,t))},zt=function(t,e){var i=t.blackboard,s=t.commandExecutor;return e.tick(i,s)},Nt=function(t,e){e.conditionPassed&&t.emit("eventsheet.exit",e.title,this.name,t)},Gt={start(){if(this.isRunning)return this;this.isRunning=!0;var t=this.parent,e=this.trees,i=this.pendingTrees,s=t.blackboard;t.emit("start",this.name,t);for(var r=0,n=e.length;r0&&G(e,i),0===e.length&&(this.isRunning=!1,t.emit("complete",this.name,t)),this},startTree(t,e=!0){if(this.isRunning)return this;var i=this.getTree(t);if(!i)return this;this.isRunning=!0;var s=this.parent,r=this.pendingTrees,n=s.blackboard;return r.length=0,i.resetState(n),i.setConditionEnable(!e),jt.call(this,s,i),i.setConditionEnable(!0),r.push(i),this.continue(),this}},Yt={stop(){for(var t=this.parent,e=t.blackboard,i=t.commandExecutor,s=this.pendingTrees,r=0,n=s.length;r":">",'"':""","'":"'","`":"`","=":"="},se=/[&<>"'`=]/g,re=/[&<>"'`=]/;function ne(t){return ie[t]}function ae(t){for(var e=1;e0?(s.ids&&(s.ids=[s.name]),t.helpers.each(e,s)):r(this);if(s.data&&s.ids){var a=i.createFrame(s.data);a.contextPath=i.appendContextPath(s.data.contextPath,s.name),s={data:a}}return n(e,s)}))},t.exports=e.default}(pe,pe.exports);var ge=pe.exports,fe={exports:{}};!function(t,e){e.__esModule=!0;var i,s=ee,r=(i=ce)&&i.__esModule?i:{default:i};e.default=function(t){t.registerHelper("each",(function(t,e){if(!e)throw new r.default("Must pass iterator to #each");var i,n=e.fn,a=e.inverse,o=0,h="",l=void 0,u=void 0;function c(e,i,r){l&&(l.key=e,l.index=i,l.first=0===i,l.last=!!r,u&&(l.contextPath=u+e)),h+=n(t[e],{data:l,blockParams:s.blockParams([t[e],e],[u+e,null])})}if(e.data&&e.ids&&(u=s.appendContextPath(e.data.contextPath,e.ids[0])+"."),s.isFunction(t)&&(t=t.call(this)),e.data&&(l=s.createFrame(e.data)),t&&"object"==typeof t)if(s.isArray(t))for(var d=t.length;o=0?e:parseInt(t,10)}return t},log:function(t){if(t=s.lookupLevel(t),"undefined"!=typeof console&&s.lookupLevel(s.level)<=t){var e=s.methodMap[t];console[e]||(e="log");for(var i=arguments.length,r=Array(i>1?i-1:0),n=1;n= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var ii="[object Object]";function si(t,e,i){this.helpers=t||{},this.partials=e||{},this.decorators=i||{},Ze.registerDefaultHelpers(this),Qe.registerDefaultDecorators(this)}si.prototype={constructor:si,logger:ti.default,log:ti.default.log,registerHelper:function(t,e){if(Ke.toString.call(t)===ii){if(e)throw new Je.default("Arg not supported with multiple helpers");Ke.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(Ke.toString.call(t)===ii)Ke.extend(this.partials,t);else{if(void 0===e)throw new Je.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(Ke.toString.call(t)===ii){if(e)throw new Je.default("Arg not supported with multiple decorators");Ke.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){ei.resetLoggedProperties()}};var ri=ti.default.log;te.log=ri,te.createFrame=Ke.createFrame,te.logger=ti.default;var ni={exports:{}};!function(t,e){function i(t){this.string=t}e.__esModule=!0,i.prototype.toString=i.prototype.toHTML=function(){return""+this.string},e.default=i,t.exports=e.default}(ni,ni.exports);var ai=ni.exports,oi={},hi={};hi.__esModule=!0,hi.wrapHelper=function(t,e){if("function"!=typeof t)return t;return function(){return arguments[arguments.length-1]=e(arguments[arguments.length-1]),t.apply(this,arguments)}},oi.__esModule=!0,oi.checkRevision=function(t){var e=t&&t[0]||1,i=ci.COMPILER_REVISION;if(e>=ci.LAST_COMPATIBLE_COMPILER_REVISION&&e<=ci.COMPILER_REVISION)return;if(e2&&y.push("'"+this.terminals_[f]+"'");C=this.lexer.showPosition?"Parse error on line "+(o+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+(this.terminals_[c]||c)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==c?"end of input":"'"+(this.terminals_[c]||c)+"'"),this.parseError(C,{text:this.lexer.match,token:this.terminals_[c]||c,line:this.lexer.yylineno,loc:l,expected:y})}if(p[0]instanceof Array&&p.length>1)throw new Error("Parse Error: multiple actions possible at state: "+d+", token: "+c);switch(p[0]){case 1:i.push(c),s.push(this.lexer.yytext),r.push(this.lexer.yylloc),i.push(p[1]),c=null,h=this.lexer.yyleng,a=this.lexer.yytext,o=this.lexer.yylineno,l=this.lexer.yylloc;break;case 2:if(v=this.productions_[p[1]][1],x.$=s[s.length-v],x._$={first_line:r[r.length-(v||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(v||1)].first_column,last_column:r[r.length-1].last_column},u&&(x._$.range=[r[r.length-(v||1)].range[0],r[r.length-1].range[1]]),void 0!==(g=this.performAction.call(x,a,h,o,this.yy,p[1],s,r)))return g;v&&(i=i.slice(0,-1*v*2),s=s.slice(0,-1*v),r=r.slice(0,-1*v)),i.push(this.productions_[p[1]][0]),s.push(x.$),r.push(x._$),m=n[i[i.length-2]][i[i.length-1]],i.push(m);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,i,s,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),a=0;ae[0].length)||(e=i,s=a,this.options.flex));a++);return e?((r=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,n[s],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,i,s){function r(t,i){return e.yytext=e.yytext.substring(t,e.yyleng-i+t)}switch(i){case 0:if("\\\\"===e.yytext.slice(-2)?(r(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(r(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(r(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(e.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return e.yytext=r(1,2).replace(/\\"/g,'"'),80;case 32:return e.yytext=r(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return e.yytext=e.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return t}();function i(){this.yy={}}return t.lexer=e,i.prototype=t,t.Parser=i,new i}();e.default=i,t.exports=e.default}(wi,wi.exports);var _i=wi.exports,Ei={exports:{}},Ti={exports:{}};!function(t,e){e.__esModule=!0;var i=function(t){return t&&t.__esModule?t:{default:t}}(ce);function s(){this.parents=[]}function r(t){this.acceptRequired(t,"path"),this.acceptArray(t.params),this.acceptKey(t,"hash")}function n(t){r.call(this,t),this.acceptKey(t,"program"),this.acceptKey(t,"inverse")}function a(t){this.acceptRequired(t,"name"),this.acceptArray(t.params),this.acceptKey(t,"hash")}s.prototype={constructor:s,mutating:!1,acceptKey:function(t,e){var r=this.accept(t[e]);if(this.mutating){if(r&&!s.prototype[r.type])throw new i.default('Unexpected node type "'+r.type+'" found when accepting '+e+" on "+t.type);t[e]=r}},acceptRequired:function(t,e){if(this.acceptKey(t,e),!t[e])throw new i.default(t.type+" requires "+e)},acceptArray:function(t){for(var e=0,i=t.length;e0)throw new Di.default("Invalid path: "+s,{loc:i});".."===h&&n++}}return{type:"PathExpression",data:t,depth:n,parts:r,original:s,loc:i}},Mi.prepareMustache=function(t,e,i,s,r,n){var a=s.charAt(3)||s.charAt(2),o="{"!==a&&"&"!==a;return{type:/\*/.test(s)?"Decorator":"MustacheStatement",path:t,params:e,hash:i,escaped:o,strip:r,loc:this.locInfo(n)}},Mi.prepareRawBlock=function(t,e,i,s){Ai(t,i),s=this.locInfo(s);var r={type:"Program",body:e,strip:{},loc:s};return{type:"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:r,openStrip:{},inverseStrip:{},closeStrip:{},loc:s}},Mi.prepareBlock=function(t,e,i,s,r,n){s&&s.path&&Ai(t,s);var a=/\*/.test(t.open);e.blockParams=t.blockParams;var o=void 0,h=void 0;if(i){if(a)throw new Di.default("Unexpected inverse block on decorator",i);i.chain&&(i.program.body[0].closeStrip=s.strip),h=i.strip,o=i.program}r&&(r=o,o=e,e=r);return{type:a?"DecoratorBlock":"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:e,inverse:o,openStrip:t.strip,inverseStrip:h,closeStrip:s&&s.strip,loc:this.locInfo(n)}},Mi.prepareProgram=function(t,e){if(!e&&t.length){var i=t[0].loc,s=t[t.length-1].loc;i&&s&&(e={source:i.source,start:{line:i.start.line,column:i.start.column},end:{line:s.end.line,column:s.end.column}})}return{type:"Program",body:t,strip:{},loc:e}},Mi.preparePartialBlock=function(t,e,i,s){return Ai(t,i),{type:"PartialBlockStatement",name:t.path,params:t.params,hash:t.hash,program:e,openStrip:t.strip,closeStrip:i&&i.strip,loc:this.locInfo(s)}};var Di=function(t){return t&&t.__esModule?t:{default:t}}(ce);function Ai(t,e){if(e=e.path?e.path.original:e,t.path.original!==e){var i={loc:t.path.loc};throw new Di.default(t.path.original+" doesn't match "+e,i)}}function Li(t){return t&&t.__esModule?t:{default:t}}Si.__esModule=!0,Si.parseWithoutProcessing=zi,Si.parse=function(t,e){var i=zi(t,e);return new Fi.default(e).accept(i)};var Ri=Li(_i),Fi=Li(Pi),Bi=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}(Mi),Ii=ee;Si.parser=Ri.default;var ji={};function zi(t,e){return"Program"===t.type?t:(Ri.default.yy=ji,ji.locInfo=function(t){return new ji.SourceLocation(e&&e.srcName,t)},Ri.default.parse(t))}Ii.extend(ji,Bi);var Ni={};function Gi(t){return t&&t.__esModule?t:{default:t}}Ni.__esModule=!0,Ni.Compiler=Vi,Ni.precompile=function(t,e,i){if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new Yi.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);"data"in(e=e||{})||(e.data=!0);e.compat&&(e.useDepths=!0);var s=i.parse(t,e),r=(new i.Compiler).compile(s,e);return(new i.JavaScriptCompiler).compile(r,e)},Ni.compile=function(t,e,i){void 0===e&&(e={});if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new Yi.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);"data"in(e=Xi.extend({},e))||(e.data=!0);e.compat&&(e.useDepths=!0);var s=void 0;function r(){var s=i.parse(t,e),r=(new i.Compiler).compile(s,e),n=(new i.JavaScriptCompiler).compile(r,e,void 0,!0);return i.template(n)}function n(t,e){return s||(s=r()),s.call(this,t,e)}return n._setup=function(t){return s||(s=r()),s._setup(t)},n._child=function(t,e,i,n){return s||(s=r()),s._child(t,e,i,n)},n};var Yi=Gi(ce),Xi=ee,Wi=Gi(ki),$i=[].slice;function Vi(){}function Hi(t,e){if(t===e)return!0;if(Xi.isArray(t)&&Xi.isArray(e)&&t.length===e.length){for(var i=0;i1)throw new Yi.default("Unsupported number of partial arguments: "+i.length,t);i.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):i.push({type:"PathExpression",parts:[],depth:0}));var s=t.name.original,r="SubExpression"===t.name.type;r&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var n=t.indent||"";this.options.preventIndent&&n&&(this.opcode("appendContent",n),n=""),this.opcode("invokePartial",r,s,n),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){Ui(t);var e=this.classifySexpr(t);"simple"===e?this.simpleSexpr(t):"helper"===e?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,i){var s=t.path,r=s.parts[0],n=null!=e||null!=i;this.opcode("getContext",s.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",i),s.strict=!0,this.accept(s),this.opcode("invokeAmbiguous",r,n)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,i){var s=this.setupFullMustacheParams(t,e,i),r=t.path,n=r.parts[0];if(this.options.knownHelpers[n])this.opcode("invokeKnownHelper",s.length,n);else{if(this.options.knownHelpersOnly)throw new Yi.default("You specified knownHelpersOnly, but used the unknown helper "+n,t);r.strict=!0,r.falsy=!0,this.accept(r),this.opcode("invokeHelper",s.length,r.original,Wi.default.helpers.simpleId(r))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],i=Wi.default.helpers.scopedId(t),s=!t.depth&&!i&&this.blockParamIndex(e);s?this.opcode("lookupBlockParam",s,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,i):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,i=0,s=e.length;for(this.opcode("pushHash");i=0)return[e,r]}}};var qi,Ki,Ji={exports:{}},Zi={exports:{}},Qi={},ts={},es={},is={};function ss(){if(qi)return is;qi=1;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return is.encode=function(e){if(0<=e&&e>>=5)>0&&(i|=32),s+=t.encode(i)}while(r>0);return s},es.decode=function(e,i,s){var r,n,a,o,h=e.length,l=0,u=0;do{if(i>=h)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(n=t.decode(e.charCodeAt(i++))))throw new Error("Invalid base64 digit: "+e.charAt(i-1));r=!!(32&n),l+=(n&=31)<>1,1&~a?o:-o),s.rest=i},es}var ns,as={};function os(){return ns||(ns=1,function(t){t.getArg=function(t,e,i){if(e in t)return t[e];if(3===arguments.length)return i;throw new Error('"'+e+'" is a required argument.')};var e=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,i=/^data:.+\,.+$/;function s(t){var i=t.match(e);return i?{scheme:i[1],auth:i[2],host:i[3],port:i[4],path:i[5]}:null}function r(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}function n(e){var i=e,n=s(e);if(n){if(!n.path)return e;i=n.path}for(var a,o=t.isAbsolute(i),h=i.split(/\/+/),l=0,u=h.length-1;u>=0;u--)"."===(a=h[u])?h.splice(u,1):".."===a?l++:l>0&&(""===a?(h.splice(u+1,l),l=0):(h.splice(u,2),l--));return""===(i=h.join("/"))&&(i=o?"/":"."),n?(n.path=i,r(n)):i}function a(t,e){""===t&&(t="."),""===e&&(e=".");var a=s(e),o=s(t);if(o&&(t=o.path||"/"),a&&!a.scheme)return o&&(a.scheme=o.scheme),r(a);if(a||e.match(i))return e;if(o&&!o.host&&!o.path)return o.host=e,r(o);var h="/"===e.charAt(0)?e:n(t.replace(/\/+$/,"")+"/"+e);return o?(o.path=h,r(o)):h}t.urlParse=s,t.urlGenerate=r,t.normalize=n,t.join=a,t.isAbsolute=function(t){return"/"===t.charAt(0)||e.test(t)},t.relative=function(t,e){""===t&&(t="."),t=t.replace(/\/$/,"");for(var i=0;0!==e.indexOf(t+"/");){var s=t.lastIndexOf("/");if(s<0)return e;if((t=t.slice(0,s)).match(/^([^\/]+:\/)?\/*$/))return e;++i}return Array(i+1).join("../")+e.substr(t.length+1)};var o=!("__proto__"in Object.create(null));function h(t){return t}function l(t){if(!t)return!1;var e=t.length;if(e<9)return!1;if(95!==t.charCodeAt(e-1)||95!==t.charCodeAt(e-2)||111!==t.charCodeAt(e-3)||116!==t.charCodeAt(e-4)||111!==t.charCodeAt(e-5)||114!==t.charCodeAt(e-6)||112!==t.charCodeAt(e-7)||95!==t.charCodeAt(e-8)||95!==t.charCodeAt(e-9))return!1;for(var i=e-10;i>=0;i--)if(36!==t.charCodeAt(i))return!1;return!0}function u(t,e){return t===e?0:null===t?1:null===e?-1:t>e?1:-1}t.toSetString=o?h:function(t){return l(t)?"$"+t:t},t.fromSetString=o?h:function(t){return l(t)?t.slice(1):t},t.compareByOriginalPositions=function(t,e,i){var s=u(t.source,e.source);return 0!==s||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)||i||0!==(s=t.generatedColumn-e.generatedColumn)||0!==(s=t.generatedLine-e.generatedLine)?s:u(t.name,e.name)},t.compareByGeneratedPositionsDeflated=function(t,e,i){var s=t.generatedLine-e.generatedLine;return 0!==s||0!==(s=t.generatedColumn-e.generatedColumn)||i||0!==(s=u(t.source,e.source))||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)?s:u(t.name,e.name)},t.compareByGeneratedPositionsInflated=function(t,e){var i=t.generatedLine-e.generatedLine;return 0!==i||0!==(i=t.generatedColumn-e.generatedColumn)||0!==(i=u(t.source,e.source))||0!==(i=t.originalLine-e.originalLine)||0!==(i=t.originalColumn-e.originalColumn)?i:u(t.name,e.name)},t.parseSourceMapInput=function(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))},t.computeSourceURL=function(t,e,i){if(e=e||"",t&&("/"!==t[t.length-1]&&"/"!==e[0]&&(t+="/"),e=t+e),i){var o=s(i);if(!o)throw new Error("sourceMapURL could not be parsed");if(o.path){var h=o.path.lastIndexOf("/");h>=0&&(o.path=o.path.substring(0,h+1))}e=a(r(o),e)}return n(e)}}(as)),as}var hs,ls={};function us(){if(hs)return ls;hs=1;var t=os(),e=Object.prototype.hasOwnProperty,i="undefined"!=typeof Map;function s(){this._array=[],this._set=i?new Map:Object.create(null)}return s.fromArray=function(t,e){for(var i=new s,r=0,n=t.length;r=0)return r}else{var n=t.toSetString(s);if(e.call(this._set,n))return this._set[n]}throw new Error('"'+s+'" is not in the set.')},s.prototype.at=function(t){if(t>=0&&tr||n==r&&o>=a||t.compareByGeneratedPositionsInflated(i,s)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},e.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},ps.MappingList=e,ps}function fs(){if(ds)return ts;ds=1;var t=rs(),e=os(),i=us().ArraySet,s=gs().MappingList;function r(t){t||(t={}),this._file=e.getArg(t,"file",null),this._sourceRoot=e.getArg(t,"sourceRoot",null),this._skipValidation=e.getArg(t,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new s,this._sourcesContents=null}return r.prototype._version=3,r.fromSourceMap=function(t){var i=t.sourceRoot,s=new r({file:t.file,sourceRoot:i});return t.eachMapping((function(t){var r={generated:{line:t.generatedLine,column:t.generatedColumn}};null!=t.source&&(r.source=t.source,null!=i&&(r.source=e.relative(i,r.source)),r.original={line:t.originalLine,column:t.originalColumn},null!=t.name&&(r.name=t.name)),s.addMapping(r)})),t.sources.forEach((function(r){var n=r;null!==i&&(n=e.relative(i,r)),s._sources.has(n)||s._sources.add(n);var a=t.sourceContentFor(r);null!=a&&s.setSourceContent(r,a)})),s},r.prototype.addMapping=function(t){var i=e.getArg(t,"generated"),s=e.getArg(t,"original",null),r=e.getArg(t,"source",null),n=e.getArg(t,"name",null);this._skipValidation||this._validateMapping(i,s,r,n),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:i.line,generatedColumn:i.column,originalLine:null!=s&&s.line,originalColumn:null!=s&&s.column,source:r,name:n})},r.prototype.setSourceContent=function(t,i){var s=t;null!=this._sourceRoot&&(s=e.relative(this._sourceRoot,s)),null!=i?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[e.toSetString(s)]=i):this._sourcesContents&&(delete this._sourcesContents[e.toSetString(s)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},r.prototype.applySourceMap=function(t,s,r){var n=s;if(null==s){if(null==t.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=t.file}var a=this._sourceRoot;null!=a&&(n=e.relative(a,n));var o=new i,h=new i;this._mappings.unsortedForEach((function(i){if(i.source===n&&null!=i.originalLine){var s=t.originalPositionFor({line:i.originalLine,column:i.originalColumn});null!=s.source&&(i.source=s.source,null!=r&&(i.source=e.join(r,i.source)),null!=a&&(i.source=e.relative(a,i.source)),i.originalLine=s.line,i.originalColumn=s.column,null!=s.name&&(i.name=s.name))}var l=i.source;null==l||o.has(l)||o.add(l);var u=i.name;null==u||h.has(u)||h.add(u)}),this),this._sources=o,this._names=h,t.sources.forEach((function(i){var s=t.sourceContentFor(i);null!=s&&(null!=r&&(i=e.join(r,i)),null!=a&&(i=e.relative(a,i)),this.setSourceContent(i,s))}),this)},r.prototype._validateMapping=function(t,e,i,s){if(e&&"number"!=typeof e.line&&"number"!=typeof e.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0)||e||i||s)&&!(t&&"line"in t&&"column"in t&&e&&"line"in e&&"column"in e&&t.line>0&&t.column>=0&&e.line>0&&e.column>=0&&i))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:i,original:e,name:s}))},r.prototype._serializeMappings=function(){for(var i,s,r,n,a=0,o=1,h=0,l=0,u=0,c=0,d="",p=this._mappings.toArray(),g=0,f=p.length;g0){if(!e.compareByGeneratedPositionsInflated(s,p[g-1]))continue;i+=","}i+=t.encode(s.generatedColumn-a),a=s.generatedColumn,null!=s.source&&(n=this._sources.indexOf(s.source),i+=t.encode(n-c),c=n,i+=t.encode(s.originalLine-1-l),l=s.originalLine-1,i+=t.encode(s.originalColumn-h),h=s.originalColumn,null!=s.name&&(r=this._names.indexOf(s.name),i+=t.encode(r-u),u=r)),d+=i}return d},r.prototype._generateSourcesContent=function(t,i){return t.map((function(t){if(!this._sourcesContents)return null;null!=i&&(t=e.relative(i,t));var s=e.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,s)?this._sourcesContents[s]:null}),this)},r.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(t.file=this._file),null!=this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},ts.SourceMapGenerator=r,ts}var vs,ms={},ys={};function bs(){return vs||(vs=1,function(t){function e(i,s,r,n,a,o){var h=Math.floor((s-i)/2)+i,l=a(r,n[h],!0);return 0===l?h:l>0?s-h>1?e(h,s,r,n,a,o):o==t.LEAST_UPPER_BOUND?s1?e(i,h,r,n,a,o):o==t.LEAST_UPPER_BOUND?h:i<0?-1:i}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(i,s,r,n){if(0===s.length)return-1;var a=e(-1,s.length,i,s,r,n||t.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===r(s[a],s[a-1],!0);)--a;return a}}(ys)),ys}var xs,Cs,ks={};function Ss(){if(xs)return ks;function t(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function e(i,s,r,n){if(r=0){var o=this._originalMappings[a];if(void 0===i.column)for(var h=o.originalLine;o&&o.originalLine===h;)n.push({line:t.getArg(o,"generatedLine",null),column:t.getArg(o,"generatedColumn",null),lastColumn:t.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a];else for(var l=o.originalColumn;o&&o.originalLine===s&&o.originalColumn==l;)n.push({line:t.getArg(o,"generatedLine",null),column:t.getArg(o,"generatedColumn",null),lastColumn:t.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a]}return n},ms.SourceMapConsumer=n,a.prototype=Object.create(n.prototype),a.prototype.consumer=n,a.prototype._findSourceIndex=function(e){var i,s=e;if(null!=this.sourceRoot&&(s=t.relative(this.sourceRoot,s)),this._sources.has(s))return this._sources.indexOf(s);for(i=0;i1&&(n.source=f+h[1],f+=h[1],n.originalLine=p+h[2],p=n.originalLine,n.originalLine+=1,n.originalColumn=g+h[3],g=n.originalColumn,h.length>4&&(n.name=v+h[4],v+=h[4])),k.push(n),"number"==typeof n.originalLine&&C.push(n)}r(k,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=k,r(C,t.compareByOriginalPositions),this.__originalMappings=C},a.prototype._findMapping=function(t,i,s,r,n,a){if(t[s]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[s]);if(t[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[r]);return e.search(t,i,n,a)},a.prototype.computeColumnSpans=function(){for(var t=0;t=0){var r=this._generatedMappings[s];if(r.generatedLine===i.generatedLine){var a=t.getArg(r,"source",null);null!==a&&(a=this._sources.at(a),a=t.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var o=t.getArg(r,"name",null);return null!==o&&(o=this._names.at(o)),{source:a,line:t.getArg(r,"originalLine",null),column:t.getArg(r,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(t){return null==t}))},a.prototype.sourceContentFor=function(e,i){if(!this.sourcesContent)return null;var s=this._findSourceIndex(e);if(s>=0)return this.sourcesContent[s];var r,n=e;if(null!=this.sourceRoot&&(n=t.relative(this.sourceRoot,n)),null!=this.sourceRoot&&(r=t.urlParse(this.sourceRoot))){var a=n.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!r.path||"/"==r.path)&&this._sources.has("/"+n))return this.sourcesContent[this._sources.indexOf("/"+n)]}if(i)return null;throw new Error('"'+n+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(e){var i=t.getArg(e,"source");if((i=this._findSourceIndex(i))<0)return{line:null,column:null,lastColumn:null};var s={source:i,originalLine:t.getArg(e,"line"),originalColumn:t.getArg(e,"column")},r=this._findMapping(s,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,t.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var a=this._originalMappings[r];if(a.source===s.source)return{line:t.getArg(a,"generatedLine",null),column:t.getArg(a,"generatedColumn",null),lastColumn:t.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},ms.BasicSourceMapConsumer=a,h.prototype=Object.create(n.prototype),h.prototype.constructor=n,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:function(){for(var t=[],e=0;e=0;e--)this.prepend(t[e]);else{if(!t[s]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);this.children.unshift(t)}return this},r.prototype.walk=function(t){for(var e,i=0,r=this.children.length;i0){for(e=[],i=0;i0&&(i+=", "+s.join(", "));var r=0;Object.keys(this.aliases).forEach((function(t){var s=e.aliases[t];s.children&&s.referenceCount>1&&(i+=", alias"+ ++r+"="+t,s.children[0]="alias"+r)})),this.lookupPropertyFunctionIsUsed&&(i+=", "+this.lookupPropertyFunctionVarDeclaration());var n=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths");var a=this.mergeSource(i);return t?(n.push(a),Function.apply(this,n)):this.source.wrap(["function(",n.join(","),") {\n ",a,"}"])},mergeSource:function(t){var e=this.environment.isSimple,i=!this.forceBuffer,s=void 0,r=void 0,n=void 0,a=void 0;return this.source.each((function(t){t.appendToBuffer?(n?t.prepend(" + "):n=t,a=t):(n&&(r?n.prepend("buffer += "):s=!0,a.add(";"),n=a=void 0),r=!0,e||(i=!1))})),i?n?(n.prepend("return "),a.add(";")):r||this.source.push('return "";'):(t+=", buffer = "+(s?"":this.initializeBuffer()),n?(n.prepend("return buffer + "),a.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(s?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(t){var e=this.aliasable("container.hooks.blockHelperMissing"),i=[this.contextName(0)];this.setupHelperArgs(t,0,i);var s=this.popStack();i.splice(1,0,s),this.push(this.source.functionCall(e,"call",i))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),e=[this.contextName(0)];this.setupHelperArgs("",0,e,!0),this.flushInline();var i=this.topStack();e.splice(1,0,i),this.pushSource(["if (!",this.lastHelper,") { ",i," = ",this.source.functionCall(t,"call",e),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack((function(t){return[" != null ? ",t,' : ""']})),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,e,i,s){var r=0;s||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(t[r++])),this.resolvePath("context",t,r,e,i)},lookupBlockParam:function(t,e){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",e,1)},lookupData:function(t,e,i){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",e,0,!0,i)},resolvePath:function(t,e,i,s,r){var n=this;if(this.options.strict||this.options.assumeObjects)this.push(function(t,e,i,s,r){var n=e.popStack(),a=i.length;t&&a--;for(;sthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,i=t.length;ee[t],set(i){e[t]=i},enumerable:!0,configurable:!0}),this}setTreeGroup(t){return this.groupName=t,this.eventSheetGroup=this.eventSheetManager.getTreeGroup(t),this}setActive(t){return void 0===t&&(t=!0),this.active=t,this}get roundComplete(){return 2===this.roundState}set roundComplete(t){this.roundState=t?2:1}setConditionEnable(t=!0){var e=t?void 0:0;return this.root.setSelectChildIndex(e),this}start(t,e){if(1===this.roundState)return!1;var i=3!==this.getState(t);if(i&&this.resetState(t),this.roundState=1,super.tick(t,e),i){var s=this.root.getNodeMemory(this.ticker);this.conditionPassed=0===s.$runningChild}return!0}tick(t,e){var i=super.tick(t,e);return 3!==i&&(this.roundState=2,this.conditionPassed&&this.properties.once&&this.setActive(!1)),i}abort(t,e){this.roundState=0,super.abort(t,e)}}var Ns={exports:{}};!function(t,e){!function(t){function e(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,s=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function a(t){return c[t]}t.defaults=n();var o=/[&<>"']/,h=new RegExp(o.source,"g"),l=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,u=new RegExp(l.source,"g"),c={"&":"&","<":"<",">":">",'"':""","'":"'"};function d(t,e){if(e){if(o.test(t))return t.replace(h,a)}else if(l.test(t))return t.replace(u,a);return t}var p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function g(t){return t.replace(p,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}var f=/(^|[^\[])\^/g;function v(t,e){t="string"==typeof t?t:t.source,e=e||"";var i={replace:function(e,s){return s=(s=s.source||s).replace(f,"$1"),t=t.replace(e,s),i},getRegex:function(){return new RegExp(t,e)}};return i}var m=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function b(t,e,i){if(t){try{s=decodeURIComponent(g(i)).replace(m,"").toLowerCase()}catch(t){return null}if(0===s.indexOf("javascript:")||0===s.indexOf("vbscript:")||0===s.indexOf("data:"))return null}var s;e&&!y.test(i)&&(t=i,x[" "+(s=e)]||(C.test(s)?x[" "+s]=s+"/":x[" "+s]=E(s,"/",!0)),e=-1===(s=x[" "+s]).indexOf(":"),i="//"===t.substring(0,2)?e?t:s.replace(k,"$1")+t:"/"===t.charAt(0)?e?t:s.replace(S,"$1")+t:s+t);try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i}var x={},C=/^[^:]+:\/*[^/]*$/,k=/^([^:]+:)[\s\S]*$/,S=/^([^:]+:\/*[^/]*)[\s\S]*$/,w={exec:function(){}};function _(t,e){var i=t.replace(/\|/g,(function(t,e,i){for(var s=!1,r=e;0<=--r&&"\\"===i[r];)s=!s;return s?"|":" |"})).split(/ \|/),s=0;if(i[0].trim()||i.shift(),0e)i.splice(e);else for(;i.length>=1,t+=t;return i+t}function O(t,e,i,s){var r=e.href,n=(e=e.title?d(e.title):null,t[1].replace(/\\([\[\]])/g,"$1"));return"!"!==t[0].charAt(0)?(s.state.inLink=!0,t={type:"link",raw:i,href:r,title:e,text:n,tokens:s.inlineTokens(n)},s.state.inLink=!1,t):{type:"image",raw:i,href:r,title:e,text:d(n)}}var P=function(){function e(e){this.options=e||t.defaults}var i=e.prototype;return i.space=function(t){if((t=this.rules.block.newline.exec(t))&&0=r.length?t.slice(r.length):t})).join("\n")),{type:"code",raw:e,lang:t[2]&&t[2].trim().replace(this.rules.inline._escapes,"$1"),text:i}},i.heading=function(t){var e,i;if(t=this.rules.block.heading.exec(t))return e=t[2].trim(),/#$/.test(e)&&(i=E(e,"#"),!this.options.pedantic&&i&&!/ $/.test(i)||(e=i.trim())),{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}},i.hr=function(t){if(t=this.rules.block.hr.exec(t))return{type:"hr",raw:t[0]}},i.blockquote=function(t){var e,i,s;if(t=this.rules.block.blockquote.exec(t))return e=t[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top,this.lexer.state.top=!0,s=this.lexer.blockTokens(e),this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:e}},i.list=function(t){var e=this.rules.block.list.exec(t);if(e){var i,s,r,n,a,o,h,l,u,c,d,p=1<(f=e[1].trim()).length,g={type:"list",raw:"",ordered:p,start:p?+f.slice(0,-1):"",loose:!1,items:[]},f=p?"\\d{1,9}\\"+f.slice(-1):"\\"+f;this.options.pedantic&&(f=p?f:"[*+-]");for(var v=new RegExp("^( {0,3}"+f+")((?:[\t ][^\\n]*)?(?:\\n|$))");t&&(d=!1,e=v.exec(t))&&!this.rules.block.hr.test(t);){if(i=e[0],t=t.substring(i.length),h=e[2].split("\n",1)[0].replace(/^\t+/,(function(t){return" ".repeat(3*t.length)})),l=t.split("\n",1)[0],this.options.pedantic?(n=2,c=h.trimLeft()):(n=e[2].search(/[^ ]/),c=h.slice(n=4=n||!l.trim())c+="\n"+l.slice(n);else{if(a)break;if(4<=h.search(/[^ ]/))break;if(b.test(h))break;if(x.test(h))break;if(y.test(h))break;c+="\n"+l}a||l.trim()||(a=!0),i+=u+"\n",t=t.substring(u.length+1),h=l.slice(n)}g.loose||(o?g.loose=!0:/\n *\n *$/.test(i)&&(o=!0)),this.options.gfm&&(s=/^\[[ xX]\] /.exec(c))&&(r="[ ] "!==s[0],c=c.replace(/^\[[ xX]\] +/,"")),g.items.push({type:"list_item",raw:i,task:!!s,checked:r,loose:!1,text:c}),g.raw+=i}g.items[g.items.length-1].raw=i.trimRight(),g.items[g.items.length-1].text=c.trimRight(),g.raw=g.raw.trimRight();for(var C,k=g.items.length,S=0;S$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=t[3]&&t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"),{type:"def",tag:e,raw:t[0],href:i,title:s}},i.table=function(t){if(t=this.rules.block.table.exec(t)){var e={type:"table",header:_(t[1]).map((function(t){return{text:t}})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];for(var i,s,r,n=e.align.length,a=0;a/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):d(t[0]):t[0]}},i.link=function(t){if(t=this.rules.inline.link.exec(t)){var e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;var i=E(e.slice(0,-1),"\\");if((e.length-i.length)%2==0)return}else i=function(t,e){if(-1!==t.indexOf(e[1]))for(var i=t.length,s=0,r=0;r$/.test(e)?i.slice(1):i.slice(1,-1):i)&&i.replace(this.rules.inline._escapes,"$1"),title:r&&r.replace(this.rules.inline._escapes,"$1")},t[0],this.lexer)}},i.reflink=function(t,e){var i;if(i=(i=this.rules.inline.reflink.exec(t))||this.rules.inline.nolink.exec(t))return(t=e[(t=(i[2]||i[1]).replace(/\s+/g," ")).toLowerCase()])?O(i,t,i[0],this.lexer):{type:"text",raw:e=i[0].charAt(0),text:e}},i.emStrong=function(t,e,i){void 0===i&&(i="");var s=this.rules.inline.emStrong.lDelim.exec(t);if(s&&(!s[3]||!i.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDF50-\uDF59\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDCD0-\uDCEB\uDCF0-\uDCF9\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/))&&(!s[1]&&!s[2]||""===i||this.rules.inline.punctuation.exec(i))){var r=s[0].length-1,n=r,a=0,o="*"===s[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(o.lastIndex=0,e=e.slice(-1*t.length+r);null!=(s=o.exec(e));){var h,l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6];if(l)if(h=l.length,s[3]||s[4])n+=h;else if((s[5]||s[6])&&r%3&&!((r+h)%3))a+=h;else if(!(0<(n-=h)))return h=Math.min(h,h+n+a),l=t.slice(0,r+s.index+(s[0].length-l.length)+h),Math.min(r,h)%2?(h=l.slice(1,-1),{type:"em",raw:l,text:h,tokens:this.lexer.inlineTokens(h)}):(h=l.slice(2,-2),{type:"strong",raw:l,text:h,tokens:this.lexer.inlineTokens(h)})}}},i.codespan=function(t){var e,i,s;if(t=this.rules.inline.code.exec(t))return s=t[2].replace(/\n/g," "),e=/[^ ]/.test(s),i=/^ /.test(s)&&/ $/.test(s),s=d(s=e&&i?s.substring(1,s.length-1):s,!0),{type:"codespan",raw:t[0],text:s}},i.br=function(t){if(t=this.rules.inline.br.exec(t))return{type:"br",raw:t[0]}},i.del=function(t){if(t=this.rules.inline.del.exec(t))return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}},i.autolink=function(t,e){var i;if(t=this.rules.inline.autolink.exec(t))return e="@"===t[2]?"mailto:"+(i=d(this.options.mangle?e(t[1]):t[1])):i=d(t[1]),{type:"link",raw:t[0],text:i,href:e,tokens:[{type:"text",raw:i,text:i}]}},i.url=function(t,e){var i,s,r,n;if(i=this.rules.inline.url.exec(t)){if("@"===i[2])r="mailto:"+(s=d(this.options.mangle?e(i[0]):i[0]));else{for(;n=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0],n!==i[0];);s=d(i[0]),r="www."===i[1]?"http://"+i[0]:i[0]}return{type:"link",raw:i[0],text:s,href:r,tokens:[{type:"text",raw:s,text:s}]}}},i.inlineText=function(t,e){if(t=this.rules.inline.text.exec(t))return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):d(t[0]):t[0]:d(this.options.smartypants?e(t[0]):t[0]),{type:"text",raw:t[0],text:e}},e}(),M={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:w,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/},D=(M.def=v(M.def).replace("label",M._label).replace("title",M._title).getRegex(),M.bullet=/(?:[*+-]|\d{1,9}[.)])/,M.listItemStart=v(/^( *)(bull) */).replace("bull",M.bullet).getRegex(),M.list=v(M.list).replace(/bull/g,M.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+M.def.source+")").getRegex(),M._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",M._comment=/|$)/,M.html=v(M.html,"i").replace("comment",M._comment).replace("tag",M._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),M.paragraph=v(M._paragraph).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.blockquote=v(M.blockquote).replace("paragraph",M.paragraph).getRegex(),M.normal=i({},M),M.gfm=i({},M.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),M.gfm.table=v(M.gfm.table).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.gfm.paragraph=v(M._paragraph).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",M.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.pedantic=i({},M.normal,{html:v("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",M._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:w,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:v(M.normal._paragraph).replace("hr",M.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",M.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()}),{escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:w,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:w,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",D.punctuation=v(D.punctuation).replace(/punctuation/g,D._punctuation).getRegex(),D.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,D.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,D._comment=v(M._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),D.emStrong.lDelim=v(D.emStrong.lDelim).replace(/punct/g,D._punctuation).getRegex(),D.emStrong.rDelimAst=v(D.emStrong.rDelimAst,"g").replace(/punct/g,D._punctuation).getRegex(),D.emStrong.rDelimUnd=v(D.emStrong.rDelimUnd,"g").replace(/punct/g,D._punctuation).getRegex(),D._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,D._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,D._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,D.autolink=v(D.autolink).replace("scheme",D._scheme).replace("email",D._email).getRegex(),D._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,D.tag=v(D.tag).replace("comment",D._comment).replace("attribute",D._attribute).getRegex(),D._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,D._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,D._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,D.link=v(D.link).replace("label",D._label).replace("href",D._href).replace("title",D._title).getRegex(),D.reflink=v(D.reflink).replace("label",D._label).replace("ref",M._label).getRegex(),D.nolink=v(D.nolink).replace("ref",M._label).getRegex(),D.reflinkSearch=v(D.reflinkSearch,"g").replace("reflink",D.reflink).replace("nolink",D.nolink).getRegex(),D.normal=i({},D),D.pedantic=i({},D.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:v(/^!?\[(label)\]\((.*?)\)/).replace("label",D._label).getRegex(),reflink:v(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D._label).getRegex()}),D.gfm=i({},D.normal,{escape:v(D.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\'+(i?t:d(t,!0))+"\n":"
"+(i?t:d(t,!0))+"
\n"},i.blockquote=function(t){return"
\n"+t+"
\n"},i.html=function(t,e){return t},i.heading=function(t,e,i,s){return this.options.headerIds?"'+t+"\n":""+t+"\n"},i.hr=function(){return this.options.xhtml?"
\n":"
\n"},i.list=function(t,e,i){var s=e?"ol":"ul";return"<"+s+(e&&1!==i?' start="'+i+'"':"")+">\n"+t+"\n"},i.listitem=function(t){return"
  • "+t+"
  • \n"},i.checkbox=function(t){return" "},i.paragraph=function(t){return"

    "+t+"

    \n"},i.table=function(t,e){return"\n\n"+t+"\n"+(e=e&&""+e+"")+"
    \n"},i.tablerow=function(t){return"\n"+t+"\n"},i.tablecell=function(t,e){var i=e.header?"th":"td";return(e.align?"<"+i+' align="'+e.align+'">':"<"+i+">")+t+"\n"},i.strong=function(t){return""+t+""},i.em=function(t){return""+t+""},i.codespan=function(t){return""+t+""},i.br=function(){return this.options.xhtml?"
    ":"
    "},i.del=function(t){return""+t+""},i.link=function(t,e,i){return null===(t=b(this.options.sanitize,this.options.baseUrl,t))?i:(t='"+i+"")},i.image=function(t,e,i){return null===(t=b(this.options.sanitize,this.options.baseUrl,t))?i:(t=''+i+'":">"))},i.text=function(t){return t},e}(),B=function(){function t(){}var e=t.prototype;return e.strong=function(t){return t},e.em=function(t){return t},e.codespan=function(t){return t},e.del=function(t){return t},e.html=function(t){return t},e.text=function(t){return t},e.link=function(t,e,i){return""+i},e.image=function(t,e,i){return""+i},e.br=function(){return""},t}(),I=function(){function t(){this.seen={}}var e=t.prototype;return e.serialize=function(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},e.getNextSafeSlug=function(t,e){var i=t,s=0;if(this.seen.hasOwnProperty(i))for(s=this.seen[t];i=t+"-"+ ++s,this.seen.hasOwnProperty(i););return e||(this.seen[t]=s,this.seen[i]=0),i},e.slug=function(t,e){return void 0===e&&(e={}),t=this.serialize(t),this.getNextSafeSlug(t,e.dryrun)},t}(),j=function(){function e(e){this.options=e||t.defaults,this.options.renderer=this.options.renderer||new F,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new B,this.slugger=new I}e.parse=function(t,i){return new e(i).parse(t)},e.parseInline=function(t,i){return new e(i).parseInline(t)};var i=e.prototype;return i.parse=function(t,e){void 0===e&&(e=!0);for(var i,s,r,n,a,o,h,l,u,c,d,p,f,v,m,y,b="",x=t.length,C=0;C",o?Promise.resolve(e):h?void h(null,e):e;if(o)return Promise.reject(t);if(!h)throw t;h(t)});if(null==s)return c(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof s)return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(u=n,(l=r)&&!l.silent&&(u&&console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"),(l.sanitize||l.sanitizer)&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"),!l.highlight&&"language-"===l.langPrefix||console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."),l.mangle&&console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."),l.baseUrl&&console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."),l.smartypants&&console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants."),l.xhtml&&console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml."),l.headerIds||l.headerPrefix)&&console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`."),r.hooks&&(r.hooks.options=r),n){var p,g=r.highlight;try{r.hooks&&(s=r.hooks.preprocess(s)),p=t(s,r)}catch(s){return c(s)}var f,v=function(t){var i;if(!t)try{r.walkTokens&&G.walkTokens(p,r.walkTokens),i=e(p,r),r.hooks&&(i=r.hooks.postprocess(i))}catch(i){t=i}return r.highlight=g,t?c(t):n(null,i)};return!g||g.length<3?v():(delete r.highlight,p.length?(f=0,G.walkTokens(p,(function(t){"code"===t.type&&(f++,setTimeout((function(){g(t.text,t.lang,(function(e,i){if(e)return v(e);null!=i&&i!==t.text&&(t.text=i,t.escaped=!0),0==--f&&v()}))}),0))})),void(0===f&&v())):v())}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(s):s).then((function(e){return t(e,r)})).then((function(t){return r.walkTokens?Promise.all(G.walkTokens(t,r.walkTokens)).then((function(){return t})):t})).then((function(t){return e(t,r)})).then((function(t){return r.hooks?r.hooks.postprocess(t):t})).catch(c);try{r.hooks&&(s=r.hooks.preprocess(s));var m=t(s,r),y=(r.walkTokens&&G.walkTokens(m,r.walkTokens),e(m,r));return r.hooks?r.hooks.postprocess(y):y}catch(s){return c(s)}}}function G(t,e,i){return N(R.lex,j.parse)(t,e,i)}z.passThroughHooks=new Set(["preprocess","postprocess"]),G.options=G.setOptions=function(e){return G.defaults=i({},G.defaults,e),e=G.defaults,t.defaults=e,G},G.getDefaults=n,G.defaults=t.defaults,G.use=function(){for(var t=G.defaults.extensions||{renderers:{},childTokens:{}},e=arguments.length,s=new Array(e),r=0;r0?(n=new z,t.paragraphs.length>0&&n.addChild(sr(t,e)),rr(t.children,e,n)):n=sr(t,e),n;switch(u.type){case"if":var c=new j({title:"[if]"}),d=nr(u.match[1],t);try{f=new V({expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({expression:"false"})}t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),c.addChild(f);var p=new F;return c.addChild(p),c;case"else":case"else if":var g=u.type;d="else"===g?"true":nr(u.match[1],t);try{f=new V({title:`[${g}]`,expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({title:`[${g}]`,expression:"false"})}return t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),f;case"while":var f,v=new $({title:"[while]",returnSuccess:!0});d=nr(u.match[1],t);try{f=new V({title:"[while-IF]",expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({title:"[while-IF]",expression:"false"})}return t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),v.addChild(f),v;case"repeat":var m=(l=u.match[1]).startsWith("#(")&&l.endsWith(")")?l.substring(2,l.length-1):l,y=new W({title:"[repeat]",maxLoop:m});return t.children.length>0?y.addChild(rr(t.children,e)):y.addChild(sr(t,e)),y;default:console.error(`Missing ${u.type}'s handler`)}},nr=function(t,e){var i=t.trim();return""===i&&(i=Js(e)),i},ar=function(t,e,{groupName:i,lineBreak:s="\\",commentLineStart:r="//",parallel:n=!1,active:a=!0,once:o=!1}={}){var h=function(t){for(var e=Gs.lexer(t),i=null,s=[],r=0;r0?v.addChild(rr(c[0],p)):v.addChild(new F),f.addChild(v),g};class or extends Is{boot(){super.boot(),this.scene&&this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(t){if(!this.isShutdown)return this.scene&&this.scene.sys.events.off("shutdown",this.destroy,this),super.shutdown(t),this}addEventSheet(t,e,i){"string"!=typeof e&&(i=e,e=void 0),void 0===e&&(e=this.defaultTreeGroupName),void 0===i&&(i={});var{lineBreak:s="\\",commentLineStart:r="//",parallel:n=this.parallel,groupName:e=e}=i,a=ar(this,t,{groupName:e,lineBreak:s,commentLineStart:r,parallel:n});return this.addTree(a,a.groupName),this}} + */,Repeat:W,RepeatUntilFailure:$,RepeatUntilSuccess:class extends R{constructor({maxLoop:t=-1,child:e=null,title:i,name:s="RepeatUntilSuccess"}={},r){super({child:e,title:i,name:s,properties:{maxLoop:t}},r),this.maxLoopExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;for(var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i,r=9;(i<0||s=r;if(n){e.$lastEndTime=i;r=t.evalExpression(this.intervalExpression);var a=t.evalExpression(this.randomDeviationExpression);a>0&&(r+=(.5-Math.random())*a),e.$interval=r}return n}},ShuffleSelector:class extends L{constructor({children:t=[],services:e,title:i,name:s="ShuffleSelector"}={},r){super({children:t,services:e,title:i,name:s},r)}open(t){var e=this.getNodeMemory(t);e.$runningChild=0,e.$children||(e.$children=this.children.map(((t,e)=>e))),function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[i],t[i]=s}}(e.$children)}tick(t){if(0===this.children.length)return 9;for(var e,i=this.getNodeMemory(t),s=i.$runningChild,r=i.$children,n=s,a=r.length;n=e.$duration?this.returnSuccess?SUCCESS:2:this.child._execute(t)}},Wait:class extends A{constructor({duration:t=0,services:e,title:i,name:s="Wait"}={}){super({title:i,name:s,properties:{duration:t},services:e}),this.durationExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$startTime=t.currentTime,e.$duration=t.evalExpression(this.durationExpression)}tick(t){var e=this.getNodeMemory(t),i=t.currentTime,s=e.$startTime,r=e.$duration;if(r>0){if(i-st.id)),r.services&&(n.services=r.services.map((t=>t.id)));break;case o:r.child&&(n.child=r.child.id);break;case h:r.services&&(n.services=r.services.map((t=>t.id)))}t.nodes.push(n)}return t},load:function(t,e){var i=t.sn;null!=i&&p(Math.max(g(),i)),e=e||{},this.title=t.title||this.title,this.description=t.description||this.description,this.properties=t.properties||this.properties;for(var s=t.nodes,r={},n=s.length-1;n>=0;n--){var a,o=s[n],h=o.name;if(h in e)a=e[h];else{if(!(h in H))throw new EvalError(`BehaviorTree.load: Invalid node name "${h}".`);a=H[h]}var l={};o.hasOwnProperty("children")&&(l.children=o.children),o.hasOwnProperty("child")&&(l.child=o.child),o.hasOwnProperty("services")&&(l.services=o.services);var u=new a(l=Object.assign(l,o.properties),r);u.id=o.id||u.id,u.title=o.title||u.title,u.description=o.description||u.description,u.properties=o.properties||u.properties,r[u.id]=u}return this.root=r[t.root],this}};Object.assign(q.prototype,K,v);var J=function(t){return null==t||""===t||0===t.length},Z=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(J(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(J(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n0&&(G(this.trees,e),G(this.pendingTrees,e)),this}},lt={getTreeActiveState(t){var e=this.getTree(t);return e?e.active:null},setTreeActiveState(t,e){var i=this.getTree(t);return i&&i.setActive(e),this}};class ut extends z{open(t){super.open(t);var e=t.blackboard.eventSheetManager,i=t.tree,s=i.eventSheetGroup;e.emit("label.enter",this.title,i.title,s.name,e)}tick(t){var e=super.tick(t);return 2===e&&(e=1),e}close(t){super.close(t);var e=t.blackboard.eventSheetManager,i=t.tree,s=i.eventSheetGroup;e.emit("label.exit",this.title,i.title,s.name,e)}}var ct={pauseEventSheet(t){var e=t.tree.eventSheetGroup;this.isRunning=!0;var i=this,s=this.waitId;return function(){s":">",'"':""","'":"'","/":"/","`":"`","=":"="};var Ct=/\s*/,kt=/\s+/,St=/\s*=/,wt=/\s*\}/,_t=/#|\^|\/|>|\{|&|=|!/;function Et(t){this.string=t,this.tail=t,this.pos=0}function Tt(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Ot(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Et.prototype.eos=function(){return""===this.tail},Et.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},Et.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},Tt.prototype.push=function(t){return new Tt(t,this)},Tt.prototype.lookup=function(t){var e,i,s,r=this.cache;if(r.hasOwnProperty(t))e=r[t];else{for(var n,a,o,h=this,l=!1;h;){if(t.indexOf(".")>0)for(n=h.view,a=t.split("."),o=0;null!=n&&o0?r[r.length-1][4]:i;break;default:s.push(e)}return i}(function(t){for(var e,i,s=[],r=0,n=t.length;r"===a?o=this.renderPartial(n,e,i,r):"&"===a?o=this.unescapedValue(n,e):"name"===a?o=this.escapedValue(n,e,r):"text"===a&&(o=this.rawValue(n)),void 0!==o&&(h+=o);return h},Ot.prototype.renderSection=function(t,e,i,s,r){var n=this,a="",o=e.lookup(t[1]);if(o){if(pt(o))for(var h=0,l=o.length;h0||!i)&&(r[n]=s+r[n]);return r.join("\n")},Ot.prototype.renderPartial=function(t,e,i,s){if(i){var r=this.getConfigTags(s),n=gt(i)?i(t[1]):i[t[1]];if(null!=n){var a=t[6],o=t[5],h=t[4],l=n;0==o&&h&&(l=this.indentPartial(n,h,a));var u=this.parse(l,r);return this.renderTokens(u,e,i,l,s)}}},Ot.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);if(null!=i)return i},Ot.prototype.escapedValue=function(t,e,i){var s=this.getConfigEscape(i)||Pt.escape,r=e.lookup(t[1]);if(null!=r)return"number"==typeof r&&s===Pt.escape?String(r):s(r)},Ot.prototype.rawValue=function(t){return t[1]},Ot.prototype.getConfigTags=function(t){return pt(t)?t:t&&"object"==typeof t?t.tags:void 0},Ot.prototype.getConfigEscape=function(t){return t&&"object"==typeof t&&!pt(t)?t.escape:void 0};var Pt={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Mt.templateCache=t},get templateCache(){return Mt.templateCache}},Mt=new Ot;Pt.clearCache=function(){return Mt.clearCache()},Pt.parse=function(t,e){return Mt.parse(t,e)},Pt.render=function(t,e,i,s){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+((pt(r=t)?"array":typeof r)+'" was given as the first argument for mustache#render(template, view, partials)'));var r;return Mt.render(t,e,i,s)},Pt.escape=function(t){return String(t).replace(/[&<>"'`=\/]/g,(function(t){return xt[t]}))},Pt.Scanner=Et,Pt.Context=Tt,Pt.Writer=Ot;class Dt extends A{constructor(t){super({name:"TaskAction",title:t.name,properties:t});var e=t.parameters,i={};for(var s in e)i[s]=At(e[s]);this.taskParameters=i,this.isRunning=!1,this.waitId=0}open(t){this.isRunning=!1;var e=this.properties.name;if(e){var i=t.blackboard.eventSheetManager,s=t.tree,r=i.memory,n=this.taskParameters,a={};for(var o in n){var h=n[o];"function"==typeof h&&(h=h(r)),a[o]=h}i.bindTaskActionNode(t,this);var l,u,c=t.target,d=c[e];d?l=d.call(c,a,i,s):(d=c.defaultHandler)&&(l=d.call(c,e,a,i,s)),i.unBindTaskAction(t,this),!this.isRunning&&((u=l)&&"object"==typeof u&&u.on)&&this.pauseEventSheetUnitlEvent(t,l)}}tick(t){return this.isRunning?this.RUNNING:this.SUCCESS}close(t){}abort(t){this.removeTaskCompleteCallback&&this.removeTaskCompleteCallback()}}var At=function(t){if("string"==typeof t)if(t.startsWith("#(")&&t.endsWith(")"))t=E(t.substring(2,t.length-1));else if(t.indexOf("{{")>-1&&t.indexOf("}}")>-1){var e=t;t=function(t){return Pt.render(e,t)}}return t};Object.assign(Dt.prototype,ct);class Lt extends A{constructor({activateTreeTitle:t,services:e,title:i,name:s="ActivateTree"}={}){super({name:s,title:i,properties:{activateTreeTitle:t},services:e}),this.activateTreeTitle=t}tick(t){var e=this.getTree(t);return this.activateTreeTitle&&""!==this.activateTreeTitle?e.eventSheetManager.setEventSheetActiveState(this.activateTreeTitle,e.groupName,!0):e.setActive(!0),this.SUCCESS}}class Rt extends A{constructor({deactivateTreeTitle:t,services:e,title:i,name:s="DeactivateTree"}={}){super({name:s,title:i,properties:{deactivateTreeTitle:t},services:e}),this.deactivateTreeTitle=t}tick(t){var e=this.getTree(t);return this.deactivateTreeTitle&&""!==this.deactivateTreeTitle?e.eventSheetManager.setEventSheetActiveState(this.deactivateTreeTitle,e.groupName,!1):e.setActive(!1),this.SUCCESS}}var Ft={TaskSequence:ut,TaskAction:Dt,ActivateAction:Lt,DeactivateAction:Rt},Bt={dumpEventSheetGroup(){return this.trees.map((function(t){return t.dump()}))},loadEventSheetGroup(t){return t.forEach((function(t){var e=new q({id:t.id,title:t.title,properties:y(t.properties)});e.load(t,Ft),this.trees.push(e)}),this),this}},It={dumpState(t=!1){var e={isRunning:this.isRunning,pendingTrees:this.pendingTrees.filter((function(t){return!t.roundComplete})).map((function(t){return t.id}))};return t&&(e.trees=this.dumpEventSheetGroup()),e},loadState(t){this.stop(),t.trees&&(this.trees.length=0,this.loadEventSheetGroup(t.trees)),this.isRunning=t.isRunning;var e=this.pendingTrees;return e.length=0,this.trees.forEach((function(i){t.pendingTrees.indexOf(i.id)>-1&&e.push(i)})),this}},jt=function(t,e){var i=t.blackboard,s=t.commandExecutor;e.start(i,s)&&(e.conditionPassed?t.emit("eventsheet.enter",e.title,this.name,t):t.emit("eventsheet.catch",e.title,this.name,t))},zt=function(t,e){var i=t.blackboard,s=t.commandExecutor;return e.tick(i,s)},Nt=function(t,e){e.conditionPassed&&t.emit("eventsheet.exit",e.title,this.name,t)},Gt={start(){if(this.isRunning)return this;this.isRunning=!0;var t=this.parent,e=this.trees,i=this.pendingTrees,s=t.blackboard;t.emit("start",this.name,t);for(var r=0,n=e.length;r0&&G(e,i),0===e.length&&(this.isRunning=!1,t.emit("complete",this.name,t)),this},startTree(t,e=!0){if(this.isRunning)return this;var i=this.getTree(t);if(!i)return this;this.isRunning=!0;var s=this.parent,r=this.pendingTrees,n=s.blackboard;return r.length=0,i.resetState(n),i.setConditionEnable(!e),jt.call(this,s,i),i.setConditionEnable(!0),r.push(i),this.continue(),this}},Xt={stop(){for(var t=this.parent,e=t.blackboard,i=t.commandExecutor,s=this.pendingTrees,r=0,n=s.length;r":">",'"':""","'":"'","`":"`","=":"="},se=/[&<>"'`=]/g,re=/[&<>"'`=]/;function ne(t){return ie[t]}function ae(t){for(var e=1;e0?(s.ids&&(s.ids=[s.name]),t.helpers.each(e,s)):r(this);if(s.data&&s.ids){var a=i.createFrame(s.data);a.contextPath=i.appendContextPath(s.data.contextPath,s.name),s={data:a}}return n(e,s)}))},t.exports=e.default}(pe,pe.exports);var ge=pe.exports,fe={exports:{}};!function(t,e){e.__esModule=!0;var i,s=ee,r=(i=ce)&&i.__esModule?i:{default:i};e.default=function(t){t.registerHelper("each",(function(t,e){if(!e)throw new r.default("Must pass iterator to #each");var i,n=e.fn,a=e.inverse,o=0,h="",l=void 0,u=void 0;function c(e,i,r){l&&(l.key=e,l.index=i,l.first=0===i,l.last=!!r,u&&(l.contextPath=u+e)),h+=n(t[e],{data:l,blockParams:s.blockParams([t[e],e],[u+e,null])})}if(e.data&&e.ids&&(u=s.appendContextPath(e.data.contextPath,e.ids[0])+"."),s.isFunction(t)&&(t=t.call(this)),e.data&&(l=s.createFrame(e.data)),t&&"object"==typeof t)if(s.isArray(t))for(var d=t.length;o=0?e:parseInt(t,10)}return t},log:function(t){if(t=s.lookupLevel(t),"undefined"!=typeof console&&s.lookupLevel(s.level)<=t){var e=s.methodMap[t];console[e]||(e="log");for(var i=arguments.length,r=Array(i>1?i-1:0),n=1;n= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var ii="[object Object]";function si(t,e,i){this.helpers=t||{},this.partials=e||{},this.decorators=i||{},Ze.registerDefaultHelpers(this),Qe.registerDefaultDecorators(this)}si.prototype={constructor:si,logger:ti.default,log:ti.default.log,registerHelper:function(t,e){if(Ke.toString.call(t)===ii){if(e)throw new Je.default("Arg not supported with multiple helpers");Ke.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(Ke.toString.call(t)===ii)Ke.extend(this.partials,t);else{if(void 0===e)throw new Je.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(Ke.toString.call(t)===ii){if(e)throw new Je.default("Arg not supported with multiple decorators");Ke.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){ei.resetLoggedProperties()}};var ri=ti.default.log;te.log=ri,te.createFrame=Ke.createFrame,te.logger=ti.default;var ni={exports:{}};!function(t,e){function i(t){this.string=t}e.__esModule=!0,i.prototype.toString=i.prototype.toHTML=function(){return""+this.string},e.default=i,t.exports=e.default}(ni,ni.exports);var ai=ni.exports,oi={},hi={};hi.__esModule=!0,hi.wrapHelper=function(t,e){if("function"!=typeof t)return t;return function(){return arguments[arguments.length-1]=e(arguments[arguments.length-1]),t.apply(this,arguments)}},oi.__esModule=!0,oi.checkRevision=function(t){var e=t&&t[0]||1,i=ci.COMPILER_REVISION;if(e>=ci.LAST_COMPATIBLE_COMPILER_REVISION&&e<=ci.COMPILER_REVISION)return;if(e2&&y.push("'"+this.terminals_[f]+"'");C=this.lexer.showPosition?"Parse error on line "+(o+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+(this.terminals_[c]||c)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==c?"end of input":"'"+(this.terminals_[c]||c)+"'"),this.parseError(C,{text:this.lexer.match,token:this.terminals_[c]||c,line:this.lexer.yylineno,loc:l,expected:y})}if(p[0]instanceof Array&&p.length>1)throw new Error("Parse Error: multiple actions possible at state: "+d+", token: "+c);switch(p[0]){case 1:i.push(c),s.push(this.lexer.yytext),r.push(this.lexer.yylloc),i.push(p[1]),c=null,h=this.lexer.yyleng,a=this.lexer.yytext,o=this.lexer.yylineno,l=this.lexer.yylloc;break;case 2:if(v=this.productions_[p[1]][1],x.$=s[s.length-v],x._$={first_line:r[r.length-(v||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(v||1)].first_column,last_column:r[r.length-1].last_column},u&&(x._$.range=[r[r.length-(v||1)].range[0],r[r.length-1].range[1]]),void 0!==(g=this.performAction.call(x,a,h,o,this.yy,p[1],s,r)))return g;v&&(i=i.slice(0,-1*v*2),s=s.slice(0,-1*v),r=r.slice(0,-1*v)),i.push(this.productions_[p[1]][0]),s.push(x.$),r.push(x._$),m=n[i[i.length-2]][i[i.length-1]],i.push(m);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,i,s,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),a=0;ae[0].length)||(e=i,s=a,this.options.flex));a++);return e?((r=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,n[s],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,i,s){function r(t,i){return e.yytext=e.yytext.substring(t,e.yyleng-i+t)}switch(i){case 0:if("\\\\"===e.yytext.slice(-2)?(r(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(r(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(r(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(e.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return e.yytext=r(1,2).replace(/\\"/g,'"'),80;case 32:return e.yytext=r(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return e.yytext=e.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return t}();function i(){this.yy={}}return t.lexer=e,i.prototype=t,t.Parser=i,new i}();e.default=i,t.exports=e.default}(wi,wi.exports);var _i=wi.exports,Ei={exports:{}},Ti={exports:{}};!function(t,e){e.__esModule=!0;var i=function(t){return t&&t.__esModule?t:{default:t}}(ce);function s(){this.parents=[]}function r(t){this.acceptRequired(t,"path"),this.acceptArray(t.params),this.acceptKey(t,"hash")}function n(t){r.call(this,t),this.acceptKey(t,"program"),this.acceptKey(t,"inverse")}function a(t){this.acceptRequired(t,"name"),this.acceptArray(t.params),this.acceptKey(t,"hash")}s.prototype={constructor:s,mutating:!1,acceptKey:function(t,e){var r=this.accept(t[e]);if(this.mutating){if(r&&!s.prototype[r.type])throw new i.default('Unexpected node type "'+r.type+'" found when accepting '+e+" on "+t.type);t[e]=r}},acceptRequired:function(t,e){if(this.acceptKey(t,e),!t[e])throw new i.default(t.type+" requires "+e)},acceptArray:function(t){for(var e=0,i=t.length;e0)throw new Di.default("Invalid path: "+s,{loc:i});".."===h&&n++}}return{type:"PathExpression",data:t,depth:n,parts:r,original:s,loc:i}},Mi.prepareMustache=function(t,e,i,s,r,n){var a=s.charAt(3)||s.charAt(2),o="{"!==a&&"&"!==a;return{type:/\*/.test(s)?"Decorator":"MustacheStatement",path:t,params:e,hash:i,escaped:o,strip:r,loc:this.locInfo(n)}},Mi.prepareRawBlock=function(t,e,i,s){Ai(t,i),s=this.locInfo(s);var r={type:"Program",body:e,strip:{},loc:s};return{type:"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:r,openStrip:{},inverseStrip:{},closeStrip:{},loc:s}},Mi.prepareBlock=function(t,e,i,s,r,n){s&&s.path&&Ai(t,s);var a=/\*/.test(t.open);e.blockParams=t.blockParams;var o=void 0,h=void 0;if(i){if(a)throw new Di.default("Unexpected inverse block on decorator",i);i.chain&&(i.program.body[0].closeStrip=s.strip),h=i.strip,o=i.program}r&&(r=o,o=e,e=r);return{type:a?"DecoratorBlock":"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:e,inverse:o,openStrip:t.strip,inverseStrip:h,closeStrip:s&&s.strip,loc:this.locInfo(n)}},Mi.prepareProgram=function(t,e){if(!e&&t.length){var i=t[0].loc,s=t[t.length-1].loc;i&&s&&(e={source:i.source,start:{line:i.start.line,column:i.start.column},end:{line:s.end.line,column:s.end.column}})}return{type:"Program",body:t,strip:{},loc:e}},Mi.preparePartialBlock=function(t,e,i,s){return Ai(t,i),{type:"PartialBlockStatement",name:t.path,params:t.params,hash:t.hash,program:e,openStrip:t.strip,closeStrip:i&&i.strip,loc:this.locInfo(s)}};var Di=function(t){return t&&t.__esModule?t:{default:t}}(ce);function Ai(t,e){if(e=e.path?e.path.original:e,t.path.original!==e){var i={loc:t.path.loc};throw new Di.default(t.path.original+" doesn't match "+e,i)}}function Li(t){return t&&t.__esModule?t:{default:t}}Si.__esModule=!0,Si.parseWithoutProcessing=zi,Si.parse=function(t,e){var i=zi(t,e);return new Fi.default(e).accept(i)};var Ri=Li(_i),Fi=Li(Pi),Bi=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}(Mi),Ii=ee;Si.parser=Ri.default;var ji={};function zi(t,e){return"Program"===t.type?t:(Ri.default.yy=ji,ji.locInfo=function(t){return new ji.SourceLocation(e&&e.srcName,t)},Ri.default.parse(t))}Ii.extend(ji,Bi);var Ni={};function Gi(t){return t&&t.__esModule?t:{default:t}}Ni.__esModule=!0,Ni.Compiler=Vi,Ni.precompile=function(t,e,i){if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new Xi.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);"data"in(e=e||{})||(e.data=!0);e.compat&&(e.useDepths=!0);var s=i.parse(t,e),r=(new i.Compiler).compile(s,e);return(new i.JavaScriptCompiler).compile(r,e)},Ni.compile=function(t,e,i){void 0===e&&(e={});if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new Xi.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);"data"in(e=Yi.extend({},e))||(e.data=!0);e.compat&&(e.useDepths=!0);var s=void 0;function r(){var s=i.parse(t,e),r=(new i.Compiler).compile(s,e),n=(new i.JavaScriptCompiler).compile(r,e,void 0,!0);return i.template(n)}function n(t,e){return s||(s=r()),s.call(this,t,e)}return n._setup=function(t){return s||(s=r()),s._setup(t)},n._child=function(t,e,i,n){return s||(s=r()),s._child(t,e,i,n)},n};var Xi=Gi(ce),Yi=ee,Wi=Gi(ki),$i=[].slice;function Vi(){}function Hi(t,e){if(t===e)return!0;if(Yi.isArray(t)&&Yi.isArray(e)&&t.length===e.length){for(var i=0;i1)throw new Xi.default("Unsupported number of partial arguments: "+i.length,t);i.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):i.push({type:"PathExpression",parts:[],depth:0}));var s=t.name.original,r="SubExpression"===t.name.type;r&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var n=t.indent||"";this.options.preventIndent&&n&&(this.opcode("appendContent",n),n=""),this.opcode("invokePartial",r,s,n),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){Ui(t);var e=this.classifySexpr(t);"simple"===e?this.simpleSexpr(t):"helper"===e?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,i){var s=t.path,r=s.parts[0],n=null!=e||null!=i;this.opcode("getContext",s.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",i),s.strict=!0,this.accept(s),this.opcode("invokeAmbiguous",r,n)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,i){var s=this.setupFullMustacheParams(t,e,i),r=t.path,n=r.parts[0];if(this.options.knownHelpers[n])this.opcode("invokeKnownHelper",s.length,n);else{if(this.options.knownHelpersOnly)throw new Xi.default("You specified knownHelpersOnly, but used the unknown helper "+n,t);r.strict=!0,r.falsy=!0,this.accept(r),this.opcode("invokeHelper",s.length,r.original,Wi.default.helpers.simpleId(r))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],i=Wi.default.helpers.scopedId(t),s=!t.depth&&!i&&this.blockParamIndex(e);s?this.opcode("lookupBlockParam",s,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,i):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,i=0,s=e.length;for(this.opcode("pushHash");i=0)return[e,r]}}};var qi,Ki,Ji={exports:{}},Zi={exports:{}},Qi={},ts={},es={},is={};function ss(){if(qi)return is;qi=1;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return is.encode=function(e){if(0<=e&&e>>=5)>0&&(i|=32),s+=t.encode(i)}while(r>0);return s},es.decode=function(e,i,s){var r,n,a,o,h=e.length,l=0,u=0;do{if(i>=h)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(n=t.decode(e.charCodeAt(i++))))throw new Error("Invalid base64 digit: "+e.charAt(i-1));r=!!(32&n),l+=(n&=31)<>1,1&~a?o:-o),s.rest=i},es}var ns,as={};function os(){return ns||(ns=1,function(t){t.getArg=function(t,e,i){if(e in t)return t[e];if(3===arguments.length)return i;throw new Error('"'+e+'" is a required argument.')};var e=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,i=/^data:.+\,.+$/;function s(t){var i=t.match(e);return i?{scheme:i[1],auth:i[2],host:i[3],port:i[4],path:i[5]}:null}function r(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}function n(e){var i=e,n=s(e);if(n){if(!n.path)return e;i=n.path}for(var a,o=t.isAbsolute(i),h=i.split(/\/+/),l=0,u=h.length-1;u>=0;u--)"."===(a=h[u])?h.splice(u,1):".."===a?l++:l>0&&(""===a?(h.splice(u+1,l),l=0):(h.splice(u,2),l--));return""===(i=h.join("/"))&&(i=o?"/":"."),n?(n.path=i,r(n)):i}function a(t,e){""===t&&(t="."),""===e&&(e=".");var a=s(e),o=s(t);if(o&&(t=o.path||"/"),a&&!a.scheme)return o&&(a.scheme=o.scheme),r(a);if(a||e.match(i))return e;if(o&&!o.host&&!o.path)return o.host=e,r(o);var h="/"===e.charAt(0)?e:n(t.replace(/\/+$/,"")+"/"+e);return o?(o.path=h,r(o)):h}t.urlParse=s,t.urlGenerate=r,t.normalize=n,t.join=a,t.isAbsolute=function(t){return"/"===t.charAt(0)||e.test(t)},t.relative=function(t,e){""===t&&(t="."),t=t.replace(/\/$/,"");for(var i=0;0!==e.indexOf(t+"/");){var s=t.lastIndexOf("/");if(s<0)return e;if((t=t.slice(0,s)).match(/^([^\/]+:\/)?\/*$/))return e;++i}return Array(i+1).join("../")+e.substr(t.length+1)};var o=!("__proto__"in Object.create(null));function h(t){return t}function l(t){if(!t)return!1;var e=t.length;if(e<9)return!1;if(95!==t.charCodeAt(e-1)||95!==t.charCodeAt(e-2)||111!==t.charCodeAt(e-3)||116!==t.charCodeAt(e-4)||111!==t.charCodeAt(e-5)||114!==t.charCodeAt(e-6)||112!==t.charCodeAt(e-7)||95!==t.charCodeAt(e-8)||95!==t.charCodeAt(e-9))return!1;for(var i=e-10;i>=0;i--)if(36!==t.charCodeAt(i))return!1;return!0}function u(t,e){return t===e?0:null===t?1:null===e?-1:t>e?1:-1}t.toSetString=o?h:function(t){return l(t)?"$"+t:t},t.fromSetString=o?h:function(t){return l(t)?t.slice(1):t},t.compareByOriginalPositions=function(t,e,i){var s=u(t.source,e.source);return 0!==s||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)||i||0!==(s=t.generatedColumn-e.generatedColumn)||0!==(s=t.generatedLine-e.generatedLine)?s:u(t.name,e.name)},t.compareByGeneratedPositionsDeflated=function(t,e,i){var s=t.generatedLine-e.generatedLine;return 0!==s||0!==(s=t.generatedColumn-e.generatedColumn)||i||0!==(s=u(t.source,e.source))||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)?s:u(t.name,e.name)},t.compareByGeneratedPositionsInflated=function(t,e){var i=t.generatedLine-e.generatedLine;return 0!==i||0!==(i=t.generatedColumn-e.generatedColumn)||0!==(i=u(t.source,e.source))||0!==(i=t.originalLine-e.originalLine)||0!==(i=t.originalColumn-e.originalColumn)?i:u(t.name,e.name)},t.parseSourceMapInput=function(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))},t.computeSourceURL=function(t,e,i){if(e=e||"",t&&("/"!==t[t.length-1]&&"/"!==e[0]&&(t+="/"),e=t+e),i){var o=s(i);if(!o)throw new Error("sourceMapURL could not be parsed");if(o.path){var h=o.path.lastIndexOf("/");h>=0&&(o.path=o.path.substring(0,h+1))}e=a(r(o),e)}return n(e)}}(as)),as}var hs,ls={};function us(){if(hs)return ls;hs=1;var t=os(),e=Object.prototype.hasOwnProperty,i="undefined"!=typeof Map;function s(){this._array=[],this._set=i?new Map:Object.create(null)}return s.fromArray=function(t,e){for(var i=new s,r=0,n=t.length;r=0)return r}else{var n=t.toSetString(s);if(e.call(this._set,n))return this._set[n]}throw new Error('"'+s+'" is not in the set.')},s.prototype.at=function(t){if(t>=0&&tr||n==r&&o>=a||t.compareByGeneratedPositionsInflated(i,s)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},e.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},ps.MappingList=e,ps}function fs(){if(ds)return ts;ds=1;var t=rs(),e=os(),i=us().ArraySet,s=gs().MappingList;function r(t){t||(t={}),this._file=e.getArg(t,"file",null),this._sourceRoot=e.getArg(t,"sourceRoot",null),this._skipValidation=e.getArg(t,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new s,this._sourcesContents=null}return r.prototype._version=3,r.fromSourceMap=function(t){var i=t.sourceRoot,s=new r({file:t.file,sourceRoot:i});return t.eachMapping((function(t){var r={generated:{line:t.generatedLine,column:t.generatedColumn}};null!=t.source&&(r.source=t.source,null!=i&&(r.source=e.relative(i,r.source)),r.original={line:t.originalLine,column:t.originalColumn},null!=t.name&&(r.name=t.name)),s.addMapping(r)})),t.sources.forEach((function(r){var n=r;null!==i&&(n=e.relative(i,r)),s._sources.has(n)||s._sources.add(n);var a=t.sourceContentFor(r);null!=a&&s.setSourceContent(r,a)})),s},r.prototype.addMapping=function(t){var i=e.getArg(t,"generated"),s=e.getArg(t,"original",null),r=e.getArg(t,"source",null),n=e.getArg(t,"name",null);this._skipValidation||this._validateMapping(i,s,r,n),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:i.line,generatedColumn:i.column,originalLine:null!=s&&s.line,originalColumn:null!=s&&s.column,source:r,name:n})},r.prototype.setSourceContent=function(t,i){var s=t;null!=this._sourceRoot&&(s=e.relative(this._sourceRoot,s)),null!=i?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[e.toSetString(s)]=i):this._sourcesContents&&(delete this._sourcesContents[e.toSetString(s)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},r.prototype.applySourceMap=function(t,s,r){var n=s;if(null==s){if(null==t.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=t.file}var a=this._sourceRoot;null!=a&&(n=e.relative(a,n));var o=new i,h=new i;this._mappings.unsortedForEach((function(i){if(i.source===n&&null!=i.originalLine){var s=t.originalPositionFor({line:i.originalLine,column:i.originalColumn});null!=s.source&&(i.source=s.source,null!=r&&(i.source=e.join(r,i.source)),null!=a&&(i.source=e.relative(a,i.source)),i.originalLine=s.line,i.originalColumn=s.column,null!=s.name&&(i.name=s.name))}var l=i.source;null==l||o.has(l)||o.add(l);var u=i.name;null==u||h.has(u)||h.add(u)}),this),this._sources=o,this._names=h,t.sources.forEach((function(i){var s=t.sourceContentFor(i);null!=s&&(null!=r&&(i=e.join(r,i)),null!=a&&(i=e.relative(a,i)),this.setSourceContent(i,s))}),this)},r.prototype._validateMapping=function(t,e,i,s){if(e&&"number"!=typeof e.line&&"number"!=typeof e.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0)||e||i||s)&&!(t&&"line"in t&&"column"in t&&e&&"line"in e&&"column"in e&&t.line>0&&t.column>=0&&e.line>0&&e.column>=0&&i))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:i,original:e,name:s}))},r.prototype._serializeMappings=function(){for(var i,s,r,n,a=0,o=1,h=0,l=0,u=0,c=0,d="",p=this._mappings.toArray(),g=0,f=p.length;g0){if(!e.compareByGeneratedPositionsInflated(s,p[g-1]))continue;i+=","}i+=t.encode(s.generatedColumn-a),a=s.generatedColumn,null!=s.source&&(n=this._sources.indexOf(s.source),i+=t.encode(n-c),c=n,i+=t.encode(s.originalLine-1-l),l=s.originalLine-1,i+=t.encode(s.originalColumn-h),h=s.originalColumn,null!=s.name&&(r=this._names.indexOf(s.name),i+=t.encode(r-u),u=r)),d+=i}return d},r.prototype._generateSourcesContent=function(t,i){return t.map((function(t){if(!this._sourcesContents)return null;null!=i&&(t=e.relative(i,t));var s=e.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,s)?this._sourcesContents[s]:null}),this)},r.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(t.file=this._file),null!=this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},ts.SourceMapGenerator=r,ts}var vs,ms={},ys={};function bs(){return vs||(vs=1,function(t){function e(i,s,r,n,a,o){var h=Math.floor((s-i)/2)+i,l=a(r,n[h],!0);return 0===l?h:l>0?s-h>1?e(h,s,r,n,a,o):o==t.LEAST_UPPER_BOUND?s1?e(i,h,r,n,a,o):o==t.LEAST_UPPER_BOUND?h:i<0?-1:i}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(i,s,r,n){if(0===s.length)return-1;var a=e(-1,s.length,i,s,r,n||t.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===r(s[a],s[a-1],!0);)--a;return a}}(ys)),ys}var xs,Cs,ks={};function Ss(){if(xs)return ks;function t(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function e(i,s,r,n){if(r=0){var o=this._originalMappings[a];if(void 0===i.column)for(var h=o.originalLine;o&&o.originalLine===h;)n.push({line:t.getArg(o,"generatedLine",null),column:t.getArg(o,"generatedColumn",null),lastColumn:t.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a];else for(var l=o.originalColumn;o&&o.originalLine===s&&o.originalColumn==l;)n.push({line:t.getArg(o,"generatedLine",null),column:t.getArg(o,"generatedColumn",null),lastColumn:t.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a]}return n},ms.SourceMapConsumer=n,a.prototype=Object.create(n.prototype),a.prototype.consumer=n,a.prototype._findSourceIndex=function(e){var i,s=e;if(null!=this.sourceRoot&&(s=t.relative(this.sourceRoot,s)),this._sources.has(s))return this._sources.indexOf(s);for(i=0;i1&&(n.source=f+h[1],f+=h[1],n.originalLine=p+h[2],p=n.originalLine,n.originalLine+=1,n.originalColumn=g+h[3],g=n.originalColumn,h.length>4&&(n.name=v+h[4],v+=h[4])),k.push(n),"number"==typeof n.originalLine&&C.push(n)}r(k,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=k,r(C,t.compareByOriginalPositions),this.__originalMappings=C},a.prototype._findMapping=function(t,i,s,r,n,a){if(t[s]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[s]);if(t[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[r]);return e.search(t,i,n,a)},a.prototype.computeColumnSpans=function(){for(var t=0;t=0){var r=this._generatedMappings[s];if(r.generatedLine===i.generatedLine){var a=t.getArg(r,"source",null);null!==a&&(a=this._sources.at(a),a=t.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var o=t.getArg(r,"name",null);return null!==o&&(o=this._names.at(o)),{source:a,line:t.getArg(r,"originalLine",null),column:t.getArg(r,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(t){return null==t}))},a.prototype.sourceContentFor=function(e,i){if(!this.sourcesContent)return null;var s=this._findSourceIndex(e);if(s>=0)return this.sourcesContent[s];var r,n=e;if(null!=this.sourceRoot&&(n=t.relative(this.sourceRoot,n)),null!=this.sourceRoot&&(r=t.urlParse(this.sourceRoot))){var a=n.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!r.path||"/"==r.path)&&this._sources.has("/"+n))return this.sourcesContent[this._sources.indexOf("/"+n)]}if(i)return null;throw new Error('"'+n+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(e){var i=t.getArg(e,"source");if((i=this._findSourceIndex(i))<0)return{line:null,column:null,lastColumn:null};var s={source:i,originalLine:t.getArg(e,"line"),originalColumn:t.getArg(e,"column")},r=this._findMapping(s,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,t.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var a=this._originalMappings[r];if(a.source===s.source)return{line:t.getArg(a,"generatedLine",null),column:t.getArg(a,"generatedColumn",null),lastColumn:t.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},ms.BasicSourceMapConsumer=a,h.prototype=Object.create(n.prototype),h.prototype.constructor=n,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:function(){for(var t=[],e=0;e=0;e--)this.prepend(t[e]);else{if(!t[s]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);this.children.unshift(t)}return this},r.prototype.walk=function(t){for(var e,i=0,r=this.children.length;i0){for(e=[],i=0;i0&&(i+=", "+s.join(", "));var r=0;Object.keys(this.aliases).forEach((function(t){var s=e.aliases[t];s.children&&s.referenceCount>1&&(i+=", alias"+ ++r+"="+t,s.children[0]="alias"+r)})),this.lookupPropertyFunctionIsUsed&&(i+=", "+this.lookupPropertyFunctionVarDeclaration());var n=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths");var a=this.mergeSource(i);return t?(n.push(a),Function.apply(this,n)):this.source.wrap(["function(",n.join(","),") {\n ",a,"}"])},mergeSource:function(t){var e=this.environment.isSimple,i=!this.forceBuffer,s=void 0,r=void 0,n=void 0,a=void 0;return this.source.each((function(t){t.appendToBuffer?(n?t.prepend(" + "):n=t,a=t):(n&&(r?n.prepend("buffer += "):s=!0,a.add(";"),n=a=void 0),r=!0,e||(i=!1))})),i?n?(n.prepend("return "),a.add(";")):r||this.source.push('return "";'):(t+=", buffer = "+(s?"":this.initializeBuffer()),n?(n.prepend("return buffer + "),a.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(s?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(t){var e=this.aliasable("container.hooks.blockHelperMissing"),i=[this.contextName(0)];this.setupHelperArgs(t,0,i);var s=this.popStack();i.splice(1,0,s),this.push(this.source.functionCall(e,"call",i))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),e=[this.contextName(0)];this.setupHelperArgs("",0,e,!0),this.flushInline();var i=this.topStack();e.splice(1,0,i),this.pushSource(["if (!",this.lastHelper,") { ",i," = ",this.source.functionCall(t,"call",e),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack((function(t){return[" != null ? ",t,' : ""']})),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,e,i,s){var r=0;s||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(t[r++])),this.resolvePath("context",t,r,e,i)},lookupBlockParam:function(t,e){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",e,1)},lookupData:function(t,e,i){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",e,0,!0,i)},resolvePath:function(t,e,i,s,r){var n=this;if(this.options.strict||this.options.assumeObjects)this.push(function(t,e,i,s,r){var n=e.popStack(),a=i.length;t&&a--;for(;sthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,i=t.length;ee[t],set(i){e[t]=i},enumerable:!0,configurable:!0}),this}setTreeGroup(t){return this.groupName=t,this.eventSheetGroup=this.eventSheetManager.getTreeGroup(t),this}setActive(t){return void 0===t&&(t=!0),this.active=t,this}get roundComplete(){return 2===this.roundState}set roundComplete(t){this.roundState=t?2:1}setConditionEnable(t=!0){var e=t?void 0:0;return this.root.setSelectChildIndex(e),this}start(t,e){if(1===this.roundState)return!1;var i=3!==this.getState(t);if(i&&this.resetState(t),this.roundState=1,super.tick(t,e),i){var s=this.root.getNodeMemory(this.ticker);this.conditionPassed=0===s.$runningChild}return!0}tick(t,e){var i=super.tick(t,e);return 3!==i&&(this.roundState=2,this.conditionPassed&&this.properties.once&&this.setActive(!1)),i}abort(t,e){this.roundState=0,super.abort(t,e)}}var Ns={exports:{}};!function(t,e){!function(t){function e(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,s=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function a(t){return c[t]}t.defaults=n();var o=/[&<>"']/,h=new RegExp(o.source,"g"),l=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,u=new RegExp(l.source,"g"),c={"&":"&","<":"<",">":">",'"':""","'":"'"};function d(t,e){if(e){if(o.test(t))return t.replace(h,a)}else if(l.test(t))return t.replace(u,a);return t}var p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function g(t){return t.replace(p,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}var f=/(^|[^\[])\^/g;function v(t,e){t="string"==typeof t?t:t.source,e=e||"";var i={replace:function(e,s){return s=(s=s.source||s).replace(f,"$1"),t=t.replace(e,s),i},getRegex:function(){return new RegExp(t,e)}};return i}var m=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function b(t,e,i){if(t){try{s=decodeURIComponent(g(i)).replace(m,"").toLowerCase()}catch(t){return null}if(0===s.indexOf("javascript:")||0===s.indexOf("vbscript:")||0===s.indexOf("data:"))return null}var s;e&&!y.test(i)&&(t=i,x[" "+(s=e)]||(C.test(s)?x[" "+s]=s+"/":x[" "+s]=E(s,"/",!0)),e=-1===(s=x[" "+s]).indexOf(":"),i="//"===t.substring(0,2)?e?t:s.replace(k,"$1")+t:"/"===t.charAt(0)?e?t:s.replace(S,"$1")+t:s+t);try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i}var x={},C=/^[^:]+:\/*[^/]*$/,k=/^([^:]+:)[\s\S]*$/,S=/^([^:]+:\/*[^/]*)[\s\S]*$/,w={exec:function(){}};function _(t,e){var i=t.replace(/\|/g,(function(t,e,i){for(var s=!1,r=e;0<=--r&&"\\"===i[r];)s=!s;return s?"|":" |"})).split(/ \|/),s=0;if(i[0].trim()||i.shift(),0e)i.splice(e);else for(;i.length>=1,t+=t;return i+t}function O(t,e,i,s){var r=e.href,n=(e=e.title?d(e.title):null,t[1].replace(/\\([\[\]])/g,"$1"));return"!"!==t[0].charAt(0)?(s.state.inLink=!0,t={type:"link",raw:i,href:r,title:e,text:n,tokens:s.inlineTokens(n)},s.state.inLink=!1,t):{type:"image",raw:i,href:r,title:e,text:d(n)}}var P=function(){function e(e){this.options=e||t.defaults}var i=e.prototype;return i.space=function(t){if((t=this.rules.block.newline.exec(t))&&0=r.length?t.slice(r.length):t})).join("\n")),{type:"code",raw:e,lang:t[2]&&t[2].trim().replace(this.rules.inline._escapes,"$1"),text:i}},i.heading=function(t){var e,i;if(t=this.rules.block.heading.exec(t))return e=t[2].trim(),/#$/.test(e)&&(i=E(e,"#"),!this.options.pedantic&&i&&!/ $/.test(i)||(e=i.trim())),{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}},i.hr=function(t){if(t=this.rules.block.hr.exec(t))return{type:"hr",raw:t[0]}},i.blockquote=function(t){var e,i,s;if(t=this.rules.block.blockquote.exec(t))return e=t[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top,this.lexer.state.top=!0,s=this.lexer.blockTokens(e),this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:e}},i.list=function(t){var e=this.rules.block.list.exec(t);if(e){var i,s,r,n,a,o,h,l,u,c,d,p=1<(f=e[1].trim()).length,g={type:"list",raw:"",ordered:p,start:p?+f.slice(0,-1):"",loose:!1,items:[]},f=p?"\\d{1,9}\\"+f.slice(-1):"\\"+f;this.options.pedantic&&(f=p?f:"[*+-]");for(var v=new RegExp("^( {0,3}"+f+")((?:[\t ][^\\n]*)?(?:\\n|$))");t&&(d=!1,e=v.exec(t))&&!this.rules.block.hr.test(t);){if(i=e[0],t=t.substring(i.length),h=e[2].split("\n",1)[0].replace(/^\t+/,(function(t){return" ".repeat(3*t.length)})),l=t.split("\n",1)[0],this.options.pedantic?(n=2,c=h.trimLeft()):(n=e[2].search(/[^ ]/),c=h.slice(n=4=n||!l.trim())c+="\n"+l.slice(n);else{if(a)break;if(4<=h.search(/[^ ]/))break;if(b.test(h))break;if(x.test(h))break;if(y.test(h))break;c+="\n"+l}a||l.trim()||(a=!0),i+=u+"\n",t=t.substring(u.length+1),h=l.slice(n)}g.loose||(o?g.loose=!0:/\n *\n *$/.test(i)&&(o=!0)),this.options.gfm&&(s=/^\[[ xX]\] /.exec(c))&&(r="[ ] "!==s[0],c=c.replace(/^\[[ xX]\] +/,"")),g.items.push({type:"list_item",raw:i,task:!!s,checked:r,loose:!1,text:c}),g.raw+=i}g.items[g.items.length-1].raw=i.trimRight(),g.items[g.items.length-1].text=c.trimRight(),g.raw=g.raw.trimRight();for(var C,k=g.items.length,S=0;S$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=t[3]&&t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"),{type:"def",tag:e,raw:t[0],href:i,title:s}},i.table=function(t){if(t=this.rules.block.table.exec(t)){var e={type:"table",header:_(t[1]).map((function(t){return{text:t}})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];for(var i,s,r,n=e.align.length,a=0;a/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):d(t[0]):t[0]}},i.link=function(t){if(t=this.rules.inline.link.exec(t)){var e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;var i=E(e.slice(0,-1),"\\");if((e.length-i.length)%2==0)return}else i=function(t,e){if(-1!==t.indexOf(e[1]))for(var i=t.length,s=0,r=0;r$/.test(e)?i.slice(1):i.slice(1,-1):i)&&i.replace(this.rules.inline._escapes,"$1"),title:r&&r.replace(this.rules.inline._escapes,"$1")},t[0],this.lexer)}},i.reflink=function(t,e){var i;if(i=(i=this.rules.inline.reflink.exec(t))||this.rules.inline.nolink.exec(t))return(t=e[(t=(i[2]||i[1]).replace(/\s+/g," ")).toLowerCase()])?O(i,t,i[0],this.lexer):{type:"text",raw:e=i[0].charAt(0),text:e}},i.emStrong=function(t,e,i){void 0===i&&(i="");var s=this.rules.inline.emStrong.lDelim.exec(t);if(s&&(!s[3]||!i.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDF50-\uDF59\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDCD0-\uDCEB\uDCF0-\uDCF9\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/))&&(!s[1]&&!s[2]||""===i||this.rules.inline.punctuation.exec(i))){var r=s[0].length-1,n=r,a=0,o="*"===s[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(o.lastIndex=0,e=e.slice(-1*t.length+r);null!=(s=o.exec(e));){var h,l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6];if(l)if(h=l.length,s[3]||s[4])n+=h;else if((s[5]||s[6])&&r%3&&!((r+h)%3))a+=h;else if(!(0<(n-=h)))return h=Math.min(h,h+n+a),l=t.slice(0,r+s.index+(s[0].length-l.length)+h),Math.min(r,h)%2?(h=l.slice(1,-1),{type:"em",raw:l,text:h,tokens:this.lexer.inlineTokens(h)}):(h=l.slice(2,-2),{type:"strong",raw:l,text:h,tokens:this.lexer.inlineTokens(h)})}}},i.codespan=function(t){var e,i,s;if(t=this.rules.inline.code.exec(t))return s=t[2].replace(/\n/g," "),e=/[^ ]/.test(s),i=/^ /.test(s)&&/ $/.test(s),s=d(s=e&&i?s.substring(1,s.length-1):s,!0),{type:"codespan",raw:t[0],text:s}},i.br=function(t){if(t=this.rules.inline.br.exec(t))return{type:"br",raw:t[0]}},i.del=function(t){if(t=this.rules.inline.del.exec(t))return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}},i.autolink=function(t,e){var i;if(t=this.rules.inline.autolink.exec(t))return e="@"===t[2]?"mailto:"+(i=d(this.options.mangle?e(t[1]):t[1])):i=d(t[1]),{type:"link",raw:t[0],text:i,href:e,tokens:[{type:"text",raw:i,text:i}]}},i.url=function(t,e){var i,s,r,n;if(i=this.rules.inline.url.exec(t)){if("@"===i[2])r="mailto:"+(s=d(this.options.mangle?e(i[0]):i[0]));else{for(;n=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0],n!==i[0];);s=d(i[0]),r="www."===i[1]?"http://"+i[0]:i[0]}return{type:"link",raw:i[0],text:s,href:r,tokens:[{type:"text",raw:s,text:s}]}}},i.inlineText=function(t,e){if(t=this.rules.inline.text.exec(t))return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):d(t[0]):t[0]:d(this.options.smartypants?e(t[0]):t[0]),{type:"text",raw:t[0],text:e}},e}(),M={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:w,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/},D=(M.def=v(M.def).replace("label",M._label).replace("title",M._title).getRegex(),M.bullet=/(?:[*+-]|\d{1,9}[.)])/,M.listItemStart=v(/^( *)(bull) */).replace("bull",M.bullet).getRegex(),M.list=v(M.list).replace(/bull/g,M.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+M.def.source+")").getRegex(),M._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",M._comment=/|$)/,M.html=v(M.html,"i").replace("comment",M._comment).replace("tag",M._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),M.paragraph=v(M._paragraph).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.blockquote=v(M.blockquote).replace("paragraph",M.paragraph).getRegex(),M.normal=i({},M),M.gfm=i({},M.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),M.gfm.table=v(M.gfm.table).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.gfm.paragraph=v(M._paragraph).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",M.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.pedantic=i({},M.normal,{html:v("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",M._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:w,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:v(M.normal._paragraph).replace("hr",M.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",M.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()}),{escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:w,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:w,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",D.punctuation=v(D.punctuation).replace(/punctuation/g,D._punctuation).getRegex(),D.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,D.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,D._comment=v(M._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),D.emStrong.lDelim=v(D.emStrong.lDelim).replace(/punct/g,D._punctuation).getRegex(),D.emStrong.rDelimAst=v(D.emStrong.rDelimAst,"g").replace(/punct/g,D._punctuation).getRegex(),D.emStrong.rDelimUnd=v(D.emStrong.rDelimUnd,"g").replace(/punct/g,D._punctuation).getRegex(),D._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,D._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,D._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,D.autolink=v(D.autolink).replace("scheme",D._scheme).replace("email",D._email).getRegex(),D._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,D.tag=v(D.tag).replace("comment",D._comment).replace("attribute",D._attribute).getRegex(),D._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,D._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,D._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,D.link=v(D.link).replace("label",D._label).replace("href",D._href).replace("title",D._title).getRegex(),D.reflink=v(D.reflink).replace("label",D._label).replace("ref",M._label).getRegex(),D.nolink=v(D.nolink).replace("ref",M._label).getRegex(),D.reflinkSearch=v(D.reflinkSearch,"g").replace("reflink",D.reflink).replace("nolink",D.nolink).getRegex(),D.normal=i({},D),D.pedantic=i({},D.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:v(/^!?\[(label)\]\((.*?)\)/).replace("label",D._label).getRegex(),reflink:v(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D._label).getRegex()}),D.gfm=i({},D.normal,{escape:v(D.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\'+(i?t:d(t,!0))+"\n":"
    "+(i?t:d(t,!0))+"
    \n"},i.blockquote=function(t){return"
    \n"+t+"
    \n"},i.html=function(t,e){return t},i.heading=function(t,e,i,s){return this.options.headerIds?"'+t+"\n":""+t+"\n"},i.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},i.list=function(t,e,i){var s=e?"ol":"ul";return"<"+s+(e&&1!==i?' start="'+i+'"':"")+">\n"+t+"\n"},i.listitem=function(t){return"
  • "+t+"
  • \n"},i.checkbox=function(t){return" "},i.paragraph=function(t){return"

    "+t+"

    \n"},i.table=function(t,e){return"\n\n"+t+"\n"+(e=e&&""+e+"")+"
    \n"},i.tablerow=function(t){return"\n"+t+"\n"},i.tablecell=function(t,e){var i=e.header?"th":"td";return(e.align?"<"+i+' align="'+e.align+'">':"<"+i+">")+t+"\n"},i.strong=function(t){return""+t+""},i.em=function(t){return""+t+""},i.codespan=function(t){return""+t+""},i.br=function(){return this.options.xhtml?"
    ":"
    "},i.del=function(t){return""+t+""},i.link=function(t,e,i){return null===(t=b(this.options.sanitize,this.options.baseUrl,t))?i:(t='"+i+"")},i.image=function(t,e,i){return null===(t=b(this.options.sanitize,this.options.baseUrl,t))?i:(t=''+i+'":">"))},i.text=function(t){return t},e}(),B=function(){function t(){}var e=t.prototype;return e.strong=function(t){return t},e.em=function(t){return t},e.codespan=function(t){return t},e.del=function(t){return t},e.html=function(t){return t},e.text=function(t){return t},e.link=function(t,e,i){return""+i},e.image=function(t,e,i){return""+i},e.br=function(){return""},t}(),I=function(){function t(){this.seen={}}var e=t.prototype;return e.serialize=function(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},e.getNextSafeSlug=function(t,e){var i=t,s=0;if(this.seen.hasOwnProperty(i))for(s=this.seen[t];i=t+"-"+ ++s,this.seen.hasOwnProperty(i););return e||(this.seen[t]=s,this.seen[i]=0),i},e.slug=function(t,e){return void 0===e&&(e={}),t=this.serialize(t),this.getNextSafeSlug(t,e.dryrun)},t}(),j=function(){function e(e){this.options=e||t.defaults,this.options.renderer=this.options.renderer||new F,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new B,this.slugger=new I}e.parse=function(t,i){return new e(i).parse(t)},e.parseInline=function(t,i){return new e(i).parseInline(t)};var i=e.prototype;return i.parse=function(t,e){void 0===e&&(e=!0);for(var i,s,r,n,a,o,h,l,u,c,d,p,f,v,m,y,b="",x=t.length,C=0;C",o?Promise.resolve(e):h?void h(null,e):e;if(o)return Promise.reject(t);if(!h)throw t;h(t)});if(null==s)return c(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof s)return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(u=n,(l=r)&&!l.silent&&(u&&console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"),(l.sanitize||l.sanitizer)&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"),!l.highlight&&"language-"===l.langPrefix||console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."),l.mangle&&console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."),l.baseUrl&&console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."),l.smartypants&&console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants."),l.xhtml&&console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml."),l.headerIds||l.headerPrefix)&&console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`."),r.hooks&&(r.hooks.options=r),n){var p,g=r.highlight;try{r.hooks&&(s=r.hooks.preprocess(s)),p=t(s,r)}catch(s){return c(s)}var f,v=function(t){var i;if(!t)try{r.walkTokens&&G.walkTokens(p,r.walkTokens),i=e(p,r),r.hooks&&(i=r.hooks.postprocess(i))}catch(i){t=i}return r.highlight=g,t?c(t):n(null,i)};return!g||g.length<3?v():(delete r.highlight,p.length?(f=0,G.walkTokens(p,(function(t){"code"===t.type&&(f++,setTimeout((function(){g(t.text,t.lang,(function(e,i){if(e)return v(e);null!=i&&i!==t.text&&(t.text=i,t.escaped=!0),0==--f&&v()}))}),0))})),void(0===f&&v())):v())}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(s):s).then((function(e){return t(e,r)})).then((function(t){return r.walkTokens?Promise.all(G.walkTokens(t,r.walkTokens)).then((function(){return t})):t})).then((function(t){return e(t,r)})).then((function(t){return r.hooks?r.hooks.postprocess(t):t})).catch(c);try{r.hooks&&(s=r.hooks.preprocess(s));var m=t(s,r),y=(r.walkTokens&&G.walkTokens(m,r.walkTokens),e(m,r));return r.hooks?r.hooks.postprocess(y):y}catch(s){return c(s)}}}function G(t,e,i){return N(R.lex,j.parse)(t,e,i)}z.passThroughHooks=new Set(["preprocess","postprocess"]),G.options=G.setOptions=function(e){return G.defaults=i({},G.defaults,e),e=G.defaults,t.defaults=e,G},G.getDefaults=n,G.defaults=t.defaults,G.use=function(){for(var t=G.defaults.extensions||{renderers:{},childTokens:{}},e=arguments.length,s=new Array(e),r=0;r0?(n=new z,t.paragraphs.length>0&&n.addChild(sr(t,e)),rr(t.children,e,n)):n=sr(t,e),n;switch(u.type){case"if":var c=new j({title:"[if]"}),d=nr(u.match[1],t);try{f=new V({expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({expression:"false"})}t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),c.addChild(f);var p=new F;return c.addChild(p),c;case"else":case"else if":var g=u.type;d="else"===g?"true":nr(u.match[1],t);try{f=new V({title:`[${g}]`,expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({title:`[${g}]`,expression:"false"})}return t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),f;case"while":var f,v=new $({title:"[while]",returnSuccess:!0});d=nr(u.match[1],t);try{f=new V({title:"[while-IF]",expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({title:"[while-IF]",expression:"false"})}return t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),v.addChild(f),v;case"repeat":var m=(l=u.match[1]).startsWith("#(")&&l.endsWith(")")?l.substring(2,l.length-1):l,y=new W({title:"[repeat]",maxLoop:m});return t.children.length>0?y.addChild(rr(t.children,e)):y.addChild(sr(t,e)),y;default:console.error(`Missing ${u.type}'s handler`)}},nr=function(t,e){var i=t.trim();return""===i&&(i=Js(e)),i},ar=function(t,e,{groupName:i,lineBreak:s="\\",commentLineStart:r="//",parallel:n=!1,active:a=!0,once:o=!1}={}){var h=function(t){for(var e=Gs.lexer(t),i=null,s=[],r=0;r0?v.addChild(rr(c[0],p)):v.addChild(new F),f.addChild(v),g};class or extends Is{boot(){super.boot(),this.scene&&this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(t){if(!this.isShutdown)return this.scene&&this.scene.sys.events.off("shutdown",this.destroy,this),super.shutdown(t),this}addEventSheet(t,e,i){"string"!=typeof e&&(i=e,e=void 0),void 0===e&&(e=this.defaultTreeGroupName),void 0===i&&(i={});var{lineBreak:s="\\",commentLineStart:r="//",parallel:n=this.parallel,groupName:e=e}=i,a=ar(this,t,{groupName:e,lineBreak:s,commentLineStart:r,parallel:n});return this.addTree(a,a.groupName),this}} /* @license Papa Parse v5.4.1 https://github.com/mholt/PapaParse License: MIT */ -!function(t){t.exports=function t(){var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,s=e.IS_PAPA_WORKER||!1,r={},n=0,a={parse:function(i,s){var o=(s=s||{}).dynamicTyping||!1;if(C(o)&&(s.dynamicTypingFunction=o,o={}),s.dynamicTyping=o,s.transform=!!C(s.transform)&&s.transform,s.worker&&a.WORKERS_SUPPORTED){var h=function(){if(!a.WORKERS_SUPPORTED)return!1;var i,s,o=(i=e.URL||e.webkitURL||null,s=t.toString(),a.BLOB_URL||(a.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",s,")();"],{type:"text/javascript"})))),h=new e.Worker(o);return h.onmessage=v,h.id=n++,r[h.id]=h}();return h.userStep=s.step,h.userChunk=s.chunk,h.userComplete=s.complete,h.userError=s.error,s.step=C(s.step),s.chunk=C(s.chunk),s.complete=C(s.complete),s.error=C(s.error),delete s.worker,void h.postMessage({input:i,config:s,workerId:h.id})}var p=null;return a.NODE_STREAM_INPUT,"string"==typeof i?(i=function(t){return 65279===t.charCodeAt(0)?t.slice(1):t}(i),p=s.download?new l(s):new c(s)):!0===i.readable&&C(i.read)&&C(i.on)?p=new d(s):(e.File&&i instanceof File||i instanceof Object)&&(p=new u(s)),p.stream(i)},unparse:function(t,e){var i=!1,s=!0,r=",",n="\r\n",o='"',h=o+o,l=!1,u=null,c=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||a.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(l=e.skipEmptyLines),"string"==typeof e.newline&&(n=e.newline),"string"==typeof e.quoteChar&&(o=e.quoteChar),"boolean"==typeof e.header&&(s=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");u=e.columns}void 0!==e.escapeChar&&(h=e.escapeChar+o),("boolean"==typeof e.escapeFormulae||e.escapeFormulae instanceof RegExp)&&(c=e.escapeFormulae instanceof RegExp?e.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var d=new RegExp(g(o),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,l);if("object"==typeof t[0])return p(u||Object.keys(t[0]),t,l)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||u),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],l);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var a="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var o=Array.isArray(t)&&0=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(C(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!C(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){C(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(C(t.step)){var y=t.step;t.step=function(e){if(m=e,S())k();else{if(k(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function k(){return m&&s&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)C(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return V(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||k.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),W();if(z===f-1)return W(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==B&&B=o)return V(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return W();function Y(t){x.push(t),w=u}function X(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function W(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,Y(S),b&&H()),V()}function $(t){u=t,Y(S),S=[],I=a.indexOf(s,u)}function V(t){return{data:x,errors:k,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function H(){n(V()),x=[],k=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(C(i.userStep)){for(var a=0;a>16&255},mr=function(t){return t>>8&255},yr=function(t){return 255&t};const br=Phaser.Events.EventEmitter;var xr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Cr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Cr={},kr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=xr),function(t){if(t.events)return t;var e=new br,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},wr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},_r=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Or(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},Ir=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},jr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const zr=Phaser.Geom.Rectangle,Nr=Phaser.Math.Vector2,Gr=Phaser.Math.RotateAround,Yr=Phaser.GameObjects.Container;var Xr=function(t,e){if(void 0===e?e=new zr:!0===e&&(void 0===Wr&&(Wr=new zr),e=Wr),t.getBounds&&!(t instanceof Yr))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();$r(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Vr(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Hr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else $r(t,e),i=e.x,s=e.y,Vr(t,e),r=e.x,n=e.y,Hr(t,e),a=e.x,o=e.y,Ur(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Wr=void 0,$r=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY,Kr(t,e,i))},Vr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getTopRight?t.getTopRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY,Kr(t,e,i))},Hr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY+jr(t),Kr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY+jr(t),Kr(t,e,i))},qr=void 0,Kr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Gr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const Jr=Phaser.Utils.Objects.GetValue;var Zr=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Jr(i,"color"),r=Jr(i,"lineWidth"),n=Jr(i,"fillColor"),a=Jr(i,"fillAlpha",1),o=Jr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?qn:Un,this.repeatCounter=0,this}stop(){return this.state=Hn,this}update(t,e){this.state!==Hn&&this.state!==Jn&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Kn)):(this.nowTime=this.duration,this.state=Jn):this.nowTime>=0&&(this.state=qn))}get t(){var t;switch(this.state){case Hn:case Un:case Kn:t=0;break;case qn:t=this.nowTime/this.duration;break;case Jn:t=1}return $n(t,0,1)}set t(t){(t=$n(t,-1,1))<0?(this.state=Un,this.nowTime=-this.delay*t):(this.state=qn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Hn}get isDelay(){return this.state===Un}get isCountDown(){return this.state===qn}get isRunning(){return this.state===Un||this.state===qn}get isDone(){return this.state===Jn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Hn=0,Un=1,qn=2,Kn=3,Jn=-1;class Zn extends Yn{constructor(t,e){super(t,e),this.timer=new Vn}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Qn=Phaser.Utils.Objects.GetValue,ta=Phaser.Utils.Objects.GetAdvancedValue,ea=Phaser.Tweens.Builders.GetEaseFunction;class ia extends Zn{resetFromJSON(t){return this.timer.resetFromJSON(Qn(t,"timer")),this.setEnable(Qn(t,"enable",!0)),this.setTarget(Qn(t,"target",this.parent)),this.setDelay(ta(t,"delay",0)),this.setDuration(ta(t,"duration",1e3)),this.setEase(Qn(t,"ease","Linear")),this.setRepeat(Qn(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ea(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const sa=Phaser.Sound.BaseSound;var ra=function(t){return t instanceof sa};const na=Phaser.Utils.Objects.GetValue,aa=Phaser.Utils.Objects.GetAdvancedValue,oa=Phaser.Math.Linear;let ha=class extends ia{constructor(t,e,i){ra(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(na(t,"mode",0)),this.setEnable(na(t,"enable",!0)),this.setVolumeRange(aa(t,"volume.start",this.parent.volume),aa(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=la[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=oa(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const la={stop:1,destroy:2};var ua=function(t,e,i,s,r){ra(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ha(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ca=function(t,e,i,s){ra(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ha(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const da=Phaser.Utils.Objects.GetValue;var pa={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:da(e,"loop",this.backgroundMusicLoop),mute:da(e,"mute",this.backgroundMusicMute),volume:da(e,"volume",this.backgroundMusicVolume),detune:da(e,"detune",0),rate:da(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&ua(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ca(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ga=Phaser.Utils.Objects.GetValue;var fa={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ga(e,"loop",this.backgroundMusicLoop),mute:ga(e,"mute",this.backgroundMusic2Mute),volume:ga(e,"volume",this.backgroundMusic2Volume),detune:ga(e,"detune",0),rate:ga(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&ua(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ca(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const va=Phaser.Utils.Array.Remove,ma=Phaser.Utils.Objects.GetValue;var ya={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:ma(e,"mute",this.soundEffectsMute),volume:ma(e,"volume",this.soundEffectsVolume),detune:ma(e,"detune",0),rate:ma(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&va(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&va(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&ua(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ca(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ca(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&ua(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ca(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ca(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Aa=Phaser.Utils.Objects.GetValue,La=new class extends Da{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Qa(this.delimiterLeft),e=Qa(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=$s:t||(t=so),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=ao),this.tagExpression=t,this}setValueExpression(t){return t||(t=ao),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==ao||this.valueExpression!==ao){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Qa(this.delimiterLeft),e=Qa(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=ro(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const ao="[^=]+";var oo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],ho=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},lo=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:ho(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},xo={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},Co={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},ko={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},So={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},wo=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return wo(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!wo(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Eo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const Wo=Phaser.GameObjects.Zone;let $o=class extends Wo{constructor(t){super(t,0,0,2,2),this.fullWindow=new Xo(this)}};const Vo="BG",Ho="SPRITE",Uo="TEXTBOX",qo="TITLE",Ko="CHOICE",Jo="NAMEINPUT";var Zo=!1,Qo=function(t){Zo||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return eh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return ih(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ihh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ehh(t).x,getChildLocalY:t=>hh(t).y};const wh=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=hh(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=hh(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return hh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return hh(t).rotation=wh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=hh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>hh(t).rotation},Eh={updateChildScale(t){var e=hh(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=hh(t),i=e.parent;return e.scaleX=kh(t.scaleX,i.scaleX),e.scaleY=kh(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=hh(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=hh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>hh(t).scaleX,getChildLocalScaleY:t=>hh(t).scaleY},Th={updateChildVisible(t){var e=hh(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=hh(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),hh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),hh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=hh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>hh(t).visible},Oh={updateChildAlpha(t){var e=hh(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=hh(t),i=e.parent;return e.alpha=kh(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return hh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=hh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>hh(t).alpha},Ph={updateChildActive(t){var e=hh(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return hh(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),hh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=hh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>hh(t).active},Mh={updateChildScrollFactor(t){var e=hh(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Dh={updateCameraFilter(t){var e=hh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Ah={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Lh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Rh={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Fh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Ih=Phaser.Utils.Array;var jh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,T):r(c,d,T),h&&c.add.existing(E),l){var O=b+k*_+a*k,P=x+S*w+o*S;E.setOrigin(a,o).setPosition(O,P).setScale(f,v).setRotation(m),Ml(E,b,x,m)}C.push(E)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(Nl.prototype,Ll);const Yl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Xl=Phaser.GameObjects.GetCalcMatrix;const Wl=Phaser.Renderer.Canvas.SetTransform;var $l={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Xl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},su=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const ru=Phaser.Geom.Polygon.Earcut;class nu extends Jl{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=ru(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&Ql(t,e,this,i,s,r),this.isStroked&&eu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ou=Phaser.Math.DegToRad;var hu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Bu(t,"tl",0),this.radiusTR=Bu(t,"tr",0),this.radiusBL=Bu(t,"bl",0),this.radiusBR=Bu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?hu(e,e,e,e,180,270,!1,r,t):hu(0,0,e,e,90,0,!0,r,t):au(0,0,t);(e=this.radiusTR)>0?this._convexTR?hu(i-e,e,e,e,270,360,!1,r,t):hu(i,0,e,e,180,90,!0,r,t):au(i,0,t);(e=this.radiusBR)>0?this._convexBR?hu(i-e,s-e,e,e,0,90,!1,r,t):hu(i,s,e,e,270,180,!0,r,t):au(i,s,t);(e=this.radiusBL)>0?this._convexBL?hu(e,s-e,e,e,90,180,!1,r,t):hu(0,s,e,e,360,270,!0,r,t):au(0,s,t);return t.push(t[0],t[1]),yu(this.x,this.y,t),super.updateData(),this}},triangle:class extends Jl{constructor(t,e,i,s,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(i,s),this.setP2(r,n)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,i,s,r){if(this.isFilled){var n=Iu(this.fillColor,this.fillAlpha*i),a=this.x0-s,o=this.y0-r,h=this.x1-s,l=this.y1-r,u=this.x2-s,c=this.y2-r,d=e.getX(a,o),p=e.getY(a,o),g=e.getX(h,l),f=e.getY(h,l),v=e.getX(u,c),m=e.getY(u,c);t.batchTri(d,p,g,f,v,m,n,n,n)}this.isStroked&&eu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.x1-e,r=this.y1-i,n=this.x2-e,a=this.y2-i,o=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(s,r),t.lineTo(n,a),t.lineTo(o,h),t.closePath(),this.isFilled&&(iu(t,this),t.fill()),this.isStroked&&(su(t,this),t.stroke())}}},zu=Phaser.Utils.Objects.GetValue,Nu=Phaser.Utils.Objects.IsPlainObject,Gu=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),pc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,cc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(gc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(gc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(gc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(gc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class vc extends Nl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=fc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},Nc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Gc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Nc(t));t=this.sections.join("\n");this.lines=zc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(Vc,Gc,Xc,$c);const Hc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Uc extends In{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=jc(this.parent),this.pageStartIndexes=[],this.lines=zc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Hc(t,"maxLines",void 0)),this.setPageBreak(Hc(t,"pageBreak","\f\n")),this.setText(Hc(t,"text","")),this.startLineIndex=Hc(t,"start",-1),this.endLineIndex=Hc(t,"end",void 0);var e=Hc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(jc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Uc.prototype,Vc);var qc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Wc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Nc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},Kc=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},Jc=function(t,e){for(var i=void 0,s=0;s0)l=Zc(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=Zc(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},td={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=Kc(this.parent,t);n=Jc(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)Qc.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(td,qc);const ed=Phaser.Utils.Objects.GetFastValue,id=Phaser.Utils.Objects.GetValue;class sd extends In{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(id(t,"wrap",!1)),this.setTypeMode(id(t,"typeMode",0)),this.setTypingSpeed(id(t,"speed",333)),this.setTextCallback=ed(t,"setTextCallback",null),this.setTextCallbackScope=ed(t,"setTextCallbackScope",null),this.setTypingContent(ed(t,"text","")),this.typingIndex=ed(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=ed(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=rd[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Nc(t);this.textWrapEnable&&(e=function(t,e){switch(jc(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=Kc(this.parent,this.text).length,this}onTyping(){var t=Qc.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Wc(this.parent,t):this.parent.setText(t)}}const rd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(sd.prototype,td);const nd=Phaser.Utils.Objects.GetValue;const ad={page:0,line:1};var od=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const hd=Phaser.Display.Align;var ld={center:hd.CENTER,left:hd.LEFT_CENTER,right:hd.RIGHT_CENTER,top:hd.TOP_CENTER,bottom:hd.BOTTOM_CENTER,"left-top":hd.TOP_LEFT,"top-left":hd.TOP_LEFT,"left-center":hd.LEFT_CENTER,"center-left":hd.LEFT_CENTER,"left-bottom":hd.BOTTOM_LEFT,"bottom-left":hd.BOTTOM_LEFT,"center-top":hd.TOP_CENTER,"top-center":hd.TOP_CENTER,"center-center":hd.CENTER,"center-bottom":hd.BOTTOM_CENTER,"bottom-center":hd.BOTTOM_CENTER,"right-top":hd.TOP_RIGHT,"top-right":hd.TOP_RIGHT,"right-center":hd.RIGHT_CENTER,"center-right":hd.RIGHT_CENTER,"right-bottom":hd.BOTTOM_RIGHT,"bottom-right":hd.BOTTOM_RIGHT},ud=function(){},cd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:ud,events:{once:ud}}},0,0,1,1);cd.setOrigin(0);var dd=0,pd=1,gd=2,fd=4,vd=6,md=8,yd=10,bd=12,xd=function(t){var e=jr(t);return t.y+e-e*t.originY},Cd=function(t){var e=Ir(t);return t.x-e*t.originX+.5*e},kd=function(t,e){var i=jr(t);return t.y=e-i+i*t.originY,t},Sd=function(t,e){var i=Ir(t),s=i*t.originX;return t.x=e+s-.5*i,t},wd=function(t){var e=Ir(t);return t.x-e*t.originX},_d=function(t,e){var i=Ir(t);return t.x=e+i*t.originX,t},Ed=function(t){var e=Ir(t);return t.x+e-e*t.originX},Td=function(t,e){var i=Ir(t);return t.x=e-i+i*t.originX,t},Od=function(t,e){var i=jr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Pd=function(t){var e=jr(t);return t.y-e*t.originY+.5*e},Md=function(t){var e=jr(t);return t.y-e*t.originY},Dd=function(t,e){var i=jr(t);return t.y=e+i*t.originY,t},Ad=[];Ad[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Sd(t,Cd(e)+i),kd(t,xd(e)+s),t},Ad[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),_d(t,wd(e)-i),kd(t,xd(e)+s),t},Ad[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Td(t,Ed(e)+i),kd(t,xd(e)+s),t},Ad[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Sd(t,e),Od(t,i)}(t,Cd(e)+i,Pd(e)+s),t},Ad[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),_d(t,wd(e)-i),Od(t,Pd(e)+s),t},Ad[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Td(t,Ed(e)+i),Od(t,Pd(e)+s),t},Ad[pd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Sd(t,Cd(e)+i),Dd(t,Md(e)-s),t},Ad[dd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),_d(t,wd(e)-i),Dd(t,Md(e)-s),t},Ad[gd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Td(t,Ed(e)+i),Dd(t,Md(e)-s),t};var Ld=function(t,e,i,s,r){return Ad[i](t,e,s,r)},Rd=function(t,e,i,s,r,n){cd.setPosition(e,i).setSize(s,r),Ld(t,cd,n)};const Fd=Phaser.Utils.Objects.GetValue,Bd=Phaser.GameObjects.Group,Id=Phaser.GameObjects.Container;var jd=function(t,e,i){return t.add.text(0,0,"")},zd=function(t,e){Array.isArray(t)||(t=[t]),void 0===e&&(e=[]);for(var i=0,s=t.length;i=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Qd=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const tp=/(\S+)\[(\d+)\]/i;const ep=Phaser.Utils.Objects.GetValue;var ip=function(t,e){return void 0===e?t:t[e]},sp=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ep(e,"left",0),t.right=ep(e,"right",0),t.top=ep(e,"top",0),t.bottom=ep(e,"bottom",0)),t},rp={getInnerPadding(t){return ip(this.space,t)},setInnerPadding(t,e){return sp(this.space,t,e),this},getOuterPadding(t){return ip(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return sp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ip(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),sp(this.getSizerConfig(t).padding,e,i),this}},np=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ap=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},op=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},hp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},lp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},up=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},cp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},dp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var bg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=An(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},xg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=ud),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=ud),this.transitOutCallback=t,this}},Cg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},kg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Sg={};Object.assign(Sg,bg,xg,Cg,kg);const wg=Phaser.Utils.Objects.GetValue;class _g extends In{constructor(t,e){super(t,e),this.setTransitInTime(wg(e,"duration.in",200)),this.setTransitOutTime(wg(e,"duration.out",200)),this.setTransitInCallback(wg(e,"transitIn")),this.setTransitOutCallback(wg(e,"transitOut")),this.oneShotMode=wg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new yg(this,{eventEmitter:!1,initState:wg(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(_g.prototype,Sg);const Eg=Phaser.GameObjects.Rectangle;class Tg extends Eg{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Og=Phaser.Utils.Objects.GetValue;class Pg extends In{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Og(t,"hitAreaMode",0)),this.setEnable(Og(t,"enable",!0)),this.setStopMode(Og(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Mg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Mg={default:0,fullWindow:1};const Dg=Phaser.Utils.Objects.GetValue;class Ag extends Tg{constructor(t,e){super(t,Dg(e,"color",0),Dg(e,"alpha",.8)),this.touchEventStop=new Pg(this,{hitAreaMode:1})}}var Lg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Tp(t,e)},scaleDown(t,e){Op(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Np(t,e)},fadeOut(t,e){Gp(t,e,!1)}},Rg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Np(t,e,t.alpha)},Fg=function(t,e){Gp(t,e,!1)},Bg=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Xr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Ig=Phaser.Utils.Objects.GetValue;let jg=class extends _g{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=zg.popUp),null==e.transitOut&&(e.transitOut=zg.scaleDown),e.destroy=Ig(e,"destroy",!0),super(t,e);var i=Ig(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ag(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ig(i,"transitIn",Rg)),this.setCoverTransitOutCallback(Ig(i,"transitOut",Fg)));var s=Ig(e,"touchOutsideClose",!1),r=Ig(e,"duration.hold",-1),n=Ig(e,"timeOutClose",r>=0),a=Ig(e,"anyTouchClose",!1);Ig(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ig(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Bg(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=zg[t]),t){case zg.popUp:t=Lg.popUp;break;case zg.fadeIn:t=Lg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=zg[t]),t){case zg.scaleDown:t=Lg.scaleDown;break;case zg.fadeOut:t=Lg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const zg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ng=function(t){return t&&"function"==typeof t},Gg={modal(t,e){return Ng(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new jg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Yg=function(t,e,i,s,r){Ng(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Xg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),vo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Yg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Yg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Yg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Yg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Yg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Yg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Yg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Yg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Yg.call(this,"shutdown",t,e,i,s),this}},Wg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=$g),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},$g={},Vg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Bg(t,e.x,e.y,i,s):!!(r=Wg(e,n,!0))&&Bg(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const nf={press:0,pointerdown:0,release:1,pointerup:1};var af={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new rf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},of=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!hf(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return lf.length=0,!0;return lf.length=0,!1},lf=[];const uf=Phaser.Utils.Objects.GetValue;class cf extends In{constructor(t,e){super(t,e),this._enable=void 0;var i=uf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(uf(t,"enable",!0)),this.setMode(uf(t,"mode",1)),this.setClickInterval(uf(t,"clickInterval",100)),this.setDragThreshold(uf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=df[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?of:Vg)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const df={press:0,pointerdown:0,release:1,pointerup:1};var pf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new cf(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class gf extends mg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const ff=Phaser.Utils.Objects.GetValue;class vf extends In{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new gf,this.parent.setInteractive(ff(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(ff(t,"enable",!0)),this.setCooldown(ff(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var mf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Vg(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new vf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new vf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},yf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},bf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ff,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Bf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ff,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=If,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Vg(t,s,e,i)}}const Ff=0,Bf=1,If="IDLE",jf=Phaser.Utils.Objects.GetValue,zf=Phaser.Math.Distance.Between;class Nf extends Rf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Gf},eventEmitter:!1};this.setRecongizedStateObject(new mg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(jf(t,"time",250)),this.setTapInterval(jf(t,"tapInterval",200)),this.setDragThreshold(jf(t,"threshold",9)),this.setTapOffset(jf(t,"tapOffset",10));var e=jf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(jf(t,"maxTaps",void 0)),this.setMinTaps(jf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Gf:this.state=Yf;break;case Yf:var t=this.lastPointer;zf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Xf,this.state=Yf);break;case Xf:this.state=Yf}}onDragEnd(){this.state===Yf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Xf))}onDrag(){this.state!==Gf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Gf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Yf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Gf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Xf:this.state=Gf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Xf&&(this.state=Gf)}get isTapped(){return this.state===Xf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Gf="IDLE",Yf="BEGIN",Xf="RECOGNIZED",Wf=Phaser.Utils.Objects.GetValue;class $f extends Rf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Vf},eventEmitter:!1};this.setRecongizedStateObject(new mg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Wf(t,"threshold",9)),this.setHoldTime(Wf(t,"time",251)),this}onDragStart(){this.state=Hf,0===this.holdTime&&(this.state=Uf)}onDragEnd(){this.state=Vf}onDrag(){this.state!==Vf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Vf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Hf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Uf))}get isPressed(){return this.state===Uf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Vf="IDLE",Hf="BEGIN",Uf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var qf=function(t){return Fn(t).loop.delta};const Kf=Phaser.Math.Distance.Between,Jf=Phaser.Math.Angle.Between;var Zf={getDt:function(){return qf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Kf(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Jf(e.x,e.y,t.x,t.y)}},Qf={"up&down":0,"left&right":1,"4dir":2,"8dir":3},tv={};const ev=Phaser.Utils.Objects.GetValue,iv=Phaser.Math.RadToDeg;class sv extends Rf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=rv},eventEmitter:!1};this.setRecongizedStateObject(new mg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ev(t,"threshold",10)),this.setVelocityThreshold(ev(t,"velocityThreshold",1e3)),this.setDirectionMode(ev(t,"dir","8dir")),this}onDragStart(){this.state=nv}onDragEnd(){this.state=rv}onDrag(){this.state===nv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=av))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===av&&(this.state=rv)}get isSwiped(){return this.state===av}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Qf[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=tv),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(iv(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(sv.prototype,Zf);const rv="IDLE",nv="BEGIN",av="RECOGNIZED",ov=Phaser.Utils.Objects.GetValue,hv=Phaser.Utils.Array.SpliceOne,lv=Phaser.Math.Distance.Between,uv=Phaser.Math.Angle.Between;class cv{constructor(t,e){var i=An(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(ov(e,"inputConfig",void 0)),this.setEventEmitter(ov(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(ov(t,"enable",!0)),this.bounds=ov(t,"bounds",void 0),this.tracerState=pv,this.pointers.length=0,ho(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ho(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case pv:this.tracerState=gv,this.onDrag1Start();break;case gv:this.tracerState=fv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],hv(this.pointers,e),this.tracerState){case gv:this.tracerState=pv,this.onDrag1End();break;case fv:this.tracerState=gv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case gv:this.onDrag1();break;case fv:this.onDrag2()}}}dragCancel(){return this.tracerState===fv&&this.onDrag2End(),this.pointers.length=0,ho(this.movedState),this.tracerState=pv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==fv)return 0;var t=this.pointers[0],e=this.pointers[1];return lv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==fv)return 0;var t=this.pointers[0],e=this.pointers[1];return uv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;dv.x=e.x-i.x,dv.y=e.y-i.y}else dv.x=0,dv.y=0;return dv}get centerX(){if(this.tracerState!==fv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==fv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==fv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==fv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=vv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Vg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Vg(t,s,e,i)}}Object.assign(cv.prototype,hr);var dv={};const pv=0,gv=1,fv=2,vv="IDLE";Phaser.Utils.Objects.GetValue;const mv=Phaser.Math.RotateAround;var yv=function(t,e,i,s){return mv(t,e,i,s),t.rotation+=s,t},bv={};const xv=Phaser.Utils.Objects.GetValue,Cv=Phaser.Math.Angle.WrapDegrees,kv=Phaser.Math.Angle.ShortestBetween,Sv=Phaser.Math.RadToDeg,wv=Phaser.Math.DegToRad;var _v={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=bv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Cv(Sv(this.angleBetween));this.angle=kv(this.prevAngle,t),this.prevAngle=t,this.state=Ov}break;case Ov:t=Cv(Sv(this.angleBetween));this.angle=kv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Ov}get rotation(){return wv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,_v);const Ev="IDLE",Tv="BEGIN",Ov="RECOGNIZED",Pv=Phaser.Utils.Objects.GetValue;var Mv=function(t){var e=Pv(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Nf(this,e),this._tap.on("tap",(function(t,e,s){xf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),xf(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Dv=Phaser.Utils.Objects.GetValue;var Av=function(t){var e=Dv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new $f(this,e),this._press.on("pressstart",(function(t,e,s){xf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){xf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Lv=Phaser.Utils.Objects.GetValue;var Rv=function(t){var e=Lv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new sv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";xf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),xf(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Fv=Phaser.Utils.Objects.GetValue;var Bv=function(t,e){return t.setInteractive(),Fv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Fv(e,"targets",[t]),targetMode:Fv(e,"targetMode","parent"),eventEmitter:Fv(e,"eventEmitter",t),eventNamePrefix:Fv(e,"inputEventPrefix","child.")},kf.call(t,e),_f.call(t,e),Of.call(t,e),Af.call(t,e),Mv.call(t,e),Av.call(t,e),Rv.call(t,e),t},Iv={getSizerConfig:function(t){return void 0===t&&(t=this),od(t)},getChildPrevState:function(t){var e=od(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=on(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=Fd(e,"color"),s=Fd(e,"lineWidth");var h=Fd(e,"name",!1);h&&(r=Fd(h,"createTextCallback",jd),n=Fd(h,"createTextCallbackScope",void 0),"string"==typeof(a=Fd(h,"align","left-top"))&&(a=ld[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Bd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var u,c,d=this.getAllShownChildren([this]);zd(d,d);for(var p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const Vv=Phaser.Utils.Objects.IsPlainObject,Hv=Phaser.Utils.Objects.GetValue,Uv=Phaser.Display.Align.CENTER,qv={min:0,full:-1};var Kv=function(t,e,i,s,r,n,a,o,h,l){var u,c,d,p;Yd.call(this,t);var g=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=qv[e];else if(Vv(e)){var v;e=Hv(v=e,"proportion",void 0),i=Hv(v,"align",Uv),s=Hv(v,"padding",0),r=Hv(v,"expand",!1),n=Hv(v,"key",void 0),a=Hv(v,"index",void 0),t.isRexSizer||(o=Hv(v,"minWidth",void 0),h=Hv(v,"minHeight",void 0)),l=Hv(v,"fitRatio",0),u=Hv(v,"offsetX",0),c=Hv(v,"offsetY",0),d=Hv(v,"offsetOriginX",0),p=Hv(v,"offsetOriginY",0)}return"string"==typeof i&&(i=ld[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Uv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Ir(t)/jr(t)),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===p&&(p=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=Cl(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=u,v.alignOffsetY=c,v.alignOffsetOriginX=d,v.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Ir(t):o:t.minHeight=void 0===h?jr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Jv={add:Kv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Kv.call(this,new Wv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Vv(i)&&(i.index=t),Kv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=$v.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Zv=sl.prototype.clear;var Qv=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Zv.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Qv.call(this,t),this}},im={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=ld[e]),this.getSizerConfig(t).align=e,this}},sm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},rm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},nm={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},am={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(fp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,dp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u,c,d=this.sizerChildren,p=this.innerLeft,g=this.innerTop,f=this.innerWidth,v=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=hp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ap.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Yv.call(this,t,void 0),op.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||lp.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Yv.call(this,void 0,t),up.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(am,Jv,em,im,sm,rm,nm);var om=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},hm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},lm=function(t){return"string"==typeof t&&(t=hm[t]),t};const um=Phaser.Utils.Objects.IsPlainObject,cm=Phaser.Utils.Objects.GetValue;class dm extends zv{constructor(t,e,i,s,r,n,a){um(e)?(e=cm(a=e,"x",0),i=cm(a,"y",0),s=cm(a,"width",void 0),r=cm(a,"height",void 0),n=cm(a,"orientation",0)):um(s)?(s=cm(a=s,"width",void 0),r=cm(a,"height",void 0),n=cm(a,"orientation",0)):um(n)&&(n=cm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(cm(a,"space.item",0)),this.setStartChildIndex(cm(a,"startChildIndex",0)),this.setRTL(cm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=lm(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=om.call(this)),this._childrenProportion}}Object.assign(dm.prototype,am);var pm=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},gm=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},fm={appendText:gm,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class vm extends dm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(pm(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(pm(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&pm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&pm(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(vm.prototype,fm);var mm=function(t,e,i,s){var r=new wl(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const ym=Phaser.Utils.Objects.GetValue;const bm=Phaser.Utils.Objects.GetValue;var xm=/^[\x00-\x7F]+$/,Cm=function(t){return xm.test(t)},km=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},wm=0,_m=1,Em=2,Tm=0,Om=1,Pm=2,Mm=/(?:\r\n|\r|\n)/;const Dm={none:Tm,word:Om,char:Pm,character:Pm,mix:3};var Am=function(t,e){switch(jc(t)){case 0:switch("string"==typeof e&&(e=Dm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=km;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Dm[e]||0),t.style.wrapMode=e}};const Lm=Phaser.Renderer.WebGL.Utils;var Rm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Lm.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Fm=Phaser.Display.Color;var Bm={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Fm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Im=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},jm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Im(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Qo();const zm=Phaser.Display.Canvas.CanvasPool,Nm=Phaser.GameObjects.GameObject,Gm=Phaser.Utils.String.UUID;class Ym extends Nm{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=zm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Gm(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){zm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Xm=Phaser.GameObjects.Components;Phaser.Class.mixin(Ym,[Xm.Alpha,Xm.BlendMode,Xm.Crop,Xm.Depth,Xm.Flip,Xm.GetBounds,Xm.Mask,Xm.Origin,Xm.Pipeline,Xm.PostPipeline,Xm.ScrollFactor,Xm.Tint,Xm.Transform,Xm.Visible,Rm,Bm,jm]);let Wm=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Wm.prototype,Kl);var $m={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Vm=Phaser.Math.RotateAround;var Hm;const Um=Phaser.Geom.Rectangle;var qm,Km=function(t){void 0===qm&&(qm=new Um);var e=t.drawTLX,i=t.drawTLY;return qm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),qm};const Jm=Phaser.Math.RotateAround;var Zm,Qm=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Zm&&(Zm={}),s=Zm),s.x=e,s.y=i,0!==t.rotation&&Jm(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ty=Phaser.GameObjects.Components.TransformMatrix;var ey,iy,sy={},ry=function(t,e,i,s,r){var n=Qm(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=sy);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ey&&(ey=new ty,iy=new ty),t.parentContainer?t.getWorldTransformMatrix(ey,iy):ey.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ey.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ny=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return ry(t,e,n,a,r)},ay={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hm&&(Hm={}),s=Hm),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Vm(s,0,0,-i.rotation),s}(t,e,this,!0);return Km(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ny(this.parent,this,t,e,i)}};Object.assign(ay,$m);const oy=Phaser.Math.DegToRad,hy=Phaser.Math.RadToDeg,ly=Phaser.Utils.Objects.GetValue;class uy extends Wm{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return hy(this._rotation)}set angle(t){this.rotation=oy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ly(t,"width",void 0),i=ly(t,"height",void 0),s=ly(t,"scaleX",void 0),r=ly(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(uy.prototype,ay);const cy=Phaser.Utils.String.Pad;var dy=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${cy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},py=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const gy=Phaser.Utils.Objects.GetValue;let fy=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=gy(t,"x",0),i=gy(t,"y",0));var s=this.cornerRadius;s.tl=vy(gy(t,"tl",void 0),e,i),s.tr=vy(gy(t,"tr",void 0),e,i),s.bl=vy(gy(t,"bl",void 0),e,i),s.br=vy(gy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){my(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){my(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){my(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){my(this.cornerRadius.br,t)}};var vy=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),yy(t),t},my=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=gy(e,"x",0),t.y=gy(e,"y",0)),yy(t)},yy=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const by=Phaser.Math.DegToRad;var xy=function(t){return!t.hasOwnProperty("convex")||t.convex},Cy=function(t){return t.x>0&&t.y>0},ky=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Cy(o)?(h=o.x*f,l=o.y*v,xy(o)?ky(t,h,l,h,l,180,270,!1,a):ky(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,Cy(o)?(h=o.x*f,l=o.y*v,xy(o)?ky(t,s-h,l,h,l,270,360,!1,a):ky(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Cy(o)?(h=o.x*f,l=o.y*v,xy(o)?ky(t,s-h,r-l,h,l,0,90,!1,a):ky(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Cy(o)?(h=o.x*f,l=o.y*v,xy(o)?ky(t,h,r-l,h,l,90,180,!1,a):ky(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},wy=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),Sy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const _y=Phaser.Utils.Objects.GetValue;class Ey extends uy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(_y(e,"color",null),_y(e,"color2",null),_y(e,"horizontalGradient",!0)),this.setStroke(_y(e,"stroke",null),_y(e,"strokeThickness",2)),this.setCornerRadius(_y(e,"cornerRadius",0),_y(e,"cornerIteration",null))}set color(t){t=dy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=dy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=dy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,py("color2",t,this),py("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,py("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,py("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){wy(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ty=Phaser.Utils.Objects.GetValue;class Oy extends uy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ty(e,"color",null),Ty(e,"color2",null),Ty(e,"horizontalGradient",!0)),this.setStroke(Ty(e,"stroke",null),Ty(e,"strokeThickness",2))}set color(t){t=dy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=dy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=dy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ty(t,"color2",null),Ty(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ty(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Py=Phaser.Utils.Objects.GetValue;let My=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Py(t,"bold",!1)),this.setItalic(Py(t,"italic",!1)),this.setFontSize(Py(t,"fontSize","16px")),this.setFontFamily(Py(t,"fontFamily","Courier")),this.setColor(Py(t,"color","#fff")),this.setStrokeStyle(Py(t,"stroke",null),Py(t,"strokeThickness",0)),this.setShadow(Py(t,"shadowColor",null),Py(t,"shadowOffsetX",0),Py(t,"shadowOffsetY",0),Py(t,"shadowBlur",0)),this.setOffset(Py(t,"offsetX",0),Py(t,"offsetY",0)),this.setSpace(Py(t,"leftSpace",0),Py(t,"rightSpace",0)),this.setAlign(Py(t,"align",void 0)),this.setBackgroundColor(Py(t,"backgroundColor",null)),this.setBackgroundHeight(Py(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Py(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(py("stroke",t,this),py("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(py("shadowOffsetX",t,this),py("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=dy(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=dy(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=dy(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=dy(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Dy=Phaser.Utils.Array.Remove;const Ay=Phaser.Utils.Array.Remove;const Ly="text",Ry="image",Fy="drawer",By="space",Iy="command";var jy=function(t){return t.type===Ly&&"\n"===t.text},zy=function(t){return t.type===Ly&&"\f"===t.text},Ny=function(t){return t.type===Ly};class Gy extends uy{constructor(t,e,i){super(t,Ly),this.updateTextFlag=!1,this.style=new My(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Yy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Xy=Phaser.Display.Canvas.CanvasPool;var Wy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Xy.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Xy.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class $y extends uy{constructor(t,e,i){super(t,Ry),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Wy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Vy extends uy{constructor(t,e,i,s){super(t,Fy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Hy extends uy{constructor(t,e){super(t,By),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Uy extends Wm{constructor(t,e,i,s,r){super(t,Iy),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var qy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ky={none:0,word:1,char:2,character:2,mix:3};var Jy=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=eb.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=eb.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=sb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=sb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=sb(t,"wrapMode");void 0===c&&(c=sb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Ky[c]);var d=sb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=sb(t,"letterSpacing",0),g=sb(t,"hAlign",0),f=sb(t,"vAlign",0),v=sb(t,"justifyPercentage",.25),m=qy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(P.push({children:M,width:D}),A=Math.max(A,D)),m.start+=O.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=A,m.linesHeight=P.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ab(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ab(t,"maxLines",0);var o=0===i,h=ab(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ab(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=ab(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=ab(t,"letterSpacing",0),p=ab(t,"rtl",!0),g=ab(t,"hAlign",p?2:0),f=ab(t,"vAlign",0),v=qy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(O.push({children:P,height:M}),D=Math.max(D,M)),v.start+=T.length,v.isLastPage=v.start===E,v.maxLineHeight=D,v.linesWidth=O.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return sp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return ip(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Dy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ay(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ly);return null===i?i=new Gy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ny(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Nb(t,r,e,i,n),o=0;o<=Ib&&0!==a;o++){if((r+=a)<0){r=0;break}a=Nb(t,r,e,i,n)}return o===Ib&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Gb(t,e,i),t},zb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Nb=function(t,e,i,s,r){var n,a=zb(t,e,r),o=zb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Gb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Yb=Phaser.Utils.Objects.GetValue;var Xb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Yb(e,"minWidth",0),s=Yb(e,"minHeight",0),r=Yb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return jb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),jb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Wb=Phaser.Utils.Objects.GetValue,$b=[function(t){var e=this.scene,i=ym(t,"orientation",0);this.setOrientation(i);var s=ym(t,"icon",void 0),r=ym(t,"iconMask",void 0),n=ym(t,"innerBackground",void 0),a=ym(t,"title",void 0),o=ym(t,"separator",void 0),h=ym(t,"text",void 0),l=ym(t,"action",void 0),u=ym(t,"actionMask",void 0);if(s){var c=ym(t,"align.icon","center");m=0===this.orientation?{right:ym(t,"space.icon",0),top:ym(t,"space.iconTop",0),bottom:ym(t,"space.iconBottom",0),left:ym(t,"space.iconLeft",0)}:{bottom:ym(t,"space.icon",0),left:ym(t,"space.iconLeft",0),right:ym(t,"space.iconRight",0),top:ym(t,"space.iconTop",0)};var d=ym(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=mm.call(this,s,s,1)),!d){var p=ym(t,"iconSize",void 0);this.setIconSize(ym(t,"iconWidth",p),ym(t,"iconHeight",p))}}var g=new dm(e,{orientation:1});n&&g.addBackground(n);var f=ym(t,"space.separator",0);if(a){c=ym(t,"align.title","left");var v=ym(t,"expandTitleWidth",!1);y=ym(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?ym(t,"space.title",f):0,left:ym(t,"space.titleLeft",0),right:ym(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:ym(t,"space.separatorLeft",0),right:ym(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=ym(t,"align.text","left");var y,b,x=ym(t,"expandTextWidth",!1);y=ym(t,"expandTextHeight",!1)?1:0,b=x,m={left:ym(t,"space.textLeft",0),right:ym(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:ym(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=ym(t,"align.action","center");m=0===this.orientation?{top:ym(t,"space.actionTop",0),bottom:ym(t,"space.actionBottom",0),right:ym(t,"space.actionRight",0)}:{left:ym(t,"space.actionLeft",0),right:ym(t,"space.actionRight",0),bottom:ym(t,"space.actionBottom",0)};d=ym(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=mm.call(this,l,l,1)),!d){var C=ym(t,"actionSize");this.setActionSize(ym(t,"actionWidth",C),ym(t,"actionHeight",C))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=bm(t,"title",void 0),s=bm(t,"separator",void 0),r=bm(t,"innerBackground",void 0),n=bm(t,"icon",void 0),a=bm(t,"iconMask",void 0),o=bm(t,"text",void 0),h=bm(t,"action",void 0),l=bm(t,"actionMask",void 0);if(i){var u=bm(t,"align.title","left"),c=bm(t,"expandTitleWidth",!1);y=bm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:bm(t,"space.title",0),left:bm(t,"space.titleLeft",0),right:bm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=bm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:bm(t,"space.separatorLeft",0),right:bm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=bm(t,"orientation",0),f=new dm(e,{orientation:g,rtl:bm(t,"rtl",!1),space:{left:bm(t,"space.innerLeft",0),right:bm(t,"space.innerRight",0),top:bm(t,"space.innerTop",0),bottom:bm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=bm(t,"align.icon","center");p=0===f.orientation?{right:bm(t,"space.icon",0),top:bm(t,"space.iconTop",0),bottom:bm(t,"space.iconBottom",0),left:bm(t,"space.iconLeft",0)}:{bottom:bm(t,"space.icon",0),left:bm(t,"space.iconLeft",0),right:bm(t,"space.iconRight",0),top:bm(t,"space.iconTop",0)};var v=bm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=mm.call(this,n,n,1)),!v){var m=bm(t,"iconSize",void 0);this.setIconSize(bm(t,"iconWidth",m),bm(t,"iconHeight",m))}}if(o){u=bm(t,"align.text","left");var y,b,x=bm(t,"space.text",0),C=bm(t,"expandTextWidth",!1),k=bm(t,"expandTextHeight",!1);0===f.orientation?(y=C?1:0,h&&(p={right:x}),b=k):(y=k?1:0,h&&(p={bottom:x}),b=C),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=bm(t,"align.action","center");p=0===f.orientation?{top:bm(t,"space.actionTop",0),bottom:bm(t,"space.actionBottom",0),right:bm(t,"space.actionRight",0)}:{left:bm(t,"space.actionLeft",0),right:bm(t,"space.actionRight",0),bottom:bm(t,"space.actionBottom",0)};v=bm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=mm.call(this,h,h,1)),!v){var S=bm(t,"actionSize");this.setActionSize(bm(t,"actionWidth",S),bm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class Vb extends vm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Wb(e,"background",void 0);i&&this.addBackground(i);var s=Wb(e,"title",void 0),r=Wb(e,"text",void 0);if(s){var n=Wb(e,"wrapTitle",!1),a=Wb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Am(s,n),e.expandTitleWidth=!0,Bb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Xb(s,{fitHeight:!0}))}if(r){var o=Wb(e,"wrapText",!1),h=Wb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Am(r,o),e.expandTextWidth=!0,Bb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Xb(r,{fitHeight:!0}))}var l=Wb(e,"layoutMode",0);($b[l]||$b[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Hb extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=nd(i,"expandTextWidth",!1),n=nd(i,"expandTextHeight",!1);if(r||n){var a=jc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(nd(i,"typingMode","page")),this.page=new Uc(s,nd(i,"page",void 0)),this.typing=new sd(s,nd(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=ad[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(Vb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Ub=Phaser.GameObjects.GetCalcMatrix;const qb=Phaser.Renderer.Canvas.SetTransform;var Kb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ub(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Ql(r,a,e,l,o,h),e.isStroked&&eu(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(qb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Zb.prototype,Kb);var Qb=function(t){return t.x>0&&t.y>0};const tx=Phaser.Utils.Objects.IsPlainObject,ex=Phaser.Utils.Objects.GetValue,ix=Phaser.Geom.Polygon.Earcut;class sx extends Zb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(tx(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new fy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=ex(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(ex(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,Qb(i))if(i.convex){var o=i.x,h=i.y;hu(o,h,i.x,i.y,180,270,!1,a,e)}else{hu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else au(0,0,e);if(i=n.tr,Qb(i))if(i.convex){o=s-i.x,h=i.y;hu(o,h,i.x,i.y,270,360,!1,a,e)}else{hu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else au(s,0,e);if(i=n.br,Qb(i))if(i.convex){o=s-i.x,h=r-i.y;hu(o,h,i.x,i.y,0,90,!1,a,e)}else{hu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else au(s,r,e);if(i=n.bl,Qb(i))if(i.convex){o=i.x,h=r-i.y;hu(o,h,i.x,i.y,90,180,!1,a,e)}else{hu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else au(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=ix(e),this}setShapeType(t){return"string"==typeof t&&(t=rx[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const rx={rectangle:0,circle:1};var nx=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},ax=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const fx=Phaser.Utils.Objects.GetValue,vx=Phaser.Utils.Objects.IsPlainObject;class mx extends(rc(Ul)){constructor(t,e,i,s,r,n,a,o){vx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):vx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):vx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Ru).setName("trackFill")).addShape((new Ru).setName("bar")).addShape((new Ru).setName("trackStroke")),this.setTrackColor(fx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(fx(o,"trackStrokeThickness",2),fx(o,"trackStrokeColor",void 0)),this.setSkewX(fx(o,"skewX",0)),this.setRTL(fx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var yx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&gx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),gx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&gx(o,0,0,e,i,t)}};Object.assign(mx.prototype,yx);class bx extends mx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=xx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const xx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(bx.prototype,cx);let Cx=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const kx=Phaser.GameObjects.NineSlice,Sx=Phaser.Utils.Objects.GetValue;class wx extends kx{constructor(t,e){void 0===e&&(e={}),super(t,Sx(e,"x",0),Sx(e,"y",0),Sx(e,"key",null),Sx(e,"frame",null),Sx(e,"width",0),Sx(e,"height",0),Sx(e,"leftWidth",0),Sx(e,"rightWidth",0),Sx(e,"topHeight",0),Sx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=Sx(e,"effects",!0);i&&Or(this,i),this.style=new Cx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(wx.prototype,cx);let _x=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Ex=Phaser.GameObjects.Image,Tx=Phaser.Utils.Objects.GetValue;class Ox extends Ex{constructor(t,e){void 0===e&&(e={}),super(t,Tx(e,"x",0),Tx(e,"y",0),Tx(e,"key",""),Tx(e,"frame",void 0)),this.type="rexStatesImage";var i=Tx(e,"effects",!0);i&&Or(this,i),this.style=new _x(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ox.prototype,cx);var Px=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Mx=Phaser.Utils.Objects.IsPlainObject,Dx=Phaser.Utils.Objects.GetValue;var Ax=function(t){return"string"==typeof t&&(t=Lx[t]),t};const Lx={scale:0,repeat:1};var Rx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Fx={_beginDraw:ud,_drawImage:ud,_drawTileSprite:ud,_endDraw:ud,setGetFrameNameCallback:function(t){return void 0===t&&(t=Px),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var _=typeof(m=this.getFrameNameCallback(h,k,e));"string"!==_&&"number"!==_||r.add(m,0,x+n.cutX,C+n.cutY,v,f)}x+=v}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Mx(t)?(this.stretchMode.edge=Ax(Dx(t,"edge",0)),this.stretchMode.internal=Ax(Dx(t,"internal",0))):(t=Ax(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Rx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Bx=Phaser.Utils.Objects.IsPlainObject,Ix=Phaser.Utils.Objects.GetValue;const jx=Phaser.GameObjects;var zx=void 0,Nx=function(t,e){if(zx||(zx={},Fn(t).events.once("destroy",(function(){for(var t in zx)zx[t].destroy();zx=void 0}))),!zx.hasOwnProperty(e)){var i=Fn(t).scene.systemScene;(t=new jx[e](i)).setOrigin(0),zx[e]=t}return zx[e]};const Gx=Phaser.GameObjects.RenderTexture;class Yx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Bx(i)?(i=Ix(u=i,"x",0),s=Ix(u,"y",0),r=Ix(u,"width",1),n=Ix(u,"height",1),a=Ix(u,"key",void 0),o=Ix(u,"baseFrame",void 0),h=Ix(u,"columns",void 0),l=Ix(u,"rows",void 0)):Bx(r)?(r=Ix(u=r,"width",1),n=Ix(u,"height",1),a=Ix(u,"key",void 0),o=Ix(u,"baseFrame",void 0),h=Ix(u,"columns",void 0),l=Ix(u,"rows",void 0)):Bx(a)?(a=Ix(u=a,"key",void 0),o=Ix(u,"baseFrame",void 0),h=Ix(u,"columns",void 0),l=Ix(u,"rows",void 0)):Bx(o)?(o=Ix(u=o,"baseFrame",void 0),h=Ix(u,"columns",void 0),l=Ix(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Ix(u,"baseFrame",void 0)):Bx(h)&&(h=Ix(u=h,"columns",void 0),l=Ix(u,"rows",void 0)),void 0===o&&(o=Ix(u,"frame",void 0)),void 0===h){var c=Ix(u,"leftWidth",void 0),d=Ix(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Ix(u,"topHeight",void 0),g=Ix(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Ix(u,"getFrameNameCallback",void 0)),this.setStretchMode(Ix(u,"stretchMode",0)),this.setPreserveRatio(Ix(u,"preserveRatio",!0));var f=Ix(u,"maxFixedPartScale",1),v=Ix(u,"maxFixedPartScaleX",f),m=Ix(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Fx),i}(Gx,"rexNinePatch")){}var Xx={_drawImage:function(t,e,i,s,r,n){var a=Nx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Nx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Yx.prototype,Xx);let Wx=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const $x=Phaser.Utils.Objects.GetValue;class Vx extends Yx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=$x(e,"effects",!0);i&&Or(this,i),this.style=new Wx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Vx.prototype,cx);const Hx=["alpha","tint","flipX","flipY"];var Ux=function(t,e){if(!e)return t;for(var i=0,s=Hx.length;i=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(C(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!C(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){C(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(C(t.step)){var y=t.step;t.step=function(e){if(m=e,S())k();else{if(k(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function k(){return m&&s&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)C(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return V(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||k.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),W();if(z===f-1)return W(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==B&&B=o)return V(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return W();function X(t){x.push(t),w=u}function Y(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function W(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,X(S),b&&H()),V()}function $(t){u=t,X(S),S=[],I=a.indexOf(s,u)}function V(t){return{data:x,errors:k,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function H(){n(V()),x=[],k=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(C(i.userStep)){for(var a=0;a>16&255},mr=function(t){return t>>8&255},yr=function(t){return 255&t};const br=Phaser.Events.EventEmitter;var xr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Cr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Cr={},kr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=xr),function(t){if(t.events)return t;var e=new br,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},wr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},_r=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Or(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},Ir=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},jr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const zr=Phaser.Geom.Rectangle,Nr=Phaser.Math.Vector2,Gr=Phaser.Math.RotateAround,Xr=Phaser.GameObjects.Container;var Yr=function(t,e){if(void 0===e?e=new zr:!0===e&&(void 0===Wr&&(Wr=new zr),e=Wr),t.getBounds&&!(t instanceof Xr))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();$r(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Vr(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Hr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else $r(t,e),i=e.x,s=e.y,Vr(t,e),r=e.x,n=e.y,Hr(t,e),a=e.x,o=e.y,Ur(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Wr=void 0,$r=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY,Kr(t,e,i))},Vr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getTopRight?t.getTopRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY,Kr(t,e,i))},Hr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY+jr(t),Kr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY+jr(t),Kr(t,e,i))},qr=void 0,Kr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Gr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const Jr=Phaser.Utils.Objects.GetValue;var Zr=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Jr(i,"color"),r=Jr(i,"lineWidth"),n=Jr(i,"fillColor"),a=Jr(i,"fillAlpha",1),o=Jr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?qn:Un,this.repeatCounter=0,this}stop(){return this.state=Hn,this}update(t,e){this.state!==Hn&&this.state!==Jn&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Kn)):(this.nowTime=this.duration,this.state=Jn):this.nowTime>=0&&(this.state=qn))}get t(){var t;switch(this.state){case Hn:case Un:case Kn:t=0;break;case qn:t=this.nowTime/this.duration;break;case Jn:t=1}return $n(t,0,1)}set t(t){(t=$n(t,-1,1))<0?(this.state=Un,this.nowTime=-this.delay*t):(this.state=qn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Hn}get isDelay(){return this.state===Un}get isCountDown(){return this.state===qn}get isRunning(){return this.state===Un||this.state===qn}get isDone(){return this.state===Jn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Hn=0,Un=1,qn=2,Kn=3,Jn=-1;class Zn extends Xn{constructor(t,e){super(t,e),this.timer=new Vn}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Qn=Phaser.Utils.Objects.GetValue,ta=Phaser.Utils.Objects.GetAdvancedValue,ea=Phaser.Tweens.Builders.GetEaseFunction;class ia extends Zn{resetFromJSON(t){return this.timer.resetFromJSON(Qn(t,"timer")),this.setEnable(Qn(t,"enable",!0)),this.setTarget(Qn(t,"target",this.parent)),this.setDelay(ta(t,"delay",0)),this.setDuration(ta(t,"duration",1e3)),this.setEase(Qn(t,"ease","Linear")),this.setRepeat(Qn(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ea(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const sa=Phaser.Sound.BaseSound;var ra=function(t){return t instanceof sa};const na=Phaser.Utils.Objects.GetValue,aa=Phaser.Utils.Objects.GetAdvancedValue,oa=Phaser.Math.Linear;let ha=class extends ia{constructor(t,e,i){ra(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(na(t,"mode",0)),this.setEnable(na(t,"enable",!0)),this.setVolumeRange(aa(t,"volume.start",this.parent.volume),aa(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=la[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=oa(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const la={stop:1,destroy:2};var ua=function(t,e,i,s,r){ra(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ha(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ca=function(t,e,i,s){ra(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ha(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const da=Phaser.Utils.Objects.GetValue;var pa={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:da(e,"loop",this.backgroundMusicLoop),mute:da(e,"mute",this.backgroundMusicMute),volume:da(e,"volume",this.backgroundMusicVolume),detune:da(e,"detune",0),rate:da(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&ua(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ca(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ga=Phaser.Utils.Objects.GetValue;var fa={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ga(e,"loop",this.backgroundMusicLoop),mute:ga(e,"mute",this.backgroundMusic2Mute),volume:ga(e,"volume",this.backgroundMusic2Volume),detune:ga(e,"detune",0),rate:ga(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&ua(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ca(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const va=Phaser.Utils.Array.Remove,ma=Phaser.Utils.Objects.GetValue;var ya={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:ma(e,"mute",this.soundEffectsMute),volume:ma(e,"volume",this.soundEffectsVolume),detune:ma(e,"detune",0),rate:ma(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&va(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&va(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&ua(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ca(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ca(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&ua(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ca(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ca(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Aa=Phaser.Utils.Objects.GetValue,La=new class extends Da{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Qa(this.delimiterLeft),e=Qa(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=$s:t||(t=so),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=ao),this.tagExpression=t,this}setValueExpression(t){return t||(t=ao),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==ao||this.valueExpression!==ao){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Qa(this.delimiterLeft),e=Qa(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=ro(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const ao="[^=]+";var oo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],ho=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},lo=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:ho(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},xo={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},Co={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},ko={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},So={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},wo=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return wo(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!wo(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Eo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const Wo=Phaser.GameObjects.Zone;let $o=class extends Wo{constructor(t){super(t,0,0,2,2),this.fullWindow=new Yo(this)}};const Vo="BG",Ho="SPRITE",Uo="TEXTBOX",qo="TITLE",Ko="CHOICE",Jo="NAMEINPUT";var Zo=!1,Qo=function(t){Zo||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return eh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return ih(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ihh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ehh(t).x,getChildLocalY:t=>hh(t).y};const wh=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=hh(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=hh(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return hh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return hh(t).rotation=wh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=hh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>hh(t).rotation},Eh={updateChildScale(t){var e=hh(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=hh(t),i=e.parent;return e.scaleX=kh(t.scaleX,i.scaleX),e.scaleY=kh(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=hh(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=hh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>hh(t).scaleX,getChildLocalScaleY:t=>hh(t).scaleY},Th={updateChildVisible(t){var e=hh(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=hh(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),hh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),hh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=hh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>hh(t).visible},Oh={updateChildAlpha(t){var e=hh(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=hh(t),i=e.parent;return e.alpha=kh(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return hh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=hh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>hh(t).alpha},Ph={updateChildActive(t){var e=hh(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return hh(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),hh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=hh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>hh(t).active},Mh={updateChildScrollFactor(t){var e=hh(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Dh={updateCameraFilter(t){var e=hh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Ah={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Lh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Rh={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Fh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Ih=Phaser.Utils.Array;var jh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,T):r(c,d,T),h&&c.add.existing(E),l){var O=b+k*_+a*k,P=x+S*w+o*S;E.setOrigin(a,o).setPosition(O,P).setScale(f,v).setRotation(m),Ml(E,b,x,m)}C.push(E)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(Nl.prototype,Ll);const Xl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Yl=Phaser.GameObjects.GetCalcMatrix;const Wl=Phaser.Renderer.Canvas.SetTransform;var $l={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Yl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},su=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const ru=Phaser.Geom.Polygon.Earcut;class nu extends Jl{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=ru(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&Ql(t,e,this,i,s,r),this.isStroked&&eu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ou=Phaser.Math.DegToRad;var hu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Bu(t,"tl",0),this.radiusTR=Bu(t,"tr",0),this.radiusBL=Bu(t,"bl",0),this.radiusBR=Bu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?hu(e,e,e,e,180,270,!1,r,t):hu(0,0,e,e,90,0,!0,r,t):au(0,0,t);(e=this.radiusTR)>0?this._convexTR?hu(i-e,e,e,e,270,360,!1,r,t):hu(i,0,e,e,180,90,!0,r,t):au(i,0,t);(e=this.radiusBR)>0?this._convexBR?hu(i-e,s-e,e,e,0,90,!1,r,t):hu(i,s,e,e,270,180,!0,r,t):au(i,s,t);(e=this.radiusBL)>0?this._convexBL?hu(e,s-e,e,e,90,180,!1,r,t):hu(0,s,e,e,360,270,!0,r,t):au(0,s,t);return t.push(t[0],t[1]),yu(this.x,this.y,t),super.updateData(),this}},triangle:class extends Jl{constructor(t,e,i,s,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(i,s),this.setP2(r,n)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,i,s,r){if(this.isFilled){var n=Iu(this.fillColor,this.fillAlpha*i),a=this.x0-s,o=this.y0-r,h=this.x1-s,l=this.y1-r,u=this.x2-s,c=this.y2-r,d=e.getX(a,o),p=e.getY(a,o),g=e.getX(h,l),f=e.getY(h,l),v=e.getX(u,c),m=e.getY(u,c);t.batchTri(d,p,g,f,v,m,n,n,n)}this.isStroked&&eu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.x1-e,r=this.y1-i,n=this.x2-e,a=this.y2-i,o=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(s,r),t.lineTo(n,a),t.lineTo(o,h),t.closePath(),this.isFilled&&(iu(t,this),t.fill()),this.isStroked&&(su(t,this),t.stroke())}}},zu=Phaser.Utils.Objects.GetValue,Nu=Phaser.Utils.Objects.IsPlainObject,Gu=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),pc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,cc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(gc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(gc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(gc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(gc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class vc extends Nl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=fc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},Nc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Gc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Nc(t));t=this.sections.join("\n");this.lines=zc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(Vc,Gc,Yc,$c);const Hc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Uc extends In{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=jc(this.parent),this.pageStartIndexes=[],this.lines=zc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Hc(t,"maxLines",void 0)),this.setPageBreak(Hc(t,"pageBreak","\f\n")),this.setText(Hc(t,"text","")),this.startLineIndex=Hc(t,"start",-1),this.endLineIndex=Hc(t,"end",void 0);var e=Hc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(jc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Uc.prototype,Vc);var qc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Wc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Nc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},Kc=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},Jc=function(t,e){for(var i=void 0,s=0;s0)l=Zc(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=Zc(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},td={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=Kc(this.parent,t);n=Jc(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)Qc.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(td,qc);const ed=Phaser.Utils.Objects.GetFastValue,id=Phaser.Utils.Objects.GetValue;class sd extends In{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(id(t,"wrap",!1)),this.setTypeMode(id(t,"typeMode",0)),this.setTypingSpeed(id(t,"speed",333)),this.setTextCallback=ed(t,"setTextCallback",null),this.setTextCallbackScope=ed(t,"setTextCallbackScope",null),this.setTypingContent(ed(t,"text","")),this.typingIndex=ed(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=ed(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=rd[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Nc(t);this.textWrapEnable&&(e=function(t,e){switch(jc(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=Kc(this.parent,this.text).length,this}onTyping(){var t=Qc.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Wc(this.parent,t):this.parent.setText(t)}}const rd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(sd.prototype,td);const nd=Phaser.Utils.Objects.GetValue;const ad={page:0,line:1};var od=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const hd=Phaser.Display.Align;var ld={center:hd.CENTER,left:hd.LEFT_CENTER,right:hd.RIGHT_CENTER,top:hd.TOP_CENTER,bottom:hd.BOTTOM_CENTER,"left-top":hd.TOP_LEFT,"top-left":hd.TOP_LEFT,"left-center":hd.LEFT_CENTER,"center-left":hd.LEFT_CENTER,"left-bottom":hd.BOTTOM_LEFT,"bottom-left":hd.BOTTOM_LEFT,"center-top":hd.TOP_CENTER,"top-center":hd.TOP_CENTER,"center-center":hd.CENTER,"center-bottom":hd.BOTTOM_CENTER,"bottom-center":hd.BOTTOM_CENTER,"right-top":hd.TOP_RIGHT,"top-right":hd.TOP_RIGHT,"right-center":hd.RIGHT_CENTER,"center-right":hd.RIGHT_CENTER,"right-bottom":hd.BOTTOM_RIGHT,"bottom-right":hd.BOTTOM_RIGHT},ud=function(){},cd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:ud,events:{once:ud}}},0,0,1,1);cd.setOrigin(0);var dd=0,pd=1,gd=2,fd=4,vd=6,md=8,yd=10,bd=12,xd=function(t){var e=jr(t);return t.y+e-e*t.originY},Cd=function(t){var e=Ir(t);return t.x-e*t.originX+.5*e},kd=function(t,e){var i=jr(t);return t.y=e-i+i*t.originY,t},Sd=function(t,e){var i=Ir(t),s=i*t.originX;return t.x=e+s-.5*i,t},wd=function(t){var e=Ir(t);return t.x-e*t.originX},_d=function(t,e){var i=Ir(t);return t.x=e+i*t.originX,t},Ed=function(t){var e=Ir(t);return t.x+e-e*t.originX},Td=function(t,e){var i=Ir(t);return t.x=e-i+i*t.originX,t},Od=function(t,e){var i=jr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Pd=function(t){var e=jr(t);return t.y-e*t.originY+.5*e},Md=function(t){var e=jr(t);return t.y-e*t.originY},Dd=function(t,e){var i=jr(t);return t.y=e+i*t.originY,t},Ad=[];Ad[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Sd(t,Cd(e)+i),kd(t,xd(e)+s),t},Ad[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),_d(t,wd(e)-i),kd(t,xd(e)+s),t},Ad[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Td(t,Ed(e)+i),kd(t,xd(e)+s),t},Ad[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Sd(t,e),Od(t,i)}(t,Cd(e)+i,Pd(e)+s),t},Ad[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),_d(t,wd(e)-i),Od(t,Pd(e)+s),t},Ad[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Td(t,Ed(e)+i),Od(t,Pd(e)+s),t},Ad[pd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Sd(t,Cd(e)+i),Dd(t,Md(e)-s),t},Ad[dd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),_d(t,wd(e)-i),Dd(t,Md(e)-s),t},Ad[gd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Td(t,Ed(e)+i),Dd(t,Md(e)-s),t};var Ld=function(t,e,i,s,r){return Ad[i](t,e,s,r)},Rd=function(t,e,i,s,r,n){cd.setPosition(e,i).setSize(s,r),Ld(t,cd,n)};const Fd=Phaser.Utils.Objects.GetValue,Bd=Phaser.GameObjects.Group,Id=Phaser.GameObjects.Container;var jd=function(t,e,i){return t.add.text(0,0,"")},zd=function(t,e){Array.isArray(t)||(t=[t]),void 0===e&&(e=[]);for(var i=0,s=t.length;i=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Qd=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const tp=/(\S+)\[(\d+)\]/i;const ep=Phaser.Utils.Objects.GetValue;var ip=function(t,e){return void 0===e?t:t[e]},sp=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ep(e,"left",0),t.right=ep(e,"right",0),t.top=ep(e,"top",0),t.bottom=ep(e,"bottom",0)),t},rp={getInnerPadding(t){return ip(this.space,t)},setInnerPadding(t,e){return sp(this.space,t,e),this},getOuterPadding(t){return ip(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return sp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ip(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),sp(this.getSizerConfig(t).padding,e,i),this}},np=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ap=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},op=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},hp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},lp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},up=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},cp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},dp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var bg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=An(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},xg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=ud),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=ud),this.transitOutCallback=t,this}},Cg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},kg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Sg={};Object.assign(Sg,bg,xg,Cg,kg);const wg=Phaser.Utils.Objects.GetValue;class _g extends In{constructor(t,e){super(t,e),this.setTransitInTime(wg(e,"duration.in",200)),this.setTransitOutTime(wg(e,"duration.out",200)),this.setTransitInCallback(wg(e,"transitIn")),this.setTransitOutCallback(wg(e,"transitOut")),this.oneShotMode=wg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new yg(this,{eventEmitter:!1,initState:wg(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(_g.prototype,Sg);const Eg=Phaser.GameObjects.Rectangle;class Tg extends Eg{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Yo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Og=Phaser.Utils.Objects.GetValue;class Pg extends In{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Og(t,"hitAreaMode",0)),this.setEnable(Og(t,"enable",!0)),this.setStopMode(Og(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Mg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Mg={default:0,fullWindow:1};const Dg=Phaser.Utils.Objects.GetValue;class Ag extends Tg{constructor(t,e){super(t,Dg(e,"color",0),Dg(e,"alpha",.8)),this.touchEventStop=new Pg(this,{hitAreaMode:1})}}var Lg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Tp(t,e)},scaleDown(t,e){Op(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Np(t,e)},fadeOut(t,e){Gp(t,e,!1)}},Rg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Np(t,e,t.alpha)},Fg=function(t,e){Gp(t,e,!1)},Bg=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Yr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Ig=Phaser.Utils.Objects.GetValue;let jg=class extends _g{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=zg.popUp),null==e.transitOut&&(e.transitOut=zg.scaleDown),e.destroy=Ig(e,"destroy",!0),super(t,e);var i=Ig(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ag(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ig(i,"transitIn",Rg)),this.setCoverTransitOutCallback(Ig(i,"transitOut",Fg)));var s=Ig(e,"touchOutsideClose",!1),r=Ig(e,"duration.hold",-1),n=Ig(e,"timeOutClose",r>=0),a=Ig(e,"anyTouchClose",!1);Ig(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ig(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Bg(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=zg[t]),t){case zg.popUp:t=Lg.popUp;break;case zg.fadeIn:t=Lg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=zg[t]),t){case zg.scaleDown:t=Lg.scaleDown;break;case zg.fadeOut:t=Lg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const zg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ng=function(t){return t&&"function"==typeof t},Gg={modal(t,e){return Ng(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new jg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Xg=function(t,e,i,s,r){Ng(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Yg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),vo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Xg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Xg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Xg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Xg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Xg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Xg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Xg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Xg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Xg.call(this,"shutdown",t,e,i,s),this}},Wg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=$g),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},$g={},Vg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Bg(t,e.x,e.y,i,s):!!(r=Wg(e,n,!0))&&Bg(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const nf={press:0,pointerdown:0,release:1,pointerup:1};var af={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new rf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},of=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!hf(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return lf.length=0,!0;return lf.length=0,!1},lf=[];const uf=Phaser.Utils.Objects.GetValue;class cf extends In{constructor(t,e){super(t,e),this._enable=void 0;var i=uf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(uf(t,"enable",!0)),this.setMode(uf(t,"mode",1)),this.setClickInterval(uf(t,"clickInterval",100)),this.setDragThreshold(uf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=df[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?of:Vg)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const df={press:0,pointerdown:0,release:1,pointerup:1};var pf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new cf(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class gf extends mg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const ff=Phaser.Utils.Objects.GetValue;class vf extends In{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new gf,this.parent.setInteractive(ff(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(ff(t,"enable",!0)),this.setCooldown(ff(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var mf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Vg(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new vf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new vf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},yf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},bf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ff,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Bf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ff,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=If,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Vg(t,s,e,i)}}const Ff=0,Bf=1,If="IDLE",jf=Phaser.Utils.Objects.GetValue,zf=Phaser.Math.Distance.Between;class Nf extends Rf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Gf},eventEmitter:!1};this.setRecongizedStateObject(new mg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(jf(t,"time",250)),this.setTapInterval(jf(t,"tapInterval",200)),this.setDragThreshold(jf(t,"threshold",9)),this.setTapOffset(jf(t,"tapOffset",10));var e=jf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(jf(t,"maxTaps",void 0)),this.setMinTaps(jf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Gf:this.state=Xf;break;case Xf:var t=this.lastPointer;zf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Yf,this.state=Xf);break;case Yf:this.state=Xf}}onDragEnd(){this.state===Xf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Yf))}onDrag(){this.state!==Gf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Gf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Xf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Gf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Yf:this.state=Gf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Yf&&(this.state=Gf)}get isTapped(){return this.state===Yf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Gf="IDLE",Xf="BEGIN",Yf="RECOGNIZED",Wf=Phaser.Utils.Objects.GetValue;class $f extends Rf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Vf},eventEmitter:!1};this.setRecongizedStateObject(new mg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Wf(t,"threshold",9)),this.setHoldTime(Wf(t,"time",251)),this}onDragStart(){this.state=Hf,0===this.holdTime&&(this.state=Uf)}onDragEnd(){this.state=Vf}onDrag(){this.state!==Vf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Vf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Hf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Uf))}get isPressed(){return this.state===Uf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Vf="IDLE",Hf="BEGIN",Uf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var qf=function(t){return Fn(t).loop.delta};const Kf=Phaser.Math.Distance.Between,Jf=Phaser.Math.Angle.Between;var Zf={getDt:function(){return qf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Kf(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Jf(e.x,e.y,t.x,t.y)}},Qf={"up&down":0,"left&right":1,"4dir":2,"8dir":3},tv={};const ev=Phaser.Utils.Objects.GetValue,iv=Phaser.Math.RadToDeg;class sv extends Rf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=rv},eventEmitter:!1};this.setRecongizedStateObject(new mg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ev(t,"threshold",10)),this.setVelocityThreshold(ev(t,"velocityThreshold",1e3)),this.setDirectionMode(ev(t,"dir","8dir")),this}onDragStart(){this.state=nv}onDragEnd(){this.state=rv}onDrag(){this.state===nv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=av))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===av&&(this.state=rv)}get isSwiped(){return this.state===av}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Qf[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=tv),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(iv(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(sv.prototype,Zf);const rv="IDLE",nv="BEGIN",av="RECOGNIZED",ov=Phaser.Utils.Objects.GetValue,hv=Phaser.Utils.Array.SpliceOne,lv=Phaser.Math.Distance.Between,uv=Phaser.Math.Angle.Between;class cv{constructor(t,e){var i=An(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(ov(e,"inputConfig",void 0)),this.setEventEmitter(ov(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(ov(t,"enable",!0)),this.bounds=ov(t,"bounds",void 0),this.tracerState=pv,this.pointers.length=0,ho(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ho(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case pv:this.tracerState=gv,this.onDrag1Start();break;case gv:this.tracerState=fv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],hv(this.pointers,e),this.tracerState){case gv:this.tracerState=pv,this.onDrag1End();break;case fv:this.tracerState=gv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case gv:this.onDrag1();break;case fv:this.onDrag2()}}}dragCancel(){return this.tracerState===fv&&this.onDrag2End(),this.pointers.length=0,ho(this.movedState),this.tracerState=pv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==fv)return 0;var t=this.pointers[0],e=this.pointers[1];return lv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==fv)return 0;var t=this.pointers[0],e=this.pointers[1];return uv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;dv.x=e.x-i.x,dv.y=e.y-i.y}else dv.x=0,dv.y=0;return dv}get centerX(){if(this.tracerState!==fv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==fv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==fv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==fv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=vv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Vg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Vg(t,s,e,i)}}Object.assign(cv.prototype,hr);var dv={};const pv=0,gv=1,fv=2,vv="IDLE";Phaser.Utils.Objects.GetValue;const mv=Phaser.Math.RotateAround;var yv=function(t,e,i,s){return mv(t,e,i,s),t.rotation+=s,t},bv={};const xv=Phaser.Utils.Objects.GetValue,Cv=Phaser.Math.Angle.WrapDegrees,kv=Phaser.Math.Angle.ShortestBetween,Sv=Phaser.Math.RadToDeg,wv=Phaser.Math.DegToRad;var _v={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=bv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Cv(Sv(this.angleBetween));this.angle=kv(this.prevAngle,t),this.prevAngle=t,this.state=Ov}break;case Ov:t=Cv(Sv(this.angleBetween));this.angle=kv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Ov}get rotation(){return wv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,_v);const Ev="IDLE",Tv="BEGIN",Ov="RECOGNIZED",Pv=Phaser.Utils.Objects.GetValue;var Mv=function(t){var e=Pv(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Nf(this,e),this._tap.on("tap",(function(t,e,s){xf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),xf(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Dv=Phaser.Utils.Objects.GetValue;var Av=function(t){var e=Dv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new $f(this,e),this._press.on("pressstart",(function(t,e,s){xf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){xf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Lv=Phaser.Utils.Objects.GetValue;var Rv=function(t){var e=Lv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new sv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";xf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),xf(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Fv=Phaser.Utils.Objects.GetValue;var Bv=function(t,e){return t.setInteractive(),Fv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Fv(e,"targets",[t]),targetMode:Fv(e,"targetMode","parent"),eventEmitter:Fv(e,"eventEmitter",t),eventNamePrefix:Fv(e,"inputEventPrefix","child.")},kf.call(t,e),_f.call(t,e),Of.call(t,e),Af.call(t,e),Mv.call(t,e),Av.call(t,e),Rv.call(t,e),t},Iv={getSizerConfig:function(t){return void 0===t&&(t=this),od(t)},getChildPrevState:function(t){var e=od(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=on(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=Fd(e,"color"),s=Fd(e,"lineWidth");var h=Fd(e,"name",!1);h&&(r=Fd(h,"createTextCallback",jd),n=Fd(h,"createTextCallbackScope",void 0),"string"==typeof(a=Fd(h,"align","left-top"))&&(a=ld[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Bd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var u,c,d=this.getAllShownChildren([this]);zd(d,d);for(var p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const Vv=Phaser.Utils.Objects.IsPlainObject,Hv=Phaser.Utils.Objects.GetValue,Uv=Phaser.Display.Align.CENTER,qv={min:0,full:-1};var Kv=function(t,e,i,s,r,n,a,o,h,l){var u,c,d,p;Xd.call(this,t);var g=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=qv[e];else if(Vv(e)){var v;e=Hv(v=e,"proportion",void 0),i=Hv(v,"align",Uv),s=Hv(v,"padding",0),r=Hv(v,"expand",!1),n=Hv(v,"key",void 0),a=Hv(v,"index",void 0),t.isRexSizer||(o=Hv(v,"minWidth",void 0),h=Hv(v,"minHeight",void 0)),l=Hv(v,"fitRatio",0),u=Hv(v,"offsetX",0),c=Hv(v,"offsetY",0),d=Hv(v,"offsetOriginX",0),p=Hv(v,"offsetOriginY",0)}return"string"==typeof i&&(i=ld[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Uv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Ir(t)/jr(t)),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===p&&(p=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=Cl(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=u,v.alignOffsetY=c,v.alignOffsetOriginX=d,v.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Ir(t):o:t.minHeight=void 0===h?jr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Jv={add:Kv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Kv.call(this,new Wv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Vv(i)&&(i.index=t),Kv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=$v.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Zv=sl.prototype.clear;var Qv=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Zv.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Qv.call(this,t),this}},im={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=ld[e]),this.getSizerConfig(t).align=e,this}},sm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},rm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},nm={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},am={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(fp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,dp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u,c,d=this.sizerChildren,p=this.innerLeft,g=this.innerTop,f=this.innerWidth,v=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=hp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ap.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Xv.call(this,t,void 0),op.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||lp.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Xv.call(this,void 0,t),up.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(am,Jv,em,im,sm,rm,nm);var om=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},hm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},lm=function(t){return"string"==typeof t&&(t=hm[t]),t};const um=Phaser.Utils.Objects.IsPlainObject,cm=Phaser.Utils.Objects.GetValue;class dm extends zv{constructor(t,e,i,s,r,n,a){um(e)?(e=cm(a=e,"x",0),i=cm(a,"y",0),s=cm(a,"width",void 0),r=cm(a,"height",void 0),n=cm(a,"orientation",0)):um(s)?(s=cm(a=s,"width",void 0),r=cm(a,"height",void 0),n=cm(a,"orientation",0)):um(n)&&(n=cm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(cm(a,"space.item",0)),this.setStartChildIndex(cm(a,"startChildIndex",0)),this.setRTL(cm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=lm(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=om.call(this)),this._childrenProportion}}Object.assign(dm.prototype,am);var pm=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},gm=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},fm={appendText:gm,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class vm extends dm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(pm(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(pm(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&pm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&pm(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(vm.prototype,fm);var mm=function(t,e,i,s){var r=new wl(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const ym=Phaser.Utils.Objects.GetValue;const bm=Phaser.Utils.Objects.GetValue;var xm=/^[\x00-\x7F]+$/,Cm=function(t){return xm.test(t)},km=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},wm=0,_m=1,Em=2,Tm=0,Om=1,Pm=2,Mm=/(?:\r\n|\r|\n)/;const Dm={none:Tm,word:Om,char:Pm,character:Pm,mix:3};var Am=function(t,e){switch(jc(t)){case 0:switch("string"==typeof e&&(e=Dm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=km;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Dm[e]||0),t.style.wrapMode=e}};const Lm=Phaser.Renderer.WebGL.Utils;var Rm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Lm.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Fm=Phaser.Display.Color;var Bm={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Fm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Im=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},jm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Im(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Qo();const zm=Phaser.Display.Canvas.CanvasPool,Nm=Phaser.GameObjects.GameObject,Gm=Phaser.Utils.String.UUID;class Xm extends Nm{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=zm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Gm(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){zm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Ym=Phaser.GameObjects.Components;Phaser.Class.mixin(Xm,[Ym.Alpha,Ym.BlendMode,Ym.Crop,Ym.Depth,Ym.Flip,Ym.GetBounds,Ym.Mask,Ym.Origin,Ym.Pipeline,Ym.PostPipeline,Ym.ScrollFactor,Ym.Tint,Ym.Transform,Ym.Visible,Rm,Bm,jm]);let Wm=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Wm.prototype,Kl);var $m={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Vm=Phaser.Math.RotateAround;var Hm;const Um=Phaser.Geom.Rectangle;var qm,Km=function(t){void 0===qm&&(qm=new Um);var e=t.drawTLX,i=t.drawTLY;return qm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),qm};const Jm=Phaser.Math.RotateAround;var Zm,Qm=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Zm&&(Zm={}),s=Zm),s.x=e,s.y=i,0!==t.rotation&&Jm(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ty=Phaser.GameObjects.Components.TransformMatrix;var ey,iy,sy={},ry=function(t,e,i,s,r){var n=Qm(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=sy);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ey&&(ey=new ty,iy=new ty),t.parentContainer?t.getWorldTransformMatrix(ey,iy):ey.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ey.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ny=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return ry(t,e,n,a,r)},ay={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hm&&(Hm={}),s=Hm),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Vm(s,0,0,-i.rotation),s}(t,e,this,!0);return Km(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ny(this.parent,this,t,e,i)}};Object.assign(ay,$m);const oy=Phaser.Math.DegToRad,hy=Phaser.Math.RadToDeg,ly=Phaser.Utils.Objects.GetValue;class uy extends Wm{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return hy(this._rotation)}set angle(t){this.rotation=oy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ly(t,"width",void 0),i=ly(t,"height",void 0),s=ly(t,"scaleX",void 0),r=ly(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(uy.prototype,ay);const cy=Phaser.Utils.String.Pad;var dy=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${cy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},py=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const gy=Phaser.Utils.Objects.GetValue;let fy=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=gy(t,"x",0),i=gy(t,"y",0));var s=this.cornerRadius;s.tl=vy(gy(t,"tl",void 0),e,i),s.tr=vy(gy(t,"tr",void 0),e,i),s.bl=vy(gy(t,"bl",void 0),e,i),s.br=vy(gy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){my(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){my(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){my(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){my(this.cornerRadius.br,t)}};var vy=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),yy(t),t},my=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=gy(e,"x",0),t.y=gy(e,"y",0)),yy(t)},yy=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const by=Phaser.Math.DegToRad;var xy=function(t){return!t.hasOwnProperty("convex")||t.convex},Cy=function(t){return t.x>0&&t.y>0},ky=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Cy(o)?(h=o.x*f,l=o.y*v,xy(o)?ky(t,h,l,h,l,180,270,!1,a):ky(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,Cy(o)?(h=o.x*f,l=o.y*v,xy(o)?ky(t,s-h,l,h,l,270,360,!1,a):ky(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Cy(o)?(h=o.x*f,l=o.y*v,xy(o)?ky(t,s-h,r-l,h,l,0,90,!1,a):ky(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Cy(o)?(h=o.x*f,l=o.y*v,xy(o)?ky(t,h,r-l,h,l,90,180,!1,a):ky(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},wy=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),Sy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const _y=Phaser.Utils.Objects.GetValue;class Ey extends uy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(_y(e,"color",null),_y(e,"color2",null),_y(e,"horizontalGradient",!0)),this.setStroke(_y(e,"stroke",null),_y(e,"strokeThickness",2)),this.setCornerRadius(_y(e,"cornerRadius",0),_y(e,"cornerIteration",null))}set color(t){t=dy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=dy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=dy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,py("color2",t,this),py("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,py("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,py("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){wy(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ty=Phaser.Utils.Objects.GetValue;class Oy extends uy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ty(e,"color",null),Ty(e,"color2",null),Ty(e,"horizontalGradient",!0)),this.setStroke(Ty(e,"stroke",null),Ty(e,"strokeThickness",2))}set color(t){t=dy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=dy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=dy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ty(t,"color2",null),Ty(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ty(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Py=Phaser.Utils.Objects.GetValue;let My=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Py(t,"bold",!1)),this.setItalic(Py(t,"italic",!1)),this.setFontSize(Py(t,"fontSize","16px")),this.setFontFamily(Py(t,"fontFamily","Courier")),this.setColor(Py(t,"color","#fff")),this.setStrokeStyle(Py(t,"stroke",null),Py(t,"strokeThickness",0)),this.setShadow(Py(t,"shadowColor",null),Py(t,"shadowOffsetX",0),Py(t,"shadowOffsetY",0),Py(t,"shadowBlur",0)),this.setOffset(Py(t,"offsetX",0),Py(t,"offsetY",0)),this.setSpace(Py(t,"leftSpace",0),Py(t,"rightSpace",0)),this.setAlign(Py(t,"align",void 0)),this.setBackgroundColor(Py(t,"backgroundColor",null)),this.setBackgroundHeight(Py(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Py(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Py(t,"backgroundLeftX",0)),this.setBackgroundRightX(Py(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(py("stroke",t,this),py("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(py("shadowOffsetX",t,this),py("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=dy(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=dy(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=dy(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=dy(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Dy=Phaser.Utils.Array.Remove;const Ay=Phaser.Utils.Array.Remove;const Ly="text",Ry="image",Fy="drawer",By="space",Iy="command";var jy=function(t){return t.type===Ly&&"\n"===t.text},zy=function(t){return t.type===Ly&&"\f"===t.text},Ny=function(t){return t.type===Ly};class Gy extends uy{constructor(t,e,i){super(t,Ly),this.updateTextFlag=!1,this.style=new My(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Xy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yy=Phaser.Display.Canvas.CanvasPool;var Wy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Yy.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Yy.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class $y extends uy{constructor(t,e,i){super(t,Ry),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Wy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Vy extends uy{constructor(t,e,i,s){super(t,Fy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Hy extends uy{constructor(t,e){super(t,By),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Uy extends Wm{constructor(t,e,i,s,r){super(t,Iy),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var qy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ky={none:0,word:1,char:2,character:2,mix:3};var Jy=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=eb.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=eb.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=sb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=sb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=sb(t,"wrapMode");void 0===c&&(c=sb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Ky[c]);var d=sb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=sb(t,"letterSpacing",0),g=sb(t,"hAlign",0),f=sb(t,"vAlign",0),v=sb(t,"justifyPercentage",.25),m=qy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(P.push({children:M,width:D}),A=Math.max(A,D)),m.start+=O.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=A,m.linesHeight=P.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ab(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ab(t,"maxLines",0);var o=0===i,h=ab(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ab(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=ab(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=ab(t,"letterSpacing",0),p=ab(t,"rtl",!0),g=ab(t,"hAlign",p?2:0),f=ab(t,"vAlign",0),v=qy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(O.push({children:P,height:M}),D=Math.max(D,M)),v.start+=T.length,v.isLastPage=v.start===E,v.maxLineHeight=D,v.linesWidth=O.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return sp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return ip(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Dy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ay(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ly);return null===i?i=new Gy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ny(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Nb(t,r,e,i,n),o=0;o<=Ib&&0!==a;o++){if((r+=a)<0){r=0;break}a=Nb(t,r,e,i,n)}return o===Ib&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Gb(t,e,i),t},zb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Nb=function(t,e,i,s,r){var n,a=zb(t,e,r),o=zb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Gb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Xb=Phaser.Utils.Objects.GetValue;var Yb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Xb(e,"minWidth",0),s=Xb(e,"minHeight",0),r=Xb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return jb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),jb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Wb=Phaser.Utils.Objects.GetValue,$b=[function(t){var e=this.scene,i=ym(t,"orientation",0);this.setOrientation(i);var s=ym(t,"icon",void 0),r=ym(t,"iconMask",void 0),n=ym(t,"innerBackground",void 0),a=ym(t,"title",void 0),o=ym(t,"separator",void 0),h=ym(t,"text",void 0),l=ym(t,"action",void 0),u=ym(t,"actionMask",void 0);if(s){var c=ym(t,"align.icon","center");m=0===this.orientation?{right:ym(t,"space.icon",0),top:ym(t,"space.iconTop",0),bottom:ym(t,"space.iconBottom",0),left:ym(t,"space.iconLeft",0)}:{bottom:ym(t,"space.icon",0),left:ym(t,"space.iconLeft",0),right:ym(t,"space.iconRight",0),top:ym(t,"space.iconTop",0)};var d=ym(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=mm.call(this,s,s,1)),!d){var p=ym(t,"iconSize",void 0);this.setIconSize(ym(t,"iconWidth",p),ym(t,"iconHeight",p))}}var g=new dm(e,{orientation:1});n&&g.addBackground(n);var f=ym(t,"space.separator",0);if(a){c=ym(t,"align.title","left");var v=ym(t,"expandTitleWidth",!1);y=ym(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?ym(t,"space.title",f):0,left:ym(t,"space.titleLeft",0),right:ym(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:ym(t,"space.separatorLeft",0),right:ym(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=ym(t,"align.text","left");var y,b,x=ym(t,"expandTextWidth",!1);y=ym(t,"expandTextHeight",!1)?1:0,b=x,m={left:ym(t,"space.textLeft",0),right:ym(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:ym(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=ym(t,"align.action","center");m=0===this.orientation?{top:ym(t,"space.actionTop",0),bottom:ym(t,"space.actionBottom",0),right:ym(t,"space.actionRight",0)}:{left:ym(t,"space.actionLeft",0),right:ym(t,"space.actionRight",0),bottom:ym(t,"space.actionBottom",0)};d=ym(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=mm.call(this,l,l,1)),!d){var C=ym(t,"actionSize");this.setActionSize(ym(t,"actionWidth",C),ym(t,"actionHeight",C))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=bm(t,"title",void 0),s=bm(t,"separator",void 0),r=bm(t,"innerBackground",void 0),n=bm(t,"icon",void 0),a=bm(t,"iconMask",void 0),o=bm(t,"text",void 0),h=bm(t,"action",void 0),l=bm(t,"actionMask",void 0);if(i){var u=bm(t,"align.title","left"),c=bm(t,"expandTitleWidth",!1);y=bm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:bm(t,"space.title",0),left:bm(t,"space.titleLeft",0),right:bm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=bm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:bm(t,"space.separatorLeft",0),right:bm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=bm(t,"orientation",0),f=new dm(e,{orientation:g,rtl:bm(t,"rtl",!1),space:{left:bm(t,"space.innerLeft",0),right:bm(t,"space.innerRight",0),top:bm(t,"space.innerTop",0),bottom:bm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=bm(t,"align.icon","center");p=0===f.orientation?{right:bm(t,"space.icon",0),top:bm(t,"space.iconTop",0),bottom:bm(t,"space.iconBottom",0),left:bm(t,"space.iconLeft",0)}:{bottom:bm(t,"space.icon",0),left:bm(t,"space.iconLeft",0),right:bm(t,"space.iconRight",0),top:bm(t,"space.iconTop",0)};var v=bm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=mm.call(this,n,n,1)),!v){var m=bm(t,"iconSize",void 0);this.setIconSize(bm(t,"iconWidth",m),bm(t,"iconHeight",m))}}if(o){u=bm(t,"align.text","left");var y,b,x=bm(t,"space.text",0),C=bm(t,"expandTextWidth",!1),k=bm(t,"expandTextHeight",!1);0===f.orientation?(y=C?1:0,h&&(p={right:x}),b=k):(y=k?1:0,h&&(p={bottom:x}),b=C),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=bm(t,"align.action","center");p=0===f.orientation?{top:bm(t,"space.actionTop",0),bottom:bm(t,"space.actionBottom",0),right:bm(t,"space.actionRight",0)}:{left:bm(t,"space.actionLeft",0),right:bm(t,"space.actionRight",0),bottom:bm(t,"space.actionBottom",0)};v=bm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=mm.call(this,h,h,1)),!v){var S=bm(t,"actionSize");this.setActionSize(bm(t,"actionWidth",S),bm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class Vb extends vm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Wb(e,"background",void 0);i&&this.addBackground(i);var s=Wb(e,"title",void 0),r=Wb(e,"text",void 0);if(s){var n=Wb(e,"wrapTitle",!1),a=Wb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Am(s,n),e.expandTitleWidth=!0,Bb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(s,{fitHeight:!0}))}if(r){var o=Wb(e,"wrapText",!1),h=Wb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Am(r,o),e.expandTextWidth=!0,Bb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(r,{fitHeight:!0}))}var l=Wb(e,"layoutMode",0);($b[l]||$b[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Hb extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=nd(i,"expandTextWidth",!1),n=nd(i,"expandTextHeight",!1);if(r||n){var a=jc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(nd(i,"typingMode","page")),this.page=new Uc(s,nd(i,"page",void 0)),this.typing=new sd(s,nd(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=ad[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(Vb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Ub=Phaser.GameObjects.GetCalcMatrix;const qb=Phaser.Renderer.Canvas.SetTransform;var Kb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ub(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Ql(r,a,e,l,o,h),e.isStroked&&eu(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(qb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Zb.prototype,Kb);var Qb=function(t){return t.x>0&&t.y>0};const tx=Phaser.Utils.Objects.IsPlainObject,ex=Phaser.Utils.Objects.GetValue,ix=Phaser.Geom.Polygon.Earcut;class sx extends Zb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(tx(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new fy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=ex(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(ex(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,Qb(i))if(i.convex){var o=i.x,h=i.y;hu(o,h,i.x,i.y,180,270,!1,a,e)}else{hu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else au(0,0,e);if(i=n.tr,Qb(i))if(i.convex){o=s-i.x,h=i.y;hu(o,h,i.x,i.y,270,360,!1,a,e)}else{hu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else au(s,0,e);if(i=n.br,Qb(i))if(i.convex){o=s-i.x,h=r-i.y;hu(o,h,i.x,i.y,0,90,!1,a,e)}else{hu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else au(s,r,e);if(i=n.bl,Qb(i))if(i.convex){o=i.x,h=r-i.y;hu(o,h,i.x,i.y,90,180,!1,a,e)}else{hu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else au(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=ix(e),this}setShapeType(t){return"string"==typeof t&&(t=rx[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const rx={rectangle:0,circle:1};var nx=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},ax=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const fx=Phaser.Utils.Objects.GetValue,vx=Phaser.Utils.Objects.IsPlainObject;class mx extends(rc(Ul)){constructor(t,e,i,s,r,n,a,o){vx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):vx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):vx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Ru).setName("trackFill")).addShape((new Ru).setName("bar")).addShape((new Ru).setName("trackStroke")),this.setTrackColor(fx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(fx(o,"trackStrokeThickness",2),fx(o,"trackStrokeColor",void 0)),this.setSkewX(fx(o,"skewX",0)),this.setRTL(fx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var yx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&gx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),gx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&gx(o,0,0,e,i,t)}};Object.assign(mx.prototype,yx);class bx extends mx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=xx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const xx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(bx.prototype,cx);let Cx=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const kx=Phaser.GameObjects.NineSlice,Sx=Phaser.Utils.Objects.GetValue;class wx extends kx{constructor(t,e){void 0===e&&(e={}),super(t,Sx(e,"x",0),Sx(e,"y",0),Sx(e,"key",null),Sx(e,"frame",null),Sx(e,"width",0),Sx(e,"height",0),Sx(e,"leftWidth",0),Sx(e,"rightWidth",0),Sx(e,"topHeight",0),Sx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=Sx(e,"effects",!0);i&&Or(this,i),this.style=new Cx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(wx.prototype,cx);let _x=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Ex=Phaser.GameObjects.Image,Tx=Phaser.Utils.Objects.GetValue;class Ox extends Ex{constructor(t,e){void 0===e&&(e={}),super(t,Tx(e,"x",0),Tx(e,"y",0),Tx(e,"key",""),Tx(e,"frame",void 0)),this.type="rexStatesImage";var i=Tx(e,"effects",!0);i&&Or(this,i),this.style=new _x(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ox.prototype,cx);var Px=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Mx=Phaser.Utils.Objects.IsPlainObject,Dx=Phaser.Utils.Objects.GetValue;var Ax=function(t){return"string"==typeof t&&(t=Lx[t]),t};const Lx={scale:0,repeat:1};var Rx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Fx={_beginDraw:ud,_drawImage:ud,_drawTileSprite:ud,_endDraw:ud,setGetFrameNameCallback:function(t){return void 0===t&&(t=Px),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var _=typeof(m=this.getFrameNameCallback(h,k,e));"string"!==_&&"number"!==_||r.add(m,0,x+n.cutX,C+n.cutY,v,f)}x+=v}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Mx(t)?(this.stretchMode.edge=Ax(Dx(t,"edge",0)),this.stretchMode.internal=Ax(Dx(t,"internal",0))):(t=Ax(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Rx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Bx=Phaser.Utils.Objects.IsPlainObject,Ix=Phaser.Utils.Objects.GetValue;const jx=Phaser.GameObjects;var zx=void 0,Nx=function(t,e){if(zx||(zx={},Fn(t).events.once("destroy",(function(){for(var t in zx)zx[t].destroy();zx=void 0}))),!zx.hasOwnProperty(e)){var i=Fn(t).scene.systemScene;(t=new jx[e](i)).setOrigin(0),zx[e]=t}return zx[e]};const Gx=Phaser.GameObjects.RenderTexture;class Xx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Bx(i)?(i=Ix(u=i,"x",0),s=Ix(u,"y",0),r=Ix(u,"width",1),n=Ix(u,"height",1),a=Ix(u,"key",void 0),o=Ix(u,"baseFrame",void 0),h=Ix(u,"columns",void 0),l=Ix(u,"rows",void 0)):Bx(r)?(r=Ix(u=r,"width",1),n=Ix(u,"height",1),a=Ix(u,"key",void 0),o=Ix(u,"baseFrame",void 0),h=Ix(u,"columns",void 0),l=Ix(u,"rows",void 0)):Bx(a)?(a=Ix(u=a,"key",void 0),o=Ix(u,"baseFrame",void 0),h=Ix(u,"columns",void 0),l=Ix(u,"rows",void 0)):Bx(o)?(o=Ix(u=o,"baseFrame",void 0),h=Ix(u,"columns",void 0),l=Ix(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Ix(u,"baseFrame",void 0)):Bx(h)&&(h=Ix(u=h,"columns",void 0),l=Ix(u,"rows",void 0)),void 0===o&&(o=Ix(u,"frame",void 0)),void 0===h){var c=Ix(u,"leftWidth",void 0),d=Ix(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Ix(u,"topHeight",void 0),g=Ix(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Ix(u,"getFrameNameCallback",void 0)),this.setStretchMode(Ix(u,"stretchMode",0)),this.setPreserveRatio(Ix(u,"preserveRatio",!0));var f=Ix(u,"maxFixedPartScale",1),v=Ix(u,"maxFixedPartScaleX",f),m=Ix(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Fx),i}(Gx,"rexNinePatch")){}var Yx={_drawImage:function(t,e,i,s,r,n){var a=Nx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Nx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Xx.prototype,Yx);let Wx=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const $x=Phaser.Utils.Objects.GetValue;class Vx extends Xx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=$x(e,"effects",!0);i&&Or(this,i),this.style=new Wx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Vx.prototype,cx);const Hx=["alpha","tint","flipX","flipY"];var Ux=function(t,e){if(!e)return t;for(var i=0,s=Hx.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const aC=Phaser.Display.Canvas.CanvasPool;var oC=function(t){var e=aC.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return aC.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,aC.remove(e),a;var u,c,d=i.getImageData(0,0,o,l).data,p=d.length,g=4*o,f=0,v=!1;for(u=0;uh;u--){for(c=0;c0&&this.wrapMode!==Tm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Dm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=lC(t,l,u);else{var d=hC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=lC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=lC(t,"fill",null);null!==g&&(this.color=dy(g));var f=lC(t,"metrics",!1);return f?this.metrics={ascent:lC(f,"ascent",0),descent:lC(f,"descent",0),fontSize:lC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=oC(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=oC(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=lC(t,"fontFamily","Courier"),this.fontSize=lC(t,"fontSize","16px"),this.fontStyle=lC(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=dy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=dy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=dy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=dy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=dy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=dy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=dy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Dm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=lC(e,"fontFamily",this.fontFamily),this.fontSize=lC(e,"fontSize",this.fontSize),this.fontStyle=lC(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var cC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),wy(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const dC=Phaser.Utils.Objects.GetValue,pC=wm,gC=_m;class fC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=dC(t,"text",""),this.x=dC(t,"x",0),this.y=dC(t,"y",0),this.width=dC(t,"width",0);var e=dC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=dC(t,"newLineMode",0),this.startIndex=dC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===gC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==pC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===gC&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const vC=Phaser.Utils.Objects.GetFastValue,mC=wm,yC=Em;class bC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=vC(t,"tagToText",ud),this.tagToTextScope=vC(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var xC={};const CC=Phaser.Geom.Rectangle;var kC=new Da;class SC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&IC(f)){""!==b?a.push(n.getLine(b,x,MC)):0===C&&r>0&&a.push(n.getLine("",0,MC)),a.push(...FC(f,e,LC,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,MC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},BC=function(t,e){var i;switch(e){case AC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==zC&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new bC({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Vk(this.sizerChildren,null),Qv.call(this,t),this}},Uk={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Vk(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Zk={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=hp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Vk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Vk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},tS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eS=Phaser.Utils.Objects.IsPlainObject,iS=Phaser.Utils.Objects.GetValue;class sS extends zv{constructor(t,e,i,s,r,n,a,o,h,l){eS(e)?(e=iS(l=e,"x",0),i=iS(l,"y",0),s=iS(l,"width",void 0),r=iS(l,"height",void 0),n=iS(l,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(s)?(s=iS(l=s,"width",void 0),r=iS(l,"height",void 0),n=iS(l,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(n)?(n=iS(l=n,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(o)&&(o=iS(l=o,"columnProportions",0),h=iS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(iS(l,"createCellContainerCallback")),this.setIndentLeft(iS(l,"space.indentLeftOdd",0),iS(l,"space.indentLeftEven",0)),this.setIndentTop(iS(l,"space.indentTopOdd",0),iS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,iS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Qk.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=tS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(sS.prototype,Zk);const rS=Phaser.Utils.Objects.GetValue;const nS=Phaser.Math.Percent;var aS=function(t,e,i){var s;return t.y===e.y?s=nS(i.x,t.x,e.x):t.x===e.x&&(s=nS(i.y,t.y,e.y)),s},oS=function(t,e,i){var s,r;this.enable&&(hS.x=e,hS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=aS(s,r,hS))},hS={},lS=function(t,e,i){if(this.enable&&t.isDown){var s,r;uS.x=t.worldX,uS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=aS(s,r,uS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},uS={},cS=function(t,e){void 0===e&&(e=dS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Rd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},dS={};const pS=Phaser.Display.Align.LEFT_CENTER,gS=Phaser.Display.Align.TOP_CENTER;var fS={};const vS=Phaser.Display.Align.RIGHT_CENTER,mS=Phaser.Display.Align.BOTTOM_CENTER;var yS={};const bS=Phaser.Math.Linear;var xS={};const CS=Phaser.Display.Align.LEFT_CENTER,kS=Phaser.Display.Align.TOP_CENTER,SS=Phaser.Display.Align.RIGHT_CENTER,wS=Phaser.Display.Align.BOTTOM_CENTER;const _S=Phaser.Utils.Objects.GetValue,ES=Phaser.Utils.Objects.IsPlainObject,TS=Phaser.Math.Clamp,OS=Phaser.Math.Snap.To;class PS extends(rc(dm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=_S(e,"reverseAxis",!1);var i=_S(e,"background",void 0),s=_S(e,"track",void 0),r=_S(e,"indicator",void 0),n=_S(e,"thumb",void 0);if(i&&(ES(i)&&(i=qx(t,i)),this.addBackground(i)),s&&(ES(s)&&(s=qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(ES(r)&&(r=qx(t,r)),this.pin(r)),n){ES(n)&&(n=qx(t,n)),this.pin(n);var a=_S(e,"thumbOffsetX",0),o=_S(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=_S(e,"input",0);switch("string"==typeof h&&(h=MS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",oS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",lS,this).on("pointermove",lS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(_S(e,"enable",void 0)),this.setGap(_S(e,"gap",void 0)),this.setValue(_S(e,"value",0),_S(e,"min",void 0),_S(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=OS(t,this.gap));var e=this._value;this._value=TS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const MS={pan:0,drag:0,click:1,none:-1};var DS={getStartPoint:function(t){if(void 0===t&&(t=fS),this.childrenMap.thumb){var e=0===this.orientation?pS:gS;cS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=yS),this.childrenMap.thumb){var e=0===this.orientation?vS:mS;cS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=xS),s.x=bS(e.x,i.x,t),s.y=bS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=Ir(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=jr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;fp(e,i,s),r=n?0===this.orientation?SS:wS:0===this.orientation?CS:kS,Ld(e,this,r),this.resetChildPositionState(e)}};Object.assign(PS.prototype,DS);const AS=Phaser.Utils.Objects.GetValue;class LS extends dm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=AS(e,"background",void 0),r=AS(e,"buttons",void 0),n=AS(r,"top",AS(r,"left",void 0)),a=AS(r,"bottom",AS(r,"right",void 0)),o=AS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new vf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===AS(o,"width",void 0)?1:0;else h=void 0===AS(o,"height",void 0)?1:0;i=new PS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new vf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=AS(e,"valuechangeCallback",null);if(null!==u){var c=AS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(AS(e,"enable",void 0)),this.setValue(AS(e,"value",0)),this.setScrollStep(AS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class RS extends mg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const FS=Phaser.Utils.Objects.GetValue,BS=Phaser.Math.Distance.Between;class IS extends In{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=FS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(FS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(FS(t,"enable",!0)),this.holdThreshold=FS(t,"holdThreshold",50),this.pointerOutReleaseEnable=FS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:BS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Vg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Vg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jS=Phaser.Utils.Objects.GetValue;class zS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jS(t,"value",0)),this.setSpeed(jS(t,"speed",0)),this.setAcceleration(jS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class NS{constructor(){this.value,this.dir,this.movement=new zS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const WS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},$S=Phaser.Utils.Objects.GetValue;class VS extends In{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=$S(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed($S(e,"speed",.1)),this.setEnable($S(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive($S(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Vg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const HS=Phaser.Utils.Objects.GetValue;var US=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?HS(s,l,void 0):HS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=lo(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new LS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=HS(r,"position",0);"string"==typeof p&&(p=qS[p]);var g,f,v=HS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=HS(s,"space.slider",void 0))&&(o?v=0:g=HS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:HS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:HS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:HS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:HS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=HS(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=HS(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=HS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=HS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=HS(s,"scrollDetectionMode");"string"==typeof b&&(b=KS[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?HS(s,x,!0):HS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new XS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=HS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new VS(h,E)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n)&&(o?(k=a?"t":"s",w=`scroll${i}`):(k="t",w="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));C&&(_=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[_](-e,!0)})))};const qS={right:0,left:1,bottom:0,top:1},KS={gameObject:0,rectBounds:1},JS=Phaser.Utils.Objects.GetValue;var ZS=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=JS(e,"width"),a=JS(e,"height");n||(JS(e,"child.expandWidth",!0)||(s[1]=0));a||(JS(e,"child.expandHeight",!0)||(r[1]=0));var o=new sS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=rS(i,"child"),r=rS(s,"gameObject",void 0);if(r){var n=rS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=rS(n,"top",0),a.bottom=rS(n,"bottom",0),o.left=rS(n,"left",0),o.right=rS(n,"right",0);break;case 1:a.top=rS(n,"left",0),a.bottom=rS(n,"right",0),o.top=rS(n,"top",0),o.bottom=rS(n,"bottom",0);break;default:a.top=rS(n,"top",0),a.bottom=rS(n,"bottom",0),a.left=rS(n,"left",0),a.right=rS(n,"right",0)}e.add(r,{column:1,row:1,align:rS(s,"align","center"),padding:o,expand:{width:rS(s,"expandWidth",!0),height:rS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:US(t,o,"y",e);break;case 1:US(t,o,"x",e);break;default:US(t,o,"y",e),US(t,o,"x",e)}return o},QS=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},tw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},ew=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var yw=function(t){return t.add.text(0,0,"")};Object.assign(mw.prototype,pw);var bw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},xw={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Cw=Phaser.Utils.Objects.GetValue;class kw extends nw{constructor(t,e){void 0===e&&(e={});var i=Cw(e,"text",void 0),s=Cw(e,"textWidth",void 0),r=Cw(e,"textHeight",void 0),n=Cw(e,"textCrop",!!i.setCrop),a=Cw(e,"textMask",!n),o=Cw(e,"content",""),h=new mw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Cw(e,"clampChildOY",!1),alwaysScrollable:Cw(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=Cw(e,"space",void 0);l&&(l.child=Cw(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(kw.prototype,bw,xw);const Sw=Phaser.Utils.Objects.GetValue;var ww=function(t,e,i){e=e?y(e):{};var s=Sw(i,"background",qx),r=Sw(i,"text",_w),n=Sw(i,"track",qx),a=Sw(i,"thumb",qx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new kw(t,e);return t.add.existing(h),h},_w=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Ak(t,e);break;case"bbcodetext":case"bbcode":s=new Ok(t,0,0,"",e);break;case"label":s=new Fk(t,e);break;case"textarea":s=ww(t,e);break;default:s=new Zx(t,e)}return Ux(s,e),t.add.existing(s),s},Ew=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Vx(t,e):new wx(t,e);break;case"roundRectangle":s=new dx(t,e);break;default:s=new Ox(t,e)}return Ux(s,e),t.add.existing(s),s};const Tw=Phaser.Utils.Objects.GetValue;var Ow=function(t,e,i){e=e?y(e):{};var s=Tw(i,"background",qx),r=Tw(i,"text",_w),n=Tw(i,"icon",Ew),a=Tw(i,"action",Ew);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Pw=Phaser.Utils.Objects.GetValue;var Mw=function(t,e,i){var s,r,n=Pw(i,"innerBackground",qx),a=Pw(i,"separator",qx),o=Pw(i,"title",_w);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Ow(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Dw extends Hb{constructor(t,e,i){super(t,e=Mw(t,e,i))}}var Aw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ol(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Lw=Phaser.Utils.Objects.GetValue;class Rw extends Ul{constructor(t,e){super(t,Lw(e,"x",0),Lw(e,"y",0),Lw(e,"width",64),Lw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Lw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Lw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Lw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Lw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Lw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Lw(t,"color",i)),i=e?0:this.value,this.setValue(Lw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Rw.prototype,Aw);const Fw=Phaser.Math.DegToRad,Bw=Phaser.Math.Linear,Iw=Phaser.Math.Easing.Expo.In,jw={right:0,down:1,left:2,up:3};var zw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Gw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Gw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Gw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Gw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Gw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Gw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Nw={},Gw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Nw.x=a*u+o*c+r,Nw.y=h*u+l*c+n,Nw},Yw={setDirection(t){return"string"==typeof t&&(t=jw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Ru)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Fw(315);i=Math.cos(a),s=Math.sin(a);var o=Fw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Fw(135);i=Math.cos(a),s=Math.sin(a);o=Fw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Fw(225);i=Math.cos(a),s=Math.sin(a);o=Fw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Fw(45);i=Math.cos(a),s=Math.sin(a);o=Fw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=Cl(s),K_(r)?(d.expandWidth=J_(r,"width",!1),d.expandHeight=J_(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),d.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},eE={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),qd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Qv.call(this,t),this}},iE={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,Zg.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(U_.width=e.aspectRatio,U_.height=1,q_.width=l,q_.height=u,l=(c=hl(U_,q_,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Nv(t,this)):fp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Ir(t)),void 0===u&&(u=jr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,Qg.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(iE,tE,eE);const sE=Phaser.Utils.Objects.IsPlainObject,rE=Phaser.Utils.Objects.GetValue;class nE extends zv{constructor(t,e,i,s,r,n){sE(e)?(e=rE(n=e,"x",0),i=rE(n,"y",0),s=rE(n,"width",void 0),r=rE(n,"height",void 0)):sE(s)&&(s=rE(n=s,"width",void 0),r=rE(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(nE.prototype,iE);const aE=dm.prototype.add,oE=dm.prototype.addSpace;var hE=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&oE.call(this),aE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&oE.call(this),this.hasTailSpace=s}else aE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;aE.call(this,t,{index:r,proportion:i,expand:!0})}else aE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},lE={addButton(t){if(Hg(t))for(var e=t,i=0,s=e.length;i=0;i--)dE.call(this,e[i],t);return this}},gE=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},fE=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,gE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},vE={add(t){return this.buttons.push(t),t._click||(t._click=new rf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),fE.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=ME(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=ME(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const AE=Phaser.Utils.Objects.IsPlainObject,LE=Phaser.Utils.Objects.GetValue,RE=Phaser.Display.Align.CENTER;var FE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Yd.call(this,t),AE(e))&&(e=LE(h=e,"padding",0),i=LE(h,"key",void 0),s=LE(h,"index",void 0),r=LE(h,"offsetX",0),n=LE(h,"offsetY",0),a=LE(h,"offsetOriginX",0),o=LE(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=RE,h.padding=Cl(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},BE={add(t,e,i){if(Hg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Qv.call(this,t),this}},zE={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&VE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)JE.call(this,e[i],t);return this}};const QE=Phaser.Utils.Objects.GetValue;class tT extends WE{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new SE({parent:this,eventEmitter:QE(e,"eventEmitter",this),groupName:QE(e,"groupName",void 0),clickConfig:QE(e,"click",void 0)}).setButtonsType(e);var s=QE(e,"background",void 0),r=QE(e,"buttons",void 0);this.buttonsAlign=QE(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(tT.prototype,UE,ZE,kE,_E);const eT=sS.prototype.add;var iT={addButton(t,e,i){return eT.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)nT.call(this,e[i],t);return this}};const oT=Phaser.Utils.Objects.GetValue;class hT extends sS{constructor(t,e){void 0===e&&(e={});var i=oT(e,"row",0),s=oT(e,"column",e.col||0),r=oT(e,"createCellContainerCallback"),n=oT(e,"buttons",void 0),a=oT(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(rO(this),nO(this)),this}setNumberInput(){return this.onUpdateCallback=sO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const hO=Phaser.Utils.Objects.GetValue,lO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var uO=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},cO=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ax(t.style,e);kl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},dO=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ax(t,e);kl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function pO(){}function gO(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}pO.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(gO(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const fO=new pO;const vO=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,mO=/\S/,yO=new pO;yO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!mO.test(t)&&!mO.test(e)},yO.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(kO(t,null,null,i),i," ")},CO.equals=function(t,e){return pO.prototype.equals.call(CO,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const SO=new pO;SO.tokenize=function(t){return t.slice()},SO.join=SO.removeEmpty=function(t){return t};const wO=Phaser.Utils.Array.Remove;var _O=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),wO(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,fO.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},MO={cursorMoveLeft(){if(!this.isOpened)return this;var t=TO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=TO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=OO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=TO(PO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=OO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=TO(PO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const DO=Phaser.Utils.Objects.IsPlainObject;class AO extends Fb{constructor(t,e,i,s,r,n){DO(e)?n=e:DO(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new $o(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=nx(n.background,"focus"),h=nx(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=hO(e,"edit");return void 0===i&&(i={}),WT(e,i,lO),new oO(t,i)}(this,n),uO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),dO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),cO.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var u=n.onCursorOut;u&&this.on("cursorout",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((d=this.createCharChild("|")).text="",d),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new vc(t,e);return Ux(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new L_(t,e);return Ux(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Dw(r,t,i);C.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(C),kr(C,e),C.vpx=l,C.vpy=u,C.frameDelimiter=c,y&&(b=C.getElement("action"),C.setChildVisible(b,!1)),kc(C),C.emitClick=function(){C.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:C.setInteractive()),x&&C.bindEvent(x,"pointerdown",(function(){C.emitClick()})),C.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=F_[t.keyCode];-1!==e.indexOf(i)&&C.emitClick()}}));var k=function(){C.isTyping?C.once("click",k).stop(!0):C.isLastPage?C.complete2Flag||(C.complete2Flag=!0,C.emit("complete2")):C.once("click",k).typeNextPage()},S=function(){C.isPageEnd&&(C.off("click",S),y&&(b.stop(),C.setChildVisible(b,!1)),v.emit("resume.input"))};C._typeNextPage=S,C.on("pageend",(function(){y&&(b.start(),C.setChildVisible(b,!0)),C.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,C.emitClick)),v.emit("pause.input")})).on("start",(function(){C.off("click",k).once("click",k)}));var w=v.getData("$fastTyping"),_=v.getData("$autoNextPage");C.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(C.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=C.normalTypingSpeed),C.setTypingSpeed(e)}else t&&C.emitClick();else e===_||t||C.isTyping||e&&C.emitClick();w=t,_=e}));var E=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=F_[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return C.bindEvent(r.input.keyboard,"keydown",(function(t){E(t,!0)})),C.bindEvent(r.input.keyboard,"keyup",(function(t){E(t,!1)})),C}}(I_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{typing:Mc,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=_c(e,`creators.${Vo}`,void 0);if(!1!==s){if(Ec(s)&&(s=void 0),void 0===s){_c(e,`styles.${Vo}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new vc(t,i);t.add.existing(s),kr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return kc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Vo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{cross:wc,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=FT(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(BT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new LT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,kc(u),u}}(FT(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{choice:RT,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=zO(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if(NO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new IO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,kc(u),u}}(zO(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{input:jO,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=V_(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(H_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new vc(t,e);return Ux(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new z_(s,t,i);return g&&C.setTitle(g),f&&C.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,C.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(C),kr(C,e),C.vpx=h,C.vpy=l,kc(C),C}}(V_(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{setText:G_,popUp:Y_,shake:Sc}})}}];var YO=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],XO={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},WO=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=lo(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,XO),i)t.setData(s,i[s])};return class extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=on(t,t.cameras.main));for(var a=new To(t,{layers:r?No:Go,layerDepth:i,rootLayer:s}),o=0,h=GO.length;oh;u--){for(c=0;c0&&this.wrapMode!==Tm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Dm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=lC(t,l,u);else{var d=hC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=lC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=lC(t,"fill",null);null!==g&&(this.color=dy(g));var f=lC(t,"metrics",!1);return f?this.metrics={ascent:lC(f,"ascent",0),descent:lC(f,"descent",0),fontSize:lC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=oC(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=oC(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=lC(t,"fontFamily","Courier"),this.fontSize=lC(t,"fontSize","16px"),this.fontStyle=lC(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=dy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=dy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=dy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=dy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=dy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=dy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=dy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=dy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Dm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=lC(e,"fontFamily",this.fontFamily),this.fontSize=lC(e,"fontSize",this.fontSize),this.fontStyle=lC(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var cC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),wy(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const dC=Phaser.Utils.Objects.GetValue,pC=wm,gC=_m;class fC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=dC(t,"text",""),this.x=dC(t,"x",0),this.y=dC(t,"y",0),this.width=dC(t,"width",0);var e=dC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=dC(t,"newLineMode",0),this.startIndex=dC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===gC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==pC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===gC&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const vC=Phaser.Utils.Objects.GetFastValue,mC=wm,yC=Em;class bC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=vC(t,"tagToText",ud),this.tagToTextScope=vC(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var xC={};const CC=Phaser.Geom.Rectangle;var kC=new Da;class SC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&IC(f)){""!==b?a.push(n.getLine(b,x,MC)):0===C&&r>0&&a.push(n.getLine("",0,MC)),a.push(...FC(f,e,LC,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,MC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},BC=function(t,e){var i;switch(e){case AC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==zC&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new bC({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Vk(this.sizerChildren,null),Qv.call(this,t),this}},Uk={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Vk(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Zk={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=hp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Vk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Vk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},tS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eS=Phaser.Utils.Objects.IsPlainObject,iS=Phaser.Utils.Objects.GetValue;class sS extends zv{constructor(t,e,i,s,r,n,a,o,h,l){eS(e)?(e=iS(l=e,"x",0),i=iS(l,"y",0),s=iS(l,"width",void 0),r=iS(l,"height",void 0),n=iS(l,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(s)?(s=iS(l=s,"width",void 0),r=iS(l,"height",void 0),n=iS(l,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(n)?(n=iS(l=n,"column",l.col||0),a=iS(l,"row",0),o=iS(l,"columnProportions",0),h=iS(l,"rowProportions",0)):eS(o)&&(o=iS(l=o,"columnProportions",0),h=iS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(iS(l,"createCellContainerCallback")),this.setIndentLeft(iS(l,"space.indentLeftOdd",0),iS(l,"space.indentLeftEven",0)),this.setIndentTop(iS(l,"space.indentTopOdd",0),iS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,iS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Qk.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=tS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(sS.prototype,Zk);const rS=Phaser.Utils.Objects.GetValue;const nS=Phaser.Math.Percent;var aS=function(t,e,i){var s;return t.y===e.y?s=nS(i.x,t.x,e.x):t.x===e.x&&(s=nS(i.y,t.y,e.y)),s},oS=function(t,e,i){var s,r;this.enable&&(hS.x=e,hS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=aS(s,r,hS))},hS={},lS=function(t,e,i){if(this.enable&&t.isDown){var s,r;uS.x=t.worldX,uS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=aS(s,r,uS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},uS={},cS=function(t,e){void 0===e&&(e=dS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Rd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},dS={};const pS=Phaser.Display.Align.LEFT_CENTER,gS=Phaser.Display.Align.TOP_CENTER;var fS={};const vS=Phaser.Display.Align.RIGHT_CENTER,mS=Phaser.Display.Align.BOTTOM_CENTER;var yS={};const bS=Phaser.Math.Linear;var xS={};const CS=Phaser.Display.Align.LEFT_CENTER,kS=Phaser.Display.Align.TOP_CENTER,SS=Phaser.Display.Align.RIGHT_CENTER,wS=Phaser.Display.Align.BOTTOM_CENTER;const _S=Phaser.Utils.Objects.GetValue,ES=Phaser.Utils.Objects.IsPlainObject,TS=Phaser.Math.Clamp,OS=Phaser.Math.Snap.To;class PS extends(rc(dm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=_S(e,"reverseAxis",!1);var i=_S(e,"background",void 0),s=_S(e,"track",void 0),r=_S(e,"indicator",void 0),n=_S(e,"thumb",void 0);if(i&&(ES(i)&&(i=qx(t,i)),this.addBackground(i)),s&&(ES(s)&&(s=qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(ES(r)&&(r=qx(t,r)),this.pin(r)),n){ES(n)&&(n=qx(t,n)),this.pin(n);var a=_S(e,"thumbOffsetX",0),o=_S(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=_S(e,"input",0);switch("string"==typeof h&&(h=MS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",oS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",lS,this).on("pointermove",lS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(_S(e,"enable",void 0)),this.setGap(_S(e,"gap",void 0)),this.setValue(_S(e,"value",0),_S(e,"min",void 0),_S(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=OS(t,this.gap));var e=this._value;this._value=TS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const MS={pan:0,drag:0,click:1,none:-1};var DS={getStartPoint:function(t){if(void 0===t&&(t=fS),this.childrenMap.thumb){var e=0===this.orientation?pS:gS;cS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=yS),this.childrenMap.thumb){var e=0===this.orientation?vS:mS;cS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=xS),s.x=bS(e.x,i.x,t),s.y=bS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=Ir(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=jr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;fp(e,i,s),r=n?0===this.orientation?SS:wS:0===this.orientation?CS:kS,Ld(e,this,r),this.resetChildPositionState(e)}};Object.assign(PS.prototype,DS);const AS=Phaser.Utils.Objects.GetValue;class LS extends dm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=AS(e,"background",void 0),r=AS(e,"buttons",void 0),n=AS(r,"top",AS(r,"left",void 0)),a=AS(r,"bottom",AS(r,"right",void 0)),o=AS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new vf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===AS(o,"width",void 0)?1:0;else h=void 0===AS(o,"height",void 0)?1:0;i=new PS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new vf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=AS(e,"valuechangeCallback",null);if(null!==u){var c=AS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(AS(e,"enable",void 0)),this.setValue(AS(e,"value",0)),this.setScrollStep(AS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class RS extends mg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const FS=Phaser.Utils.Objects.GetValue,BS=Phaser.Math.Distance.Between;class IS extends In{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=FS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(FS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(FS(t,"enable",!0)),this.holdThreshold=FS(t,"holdThreshold",50),this.pointerOutReleaseEnable=FS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:BS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Vg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Vg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jS=Phaser.Utils.Objects.GetValue;class zS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jS(t,"value",0)),this.setSpeed(jS(t,"speed",0)),this.setAcceleration(jS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class NS{constructor(){this.value,this.dir,this.movement=new zS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const WS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},$S=Phaser.Utils.Objects.GetValue;class VS extends In{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=$S(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed($S(e,"speed",.1)),this.setEnable($S(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive($S(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Vg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const HS=Phaser.Utils.Objects.GetValue;var US=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?HS(s,l,void 0):HS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=lo(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new LS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=HS(r,"position",0);"string"==typeof p&&(p=qS[p]);var g,f,v=HS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=HS(s,"space.slider",void 0))&&(o?v=0:g=HS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:HS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:HS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:HS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:HS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=HS(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=HS(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=HS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=HS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=HS(s,"scrollDetectionMode");"string"==typeof b&&(b=KS[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?HS(s,x,!0):HS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new YS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=HS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new VS(h,E)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n)&&(o?(k=a?"t":"s",w=`scroll${i}`):(k="t",w="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));C&&(_=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[_](-e,!0)})))};const qS={right:0,left:1,bottom:0,top:1},KS={gameObject:0,rectBounds:1},JS=Phaser.Utils.Objects.GetValue;var ZS=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=JS(e,"width"),a=JS(e,"height");n||(JS(e,"child.expandWidth",!0)||(s[1]=0));a||(JS(e,"child.expandHeight",!0)||(r[1]=0));var o=new sS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=rS(i,"child"),r=rS(s,"gameObject",void 0);if(r){var n=rS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=rS(n,"top",0),a.bottom=rS(n,"bottom",0),o.left=rS(n,"left",0),o.right=rS(n,"right",0);break;case 1:a.top=rS(n,"left",0),a.bottom=rS(n,"right",0),o.top=rS(n,"top",0),o.bottom=rS(n,"bottom",0);break;default:a.top=rS(n,"top",0),a.bottom=rS(n,"bottom",0),a.left=rS(n,"left",0),a.right=rS(n,"right",0)}e.add(r,{column:1,row:1,align:rS(s,"align","center"),padding:o,expand:{width:rS(s,"expandWidth",!0),height:rS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:US(t,o,"y",e);break;case 1:US(t,o,"x",e);break;default:US(t,o,"y",e),US(t,o,"x",e)}return o},QS=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},tw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},ew=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var yw=function(t){return t.add.text(0,0,"")};Object.assign(mw.prototype,pw);var bw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},xw={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Cw=Phaser.Utils.Objects.GetValue;class kw extends nw{constructor(t,e){void 0===e&&(e={});var i=Cw(e,"text",void 0),s=Cw(e,"textWidth",void 0),r=Cw(e,"textHeight",void 0),n=Cw(e,"textCrop",!!i.setCrop),a=Cw(e,"textMask",!n),o=Cw(e,"content",""),h=new mw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Cw(e,"clampChildOY",!1),alwaysScrollable:Cw(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=Cw(e,"space",void 0);l&&(l.child=Cw(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(kw.prototype,bw,xw);const Sw=Phaser.Utils.Objects.GetValue;var ww=function(t,e,i){e=e?y(e):{};var s=Sw(i,"background",qx),r=Sw(i,"text",_w),n=Sw(i,"track",qx),a=Sw(i,"thumb",qx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new kw(t,e);return t.add.existing(h),h},_w=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Ak(t,e);break;case"bbcodetext":case"bbcode":s=new Ok(t,0,0,"",e);break;case"label":s=new Fk(t,e);break;case"textarea":s=ww(t,e);break;default:s=new Zx(t,e)}return Ux(s,e),t.add.existing(s),s},Ew=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Vx(t,e):new wx(t,e);break;case"roundRectangle":s=new dx(t,e);break;default:s=new Ox(t,e)}return Ux(s,e),t.add.existing(s),s};const Tw=Phaser.Utils.Objects.GetValue;var Ow=function(t,e,i){e=e?y(e):{};var s=Tw(i,"background",qx),r=Tw(i,"text",_w),n=Tw(i,"icon",Ew),a=Tw(i,"action",Ew);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Pw=Phaser.Utils.Objects.GetValue;var Mw=function(t,e,i){var s,r,n=Pw(i,"innerBackground",qx),a=Pw(i,"separator",qx),o=Pw(i,"title",_w);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Ow(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Dw extends Hb{constructor(t,e,i){super(t,e=Mw(t,e,i))}}var Aw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ol(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Lw=Phaser.Utils.Objects.GetValue;class Rw extends Ul{constructor(t,e){super(t,Lw(e,"x",0),Lw(e,"y",0),Lw(e,"width",64),Lw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Lw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Lw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Lw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Lw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Lw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Lw(t,"color",i)),i=e?0:this.value,this.setValue(Lw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Rw.prototype,Aw);const Fw=Phaser.Math.DegToRad,Bw=Phaser.Math.Linear,Iw=Phaser.Math.Easing.Expo.In,jw={right:0,down:1,left:2,up:3};var zw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Gw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Gw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Gw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Gw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Gw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Gw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Nw={},Gw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Nw.x=a*u+o*c+r,Nw.y=h*u+l*c+n,Nw},Xw={setDirection(t){return"string"==typeof t&&(t=jw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Ru)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Fw(315);i=Math.cos(a),s=Math.sin(a);var o=Fw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Fw(135);i=Math.cos(a),s=Math.sin(a);o=Fw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Fw(225);i=Math.cos(a),s=Math.sin(a);o=Fw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Fw(45);i=Math.cos(a),s=Math.sin(a);o=Fw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=Cl(s),K_(r)?(d.expandWidth=J_(r,"width",!1),d.expandHeight=J_(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),d.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},eE={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),qd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Qv.call(this,t),this}},iE={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,Zg.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(U_.width=e.aspectRatio,U_.height=1,q_.width=l,q_.height=u,l=(c=hl(U_,q_,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Nv(t,this)):fp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Ir(t)),void 0===u&&(u=jr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,Qg.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(iE,tE,eE);const sE=Phaser.Utils.Objects.IsPlainObject,rE=Phaser.Utils.Objects.GetValue;class nE extends zv{constructor(t,e,i,s,r,n){sE(e)?(e=rE(n=e,"x",0),i=rE(n,"y",0),s=rE(n,"width",void 0),r=rE(n,"height",void 0)):sE(s)&&(s=rE(n=s,"width",void 0),r=rE(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(nE.prototype,iE);const aE=dm.prototype.add,oE=dm.prototype.addSpace;var hE=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&oE.call(this),aE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&oE.call(this),this.hasTailSpace=s}else aE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;aE.call(this,t,{index:r,proportion:i,expand:!0})}else aE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},lE={addButton(t){if(Hg(t))for(var e=t,i=0,s=e.length;i=0;i--)dE.call(this,e[i],t);return this}},gE=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},fE=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,gE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},vE={add(t){return this.buttons.push(t),t._click||(t._click=new rf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),fE.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=ME(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=ME(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const AE=Phaser.Utils.Objects.IsPlainObject,LE=Phaser.Utils.Objects.GetValue,RE=Phaser.Display.Align.CENTER;var FE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Xd.call(this,t),AE(e))&&(e=LE(h=e,"padding",0),i=LE(h,"key",void 0),s=LE(h,"index",void 0),r=LE(h,"offsetX",0),n=LE(h,"offsetY",0),a=LE(h,"offsetOriginX",0),o=LE(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=RE,h.padding=Cl(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},BE={add(t,e,i){if(Hg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Qv.call(this,t),this}},zE={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&VE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)JE.call(this,e[i],t);return this}};const QE=Phaser.Utils.Objects.GetValue;class tT extends WE{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new SE({parent:this,eventEmitter:QE(e,"eventEmitter",this),groupName:QE(e,"groupName",void 0),clickConfig:QE(e,"click",void 0)}).setButtonsType(e);var s=QE(e,"background",void 0),r=QE(e,"buttons",void 0);this.buttonsAlign=QE(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(tT.prototype,UE,ZE,kE,_E);const eT=sS.prototype.add;var iT={addButton(t,e,i){return eT.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)nT.call(this,e[i],t);return this}};const oT=Phaser.Utils.Objects.GetValue;class hT extends sS{constructor(t,e){void 0===e&&(e={});var i=oT(e,"row",0),s=oT(e,"column",e.col||0),r=oT(e,"createCellContainerCallback"),n=oT(e,"buttons",void 0),a=oT(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(rO(this),nO(this)),this}setNumberInput(){return this.onUpdateCallback=sO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const hO=Phaser.Utils.Objects.GetValue,lO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var uO=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},cO=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ax(t.style,e);kl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},dO=function(t){pr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=ax(t.style,e);kl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},pO=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ax(t,e);kl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function gO(){}function fO(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}gO.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(fO(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const vO=new gO;const mO=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,yO=/\S/,bO=new gO;bO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!yO.test(t)&&!yO.test(e)},bO.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(SO(t,null,null,i),i," ")},kO.equals=function(t,e){return gO.prototype.equals.call(kO,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const wO=new gO;wO.tokenize=function(t){return t.slice()},wO.join=wO.removeEmpty=function(t){return t};const _O=Phaser.Utils.Array.Remove;var EO=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),_O(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,vO.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},DO={cursorMoveLeft(){if(!this.isOpened)return this;var t=OO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=OO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=PO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=OO(MO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=PO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=OO(MO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const AO=Phaser.Utils.Objects.IsPlainObject;class LO extends Fb{constructor(t,e,i,s,r,n){AO(e)?n=e:AO(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new $o(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=nx(n.background,"focus"),h=nx(n.style,"cursor"),l=nx(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=hO(e,"edit");return void 0===i&&(i={}),WT(e,i,lO),new oO(t,i)}(this,n),uO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),pO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),cO.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),pr(l)&&Object.assign(l,h),dO.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new vc(t,e);return Ux(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new L_(t,e);return Ux(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Dw(r,t,i);C.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(C),kr(C,e),C.vpx=l,C.vpy=u,C.frameDelimiter=c,y&&(b=C.getElement("action"),C.setChildVisible(b,!1)),kc(C),C.emitClick=function(){C.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:C.setInteractive()),x&&C.bindEvent(x,"pointerdown",(function(){C.emitClick()})),C.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=F_[t.keyCode];-1!==e.indexOf(i)&&C.emitClick()}}));var k=function(){C.isTyping?C.once("click",k).stop(!0):C.isLastPage?C.complete2Flag||(C.complete2Flag=!0,C.emit("complete2")):C.once("click",k).typeNextPage()},S=function(){C.isPageEnd&&(C.off("click",S),y&&(b.stop(),C.setChildVisible(b,!1)),v.emit("resume.input"))};C._typeNextPage=S,C.on("pageend",(function(){y&&(b.start(),C.setChildVisible(b,!0)),C.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,C.emitClick)),v.emit("pause.input")})).on("start",(function(){C.off("click",k).once("click",k)}));var w=v.getData("$fastTyping"),_=v.getData("$autoNextPage");C.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(C.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=C.normalTypingSpeed),C.setTypingSpeed(e)}else t&&C.emitClick();else e===_||t||C.isTyping||e&&C.emitClick();w=t,_=e}));var E=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=F_[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return C.bindEvent(r.input.keyboard,"keydown",(function(t){E(t,!0)})),C.bindEvent(r.input.keyboard,"keyup",(function(t){E(t,!1)})),C}}(I_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{typing:Mc,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=_c(e,`creators.${Vo}`,void 0);if(!1!==s){if(Ec(s)&&(s=void 0),void 0===s){_c(e,`styles.${Vo}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new vc(t,i);t.add.existing(s),kr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return kc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Vo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{cross:wc,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=FT(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(BT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new LT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,kc(u),u}}(FT(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{choice:RT,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=NO(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if(GO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new jO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,kc(u),u}}(NO(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{input:zO,shake:Sc}})}},function(t,e){var{viewport:i}=e,s=V_(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(H_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new vc(t,e);return Ux(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new z_(s,t,i);return g&&C.setTitle(g),f&&C.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,C.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(C),kr(C,e),C.vpx=h,C.vpy=l,kc(C),C}}(V_(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{setText:G_,popUp:X_,shake:Sc}})}}];var YO=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],WO={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},$O=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=lo(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,WO),i)t.setData(s,i[s])};return class extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=on(t,t.cameras.main));for(var a=new To(t,{layers:r?No:Go,layerDepth:i,rootLayer:s}),o=0,h=XO.length;o 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -65931,7 +65953,7 @@ void main () { var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -66292,6 +66314,33 @@ void main () { }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -66940,6 +66989,7 @@ void main () { var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -66967,19 +67017,41 @@ void main () { } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -67174,6 +67246,11 @@ void main () { return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rexmdscenarioplugin.min.js b/dist/rexmdscenarioplugin.min.js index 25958a21ae..41a0338970 100644 --- a/dist/rexmdscenarioplugin.min.js +++ b/dist/rexmdscenarioplugin.min.js @@ -19,9 +19,9 @@ v5.4.1 https://github.com/mholt/PapaParse License: MIT - */!function(t){t.exports=function t(){var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,s=e.IS_PAPA_WORKER||!1,r={},n=0,a={parse:function(i,s){var o=(s=s||{}).dynamicTyping||!1;if(k(o)&&(s.dynamicTypingFunction=o,o={}),s.dynamicTyping=o,s.transform=!!k(s.transform)&&s.transform,s.worker&&a.WORKERS_SUPPORTED){var h=function(){if(!a.WORKERS_SUPPORTED)return!1;var i,s,o=(i=e.URL||e.webkitURL||null,s=t.toString(),a.BLOB_URL||(a.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",s,")();"],{type:"text/javascript"})))),h=new e.Worker(o);return h.onmessage=v,h.id=n++,r[h.id]=h}();return h.userStep=s.step,h.userChunk=s.chunk,h.userComplete=s.complete,h.userError=s.error,s.step=k(s.step),s.chunk=k(s.chunk),s.complete=k(s.complete),s.error=k(s.error),delete s.worker,void h.postMessage({input:i,config:s,workerId:h.id})}var p=null;return a.NODE_STREAM_INPUT,"string"==typeof i?(i=function(t){return 65279===t.charCodeAt(0)?t.slice(1):t}(i),p=s.download?new l(s):new c(s)):!0===i.readable&&k(i.read)&&k(i.on)?p=new d(s):(e.File&&i instanceof File||i instanceof Object)&&(p=new u(s)),p.stream(i)},unparse:function(t,e){var i=!1,s=!0,r=",",n="\r\n",o='"',h=o+o,l=!1,u=null,c=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||a.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(l=e.skipEmptyLines),"string"==typeof e.newline&&(n=e.newline),"string"==typeof e.quoteChar&&(o=e.quoteChar),"boolean"==typeof e.header&&(s=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");u=e.columns}void 0!==e.escapeChar&&(h=e.escapeChar+o),("boolean"==typeof e.escapeFormulae||e.escapeFormulae instanceof RegExp)&&(c=e.escapeFormulae instanceof RegExp?e.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var d=new RegExp(g(o),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,l);if("object"==typeof t[0])return p(u||Object.keys(t[0]),t,l)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||u),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],l);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var a="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var o=Array.isArray(t)&&0=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(k(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!k(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){k(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(k(t.step)){var y=t.step;t.step=function(e){if(m=e,S())C();else{if(C(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function C(){return m&&s&&(T("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?T("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)k(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return H(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||C.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),Y();if(z===f-1)return Y(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==F&&F=o)return H(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return Y();function W(t){x.push(t),w=u}function V(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function Y(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,W(S),b&&$()),H()}function X(t){u=t,W(S),S=[],I=a.indexOf(s,u)}function H(t){return{data:x,errors:C,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function $(){n(H()),x=[],C=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(k(i.userStep)){for(var a=0;a>16&255},br=function(t){return t>>8&255},xr=function(t){return 255&t};const kr=Phaser.Events.EventEmitter;var Cr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Sr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Sr={},wr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cr),function(t){if(t.events)return t;var e=new kr,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Tr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Pr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Or=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mr(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},zr=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Nr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Gr=Phaser.Geom.Rectangle,Wr=Phaser.Math.Vector2,Vr=Phaser.Math.RotateAround,Yr=Phaser.GameObjects.Container;var Xr=function(t,e){if(void 0===e?e=new Gr:!0===e&&(void 0===Hr&&(Hr=new Gr),e=Hr),t.getBounds&&!(t instanceof Yr))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();$r(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Kr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,qr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else $r(t,e),i=e.x,s=e.y,Ur(t,e),r=e.x,n=e.y,Kr(t,e),a=e.x,o=e.y,qr(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Hr=void 0,$r=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY,Qr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getTopRight?t.getTopRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY,Qr(t,e,i))},Kr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY+Nr(t),Qr(t,e,i))},qr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY+Nr(t),Qr(t,e,i))},Jr=function(t,e,i){void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr);var s=zr(t),r=Nr(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Qr(t,e,i)},Zr=void 0,Qr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Vr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const tn=Phaser.Utils.Objects.GetValue;var en=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=tn(i,"color"),r=tn(i,"lineWidth"),n=tn(i,"fillColor"),a=tn(i,"fillAlpha",1),o=tn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Zn:Jn,this.repeatCounter=0,this}stop(){return this.state=qn,this}update(t,e){this.state!==qn&&this.state!==ta&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Qn)):(this.nowTime=this.duration,this.state=ta):this.nowTime>=0&&(this.state=Zn))}get t(){var t;switch(this.state){case qn:case Jn:case Qn:t=0;break;case Zn:t=this.nowTime/this.duration;break;case ta:t=1}return Un(t,0,1)}set t(t){(t=Un(t,-1,1))<0?(this.state=Jn,this.nowTime=-this.delay*t):(this.state=Zn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===qn}get isDelay(){return this.state===Jn}get isCountDown(){return this.state===Zn}get isRunning(){return this.state===Jn||this.state===Zn}get isDone(){return this.state===ta}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const qn=0,Jn=1,Zn=2,Qn=3,ta=-1;class ea extends Xn{constructor(t,e){super(t,e),this.timer=new Kn}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Utils.Objects.GetAdvancedValue,ra=Phaser.Tweens.Builders.GetEaseFunction;class na extends ea{resetFromJSON(t){return this.timer.resetFromJSON(ia(t,"timer")),this.setEnable(ia(t,"enable",!0)),this.setTarget(ia(t,"target",this.parent)),this.setDelay(sa(t,"delay",0)),this.setDuration(sa(t,"duration",1e3)),this.setEase(ia(t,"ease","Linear")),this.setRepeat(ia(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ra(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const aa=Phaser.Sound.BaseSound;var oa=function(t){return t instanceof aa};const ha=Phaser.Utils.Objects.GetValue,la=Phaser.Utils.Objects.GetAdvancedValue,ua=Phaser.Math.Linear;let ca=class extends na{constructor(t,e,i){oa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ha(t,"mode",0)),this.setEnable(ha(t,"enable",!0)),this.setVolumeRange(la(t,"volume.start",this.parent.volume),la(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=da[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=ua(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const da={stop:1,destroy:2};var pa=function(t,e,i,s,r){oa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ca(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ga=function(t,e,i,s){oa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ca(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const fa=Phaser.Utils.Objects.GetValue;var va={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:fa(e,"loop",this.backgroundMusicLoop),mute:fa(e,"mute",this.backgroundMusicMute),volume:fa(e,"volume",this.backgroundMusicVolume),detune:fa(e,"detune",0),rate:fa(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&pa(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ga(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ma=Phaser.Utils.Objects.GetValue;var ya={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ma(e,"loop",this.backgroundMusicLoop),mute:ma(e,"mute",this.backgroundMusic2Mute),volume:ma(e,"volume",this.backgroundMusic2Volume),detune:ma(e,"detune",0),rate:ma(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&pa(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ga(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const ba=Phaser.Utils.Array.Remove,xa=Phaser.Utils.Objects.GetValue;var ka={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:xa(e,"mute",this.soundEffectsMute),volume:xa(e,"volume",this.soundEffectsVolume),detune:xa(e,"detune",0),rate:xa(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&ba(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&ba(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&pa(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ga(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ga(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&pa(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ga(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ga(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ba=Phaser.Utils.Objects.GetValue,Fa=new class extends Ra{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=io(this.delimiterLeft),e=io(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Xs:t||(t=ao),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=lo),this.tagExpression=t,this}setValueExpression(t){return t||(t=lo),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==lo||this.valueExpression!==lo){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=io(this.delimiterLeft),e=io(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=oo(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const lo="[^=]+";var uo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],co=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},po=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:co(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},So={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},wo={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},To={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},Po={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},Oo=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return Oo(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!Oo(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Eo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const $o=Phaser.GameObjects.Zone;let Uo=class extends $o{constructor(t){super(t,0,0,2,2),this.fullWindow=new Ho(this)}};const Ko="BG",qo="SPRITE",Jo="TEXTBOX",Zo="TITLE",Qo="CHOICE",th="NAMEINPUT";var eh=!1,ih=function(t){eh||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return rh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return nh(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ich(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ech(t).x,getChildLocalY:t=>ch(t).y};const Oh=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=ch(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=ch(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return ch(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return ch(t).rotation=Oh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=ch(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>ch(t).rotation},Eh={updateChildScale(t){var e=ch(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=ch(t),i=e.parent;return e.scaleX=Th(t.scaleX,i.scaleX),e.scaleY=Th(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=ch(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=ch(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>ch(t).scaleX,getChildLocalScaleY:t=>ch(t).scaleY},Mh={updateChildVisible(t){var e=ch(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=ch(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),ch(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),ch(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=ch(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>ch(t).visible},Dh={updateChildAlpha(t){var e=ch(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=ch(t),i=e.parent;return e.alpha=Th(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return ch(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=ch(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>ch(t).alpha},Lh={updateChildActive(t){var e=ch(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return ch(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),ch(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=ch(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>ch(t).active},Ah={updateChildScrollFactor(t){var e=ch(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Rh={updateCameraFilter(t){var e=ch(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Bh={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Fh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Ih={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},jh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Nh=Phaser.Utils.Array;var Gh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,O):r(c,d,O),h&&c.add.existing(P),l){var _=b+C*T+a*C,E=x+S*w+o*S;P.setOrigin(a,o).setPosition(_,E).setScale(f,v).setRotation(m),Al(P,b,x,m)}k.push(P)}return k}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(Vl.prototype,Fl);const Xl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Hl=Phaser.GameObjects.GetCalcMatrix;const $l=Phaser.Renderer.Canvas.SetTransform;var Ul={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},au=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const ou=Phaser.Geom.Polygon.Earcut;class hu extends tu{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=ou(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&iu(t,e,this,i,s,r),this.isStroked&&ru(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const uu=Phaser.Math.DegToRad;var cu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=zu(t,"tl",0),this.radiusTR=zu(t,"tr",0),this.radiusBL=zu(t,"bl",0),this.radiusBR=zu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?cu(e,e,e,e,180,270,!1,r,t):cu(0,0,e,e,90,0,!0,r,t):lu(0,0,t);(e=this.radiusTR)>0?this._convexTR?cu(i-e,e,e,e,270,360,!1,r,t):cu(i,0,e,e,180,90,!0,r,t):lu(i,0,t);(e=this.radiusBR)>0?this._convexBR?cu(i-e,s-e,e,e,0,90,!1,r,t):cu(i,s,e,e,270,180,!0,r,t):lu(i,s,t);(e=this.radiusBL)>0?this._convexBL?cu(e,s-e,e,e,90,180,!1,r,t):cu(0,s,e,e,360,270,!0,r,t):lu(0,s,t);return t.push(t[0],t[1]),ku(this.x,this.y,t),super.updateData(),this}};const Gu=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;const Wu={arc:pu,circle:gu,curve:class extends hu{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),mc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,fc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class xc extends Vl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=bc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},Yc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Xc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Yc(t));t=this.sections.join("\n");this.lines=Vc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(qc,Xc,$c,Kc);const Jc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Zc extends Nn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Wc(this.parent),this.pageStartIndexes=[],this.lines=Vc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Jc(t,"maxLines",void 0)),this.setPageBreak(Jc(t,"pageBreak","\f\n")),this.setText(Jc(t,"text","")),this.startLineIndex=Jc(t,"start",-1),this.endLineIndex=Jc(t,"end",void 0);var e=Jc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Wc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Zc.prototype,qc);var Qc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Uc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Yc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},td=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},ed=function(t,e){for(var i=void 0,s=0;s0)l=id(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=id(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},rd={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=td(this.parent,t);n=ed(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)sd.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(rd,Qc);const nd=Phaser.Utils.Objects.GetFastValue,ad=Phaser.Utils.Objects.GetValue;class od extends Nn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(ad(t,"wrap",!1)),this.setTypeMode(ad(t,"typeMode",0)),this.setTypingSpeed(ad(t,"speed",333)),this.setTextCallback=nd(t,"setTextCallback",null),this.setTextCallbackScope=nd(t,"setTextCallbackScope",null),this.setTypingContent(nd(t,"text","")),this.typingIndex=nd(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=nd(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=hd[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Yc(t);this.textWrapEnable&&(e=function(t,e){switch(Wc(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=td(this.parent,this.text).length,this}onTyping(){var t=sd.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Uc(this.parent,t):this.parent.setText(t)}}const hd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(od.prototype,rd);const ld=Phaser.Utils.Objects.GetValue;const ud={page:0,line:1};var cd=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const dd=Phaser.Display.Align;var pd={center:dd.CENTER,left:dd.LEFT_CENTER,right:dd.RIGHT_CENTER,top:dd.TOP_CENTER,bottom:dd.BOTTOM_CENTER,"left-top":dd.TOP_LEFT,"top-left":dd.TOP_LEFT,"left-center":dd.LEFT_CENTER,"center-left":dd.LEFT_CENTER,"left-bottom":dd.BOTTOM_LEFT,"bottom-left":dd.BOTTOM_LEFT,"center-top":dd.TOP_CENTER,"top-center":dd.TOP_CENTER,"center-center":dd.CENTER,"center-bottom":dd.BOTTOM_CENTER,"bottom-center":dd.BOTTOM_CENTER,"right-top":dd.TOP_RIGHT,"top-right":dd.TOP_RIGHT,"right-center":dd.RIGHT_CENTER,"center-right":dd.RIGHT_CENTER,"right-bottom":dd.BOTTOM_RIGHT,"bottom-right":dd.BOTTOM_RIGHT},gd=function(){},fd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:gd,events:{once:gd}}},0,0,1,1);fd.setOrigin(0);var vd=0,md=1,yd=2,bd=4,xd=6,kd=8,Cd=10,Sd=12,wd=function(t){var e=Nr(t);return t.y+e-e*t.originY},Td=function(t){var e=zr(t);return t.x-e*t.originX+.5*e},Pd=function(t,e){var i=Nr(t);return t.y=e-i+i*t.originY,t},Od=function(t,e){var i=zr(t),s=i*t.originX;return t.x=e+s-.5*i,t},_d=function(t){var e=zr(t);return t.x-e*t.originX},Ed=function(t,e){var i=zr(t);return t.x=e+i*t.originX,t},Md=function(t){var e=zr(t);return t.x+e-e*t.originX},Dd=function(t,e){var i=zr(t);return t.x=e-i+i*t.originX,t},Ld=function(t,e){var i=Nr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Ad=function(t){var e=Nr(t);return t.y-e*t.originY+.5*e},Rd=function(t){var e=Nr(t);return t.y-e*t.originY},Bd=function(t,e){var i=Nr(t);return t.y=e+i*t.originY,t},Fd=[];Fd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,Td(e)+i),Pd(t,wd(e)+s),t},Fd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)-i),Pd(t,wd(e)+s),t},Fd[Sd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Md(e)+i),Pd(t,wd(e)+s),t},Fd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Od(t,e),Ld(t,i)}(t,Td(e)+i,Ad(e)+s),t},Fd[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)-i),Ld(t,Ad(e)+s),t},Fd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Md(e)+i),Ld(t,Ad(e)+s),t},Fd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,Td(e)+i),Bd(t,Rd(e)-s),t},Fd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)-i),Bd(t,Rd(e)-s),t},Fd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Md(e)+i),Bd(t,Rd(e)-s),t};var Id=function(t,e,i,s,r){return Fd[i](t,e,s,r)},jd=function(t,e,i,s,r,n){fd.setPosition(e,i).setSize(s,r),Id(t,fd,n)};const zd=Phaser.Utils.Objects.GetValue,Nd=Phaser.GameObjects.Group,Gd=Phaser.GameObjects.Container;var Wd=function(t,e,i){return t.add.text(0,0,"")},Vd=function(t,e){Array.isArray(t)||(t=[t]),void 0===e&&(e=[]);for(var i=0,s=t.length;i=0;e--)this.remove(this.backgroundChildren[e],t);return this}},sp=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const rp=/(\S+)\[(\d+)\]/i;const np=Phaser.Utils.Objects.GetValue;var ap=function(t,e){return void 0===e?t:t[e]},op=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=np(e,"left",0),t.right=np(e,"right",0),t.top=np(e,"top",0),t.bottom=np(e,"bottom",0)),t},hp={getInnerPadding(t){return ap(this.space,t)},setInnerPadding(t,e){return op(this.space,t,e),this},getOuterPadding(t){return ap(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return op(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ap(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),op(this.getSizerConfig(t).padding,e,i),this}},lp=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},up=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},cp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},dp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},pp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},gp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},fp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},vp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Sg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Bn(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},wg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=gd),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=gd),this.transitOutCallback=t,this}},Tg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Pg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Og={};Object.assign(Og,Sg,wg,Tg,Pg);const _g=Phaser.Utils.Objects.GetValue;class Eg extends Nn{constructor(t,e){super(t,e),this.setTransitInTime(_g(e,"duration.in",200)),this.setTransitOutTime(_g(e,"duration.out",200)),this.setTransitInCallback(_g(e,"transitIn")),this.setTransitOutCallback(_g(e,"transitOut")),this.oneShotMode=_g(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Cg(this,{eventEmitter:!1,initState:_g(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Eg.prototype,Og);const Mg=Phaser.GameObjects.Rectangle;class Dg extends Mg{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ho(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Lg=Phaser.Utils.Objects.GetValue;class Ag extends Nn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Lg(t,"hitAreaMode",0)),this.setEnable(Lg(t,"enable",!0)),this.setStopMode(Lg(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Rg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Rg={default:0,fullWindow:1};const Bg=Phaser.Utils.Objects.GetValue;class Fg extends Dg{constructor(t,e){super(t,Bg(e,"color",0),Bg(e,"alpha",.8)),this.touchEventStop=new Ag(this,{hitAreaMode:1})}}var Ig={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Dp(t,e)},scaleDown(t,e){Lp(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yp(t,e)},fadeOut(t,e){Xp(t,e,!1)}},jg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yp(t,e,t.alpha)},zg=function(t,e){Xp(t,e,!1)},Ng=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Xr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Gg=Phaser.Utils.Objects.GetValue;let Wg=class extends Eg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Vg.popUp),null==e.transitOut&&(e.transitOut=Vg.scaleDown),e.destroy=Gg(e,"destroy",!0),super(t,e);var i=Gg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Fg(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Gg(i,"transitIn",jg)),this.setCoverTransitOutCallback(Gg(i,"transitOut",zg)));var s=Gg(e,"touchOutsideClose",!1),r=Gg(e,"duration.hold",-1),n=Gg(e,"timeOutClose",r>=0),a=Gg(e,"anyTouchClose",!1);Gg(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Gg(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ng(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Vg[t]),t){case Vg.popUp:t=Ig.popUp;break;case Vg.fadeIn:t=Ig.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Vg[t]),t){case Vg.scaleDown:t=Ig.scaleDown;break;case Vg.fadeOut:t=Ig.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Vg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Yg=function(t){return t&&"function"==typeof t},Xg={modal(t,e){return Yg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Wg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Hg=function(t,e,i,s,r){Yg(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},$g={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),bo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Hg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Hg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Hg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Hg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Hg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Hg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Hg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Hg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Hg.call(this,"shutdown",t,e,i,s),this}},Ug=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Kg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Kg={},qg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ng(t,e.x,e.y,i,s):!!(r=Ug(e,n,!0))&&Ng(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const lf={press:0,pointerdown:0,release:1,pointerup:1};var uf={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new hf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},cf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!df(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return pf.length=0,!0;return pf.length=0,!1},pf=[];const gf=Phaser.Utils.Objects.GetValue;class ff extends Nn{constructor(t,e){super(t,e),this._enable=void 0;var i=gf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(gf(t,"enable",!0)),this.setMode(gf(t,"mode",1)),this.setClickInterval(gf(t,"clickInterval",100)),this.setDragThreshold(gf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=vf[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?cf:qg)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const vf={press:0,pointerdown:0,release:1,pointerup:1};var mf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new ff(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class yf extends kg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const bf=Phaser.Utils.Objects.GetValue;class xf extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new yf,this.parent.setInteractive(bf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(bf(t,"enable",!0)),this.setCooldown(bf(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&qg(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new xf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new xf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Cf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Sf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=zf,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Nf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=zf,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Gf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&qg(t,s,e,i)}}const zf=0,Nf=1,Gf="IDLE",Wf=Phaser.Utils.Objects.GetValue,Vf=Phaser.Math.Distance.Between;class Yf extends jf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Xf},eventEmitter:!1};this.setRecongizedStateObject(new kg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Wf(t,"time",250)),this.setTapInterval(Wf(t,"tapInterval",200)),this.setDragThreshold(Wf(t,"threshold",9)),this.setTapOffset(Wf(t,"tapOffset",10));var e=Wf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Wf(t,"maxTaps",void 0)),this.setMinTaps(Wf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Xf:this.state=Hf;break;case Hf:var t=this.lastPointer;Vf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=$f,this.state=Hf);break;case $f:this.state=Hf}}onDragEnd(){this.state===Hf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$f))}onDrag(){this.state!==Xf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Xf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Hf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Xf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$f:this.state=Xf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===$f&&(this.state=Xf)}get isTapped(){return this.state===$f}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Xf="IDLE",Hf="BEGIN",$f="RECOGNIZED",Uf=Phaser.Utils.Objects.GetValue;class Kf extends jf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qf},eventEmitter:!1};this.setRecongizedStateObject(new kg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Uf(t,"threshold",9)),this.setHoldTime(Uf(t,"time",251)),this}onDragStart(){this.state=Jf,0===this.holdTime&&(this.state=Zf)}onDragEnd(){this.state=qf}onDrag(){this.state!==qf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Jf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Zf))}get isPressed(){return this.state===Zf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const qf="IDLE",Jf="BEGIN",Zf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var Qf=function(t){return jn(t).loop.delta};const tv=Phaser.Math.Distance.Between,ev=Phaser.Math.Angle.Between;var iv={getDt:function(){return Qf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return tv(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ev(e.x,e.y,t.x,t.y)}},sv={"up&down":0,"left&right":1,"4dir":2,"8dir":3},rv={};const nv=Phaser.Utils.Objects.GetValue,av=Phaser.Math.RadToDeg;class ov extends jf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=hv},eventEmitter:!1};this.setRecongizedStateObject(new kg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nv(t,"threshold",10)),this.setVelocityThreshold(nv(t,"velocityThreshold",1e3)),this.setDirectionMode(nv(t,"dir","8dir")),this}onDragStart(){this.state=lv}onDragEnd(){this.state=hv}onDrag(){this.state===lv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=uv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===uv&&(this.state=hv)}get isSwiped(){return this.state===uv}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=sv[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=rv),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(av(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(ov.prototype,iv);const hv="IDLE",lv="BEGIN",uv="RECOGNIZED",cv=Phaser.Utils.Objects.GetValue,dv=Phaser.Utils.Array.SpliceOne,pv=Phaser.Math.Distance.Between,gv=Phaser.Math.Angle.Between;class fv{constructor(t,e){var i=Bn(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(cv(e,"inputConfig",void 0)),this.setEventEmitter(cv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(cv(t,"enable",!0)),this.bounds=cv(t,"bounds",void 0),this.tracerState=mv,this.pointers.length=0,co(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,co(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case mv:this.tracerState=yv,this.onDrag1Start();break;case yv:this.tracerState=bv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],dv(this.pointers,e),this.tracerState){case yv:this.tracerState=mv,this.onDrag1End();break;case bv:this.tracerState=yv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case yv:this.onDrag1();break;case bv:this.onDrag2()}}}dragCancel(){return this.tracerState===bv&&this.onDrag2End(),this.pointers.length=0,co(this.movedState),this.tracerState=mv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==bv)return 0;var t=this.pointers[0],e=this.pointers[1];return pv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==bv)return 0;var t=this.pointers[0],e=this.pointers[1];return gv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;vv.x=e.x-i.x,vv.y=e.y-i.y}else vv.x=0,vv.y=0;return vv}get centerX(){if(this.tracerState!==bv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==bv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==bv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==bv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=xv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&qg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&qg(t,s,e,i)}}Object.assign(fv.prototype,ur);var vv={};const mv=0,yv=1,bv=2,xv="IDLE";Phaser.Utils.Objects.GetValue;const kv=Phaser.Math.RotateAround;var Cv=function(t,e,i,s){return kv(t,e,i,s),t.rotation+=s,t},Sv={};const wv=Phaser.Utils.Objects.GetValue,Tv=Phaser.Math.Angle.WrapDegrees,Pv=Phaser.Math.Angle.ShortestBetween,Ov=Phaser.Math.RadToDeg,_v=Phaser.Math.DegToRad;var Ev={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Sv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Tv(Ov(this.angleBetween));this.angle=Pv(this.prevAngle,t),this.prevAngle=t,this.state=Lv}break;case Lv:t=Tv(Ov(this.angleBetween));this.angle=Pv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Lv}get rotation(){return _v(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ev);const Mv="IDLE",Dv="BEGIN",Lv="RECOGNIZED",Av=Phaser.Utils.Objects.GetValue;var Rv=function(t){var e=Av(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Yf(this,e),this._tap.on("tap",(function(t,e,s){wf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),wf(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Bv=Phaser.Utils.Objects.GetValue;var Fv=function(t){var e=Bv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Kf(this,e),this._press.on("pressstart",(function(t,e,s){wf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){wf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Iv=Phaser.Utils.Objects.GetValue;var jv=function(t){var e=Iv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new ov(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";wf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),wf(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const zv=Phaser.Utils.Objects.GetValue;var Nv=function(t,e){return t.setInteractive(),zv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:zv(e,"targets",[t]),targetMode:zv(e,"targetMode","parent"),eventEmitter:zv(e,"eventEmitter",t),eventNamePrefix:zv(e,"inputEventPrefix","child.")},Pf.call(t,e),Ef.call(t,e),Lf.call(t,e),Ff.call(t,e),Rv.call(t,e),Fv.call(t,e),jv.call(t,e),t},Gv={getSizerConfig:function(t){return void 0===t&&(t=this),cd(t)},getChildPrevState:function(t){var e=cd(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=un(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=zd(e,"color"),s=zd(e,"lineWidth");var h=zd(e,"name",!1);h&&(r=zd(h,"createTextCallback",Wd),n=zd(h,"createTextCallbackScope",void 0),"string"==typeof(a=zd(h,"align","left-top"))&&(a=pd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Nd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var u,c,d=this.getAllShownChildren([this]);Vd(d,d);for(var p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const qv=Phaser.Utils.Objects.IsPlainObject,Jv=Phaser.Utils.Objects.GetValue,Zv=Phaser.Display.Align.CENTER,Qv={min:0,full:-1};var tm=function(t,e,i,s,r,n,a,o,h,l){var u,c,d,p;Hd.call(this,t);var g=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=Qv[e];else if(qv(e)){var v;e=Jv(v=e,"proportion",void 0),i=Jv(v,"align",Zv),s=Jv(v,"padding",0),r=Jv(v,"expand",!1),n=Jv(v,"key",void 0),a=Jv(v,"index",void 0),t.isRexSizer||(o=Jv(v,"minWidth",void 0),h=Jv(v,"minHeight",void 0)),l=Jv(v,"fitRatio",0),u=Jv(v,"offsetX",0),c=Jv(v,"offsetY",0),d=Jv(v,"offsetOriginX",0),p=Jv(v,"offsetOriginY",0)}return"string"==typeof i&&(i=pd[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Zv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zr(t)/Nr(t)),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===p&&(p=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=wl(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=u,v.alignOffsetY=c,v.alignOffsetOriginX=d,v.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?zr(t):o:t.minHeight=void 0===h?Nr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},em={add:tm,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),tm.call(this,new Uv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return qv(i)&&(i.index=t),tm.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Kv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const im=al.prototype.clear;var sm=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),im.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,sm.call(this,t),this}},am={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=pd[e]),this.getSizerConfig(t).align=e,this}},om={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},hm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},lm={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},um={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(bp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,vp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u,c,d=this.sizerChildren,p=this.innerLeft,g=this.innerTop,f=this.innerWidth,v=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,k=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=dp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||up.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Hv.call(this,t,void 0),cp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||pp.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Hv.call(this,void 0,t),gp.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(um,em,nm,am,om,hm,lm);var cm=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},dm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},pm=function(t){return"string"==typeof t&&(t=dm[t]),t};const gm=Phaser.Utils.Objects.IsPlainObject,fm=Phaser.Utils.Objects.GetValue;class vm extends Vv{constructor(t,e,i,s,r,n,a){gm(e)?(e=fm(a=e,"x",0),i=fm(a,"y",0),s=fm(a,"width",void 0),r=fm(a,"height",void 0),n=fm(a,"orientation",0)):gm(s)?(s=fm(a=s,"width",void 0),r=fm(a,"height",void 0),n=fm(a,"orientation",0)):gm(n)&&(n=fm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(fm(a,"space.item",0)),this.setStartChildIndex(fm(a,"startChildIndex",0)),this.setRTL(fm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=pm(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=cm.call(this)),this._childrenProportion}}Object.assign(vm.prototype,um);var mm=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},ym=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},bm={appendText:ym,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class xm extends vm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(mm(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(mm(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&mm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&mm(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(xm.prototype,bm);var km=function(t,e,i,s){var r=new Ol(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Cm=Phaser.Utils.Objects.GetValue;const Sm=Phaser.Utils.Objects.GetValue;var wm=/^[\x00-\x7F]+$/,Tm=function(t){return wm.test(t)},Pm=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},_m=0,Em=1,Mm=2,Dm=0,Lm=1,Am=2,Rm=/(?:\r\n|\r|\n)/;const Bm={none:Dm,word:Lm,char:Am,character:Am,mix:3};var Fm=function(t,e){switch(Wc(t)){case 0:switch("string"==typeof e&&(e=Bm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Pm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Bm[e]||0),t.style.wrapMode=e}};const Im=Phaser.Renderer.WebGL.Utils;var jm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Im.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const zm=Phaser.Display.Color;var Nm={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new zm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Gm=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},Wm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Gm(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};ih();const Vm=Phaser.Display.Canvas.CanvasPool,Ym=Phaser.GameObjects.GameObject,Xm=Phaser.Utils.String.UUID;let Hm=class extends Ym{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Vm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Xm(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Vm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const $m=Phaser.GameObjects.Components;Phaser.Class.mixin(Hm,[$m.Alpha,$m.BlendMode,$m.Crop,$m.Depth,$m.Flip,$m.GetBounds,$m.Mask,$m.Origin,$m.Pipeline,$m.PostPipeline,$m.ScrollFactor,$m.Tint,$m.Transform,$m.Visible,jm,Nm,Wm]);let Um=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Um.prototype,Ql);var Km={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const qm=Phaser.Math.RotateAround;var Jm;const Zm=Phaser.Geom.Rectangle;var Qm,ty=function(t){void 0===Qm&&(Qm=new Zm);var e=t.drawTLX,i=t.drawTLY;return Qm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Qm};const ey=Phaser.Math.RotateAround;var iy,sy=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===iy&&(iy={}),s=iy),s.x=e,s.y=i,0!==t.rotation&&ey(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ry=Phaser.GameObjects.Components.TransformMatrix;var ny,ay,oy={},hy=function(t,e,i,s,r){var n=sy(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=oy);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ny&&(ny=new ry,ay=new ry),t.parentContainer?t.getWorldTransformMatrix(ny,ay):ny.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ny.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ly=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return hy(t,e,n,a,r)},uy={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Jm&&(Jm={}),s=Jm),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&qm(s,0,0,-i.rotation),s}(t,e,this,!0);return ty(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ly(this.parent,this,t,e,i)}};Object.assign(uy,Km);const cy=Phaser.Math.DegToRad,dy=Phaser.Math.RadToDeg,py=Phaser.Utils.Objects.GetValue;class gy extends Um{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return dy(this._rotation)}set angle(t){this.rotation=cy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=py(t,"width",void 0),i=py(t,"height",void 0),s=py(t,"scaleX",void 0),r=py(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(gy.prototype,uy);const fy=Phaser.Utils.String.Pad;var vy=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${fy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},my=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const yy=Phaser.Utils.Objects.GetValue;let by=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=yy(t,"x",0),i=yy(t,"y",0));var s=this.cornerRadius;s.tl=xy(yy(t,"tl",void 0),e,i),s.tr=xy(yy(t,"tr",void 0),e,i),s.bl=xy(yy(t,"bl",void 0),e,i),s.br=xy(yy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ky(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ky(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ky(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ky(this.cornerRadius.br,t)}};var xy=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Cy(t),t},ky=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=yy(e,"x",0),t.y=yy(e,"y",0)),Cy(t)},Cy=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Sy=Phaser.Math.DegToRad;var wy=function(t){return!t.hasOwnProperty("convex")||t.convex},Ty=function(t){return t.x>0&&t.y>0},Py=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Ty(o)?(h=o.x*f,l=o.y*v,wy(o)?Py(t,h,l,h,l,180,270,!1,a):Py(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,Ty(o)?(h=o.x*f,l=o.y*v,wy(o)?Py(t,s-h,l,h,l,270,360,!1,a):Py(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Ty(o)?(h=o.x*f,l=o.y*v,wy(o)?Py(t,s-h,r-l,h,l,0,90,!1,a):Py(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Ty(o)?(h=o.x*f,l=o.y*v,wy(o)?Py(t,h,r-l,h,l,90,180,!1,a):Py(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},_y=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),Oy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Ey=Phaser.Utils.Objects.GetValue;class My extends gy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ey(e,"color",null),Ey(e,"color2",null),Ey(e,"horizontalGradient",!0)),this.setStroke(Ey(e,"stroke",null),Ey(e,"strokeThickness",2)),this.setCornerRadius(Ey(e,"cornerRadius",0),Ey(e,"cornerIteration",null))}set color(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=vy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,my("color2",t,this),my("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,my("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,my("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){_y(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Dy=Phaser.Utils.Objects.GetValue;class Ly extends gy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Dy(e,"color",null),Dy(e,"color2",null),Dy(e,"horizontalGradient",!0)),this.setStroke(Dy(e,"stroke",null),Dy(e,"strokeThickness",2))}set color(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=vy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Dy(t,"color2",null),Dy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Dy(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Ay=Phaser.Utils.Objects.GetValue;let Ry=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ay(t,"bold",!1)),this.setItalic(Ay(t,"italic",!1)),this.setFontSize(Ay(t,"fontSize","16px")),this.setFontFamily(Ay(t,"fontFamily","Courier")),this.setColor(Ay(t,"color","#fff")),this.setStrokeStyle(Ay(t,"stroke",null),Ay(t,"strokeThickness",0)),this.setShadow(Ay(t,"shadowColor",null),Ay(t,"shadowOffsetX",0),Ay(t,"shadowOffsetY",0),Ay(t,"shadowBlur",0)),this.setOffset(Ay(t,"offsetX",0),Ay(t,"offsetY",0)),this.setSpace(Ay(t,"leftSpace",0),Ay(t,"rightSpace",0)),this.setAlign(Ay(t,"align",void 0)),this.setBackgroundColor(Ay(t,"backgroundColor",null)),this.setBackgroundHeight(Ay(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ay(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(my("stroke",t,this),my("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(my("shadowOffsetX",t,this),my("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=vy(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=vy(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=vy(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=vy(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const By=Phaser.Utils.Array.Remove;const Fy=Phaser.Utils.Array.Remove;const Iy="text",jy="image",zy="drawer",Ny="space",Gy="command";var Wy=function(t){return t.type===Iy&&"\n"===t.text},Vy=function(t){return t.type===Iy&&"\f"===t.text},Yy=function(t){return t.type===Iy};class Xy extends gy{constructor(t,e,i){super(t,Iy),this.updateTextFlag=!1,this.style=new Ry(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Hy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const $y=Phaser.Display.Canvas.CanvasPool;var Uy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=$y.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),$y.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Ky extends gy{constructor(t,e,i){super(t,jy),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Uy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class qy extends gy{constructor(t,e,i,s){super(t,zy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Jy extends gy{constructor(t,e){super(t,Ny),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Zy extends Um{constructor(t,e,i,s,r){super(t,Gy),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Qy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const tb={none:0,word:1,char:2,character:2,mix:3};var eb=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=nb.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=nb.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=ob(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=ob(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=ob(t,"wrapMode");void 0===c&&(c=ob(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=tb[c]);var d=ob(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=ob(t,"letterSpacing",0),g=ob(t,"hAlign",0),f=ob(t,"vAlign",0),v=ob(t,"justifyPercentage",.25),m=Qy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:D}),L=Math.max(L,D)),m.start+=_.length,m.isLastPage=!A&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ub(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ub(t,"maxLines",0);var o=0===i,h=ub(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ub(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=ub(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=ub(t,"letterSpacing",0),p=ub(t,"rtl",!0),g=ub(t,"hAlign",p?2:0),f=ub(t,"vAlign",0),v=Qy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),D=Math.max(D,M)),v.start+=O.length,v.isLastPage=v.start===P,v.maxLineHeight=D,v.linesWidth=_.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return op(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return ap(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),By(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Fy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Iy);return null===i?i=new Xy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ly(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Yb(t,r,e,i,n),o=0;o<=Gb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Yb(t,r,e,i,n)}return o===Gb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Xb(t,e,i),t},Vb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Yb=function(t,e,i,s,r){var n,a=Vb(t,e,r),o=Vb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Xb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Hb=Phaser.Utils.Objects.GetValue;var $b=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Hb(e,"minWidth",0),s=Hb(e,"minHeight",0),r=Hb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Wb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Wb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Ub=Phaser.Utils.Objects.GetValue,Kb=[function(t){var e=this.scene,i=Cm(t,"orientation",0);this.setOrientation(i);var s=Cm(t,"icon",void 0),r=Cm(t,"iconMask",void 0),n=Cm(t,"innerBackground",void 0),a=Cm(t,"title",void 0),o=Cm(t,"separator",void 0),h=Cm(t,"text",void 0),l=Cm(t,"action",void 0),u=Cm(t,"actionMask",void 0);if(s){var c=Cm(t,"align.icon","center");m=0===this.orientation?{right:Cm(t,"space.icon",0),top:Cm(t,"space.iconTop",0),bottom:Cm(t,"space.iconBottom",0),left:Cm(t,"space.iconLeft",0)}:{bottom:Cm(t,"space.icon",0),left:Cm(t,"space.iconLeft",0),right:Cm(t,"space.iconRight",0),top:Cm(t,"space.iconTop",0)};var d=Cm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=km.call(this,s,s,1)),!d){var p=Cm(t,"iconSize",void 0);this.setIconSize(Cm(t,"iconWidth",p),Cm(t,"iconHeight",p))}}var g=new vm(e,{orientation:1});n&&g.addBackground(n);var f=Cm(t,"space.separator",0);if(a){c=Cm(t,"align.title","left");var v=Cm(t,"expandTitleWidth",!1);y=Cm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?Cm(t,"space.title",f):0,left:Cm(t,"space.titleLeft",0),right:Cm(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:Cm(t,"space.separatorLeft",0),right:Cm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=Cm(t,"align.text","left");var y,b,x=Cm(t,"expandTextWidth",!1);y=Cm(t,"expandTextHeight",!1)?1:0,b=x,m={left:Cm(t,"space.textLeft",0),right:Cm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:Cm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=Cm(t,"align.action","center");m=0===this.orientation?{top:Cm(t,"space.actionTop",0),bottom:Cm(t,"space.actionBottom",0),right:Cm(t,"space.actionRight",0)}:{left:Cm(t,"space.actionLeft",0),right:Cm(t,"space.actionRight",0),bottom:Cm(t,"space.actionBottom",0)};d=Cm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=km.call(this,l,l,1)),!d){var k=Cm(t,"actionSize");this.setActionSize(Cm(t,"actionWidth",k),Cm(t,"actionHeight",k))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=Sm(t,"title",void 0),s=Sm(t,"separator",void 0),r=Sm(t,"innerBackground",void 0),n=Sm(t,"icon",void 0),a=Sm(t,"iconMask",void 0),o=Sm(t,"text",void 0),h=Sm(t,"action",void 0),l=Sm(t,"actionMask",void 0);if(i){var u=Sm(t,"align.title","left"),c=Sm(t,"expandTitleWidth",!1);y=Sm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:Sm(t,"space.title",0),left:Sm(t,"space.titleLeft",0),right:Sm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=Sm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:Sm(t,"space.separatorLeft",0),right:Sm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=Sm(t,"orientation",0),f=new vm(e,{orientation:g,rtl:Sm(t,"rtl",!1),space:{left:Sm(t,"space.innerLeft",0),right:Sm(t,"space.innerRight",0),top:Sm(t,"space.innerTop",0),bottom:Sm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=Sm(t,"align.icon","center");p=0===f.orientation?{right:Sm(t,"space.icon",0),top:Sm(t,"space.iconTop",0),bottom:Sm(t,"space.iconBottom",0),left:Sm(t,"space.iconLeft",0)}:{bottom:Sm(t,"space.icon",0),left:Sm(t,"space.iconLeft",0),right:Sm(t,"space.iconRight",0),top:Sm(t,"space.iconTop",0)};var v=Sm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=km.call(this,n,n,1)),!v){var m=Sm(t,"iconSize",void 0);this.setIconSize(Sm(t,"iconWidth",m),Sm(t,"iconHeight",m))}}if(o){u=Sm(t,"align.text","left");var y,b,x=Sm(t,"space.text",0),k=Sm(t,"expandTextWidth",!1),C=Sm(t,"expandTextHeight",!1);0===f.orientation?(y=k?1:0,h&&(p={right:x}),b=C):(y=C?1:0,h&&(p={bottom:x}),b=k),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=Sm(t,"align.action","center");p=0===f.orientation?{top:Sm(t,"space.actionTop",0),bottom:Sm(t,"space.actionBottom",0),right:Sm(t,"space.actionRight",0)}:{left:Sm(t,"space.actionLeft",0),right:Sm(t,"space.actionRight",0),bottom:Sm(t,"space.actionBottom",0)};v=Sm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=km.call(this,h,h,1)),!v){var S=Sm(t,"actionSize");this.setActionSize(Sm(t,"actionWidth",S),Sm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class qb extends xm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Ub(e,"background",void 0);i&&this.addBackground(i);var s=Ub(e,"title",void 0),r=Ub(e,"text",void 0);if(s){var n=Ub(e,"wrapTitle",!1),a=Ub(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Fm(s,n),e.expandTitleWidth=!0,Nb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,$b(s,{fitHeight:!0}))}if(r){var o=Ub(e,"wrapText",!1),h=Ub(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Fm(r,o),e.expandTextWidth=!0,Nb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,$b(r,{fitHeight:!0}))}var l=Ub(e,"layoutMode",0);(Kb[l]||Kb[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Jb extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=ld(i,"expandTextWidth",!1),n=ld(i,"expandTextHeight",!1);if(r||n){var a=Wc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(ld(i,"typingMode","page")),this.page=new Zc(s,ld(i,"page",void 0)),this.typing=new od(s,ld(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=ud[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(qb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Zb=Phaser.GameObjects.GetCalcMatrix;const Qb=Phaser.Renderer.Canvas.SetTransform;var tx={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Zb(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&iu(r,a,e,l,o,h),e.isStroked&&ru(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ix.prototype,tx);var sx=function(t){return t.x>0&&t.y>0};const rx=Phaser.Utils.Objects.IsPlainObject,nx=Phaser.Utils.Objects.GetValue,ax=Phaser.Geom.Polygon.Earcut;class ox extends ix{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(rx(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new by;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=nx(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(nx(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,sx(i))if(i.convex){var o=i.x,h=i.y;cu(o,h,i.x,i.y,180,270,!1,a,e)}else{cu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else lu(0,0,e);if(i=n.tr,sx(i))if(i.convex){o=s-i.x,h=i.y;cu(o,h,i.x,i.y,270,360,!1,a,e)}else{cu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else lu(s,0,e);if(i=n.br,sx(i))if(i.convex){o=s-i.x,h=r-i.y;cu(o,h,i.x,i.y,0,90,!1,a,e)}else{cu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else lu(s,r,e);if(i=n.bl,sx(i))if(i.convex){o=i.x,h=r-i.y;cu(o,h,i.x,i.y,90,180,!1,a,e)}else{cu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else lu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=ax(e),this}setShapeType(t){return"string"==typeof t&&(t=hx[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const hx={rectangle:0,circle:1};var lx=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},ux=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const bx=Phaser.Utils.Objects.GetValue,xx=Phaser.Utils.Objects.IsPlainObject;class kx extends(hc(Jl)){constructor(t,e,i,s,r,n,a,o){xx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):xx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):xx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Iu).setName("trackFill")).addShape((new Iu).setName("bar")).addShape((new Iu).setName("trackStroke")),this.setTrackColor(bx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(bx(o,"trackStrokeThickness",2),bx(o,"trackStrokeColor",void 0)),this.setSkewX(bx(o,"skewX",0)),this.setRTL(bx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Cx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&yx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),yx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&yx(o,0,0,e,i,t)}};Object.assign(kx.prototype,Cx);class Sx extends kx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=wx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const wx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Sx.prototype,fx);let Tx=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const Px=Phaser.GameObjects.NineSlice,Ox=Phaser.Utils.Objects.GetValue;class _x extends Px{constructor(t,e){void 0===e&&(e={}),super(t,Ox(e,"x",0),Ox(e,"y",0),Ox(e,"key",null),Ox(e,"frame",null),Ox(e,"width",0),Ox(e,"height",0),Ox(e,"leftWidth",0),Ox(e,"rightWidth",0),Ox(e,"topHeight",0),Ox(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=Ox(e,"effects",!0);i&&Mr(this,i),this.style=new Tx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_x.prototype,fx);let Ex=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Mx=Phaser.GameObjects.Image,Dx=Phaser.Utils.Objects.GetValue;class Lx extends Mx{constructor(t,e){void 0===e&&(e={}),super(t,Dx(e,"x",0),Dx(e,"y",0),Dx(e,"key",""),Dx(e,"frame",void 0)),this.type="rexStatesImage";var i=Dx(e,"effects",!0);i&&Mr(this,i),this.style=new Ex(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Lx.prototype,fx);var Ax=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Rx=Phaser.Utils.Objects.IsPlainObject,Bx=Phaser.Utils.Objects.GetValue;var Fx=function(t){return"string"==typeof t&&(t=Ix[t]),t};const Ix={scale:0,repeat:1};var jx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},zx={_beginDraw:gd,_drawImage:gd,_drawTileSprite:gd,_endDraw:gd,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ax),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var T=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==T&&"number"!==T||r.add(m,0,x+n.cutX,k+n.cutY,v,f)}x+=v}k+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(k,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Rx(t)?(this.stretchMode.edge=Fx(Bx(t,"edge",0)),this.stretchMode.internal=Fx(Bx(t,"internal",0))):(t=Fx(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return jx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Nx=Phaser.Utils.Objects.IsPlainObject,Gx=Phaser.Utils.Objects.GetValue;const Wx=Phaser.GameObjects;var Vx=void 0,Yx=function(t,e){if(Vx||(Vx={},jn(t).events.once("destroy",(function(){for(var t in Vx)Vx[t].destroy();Vx=void 0}))),!Vx.hasOwnProperty(e)){var i=jn(t).scene.systemScene;(t=new Wx[e](i)).setOrigin(0),Vx[e]=t}return Vx[e]};const Xx=Phaser.GameObjects.RenderTexture;class Hx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Nx(i)?(i=Gx(u=i,"x",0),s=Gx(u,"y",0),r=Gx(u,"width",1),n=Gx(u,"height",1),a=Gx(u,"key",void 0),o=Gx(u,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Nx(r)?(r=Gx(u=r,"width",1),n=Gx(u,"height",1),a=Gx(u,"key",void 0),o=Gx(u,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Nx(a)?(a=Gx(u=a,"key",void 0),o=Gx(u,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Nx(o)?(o=Gx(u=o,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Gx(u,"baseFrame",void 0)):Nx(h)&&(h=Gx(u=h,"columns",void 0),l=Gx(u,"rows",void 0)),void 0===o&&(o=Gx(u,"frame",void 0)),void 0===h){var c=Gx(u,"leftWidth",void 0),d=Gx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Gx(u,"topHeight",void 0),g=Gx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Gx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Gx(u,"stretchMode",0)),this.setPreserveRatio(Gx(u,"preserveRatio",!0));var f=Gx(u,"maxFixedPartScale",1),v=Gx(u,"maxFixedPartScaleX",f),m=Gx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,zx),i}(Xx,"rexNinePatch")){}var $x={_drawImage:function(t,e,i,s,r,n){var a=Yx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Yx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Hx.prototype,$x);let Ux=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Kx=Phaser.Utils.Objects.GetValue;class qx extends Hx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Kx(e,"effects",!0);i&&Mr(this,i),this.style=new Ux(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(qx.prototype,fx);const Jx=["alpha","tint","flipX","flipY"];var Zx=function(t,e){if(!e)return t;for(var i=0,s=Jx.length;i=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(k(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!k(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){k(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(k(t.step)){var y=t.step;t.step=function(e){if(m=e,S())C();else{if(C(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function C(){return m&&s&&(T("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?T("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)k(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return H(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||C.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),Y();if(z===f-1)return Y(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==F&&F=o)return H(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return Y();function W(t){x.push(t),w=u}function V(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function Y(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,W(S),b&&$()),H()}function X(t){u=t,W(S),S=[],I=a.indexOf(s,u)}function H(t){return{data:x,errors:C,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function $(){n(H()),x=[],C=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(k(i.userStep)){for(var a=0;a>16&255},br=function(t){return t>>8&255},xr=function(t){return 255&t};const kr=Phaser.Events.EventEmitter;var Cr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Sr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Sr={},wr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cr),function(t){if(t.events)return t;var e=new kr,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Tr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Pr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Or=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mr(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},zr=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Nr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Gr=Phaser.Geom.Rectangle,Wr=Phaser.Math.Vector2,Vr=Phaser.Math.RotateAround,Yr=Phaser.GameObjects.Container;var Xr=function(t,e){if(void 0===e?e=new Gr:!0===e&&(void 0===Hr&&(Hr=new Gr),e=Hr),t.getBounds&&!(t instanceof Yr))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();$r(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Kr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,qr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else $r(t,e),i=e.x,s=e.y,Ur(t,e),r=e.x,n=e.y,Kr(t,e),a=e.x,o=e.y,qr(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Hr=void 0,$r=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY,Qr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getTopRight?t.getTopRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY,Qr(t,e,i))},Kr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY+Nr(t),Qr(t,e,i))},qr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY+Nr(t),Qr(t,e,i))},Jr=function(t,e,i){void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr);var s=zr(t),r=Nr(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Qr(t,e,i)},Zr=void 0,Qr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Vr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const tn=Phaser.Utils.Objects.GetValue;var en=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=tn(i,"color"),r=tn(i,"lineWidth"),n=tn(i,"fillColor"),a=tn(i,"fillAlpha",1),o=tn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Zn:Jn,this.repeatCounter=0,this}stop(){return this.state=qn,this}update(t,e){this.state!==qn&&this.state!==ta&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Qn)):(this.nowTime=this.duration,this.state=ta):this.nowTime>=0&&(this.state=Zn))}get t(){var t;switch(this.state){case qn:case Jn:case Qn:t=0;break;case Zn:t=this.nowTime/this.duration;break;case ta:t=1}return Un(t,0,1)}set t(t){(t=Un(t,-1,1))<0?(this.state=Jn,this.nowTime=-this.delay*t):(this.state=Zn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===qn}get isDelay(){return this.state===Jn}get isCountDown(){return this.state===Zn}get isRunning(){return this.state===Jn||this.state===Zn}get isDone(){return this.state===ta}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const qn=0,Jn=1,Zn=2,Qn=3,ta=-1;class ea extends Xn{constructor(t,e){super(t,e),this.timer=new Kn}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Utils.Objects.GetAdvancedValue,ra=Phaser.Tweens.Builders.GetEaseFunction;class na extends ea{resetFromJSON(t){return this.timer.resetFromJSON(ia(t,"timer")),this.setEnable(ia(t,"enable",!0)),this.setTarget(ia(t,"target",this.parent)),this.setDelay(sa(t,"delay",0)),this.setDuration(sa(t,"duration",1e3)),this.setEase(ia(t,"ease","Linear")),this.setRepeat(ia(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ra(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const aa=Phaser.Sound.BaseSound;var oa=function(t){return t instanceof aa};const ha=Phaser.Utils.Objects.GetValue,la=Phaser.Utils.Objects.GetAdvancedValue,ua=Phaser.Math.Linear;let ca=class extends na{constructor(t,e,i){oa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ha(t,"mode",0)),this.setEnable(ha(t,"enable",!0)),this.setVolumeRange(la(t,"volume.start",this.parent.volume),la(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=da[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=ua(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const da={stop:1,destroy:2};var pa=function(t,e,i,s,r){oa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ca(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ga=function(t,e,i,s){oa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ca(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const fa=Phaser.Utils.Objects.GetValue;var va={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:fa(e,"loop",this.backgroundMusicLoop),mute:fa(e,"mute",this.backgroundMusicMute),volume:fa(e,"volume",this.backgroundMusicVolume),detune:fa(e,"detune",0),rate:fa(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&pa(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ga(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ma=Phaser.Utils.Objects.GetValue;var ya={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ma(e,"loop",this.backgroundMusicLoop),mute:ma(e,"mute",this.backgroundMusic2Mute),volume:ma(e,"volume",this.backgroundMusic2Volume),detune:ma(e,"detune",0),rate:ma(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&pa(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ga(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const ba=Phaser.Utils.Array.Remove,xa=Phaser.Utils.Objects.GetValue;var ka={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:xa(e,"mute",this.soundEffectsMute),volume:xa(e,"volume",this.soundEffectsVolume),detune:xa(e,"detune",0),rate:xa(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&ba(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&ba(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&pa(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ga(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ga(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&pa(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ga(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ga(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ba=Phaser.Utils.Objects.GetValue,Fa=new class extends Ra{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=io(this.delimiterLeft),e=io(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Xs:t||(t=ao),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=lo),this.tagExpression=t,this}setValueExpression(t){return t||(t=lo),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==lo||this.valueExpression!==lo){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=io(this.delimiterLeft),e=io(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=oo(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const lo="[^=]+";var uo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],co=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},po=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:co(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},So={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},wo={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},To={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},Po={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},Oo=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return Oo(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!Oo(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Eo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const $o=Phaser.GameObjects.Zone;let Uo=class extends $o{constructor(t){super(t,0,0,2,2),this.fullWindow=new Ho(this)}};const Ko="BG",qo="SPRITE",Jo="TEXTBOX",Zo="TITLE",Qo="CHOICE",th="NAMEINPUT";var eh=!1,ih=function(t){eh||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return rh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return nh(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ich(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ech(t).x,getChildLocalY:t=>ch(t).y};const Oh=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=ch(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=ch(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return ch(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return ch(t).rotation=Oh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=ch(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>ch(t).rotation},Eh={updateChildScale(t){var e=ch(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=ch(t),i=e.parent;return e.scaleX=Th(t.scaleX,i.scaleX),e.scaleY=Th(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=ch(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=ch(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>ch(t).scaleX,getChildLocalScaleY:t=>ch(t).scaleY},Mh={updateChildVisible(t){var e=ch(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=ch(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),ch(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),ch(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=ch(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>ch(t).visible},Dh={updateChildAlpha(t){var e=ch(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=ch(t),i=e.parent;return e.alpha=Th(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return ch(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=ch(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>ch(t).alpha},Lh={updateChildActive(t){var e=ch(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return ch(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),ch(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=ch(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>ch(t).active},Ah={updateChildScrollFactor(t){var e=ch(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Rh={updateCameraFilter(t){var e=ch(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Bh={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Fh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Ih={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},jh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Nh=Phaser.Utils.Array;var Gh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,O):r(c,d,O),h&&c.add.existing(P),l){var _=b+C*T+a*C,E=x+S*w+o*S;P.setOrigin(a,o).setPosition(_,E).setScale(f,v).setRotation(m),Al(P,b,x,m)}k.push(P)}return k}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(Vl.prototype,Fl);const Xl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Hl=Phaser.GameObjects.GetCalcMatrix;const $l=Phaser.Renderer.Canvas.SetTransform;var Ul={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},au=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const ou=Phaser.Geom.Polygon.Earcut;class hu extends tu{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=ou(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&iu(t,e,this,i,s,r),this.isStroked&&ru(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const uu=Phaser.Math.DegToRad;var cu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=zu(t,"tl",0),this.radiusTR=zu(t,"tr",0),this.radiusBL=zu(t,"bl",0),this.radiusBR=zu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?cu(e,e,e,e,180,270,!1,r,t):cu(0,0,e,e,90,0,!0,r,t):lu(0,0,t);(e=this.radiusTR)>0?this._convexTR?cu(i-e,e,e,e,270,360,!1,r,t):cu(i,0,e,e,180,90,!0,r,t):lu(i,0,t);(e=this.radiusBR)>0?this._convexBR?cu(i-e,s-e,e,e,0,90,!1,r,t):cu(i,s,e,e,270,180,!0,r,t):lu(i,s,t);(e=this.radiusBL)>0?this._convexBL?cu(e,s-e,e,e,90,180,!1,r,t):cu(0,s,e,e,360,270,!0,r,t):lu(0,s,t);return t.push(t[0],t[1]),ku(this.x,this.y,t),super.updateData(),this}};const Gu=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;const Wu={arc:pu,circle:gu,curve:class extends hu{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),mc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,fc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class xc extends Vl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=bc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},Yc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Xc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Yc(t));t=this.sections.join("\n");this.lines=Vc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(qc,Xc,$c,Kc);const Jc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Zc extends Nn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Wc(this.parent),this.pageStartIndexes=[],this.lines=Vc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Jc(t,"maxLines",void 0)),this.setPageBreak(Jc(t,"pageBreak","\f\n")),this.setText(Jc(t,"text","")),this.startLineIndex=Jc(t,"start",-1),this.endLineIndex=Jc(t,"end",void 0);var e=Jc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Wc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Zc.prototype,qc);var Qc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Uc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Yc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},td=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},ed=function(t,e){for(var i=void 0,s=0;s0)l=id(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=id(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},rd={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=td(this.parent,t);n=ed(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)sd.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(rd,Qc);const nd=Phaser.Utils.Objects.GetFastValue,ad=Phaser.Utils.Objects.GetValue;class od extends Nn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(ad(t,"wrap",!1)),this.setTypeMode(ad(t,"typeMode",0)),this.setTypingSpeed(ad(t,"speed",333)),this.setTextCallback=nd(t,"setTextCallback",null),this.setTextCallbackScope=nd(t,"setTextCallbackScope",null),this.setTypingContent(nd(t,"text","")),this.typingIndex=nd(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=nd(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=hd[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Yc(t);this.textWrapEnable&&(e=function(t,e){switch(Wc(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=td(this.parent,this.text).length,this}onTyping(){var t=sd.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Uc(this.parent,t):this.parent.setText(t)}}const hd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(od.prototype,rd);const ld=Phaser.Utils.Objects.GetValue;const ud={page:0,line:1};var cd=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const dd=Phaser.Display.Align;var pd={center:dd.CENTER,left:dd.LEFT_CENTER,right:dd.RIGHT_CENTER,top:dd.TOP_CENTER,bottom:dd.BOTTOM_CENTER,"left-top":dd.TOP_LEFT,"top-left":dd.TOP_LEFT,"left-center":dd.LEFT_CENTER,"center-left":dd.LEFT_CENTER,"left-bottom":dd.BOTTOM_LEFT,"bottom-left":dd.BOTTOM_LEFT,"center-top":dd.TOP_CENTER,"top-center":dd.TOP_CENTER,"center-center":dd.CENTER,"center-bottom":dd.BOTTOM_CENTER,"bottom-center":dd.BOTTOM_CENTER,"right-top":dd.TOP_RIGHT,"top-right":dd.TOP_RIGHT,"right-center":dd.RIGHT_CENTER,"center-right":dd.RIGHT_CENTER,"right-bottom":dd.BOTTOM_RIGHT,"bottom-right":dd.BOTTOM_RIGHT},gd=function(){},fd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:gd,events:{once:gd}}},0,0,1,1);fd.setOrigin(0);var vd=0,md=1,yd=2,bd=4,xd=6,kd=8,Cd=10,Sd=12,wd=function(t){var e=Nr(t);return t.y+e-e*t.originY},Td=function(t){var e=zr(t);return t.x-e*t.originX+.5*e},Pd=function(t,e){var i=Nr(t);return t.y=e-i+i*t.originY,t},Od=function(t,e){var i=zr(t),s=i*t.originX;return t.x=e+s-.5*i,t},_d=function(t){var e=zr(t);return t.x-e*t.originX},Ed=function(t,e){var i=zr(t);return t.x=e+i*t.originX,t},Md=function(t){var e=zr(t);return t.x+e-e*t.originX},Dd=function(t,e){var i=zr(t);return t.x=e-i+i*t.originX,t},Ld=function(t,e){var i=Nr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Ad=function(t){var e=Nr(t);return t.y-e*t.originY+.5*e},Rd=function(t){var e=Nr(t);return t.y-e*t.originY},Bd=function(t,e){var i=Nr(t);return t.y=e+i*t.originY,t},Fd=[];Fd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,Td(e)+i),Pd(t,wd(e)+s),t},Fd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)-i),Pd(t,wd(e)+s),t},Fd[Sd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Md(e)+i),Pd(t,wd(e)+s),t},Fd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Od(t,e),Ld(t,i)}(t,Td(e)+i,Ad(e)+s),t},Fd[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)-i),Ld(t,Ad(e)+s),t},Fd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Md(e)+i),Ld(t,Ad(e)+s),t},Fd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,Td(e)+i),Bd(t,Rd(e)-s),t},Fd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)-i),Bd(t,Rd(e)-s),t},Fd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Md(e)+i),Bd(t,Rd(e)-s),t};var Id=function(t,e,i,s,r){return Fd[i](t,e,s,r)},jd=function(t,e,i,s,r,n){fd.setPosition(e,i).setSize(s,r),Id(t,fd,n)};const zd=Phaser.Utils.Objects.GetValue,Nd=Phaser.GameObjects.Group,Gd=Phaser.GameObjects.Container;var Wd=function(t,e,i){return t.add.text(0,0,"")},Vd=function(t,e){Array.isArray(t)||(t=[t]),void 0===e&&(e=[]);for(var i=0,s=t.length;i=0;e--)this.remove(this.backgroundChildren[e],t);return this}},sp=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const rp=/(\S+)\[(\d+)\]/i;const np=Phaser.Utils.Objects.GetValue;var ap=function(t,e){return void 0===e?t:t[e]},op=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=np(e,"left",0),t.right=np(e,"right",0),t.top=np(e,"top",0),t.bottom=np(e,"bottom",0)),t},hp={getInnerPadding(t){return ap(this.space,t)},setInnerPadding(t,e){return op(this.space,t,e),this},getOuterPadding(t){return ap(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return op(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ap(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),op(this.getSizerConfig(t).padding,e,i),this}},lp=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},up=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},cp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},dp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},pp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},gp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},fp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},vp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Sg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Bn(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},wg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=gd),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=gd),this.transitOutCallback=t,this}},Tg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Pg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Og={};Object.assign(Og,Sg,wg,Tg,Pg);const _g=Phaser.Utils.Objects.GetValue;class Eg extends Nn{constructor(t,e){super(t,e),this.setTransitInTime(_g(e,"duration.in",200)),this.setTransitOutTime(_g(e,"duration.out",200)),this.setTransitInCallback(_g(e,"transitIn")),this.setTransitOutCallback(_g(e,"transitOut")),this.oneShotMode=_g(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Cg(this,{eventEmitter:!1,initState:_g(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Eg.prototype,Og);const Mg=Phaser.GameObjects.Rectangle;class Dg extends Mg{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ho(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Lg=Phaser.Utils.Objects.GetValue;class Ag extends Nn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Lg(t,"hitAreaMode",0)),this.setEnable(Lg(t,"enable",!0)),this.setStopMode(Lg(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Rg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Rg={default:0,fullWindow:1};const Bg=Phaser.Utils.Objects.GetValue;class Fg extends Dg{constructor(t,e){super(t,Bg(e,"color",0),Bg(e,"alpha",.8)),this.touchEventStop=new Ag(this,{hitAreaMode:1})}}var Ig={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Dp(t,e)},scaleDown(t,e){Lp(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yp(t,e)},fadeOut(t,e){Xp(t,e,!1)}},jg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yp(t,e,t.alpha)},zg=function(t,e){Xp(t,e,!1)},Ng=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Xr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Gg=Phaser.Utils.Objects.GetValue;let Wg=class extends Eg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Vg.popUp),null==e.transitOut&&(e.transitOut=Vg.scaleDown),e.destroy=Gg(e,"destroy",!0),super(t,e);var i=Gg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Fg(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Gg(i,"transitIn",jg)),this.setCoverTransitOutCallback(Gg(i,"transitOut",zg)));var s=Gg(e,"touchOutsideClose",!1),r=Gg(e,"duration.hold",-1),n=Gg(e,"timeOutClose",r>=0),a=Gg(e,"anyTouchClose",!1);Gg(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Gg(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ng(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Vg[t]),t){case Vg.popUp:t=Ig.popUp;break;case Vg.fadeIn:t=Ig.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Vg[t]),t){case Vg.scaleDown:t=Ig.scaleDown;break;case Vg.fadeOut:t=Ig.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Vg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Yg=function(t){return t&&"function"==typeof t},Xg={modal(t,e){return Yg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Wg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Hg=function(t,e,i,s,r){Yg(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},$g={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),bo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Hg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Hg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Hg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Hg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Hg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Hg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Hg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Hg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Hg.call(this,"shutdown",t,e,i,s),this}},Ug=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Kg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Kg={},qg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ng(t,e.x,e.y,i,s):!!(r=Ug(e,n,!0))&&Ng(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const lf={press:0,pointerdown:0,release:1,pointerup:1};var uf={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new hf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},cf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!df(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return pf.length=0,!0;return pf.length=0,!1},pf=[];const gf=Phaser.Utils.Objects.GetValue;class ff extends Nn{constructor(t,e){super(t,e),this._enable=void 0;var i=gf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(gf(t,"enable",!0)),this.setMode(gf(t,"mode",1)),this.setClickInterval(gf(t,"clickInterval",100)),this.setDragThreshold(gf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=vf[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?cf:qg)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const vf={press:0,pointerdown:0,release:1,pointerup:1};var mf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new ff(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class yf extends kg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const bf=Phaser.Utils.Objects.GetValue;class xf extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new yf,this.parent.setInteractive(bf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(bf(t,"enable",!0)),this.setCooldown(bf(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&qg(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new xf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new xf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Cf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Sf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=zf,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Nf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=zf,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Gf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&qg(t,s,e,i)}}const zf=0,Nf=1,Gf="IDLE",Wf=Phaser.Utils.Objects.GetValue,Vf=Phaser.Math.Distance.Between;class Yf extends jf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Xf},eventEmitter:!1};this.setRecongizedStateObject(new kg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Wf(t,"time",250)),this.setTapInterval(Wf(t,"tapInterval",200)),this.setDragThreshold(Wf(t,"threshold",9)),this.setTapOffset(Wf(t,"tapOffset",10));var e=Wf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Wf(t,"maxTaps",void 0)),this.setMinTaps(Wf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Xf:this.state=Hf;break;case Hf:var t=this.lastPointer;Vf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=$f,this.state=Hf);break;case $f:this.state=Hf}}onDragEnd(){this.state===Hf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$f))}onDrag(){this.state!==Xf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Xf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Hf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Xf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$f:this.state=Xf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===$f&&(this.state=Xf)}get isTapped(){return this.state===$f}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Xf="IDLE",Hf="BEGIN",$f="RECOGNIZED",Uf=Phaser.Utils.Objects.GetValue;class Kf extends jf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qf},eventEmitter:!1};this.setRecongizedStateObject(new kg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Uf(t,"threshold",9)),this.setHoldTime(Uf(t,"time",251)),this}onDragStart(){this.state=Jf,0===this.holdTime&&(this.state=Zf)}onDragEnd(){this.state=qf}onDrag(){this.state!==qf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Jf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Zf))}get isPressed(){return this.state===Zf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const qf="IDLE",Jf="BEGIN",Zf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var Qf=function(t){return jn(t).loop.delta};const tv=Phaser.Math.Distance.Between,ev=Phaser.Math.Angle.Between;var iv={getDt:function(){return Qf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return tv(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ev(e.x,e.y,t.x,t.y)}},sv={"up&down":0,"left&right":1,"4dir":2,"8dir":3},rv={};const nv=Phaser.Utils.Objects.GetValue,av=Phaser.Math.RadToDeg;class ov extends jf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=hv},eventEmitter:!1};this.setRecongizedStateObject(new kg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nv(t,"threshold",10)),this.setVelocityThreshold(nv(t,"velocityThreshold",1e3)),this.setDirectionMode(nv(t,"dir","8dir")),this}onDragStart(){this.state=lv}onDragEnd(){this.state=hv}onDrag(){this.state===lv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=uv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===uv&&(this.state=hv)}get isSwiped(){return this.state===uv}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=sv[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=rv),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(av(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(ov.prototype,iv);const hv="IDLE",lv="BEGIN",uv="RECOGNIZED",cv=Phaser.Utils.Objects.GetValue,dv=Phaser.Utils.Array.SpliceOne,pv=Phaser.Math.Distance.Between,gv=Phaser.Math.Angle.Between;class fv{constructor(t,e){var i=Bn(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(cv(e,"inputConfig",void 0)),this.setEventEmitter(cv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(cv(t,"enable",!0)),this.bounds=cv(t,"bounds",void 0),this.tracerState=mv,this.pointers.length=0,co(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,co(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case mv:this.tracerState=yv,this.onDrag1Start();break;case yv:this.tracerState=bv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],dv(this.pointers,e),this.tracerState){case yv:this.tracerState=mv,this.onDrag1End();break;case bv:this.tracerState=yv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case yv:this.onDrag1();break;case bv:this.onDrag2()}}}dragCancel(){return this.tracerState===bv&&this.onDrag2End(),this.pointers.length=0,co(this.movedState),this.tracerState=mv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==bv)return 0;var t=this.pointers[0],e=this.pointers[1];return pv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==bv)return 0;var t=this.pointers[0],e=this.pointers[1];return gv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;vv.x=e.x-i.x,vv.y=e.y-i.y}else vv.x=0,vv.y=0;return vv}get centerX(){if(this.tracerState!==bv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==bv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==bv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==bv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=xv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&qg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&qg(t,s,e,i)}}Object.assign(fv.prototype,ur);var vv={};const mv=0,yv=1,bv=2,xv="IDLE";Phaser.Utils.Objects.GetValue;const kv=Phaser.Math.RotateAround;var Cv=function(t,e,i,s){return kv(t,e,i,s),t.rotation+=s,t},Sv={};const wv=Phaser.Utils.Objects.GetValue,Tv=Phaser.Math.Angle.WrapDegrees,Pv=Phaser.Math.Angle.ShortestBetween,Ov=Phaser.Math.RadToDeg,_v=Phaser.Math.DegToRad;var Ev={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Sv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Tv(Ov(this.angleBetween));this.angle=Pv(this.prevAngle,t),this.prevAngle=t,this.state=Lv}break;case Lv:t=Tv(Ov(this.angleBetween));this.angle=Pv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Lv}get rotation(){return _v(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ev);const Mv="IDLE",Dv="BEGIN",Lv="RECOGNIZED",Av=Phaser.Utils.Objects.GetValue;var Rv=function(t){var e=Av(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Yf(this,e),this._tap.on("tap",(function(t,e,s){wf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),wf(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Bv=Phaser.Utils.Objects.GetValue;var Fv=function(t){var e=Bv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Kf(this,e),this._press.on("pressstart",(function(t,e,s){wf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){wf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Iv=Phaser.Utils.Objects.GetValue;var jv=function(t){var e=Iv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new ov(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";wf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),wf(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const zv=Phaser.Utils.Objects.GetValue;var Nv=function(t,e){return t.setInteractive(),zv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:zv(e,"targets",[t]),targetMode:zv(e,"targetMode","parent"),eventEmitter:zv(e,"eventEmitter",t),eventNamePrefix:zv(e,"inputEventPrefix","child.")},Pf.call(t,e),Ef.call(t,e),Lf.call(t,e),Ff.call(t,e),Rv.call(t,e),Fv.call(t,e),jv.call(t,e),t},Gv={getSizerConfig:function(t){return void 0===t&&(t=this),cd(t)},getChildPrevState:function(t){var e=cd(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=un(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=zd(e,"color"),s=zd(e,"lineWidth");var h=zd(e,"name",!1);h&&(r=zd(h,"createTextCallback",Wd),n=zd(h,"createTextCallbackScope",void 0),"string"==typeof(a=zd(h,"align","left-top"))&&(a=pd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Nd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var u,c,d=this.getAllShownChildren([this]);Vd(d,d);for(var p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const qv=Phaser.Utils.Objects.IsPlainObject,Jv=Phaser.Utils.Objects.GetValue,Zv=Phaser.Display.Align.CENTER,Qv={min:0,full:-1};var tm=function(t,e,i,s,r,n,a,o,h,l){var u,c,d,p;Hd.call(this,t);var g=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=Qv[e];else if(qv(e)){var v;e=Jv(v=e,"proportion",void 0),i=Jv(v,"align",Zv),s=Jv(v,"padding",0),r=Jv(v,"expand",!1),n=Jv(v,"key",void 0),a=Jv(v,"index",void 0),t.isRexSizer||(o=Jv(v,"minWidth",void 0),h=Jv(v,"minHeight",void 0)),l=Jv(v,"fitRatio",0),u=Jv(v,"offsetX",0),c=Jv(v,"offsetY",0),d=Jv(v,"offsetOriginX",0),p=Jv(v,"offsetOriginY",0)}return"string"==typeof i&&(i=pd[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Zv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zr(t)/Nr(t)),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===p&&(p=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=wl(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=u,v.alignOffsetY=c,v.alignOffsetOriginX=d,v.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?zr(t):o:t.minHeight=void 0===h?Nr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},em={add:tm,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),tm.call(this,new Uv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return qv(i)&&(i.index=t),tm.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Kv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const im=al.prototype.clear;var sm=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),im.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,sm.call(this,t),this}},am={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=pd[e]),this.getSizerConfig(t).align=e,this}},om={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},hm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},lm={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},um={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(bp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,vp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u,c,d=this.sizerChildren,p=this.innerLeft,g=this.innerTop,f=this.innerWidth,v=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,k=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=dp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||up.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Hv.call(this,t,void 0),cp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||pp.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Hv.call(this,void 0,t),gp.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(um,em,nm,am,om,hm,lm);var cm=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},dm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},pm=function(t){return"string"==typeof t&&(t=dm[t]),t};const gm=Phaser.Utils.Objects.IsPlainObject,fm=Phaser.Utils.Objects.GetValue;class vm extends Vv{constructor(t,e,i,s,r,n,a){gm(e)?(e=fm(a=e,"x",0),i=fm(a,"y",0),s=fm(a,"width",void 0),r=fm(a,"height",void 0),n=fm(a,"orientation",0)):gm(s)?(s=fm(a=s,"width",void 0),r=fm(a,"height",void 0),n=fm(a,"orientation",0)):gm(n)&&(n=fm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(fm(a,"space.item",0)),this.setStartChildIndex(fm(a,"startChildIndex",0)),this.setRTL(fm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=pm(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=cm.call(this)),this._childrenProportion}}Object.assign(vm.prototype,um);var mm=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},ym=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},bm={appendText:ym,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class xm extends vm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(mm(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(mm(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&mm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&mm(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(xm.prototype,bm);var km=function(t,e,i,s){var r=new Ol(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Cm=Phaser.Utils.Objects.GetValue;const Sm=Phaser.Utils.Objects.GetValue;var wm=/^[\x00-\x7F]+$/,Tm=function(t){return wm.test(t)},Pm=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},_m=0,Em=1,Mm=2,Dm=0,Lm=1,Am=2,Rm=/(?:\r\n|\r|\n)/;const Bm={none:Dm,word:Lm,char:Am,character:Am,mix:3};var Fm=function(t,e){switch(Wc(t)){case 0:switch("string"==typeof e&&(e=Bm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Pm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Bm[e]||0),t.style.wrapMode=e}};const Im=Phaser.Renderer.WebGL.Utils;var jm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Im.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const zm=Phaser.Display.Color;var Nm={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new zm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Gm=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},Wm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Gm(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};ih();const Vm=Phaser.Display.Canvas.CanvasPool,Ym=Phaser.GameObjects.GameObject,Xm=Phaser.Utils.String.UUID;let Hm=class extends Ym{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Vm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Xm(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Vm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const $m=Phaser.GameObjects.Components;Phaser.Class.mixin(Hm,[$m.Alpha,$m.BlendMode,$m.Crop,$m.Depth,$m.Flip,$m.GetBounds,$m.Mask,$m.Origin,$m.Pipeline,$m.PostPipeline,$m.ScrollFactor,$m.Tint,$m.Transform,$m.Visible,jm,Nm,Wm]);let Um=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Um.prototype,Ql);var Km={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const qm=Phaser.Math.RotateAround;var Jm;const Zm=Phaser.Geom.Rectangle;var Qm,ty=function(t){void 0===Qm&&(Qm=new Zm);var e=t.drawTLX,i=t.drawTLY;return Qm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Qm};const ey=Phaser.Math.RotateAround;var iy,sy=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===iy&&(iy={}),s=iy),s.x=e,s.y=i,0!==t.rotation&&ey(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ry=Phaser.GameObjects.Components.TransformMatrix;var ny,ay,oy={},hy=function(t,e,i,s,r){var n=sy(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=oy);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ny&&(ny=new ry,ay=new ry),t.parentContainer?t.getWorldTransformMatrix(ny,ay):ny.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ny.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ly=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return hy(t,e,n,a,r)},uy={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Jm&&(Jm={}),s=Jm),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&qm(s,0,0,-i.rotation),s}(t,e,this,!0);return ty(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ly(this.parent,this,t,e,i)}};Object.assign(uy,Km);const cy=Phaser.Math.DegToRad,dy=Phaser.Math.RadToDeg,py=Phaser.Utils.Objects.GetValue;class gy extends Um{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return dy(this._rotation)}set angle(t){this.rotation=cy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=py(t,"width",void 0),i=py(t,"height",void 0),s=py(t,"scaleX",void 0),r=py(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(gy.prototype,uy);const fy=Phaser.Utils.String.Pad;var vy=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${fy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},my=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const yy=Phaser.Utils.Objects.GetValue;let by=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=yy(t,"x",0),i=yy(t,"y",0));var s=this.cornerRadius;s.tl=xy(yy(t,"tl",void 0),e,i),s.tr=xy(yy(t,"tr",void 0),e,i),s.bl=xy(yy(t,"bl",void 0),e,i),s.br=xy(yy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ky(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ky(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ky(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ky(this.cornerRadius.br,t)}};var xy=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Cy(t),t},ky=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=yy(e,"x",0),t.y=yy(e,"y",0)),Cy(t)},Cy=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Sy=Phaser.Math.DegToRad;var wy=function(t){return!t.hasOwnProperty("convex")||t.convex},Ty=function(t){return t.x>0&&t.y>0},Py=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Ty(o)?(h=o.x*f,l=o.y*v,wy(o)?Py(t,h,l,h,l,180,270,!1,a):Py(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,Ty(o)?(h=o.x*f,l=o.y*v,wy(o)?Py(t,s-h,l,h,l,270,360,!1,a):Py(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Ty(o)?(h=o.x*f,l=o.y*v,wy(o)?Py(t,s-h,r-l,h,l,0,90,!1,a):Py(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Ty(o)?(h=o.x*f,l=o.y*v,wy(o)?Py(t,h,r-l,h,l,90,180,!1,a):Py(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},_y=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),Oy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Ey=Phaser.Utils.Objects.GetValue;class My extends gy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ey(e,"color",null),Ey(e,"color2",null),Ey(e,"horizontalGradient",!0)),this.setStroke(Ey(e,"stroke",null),Ey(e,"strokeThickness",2)),this.setCornerRadius(Ey(e,"cornerRadius",0),Ey(e,"cornerIteration",null))}set color(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=vy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,my("color2",t,this),my("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,my("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,my("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){_y(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Dy=Phaser.Utils.Objects.GetValue;class Ly extends gy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Dy(e,"color",null),Dy(e,"color2",null),Dy(e,"horizontalGradient",!0)),this.setStroke(Dy(e,"stroke",null),Dy(e,"strokeThickness",2))}set color(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=vy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Dy(t,"color2",null),Dy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Dy(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Ay=Phaser.Utils.Objects.GetValue;let Ry=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ay(t,"bold",!1)),this.setItalic(Ay(t,"italic",!1)),this.setFontSize(Ay(t,"fontSize","16px")),this.setFontFamily(Ay(t,"fontFamily","Courier")),this.setColor(Ay(t,"color","#fff")),this.setStrokeStyle(Ay(t,"stroke",null),Ay(t,"strokeThickness",0)),this.setShadow(Ay(t,"shadowColor",null),Ay(t,"shadowOffsetX",0),Ay(t,"shadowOffsetY",0),Ay(t,"shadowBlur",0)),this.setOffset(Ay(t,"offsetX",0),Ay(t,"offsetY",0)),this.setSpace(Ay(t,"leftSpace",0),Ay(t,"rightSpace",0)),this.setAlign(Ay(t,"align",void 0)),this.setBackgroundColor(Ay(t,"backgroundColor",null)),this.setBackgroundHeight(Ay(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ay(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Ay(t,"backgroundLeftX",0)),this.setBackgroundRightX(Ay(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(my("stroke",t,this),my("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(my("shadowOffsetX",t,this),my("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=vy(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=vy(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=vy(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=vy(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const By=Phaser.Utils.Array.Remove;const Fy=Phaser.Utils.Array.Remove;const Iy="text",jy="image",zy="drawer",Ny="space",Gy="command";var Wy=function(t){return t.type===Iy&&"\n"===t.text},Vy=function(t){return t.type===Iy&&"\f"===t.text},Yy=function(t){return t.type===Iy};class Xy extends gy{constructor(t,e,i){super(t,Iy),this.updateTextFlag=!1,this.style=new Ry(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Hy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const $y=Phaser.Display.Canvas.CanvasPool;var Uy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=$y.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),$y.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Ky extends gy{constructor(t,e,i){super(t,jy),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Uy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class qy extends gy{constructor(t,e,i,s){super(t,zy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Jy extends gy{constructor(t,e){super(t,Ny),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Zy extends Um{constructor(t,e,i,s,r){super(t,Gy),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Qy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const tb={none:0,word:1,char:2,character:2,mix:3};var eb=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=nb.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=nb.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=ob(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=ob(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=ob(t,"wrapMode");void 0===c&&(c=ob(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=tb[c]);var d=ob(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=ob(t,"letterSpacing",0),g=ob(t,"hAlign",0),f=ob(t,"vAlign",0),v=ob(t,"justifyPercentage",.25),m=Qy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:D}),L=Math.max(L,D)),m.start+=_.length,m.isLastPage=!A&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ub(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ub(t,"maxLines",0);var o=0===i,h=ub(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ub(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=ub(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=ub(t,"letterSpacing",0),p=ub(t,"rtl",!0),g=ub(t,"hAlign",p?2:0),f=ub(t,"vAlign",0),v=Qy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),D=Math.max(D,M)),v.start+=O.length,v.isLastPage=v.start===P,v.maxLineHeight=D,v.linesWidth=_.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return op(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return ap(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),By(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Fy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Iy);return null===i?i=new Xy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ly(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Yb(t,r,e,i,n),o=0;o<=Gb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Yb(t,r,e,i,n)}return o===Gb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Xb(t,e,i),t},Vb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Yb=function(t,e,i,s,r){var n,a=Vb(t,e,r),o=Vb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Xb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Hb=Phaser.Utils.Objects.GetValue;var $b=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Hb(e,"minWidth",0),s=Hb(e,"minHeight",0),r=Hb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Wb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Wb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Ub=Phaser.Utils.Objects.GetValue,Kb=[function(t){var e=this.scene,i=Cm(t,"orientation",0);this.setOrientation(i);var s=Cm(t,"icon",void 0),r=Cm(t,"iconMask",void 0),n=Cm(t,"innerBackground",void 0),a=Cm(t,"title",void 0),o=Cm(t,"separator",void 0),h=Cm(t,"text",void 0),l=Cm(t,"action",void 0),u=Cm(t,"actionMask",void 0);if(s){var c=Cm(t,"align.icon","center");m=0===this.orientation?{right:Cm(t,"space.icon",0),top:Cm(t,"space.iconTop",0),bottom:Cm(t,"space.iconBottom",0),left:Cm(t,"space.iconLeft",0)}:{bottom:Cm(t,"space.icon",0),left:Cm(t,"space.iconLeft",0),right:Cm(t,"space.iconRight",0),top:Cm(t,"space.iconTop",0)};var d=Cm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=km.call(this,s,s,1)),!d){var p=Cm(t,"iconSize",void 0);this.setIconSize(Cm(t,"iconWidth",p),Cm(t,"iconHeight",p))}}var g=new vm(e,{orientation:1});n&&g.addBackground(n);var f=Cm(t,"space.separator",0);if(a){c=Cm(t,"align.title","left");var v=Cm(t,"expandTitleWidth",!1);y=Cm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?Cm(t,"space.title",f):0,left:Cm(t,"space.titleLeft",0),right:Cm(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:Cm(t,"space.separatorLeft",0),right:Cm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=Cm(t,"align.text","left");var y,b,x=Cm(t,"expandTextWidth",!1);y=Cm(t,"expandTextHeight",!1)?1:0,b=x,m={left:Cm(t,"space.textLeft",0),right:Cm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:Cm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=Cm(t,"align.action","center");m=0===this.orientation?{top:Cm(t,"space.actionTop",0),bottom:Cm(t,"space.actionBottom",0),right:Cm(t,"space.actionRight",0)}:{left:Cm(t,"space.actionLeft",0),right:Cm(t,"space.actionRight",0),bottom:Cm(t,"space.actionBottom",0)};d=Cm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=km.call(this,l,l,1)),!d){var k=Cm(t,"actionSize");this.setActionSize(Cm(t,"actionWidth",k),Cm(t,"actionHeight",k))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=Sm(t,"title",void 0),s=Sm(t,"separator",void 0),r=Sm(t,"innerBackground",void 0),n=Sm(t,"icon",void 0),a=Sm(t,"iconMask",void 0),o=Sm(t,"text",void 0),h=Sm(t,"action",void 0),l=Sm(t,"actionMask",void 0);if(i){var u=Sm(t,"align.title","left"),c=Sm(t,"expandTitleWidth",!1);y=Sm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:Sm(t,"space.title",0),left:Sm(t,"space.titleLeft",0),right:Sm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=Sm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:Sm(t,"space.separatorLeft",0),right:Sm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=Sm(t,"orientation",0),f=new vm(e,{orientation:g,rtl:Sm(t,"rtl",!1),space:{left:Sm(t,"space.innerLeft",0),right:Sm(t,"space.innerRight",0),top:Sm(t,"space.innerTop",0),bottom:Sm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=Sm(t,"align.icon","center");p=0===f.orientation?{right:Sm(t,"space.icon",0),top:Sm(t,"space.iconTop",0),bottom:Sm(t,"space.iconBottom",0),left:Sm(t,"space.iconLeft",0)}:{bottom:Sm(t,"space.icon",0),left:Sm(t,"space.iconLeft",0),right:Sm(t,"space.iconRight",0),top:Sm(t,"space.iconTop",0)};var v=Sm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=km.call(this,n,n,1)),!v){var m=Sm(t,"iconSize",void 0);this.setIconSize(Sm(t,"iconWidth",m),Sm(t,"iconHeight",m))}}if(o){u=Sm(t,"align.text","left");var y,b,x=Sm(t,"space.text",0),k=Sm(t,"expandTextWidth",!1),C=Sm(t,"expandTextHeight",!1);0===f.orientation?(y=k?1:0,h&&(p={right:x}),b=C):(y=C?1:0,h&&(p={bottom:x}),b=k),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=Sm(t,"align.action","center");p=0===f.orientation?{top:Sm(t,"space.actionTop",0),bottom:Sm(t,"space.actionBottom",0),right:Sm(t,"space.actionRight",0)}:{left:Sm(t,"space.actionLeft",0),right:Sm(t,"space.actionRight",0),bottom:Sm(t,"space.actionBottom",0)};v=Sm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=km.call(this,h,h,1)),!v){var S=Sm(t,"actionSize");this.setActionSize(Sm(t,"actionWidth",S),Sm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class qb extends xm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Ub(e,"background",void 0);i&&this.addBackground(i);var s=Ub(e,"title",void 0),r=Ub(e,"text",void 0);if(s){var n=Ub(e,"wrapTitle",!1),a=Ub(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Fm(s,n),e.expandTitleWidth=!0,Nb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,$b(s,{fitHeight:!0}))}if(r){var o=Ub(e,"wrapText",!1),h=Ub(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Fm(r,o),e.expandTextWidth=!0,Nb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,$b(r,{fitHeight:!0}))}var l=Ub(e,"layoutMode",0);(Kb[l]||Kb[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Jb extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=ld(i,"expandTextWidth",!1),n=ld(i,"expandTextHeight",!1);if(r||n){var a=Wc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(ld(i,"typingMode","page")),this.page=new Zc(s,ld(i,"page",void 0)),this.typing=new od(s,ld(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=ud[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(qb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Zb=Phaser.GameObjects.GetCalcMatrix;const Qb=Phaser.Renderer.Canvas.SetTransform;var tx={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Zb(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&iu(r,a,e,l,o,h),e.isStroked&&ru(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ix.prototype,tx);var sx=function(t){return t.x>0&&t.y>0};const rx=Phaser.Utils.Objects.IsPlainObject,nx=Phaser.Utils.Objects.GetValue,ax=Phaser.Geom.Polygon.Earcut;class ox extends ix{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(rx(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new by;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=nx(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(nx(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,sx(i))if(i.convex){var o=i.x,h=i.y;cu(o,h,i.x,i.y,180,270,!1,a,e)}else{cu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else lu(0,0,e);if(i=n.tr,sx(i))if(i.convex){o=s-i.x,h=i.y;cu(o,h,i.x,i.y,270,360,!1,a,e)}else{cu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else lu(s,0,e);if(i=n.br,sx(i))if(i.convex){o=s-i.x,h=r-i.y;cu(o,h,i.x,i.y,0,90,!1,a,e)}else{cu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else lu(s,r,e);if(i=n.bl,sx(i))if(i.convex){o=i.x,h=r-i.y;cu(o,h,i.x,i.y,90,180,!1,a,e)}else{cu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else lu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=ax(e),this}setShapeType(t){return"string"==typeof t&&(t=hx[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const hx={rectangle:0,circle:1};var lx=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},ux=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const bx=Phaser.Utils.Objects.GetValue,xx=Phaser.Utils.Objects.IsPlainObject;class kx extends(hc(Jl)){constructor(t,e,i,s,r,n,a,o){xx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):xx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):xx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Iu).setName("trackFill")).addShape((new Iu).setName("bar")).addShape((new Iu).setName("trackStroke")),this.setTrackColor(bx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(bx(o,"trackStrokeThickness",2),bx(o,"trackStrokeColor",void 0)),this.setSkewX(bx(o,"skewX",0)),this.setRTL(bx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Cx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&yx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),yx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&yx(o,0,0,e,i,t)}};Object.assign(kx.prototype,Cx);class Sx extends kx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=wx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const wx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Sx.prototype,fx);let Tx=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const Px=Phaser.GameObjects.NineSlice,Ox=Phaser.Utils.Objects.GetValue;class _x extends Px{constructor(t,e){void 0===e&&(e={}),super(t,Ox(e,"x",0),Ox(e,"y",0),Ox(e,"key",null),Ox(e,"frame",null),Ox(e,"width",0),Ox(e,"height",0),Ox(e,"leftWidth",0),Ox(e,"rightWidth",0),Ox(e,"topHeight",0),Ox(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=Ox(e,"effects",!0);i&&Mr(this,i),this.style=new Tx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_x.prototype,fx);let Ex=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Mx=Phaser.GameObjects.Image,Dx=Phaser.Utils.Objects.GetValue;class Lx extends Mx{constructor(t,e){void 0===e&&(e={}),super(t,Dx(e,"x",0),Dx(e,"y",0),Dx(e,"key",""),Dx(e,"frame",void 0)),this.type="rexStatesImage";var i=Dx(e,"effects",!0);i&&Mr(this,i),this.style=new Ex(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Lx.prototype,fx);var Ax=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Rx=Phaser.Utils.Objects.IsPlainObject,Bx=Phaser.Utils.Objects.GetValue;var Fx=function(t){return"string"==typeof t&&(t=Ix[t]),t};const Ix={scale:0,repeat:1};var jx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},zx={_beginDraw:gd,_drawImage:gd,_drawTileSprite:gd,_endDraw:gd,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ax),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var T=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==T&&"number"!==T||r.add(m,0,x+n.cutX,k+n.cutY,v,f)}x+=v}k+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(k,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Rx(t)?(this.stretchMode.edge=Fx(Bx(t,"edge",0)),this.stretchMode.internal=Fx(Bx(t,"internal",0))):(t=Fx(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return jx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Nx=Phaser.Utils.Objects.IsPlainObject,Gx=Phaser.Utils.Objects.GetValue;const Wx=Phaser.GameObjects;var Vx=void 0,Yx=function(t,e){if(Vx||(Vx={},jn(t).events.once("destroy",(function(){for(var t in Vx)Vx[t].destroy();Vx=void 0}))),!Vx.hasOwnProperty(e)){var i=jn(t).scene.systemScene;(t=new Wx[e](i)).setOrigin(0),Vx[e]=t}return Vx[e]};const Xx=Phaser.GameObjects.RenderTexture;class Hx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Nx(i)?(i=Gx(u=i,"x",0),s=Gx(u,"y",0),r=Gx(u,"width",1),n=Gx(u,"height",1),a=Gx(u,"key",void 0),o=Gx(u,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Nx(r)?(r=Gx(u=r,"width",1),n=Gx(u,"height",1),a=Gx(u,"key",void 0),o=Gx(u,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Nx(a)?(a=Gx(u=a,"key",void 0),o=Gx(u,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Nx(o)?(o=Gx(u=o,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Gx(u,"baseFrame",void 0)):Nx(h)&&(h=Gx(u=h,"columns",void 0),l=Gx(u,"rows",void 0)),void 0===o&&(o=Gx(u,"frame",void 0)),void 0===h){var c=Gx(u,"leftWidth",void 0),d=Gx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Gx(u,"topHeight",void 0),g=Gx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Gx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Gx(u,"stretchMode",0)),this.setPreserveRatio(Gx(u,"preserveRatio",!0));var f=Gx(u,"maxFixedPartScale",1),v=Gx(u,"maxFixedPartScaleX",f),m=Gx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,zx),i}(Xx,"rexNinePatch")){}var $x={_drawImage:function(t,e,i,s,r,n){var a=Yx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Yx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Hx.prototype,$x);let Ux=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Kx=Phaser.Utils.Objects.GetValue;class qx extends Hx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Kx(e,"effects",!0);i&&Mr(this,i),this.style=new Ux(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(qx.prototype,fx);const Jx=["alpha","tint","flipX","flipY"];var Zx=function(t,e){if(!e)return t;for(var i=0,s=Jx.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const uk=Phaser.Display.Canvas.CanvasPool;var ck=function(t){var e=uk.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return uk.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,uk.remove(e),a;var u,c,d=i.getImageData(0,0,o,l).data,p=d.length,g=4*o,f=0,v=!1;for(u=0;uh;u--){for(c=0;c0&&this.wrapMode!==Dm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Bm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=pk(t,l,u);else{var d=dk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=pk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=pk(t,"fill",null);null!==g&&(this.color=vy(g));var f=pk(t,"metrics",!1);return f?this.metrics={ascent:pk(f,"ascent",0),descent:pk(f,"descent",0),fontSize:pk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=ck(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=ck(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=pk(t,"fontFamily","Courier"),this.fontSize=pk(t,"fontSize","16px"),this.fontStyle=pk(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=vy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=vy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=vy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Bm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=pk(e,"fontFamily",this.fontFamily),this.fontSize=pk(e,"fontSize",this.fontSize),this.fontStyle=pk(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var fk={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),_y(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var k=l;k0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const vk=Phaser.Utils.Objects.GetValue,mk=_m,yk=Em;class bk{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vk(t,"text",""),this.x=vk(t,"x",0),this.y=vk(t,"y",0),this.width=vk(t,"width",0);var e=vk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vk(t,"newLineMode",0),this.startIndex=vk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===yk&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==mk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===yk&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const xk=Phaser.Utils.Objects.GetFastValue,kk=_m,Ck=Mm;class Sk{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=xk(t,"tagToText",gd),this.tagToTextScope=xk(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var wk={};const Tk=Phaser.Geom.Rectangle;var Pk=new Ra;class Ok{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Gk(f)){""!==b?a.push(n.getLine(b,x,Rk)):0===k&&r>0&&a.push(n.getLine("",0,Rk)),a.push(...zk(f,e,Ik,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,Rk)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Nk=function(t,e){var i;switch(e){case Fk:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Vk&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Sk({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return JC(this.sizerChildren,null),sm.call(this,t),this}},QC={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)JC(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},sS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=dp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,JC(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)JC(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},nS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const aS=Phaser.Utils.Objects.IsPlainObject,oS=Phaser.Utils.Objects.GetValue;class hS extends Vv{constructor(t,e,i,s,r,n,a,o,h,l){aS(e)?(e=oS(l=e,"x",0),i=oS(l,"y",0),s=oS(l,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(s)?(s=oS(l=s,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(n)?(n=oS(l=n,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(o)&&(o=oS(l=o,"columnProportions",0),h=oS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(oS(l,"createCellContainerCallback")),this.setIndentLeft(oS(l,"space.indentLeftOdd",0),oS(l,"space.indentLeftEven",0)),this.setIndentTop(oS(l,"space.indentTopOdd",0),oS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,oS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=rS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=nS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(hS.prototype,sS);const lS=Phaser.Utils.Objects.GetValue;const uS=Phaser.Math.Percent;var cS=function(t,e,i){var s;return t.y===e.y?s=uS(i.x,t.x,e.x):t.x===e.x&&(s=uS(i.y,t.y,e.y)),s},dS=function(t,e,i){var s,r;this.enable&&(pS.x=e,pS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=cS(s,r,pS))},pS={},gS=function(t,e,i){if(this.enable&&t.isDown){var s,r;fS.x=t.worldX,fS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=cS(s,r,fS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},fS={},vS=function(t,e){void 0===e&&(e=mS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return jd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},mS={};const yS=Phaser.Display.Align.LEFT_CENTER,bS=Phaser.Display.Align.TOP_CENTER;var xS={};const kS=Phaser.Display.Align.RIGHT_CENTER,CS=Phaser.Display.Align.BOTTOM_CENTER;var SS={};const wS=Phaser.Math.Linear;var TS={};const PS=Phaser.Display.Align.LEFT_CENTER,OS=Phaser.Display.Align.TOP_CENTER,_S=Phaser.Display.Align.RIGHT_CENTER,ES=Phaser.Display.Align.BOTTOM_CENTER;const MS=Phaser.Utils.Objects.GetValue,DS=Phaser.Utils.Objects.IsPlainObject,LS=Phaser.Math.Clamp,AS=Phaser.Math.Snap.To;class RS extends(hc(vm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=MS(e,"reverseAxis",!1);var i=MS(e,"background",void 0),s=MS(e,"track",void 0),r=MS(e,"indicator",void 0),n=MS(e,"thumb",void 0);if(i&&(DS(i)&&(i=Qx(t,i)),this.addBackground(i)),s&&(DS(s)&&(s=Qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(DS(r)&&(r=Qx(t,r)),this.pin(r)),n){DS(n)&&(n=Qx(t,n)),this.pin(n);var a=MS(e,"thumbOffsetX",0),o=MS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=MS(e,"input",0);switch("string"==typeof h&&(h=BS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",dS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",gS,this).on("pointermove",gS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(MS(e,"enable",void 0)),this.setGap(MS(e,"gap",void 0)),this.setValue(MS(e,"value",0),MS(e,"min",void 0),MS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=AS(t,this.gap));var e=this._value;this._value=LS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const BS={pan:0,drag:0,click:1,none:-1};var FS={getStartPoint:function(t){if(void 0===t&&(t=xS),this.childrenMap.thumb){var e=0===this.orientation?yS:bS;vS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=SS),this.childrenMap.thumb){var e=0===this.orientation?kS:CS;vS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=TS),s.x=wS(e.x,i.x,t),s.y=wS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=zr(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=Nr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;bp(e,i,s),r=n?0===this.orientation?_S:ES:0===this.orientation?PS:OS,Id(e,this,r),this.resetChildPositionState(e)}};Object.assign(RS.prototype,FS);const IS=Phaser.Utils.Objects.GetValue;class jS extends vm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=IS(e,"background",void 0),r=IS(e,"buttons",void 0),n=IS(r,"top",IS(r,"left",void 0)),a=IS(r,"bottom",IS(r,"right",void 0)),o=IS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new xf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===IS(o,"width",void 0)?1:0;else h=void 0===IS(o,"height",void 0)?1:0;i=new RS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new xf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=IS(e,"valuechangeCallback",null);if(null!==u){var c=IS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(IS(e,"enable",void 0)),this.setValue(IS(e,"value",0)),this.setScrollStep(IS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class zS extends kg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const NS=Phaser.Utils.Objects.GetValue,GS=Phaser.Math.Distance.Between;class WS extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=NS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(NS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(NS(t,"enable",!0)),this.holdThreshold=NS(t,"holdThreshold",50),this.pointerOutReleaseEnable=NS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return Qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:GS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!qg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!qg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const VS=Phaser.Utils.Objects.GetValue;class YS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(VS(t,"value",0)),this.setSpeed(VS(t,"speed",0)),this.setAcceleration(VS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class XS{constructor(){this.value,this.dir,this.movement=new YS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const KS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},qS=Phaser.Utils.Objects.GetValue;class JS extends Nn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=qS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(qS(e,"speed",.1)),this.setEnable(qS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(qS(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||qg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const ZS=Phaser.Utils.Objects.GetValue;var QS=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?ZS(s,l,void 0):ZS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=po(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new jS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=ZS(r,"position",0);"string"==typeof p&&(p=tw[p]);var g,f,v=ZS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=ZS(s,"space.slider",void 0))&&(o?v=0:g=ZS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:ZS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:ZS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:ZS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:ZS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=ZS(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=ZS(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=ZS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ZS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ZS(s,"scrollDetectionMode");"string"==typeof b&&(b=ew[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ZS(s,x,!0):ZS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new US(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=ZS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new JS(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,k),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",k)),n)&&(o?(C=a?"t":"s",w=`scroll${i}`):(C="t",w="scroll"),n.on("valuechange",(function(e){t[C]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));k&&(T=o?`addChildO${i}`:"addChildOY",k.on("scroll",(function(e){t[T](-e,!0)})))};const tw={right:0,left:1,bottom:0,top:1},ew={gameObject:0,rectBounds:1},iw=Phaser.Utils.Objects.GetValue;var sw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=iw(e,"width"),a=iw(e,"height");n||(iw(e,"child.expandWidth",!0)||(s[1]=0));a||(iw(e,"child.expandHeight",!0)||(r[1]=0));var o=new hS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lS(i,"child"),r=lS(s,"gameObject",void 0);if(r){var n=lS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=lS(n,"top",0),a.bottom=lS(n,"bottom",0),o.left=lS(n,"left",0),o.right=lS(n,"right",0);break;case 1:a.top=lS(n,"left",0),a.bottom=lS(n,"right",0),o.top=lS(n,"top",0),o.bottom=lS(n,"bottom",0);break;default:a.top=lS(n,"top",0),a.bottom=lS(n,"bottom",0),a.left=lS(n,"left",0),a.right=lS(n,"right",0)}e.add(r,{column:1,row:1,align:lS(s,"align","center"),padding:o,expand:{width:lS(s,"expandWidth",!0),height:lS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:QS(t,o,"y",e);break;case 1:QS(t,o,"x",e);break;default:QS(t,o,"y",e),QS(t,o,"x",e)}return o},rw=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},nw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},aw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Sw=function(t){return t.add.text(0,0,"")};Object.assign(Cw.prototype,yw);var ww={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Tw={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Pw=Phaser.Utils.Objects.GetValue;class Ow extends uw{constructor(t,e){void 0===e&&(e={});var i=Pw(e,"text",void 0),s=Pw(e,"textWidth",void 0),r=Pw(e,"textHeight",void 0),n=Pw(e,"textCrop",!!i.setCrop),a=Pw(e,"textMask",!n),o=Pw(e,"content",""),h=new Cw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Pw(e,"clampChildOY",!1),alwaysScrollable:Pw(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=Pw(e,"space",void 0);l&&(l.child=Pw(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Ow.prototype,ww,Tw);const _w=Phaser.Utils.Objects.GetValue;var Ew=function(t,e,i){e=e?y(e):{};var s=_w(i,"background",Qx),r=_w(i,"text",Mw),n=_w(i,"track",Qx),a=_w(i,"thumb",Qx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Ow(t,e);return t.add.existing(h),h},Mw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new FC(t,e);break;case"bbcodetext":case"bbcode":s=new LC(t,0,0,"",e);break;case"label":s=new zC(t,e);break;case"textarea":s=Ew(t,e);break;default:s=new ik(t,e)}return Zx(s,e),t.add.existing(s),s},Dw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new qx(t,e):new _x(t,e);break;case"roundRectangle":s=new vx(t,e);break;default:s=new Lx(t,e)}return Zx(s,e),t.add.existing(s),s};const Lw=Phaser.Utils.Objects.GetValue;var Aw=function(t,e,i){e=e?y(e):{};var s=Lw(i,"background",Qx),r=Lw(i,"text",Mw),n=Lw(i,"icon",Dw),a=Lw(i,"action",Dw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Rw=Phaser.Utils.Objects.GetValue;var Bw=function(t,e,i){var s,r,n=Rw(i,"innerBackground",Qx),a=Rw(i,"separator",Qx),o=Rw(i,"title",Mw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Aw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Fw extends Jb{constructor(t,e,i){super(t,e=Bw(t,e,i))}}var Iw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ul(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const jw=Phaser.Utils.Objects.GetValue;class zw extends Jl{constructor(t,e){super(t,jw(e,"x",0),jw(e,"y",0),jw(e,"width",64),jw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),jw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(jw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(jw(t,"ease",i)),i=e?0:this.delay,this.setDelay(jw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(jw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(jw(t,"color",i)),i=e?0:this.value,this.setValue(jw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(zw.prototype,Iw);const Nw=Phaser.Math.DegToRad,Gw=Phaser.Math.Linear,Ww=Phaser.Math.Easing.Expo.In,Vw={right:0,down:1,left:2,up:3};var Yw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Hw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Hw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Hw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Hw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Hw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Hw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Xw={},Hw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Xw.x=a*u+o*c+r,Xw.y=h*u+l*c+n,Xw},$w={setDirection(t){return"string"==typeof t&&(t=Vw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Iu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Nw(315);i=Math.cos(a),s=Math.sin(a);var o=Nw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Nw(135);i=Math.cos(a),s=Math.sin(a);o=Nw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Nw(225);i=Math.cos(a),s=Math.sin(a);o=Nw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Nw(45);i=Math.cos(a),s=Math.sin(a);o=Nw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=wl(s),eP(r)?(d.expandWidth=iP(r,"width",!1),d.expandHeight=iP(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?zr(t):n),d.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},aP={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Qd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return sm.call(this,t),this}},oP={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,sf.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(QT.width=e.aspectRatio,QT.height=1,tP.width=l,tP.height=u,l=(c=cl(QT,tP,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Yv(t,this)):bp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zr(t)),void 0===u&&(u=Nr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,rf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(oP,nP,aP);const hP=Phaser.Utils.Objects.IsPlainObject,lP=Phaser.Utils.Objects.GetValue;class uP extends Vv{constructor(t,e,i,s,r,n){hP(e)?(e=lP(n=e,"x",0),i=lP(n,"y",0),s=lP(n,"width",void 0),r=lP(n,"height",void 0)):hP(s)&&(s=lP(n=s,"width",void 0),r=lP(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(uP.prototype,oP);const cP=vm.prototype.add,dP=vm.prototype.addSpace;var pP=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&dP.call(this),cP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&dP.call(this),this.hasTailSpace=s}else cP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;cP.call(this,t,{index:r,proportion:i,expand:!0})}else cP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},gP={addButton(t){if(Jg(t))for(var e=t,i=0,s=e.length;i=0;i--)mP.call(this,e[i],t);return this}},bP=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},xP=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,bP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},kP={add(t){return this.buttons.push(t),t._click||(t._click=new hf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),xP.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=BP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=BP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const IP=Phaser.Utils.Objects.IsPlainObject,jP=Phaser.Utils.Objects.GetValue,zP=Phaser.Display.Align.CENTER;var NP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Hd.call(this,t),IP(e))&&(e=jP(h=e,"padding",0),i=jP(h,"key",void 0),s=jP(h,"index",void 0),r=jP(h,"offsetX",0),n=jP(h,"offsetY",0),a=jP(h,"offsetOriginX",0),o=jP(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=zP,h.padding=wl(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},GP={add(t,e,i){if(Jg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,sm.call(this,t),this}},YP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&JP.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)iO.call(this,e[i],t);return this}};const rO=Phaser.Utils.Objects.GetValue;class nO extends KP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new _P({parent:this,eventEmitter:rO(e,"eventEmitter",this),groupName:rO(e,"groupName",void 0),clickConfig:rO(e,"click",void 0)}).setButtonsType(e);var s=rO(e,"background",void 0),r=rO(e,"buttons",void 0);this.buttonsAlign=rO(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(nO.prototype,QP,sO,OP,MP);const aO=hS.prototype.add;var oO={addButton(t,e,i){return aO.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uO.call(this,e[i],t);return this}};const dO=Phaser.Utils.Objects.GetValue;class pO extends hS{constructor(t,e){void 0===e&&(e={});var i=dO(e,"row",0),s=dO(e,"column",e.col||0),r=dO(e,"createCellContainerCallback"),n=dO(e,"buttons",void 0),a=dO(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(l_(this),u_(this)),this}setNumberInput(){return this.onUpdateCallback=h_,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const p_=Phaser.Utils.Objects.GetValue,g_=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var f_=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},v_=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ux(t.style,e);Tl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},m_=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ux(t,e);Tl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function y_(){}function b_(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}y_.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(b_(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const x_=new y_;const k_=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,C_=/\S/,S_=new y_;S_.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!C_.test(t)&&!C_.test(e)},S_.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(O_(t,null,null,i),i," ")},P_.equals=function(t,e){return y_.prototype.equals.call(P_,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const __=new y_;__.tokenize=function(t){return t.slice()},__.join=__.removeEmpty=function(t){return t};const E_=Phaser.Utils.Array.Remove;var M_=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),E_(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,x_.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},B_={cursorMoveLeft(){if(!this.isOpened)return this;var t=L_(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=L_(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=A_(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=L_(R_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=A_(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=L_(R_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const F_=Phaser.Utils.Objects.IsPlainObject;class I_ extends zb{constructor(t,e,i,s,r,n){F_(e)?n=e:F_(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Uo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=lx(n.background,"focus"),h=lx(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=p_(e,"edit");return void 0===i&&(i={}),KO(e,i,g_),new d_(t,i)}(this,n),f_.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),m_.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),v_.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var u=n.onCursorOut;u&&this.on("cursorout",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((d=this.createCharChild("|")).text="",d),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new jT(t,e);return Zx(i,e),t.add.existing(i),i},y=!0);var b,x,k=new Fw(r,t,i);k.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(k),wr(k,e),k.vpx=l,k.vpy=u,k.frameDelimiter=c,y&&(b=k.getElement("action"),k.setChildVisible(b,!1)),Pc(k),k.emitClick=function(){k.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:k.setInteractive()),x&&k.bindEvent(x,"pointerdown",(function(){k.emitClick()})),k.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=NT[t.keyCode];-1!==e.indexOf(i)&&k.emitClick()}}));var C=function(){k.isTyping?k.once("click",C).stop(!0):k.isLastPage?k.complete2Flag||(k.complete2Flag=!0,k.emit("complete2")):k.once("click",C).typeNextPage()},S=function(){k.isPageEnd&&(k.off("click",S),y&&(b.stop(),k.setChildVisible(b,!1)),v.emit("resume.input"))};k._typeNextPage=S,k.on("pageend",(function(){y&&(b.start(),k.setChildVisible(b,!0)),k.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,k.emitClick)),v.emit("pause.input")})).on("start",(function(){k.off("click",C).once("click",C)}));var w=v.getData("$fastTyping"),T=v.getData("$autoNextPage");k.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(k.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=k.normalTypingSpeed),k.setTypingSpeed(e)}else t&&k.emitClick();else e===T||t||k.isTyping||e&&k.emitClick();w=t,T=e}));var P=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=NT[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return k.bindEvent(r.input.keyboard,"keydown",(function(t){P(t,!0)})),k.bindEvent(r.input.keyboard,"keyup",(function(t){P(t,!1)})),k}}(WT(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{typing:Rc,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=Ec(e,`creators.${Ko}`,void 0);if(!1!==s){if(Mc(s)&&(s=void 0),void 0===s){Ec(e,`styles.${Ko}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new xc(t,i);t.add.existing(s),wr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Pc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Do,commands:{cross:_c,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=NO(e,`creators.${Qo}`,void 0);if(!1!==s){var r;if(GO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new jO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Pc(u),u}}(NO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{choice:zO,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=Y_(e,`creators.${th}`,void 0);if(!1!==s){var r;if(X_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new W_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Pc(u),u}}(Y_(e,`styles.${th}`,{}),{viewport:i},r);t.addGameObjectManager({name:th,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{input:V_,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=JT(e,`creators.${Zo}`,void 0);if(!1!==s){var r;if(ZT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new YT(s,t,i);return g&&k.setTitle(g),f&&k.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,k.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(k),wr(k,e),k.vpx=h,k.vpy=l,Pc(k),k}}(JT(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{setText:HT,popUp:$T,shake:Oc}})}}];var $_=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],U_={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},K_=function(t,e){var i=po(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class q_ extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=un(t,t.cameras.main));for(var a=new Mo(t,{layers:r?Vo:Yo,layerDepth:i,rootLayer:s}),o=0,h=H_.length;o0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=aE(r,"x",null);null!==n?(t=n,i=n):(t=aE(r,"left",0),i=aE(r,"right",t));var a=aE(r,"y",null);null!==a?(e=a,s=a):(e=aE(r,"top",0),s=aE(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return lE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=hE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const cE={right:0,down:1,left:2,up:3};var dE=function(t){return"string"==typeof t&&(t=cE[t]),t%=4};Object.assign(uE.prototype,rE,nE);class pE extends Q_{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new uE(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}var gE=function(t,e,i){return Qx(t,K_(e,i))};class fE extends Eg{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var vE={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;(this.show(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();return e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){(this.setChildScale(i,1,1).hide(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},mE=function(t,e){Ip.popUp.call(t,e,this.expandDirection)},yE=function(t,e){Ip.scaleDown.call(t,e,this.expandDirection)},bE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=mE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=yE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const xE=Phaser.Utils.Objects.GetValue;let kE=class extends vm{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=xE(e,"space"),a=1===this.orientation?"left":"top",o=xE(e,"align.title",a),h=xE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:xE(n,"titleLeft",0),right:xE(n,"titleRight",0),top:xE(n,"titleTop",0),bottom:xE(n,"titleBottom",0)}});var l=xE(e,"toggleByTarget",void 0),u=xE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&uf.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new fE(r),!xE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=xE(e,"align.child","left");var d=(h=xE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:xE(n,"childLeft",0),right:xE(n,"childRight",0),top:xE(n,"childTop",0),bottom:xE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(xE(p,"duration",200)),this.setExpandCallback(xE(p,"expandCallback",void 0)),this.setCollapseCallback(xE(p,"collapseCallback",void 0)),this.reLayoutTarget=xE(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var f=e.onExpandComplete;f&&this.on("expand.complete",f);var v=e.onCollapseStart;v&&this.on("collapse.start",v);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=xE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(kE.prototype,vE,bE);var CE={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},SE={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class wE extends kE{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(wE.prototype,CE,SE);const TE=Phaser.Utils.Objects.GetValue;const PE=Phaser.Utils.Objects.GetValue;const OE=uP.prototype.add;var _E=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),OE.call(this,t,e,i,s,r,n,a,o,h),this},EE={add:_E,addPage:_E};const ME=al.prototype.setChildVisible;var DE={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(ME.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(ME.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(DE,EE);const LE=Phaser.Utils.Objects.GetValue;class AE extends uP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(LE(e,"swapMode",0)),this.setFadeInDuration(LE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=RE[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(AE.prototype,DE);const RE={invisible:0,destroy:1};const BE=Phaser.Utils.Objects.IsPlainObject,FE=Phaser.Utils.Objects.GetValue,IE=Phaser.Utils.String.UUID;var jE={swapPage:function(t,e){var i,s;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s));return this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},zE={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},NE={top:1,left:3,right:5,bottom:7},GE={top:"bottom",left:"right",right:"left",bottom:"top"},WE={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},VE={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const aM=Phaser.Utils.Objects.GetValue;class oM extends vm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=aM(e,"background",void 0),s=aM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:aM(e,"space.title",0)}});var r=aM(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(oM.prototype,rM,nM);const hM=Phaser.Utils.Objects.GetValue;const lM=Phaser.Utils.Objects.GetValue;var uM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const cM=Phaser.Geom.Intersects.RectangleToRectangle,dM=Phaser.Geom.Rectangle.Overlaps;var pM=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},gM=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},fM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},vM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},mM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const yM=Phaser.Utils.Objects.GetValue,bM={update:0,everyTick:1};var xM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(yM(t,"updateMode",0)),this.enableChildrenMask(yM(t,"padding",0)),this.setMaskLayer(yM(t,"layer",void 0)),this.onMaskGameObjectVisible=yM(t,"onVisible"),this.onMaskGameObjectInvisible=yM(t,"onInvisible"),this.maskGameObjectCallbackScope=yM(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=bM[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=km.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,u=t.getBounds(),c=uM(e),d=0,p=i.length;dthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(TM.prototype,kM);const PM=["top","bottom","centerY","center"],OM=["left","right","centerX","center"];var _M=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=PM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=OM.length;a=0?0:Math.abs(c)<=Math.abs(d)?c:d}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const EM=Phaser.Utils.Objects.GetValue;class MM extends uw{constructor(t,e){void 0===e&&(e={});var i=WC(e),s=EM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=EM(e,"clampChildOY",!1),s.clampChildOX=EM(e,"clampChildOX",!1);var r,n,a=new TM(t,s);switch(t.add.existing(a),i){case 0:r=EM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=EM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:EM(e,"align.panel","center")};var o=EM(e,"space",void 0);o&&(o.child=EM(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Nv(this.childrenMap.child,t),this}}var DM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:_M.call(this,t,"y",e);break;case 1:_M.call(this,t,"x",e);break;default:_M.call(this,t,"y",e),_M.call(this,t,"x",e)}return this}};Object.assign(MM.prototype,DM);var LM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},AM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class RM extends MM{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(RM.prototype,LM,AM);const BM=Phaser.Utils.Objects.GetValue;const FM=Phaser.Utils.Objects.GetValue;const IM=Phaser.Utils.Objects.GetValue;var jM={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=IM(t,"onGetValue"),this.onSetValue=IM(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},zM={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},NM={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const GM=Phaser.Utils.Objects.GetValue;class WM extends vm{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=GM(e,"proportion.title",0),o=GM(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0);a=GM(e,"proportion.inputField",h);this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(WM.prototype,jM,zM,NM);var VM=function(t,e,i){var s=new Q_(t,i);return t.add.existing(s),s},YM=function(t){void 0===t&&(t=vm);return class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},XM=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0}));i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange);return n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=JM(this.styles,"inputRow")||{},r=qM(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Qx(t,K_(e,i))}(this.scene,t,ZM(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),QM(this,y(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=z_(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},rD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},nD={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const aD=Phaser.Utils.Objects.GetValue;class oD extends uw{constructor(t,e){void 0===e&&(e={});var i,s=aD(e,"text");fn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new I_(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=aD(e,"space",void 0);h&&(h.child=aD(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=aD(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(oD.prototype,rD,nD);var hD={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new oD(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},lD={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=z_(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const uD=Phaser.Utils.Objects.GetValue,cD=Phaser.Math.Linear,dD=Phaser.Math.Snap.Floor;var pD={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=uD(s,r),a=function(t,e){var i=new RS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=uD(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var u=e.inputNumber||e.inputText,c=z_(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=uD(e,"proportion.range.inputText",o);t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=cD(t.minValue,t.maxValue,a.value);t.step&&(e=dD(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},gD=function(t,e){var i=new LP(t,e);return t.add.existing(i),i};const fD=Phaser.Utils.Objects.GetValue;var vD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=fD(e,"incDec")||{},r={text:null,action:null},n=gD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=z_(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=CO(i,l),c=Object.assign(y(r),s.decButton||{}),d=CO(i,c);n.addButton(u),n.addButton(d);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new lL(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const cL=Phaser.Utils.Objects.GetValue;var dL=function(t,e){var i=cL(e,"expandDirection",void 0);"string"==typeof i&&(i=pL[i]);var s,r,n,a,o,h,l,u=(n="alignTargetX",tt(s=e,r="alignTarget")?Q(s,r):n&&tt(s,n)?Q(s,n):a&&tt(s,a)?Q(s,a):o),c=cL(e,"alignTargetY",u),d=cL(e,"alignOffsetX",0),p=cL(e,"alignOffsetY",0),g=cL(e,"alignSide","").includes("right"),f=cL(e,"bounds"),v=0===i,m=!v&&!(1===i),y=g?1:0,b=v||m?0:1;t.setOrigin(y,b),h=g?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+p);var x=f;x||(x=un(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const pL={down:0,up:1},gL=Phaser.Utils.Objects.GetValue;class fL extends Eg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Dp(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ep(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),dL(t,e),t.isRexSizer&&t.layout();var i=gL(e,"touchOutsideClose",!1),s=gL(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ng(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var vL={openColorPicker:function(){if(!this.colorPicker){var t=uL.call(this).layout(),e=new fL(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(vL,MD);const mL=Phaser.Utils.Objects.GetValue;class yL extends ED{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(mL(i,"width",160),mL(i,"height",170));var n=mL(i,"background");r=n?function(t){return Qx(t,n)}:mL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(mL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(mL(i,"expandDirection")),this.setColorPickerEaseInDuration(mL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(mL(i,"easeOut",200)),this.setColorPickerTransitInCallback(mL(i,"transitIn")),this.setColorPickerTransitOutCallback(mL(i,"transitOut")),this.setColorPickerBounds(mL(i,"bounds"));var a=mL(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&(!1!==o&&null!==o)){this.setColorComponentsHeight(mL(o,"height",30)),this.setColorComponentsFormatLabelConfig(mL(o,"formatLabel"));var h=mL(o,"inputText");h||(h=mL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=mL(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var u=this.childrenMap.swatch;u&&s&&this.onClick(u,this.openColorPicker,this)}}Object.assign(yL.prototype,vL);var bL={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new yL(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},xL={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},kL={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},CL={buildShapes(){this.addShape((new Nu).setName("box")).addShape((new Iu).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,c=a/2,d=s*this.boxSize-a;h.setTopLeftPosition(r+c+u,n+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,f=2*p,v=3*p;l.startAt(g,f).lineTo(f,v).lineTo(v,g).offset(r+u,n+u).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},SL={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ul(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},wL={};Object.assign(wL,xL,kL,CL,SL);const TL=23730,PL=Phaser.Utils.Objects.GetValue,OL=Phaser.Utils.Objects.IsPlainObject;class _L extends Jl{constructor(t,e,i,s,r,n,a){OL(e)?(e=PL(a=e,"x",0),i=PL(a,"y",0),s=PL(a,"width",2),r=PL(a,"height",2),n=PL(a,"color",TL)):OL(n)&&(n=PL(a=n,"color",TL)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=TL),this.setBoxShape(PL(a,"circleBox",!1)),this.setBoxFillStyle(n,PL(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(PL(a,"uncheckedColor",null),PL(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(PL(a,"boxLineWidth",4),PL(a,"boxStrokeColor",n),PL(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,PL(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),PL(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(PL(a,"checkerColor",16777215),PL(a,"checkerAlpha",1)),this.setBoxSize(PL(a,"boxSize",1)),this.setCheckerSize(PL(a,"checkerSize",1)),this.setCheckerAnimationDuration(PL(a,"animationDuration",150)),this.buildShapes();var o=PL(a,"checked");void 0===o&&(o=PL(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(_L.prototype,wL);const EL=Phaser.Utils.Objects.GetValue,ML=Phaser.Utils.Objects.IsPlainObject;class DL extends _L{constructor(t,e,i,s,r,n,a){ML(e)?(e=EL(a=e,"x",0),i=EL(a,"y",0),s=EL(a,"width",2),r=EL(a,"height",2),n=EL(a,"color",TL)):ML(n)&&(n=EL(a=n,"color",TL)),super(t,e,i,s,r,n,a),this._click=new hf(this,EL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(EL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var LL={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new DL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},AL={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},RL={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},BL={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},FL=function(t,e,i){return(e-t)*i+t};const IL=Phaser.Math.Linear;var jL={buildShapes(){this.addShape((new Nu).setName("track")).addShape((new Nu).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&FL(yr(l),yr(u),c))<<16|(255&FL(br(l),br(u),c))<<8|255&FL(xr(l),xr(u),c)),p=IL(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(d,p);var g=this.getShape("thumb");if(this.isSizeChanged){var f=t*this.thumbWidth,v=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(f,v).setRadius(m)}var y=IL(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},zL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ul(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},NL={};Object.assign(NL,AL,RL,BL,jL,zL);const GL=Phaser.Utils.Objects.GetValue,WL=Phaser.Utils.Objects.IsPlainObject,VL=23730;class YL extends Jl{constructor(t,e,i,s,r,n,a){WL(e)?(e=GL(a=e,"x",0),i=GL(a,"y",0),s=GL(a,"width",2),r=GL(a,"height",2),n=GL(a,"color",VL)):WL(n)&&(n=GL(a=n,"color",VL)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=VL),this.setTrackFillStyle(n,GL(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(GL(a,"falseValueTrackColor",function(t){var e=.3*yr(t)+.59*br(t)+.11*xr(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),GL(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(GL(a,"thumbColor",16777215),GL(a,"thumbAlpha",1)),this.setTrackSize(GL(a,"trackWidth",.9),GL(a,"trackHeight",.5)),this.setTrackRadius(GL(a,"trackRadius",.5*this.trackHeight));var o=GL(a,"thumbHeight",void 0),h=GL(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(GL(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(GL(a,"thumbLeft",.3),GL(a,"thumbRight",void 0)),this.setRTL(GL(a,"rtl",!1)),this.setToggleAnimationDuration(GL(a,"animationDuration",150)),this.buildShapes(),this.setValue(GL(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(YL.prototype,NL);const XL=Phaser.Utils.Objects.GetValue;class HL extends YL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new hf(this,XL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(XL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var $L={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new HL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},UL={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=KL[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const KL={down:0,up:1},qL=Phaser.Utils.Objects.GetValue;var JL=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){s=ZL(e,d);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=QL(e,this.listCreateSliderTrackCallback),g=QL(e,this.listCreateSliderThumbCallback);u=new MM(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:qL(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=ZL(e,d),u=s;return t&&u.addBackground(t,"background"),this.listDraggable&&u.setDraggable(!0),u!==s&&s.on("button.over",(function(t,e,i,s){u.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){u.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){u.emit("button.click",t,e,i,s)})),u},ZL=function(t,e,i){var s;return i?(e.orientation="x",s=new nO(t,e)):(e.orientation="y",s=new LP(t,e)),t.add.existing(s),s},QL=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},tA={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;void 0===e?t=0:t=(e+1)%this.listPanel.getButtons().length;return this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},eA={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=JL.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new fL(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(eA,UL,tA);const iA=Phaser.Utils.Objects.GetValue;class sA extends jC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(iA(e,"options"));var i=iA(e,"list");this.setWrapEnable(iA(i,"wrap",!1)),this.setCreateButtonCallback(iA(i,"createButtonCallback")),this.setCreateListBackgroundCallback(iA(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(iA(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(iA(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(iA(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(iA(i,"scroller")),this.setListMouseWheelScrollerConfig(iA(i,"mouseWheelScroller")),this.setButtonClickCallback(iA(i,"onButtonClick")),this.setButtonOverCallback(iA(i,"onButtonOver")),this.setButtonOutCallback(iA(i,"onButtonOut")),this.setListExpandDirection(iA(i,"expandDirection")),this.setListEaseInDuration(iA(i,"easeIn",500)),this.setListEaseOutDuration(iA(i,"easeOut",100)),this.setListTransitInCallback(iA(i,"transitIn")),this.settListTransitOutCallback(iA(i,"transitOut")),this.setListMaxHeight(iA(i,"maxHeight",0)),this.setListSize(iA(i,"width"),iA(i,"height",0)),this.setListAlignmentMode(iA(i,"alignParent","text")),this.setListAlignmentSide(iA(i,"alignSide","")),this.setListBounds(iA(i,"bounds")),this.setListSpace(iA(i,"space")),this.setListDraggable(iA(i,"draggable",!1)),this.setValueChangeCallback(iA(e,"setValueCallback"),iA(e,"setValueCallbackScope")),this.setValue(iA(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(sA.prototype,eA);var rA=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?y(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Aw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=CO(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Qx(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Qx(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new sA(t,e);return t.add.existing(i),i},nA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=rA(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=nA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const oA=Phaser.Utils.Objects.GetValue;var hA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?y(e.button):{},r=oA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=gD(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n0?r.addScrollable():r).addRows(s,i,!0),r}(t,e,i,s)}}var dA={csv2md:function(t,e={}){"string"==typeof e&&(e={title:e});for(var i,s,r,{title:n}=e,a=lr.parse(t).data,o=!1,h=!1,l=[],u=0,c=a.length;uh;u--){for(c=0;c0&&this.wrapMode!==Dm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Bm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=pk(t,l,u);else{var d=dk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=pk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=pk(t,"fill",null);null!==g&&(this.color=vy(g));var f=pk(t,"metrics",!1);return f?this.metrics={ascent:pk(f,"ascent",0),descent:pk(f,"descent",0),fontSize:pk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=ck(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=ck(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=pk(t,"fontFamily","Courier"),this.fontSize=pk(t,"fontSize","16px"),this.fontStyle=pk(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=vy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=vy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=vy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Bm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=pk(e,"fontFamily",this.fontFamily),this.fontSize=pk(e,"fontSize",this.fontSize),this.fontStyle=pk(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var fk={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),_y(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var k=l;k0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const vk=Phaser.Utils.Objects.GetValue,mk=_m,yk=Em;class bk{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vk(t,"text",""),this.x=vk(t,"x",0),this.y=vk(t,"y",0),this.width=vk(t,"width",0);var e=vk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vk(t,"newLineMode",0),this.startIndex=vk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===yk&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==mk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===yk&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const xk=Phaser.Utils.Objects.GetFastValue,kk=_m,Ck=Mm;class Sk{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=xk(t,"tagToText",gd),this.tagToTextScope=xk(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var wk={};const Tk=Phaser.Geom.Rectangle;var Pk=new Ra;class Ok{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Gk(f)){""!==b?a.push(n.getLine(b,x,Rk)):0===k&&r>0&&a.push(n.getLine("",0,Rk)),a.push(...zk(f,e,Ik,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,Rk)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Nk=function(t,e){var i;switch(e){case Fk:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Vk&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Sk({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return JC(this.sizerChildren,null),sm.call(this,t),this}},QC={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)JC(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},sS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=dp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,JC(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)JC(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},nS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const aS=Phaser.Utils.Objects.IsPlainObject,oS=Phaser.Utils.Objects.GetValue;class hS extends Vv{constructor(t,e,i,s,r,n,a,o,h,l){aS(e)?(e=oS(l=e,"x",0),i=oS(l,"y",0),s=oS(l,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(s)?(s=oS(l=s,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(n)?(n=oS(l=n,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(o)&&(o=oS(l=o,"columnProportions",0),h=oS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(oS(l,"createCellContainerCallback")),this.setIndentLeft(oS(l,"space.indentLeftOdd",0),oS(l,"space.indentLeftEven",0)),this.setIndentTop(oS(l,"space.indentTopOdd",0),oS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,oS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=rS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=nS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(hS.prototype,sS);const lS=Phaser.Utils.Objects.GetValue;const uS=Phaser.Math.Percent;var cS=function(t,e,i){var s;return t.y===e.y?s=uS(i.x,t.x,e.x):t.x===e.x&&(s=uS(i.y,t.y,e.y)),s},dS=function(t,e,i){var s,r;this.enable&&(pS.x=e,pS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=cS(s,r,pS))},pS={},gS=function(t,e,i){if(this.enable&&t.isDown){var s,r;fS.x=t.worldX,fS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=cS(s,r,fS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},fS={},vS=function(t,e){void 0===e&&(e=mS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return jd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},mS={};const yS=Phaser.Display.Align.LEFT_CENTER,bS=Phaser.Display.Align.TOP_CENTER;var xS={};const kS=Phaser.Display.Align.RIGHT_CENTER,CS=Phaser.Display.Align.BOTTOM_CENTER;var SS={};const wS=Phaser.Math.Linear;var TS={};const PS=Phaser.Display.Align.LEFT_CENTER,OS=Phaser.Display.Align.TOP_CENTER,_S=Phaser.Display.Align.RIGHT_CENTER,ES=Phaser.Display.Align.BOTTOM_CENTER;const MS=Phaser.Utils.Objects.GetValue,DS=Phaser.Utils.Objects.IsPlainObject,LS=Phaser.Math.Clamp,AS=Phaser.Math.Snap.To;class RS extends(hc(vm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=MS(e,"reverseAxis",!1);var i=MS(e,"background",void 0),s=MS(e,"track",void 0),r=MS(e,"indicator",void 0),n=MS(e,"thumb",void 0);if(i&&(DS(i)&&(i=Qx(t,i)),this.addBackground(i)),s&&(DS(s)&&(s=Qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(DS(r)&&(r=Qx(t,r)),this.pin(r)),n){DS(n)&&(n=Qx(t,n)),this.pin(n);var a=MS(e,"thumbOffsetX",0),o=MS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=MS(e,"input",0);switch("string"==typeof h&&(h=BS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",dS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",gS,this).on("pointermove",gS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(MS(e,"enable",void 0)),this.setGap(MS(e,"gap",void 0)),this.setValue(MS(e,"value",0),MS(e,"min",void 0),MS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=AS(t,this.gap));var e=this._value;this._value=LS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const BS={pan:0,drag:0,click:1,none:-1};var FS={getStartPoint:function(t){if(void 0===t&&(t=xS),this.childrenMap.thumb){var e=0===this.orientation?yS:bS;vS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=SS),this.childrenMap.thumb){var e=0===this.orientation?kS:CS;vS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=TS),s.x=wS(e.x,i.x,t),s.y=wS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=zr(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=Nr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;bp(e,i,s),r=n?0===this.orientation?_S:ES:0===this.orientation?PS:OS,Id(e,this,r),this.resetChildPositionState(e)}};Object.assign(RS.prototype,FS);const IS=Phaser.Utils.Objects.GetValue;class jS extends vm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=IS(e,"background",void 0),r=IS(e,"buttons",void 0),n=IS(r,"top",IS(r,"left",void 0)),a=IS(r,"bottom",IS(r,"right",void 0)),o=IS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new xf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===IS(o,"width",void 0)?1:0;else h=void 0===IS(o,"height",void 0)?1:0;i=new RS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new xf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=IS(e,"valuechangeCallback",null);if(null!==u){var c=IS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(IS(e,"enable",void 0)),this.setValue(IS(e,"value",0)),this.setScrollStep(IS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class zS extends kg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const NS=Phaser.Utils.Objects.GetValue,GS=Phaser.Math.Distance.Between;class WS extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=NS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(NS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(NS(t,"enable",!0)),this.holdThreshold=NS(t,"holdThreshold",50),this.pointerOutReleaseEnable=NS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return Qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:GS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!qg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!qg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const VS=Phaser.Utils.Objects.GetValue;class YS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(VS(t,"value",0)),this.setSpeed(VS(t,"speed",0)),this.setAcceleration(VS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class XS{constructor(){this.value,this.dir,this.movement=new YS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const KS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},qS=Phaser.Utils.Objects.GetValue;class JS extends Nn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=qS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(qS(e,"speed",.1)),this.setEnable(qS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(qS(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||qg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const ZS=Phaser.Utils.Objects.GetValue;var QS=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?ZS(s,l,void 0):ZS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=po(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new jS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=ZS(r,"position",0);"string"==typeof p&&(p=tw[p]);var g,f,v=ZS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=ZS(s,"space.slider",void 0))&&(o?v=0:g=ZS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:ZS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:ZS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:ZS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:ZS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=ZS(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=ZS(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=ZS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ZS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ZS(s,"scrollDetectionMode");"string"==typeof b&&(b=ew[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ZS(s,x,!0):ZS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new US(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=ZS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new JS(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,k),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",k)),n)&&(o?(C=a?"t":"s",w=`scroll${i}`):(C="t",w="scroll"),n.on("valuechange",(function(e){t[C]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));k&&(T=o?`addChildO${i}`:"addChildOY",k.on("scroll",(function(e){t[T](-e,!0)})))};const tw={right:0,left:1,bottom:0,top:1},ew={gameObject:0,rectBounds:1},iw=Phaser.Utils.Objects.GetValue;var sw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=iw(e,"width"),a=iw(e,"height");n||(iw(e,"child.expandWidth",!0)||(s[1]=0));a||(iw(e,"child.expandHeight",!0)||(r[1]=0));var o=new hS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lS(i,"child"),r=lS(s,"gameObject",void 0);if(r){var n=lS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=lS(n,"top",0),a.bottom=lS(n,"bottom",0),o.left=lS(n,"left",0),o.right=lS(n,"right",0);break;case 1:a.top=lS(n,"left",0),a.bottom=lS(n,"right",0),o.top=lS(n,"top",0),o.bottom=lS(n,"bottom",0);break;default:a.top=lS(n,"top",0),a.bottom=lS(n,"bottom",0),a.left=lS(n,"left",0),a.right=lS(n,"right",0)}e.add(r,{column:1,row:1,align:lS(s,"align","center"),padding:o,expand:{width:lS(s,"expandWidth",!0),height:lS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:QS(t,o,"y",e);break;case 1:QS(t,o,"x",e);break;default:QS(t,o,"y",e),QS(t,o,"x",e)}return o},rw=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},nw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},aw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Sw=function(t){return t.add.text(0,0,"")};Object.assign(Cw.prototype,yw);var ww={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Tw={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Pw=Phaser.Utils.Objects.GetValue;class Ow extends uw{constructor(t,e){void 0===e&&(e={});var i=Pw(e,"text",void 0),s=Pw(e,"textWidth",void 0),r=Pw(e,"textHeight",void 0),n=Pw(e,"textCrop",!!i.setCrop),a=Pw(e,"textMask",!n),o=Pw(e,"content",""),h=new Cw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Pw(e,"clampChildOY",!1),alwaysScrollable:Pw(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=Pw(e,"space",void 0);l&&(l.child=Pw(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Ow.prototype,ww,Tw);const _w=Phaser.Utils.Objects.GetValue;var Ew=function(t,e,i){e=e?y(e):{};var s=_w(i,"background",Qx),r=_w(i,"text",Mw),n=_w(i,"track",Qx),a=_w(i,"thumb",Qx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Ow(t,e);return t.add.existing(h),h},Mw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new FC(t,e);break;case"bbcodetext":case"bbcode":s=new LC(t,0,0,"",e);break;case"label":s=new zC(t,e);break;case"textarea":s=Ew(t,e);break;default:s=new ik(t,e)}return Zx(s,e),t.add.existing(s),s},Dw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new qx(t,e):new _x(t,e);break;case"roundRectangle":s=new vx(t,e);break;default:s=new Lx(t,e)}return Zx(s,e),t.add.existing(s),s};const Lw=Phaser.Utils.Objects.GetValue;var Aw=function(t,e,i){e=e?y(e):{};var s=Lw(i,"background",Qx),r=Lw(i,"text",Mw),n=Lw(i,"icon",Dw),a=Lw(i,"action",Dw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Rw=Phaser.Utils.Objects.GetValue;var Bw=function(t,e,i){var s,r,n=Rw(i,"innerBackground",Qx),a=Rw(i,"separator",Qx),o=Rw(i,"title",Mw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Aw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Fw extends Jb{constructor(t,e,i){super(t,e=Bw(t,e,i))}}var Iw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ul(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const jw=Phaser.Utils.Objects.GetValue;class zw extends Jl{constructor(t,e){super(t,jw(e,"x",0),jw(e,"y",0),jw(e,"width",64),jw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),jw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(jw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(jw(t,"ease",i)),i=e?0:this.delay,this.setDelay(jw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(jw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(jw(t,"color",i)),i=e?0:this.value,this.setValue(jw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(zw.prototype,Iw);const Nw=Phaser.Math.DegToRad,Gw=Phaser.Math.Linear,Ww=Phaser.Math.Easing.Expo.In,Vw={right:0,down:1,left:2,up:3};var Yw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Hw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Hw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Hw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Hw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Hw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Hw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Xw={},Hw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Xw.x=a*u+o*c+r,Xw.y=h*u+l*c+n,Xw},$w={setDirection(t){return"string"==typeof t&&(t=Vw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Iu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Nw(315);i=Math.cos(a),s=Math.sin(a);var o=Nw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Nw(135);i=Math.cos(a),s=Math.sin(a);o=Nw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Nw(225);i=Math.cos(a),s=Math.sin(a);o=Nw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Nw(45);i=Math.cos(a),s=Math.sin(a);o=Nw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=wl(s),eP(r)?(d.expandWidth=iP(r,"width",!1),d.expandHeight=iP(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?zr(t):n),d.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},aP={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Qd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return sm.call(this,t),this}},oP={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,sf.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(QT.width=e.aspectRatio,QT.height=1,tP.width=l,tP.height=u,l=(c=cl(QT,tP,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Yv(t,this)):bp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zr(t)),void 0===u&&(u=Nr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,rf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(oP,nP,aP);const hP=Phaser.Utils.Objects.IsPlainObject,lP=Phaser.Utils.Objects.GetValue;class uP extends Vv{constructor(t,e,i,s,r,n){hP(e)?(e=lP(n=e,"x",0),i=lP(n,"y",0),s=lP(n,"width",void 0),r=lP(n,"height",void 0)):hP(s)&&(s=lP(n=s,"width",void 0),r=lP(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(uP.prototype,oP);const cP=vm.prototype.add,dP=vm.prototype.addSpace;var pP=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&dP.call(this),cP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&dP.call(this),this.hasTailSpace=s}else cP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;cP.call(this,t,{index:r,proportion:i,expand:!0})}else cP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},gP={addButton(t){if(Jg(t))for(var e=t,i=0,s=e.length;i=0;i--)mP.call(this,e[i],t);return this}},bP=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},xP=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,bP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},kP={add(t){return this.buttons.push(t),t._click||(t._click=new hf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),xP.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=BP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=BP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const IP=Phaser.Utils.Objects.IsPlainObject,jP=Phaser.Utils.Objects.GetValue,zP=Phaser.Display.Align.CENTER;var NP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Hd.call(this,t),IP(e))&&(e=jP(h=e,"padding",0),i=jP(h,"key",void 0),s=jP(h,"index",void 0),r=jP(h,"offsetX",0),n=jP(h,"offsetY",0),a=jP(h,"offsetOriginX",0),o=jP(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=zP,h.padding=wl(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},GP={add(t,e,i){if(Jg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,sm.call(this,t),this}},YP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&JP.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)iO.call(this,e[i],t);return this}};const rO=Phaser.Utils.Objects.GetValue;class nO extends KP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new _P({parent:this,eventEmitter:rO(e,"eventEmitter",this),groupName:rO(e,"groupName",void 0),clickConfig:rO(e,"click",void 0)}).setButtonsType(e);var s=rO(e,"background",void 0),r=rO(e,"buttons",void 0);this.buttonsAlign=rO(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(nO.prototype,QP,sO,OP,MP);const aO=hS.prototype.add;var oO={addButton(t,e,i){return aO.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uO.call(this,e[i],t);return this}};const dO=Phaser.Utils.Objects.GetValue;class pO extends hS{constructor(t,e){void 0===e&&(e={});var i=dO(e,"row",0),s=dO(e,"column",e.col||0),r=dO(e,"createCellContainerCallback"),n=dO(e,"buttons",void 0),a=dO(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(l_(this),u_(this)),this}setNumberInput(){return this.onUpdateCallback=h_,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const p_=Phaser.Utils.Objects.GetValue,g_=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var f_=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},v_=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ux(t.style,e);Tl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},m_=function(t){fr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=ux(t.style,e);Tl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},y_=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ux(t,e);Tl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function b_(){}function x_(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}b_.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(x_(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const k_=new b_;const C_=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,S_=/\S/,w_=new b_;w_.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!S_.test(t)&&!S_.test(e)},w_.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(__(t,null,null,i),i," ")},O_.equals=function(t,e){return b_.prototype.equals.call(O_,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const E_=new b_;E_.tokenize=function(t){return t.slice()},E_.join=E_.removeEmpty=function(t){return t};const M_=Phaser.Utils.Array.Remove;var D_=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),M_(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,k_.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},F_={cursorMoveLeft(){if(!this.isOpened)return this;var t=A_(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=A_(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=R_(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=A_(B_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=R_(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=A_(B_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const I_=Phaser.Utils.Objects.IsPlainObject;class j_ extends zb{constructor(t,e,i,s,r,n){I_(e)?n=e:I_(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Uo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=lx(n.background,"focus"),h=lx(n.style,"cursor"),l=lx(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=p_(e,"edit");return void 0===i&&(i={}),KO(e,i,g_),new d_(t,i)}(this,n),f_.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),y_.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),v_.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),fr(l)&&Object.assign(l,h),m_.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new jT(t,e);return Zx(i,e),t.add.existing(i),i},y=!0);var b,x,k=new Fw(r,t,i);k.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(k),wr(k,e),k.vpx=l,k.vpy=u,k.frameDelimiter=c,y&&(b=k.getElement("action"),k.setChildVisible(b,!1)),Pc(k),k.emitClick=function(){k.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:k.setInteractive()),x&&k.bindEvent(x,"pointerdown",(function(){k.emitClick()})),k.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=NT[t.keyCode];-1!==e.indexOf(i)&&k.emitClick()}}));var C=function(){k.isTyping?k.once("click",C).stop(!0):k.isLastPage?k.complete2Flag||(k.complete2Flag=!0,k.emit("complete2")):k.once("click",C).typeNextPage()},S=function(){k.isPageEnd&&(k.off("click",S),y&&(b.stop(),k.setChildVisible(b,!1)),v.emit("resume.input"))};k._typeNextPage=S,k.on("pageend",(function(){y&&(b.start(),k.setChildVisible(b,!0)),k.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,k.emitClick)),v.emit("pause.input")})).on("start",(function(){k.off("click",C).once("click",C)}));var w=v.getData("$fastTyping"),T=v.getData("$autoNextPage");k.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(k.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=k.normalTypingSpeed),k.setTypingSpeed(e)}else t&&k.emitClick();else e===T||t||k.isTyping||e&&k.emitClick();w=t,T=e}));var P=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=NT[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return k.bindEvent(r.input.keyboard,"keydown",(function(t){P(t,!0)})),k.bindEvent(r.input.keyboard,"keyup",(function(t){P(t,!1)})),k}}(WT(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{typing:Rc,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=Ec(e,`creators.${Ko}`,void 0);if(!1!==s){if(Mc(s)&&(s=void 0),void 0===s){Ec(e,`styles.${Ko}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new xc(t,i);t.add.existing(s),wr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Pc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Do,commands:{cross:_c,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=NO(e,`creators.${Qo}`,void 0);if(!1!==s){var r;if(GO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new jO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Pc(u),u}}(NO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{choice:zO,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=X_(e,`creators.${th}`,void 0);if(!1!==s){var r;if(H_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new V_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Pc(u),u}}(X_(e,`styles.${th}`,{}),{viewport:i},r);t.addGameObjectManager({name:th,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{input:Y_,shake:Oc}})}},function(t,e){var{viewport:i}=e,s=JT(e,`creators.${Zo}`,void 0);if(!1!==s){var r;if(ZT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new YT(s,t,i);return g&&k.setTitle(g),f&&k.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,k.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(k),wr(k,e),k.vpx=h,k.vpy=l,Pc(k),k}}(JT(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{setText:HT,popUp:$T,shake:Oc}})}}];var U_=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],K_={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},q_=function(t,e){var i=po(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class J_ extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=un(t,t.cameras.main));for(var a=new Mo(t,{layers:r?Vo:Yo,layerDepth:i,rootLayer:s}),o=0,h=$_.length;o0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=oE(r,"x",null);null!==n?(t=n,i=n):(t=oE(r,"left",0),i=oE(r,"right",t));var a=oE(r,"y",null);null!==a?(e=a,s=a):(e=oE(r,"top",0),s=oE(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return uE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=lE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const dE={right:0,down:1,left:2,up:3};var pE=function(t){return"string"==typeof t&&(t=dE[t]),t%=4};Object.assign(cE.prototype,nE,aE);class gE extends tE{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new cE(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}var fE=function(t,e,i){return Qx(t,q_(e,i))};class vE extends Eg{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var mE={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;(this.show(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();return e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){(this.setChildScale(i,1,1).hide(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},yE=function(t,e){Ip.popUp.call(t,e,this.expandDirection)},bE=function(t,e){Ip.scaleDown.call(t,e,this.expandDirection)},xE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=yE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=bE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const kE=Phaser.Utils.Objects.GetValue;let CE=class extends vm{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=kE(e,"space"),a=1===this.orientation?"left":"top",o=kE(e,"align.title",a),h=kE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:kE(n,"titleLeft",0),right:kE(n,"titleRight",0),top:kE(n,"titleTop",0),bottom:kE(n,"titleBottom",0)}});var l=kE(e,"toggleByTarget",void 0),u=kE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&uf.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new vE(r),!kE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=kE(e,"align.child","left");var d=(h=kE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:kE(n,"childLeft",0),right:kE(n,"childRight",0),top:kE(n,"childTop",0),bottom:kE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(kE(p,"duration",200)),this.setExpandCallback(kE(p,"expandCallback",void 0)),this.setCollapseCallback(kE(p,"collapseCallback",void 0)),this.reLayoutTarget=kE(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var f=e.onExpandComplete;f&&this.on("expand.complete",f);var v=e.onCollapseStart;v&&this.on("collapse.start",v);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=kE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(CE.prototype,mE,xE);var SE={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},wE={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class TE extends CE{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(TE.prototype,SE,wE);const PE=Phaser.Utils.Objects.GetValue;const OE=Phaser.Utils.Objects.GetValue;const _E=uP.prototype.add;var EE=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),_E.call(this,t,e,i,s,r,n,a,o,h),this},ME={add:EE,addPage:EE};const DE=al.prototype.setChildVisible;var LE={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(DE.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(DE.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(LE,ME);const AE=Phaser.Utils.Objects.GetValue;class RE extends uP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(AE(e,"swapMode",0)),this.setFadeInDuration(AE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=BE[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(RE.prototype,LE);const BE={invisible:0,destroy:1};const FE=Phaser.Utils.Objects.IsPlainObject,IE=Phaser.Utils.Objects.GetValue,jE=Phaser.Utils.String.UUID;var zE={swapPage:function(t,e){var i,s;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s));return this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},NE={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},GE={top:1,left:3,right:5,bottom:7},WE={top:"bottom",left:"right",right:"left",bottom:"top"},VE={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},YE={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const oM=Phaser.Utils.Objects.GetValue;class hM extends vm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=oM(e,"background",void 0),s=oM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:oM(e,"space.title",0)}});var r=oM(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(hM.prototype,nM,aM);const lM=Phaser.Utils.Objects.GetValue;const uM=Phaser.Utils.Objects.GetValue;var cM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const dM=Phaser.Geom.Intersects.RectangleToRectangle,pM=Phaser.Geom.Rectangle.Overlaps;var gM=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},fM=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},vM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},mM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},yM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const bM=Phaser.Utils.Objects.GetValue,xM={update:0,everyTick:1};var kM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(bM(t,"updateMode",0)),this.enableChildrenMask(bM(t,"padding",0)),this.setMaskLayer(bM(t,"layer",void 0)),this.onMaskGameObjectVisible=bM(t,"onVisible"),this.onMaskGameObjectInvisible=bM(t,"onInvisible"),this.maskGameObjectCallbackScope=bM(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=xM[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=km.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,u=t.getBounds(),c=cM(e),d=0,p=i.length;dthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(PM.prototype,CM);const OM=["top","bottom","centerY","center"],_M=["left","right","centerX","center"];var EM=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=OM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=_M.length;a=0?0:Math.abs(c)<=Math.abs(d)?c:d}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const MM=Phaser.Utils.Objects.GetValue;class DM extends uw{constructor(t,e){void 0===e&&(e={});var i=WC(e),s=MM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=MM(e,"clampChildOY",!1),s.clampChildOX=MM(e,"clampChildOX",!1);var r,n,a=new PM(t,s);switch(t.add.existing(a),i){case 0:r=MM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=MM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:MM(e,"align.panel","center")};var o=MM(e,"space",void 0);o&&(o.child=MM(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Nv(this.childrenMap.child,t),this}}var LM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:EM.call(this,t,"y",e);break;case 1:EM.call(this,t,"x",e);break;default:EM.call(this,t,"y",e),EM.call(this,t,"x",e)}return this}};Object.assign(DM.prototype,LM);var AM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},RM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class BM extends DM{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(BM.prototype,AM,RM);const FM=Phaser.Utils.Objects.GetValue;const IM=Phaser.Utils.Objects.GetValue;const jM=Phaser.Utils.Objects.GetValue;var zM={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=jM(t,"onGetValue"),this.onSetValue=jM(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},NM={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},GM={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const WM=Phaser.Utils.Objects.GetValue;class VM extends vm{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=WM(e,"proportion.title",0),o=WM(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0);a=WM(e,"proportion.inputField",h);this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(VM.prototype,zM,NM,GM);var YM=function(t,e,i){var s=new tE(t,i);return t.add.existing(s),s},XM=function(t){void 0===t&&(t=vm);return class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},HM=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0}));i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange);return n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=ZM(this.styles,"inputRow")||{},r=JM(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Qx(t,q_(e,i))}(this.scene,t,QM(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),tD(this,y(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=N_(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},nD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},aD={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const oD=Phaser.Utils.Objects.GetValue;class hD extends uw{constructor(t,e){void 0===e&&(e={});var i,s=oD(e,"text");fn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new j_(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=oD(e,"space",void 0);h&&(h.child=oD(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=oD(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(hD.prototype,nD,aD);var lD={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new hD(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},uD={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=N_(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const cD=Phaser.Utils.Objects.GetValue,dD=Phaser.Math.Linear,pD=Phaser.Math.Snap.Floor;var gD={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=cD(s,r),a=function(t,e){var i=new RS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=cD(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var u=e.inputNumber||e.inputText,c=N_(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=cD(e,"proportion.range.inputText",o);t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=dD(t.minValue,t.maxValue,a.value);t.step&&(e=pD(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},fD=function(t,e){var i=new LP(t,e);return t.add.existing(i),i};const vD=Phaser.Utils.Objects.GetValue;var mD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=vD(e,"incDec")||{},r={text:null,action:null},n=fD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=N_(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=CO(i,l),c=Object.assign(y(r),s.decButton||{}),d=CO(i,c);n.addButton(u),n.addButton(d);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new uL(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const dL=Phaser.Utils.Objects.GetValue;var pL=function(t,e){var i=dL(e,"expandDirection",void 0);"string"==typeof i&&(i=gL[i]);var s,r,n,a,o,h,l,u=(n="alignTargetX",tt(s=e,r="alignTarget")?Q(s,r):n&&tt(s,n)?Q(s,n):a&&tt(s,a)?Q(s,a):o),c=dL(e,"alignTargetY",u),d=dL(e,"alignOffsetX",0),p=dL(e,"alignOffsetY",0),g=dL(e,"alignSide","").includes("right"),f=dL(e,"bounds"),v=0===i,m=!v&&!(1===i),y=g?1:0,b=v||m?0:1;t.setOrigin(y,b),h=g?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+p);var x=f;x||(x=un(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const gL={down:0,up:1},fL=Phaser.Utils.Objects.GetValue;class vL extends Eg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Dp(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ep(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),pL(t,e),t.isRexSizer&&t.layout();var i=fL(e,"touchOutsideClose",!1),s=fL(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ng(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var mL={openColorPicker:function(){if(!this.colorPicker){var t=cL.call(this).layout(),e=new vL(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(mL,DD);const yL=Phaser.Utils.Objects.GetValue;class bL extends MD{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(yL(i,"width",160),yL(i,"height",170));var n=yL(i,"background");r=n?function(t){return Qx(t,n)}:yL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(yL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(yL(i,"expandDirection")),this.setColorPickerEaseInDuration(yL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(yL(i,"easeOut",200)),this.setColorPickerTransitInCallback(yL(i,"transitIn")),this.setColorPickerTransitOutCallback(yL(i,"transitOut")),this.setColorPickerBounds(yL(i,"bounds"));var a=yL(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&(!1!==o&&null!==o)){this.setColorComponentsHeight(yL(o,"height",30)),this.setColorComponentsFormatLabelConfig(yL(o,"formatLabel"));var h=yL(o,"inputText");h||(h=yL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=yL(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var u=this.childrenMap.swatch;u&&s&&this.onClick(u,this.openColorPicker,this)}}Object.assign(bL.prototype,mL);var xL={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new bL(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},kL={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},CL={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},SL={buildShapes(){this.addShape((new Nu).setName("box")).addShape((new Iu).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,c=a/2,d=s*this.boxSize-a;h.setTopLeftPosition(r+c+u,n+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,f=2*p,v=3*p;l.startAt(g,f).lineTo(f,v).lineTo(v,g).offset(r+u,n+u).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},wL={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ul(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},TL={};Object.assign(TL,kL,CL,SL,wL);const PL=23730,OL=Phaser.Utils.Objects.GetValue,_L=Phaser.Utils.Objects.IsPlainObject;class EL extends Jl{constructor(t,e,i,s,r,n,a){_L(e)?(e=OL(a=e,"x",0),i=OL(a,"y",0),s=OL(a,"width",2),r=OL(a,"height",2),n=OL(a,"color",PL)):_L(n)&&(n=OL(a=n,"color",PL)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=PL),this.setBoxShape(OL(a,"circleBox",!1)),this.setBoxFillStyle(n,OL(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(OL(a,"uncheckedColor",null),OL(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(OL(a,"boxLineWidth",4),OL(a,"boxStrokeColor",n),OL(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,OL(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),OL(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(OL(a,"checkerColor",16777215),OL(a,"checkerAlpha",1)),this.setBoxSize(OL(a,"boxSize",1)),this.setCheckerSize(OL(a,"checkerSize",1)),this.setCheckerAnimationDuration(OL(a,"animationDuration",150)),this.buildShapes();var o=OL(a,"checked");void 0===o&&(o=OL(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(EL.prototype,TL);const ML=Phaser.Utils.Objects.GetValue,DL=Phaser.Utils.Objects.IsPlainObject;class LL extends EL{constructor(t,e,i,s,r,n,a){DL(e)?(e=ML(a=e,"x",0),i=ML(a,"y",0),s=ML(a,"width",2),r=ML(a,"height",2),n=ML(a,"color",PL)):DL(n)&&(n=ML(a=n,"color",PL)),super(t,e,i,s,r,n,a),this._click=new hf(this,ML(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(ML(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var AL={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new LL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},RL={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},BL={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},FL={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},IL=function(t,e,i){return(e-t)*i+t};const jL=Phaser.Math.Linear;var zL={buildShapes(){this.addShape((new Nu).setName("track")).addShape((new Nu).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&IL(yr(l),yr(u),c))<<16|(255&IL(br(l),br(u),c))<<8|255&IL(xr(l),xr(u),c)),p=jL(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(d,p);var g=this.getShape("thumb");if(this.isSizeChanged){var f=t*this.thumbWidth,v=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(f,v).setRadius(m)}var y=jL(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},NL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ul(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},GL={};Object.assign(GL,RL,BL,FL,zL,NL);const WL=Phaser.Utils.Objects.GetValue,VL=Phaser.Utils.Objects.IsPlainObject,YL=23730;class XL extends Jl{constructor(t,e,i,s,r,n,a){VL(e)?(e=WL(a=e,"x",0),i=WL(a,"y",0),s=WL(a,"width",2),r=WL(a,"height",2),n=WL(a,"color",YL)):VL(n)&&(n=WL(a=n,"color",YL)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=YL),this.setTrackFillStyle(n,WL(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(WL(a,"falseValueTrackColor",function(t){var e=.3*yr(t)+.59*br(t)+.11*xr(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),WL(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(WL(a,"thumbColor",16777215),WL(a,"thumbAlpha",1)),this.setTrackSize(WL(a,"trackWidth",.9),WL(a,"trackHeight",.5)),this.setTrackRadius(WL(a,"trackRadius",.5*this.trackHeight));var o=WL(a,"thumbHeight",void 0),h=WL(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(WL(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(WL(a,"thumbLeft",.3),WL(a,"thumbRight",void 0)),this.setRTL(WL(a,"rtl",!1)),this.setToggleAnimationDuration(WL(a,"animationDuration",150)),this.buildShapes(),this.setValue(WL(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(XL.prototype,GL);const HL=Phaser.Utils.Objects.GetValue;class $L extends XL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new hf(this,HL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(HL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var UL={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new $L(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},KL={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=qL[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const qL={down:0,up:1},JL=Phaser.Utils.Objects.GetValue;var ZL=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){s=QL(e,d);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=tA(e,this.listCreateSliderTrackCallback),g=tA(e,this.listCreateSliderThumbCallback);u=new DM(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:JL(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=QL(e,d),u=s;return t&&u.addBackground(t,"background"),this.listDraggable&&u.setDraggable(!0),u!==s&&s.on("button.over",(function(t,e,i,s){u.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){u.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){u.emit("button.click",t,e,i,s)})),u},QL=function(t,e,i){var s;return i?(e.orientation="x",s=new nO(t,e)):(e.orientation="y",s=new LP(t,e)),t.add.existing(s),s},tA=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},eA={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;void 0===e?t=0:t=(e+1)%this.listPanel.getButtons().length;return this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},iA={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=ZL.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new vL(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(iA,KL,eA);const sA=Phaser.Utils.Objects.GetValue;class rA extends jC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(sA(e,"options"));var i=sA(e,"list");this.setWrapEnable(sA(i,"wrap",!1)),this.setCreateButtonCallback(sA(i,"createButtonCallback")),this.setCreateListBackgroundCallback(sA(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(sA(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(sA(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(sA(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(sA(i,"scroller")),this.setListMouseWheelScrollerConfig(sA(i,"mouseWheelScroller")),this.setButtonClickCallback(sA(i,"onButtonClick")),this.setButtonOverCallback(sA(i,"onButtonOver")),this.setButtonOutCallback(sA(i,"onButtonOut")),this.setListExpandDirection(sA(i,"expandDirection")),this.setListEaseInDuration(sA(i,"easeIn",500)),this.setListEaseOutDuration(sA(i,"easeOut",100)),this.setListTransitInCallback(sA(i,"transitIn")),this.settListTransitOutCallback(sA(i,"transitOut")),this.setListMaxHeight(sA(i,"maxHeight",0)),this.setListSize(sA(i,"width"),sA(i,"height",0)),this.setListAlignmentMode(sA(i,"alignParent","text")),this.setListAlignmentSide(sA(i,"alignSide","")),this.setListBounds(sA(i,"bounds")),this.setListSpace(sA(i,"space")),this.setListDraggable(sA(i,"draggable",!1)),this.setValueChangeCallback(sA(e,"setValueCallback"),sA(e,"setValueCallbackScope")),this.setValue(sA(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(rA.prototype,iA);var nA=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?y(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Aw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=CO(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Qx(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Qx(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new rA(t,e);return t.add.existing(i),i},aA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=nA(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=aA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const hA=Phaser.Utils.Objects.GetValue;var lA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?y(e.button):{},r=hA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=fD(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n0?r.addScrollable():r).addRows(s,i,!0),r}(t,e,i,s)}}var pA={csv2md:function(t,e={}){"string"==typeof e&&(e={title:e});for(var i,s,r,{title:n}=e,a=lr.parse(t).data,o=!1,h=!1,l=[],u=0,c=a.length;u 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -36912,7 +36934,7 @@ var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -37319,6 +37341,33 @@ }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -37967,6 +38016,7 @@ var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -37994,19 +38044,41 @@ } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -38201,6 +38273,11 @@ return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rexnameinputdialog.min.js b/dist/rexnameinputdialog.min.js index a5bbd5d46d..dfed81e078 100644 --- a/dist/rexnameinputdialog.min.js +++ b/dist/rexnameinputdialog.min.js @@ -1,6 +1,6 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},z={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},D={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},ze={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Be=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let _i=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=ki(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},zi=function(t){return Li(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),zi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),zi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),zi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),zi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Ai),Yi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Bi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Ni=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),zi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),zi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),zi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),zi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),zi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),zi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),zi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),zi(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ws={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Bs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Ys,Xs,Ws,Bs);const Is=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,js);var Ns=function(t){if(t.parentContainer)return Ns(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ns(e):t};class Hs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ns(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Gs=Phaser.GameObjects.Rectangle;let Vs=class extends Gs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Hs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Us=Phaser.Utils.Objects.GetValue;class $s extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Us(t,"hitAreaMode",0)),this.setEnable(Us(t,"enable",!0)),this.setStopMode(Us(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class qs extends Vs{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new $s(this,{hitAreaMode:1})}}var Zs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha)},tr=function(t,e){Hi(t,e,!1)},er=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const ir=Phaser.Utils.Objects.GetValue;let sr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=rr.popUp),null==e.transitOut&&(e.transitOut=rr.scaleDown),e.destroy=ir(e,"destroy",!0),super(t,e);var i=ir(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(ir(i,"transitIn",Qs)),this.setCoverTransitOutCallback(ir(i,"transitOut",tr)));var s=ir(e,"touchOutsideClose",!1),r=ir(e,"duration.hold",-1),n=ir(e,"timeOutClose",r>=0),h=ir(e,"anyTouchClose",!1);ir(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),ir(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&er(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.popUp:t=Zs.popUp;break;case rr.fadeIn:t=Zs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.scaleDown:t=Zs.scaleDown;break;case rr.fadeOut:t=Zs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const rr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var nr=function(t){return t&&"function"==typeof t},hr={modal(t,e){return nr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ar=function(t,e,i,s,r){nr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},or={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ar.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ar.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ar.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ar.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ar.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ar.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ar.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ar.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ar.call(this,"shutdown",t,e,i,s),this}},lr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},dr={},cr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?er(t,e.x,e.y,i,s):!!(r=lr(e,n,!0))&&er(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return kr.length=0,!0;return kr.length=0,!1},kr=[];const _r=Phaser.Utils.Objects.GetValue;class Er extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Mr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:cr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Mr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const zr=Phaser.Utils.Objects.GetValue;class Dr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(zr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(zr(t,"enable",!0)),this.setCooldown(zr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===tn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=en,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&cr(t,s,e,i)}}const Qr=0,tn=1,en="IDLE",sn=Phaser.Utils.Objects.GetValue,rn=Phaser.Math.Distance.Between;class nn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(sn(t,"time",250)),this.setTapInterval(sn(t,"tapInterval",200)),this.setDragThreshold(sn(t,"threshold",9)),this.setTapOffset(sn(t,"tapOffset",10));var e=sn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(sn(t,"maxTaps",void 0)),this.setMinTaps(sn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=an;break;case an:var t=this.lastPointer;rn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=on,this.state=an);break;case on:this.state=an}}onDragEnd(){this.state===an&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=on))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===an){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=on:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&(this.state=hn)}get isTapped(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED",ln=Phaser.Utils.Objects.GetValue;class dn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=cn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ln(t,"threshold",9)),this.setHoldTime(ln(t,"time",251)),this}onDragStart(){this.state=un,0===this.holdTime&&(this.state=pn)}onDragEnd(){this.state=cn}onDrag(){this.state!==cn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=cn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===un&&t-this.pointer.downTime>=this.holdTime&&(this.state=pn)}get isPressed(){return this.state===pn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const cn="IDLE",un="BEGIN",pn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ti(t).loop.delta};const gn=Phaser.Math.Distance.Between,fn=Phaser.Math.Angle.Between;var mn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return gn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},bn={};const xn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Math.RadToDeg;class Sn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=wn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=wn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=wn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=bn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,mn);const wn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,kn=Phaser.Utils.Array.SpliceOne,_n=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Mn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=zn,this.onDrag1Start();break;case zn:this.tracerState=Dn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],kn(this.pointers,e),this.tracerState){case zn:this.tracerState=Ln,this.onDrag1End();break;case Dn:this.tracerState=zn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case zn:this.onDrag1();break;case Dn:this.onDrag2()}}}dragCancel(){return this.tracerState===Dn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Dn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Dn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&cr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&cr(t,s,e,i)}}Object.assign(Mn.prototype,$e);var Rn={};const Ln=0,zn=1,Dn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},Wn={};const Bn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,Fn=Phaser.Math.RadToDeg,Nn=Phaser.Math.DegToRad;var Hn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Wn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Fn(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Un}break;case Un:t=jn(Fn(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Un}get rotation(){return Nn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Hn);const Gn="IDLE",Vn="BEGIN",Un="RECOGNIZED",$n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new nn(this,e),this._tap.on("tap",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new dn(this,e),this._press.on("pressstart",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t){var e=Zn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Wr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const th=Phaser.Utils.Objects.GetValue;var eh=function(t,e){return t.setInteractive(),th(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:th(e,"targets",[t]),targetMode:th(e,"targetMode","parent"),eventEmitter:th(e,"eventEmitter",t),eventNamePrefix:th(e,"inputEventPrefix","child.")},jr.call(t,e),Nr.call(t,e),Vr.call(t,e),Kr.call(t,e),Jn.call(t,e),qn.call(t,e),Qn.call(t,e),t},ih={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=zt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=vh[e];else if(ch(e)){var f;e=uh(f=e,"proportion",void 0),i=uh(f,"align",ph),s=uh(f,"padding",0),r=uh(f,"expand",!1),n=uh(f,"key",void 0),h=uh(f,"index",void 0),t.isRexSizer||(a=uh(f,"minWidth",void 0),o=uh(f,"minHeight",void 0)),l=uh(f,"fitRatio",0),d=uh(f,"offsetX",0),c=uh(f,"offsetY",0),u=uh(f,"offsetOriginX",0),p=uh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const mh=Et.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ch={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},Sh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},wh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ah.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ah.call(this,void 0,t),Be.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,fh,xh,Ch,Sh,wh,Oh);var Th=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},kh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},_h=function(t){return"string"==typeof t&&(t=kh[t]),t};const Eh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,h){Eh(e)?(e=Mh(h=e,"x",0),i=Mh(h,"y",0),s=Mh(h,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(s)?(s=Mh(h=s,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(n)&&(n=Mh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Mh(h,"space.item",0)),this.setStartChildIndex(Mh(h,"startChildIndex",0)),this.setRTL(Mh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=_h(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Th.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Ph);var Lh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=zh[i])}void 0===s?s={}:!0===s&&(s=Dh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const zh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Dh={},Ah={},Yh={};const Xh=Phaser.Utils.Objects.IsPlainObject,Wh=Phaser.Utils.Objects.GetValue,Bh=Phaser.Display.Align.CENTER,jh=Phaser.Utils.String.UUID;var Ih={add:function(t,e,i,s,r,n,h,a,o,l){var d,c;me.call(this,t),Xh(e)&&(e=Wh(u=e,"key",void 0),i=Wh(u,"align",Bh),s=Wh(u,"padding",0),r=Wh(u,"expand",!0),t.isRexSizer||(n=Wh(u,"minWidth",t._minWidth),h=Wh(u,"minHeight",t._minHeighted)),a=Wh(u,"offsetX",0),o=Wh(u,"offsetY",0),d=Wh(u,"offsetOriginX",0),c=Wh(u,"offsetOriginY",0),l=Wh(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=jh()),"string"==typeof i&&(i=Yt[i]),void 0===i&&(i=Bh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Xh(r)?(u.expandWidth=Wh(r,"width",!1),u.expandHeight=Wh(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Fh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return yh.call(this,t),this}},Nh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ah.width=e.aspectRatio,Ah.height=1,Yh.width=l,Yh.height=d,l=(c=Lh(Ah,Yh,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),nh(t,this)):He(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Nh,Ih,Fh);const Hh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Vh extends rh{constructor(t,e,i,s,r,n){Hh(e)?(e=Gh(n=e,"x",0),i=Gh(n,"y",0),s=Gh(n,"width",void 0),r=Gh(n,"height",void 0)):Hh(s)&&(s=Gh(n=s,"width",void 0),r=Gh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Vh.prototype,Nh);const Uh=Rh.prototype.add,$h=Rh.prototype.addSpace;var Jh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&$h.call(this),Uh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&$h.call(this),this.hasTailSpace=s}else Uh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Uh.call(this,t,{index:r,proportion:i,expand:!0})}else Uh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Kh={addButton(t){if(ur(t))for(var e=t,i=0,s=e.length;i=0;i--)Qh.call(this,e[i],t);return this}},ea=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ia=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ea.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},sa={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ia.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=ma(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=ma(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue,Ca=Phaser.Display.Align.CENTER;var Sa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(me.call(this,t),ba(e)&&(e=xa(o=e,"padding",0),i=xa(o,"key",void 0),s=xa(o,"index",void 0),r=xa(o,"offsetX",0),n=xa(o,"offsetY",0),h=xa(o,"offsetOriginX",0),a=xa(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Ca,o.padding=ge(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},wa={add(t,e,i){if(ur(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ta={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&za.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Wa.call(this,e[i],t);return this}};const ja=Phaser.Utils.Objects.GetValue;class Ia extends Ra{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new da({parent:this,eventEmitter:ja(e,"eventEmitter",this),groupName:ja(e,"groupName",void 0),clickConfig:ja(e,"click",void 0)}).setButtonsType(e);var s=ja(e,"background",void 0),r=ja(e,"buttons",void 0);this.buttonsAlign=ja(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ia.prototype,Aa,Ba,la,ua);var Fa=function(){return Array.prototype.reduce.call(arguments,Na,0)},Na=function(t,e){return t+e};const Ha=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Va=Phaser.Display.Align.CENTER;var Ua=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ja(this.sizerChildren,null),yh.call(this,t),this}},qa={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ja(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},eo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ja(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ja(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},so=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ro=Phaser.Utils.Objects.IsPlainObject,no=Phaser.Utils.Objects.GetValue;class ho extends rh{constructor(t,e,i,s,r,n,h,a,o,l){ro(e)?(e=no(l=e,"x",0),i=no(l,"y",0),s=no(l,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(s)?(s=no(l=s,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(n)?(n=no(l=n,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(a)&&(a=no(l=a,"columnProportions",0),o=no(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(no(l,"createCellContainerCallback")),this.setIndentLeft(no(l,"space.indentLeftOdd",0),no(l,"space.indentLeftEven",0)),this.setIndentTop(no(l,"space.indentTopOdd",0),no(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,no(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=io.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=so.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ho.prototype,eo);const ao=ho.prototype.add;var oo={addButton(t,e,i){return ao.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uo.call(this,e[i],t);return this}};const vo=Phaser.Utils.Objects.GetValue;class go extends ho{constructor(t,e){void 0===e&&(e={});var i=vo(e,"row",0),s=vo(e,"column",e.col||0),r=vo(e,"createCellContainerCallback"),n=vo(e,"buttons",void 0),h=vo(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},$o=0,Jo=1,Ko=2,qo=0,Zo=1,Qo=2,tl=/(?:\r\n|\r|\n)/;const el={none:qo,word:Zo,char:Qo,character:Qo,mix:3},il=Phaser.Renderer.WebGL.Utils;var sl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=il.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const rl=Phaser.Display.Color;var nl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new rl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},hl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},al={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,hl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ol=Phaser.Display.Canvas.CanvasPool,ll=Phaser.GameObjects.GameObject,dl=Phaser.Utils.String.UUID;class cl extends ll{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ol.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=dl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ol.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ul=Phaser.GameObjects.Components;Phaser.Class.mixin(cl,[ul.Alpha,ul.BlendMode,ul.Crop,ul.Depth,ul.Flip,ul.GetBounds,ul.Mask,ul.Origin,ul.Pipeline,ul.PostPipeline,ul.ScrollFactor,ul.Tint,ul.Transform,ul.Visible,sl,nl,al]);var pl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class vl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(vl.prototype,pl);var gl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const fl=Phaser.Math.RotateAround;var ml;const yl=Phaser.Geom.Rectangle;var bl,xl=function(t){void 0===bl&&(bl=new yl);var e=t.drawTLX,i=t.drawTLY;return bl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),bl};const Cl=Phaser.Math.RotateAround;var Sl,wl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Sl&&(Sl={}),s=Sl),s.x=e,s.y=i,0!==t.rotation&&Cl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ol=Phaser.GameObjects.Components.TransformMatrix;var Pl,Tl,kl={},_l=function(t,e,i,s,r){var n=wl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=kl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Pl&&(Pl=new Ol,Tl=new Ol),t.parentContainer?t.getWorldTransformMatrix(Pl,Tl):Pl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Pl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},El=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return _l(t,e,n,h,r)},Ml={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ml&&(ml={}),s=ml),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&fl(s,0,0,-i.rotation),s}(t,e,this,!0);return xl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return El(this.parent,this,t,e,i)}};Object.assign(Ml,gl);const Rl=Phaser.Math.DegToRad,Ll=Phaser.Math.RadToDeg,zl=Phaser.Utils.Objects.GetValue;class Dl extends vl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ll(this._rotation)}set angle(t){this.rotation=Rl(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=zl(t,"width",void 0),i=zl(t,"height",void 0),s=zl(t,"scaleX",void 0),r=zl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Dl.prototype,Ml);const Al=Phaser.Utils.String.Pad;var Yl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Al(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Xl=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Wl=Phaser.Utils.Objects.GetValue;let Bl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Wl(t,"x",0),i=Wl(t,"y",0));var s=this.cornerRadius;s.tl=jl(Wl(t,"tl",void 0),e,i),s.tr=jl(Wl(t,"tr",void 0),e,i),s.bl=jl(Wl(t,"bl",void 0),e,i),s.br=jl(Wl(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Il(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Il(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Il(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Il(this.cornerRadius.br,t)}};var jl=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Fl(t),t},Il=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Wl(e,"x",0),t.y=Wl(e,"y",0)),Fl(t)},Fl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Nl=Phaser.Math.DegToRad;var Hl=function(t){return!t.hasOwnProperty("convex")||t.convex},Gl=function(t){return t.x>0&&t.y>0},Vl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Gl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Vl(t,o,l,o,l,180,270,!1,h):Vl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Gl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Vl(t,s-o,l,o,l,270,360,!1,h):Vl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Gl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Vl(t,s-o,r-l,o,l,0,90,!1,h):Vl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Gl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Vl(t,o,r-l,o,l,90,180,!1,h):Vl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},$l=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ul(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Jl=Phaser.Utils.Objects.GetValue;class Kl extends Dl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Jl(e,"color",null),Jl(e,"color2",null),Jl(e,"horizontalGradient",!0)),this.setStroke(Jl(e,"stroke",null),Jl(e,"strokeThickness",2)),this.setCornerRadius(Jl(e,"cornerRadius",0),Jl(e,"cornerIteration",null))}set color(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Xl("color2",t,this),Xl("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Xl("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Xl("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){$l(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const ql=Phaser.Utils.Objects.GetValue;class Zl extends Dl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(ql(e,"color",null),ql(e,"color2",null),ql(e,"horizontalGradient",!0)),this.setStroke(ql(e,"stroke",null),ql(e,"strokeThickness",2))}set color(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,ql(t,"color2",null),ql(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ql(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ql=Phaser.Utils.Objects.GetValue;let td=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ql(t,"bold",!1)),this.setItalic(Ql(t,"italic",!1)),this.setFontSize(Ql(t,"fontSize","16px")),this.setFontFamily(Ql(t,"fontFamily","Courier")),this.setColor(Ql(t,"color","#fff")),this.setStrokeStyle(Ql(t,"stroke",null),Ql(t,"strokeThickness",0)),this.setShadow(Ql(t,"shadowColor",null),Ql(t,"shadowOffsetX",0),Ql(t,"shadowOffsetY",0),Ql(t,"shadowBlur",0)),this.setOffset(Ql(t,"offsetX",0),Ql(t,"offsetY",0)),this.setSpace(Ql(t,"leftSpace",0),Ql(t,"rightSpace",0)),this.setAlign(Ql(t,"align",void 0)),this.setBackgroundColor(Ql(t,"backgroundColor",null)),this.setBackgroundHeight(Ql(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ql(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Xl("stroke",t,this),Xl("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Xl("shadowOffsetX",t,this),Xl("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Yl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Yl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Yl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Yl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const ed=Phaser.Utils.Array.Remove,id=Phaser.Utils.Array.Remove,sd="text",rd="image",nd="drawer",hd="space",ad="command";var od=function(t){return t.type===sd&&"\n"===t.text},ld=function(t){return t.type===sd&&"\f"===t.text},dd=function(t){return t.type===sd};class cd extends Dl{constructor(t,e,i){super(t,sd),this.updateTextFlag=!1,this.style=new td(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ud=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const pd=Phaser.Display.Canvas.CanvasPool;var vd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=pd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),pd.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class gd extends Dl{constructor(t,e,i){super(t,rd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){vd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class fd extends Dl{constructor(t,e,i,s){super(t,nd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class md extends Dl{constructor(t,e){super(t,hd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class yd extends vl{constructor(t,e,i,s,r){super(t,ad),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function bd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>bd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=bd(t[i]));return e}var xd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Cd={none:0,word:1,char:2,character:2,mix:3};var Sd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Td.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Td.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_d(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=_d(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=_d(t,"wrapMode");void 0===c&&(c=_d(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Cd[c]);var u=_d(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_d(t,"letterSpacing",0),v=_d(t,"hAlign",0),g=_d(t,"vAlign",0),f=_d(t,"justifyPercentage",.25),m=xd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!z&&m.start===k,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Rd(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Rd(t,"maxLines",0);var a=0===i,o=Rd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Rd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Rd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Rd(t,"letterSpacing",0),p=Rd(t,"rtl",!0),v=Rd(t,"hAlign",p?2:0),g=Rd(t,"vAlign",0),f=xd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ed(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return id(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(sd);return null===i?i=new cd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),El(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ic=Phaser.Utils.Objects.GetFastValue;var sc={};class rc{constructor(t){this.pools=ic(t,"pools",sc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ec),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=uc(t,r,e,i,n),a=0;a<=lc&&0!==h;a++){if((r+=h)<0){r=0;break}h=uc(t,r,e,i,n)}return a===lc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),pc(t,e,i),t},cc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},uc=function(t,e,i,s,r){var n,h=cc(t,e,r),a=cc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},pc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const vc=Phaser.Utils.Objects.GetValue,gc=Phaser.Utils.Objects.GetValue;class fc extends Lo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=gc(e,"background",void 0),r=gc(e,"icon",void 0),n=gc(e,"iconMask",void 0),h=gc(e,"text",void 0),a=gc(e,"action",void 0),o=gc(e,"actionMask",void 0),l=gc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:gc(e,"space.icon",0),top:gc(e,"space.iconTop",0),bottom:gc(e,"space.iconBottom",0),left:gc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:gc(e,"space.icon",0),left:gc(e,"space.iconLeft",0),right:gc(e,"space.iconRight",0),top:gc(e,"space.iconTop",0)});var d=gc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Wo.call(this,r,r,1)),!d){var c=gc(e,"iconSize",void 0);this.setIconSize(gc(e,"iconWidth",c),gc(e,"iconHeight",c))}}if(h){var u=gc(e,"wrapText",!1),p=gc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(No(t)){case 0:switch("string"==typeof e&&(e=el[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Vo;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=el[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,oc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=vc(e,"minWidth",0),s=vc(e,"minHeight",0),r=vc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return dc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),dc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=gc(e,"space.text",0),m=gc(e,"expandTextWidth",!1),y=gc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:gc(e,"space.actionTop",0),bottom:gc(e,"space.actionBottom",0),right:gc(e,"space.actionRight",0)}:{left:gc(e,"space.actionLeft",0),right:gc(e,"space.actionRight",0),bottom:gc(e,"space.actionBottom",0)},d=gc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Wo.call(this,a,a,1)),!d)){var b=gc(e,"actionSize");this.setActionSize(gc(e,"actionWidth",b),gc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var mc=Phaser.Renderer.WebGL.Utils,yc=function(t,e,i,s,r,n){for(var h=mc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},wc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Oc=Phaser.Renderer.Canvas.SetTransform;var Pc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Cc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&yc(r,h,e,l,a,o),e.isStroked&&xc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Oc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(kc.prototype,Pc);var _c=function(t){return t.x>0&&t.y>0},Ec=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Mc=Phaser.Math.DegToRad;var Rc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Lu=Phaser.Utils.Objects.GetValue,zu=Phaser.Utils.Objects.IsPlainObject;class Du extends(nu(qc)){constructor(t,e,i,s,r,n,h,a){zu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):zu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):zu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Mu).setName("trackFill")).addShape((new Mu).setName("bar")).addShape((new Mu).setName("trackStroke")),this.setTrackColor(Lu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Lu(a,"trackStrokeThickness",2),Lu(a,"trackStrokeColor",void 0)),this.setSkewX(Lu(a,"skewX",0)),this.setRTL(Lu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Au={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ru(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ru(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ru(a,0,0,e,i,t)}};Object.assign(Du.prototype,Au);var Yu=function(t){return null==t||""===t||0===t.length},Xu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Yu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Yu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=bd(i),s=bd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return ep(t)?(this.stretchMode.edge=sp(ip(t,"edge",0)),this.stretchMode.internal=sp(ip(t,"internal",0))):(t=sp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return np.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const ap=Phaser.Utils.Objects.IsPlainObject,op=Phaser.Utils.Objects.GetValue,lp=Phaser.GameObjects;var dp=void 0,cp=function(t,e){if(dp||(dp={},ti(t).events.once("destroy",(function(){for(var t in dp)dp[t].destroy();dp=void 0}))),!dp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new lp[e](i)).setOrigin(0),dp[e]=t}return dp[e]};const up=Phaser.GameObjects.RenderTexture;class pp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ap(i)?(i=op(d=i,"x",0),s=op(d,"y",0),r=op(d,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(r)?(r=op(d=r,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(h)?(h=op(d=h,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(a)?(a=op(d=a,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=op(d,"baseFrame",void 0)):ap(o)&&(o=op(d=o,"columns",void 0),l=op(d,"rows",void 0)),void 0===a&&(a=op(d,"frame",void 0)),void 0===o){var c=op(d,"leftWidth",void 0),u=op(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=op(d,"topHeight",void 0),v=op(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(op(d,"getFrameNameCallback",void 0)),this.setStretchMode(op(d,"stretchMode",0)),this.setPreserveRatio(op(d,"preserveRatio",!0));var g=op(d,"maxFixedPartScale",1),f=op(d,"maxFixedPartScaleX",g),m=op(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,hp),i}(up,"rexNinePatch")){}var vp={_drawImage:function(t,e,i,s,r,n){var h=cp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=cp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(pp.prototype,vp);let gp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ju(t,e))return t[e];var i=t.parent;return ju(i,e)?i[e]:void 0}set(t,e,i){return ju(t,e)?t[e]=i:ju(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const fp=Phaser.Utils.Objects.GetValue;class mp extends pp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=fp(e,"effects",!0);i&&Gu(this,i),this.style=new gp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(mp.prototype,Nc);const yp=["alpha","tint","flipX","flipY"];var bp=function(t,e){if(!e)return t;for(var i=0,s=yp.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},z={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},D={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},ze={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Be=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let _i=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=ki(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},zi=function(t){return Li(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),zi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),zi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),zi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),zi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Ai),Yi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Bi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Ni=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),zi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),zi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),zi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),zi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),zi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),zi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),zi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),zi(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ws={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Bs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Ys,Xs,Ws,Bs);const Is=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,js);var Ns=function(t){if(t.parentContainer)return Ns(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ns(e):t};class Hs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ns(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Gs=Phaser.GameObjects.Rectangle;let Vs=class extends Gs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Hs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Us=Phaser.Utils.Objects.GetValue;class $s extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Us(t,"hitAreaMode",0)),this.setEnable(Us(t,"enable",!0)),this.setStopMode(Us(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class qs extends Vs{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new $s(this,{hitAreaMode:1})}}var Zs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha)},tr=function(t,e){Hi(t,e,!1)},er=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const ir=Phaser.Utils.Objects.GetValue;let sr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=rr.popUp),null==e.transitOut&&(e.transitOut=rr.scaleDown),e.destroy=ir(e,"destroy",!0),super(t,e);var i=ir(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(ir(i,"transitIn",Qs)),this.setCoverTransitOutCallback(ir(i,"transitOut",tr)));var s=ir(e,"touchOutsideClose",!1),r=ir(e,"duration.hold",-1),n=ir(e,"timeOutClose",r>=0),h=ir(e,"anyTouchClose",!1);ir(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),ir(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&er(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.popUp:t=Zs.popUp;break;case rr.fadeIn:t=Zs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.scaleDown:t=Zs.scaleDown;break;case rr.fadeOut:t=Zs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const rr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var nr=function(t){return t&&"function"==typeof t},hr={modal(t,e){return nr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ar=function(t,e,i,s,r){nr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},or={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ar.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ar.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ar.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ar.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ar.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ar.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ar.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ar.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ar.call(this,"shutdown",t,e,i,s),this}},lr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},dr={},cr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?er(t,e.x,e.y,i,s):!!(r=lr(e,n,!0))&&er(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return kr.length=0,!0;return kr.length=0,!1},kr=[];const _r=Phaser.Utils.Objects.GetValue;class Er extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Mr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:cr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Mr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const zr=Phaser.Utils.Objects.GetValue;class Dr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(zr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(zr(t,"enable",!0)),this.setCooldown(zr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===tn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=en,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&cr(t,s,e,i)}}const Qr=0,tn=1,en="IDLE",sn=Phaser.Utils.Objects.GetValue,rn=Phaser.Math.Distance.Between;class nn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(sn(t,"time",250)),this.setTapInterval(sn(t,"tapInterval",200)),this.setDragThreshold(sn(t,"threshold",9)),this.setTapOffset(sn(t,"tapOffset",10));var e=sn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(sn(t,"maxTaps",void 0)),this.setMinTaps(sn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=an;break;case an:var t=this.lastPointer;rn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=on,this.state=an);break;case on:this.state=an}}onDragEnd(){this.state===an&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=on))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===an){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=on:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&(this.state=hn)}get isTapped(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED",ln=Phaser.Utils.Objects.GetValue;class dn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=cn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ln(t,"threshold",9)),this.setHoldTime(ln(t,"time",251)),this}onDragStart(){this.state=un,0===this.holdTime&&(this.state=pn)}onDragEnd(){this.state=cn}onDrag(){this.state!==cn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=cn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===un&&t-this.pointer.downTime>=this.holdTime&&(this.state=pn)}get isPressed(){return this.state===pn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const cn="IDLE",un="BEGIN",pn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ti(t).loop.delta};const gn=Phaser.Math.Distance.Between,fn=Phaser.Math.Angle.Between;var mn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return gn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},bn={};const xn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Math.RadToDeg;class Sn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=wn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=wn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=wn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=bn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,mn);const wn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,kn=Phaser.Utils.Array.SpliceOne,_n=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Mn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=zn,this.onDrag1Start();break;case zn:this.tracerState=Dn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],kn(this.pointers,e),this.tracerState){case zn:this.tracerState=Ln,this.onDrag1End();break;case Dn:this.tracerState=zn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case zn:this.onDrag1();break;case Dn:this.onDrag2()}}}dragCancel(){return this.tracerState===Dn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Dn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Dn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&cr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&cr(t,s,e,i)}}Object.assign(Mn.prototype,$e);var Rn={};const Ln=0,zn=1,Dn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},Wn={};const Bn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,Fn=Phaser.Math.RadToDeg,Nn=Phaser.Math.DegToRad;var Hn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Wn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Fn(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Un}break;case Un:t=jn(Fn(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Un}get rotation(){return Nn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Hn);const Gn="IDLE",Vn="BEGIN",Un="RECOGNIZED",$n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new nn(this,e),this._tap.on("tap",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new dn(this,e),this._press.on("pressstart",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t){var e=Zn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Wr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const th=Phaser.Utils.Objects.GetValue;var eh=function(t,e){return t.setInteractive(),th(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:th(e,"targets",[t]),targetMode:th(e,"targetMode","parent"),eventEmitter:th(e,"eventEmitter",t),eventNamePrefix:th(e,"inputEventPrefix","child.")},jr.call(t,e),Nr.call(t,e),Vr.call(t,e),Kr.call(t,e),Jn.call(t,e),qn.call(t,e),Qn.call(t,e),t},ih={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=zt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=vh[e];else if(ch(e)){var f;e=uh(f=e,"proportion",void 0),i=uh(f,"align",ph),s=uh(f,"padding",0),r=uh(f,"expand",!1),n=uh(f,"key",void 0),h=uh(f,"index",void 0),t.isRexSizer||(a=uh(f,"minWidth",void 0),o=uh(f,"minHeight",void 0)),l=uh(f,"fitRatio",0),d=uh(f,"offsetX",0),c=uh(f,"offsetY",0),u=uh(f,"offsetOriginX",0),p=uh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const mh=Et.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ch={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},Sh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},wh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ah.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ah.call(this,void 0,t),Be.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,fh,xh,Ch,Sh,wh,Oh);var Th=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},kh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},_h=function(t){return"string"==typeof t&&(t=kh[t]),t};const Eh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,h){Eh(e)?(e=Mh(h=e,"x",0),i=Mh(h,"y",0),s=Mh(h,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(s)?(s=Mh(h=s,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(n)&&(n=Mh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Mh(h,"space.item",0)),this.setStartChildIndex(Mh(h,"startChildIndex",0)),this.setRTL(Mh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=_h(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Th.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Ph);var Lh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=zh[i])}void 0===s?s={}:!0===s&&(s=Dh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const zh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Dh={},Ah={},Yh={};const Xh=Phaser.Utils.Objects.IsPlainObject,Wh=Phaser.Utils.Objects.GetValue,Bh=Phaser.Display.Align.CENTER,jh=Phaser.Utils.String.UUID;var Ih={add:function(t,e,i,s,r,n,h,a,o,l){var d,c;me.call(this,t),Xh(e)&&(e=Wh(u=e,"key",void 0),i=Wh(u,"align",Bh),s=Wh(u,"padding",0),r=Wh(u,"expand",!0),t.isRexSizer||(n=Wh(u,"minWidth",t._minWidth),h=Wh(u,"minHeight",t._minHeighted)),a=Wh(u,"offsetX",0),o=Wh(u,"offsetY",0),d=Wh(u,"offsetOriginX",0),c=Wh(u,"offsetOriginY",0),l=Wh(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=jh()),"string"==typeof i&&(i=Yt[i]),void 0===i&&(i=Bh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Xh(r)?(u.expandWidth=Wh(r,"width",!1),u.expandHeight=Wh(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Fh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return yh.call(this,t),this}},Nh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ah.width=e.aspectRatio,Ah.height=1,Yh.width=l,Yh.height=d,l=(c=Lh(Ah,Yh,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),nh(t,this)):He(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Nh,Ih,Fh);const Hh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Vh extends rh{constructor(t,e,i,s,r,n){Hh(e)?(e=Gh(n=e,"x",0),i=Gh(n,"y",0),s=Gh(n,"width",void 0),r=Gh(n,"height",void 0)):Hh(s)&&(s=Gh(n=s,"width",void 0),r=Gh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Vh.prototype,Nh);const Uh=Rh.prototype.add,$h=Rh.prototype.addSpace;var Jh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&$h.call(this),Uh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&$h.call(this),this.hasTailSpace=s}else Uh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Uh.call(this,t,{index:r,proportion:i,expand:!0})}else Uh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Kh={addButton(t){if(ur(t))for(var e=t,i=0,s=e.length;i=0;i--)Qh.call(this,e[i],t);return this}},ea=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ia=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ea.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},sa={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ia.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=ma(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=ma(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue,Ca=Phaser.Display.Align.CENTER;var Sa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(me.call(this,t),ba(e)&&(e=xa(o=e,"padding",0),i=xa(o,"key",void 0),s=xa(o,"index",void 0),r=xa(o,"offsetX",0),n=xa(o,"offsetY",0),h=xa(o,"offsetOriginX",0),a=xa(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Ca,o.padding=ge(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},wa={add(t,e,i){if(ur(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ta={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&za.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Wa.call(this,e[i],t);return this}};const ja=Phaser.Utils.Objects.GetValue;class Ia extends Ra{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new da({parent:this,eventEmitter:ja(e,"eventEmitter",this),groupName:ja(e,"groupName",void 0),clickConfig:ja(e,"click",void 0)}).setButtonsType(e);var s=ja(e,"background",void 0),r=ja(e,"buttons",void 0);this.buttonsAlign=ja(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ia.prototype,Aa,Ba,la,ua);var Fa=function(){return Array.prototype.reduce.call(arguments,Na,0)},Na=function(t,e){return t+e};const Ha=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Va=Phaser.Display.Align.CENTER;var Ua=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ja(this.sizerChildren,null),yh.call(this,t),this}},qa={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ja(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},eo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ja(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ja(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},so=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ro=Phaser.Utils.Objects.IsPlainObject,no=Phaser.Utils.Objects.GetValue;class ho extends rh{constructor(t,e,i,s,r,n,h,a,o,l){ro(e)?(e=no(l=e,"x",0),i=no(l,"y",0),s=no(l,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(s)?(s=no(l=s,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(n)?(n=no(l=n,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(a)&&(a=no(l=a,"columnProportions",0),o=no(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(no(l,"createCellContainerCallback")),this.setIndentLeft(no(l,"space.indentLeftOdd",0),no(l,"space.indentLeftEven",0)),this.setIndentTop(no(l,"space.indentTopOdd",0),no(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,no(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=io.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=so.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ho.prototype,eo);const ao=ho.prototype.add;var oo={addButton(t,e,i){return ao.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uo.call(this,e[i],t);return this}};const vo=Phaser.Utils.Objects.GetValue;class go extends ho{constructor(t,e){void 0===e&&(e={});var i=vo(e,"row",0),s=vo(e,"column",e.col||0),r=vo(e,"createCellContainerCallback"),n=vo(e,"buttons",void 0),h=vo(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},$o=0,Jo=1,Ko=2,qo=0,Zo=1,Qo=2,tl=/(?:\r\n|\r|\n)/;const el={none:qo,word:Zo,char:Qo,character:Qo,mix:3},il=Phaser.Renderer.WebGL.Utils;var sl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=il.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const rl=Phaser.Display.Color;var nl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new rl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},hl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},al={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,hl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ol=Phaser.Display.Canvas.CanvasPool,ll=Phaser.GameObjects.GameObject,dl=Phaser.Utils.String.UUID;class cl extends ll{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ol.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=dl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ol.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ul=Phaser.GameObjects.Components;Phaser.Class.mixin(cl,[ul.Alpha,ul.BlendMode,ul.Crop,ul.Depth,ul.Flip,ul.GetBounds,ul.Mask,ul.Origin,ul.Pipeline,ul.PostPipeline,ul.ScrollFactor,ul.Tint,ul.Transform,ul.Visible,sl,nl,al]);var pl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class vl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(vl.prototype,pl);var gl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const fl=Phaser.Math.RotateAround;var ml;const yl=Phaser.Geom.Rectangle;var bl,xl=function(t){void 0===bl&&(bl=new yl);var e=t.drawTLX,i=t.drawTLY;return bl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),bl};const Cl=Phaser.Math.RotateAround;var Sl,wl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Sl&&(Sl={}),s=Sl),s.x=e,s.y=i,0!==t.rotation&&Cl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ol=Phaser.GameObjects.Components.TransformMatrix;var Pl,Tl,kl={},_l=function(t,e,i,s,r){var n=wl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=kl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Pl&&(Pl=new Ol,Tl=new Ol),t.parentContainer?t.getWorldTransformMatrix(Pl,Tl):Pl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Pl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},El=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return _l(t,e,n,h,r)},Ml={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ml&&(ml={}),s=ml),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&fl(s,0,0,-i.rotation),s}(t,e,this,!0);return xl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return El(this.parent,this,t,e,i)}};Object.assign(Ml,gl);const Rl=Phaser.Math.DegToRad,Ll=Phaser.Math.RadToDeg,zl=Phaser.Utils.Objects.GetValue;class Dl extends vl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ll(this._rotation)}set angle(t){this.rotation=Rl(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=zl(t,"width",void 0),i=zl(t,"height",void 0),s=zl(t,"scaleX",void 0),r=zl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Dl.prototype,Ml);const Al=Phaser.Utils.String.Pad;var Yl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Al(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Xl=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Wl=Phaser.Utils.Objects.GetValue;let Bl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Wl(t,"x",0),i=Wl(t,"y",0));var s=this.cornerRadius;s.tl=jl(Wl(t,"tl",void 0),e,i),s.tr=jl(Wl(t,"tr",void 0),e,i),s.bl=jl(Wl(t,"bl",void 0),e,i),s.br=jl(Wl(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Il(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Il(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Il(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Il(this.cornerRadius.br,t)}};var jl=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Fl(t),t},Il=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Wl(e,"x",0),t.y=Wl(e,"y",0)),Fl(t)},Fl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Nl=Phaser.Math.DegToRad;var Hl=function(t){return!t.hasOwnProperty("convex")||t.convex},Gl=function(t){return t.x>0&&t.y>0},Vl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Gl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Vl(t,o,l,o,l,180,270,!1,h):Vl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Gl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Vl(t,s-o,l,o,l,270,360,!1,h):Vl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Gl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Vl(t,s-o,r-l,o,l,0,90,!1,h):Vl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Gl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Vl(t,o,r-l,o,l,90,180,!1,h):Vl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},$l=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ul(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Jl=Phaser.Utils.Objects.GetValue;class Kl extends Dl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Jl(e,"color",null),Jl(e,"color2",null),Jl(e,"horizontalGradient",!0)),this.setStroke(Jl(e,"stroke",null),Jl(e,"strokeThickness",2)),this.setCornerRadius(Jl(e,"cornerRadius",0),Jl(e,"cornerIteration",null))}set color(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Xl("color2",t,this),Xl("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Xl("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Xl("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){$l(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const ql=Phaser.Utils.Objects.GetValue;class Zl extends Dl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(ql(e,"color",null),ql(e,"color2",null),ql(e,"horizontalGradient",!0)),this.setStroke(ql(e,"stroke",null),ql(e,"strokeThickness",2))}set color(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Yl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,ql(t,"color2",null),ql(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ql(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ql=Phaser.Utils.Objects.GetValue;let td=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ql(t,"bold",!1)),this.setItalic(Ql(t,"italic",!1)),this.setFontSize(Ql(t,"fontSize","16px")),this.setFontFamily(Ql(t,"fontFamily","Courier")),this.setColor(Ql(t,"color","#fff")),this.setStrokeStyle(Ql(t,"stroke",null),Ql(t,"strokeThickness",0)),this.setShadow(Ql(t,"shadowColor",null),Ql(t,"shadowOffsetX",0),Ql(t,"shadowOffsetY",0),Ql(t,"shadowBlur",0)),this.setOffset(Ql(t,"offsetX",0),Ql(t,"offsetY",0)),this.setSpace(Ql(t,"leftSpace",0),Ql(t,"rightSpace",0)),this.setAlign(Ql(t,"align",void 0)),this.setBackgroundColor(Ql(t,"backgroundColor",null)),this.setBackgroundHeight(Ql(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ql(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Ql(t,"backgroundLeftX",0)),this.setBackgroundRightX(Ql(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Xl("stroke",t,this),Xl("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Xl("shadowOffsetX",t,this),Xl("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Yl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Yl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Yl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Yl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const ed=Phaser.Utils.Array.Remove,id=Phaser.Utils.Array.Remove,sd="text",rd="image",nd="drawer",hd="space",ad="command";var od=function(t){return t.type===sd&&"\n"===t.text},ld=function(t){return t.type===sd&&"\f"===t.text},dd=function(t){return t.type===sd};class cd extends Dl{constructor(t,e,i){super(t,sd),this.updateTextFlag=!1,this.style=new td(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ud=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const pd=Phaser.Display.Canvas.CanvasPool;var vd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=pd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),pd.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class gd extends Dl{constructor(t,e,i){super(t,rd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){vd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class fd extends Dl{constructor(t,e,i,s){super(t,nd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class md extends Dl{constructor(t,e){super(t,hd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class yd extends vl{constructor(t,e,i,s,r){super(t,ad),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function bd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>bd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=bd(t[i]));return e}var xd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Cd={none:0,word:1,char:2,character:2,mix:3};var Sd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Td.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Td.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_d(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=_d(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=_d(t,"wrapMode");void 0===c&&(c=_d(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Cd[c]);var u=_d(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_d(t,"letterSpacing",0),v=_d(t,"hAlign",0),g=_d(t,"vAlign",0),f=_d(t,"justifyPercentage",.25),m=xd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!z&&m.start===k,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Rd(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Rd(t,"maxLines",0);var a=0===i,o=Rd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Rd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Rd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Rd(t,"letterSpacing",0),p=Rd(t,"rtl",!0),v=Rd(t,"hAlign",p?2:0),g=Rd(t,"vAlign",0),f=xd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ed(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return id(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(sd);return null===i?i=new cd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),El(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ic=Phaser.Utils.Objects.GetFastValue;var sc={};class rc{constructor(t){this.pools=ic(t,"pools",sc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ec),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=uc(t,r,e,i,n),a=0;a<=lc&&0!==h;a++){if((r+=h)<0){r=0;break}h=uc(t,r,e,i,n)}return a===lc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),pc(t,e,i),t},cc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},uc=function(t,e,i,s,r){var n,h=cc(t,e,r),a=cc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},pc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const vc=Phaser.Utils.Objects.GetValue,gc=Phaser.Utils.Objects.GetValue;class fc extends Lo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=gc(e,"background",void 0),r=gc(e,"icon",void 0),n=gc(e,"iconMask",void 0),h=gc(e,"text",void 0),a=gc(e,"action",void 0),o=gc(e,"actionMask",void 0),l=gc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:gc(e,"space.icon",0),top:gc(e,"space.iconTop",0),bottom:gc(e,"space.iconBottom",0),left:gc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:gc(e,"space.icon",0),left:gc(e,"space.iconLeft",0),right:gc(e,"space.iconRight",0),top:gc(e,"space.iconTop",0)});var d=gc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Wo.call(this,r,r,1)),!d){var c=gc(e,"iconSize",void 0);this.setIconSize(gc(e,"iconWidth",c),gc(e,"iconHeight",c))}}if(h){var u=gc(e,"wrapText",!1),p=gc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(No(t)){case 0:switch("string"==typeof e&&(e=el[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Vo;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=el[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,oc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=vc(e,"minWidth",0),s=vc(e,"minHeight",0),r=vc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return dc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),dc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=gc(e,"space.text",0),m=gc(e,"expandTextWidth",!1),y=gc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:gc(e,"space.actionTop",0),bottom:gc(e,"space.actionBottom",0),right:gc(e,"space.actionRight",0)}:{left:gc(e,"space.actionLeft",0),right:gc(e,"space.actionRight",0),bottom:gc(e,"space.actionBottom",0)},d=gc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Wo.call(this,a,a,1)),!d)){var b=gc(e,"actionSize");this.setActionSize(gc(e,"actionWidth",b),gc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var mc=Phaser.Renderer.WebGL.Utils,yc=function(t,e,i,s,r,n){for(var h=mc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},wc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Oc=Phaser.Renderer.Canvas.SetTransform;var Pc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Cc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&yc(r,h,e,l,a,o),e.isStroked&&xc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Oc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(kc.prototype,Pc);var _c=function(t){return t.x>0&&t.y>0},Ec=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Mc=Phaser.Math.DegToRad;var Rc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Lu=Phaser.Utils.Objects.GetValue,zu=Phaser.Utils.Objects.IsPlainObject;class Du extends(nu(qc)){constructor(t,e,i,s,r,n,h,a){zu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):zu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):zu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Mu).setName("trackFill")).addShape((new Mu).setName("bar")).addShape((new Mu).setName("trackStroke")),this.setTrackColor(Lu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Lu(a,"trackStrokeThickness",2),Lu(a,"trackStrokeColor",void 0)),this.setSkewX(Lu(a,"skewX",0)),this.setRTL(Lu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Au={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ru(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ru(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ru(a,0,0,e,i,t)}};Object.assign(Du.prototype,Au);var Yu=function(t){return null==t||""===t||0===t.length},Xu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Yu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Yu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=bd(i),s=bd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return ep(t)?(this.stretchMode.edge=sp(ip(t,"edge",0)),this.stretchMode.internal=sp(ip(t,"internal",0))):(t=sp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return np.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const ap=Phaser.Utils.Objects.IsPlainObject,op=Phaser.Utils.Objects.GetValue,lp=Phaser.GameObjects;var dp=void 0,cp=function(t,e){if(dp||(dp={},ti(t).events.once("destroy",(function(){for(var t in dp)dp[t].destroy();dp=void 0}))),!dp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new lp[e](i)).setOrigin(0),dp[e]=t}return dp[e]};const up=Phaser.GameObjects.RenderTexture;class pp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ap(i)?(i=op(d=i,"x",0),s=op(d,"y",0),r=op(d,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(r)?(r=op(d=r,"width",1),n=op(d,"height",1),h=op(d,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(h)?(h=op(d=h,"key",void 0),a=op(d,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):ap(a)?(a=op(d=a,"baseFrame",void 0),o=op(d,"columns",void 0),l=op(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=op(d,"baseFrame",void 0)):ap(o)&&(o=op(d=o,"columns",void 0),l=op(d,"rows",void 0)),void 0===a&&(a=op(d,"frame",void 0)),void 0===o){var c=op(d,"leftWidth",void 0),u=op(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=op(d,"topHeight",void 0),v=op(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(op(d,"getFrameNameCallback",void 0)),this.setStretchMode(op(d,"stretchMode",0)),this.setPreserveRatio(op(d,"preserveRatio",!0));var g=op(d,"maxFixedPartScale",1),f=op(d,"maxFixedPartScaleX",g),m=op(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,hp),i}(up,"rexNinePatch")){}var vp={_drawImage:function(t,e,i,s,r,n){var h=cp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=cp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(pp.prototype,vp);let gp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ju(t,e))return t[e];var i=t.parent;return ju(i,e)?i[e]:void 0}set(t,e,i){return ju(t,e)?t[e]=i:ju(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const fp=Phaser.Utils.Objects.GetValue;class mp extends pp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=fp(e,"effects",!0);i&&Gu(this,i),this.style=new gp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(mp.prototype,Nc);const yp=["alpha","tint","flipX","flipY"];var bp=function(t,e){if(!e)return t;for(var i=0,s=yp.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Rp=Phaser.Display.Canvas.CanvasPool;var Lp=function(t){var e=Rp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Rp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Rp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==qo&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=el[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Dp(t,l,d);else{var u=zp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Dp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Dp(t,"fill",null);null!==v&&(this.color=Yl(v));var g=Dp(t,"metrics",!1);return g?this.metrics={ascent:Dp(g,"ascent",0),descent:Dp(g,"descent",0),fontSize:Dp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Lp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Lp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Dp(t,"fontFamily","Courier"),this.fontSize=Dp(t,"fontSize","16px"),this.fontStyle=Dp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Yl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Yl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Yl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Yl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Yl(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Yl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Yl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=el[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Dp(e,"fontFamily",this.fontFamily),this.fontSize=Dp(e,"fontSize",this.fontSize),this.fontStyle=Dp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Yp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),$l(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Xp=Phaser.Utils.Objects.GetValue,Wp=$o,Bp=Jo;class jp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Xp(t,"text",""),this.x=Xp(t,"x",0),this.y=Xp(t,"y",0),this.width=Xp(t,"width",0);var e=Xp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Xp(t,"newLineMode",0),this.startIndex=Xp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Bp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Wp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Bp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Ip=Phaser.Utils.Objects.GetFastValue,Fp=$o,Np=Ko;class Hp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Ip(t,"tagToText",Xt),this.tagToTextScope=Ip(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Gp={};const Vp=Phaser.Geom.Rectangle;var Up=new ec;class $p{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ov(g)){""!==b?h.push(n.getLine(b,x,ev)):0===C&&r>0&&h.push(n.getLine("",0,ev)),h.push(...hv(g,e,rv,s,0,n));var w=h.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,ev)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},av=function(t,e){var i;switch(e){case sv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==dv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Hp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const jg=Phaser.Utils.Objects.GetValue,Ig=Phaser.Math.Distance.Between;class Fg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=jg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(jg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(jg(t,"enable",!0)),this.holdThreshold=jg(t,"holdThreshold",50),this.pointerOutReleaseEnable=jg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ig(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Ng=Phaser.Utils.Objects.GetValue;class Hg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Ng(t,"value",0)),this.setSpeed(Ng(t,"speed",0)),this.setAcceleration(Ng(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Gg{constructor(){this.value,this.dir,this.movement=new Hg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Jg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Kg=Phaser.Utils.Objects.GetValue;class qg extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Kg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Kg(e,"speed",.1)),this.setEnable(Kg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Kg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Zg=Phaser.Utils.Objects.GetValue;var Qg=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Zg(s,l,void 0):Zg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Wg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Zg(r,"position",0);"string"==typeof p&&(p=tf[p]);var v,g,f=Zg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Zg(s,"space.slider",void 0))&&(a?f=0:v=Zg(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Zg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Zg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Zg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Zg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Zg(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Zg(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Zg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Zg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Zg(s,"scrollDetectionMode");"string"==typeof b&&(b=ef[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Zg(s,x,!0):Zg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new $g(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,T=Zg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==b&&(T.focus=1===b?2:0),C=new qg(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const tf={right:0,left:1,bottom:0,top:1},ef={gameObject:0,rectBounds:1},sf=Phaser.Utils.Objects.GetValue;var rf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=sf(e,"width"),h=sf(e,"height");n||sf(e,"child.expandWidth",!0)||(s[1]=0),h||sf(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lg(i,"child"),r=lg(s,"gameObject",void 0);if(r){var n=lg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=lg(n,"top",0),h.bottom=lg(n,"bottom",0),a.left=lg(n,"left",0),a.right=lg(n,"right",0);break;case 1:h.top=lg(n,"left",0),h.bottom=lg(n,"right",0),a.top=lg(n,"top",0),a.bottom=lg(n,"bottom",0);break;default:h.top=lg(n,"top",0),h.bottom=lg(n,"bottom",0),h.left=lg(n,"left",0),h.right=lg(n,"right",0)}e.add(r,{column:1,row:1,align:lg(s,"align","center"),padding:a,expand:{width:lg(s,"expandWidth",!0),height:lg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Qg(t,a,"y",e);break;case 1:Qg(t,a,"x",e);break;default:Qg(t,a,"y",e),Qg(t,a,"x",e)}return a},nf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},hf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},af=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(pf.call(this,-this.textOY)),0),e=vf.call(this,t)+this.textOY,i=gf.call(this,t);return function(t,e){switch(No(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,ff.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,yf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,ff.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const xf=Phaser.Utils.Objects.IsPlainObject,Cf=Phaser.Utils.Objects.GetValue,Sf=Phaser.Display.Align.TOP_LEFT;class wf extends rh{constructor(t,e,i,s,r,n){xf(e)?(e=Cf(n=e,"x",0),i=Cf(n,"y",0),s=Cf(n,"width",void 0),r=Cf(n,"height",void 0)):xf(s)&&(s=Cf(n=s,"width",void 0),r=Cf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Cf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Cf(n,"clampTextOY",!0)),this.alwaysScrollable=Cf(n,"alwaysScrollable",!1);var h=Cf(n,"background",void 0),a=Cf(n,"text",void 0);void 0===a&&(a=Of(t)),this.textCropEnable=Cf(n,"textCrop",!!a.setCrop);var o=Cf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Sf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=No(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Wo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(pf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=vf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Of=function(t){return t.add.text(0,0,"")};Object.assign(wf.prototype,bf);var Pf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Tf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const kf=Phaser.Utils.Objects.GetValue;class _f extends cf{constructor(t,e){void 0===e&&(e={});var i=kf(e,"text",void 0),s=kf(e,"textWidth",void 0),r=kf(e,"textHeight",void 0),n=kf(e,"textCrop",!!i.setCrop),h=kf(e,"textMask",!n),a=kf(e,"content",""),o=new wf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:kf(e,"clampChildOY",!1),alwaysScrollable:kf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=kf(e,"space",void 0);l&&(l.child=kf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(_f.prototype,Pf,Tf);const Ef=Phaser.Utils.Objects.GetValue;var Mf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new hg(t,e);break;case"bbcodetext":case"bbcode":s=new ig(t,0,0,"",e);break;case"label":s=new zf(t,e);break;case"textarea":s=function(t,e,i){e=e?bd(e):{};var s=Ef(i,"background",xp),r=Ef(i,"text",Mf),n=Ef(i,"track",xp),h=Ef(i,"thumb",xp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new _f(t,e);return t.add.existing(o),o}(t,e);break;default:s=new wp(t,e)}return bp(s,e),t.add.existing(s),s},Rf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new mp(t,e):new Ju(t,e);break;case"roundRectangle":s=new Hc(t,e);break;default:s=new Qu(t,e)}return bp(s,e),t.add.existing(s),s};const Lf=Phaser.Utils.Objects.GetValue;class zf extends fc{constructor(t,e,i){e=function(t,e,i){e=e?bd(e):{};var s=Lf(i,"background",xp),r=Lf(i,"text",Mf),n=Lf(i,"icon",Rf),h=Lf(i,"action",Rf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Df(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Df(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Df(this.getChildren(),"setDisableState",t),this}}var Df=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(em(this),im(this)),this}setNumberInput(){return this.onUpdateCallback=tm,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const nm=Phaser.Utils.Objects.GetValue,hm=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var am=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}vm.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(gm(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const fm=new vm,mm=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,ym=/\S/,bm=new vm;bm.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ym.test(t)&&!ym.test(e)},bm.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(wm(t,null,null,i),i," ")},Sm.equals=function(t,e){return vm.prototype.equals.call(Sm,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Om=new vm;Om.tokenize=function(t){return t.slice()},Om.join=Om.removeEmpty=function(t){return t};const Pm=Phaser.Utils.Array.Remove;var Tm=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Pm(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,fm.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Rm={cursorMoveLeft(){if(!this.isOpened)return this;var t=_m(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=_m(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Em(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=_m(Mm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Em(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=_m(Mm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Lm=Phaser.Utils.Objects.IsPlainObject;class zm extends ac{constructor(t,e,i,s,r,n){Lm(e)?n=e:Lm(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(am(e,"wrap.vAlign")||Xu(e,"wrap.vAlign",s=i?"center":"top"),am(e,"wrap.wrapMode")||Xu(e,"wrap.wrapMode","char"),am(e,"wrap.maxLines")||Xu(e,"wrap.maxLines",s=i?1:void 0),i&&Xu(e,"wrap.wrapWidth",1/0),am(e,"wrap.useDefaultTextHeight")||Xu(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!am(e.edit,"inputType")){var s=i?"text":"textarea";Xu(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new lm(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Xc(n.background,"focus"),o=Xc(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=nm(e,"edit");return void 0===i&&(i={}),Wf(e,i,hm),new rm(t,i)}(this,n),dm.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),pm.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),um.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;so;d--){for(c=0;c0&&this.wrapMode!==qo&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=el[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Dp(t,l,d);else{var u=zp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Dp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Dp(t,"fill",null);null!==v&&(this.color=Yl(v));var g=Dp(t,"metrics",!1);return g?this.metrics={ascent:Dp(g,"ascent",0),descent:Dp(g,"descent",0),fontSize:Dp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Lp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Lp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Dp(t,"fontFamily","Courier"),this.fontSize=Dp(t,"fontSize","16px"),this.fontStyle=Dp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Yl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Yl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Yl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Yl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Yl(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Yl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Yl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Yl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=el[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Dp(e,"fontFamily",this.fontFamily),this.fontSize=Dp(e,"fontSize",this.fontSize),this.fontStyle=Dp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Yp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),$l(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Xp=Phaser.Utils.Objects.GetValue,Wp=$o,Bp=Jo;class jp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Xp(t,"text",""),this.x=Xp(t,"x",0),this.y=Xp(t,"y",0),this.width=Xp(t,"width",0);var e=Xp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Xp(t,"newLineMode",0),this.startIndex=Xp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Bp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Wp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Bp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Ip=Phaser.Utils.Objects.GetFastValue,Fp=$o,Np=Ko;class Hp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Ip(t,"tagToText",Xt),this.tagToTextScope=Ip(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Gp={};const Vp=Phaser.Geom.Rectangle;var Up=new ec;class $p{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ov(g)){""!==b?h.push(n.getLine(b,x,ev)):0===C&&r>0&&h.push(n.getLine("",0,ev)),h.push(...hv(g,e,rv,s,0,n));var w=h.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,ev)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},av=function(t,e){var i;switch(e){case sv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==dv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Hp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const jg=Phaser.Utils.Objects.GetValue,Ig=Phaser.Math.Distance.Between;class Fg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=jg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(jg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(jg(t,"enable",!0)),this.holdThreshold=jg(t,"holdThreshold",50),this.pointerOutReleaseEnable=jg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ig(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Ng=Phaser.Utils.Objects.GetValue;class Hg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Ng(t,"value",0)),this.setSpeed(Ng(t,"speed",0)),this.setAcceleration(Ng(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Gg{constructor(){this.value,this.dir,this.movement=new Hg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Jg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Kg=Phaser.Utils.Objects.GetValue;class qg extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Kg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Kg(e,"speed",.1)),this.setEnable(Kg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Kg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Zg=Phaser.Utils.Objects.GetValue;var Qg=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Zg(s,l,void 0):Zg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Wg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Zg(r,"position",0);"string"==typeof p&&(p=tf[p]);var v,g,f=Zg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Zg(s,"space.slider",void 0))&&(a?f=0:v=Zg(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Zg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Zg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Zg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Zg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Zg(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Zg(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Zg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Zg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Zg(s,"scrollDetectionMode");"string"==typeof b&&(b=ef[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Zg(s,x,!0):Zg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new $g(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,T=Zg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==b&&(T.focus=1===b?2:0),C=new qg(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const tf={right:0,left:1,bottom:0,top:1},ef={gameObject:0,rectBounds:1},sf=Phaser.Utils.Objects.GetValue;var rf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=sf(e,"width"),h=sf(e,"height");n||sf(e,"child.expandWidth",!0)||(s[1]=0),h||sf(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lg(i,"child"),r=lg(s,"gameObject",void 0);if(r){var n=lg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=lg(n,"top",0),h.bottom=lg(n,"bottom",0),a.left=lg(n,"left",0),a.right=lg(n,"right",0);break;case 1:h.top=lg(n,"left",0),h.bottom=lg(n,"right",0),a.top=lg(n,"top",0),a.bottom=lg(n,"bottom",0);break;default:h.top=lg(n,"top",0),h.bottom=lg(n,"bottom",0),h.left=lg(n,"left",0),h.right=lg(n,"right",0)}e.add(r,{column:1,row:1,align:lg(s,"align","center"),padding:a,expand:{width:lg(s,"expandWidth",!0),height:lg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Qg(t,a,"y",e);break;case 1:Qg(t,a,"x",e);break;default:Qg(t,a,"y",e),Qg(t,a,"x",e)}return a},nf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},hf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},af=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(pf.call(this,-this.textOY)),0),e=vf.call(this,t)+this.textOY,i=gf.call(this,t);return function(t,e){switch(No(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,ff.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,yf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,ff.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const xf=Phaser.Utils.Objects.IsPlainObject,Cf=Phaser.Utils.Objects.GetValue,Sf=Phaser.Display.Align.TOP_LEFT;class wf extends rh{constructor(t,e,i,s,r,n){xf(e)?(e=Cf(n=e,"x",0),i=Cf(n,"y",0),s=Cf(n,"width",void 0),r=Cf(n,"height",void 0)):xf(s)&&(s=Cf(n=s,"width",void 0),r=Cf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Cf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Cf(n,"clampTextOY",!0)),this.alwaysScrollable=Cf(n,"alwaysScrollable",!1);var h=Cf(n,"background",void 0),a=Cf(n,"text",void 0);void 0===a&&(a=Of(t)),this.textCropEnable=Cf(n,"textCrop",!!a.setCrop);var o=Cf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Sf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=No(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Wo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(pf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=vf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Of=function(t){return t.add.text(0,0,"")};Object.assign(wf.prototype,bf);var Pf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Tf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const kf=Phaser.Utils.Objects.GetValue;class _f extends cf{constructor(t,e){void 0===e&&(e={});var i=kf(e,"text",void 0),s=kf(e,"textWidth",void 0),r=kf(e,"textHeight",void 0),n=kf(e,"textCrop",!!i.setCrop),h=kf(e,"textMask",!n),a=kf(e,"content",""),o=new wf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:kf(e,"clampChildOY",!1),alwaysScrollable:kf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=kf(e,"space",void 0);l&&(l.child=kf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(_f.prototype,Pf,Tf);const Ef=Phaser.Utils.Objects.GetValue;var Mf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new hg(t,e);break;case"bbcodetext":case"bbcode":s=new ig(t,0,0,"",e);break;case"label":s=new zf(t,e);break;case"textarea":s=function(t,e,i){e=e?bd(e):{};var s=Ef(i,"background",xp),r=Ef(i,"text",Mf),n=Ef(i,"track",xp),h=Ef(i,"thumb",xp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new _f(t,e);return t.add.existing(o),o}(t,e);break;default:s=new wp(t,e)}return bp(s,e),t.add.existing(s),s},Rf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new mp(t,e):new Ju(t,e);break;case"roundRectangle":s=new Hc(t,e);break;default:s=new Qu(t,e)}return bp(s,e),t.add.existing(s),s};const Lf=Phaser.Utils.Objects.GetValue;class zf extends fc{constructor(t,e,i){e=function(t,e,i){e=e?bd(e):{};var s=Lf(i,"background",xp),r=Lf(i,"text",Mf),n=Lf(i,"icon",Rf),h=Lf(i,"action",Rf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Df(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Df(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Df(this.getChildren(),"setDisableState",t),this}}var Df=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(em(this),im(this)),this}setNumberInput(){return this.onUpdateCallback=tm,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const nm=Phaser.Utils.Objects.GetValue,hm=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var am=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}gm.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(fm(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const mm=new gm,ym=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,bm=/\S/,xm=new gm;xm.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!bm.test(t)&&!bm.test(e)},xm.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Om(t,null,null,i),i," ")},wm.equals=function(t,e){return gm.prototype.equals.call(wm,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Pm=new gm;Pm.tokenize=function(t){return t.slice()},Pm.join=Pm.removeEmpty=function(t){return t};const Tm=Phaser.Utils.Array.Remove;var km=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Tm(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,mm.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Lm={cursorMoveLeft(){if(!this.isOpened)return this;var t=Em(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Em(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Mm(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Em(Rm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Mm(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Em(Rm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const zm=Phaser.Utils.Objects.IsPlainObject;class Dm extends ac{constructor(t,e,i,s,r,n){zm(e)?n=e:zm(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(am(e,"wrap.vAlign")||Xu(e,"wrap.vAlign",s=i?"center":"top"),am(e,"wrap.wrapMode")||Xu(e,"wrap.wrapMode","char"),am(e,"wrap.maxLines")||Xu(e,"wrap.maxLines",s=i?1:void 0),i&&Xu(e,"wrap.wrapWidth",1/0),am(e,"wrap.useDefaultTextHeight")||Xu(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!am(e.edit,"inputType")){var s=i?"text":"textarea";Xu(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new lm(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Xc(n.background,"focus"),o=Xc(n.style,"cursor"),l=Xc(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=nm(e,"edit");return void 0===i&&(i={}),Wf(e,i,hm),new rm(t,i)}(this,n),dm.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),vm.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),um.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),cm(l)&&Object.assign(l,o),pm.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rexsimpledropdownlist.min.js b/dist/rexsimpledropdownlist.min.js index 9c2f6efda3..7aaa255782 100644 --- a/dist/rexsimpledropdownlist.min.js +++ b/dist/rexsimpledropdownlist.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},X=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ye={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Xe=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class ki extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Oi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends ki{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Ri=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Li=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Yi=function(t){return Di(t,"complete")};const Xi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Xi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Yi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Xi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Yi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Yi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Xi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Yi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Ai),zi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Gi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Yi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Yi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Yi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ki(t,"x",void 0),i=Ki(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ki(i,"startX",void 0),this.startY=Ki(i,"startY",void 0),this.endX=Ki(i,"endX",void 0),this.endY=Ki(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Yi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Yi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Yi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Yi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Yi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends ki{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Di(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ws={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,zs,Ws,Bs,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Is);var Gs=function(t){if(t.parentContainer)return Gs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Gs(e):t};class Ns extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Gs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Vs=Phaser.GameObjects.Rectangle;class Us extends Vs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ks[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ks={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e,t.alpha)},er=function(t,e){Ni(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Rr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Dr extends Xs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Yr=Phaser.Utils.Objects.GetValue;class Xr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Yr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Yr(t,"enable",!0)),this.setCooldown(Yr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Xr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Xr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Wr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=On},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cn(t,"threshold",10)),this.setVelocityThreshold(Cn(t,"velocityThreshold",1e3)),this.setDirectionMode(Cn(t,"dir","8dir")),this}onDragStart(){this.state=kn}onDragEnd(){this.state=On}onDrag(){this.state===kn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=On)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=bn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=xn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,yn);const On="IDLE",kn="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Dn:this.tracerState=Yn,this.onDrag1Start();break;case Yn:this.tracerState=Xn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Yn:this.tracerState=Dn,this.onDrag1End();break;case Xn:this.tracerState=Yn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Yn:this.onDrag1();break;case Xn:this.onDrag2()}}}dragCancel(){return this.tracerState===Xn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Je);var Ln={};const Dn=0,Yn=1,Xn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Wn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Bn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Gn=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Gn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Vn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Gr.call(t,e),Ur.call(t,e),qr.call(t,e),Kn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Yt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const yh=Mt.prototype.clear;var bh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),yh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},wh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Sh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Oh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},kh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,mh,Ch,wh,Sh,Oh,kh);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue;class Lh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Rh(h=e,"x",0),i=Rh(h,"y",0),s=Rh(h,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(s)?(s=Rh(h=s,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(n)&&(n=Rh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Rh(h,"space.item",0)),this.setStartChildIndex(Rh(h,"startChildIndex",0)),this.setRTL(Rh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Lh.prototype,Ph);var Dh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Yh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Xh={appendText:Yh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ah extends Lh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Dh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Dh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Dh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Dh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ah.prototype,Xh);var zh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Wh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Bh=Phaser.GameObjects.Graphics;class jh extends Bh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ih[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=fe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Wh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&yt(i,this.padding),this.originX=s.originX,this.originY=s.originY,zh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,zh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ih={rectangle:0,circle:1};var Fh=function(t,e,i,s){var r=new jh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Hh=Phaser.GameObjects.Text;var Gh=function(t){return t instanceof Hh};const Nh=Phaser.GameObjects.BitmapText;var Vh=function(t){return t instanceof Nh},Uh=function(t){return Vh(t)?2:Gh(t)?0:1},$h=/^[\x00-\x7F]+$/,Jh=function(t){return $h.test(t)},Kh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Zh=0,Qh=1,ta=2,ea=0,ia=1,sa=2,ra=/(?:\r\n|\r|\n)/;const na={none:ea,word:ia,char:sa,character:sa,mix:3},ha=Phaser.Renderer.WebGL.Utils;var aa={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ha.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const oa=Phaser.Display.Color;var la={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new oa);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},da=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},ca={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,da(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ua=Phaser.Display.Canvas.CanvasPool,pa=Phaser.GameObjects.GameObject,va=Phaser.Utils.String.UUID;class ga extends pa{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ua.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=va(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ua.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const fa=Phaser.GameObjects.Components;Phaser.Class.mixin(ga,[fa.Alpha,fa.BlendMode,fa.Crop,fa.Depth,fa.Flip,fa.GetBounds,fa.Mask,fa.Origin,fa.Pipeline,fa.PostPipeline,fa.ScrollFactor,fa.Tint,fa.Transform,fa.Visible,aa,la,ca]);var ma={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class ya{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ya.prototype,ma);var ba={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const xa=Phaser.Math.RotateAround;var Ca;const wa=Phaser.Geom.Rectangle;var Sa,Oa=function(t){void 0===Sa&&(Sa=new wa);var e=t.drawTLX,i=t.drawTLY;return Sa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Sa};const ka=Phaser.Math.RotateAround;var Pa,_a=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Pa&&(Pa={}),s=Pa),s.x=e,s.y=i,0!==t.rotation&&ka(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ta=Phaser.GameObjects.Components.TransformMatrix;var Ea,Ma,Ra={},La=function(t,e,i,s,r){var n=_a(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ra);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ea&&(Ea=new Ta,Ma=new Ta),t.parentContainer?t.getWorldTransformMatrix(Ea,Ma):Ea.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ea.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Da=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return La(t,e,n,h,r)},Ya={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ca&&(Ca={}),s=Ca),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&xa(s,0,0,-i.rotation),s}(t,e,this,!0);return Oa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Da(this.parent,this,t,e,i)}};Object.assign(Ya,ba);const Xa=Phaser.Math.DegToRad,Aa=Phaser.Math.RadToDeg,za=Phaser.Utils.Objects.GetValue;class Wa extends ya{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Aa(this._rotation)}set angle(t){this.rotation=Xa(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=za(t,"width",void 0),i=za(t,"height",void 0),s=za(t,"scaleX",void 0),r=za(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Wa.prototype,Ya);const Ba=Phaser.Utils.String.Pad;var ja=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ba(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ia=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Fa=Phaser.Utils.Objects.GetValue;let Ha=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Fa(t,"x",0),i=Fa(t,"y",0));var s=this.cornerRadius;s.tl=Ga(Fa(t,"tl",void 0),e,i),s.tr=Ga(Fa(t,"tr",void 0),e,i),s.bl=Ga(Fa(t,"bl",void 0),e,i),s.br=Ga(Fa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Na(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Na(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Na(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Na(this.cornerRadius.br,t)}};var Ga=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Va(t),t},Na=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Fa(e,"x",0),t.y=Fa(e,"y",0)),Va(t)},Va=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ua=Phaser.Math.DegToRad;var $a=function(t){return!t.hasOwnProperty("convex")||t.convex},Ja=function(t){return t.x>0&&t.y>0},Ka=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ja(a)?(o=a.x*g,l=a.y*f,$a(a)?Ka(t,o,l,o,l,180,270,!1,h):Ka(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ja(a)?(o=a.x*g,l=a.y*f,$a(a)?Ka(t,s-o,l,o,l,270,360,!1,h):Ka(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ja(a)?(o=a.x*g,l=a.y*f,$a(a)?Ka(t,s-o,r-l,o,l,0,90,!1,h):Ka(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ja(a)?(o=a.x*g,l=a.y*f,$a(a)?Ka(t,o,r-l,o,l,90,180,!1,h):Ka(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Za=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),qa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Qa=Phaser.Utils.Objects.GetValue;class to extends Wa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Qa(e,"color",null),Qa(e,"color2",null),Qa(e,"horizontalGradient",!0)),this.setStroke(Qa(e,"stroke",null),Qa(e,"strokeThickness",2)),this.setCornerRadius(Qa(e,"cornerRadius",0),Qa(e,"cornerIteration",null))}set color(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ja(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ia("color2",t,this),Ia("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ia("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ia("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Za(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const eo=Phaser.Utils.Objects.GetValue;class io extends Wa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(eo(e,"color",null),eo(e,"color2",null),eo(e,"horizontalGradient",!0)),this.setStroke(eo(e,"stroke",null),eo(e,"strokeThickness",2))}set color(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ja(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,eo(t,"color2",null),eo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,eo(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const so=Phaser.Utils.Objects.GetValue;let ro=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(so(t,"bold",!1)),this.setItalic(so(t,"italic",!1)),this.setFontSize(so(t,"fontSize","16px")),this.setFontFamily(so(t,"fontFamily","Courier")),this.setColor(so(t,"color","#fff")),this.setStrokeStyle(so(t,"stroke",null),so(t,"strokeThickness",0)),this.setShadow(so(t,"shadowColor",null),so(t,"shadowOffsetX",0),so(t,"shadowOffsetY",0),so(t,"shadowBlur",0)),this.setOffset(so(t,"offsetX",0),so(t,"offsetY",0)),this.setSpace(so(t,"leftSpace",0),so(t,"rightSpace",0)),this.setAlign(so(t,"align",void 0)),this.setBackgroundColor(so(t,"backgroundColor",null)),this.setBackgroundHeight(so(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(so(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ia("stroke",t,this),Ia("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ia("shadowOffsetX",t,this),Ia("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ja(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ja(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ja(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ja(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const no=Phaser.Utils.Array.Remove,ho=Phaser.Utils.Array.Remove,ao="text",oo="image",lo="drawer",co="space",uo="command";var po=function(t){return t.type===ao&&"\n"===t.text},vo=function(t){return t.type===ao&&"\f"===t.text},go=function(t){return t.type===ao};class fo extends Wa{constructor(t,e,i){super(t,ao),this.updateTextFlag=!1,this.style=new ro(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var mo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const yo=Phaser.Display.Canvas.CanvasPool;var bo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=yo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),yo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class xo extends Wa{constructor(t,e,i){super(t,oo),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){bo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Co extends Wa{constructor(t,e,i,s){super(t,lo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class wo extends Wa{constructor(t,e){super(t,co),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class So extends ya{constructor(t,e,i,s,r){super(t,uo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Oo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Oo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Oo(t[i]));return e}var ko=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Po={none:0,word:1,char:2,character:2,mix:3};var _o=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Ro.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Ro.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Do(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Do(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Do(t,"wrapMode");void 0===c&&(c=Do(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Po[c]);var u=Do(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Do(t,"letterSpacing",0),v=Do(t,"hAlign",0),g=Do(t,"vAlign",0),f=Do(t,"justifyPercentage",.25),m=ko({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=T.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ao(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ao(t,"maxLines",0);var a=0===i,o=Ao(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ao(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ao(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ao(t,"letterSpacing",0),p=Ao(t,"rtl",!0),v=Ao(t,"hAlign",p?2:0),g=Ao(t,"vAlign",0),f=ko({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(T.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=T.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Le(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),no(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ho(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ao);return null===i?i=new fo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Da(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const al=Phaser.Utils.Objects.GetFastValue;var ol={};class ll{constructor(t){this.pools=al(t,"pools",ol)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new hl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=ml(t,r,e,i,n),a=0;a<=vl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ml(t,r,e,i,n)}return a===vl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),yl(t,e,i),t},fl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ml=function(t,e,i,s,r){var n,h=fl(t,e,r),a=fl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},yl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const bl=Phaser.Utils.Objects.GetValue,xl=Phaser.Utils.Objects.GetValue;class Cl extends Ah{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=xl(e,"background",void 0),r=xl(e,"icon",void 0),n=xl(e,"iconMask",void 0),h=xl(e,"text",void 0),a=xl(e,"action",void 0),o=xl(e,"actionMask",void 0),l=xl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:xl(e,"space.icon",0),top:xl(e,"space.iconTop",0),bottom:xl(e,"space.iconBottom",0),left:xl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:xl(e,"space.icon",0),left:xl(e,"space.iconLeft",0),right:xl(e,"space.iconRight",0),top:xl(e,"space.iconTop",0)});var d=xl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Fh.call(this,r,r,1)),!d){var c=xl(e,"iconSize",void 0);this.setIconSize(xl(e,"iconWidth",c),xl(e,"iconHeight",c))}}if(h){var u=xl(e,"wrapText",!1),p=xl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Uh(t)){case 0:switch("string"==typeof e&&(e=na[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Kh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=na[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,pl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=bl(e,"minWidth",0),s=bl(e,"minHeight",0),r=bl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return gl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),gl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=xl(e,"space.text",0),m=xl(e,"expandTextWidth",!1),y=xl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:xl(e,"space.actionTop",0),bottom:xl(e,"space.actionBottom",0),right:xl(e,"space.actionRight",0)}:{left:xl(e,"space.actionLeft",0),right:xl(e,"space.actionRight",0),bottom:xl(e,"space.actionBottom",0)},d=xl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Fh.call(this,a,a,1)),!d)){var b=xl(e,"actionSize");this.setActionSize(xl(e,"actionWidth",b),xl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var wl={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=Sl[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const Sl={down:0,up:1},Ol=Lh.prototype.add,kl=Lh.prototype.addSpace;var Pl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&kl.call(this),Ol.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&kl.call(this),this.hasTailSpace=s}else Ol.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Ol.call(this,t,{index:r,proportion:i,expand:!0})}else Ol.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},_l={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Ml.call(this,e[i],t);return this}},Ll=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Dl=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Ll.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Yl={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Dl.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=$l(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=$l(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Kl=Phaser.Utils.Objects.IsPlainObject,ql=Phaser.Utils.Objects.GetValue,Zl=Phaser.Display.Align.CENTER;var Ql=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),Kl(e)&&(e=ql(o=e,"padding",0),i=ql(o,"key",void 0),s=ql(o,"index",void 0),r=ql(o,"offsetX",0),n=ql(o,"offsetY",0),h=ql(o,"offsetOriginX",0),a=ql(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Zl,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},td={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},sd={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&dd.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)gd.call(this,e[i],t);return this}};const md=Phaser.Utils.Objects.GetValue;class yd extends od{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Il({parent:this,eventEmitter:md(e,"eventEmitter",this),groupName:md(e,"groupName",void 0),clickConfig:md(e,"click",void 0)}).setButtonsType(e);var s=md(e,"background",void 0),r=md(e,"buttons",void 0);this.buttonsAlign=md(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(yd.prototype,ud,fd,jl,Hl);var bd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},xd=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Cd(t));var i=t[e];return"string"==typeof i&&(i=bd[i]),i},Cd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},wd=function(){return Array.prototype.reduce.call(arguments,Sd,0)},Sd=function(t,e){return t+e};const Od=Phaser.Utils.Objects.IsPlainObject,kd=Phaser.Utils.Objects.GetValue,Pd=Phaser.Display.Align.CENTER;var _d=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ed(this.sizerChildren,null),bh.call(this,t),this}},Rd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ed(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Xd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ed(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ed(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},zd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Wd=Phaser.Utils.Objects.IsPlainObject,Bd=Phaser.Utils.Objects.GetValue;class jd extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Wd(e)?(e=Bd(l=e,"x",0),i=Bd(l,"y",0),s=Bd(l,"width",void 0),r=Bd(l,"height",void 0),n=Bd(l,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(s)?(s=Bd(l=s,"width",void 0),r=Bd(l,"height",void 0),n=Bd(l,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(n)?(n=Bd(l=n,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(a)&&(a=Bd(l=a,"columnProportions",0),o=Bd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bd(l,"createCellContainerCallback")),this.setIndentLeft(Bd(l,"space.indentLeftOdd",0),Bd(l,"space.indentLeftEven",0)),this.setIndentTop(Bd(l,"space.indentTopOdd",0),Bd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bd(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Ad.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=zd.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(jd.prototype,Xd);const Id=Phaser.Utils.Objects.GetValue;var Fd=Phaser.Renderer.WebGL.Utils,Hd=function(t,e,i,s,r,n){for(var h=Fd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},$d=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Jd=Phaser.Renderer.Canvas.SetTransform;var Kd={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Hd(r,h,e,l,a,o),e.isStroked&&Nd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Jd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Zd.prototype,Kd);var Qd=function(t){return t.x>0&&t.y>0},tc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ec=Phaser.Math.DegToRad;var ic=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const eu=Phaser.Utils.Objects.GetValue,iu=Phaser.Utils.Objects.IsPlainObject;class su extends(Tc(xc)){constructor(t,e,i,s,r,n,h,a){iu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):iu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):iu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Qc).setName("trackFill")).addShape((new Qc).setName("bar")).addShape((new Qc).setName("trackStroke")),this.setTrackColor(eu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(eu(a,"trackStrokeThickness",2),eu(a,"trackStrokeColor",void 0)),this.setSkewX(eu(a,"skewX",0)),this.setRTL(eu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ru={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&tu(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),tu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&tu(a,0,0,e,i,t)}};Object.assign(su.prototype,ru);var nu=function(t){return null==t||""===t||0===t.length},hu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(nu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(nu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Oo(i),s=Oo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Ou(t)?(this.stretchMode.edge=Pu(ku(t,"edge",0)),this.stretchMode.internal=Pu(ku(t,"internal",0))):(t=Pu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Tu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Mu=Phaser.Utils.Objects.IsPlainObject,Ru=Phaser.Utils.Objects.GetValue,Lu=Phaser.GameObjects;var Du=void 0,Yu=function(t,e){if(Du||(Du={},ei(t).events.once("destroy",(function(){for(var t in Du)Du[t].destroy();Du=void 0}))),!Du.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Lu[e](i)).setOrigin(0),Du[e]=t}return Du[e]};const Xu=Phaser.GameObjects.RenderTexture;class Au extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Mu(i)?(i=Ru(d=i,"x",0),s=Ru(d,"y",0),r=Ru(d,"width",1),n=Ru(d,"height",1),h=Ru(d,"key",void 0),a=Ru(d,"baseFrame",void 0),o=Ru(d,"columns",void 0),l=Ru(d,"rows",void 0)):Mu(r)?(r=Ru(d=r,"width",1),n=Ru(d,"height",1),h=Ru(d,"key",void 0),a=Ru(d,"baseFrame",void 0),o=Ru(d,"columns",void 0),l=Ru(d,"rows",void 0)):Mu(h)?(h=Ru(d=h,"key",void 0),a=Ru(d,"baseFrame",void 0),o=Ru(d,"columns",void 0),l=Ru(d,"rows",void 0)):Mu(a)?(a=Ru(d=a,"baseFrame",void 0),o=Ru(d,"columns",void 0),l=Ru(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Ru(d,"baseFrame",void 0)):Mu(o)&&(o=Ru(d=o,"columns",void 0),l=Ru(d,"rows",void 0)),void 0===a&&(a=Ru(d,"frame",void 0)),void 0===o){var c=Ru(d,"leftWidth",void 0),u=Ru(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Ru(d,"topHeight",void 0),v=Ru(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Ru(d,"getFrameNameCallback",void 0)),this.setStretchMode(Ru(d,"stretchMode",0)),this.setPreserveRatio(Ru(d,"preserveRatio",!0));var g=Ru(d,"maxFixedPartScale",1),f=Ru(d,"maxFixedPartScaleX",g),m=Ru(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Eu),i}(Xu,"rexNinePatch")){}var zu={_drawImage:function(t,e,i,s,r,n){var h=Yu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Yu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Au.prototype,zu);let Wu=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(lu(t,e))return t[e];var i=t.parent;return lu(i,e)?i[e]:void 0}set(t,e,i){return lu(t,e)?t[e]=i:lu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Bu=Phaser.Utils.Objects.GetValue;class ju extends Au{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Bu(e,"effects",!0);i&&vu(this,i),this.style=new Wu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(ju.prototype,uc);const Iu=["alpha","tint","flipX","flipY"];var Fu=function(t,e){if(!e)return t;for(var i=0,s=Iu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const xp=Phaser.Utils.Objects.GetValue,Cp=Phaser.Math.Distance.Between;class wp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=xp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(xp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(xp(t,"enable",!0)),this.holdThreshold=xp(t,"holdThreshold",50),this.pointerOutReleaseEnable=xp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Cp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Sp=Phaser.Utils.Objects.GetValue;class Op{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Sp(t,"value",0)),this.setSpeed(Sp(t,"speed",0)),this.setAcceleration(Sp(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class kp{constructor(){this.value,this.dir,this.movement=new Op}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Ep={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Mp=Phaser.Utils.Objects.GetValue;class Rp extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Mp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Mp(e,"speed",.1)),this.setEnable(Mp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Mp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Lp=Phaser.Utils.Objects.GetValue;var Dp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Lp(s,l,void 0):Lp(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new yp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Lp(r,"position",0);"string"==typeof p&&(p=Yp[p]);var v,g,f=Lp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Lp(s,"space.slider",void 0))&&(a?f=0:v=Lp(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Lp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Lp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Lp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Lp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Lp(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Lp(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Lp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Lp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Lp(s,"scrollDetectionMode");"string"==typeof b&&(b=Xp[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Lp(s,x,!0):Lp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Tp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,k,P=Lp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Rp(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Yp={right:0,left:1,bottom:0,top:1},Xp={gameObject:0,rectBounds:1},Ap=Phaser.Utils.Objects.GetValue;var zp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ap(e,"width"),h=Ap(e,"height");n||Ap(e,"child.expandWidth",!0)||(s[1]=0),h||Ap(e,"child.expandHeight",!0)||(r[1]=0);var a=new jd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Id(i,"child"),r=Id(s,"gameObject",void 0);if(r){var n=Id(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Id(n,"top",0),h.bottom=Id(n,"bottom",0),a.left=Id(n,"left",0),a.right=Id(n,"right",0);break;case 1:h.top=Id(n,"left",0),h.bottom=Id(n,"right",0),a.top=Id(n,"top",0),a.bottom=Id(n,"bottom",0);break;default:h.top=Id(n,"top",0),h.bottom=Id(n,"bottom",0),h.left=Id(n,"left",0),h.right=Id(n,"right",0)}e.add(r,{column:1,row:1,align:Id(s,"align","center"),padding:a,expand:{width:Id(s,"expandWidth",!0),height:Id(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Dp(t,a,"y",e);break;case 1:Dp(t,a,"x",e);break;default:Dp(t,a,"y",e),Dp(t,a,"x",e)}return a},Wp=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Bp=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},jp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(av.prototype,sv);const ov=["top","bottom","centerY","center"],lv=["left","right","centerX","center"];var dv=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=ov.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=lv.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const cv=Phaser.Utils.Objects.GetValue;class uv extends Gp{constructor(t,e){void 0===e&&(e={});var i=xd(e),s=cv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=cv(e,"clampChildOY",!1),s.clampChildOX=cv(e,"clampChildOX",!1);var r,n,h=new av(t,s);switch(t.add.existing(h),i){case 0:r=cv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=cv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:cv(e,"align.panel","center")};var a=cv(e,"space",void 0);a&&(a.child=cv(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ih(this.childrenMap.child,t),this}}var pv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:dv.call(this,t,"y",e);break;case 1:dv.call(this,t,"x",e);break;default:dv.call(this,t,"y",e),dv.call(this,t,"x",e)}return this}};Object.assign(uv.prototype,pv);const vv=Phaser.Utils.Objects.GetValue;var gv=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=fv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=mv(e,this.listCreateSliderTrackCallback),v=mv(e,this.listCreateSliderThumbCallback);d=new uv(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:vv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=fv(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},fv=function(t,e,i){var s;return i?(e.orientation="x",s=new yd(t,e)):(e.orientation="y",s=new Nl(t,e)),t.add.existing(s),s},mv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},yv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rx.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Cv={down:0,up:1},wv=Phaser.Utils.Objects.GetValue;class Sv extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),xv(t,e),t.isRexSizer&&t.layout();var i=wv(e,"touchOutsideClose",!1),s=wv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ov={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},kv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=gv.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Sv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(kv,wl,Ov);const Pv=Phaser.Utils.Objects.GetValue;class _v extends Cl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(Pv(e,"options"));var i=Pv(e,"list");this.setWrapEnable(Pv(i,"wrap",!1)),this.setCreateButtonCallback(Pv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(Pv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(Pv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(Pv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(Pv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(Pv(i,"scroller")),this.setListMouseWheelScrollerConfig(Pv(i,"mouseWheelScroller")),this.setButtonClickCallback(Pv(i,"onButtonClick")),this.setButtonOverCallback(Pv(i,"onButtonOver")),this.setButtonOutCallback(Pv(i,"onButtonOut")),this.setListExpandDirection(Pv(i,"expandDirection")),this.setListEaseInDuration(Pv(i,"easeIn",500)),this.setListEaseOutDuration(Pv(i,"easeOut",100)),this.setListTransitInCallback(Pv(i,"transitIn")),this.settListTransitOutCallback(Pv(i,"transitOut")),this.setListMaxHeight(Pv(i,"maxHeight",0)),this.setListSize(Pv(i,"width"),Pv(i,"height",0)),this.setListAlignmentMode(Pv(i,"alignParent","text")),this.setListAlignmentSide(Pv(i,"alignSide","")),this.setListBounds(Pv(i,"bounds")),this.setListSpace(Pv(i,"space")),this.setListDraggable(Pv(i,"draggable",!1)),this.setValueChangeCallback(Pv(e,"setValueCallback"),Pv(e,"setValueCallbackScope")),this.setValue(Pv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(_v.prototype,kv);const Tv=Phaser.GameObjects.Text,Ev=Phaser.Utils.Objects.GetValue;class Mv extends Tv{constructor(t,e){void 0===e&&(e={}),super(t,Ev(e,"x",0),Ev(e,"y",0),Ev(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Mv.prototype,uc);var Rv=Phaser.Renderer.WebGL.Utils,Lv={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Rv.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Dv=Phaser.Display.Canvas.CanvasPool;e();const Yv=Phaser.GameObjects.GameObject;class Xv extends Yv{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Dv.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),h=Math.ceil(n.width*t.baselineX),a=h,o=2*a;if(a=a*t.baselineY|0,s.width=h,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,h,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===h||0===o||!r.getImageData(0,0,h,o))return Dv.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},X=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ye={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Xe=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class ki extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Oi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends ki{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Ri=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Li=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Yi=function(t){return Di(t,"complete")};const Xi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Xi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Yi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Xi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Yi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Yi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Xi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Yi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Ai),zi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Gi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Yi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Yi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Yi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ki(t,"x",void 0),i=Ki(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ki(i,"startX",void 0),this.startY=Ki(i,"startY",void 0),this.endX=Ki(i,"endX",void 0),this.endY=Ki(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Yi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Yi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Yi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Yi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Yi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends ki{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Di(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ws={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,zs,Ws,Bs,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Is);var Gs=function(t){if(t.parentContainer)return Gs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Gs(e):t};class Ns extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Gs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Vs=Phaser.GameObjects.Rectangle;class Us extends Vs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ks[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ks={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e,t.alpha)},er=function(t,e){Ni(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Rr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Dr extends Xs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Yr=Phaser.Utils.Objects.GetValue;class Xr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Yr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Yr(t,"enable",!0)),this.setCooldown(Yr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Xr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Xr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Wr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=On},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cn(t,"threshold",10)),this.setVelocityThreshold(Cn(t,"velocityThreshold",1e3)),this.setDirectionMode(Cn(t,"dir","8dir")),this}onDragStart(){this.state=kn}onDragEnd(){this.state=On}onDrag(){this.state===kn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=On)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=bn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=xn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,yn);const On="IDLE",kn="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Dn:this.tracerState=Yn,this.onDrag1Start();break;case Yn:this.tracerState=Xn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Yn:this.tracerState=Dn,this.onDrag1End();break;case Xn:this.tracerState=Yn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Yn:this.onDrag1();break;case Xn:this.onDrag2()}}}dragCancel(){return this.tracerState===Xn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Je);var Ln={};const Dn=0,Yn=1,Xn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Wn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Bn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Gn=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Gn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Vn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Gr.call(t,e),Ur.call(t,e),qr.call(t,e),Kn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Yt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const yh=Mt.prototype.clear;var bh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),yh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},wh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Sh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Oh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},kh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,mh,Ch,wh,Sh,Oh,kh);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue;class Lh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Rh(h=e,"x",0),i=Rh(h,"y",0),s=Rh(h,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(s)?(s=Rh(h=s,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(n)&&(n=Rh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Rh(h,"space.item",0)),this.setStartChildIndex(Rh(h,"startChildIndex",0)),this.setRTL(Rh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Lh.prototype,Ph);var Dh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Yh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Xh={appendText:Yh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ah extends Lh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Dh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Dh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Dh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Dh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ah.prototype,Xh);var zh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Wh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Bh=Phaser.GameObjects.Graphics;class jh extends Bh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ih[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=fe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Wh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&yt(i,this.padding),this.originX=s.originX,this.originY=s.originY,zh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,zh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ih={rectangle:0,circle:1};var Fh=function(t,e,i,s){var r=new jh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Hh=Phaser.GameObjects.Text;var Gh=function(t){return t instanceof Hh};const Nh=Phaser.GameObjects.BitmapText;var Vh=function(t){return t instanceof Nh},Uh=function(t){return Vh(t)?2:Gh(t)?0:1},$h=/^[\x00-\x7F]+$/,Jh=function(t){return $h.test(t)},Kh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Zh=0,Qh=1,ta=2,ea=0,ia=1,sa=2,ra=/(?:\r\n|\r|\n)/;const na={none:ea,word:ia,char:sa,character:sa,mix:3},ha=Phaser.Renderer.WebGL.Utils;var aa={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ha.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const oa=Phaser.Display.Color;var la={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new oa);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},da=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},ca={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,da(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ua=Phaser.Display.Canvas.CanvasPool,pa=Phaser.GameObjects.GameObject,va=Phaser.Utils.String.UUID;class ga extends pa{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ua.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=va(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ua.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const fa=Phaser.GameObjects.Components;Phaser.Class.mixin(ga,[fa.Alpha,fa.BlendMode,fa.Crop,fa.Depth,fa.Flip,fa.GetBounds,fa.Mask,fa.Origin,fa.Pipeline,fa.PostPipeline,fa.ScrollFactor,fa.Tint,fa.Transform,fa.Visible,aa,la,ca]);var ma={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class ya{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ya.prototype,ma);var ba={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const xa=Phaser.Math.RotateAround;var Ca;const wa=Phaser.Geom.Rectangle;var Sa,Oa=function(t){void 0===Sa&&(Sa=new wa);var e=t.drawTLX,i=t.drawTLY;return Sa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Sa};const ka=Phaser.Math.RotateAround;var Pa,_a=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Pa&&(Pa={}),s=Pa),s.x=e,s.y=i,0!==t.rotation&&ka(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ta=Phaser.GameObjects.Components.TransformMatrix;var Ea,Ma,Ra={},La=function(t,e,i,s,r){var n=_a(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ra);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ea&&(Ea=new Ta,Ma=new Ta),t.parentContainer?t.getWorldTransformMatrix(Ea,Ma):Ea.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ea.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Da=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return La(t,e,n,h,r)},Ya={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ca&&(Ca={}),s=Ca),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&xa(s,0,0,-i.rotation),s}(t,e,this,!0);return Oa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Da(this.parent,this,t,e,i)}};Object.assign(Ya,ba);const Xa=Phaser.Math.DegToRad,Aa=Phaser.Math.RadToDeg,za=Phaser.Utils.Objects.GetValue;class Wa extends ya{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Aa(this._rotation)}set angle(t){this.rotation=Xa(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=za(t,"width",void 0),i=za(t,"height",void 0),s=za(t,"scaleX",void 0),r=za(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Wa.prototype,Ya);const Ba=Phaser.Utils.String.Pad;var ja=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ba(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ia=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Fa=Phaser.Utils.Objects.GetValue;let Ha=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Fa(t,"x",0),i=Fa(t,"y",0));var s=this.cornerRadius;s.tl=Ga(Fa(t,"tl",void 0),e,i),s.tr=Ga(Fa(t,"tr",void 0),e,i),s.bl=Ga(Fa(t,"bl",void 0),e,i),s.br=Ga(Fa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Na(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Na(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Na(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Na(this.cornerRadius.br,t)}};var Ga=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Va(t),t},Na=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Fa(e,"x",0),t.y=Fa(e,"y",0)),Va(t)},Va=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ua=Phaser.Math.DegToRad;var $a=function(t){return!t.hasOwnProperty("convex")||t.convex},Ja=function(t){return t.x>0&&t.y>0},Ka=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ja(a)?(o=a.x*g,l=a.y*f,$a(a)?Ka(t,o,l,o,l,180,270,!1,h):Ka(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ja(a)?(o=a.x*g,l=a.y*f,$a(a)?Ka(t,s-o,l,o,l,270,360,!1,h):Ka(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ja(a)?(o=a.x*g,l=a.y*f,$a(a)?Ka(t,s-o,r-l,o,l,0,90,!1,h):Ka(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ja(a)?(o=a.x*g,l=a.y*f,$a(a)?Ka(t,o,r-l,o,l,90,180,!1,h):Ka(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Za=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),qa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Qa=Phaser.Utils.Objects.GetValue;class to extends Wa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Qa(e,"color",null),Qa(e,"color2",null),Qa(e,"horizontalGradient",!0)),this.setStroke(Qa(e,"stroke",null),Qa(e,"strokeThickness",2)),this.setCornerRadius(Qa(e,"cornerRadius",0),Qa(e,"cornerIteration",null))}set color(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ja(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ia("color2",t,this),Ia("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ia("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ia("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Za(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const eo=Phaser.Utils.Objects.GetValue;class io extends Wa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(eo(e,"color",null),eo(e,"color2",null),eo(e,"horizontalGradient",!0)),this.setStroke(eo(e,"stroke",null),eo(e,"strokeThickness",2))}set color(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ja(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ja(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,eo(t,"color2",null),eo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,eo(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const so=Phaser.Utils.Objects.GetValue;let ro=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(so(t,"bold",!1)),this.setItalic(so(t,"italic",!1)),this.setFontSize(so(t,"fontSize","16px")),this.setFontFamily(so(t,"fontFamily","Courier")),this.setColor(so(t,"color","#fff")),this.setStrokeStyle(so(t,"stroke",null),so(t,"strokeThickness",0)),this.setShadow(so(t,"shadowColor",null),so(t,"shadowOffsetX",0),so(t,"shadowOffsetY",0),so(t,"shadowBlur",0)),this.setOffset(so(t,"offsetX",0),so(t,"offsetY",0)),this.setSpace(so(t,"leftSpace",0),so(t,"rightSpace",0)),this.setAlign(so(t,"align",void 0)),this.setBackgroundColor(so(t,"backgroundColor",null)),this.setBackgroundHeight(so(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(so(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(so(t,"backgroundLeftX",0)),this.setBackgroundRightX(so(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ia("stroke",t,this),Ia("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ia("shadowOffsetX",t,this),Ia("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ja(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ja(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ja(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ja(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const no=Phaser.Utils.Array.Remove,ho=Phaser.Utils.Array.Remove,ao="text",oo="image",lo="drawer",co="space",uo="command";var po=function(t){return t.type===ao&&"\n"===t.text},vo=function(t){return t.type===ao&&"\f"===t.text},go=function(t){return t.type===ao};class fo extends Wa{constructor(t,e,i){super(t,ao),this.updateTextFlag=!1,this.style=new ro(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var mo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const yo=Phaser.Display.Canvas.CanvasPool;var bo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=yo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),yo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class xo extends Wa{constructor(t,e,i){super(t,oo),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){bo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Co extends Wa{constructor(t,e,i,s){super(t,lo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class wo extends Wa{constructor(t,e){super(t,co),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class So extends ya{constructor(t,e,i,s,r){super(t,uo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Oo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Oo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Oo(t[i]));return e}var ko=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Po={none:0,word:1,char:2,character:2,mix:3};var _o=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Ro.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Ro.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Do(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Do(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Do(t,"wrapMode");void 0===c&&(c=Do(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Po[c]);var u=Do(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Do(t,"letterSpacing",0),v=Do(t,"hAlign",0),g=Do(t,"vAlign",0),f=Do(t,"justifyPercentage",.25),m=ko({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=T.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ao(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ao(t,"maxLines",0);var a=0===i,o=Ao(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ao(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ao(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ao(t,"letterSpacing",0),p=Ao(t,"rtl",!0),v=Ao(t,"hAlign",p?2:0),g=Ao(t,"vAlign",0),f=ko({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(T.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=T.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Le(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),no(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ho(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ao);return null===i?i=new fo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Da(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const al=Phaser.Utils.Objects.GetFastValue;var ol={};class ll{constructor(t){this.pools=al(t,"pools",ol)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new hl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=ml(t,r,e,i,n),a=0;a<=vl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ml(t,r,e,i,n)}return a===vl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),yl(t,e,i),t},fl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ml=function(t,e,i,s,r){var n,h=fl(t,e,r),a=fl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},yl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const bl=Phaser.Utils.Objects.GetValue,xl=Phaser.Utils.Objects.GetValue;class Cl extends Ah{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=xl(e,"background",void 0),r=xl(e,"icon",void 0),n=xl(e,"iconMask",void 0),h=xl(e,"text",void 0),a=xl(e,"action",void 0),o=xl(e,"actionMask",void 0),l=xl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:xl(e,"space.icon",0),top:xl(e,"space.iconTop",0),bottom:xl(e,"space.iconBottom",0),left:xl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:xl(e,"space.icon",0),left:xl(e,"space.iconLeft",0),right:xl(e,"space.iconRight",0),top:xl(e,"space.iconTop",0)});var d=xl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Fh.call(this,r,r,1)),!d){var c=xl(e,"iconSize",void 0);this.setIconSize(xl(e,"iconWidth",c),xl(e,"iconHeight",c))}}if(h){var u=xl(e,"wrapText",!1),p=xl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Uh(t)){case 0:switch("string"==typeof e&&(e=na[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Kh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=na[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,pl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=bl(e,"minWidth",0),s=bl(e,"minHeight",0),r=bl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return gl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),gl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=xl(e,"space.text",0),m=xl(e,"expandTextWidth",!1),y=xl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:xl(e,"space.actionTop",0),bottom:xl(e,"space.actionBottom",0),right:xl(e,"space.actionRight",0)}:{left:xl(e,"space.actionLeft",0),right:xl(e,"space.actionRight",0),bottom:xl(e,"space.actionBottom",0)},d=xl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Fh.call(this,a,a,1)),!d)){var b=xl(e,"actionSize");this.setActionSize(xl(e,"actionWidth",b),xl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var wl={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=Sl[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const Sl={down:0,up:1},Ol=Lh.prototype.add,kl=Lh.prototype.addSpace;var Pl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&kl.call(this),Ol.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&kl.call(this),this.hasTailSpace=s}else Ol.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Ol.call(this,t,{index:r,proportion:i,expand:!0})}else Ol.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},_l={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Ml.call(this,e[i],t);return this}},Ll=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Dl=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Ll.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Yl={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Dl.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=$l(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=$l(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Kl=Phaser.Utils.Objects.IsPlainObject,ql=Phaser.Utils.Objects.GetValue,Zl=Phaser.Display.Align.CENTER;var Ql=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),Kl(e)&&(e=ql(o=e,"padding",0),i=ql(o,"key",void 0),s=ql(o,"index",void 0),r=ql(o,"offsetX",0),n=ql(o,"offsetY",0),h=ql(o,"offsetOriginX",0),a=ql(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Zl,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},td={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},sd={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&dd.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)gd.call(this,e[i],t);return this}};const md=Phaser.Utils.Objects.GetValue;class yd extends od{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Il({parent:this,eventEmitter:md(e,"eventEmitter",this),groupName:md(e,"groupName",void 0),clickConfig:md(e,"click",void 0)}).setButtonsType(e);var s=md(e,"background",void 0),r=md(e,"buttons",void 0);this.buttonsAlign=md(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(yd.prototype,ud,fd,jl,Hl);var bd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},xd=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Cd(t));var i=t[e];return"string"==typeof i&&(i=bd[i]),i},Cd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},wd=function(){return Array.prototype.reduce.call(arguments,Sd,0)},Sd=function(t,e){return t+e};const Od=Phaser.Utils.Objects.IsPlainObject,kd=Phaser.Utils.Objects.GetValue,Pd=Phaser.Display.Align.CENTER;var _d=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ed(this.sizerChildren,null),bh.call(this,t),this}},Rd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ed(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Xd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ed(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ed(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},zd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Wd=Phaser.Utils.Objects.IsPlainObject,Bd=Phaser.Utils.Objects.GetValue;class jd extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Wd(e)?(e=Bd(l=e,"x",0),i=Bd(l,"y",0),s=Bd(l,"width",void 0),r=Bd(l,"height",void 0),n=Bd(l,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(s)?(s=Bd(l=s,"width",void 0),r=Bd(l,"height",void 0),n=Bd(l,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(n)?(n=Bd(l=n,"column",l.col||0),h=Bd(l,"row",0),a=Bd(l,"columnProportions",0),o=Bd(l,"rowProportions",0)):Wd(a)&&(a=Bd(l=a,"columnProportions",0),o=Bd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bd(l,"createCellContainerCallback")),this.setIndentLeft(Bd(l,"space.indentLeftOdd",0),Bd(l,"space.indentLeftEven",0)),this.setIndentTop(Bd(l,"space.indentTopOdd",0),Bd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bd(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Ad.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=zd.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(jd.prototype,Xd);const Id=Phaser.Utils.Objects.GetValue;var Fd=Phaser.Renderer.WebGL.Utils,Hd=function(t,e,i,s,r,n){for(var h=Fd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},$d=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Jd=Phaser.Renderer.Canvas.SetTransform;var Kd={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Hd(r,h,e,l,a,o),e.isStroked&&Nd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Jd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Zd.prototype,Kd);var Qd=function(t){return t.x>0&&t.y>0},tc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ec=Phaser.Math.DegToRad;var ic=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const eu=Phaser.Utils.Objects.GetValue,iu=Phaser.Utils.Objects.IsPlainObject;class su extends(Tc(xc)){constructor(t,e,i,s,r,n,h,a){iu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):iu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):iu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Qc).setName("trackFill")).addShape((new Qc).setName("bar")).addShape((new Qc).setName("trackStroke")),this.setTrackColor(eu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(eu(a,"trackStrokeThickness",2),eu(a,"trackStrokeColor",void 0)),this.setSkewX(eu(a,"skewX",0)),this.setRTL(eu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ru={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&tu(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),tu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&tu(a,0,0,e,i,t)}};Object.assign(su.prototype,ru);var nu=function(t){return null==t||""===t||0===t.length},hu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(nu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(nu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Oo(i),s=Oo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Ou(t)?(this.stretchMode.edge=Pu(ku(t,"edge",0)),this.stretchMode.internal=Pu(ku(t,"internal",0))):(t=Pu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Tu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Mu=Phaser.Utils.Objects.IsPlainObject,Ru=Phaser.Utils.Objects.GetValue,Lu=Phaser.GameObjects;var Du=void 0,Yu=function(t,e){if(Du||(Du={},ei(t).events.once("destroy",(function(){for(var t in Du)Du[t].destroy();Du=void 0}))),!Du.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Lu[e](i)).setOrigin(0),Du[e]=t}return Du[e]};const Xu=Phaser.GameObjects.RenderTexture;class Au extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Mu(i)?(i=Ru(d=i,"x",0),s=Ru(d,"y",0),r=Ru(d,"width",1),n=Ru(d,"height",1),h=Ru(d,"key",void 0),a=Ru(d,"baseFrame",void 0),o=Ru(d,"columns",void 0),l=Ru(d,"rows",void 0)):Mu(r)?(r=Ru(d=r,"width",1),n=Ru(d,"height",1),h=Ru(d,"key",void 0),a=Ru(d,"baseFrame",void 0),o=Ru(d,"columns",void 0),l=Ru(d,"rows",void 0)):Mu(h)?(h=Ru(d=h,"key",void 0),a=Ru(d,"baseFrame",void 0),o=Ru(d,"columns",void 0),l=Ru(d,"rows",void 0)):Mu(a)?(a=Ru(d=a,"baseFrame",void 0),o=Ru(d,"columns",void 0),l=Ru(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Ru(d,"baseFrame",void 0)):Mu(o)&&(o=Ru(d=o,"columns",void 0),l=Ru(d,"rows",void 0)),void 0===a&&(a=Ru(d,"frame",void 0)),void 0===o){var c=Ru(d,"leftWidth",void 0),u=Ru(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Ru(d,"topHeight",void 0),v=Ru(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Ru(d,"getFrameNameCallback",void 0)),this.setStretchMode(Ru(d,"stretchMode",0)),this.setPreserveRatio(Ru(d,"preserveRatio",!0));var g=Ru(d,"maxFixedPartScale",1),f=Ru(d,"maxFixedPartScaleX",g),m=Ru(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Eu),i}(Xu,"rexNinePatch")){}var zu={_drawImage:function(t,e,i,s,r,n){var h=Yu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Yu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Au.prototype,zu);let Wu=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(lu(t,e))return t[e];var i=t.parent;return lu(i,e)?i[e]:void 0}set(t,e,i){return lu(t,e)?t[e]=i:lu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Bu=Phaser.Utils.Objects.GetValue;class ju extends Au{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Bu(e,"effects",!0);i&&vu(this,i),this.style=new Wu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(ju.prototype,uc);const Iu=["alpha","tint","flipX","flipY"];var Fu=function(t,e){if(!e)return t;for(var i=0,s=Iu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const xp=Phaser.Utils.Objects.GetValue,Cp=Phaser.Math.Distance.Between;class wp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=xp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(xp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(xp(t,"enable",!0)),this.holdThreshold=xp(t,"holdThreshold",50),this.pointerOutReleaseEnable=xp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Cp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Sp=Phaser.Utils.Objects.GetValue;class Op{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Sp(t,"value",0)),this.setSpeed(Sp(t,"speed",0)),this.setAcceleration(Sp(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class kp{constructor(){this.value,this.dir,this.movement=new Op}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Ep={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Mp=Phaser.Utils.Objects.GetValue;class Rp extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Mp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Mp(e,"speed",.1)),this.setEnable(Mp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Mp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Lp=Phaser.Utils.Objects.GetValue;var Dp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Lp(s,l,void 0):Lp(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new yp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Lp(r,"position",0);"string"==typeof p&&(p=Yp[p]);var v,g,f=Lp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Lp(s,"space.slider",void 0))&&(a?f=0:v=Lp(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Lp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Lp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Lp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Lp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Lp(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Lp(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Lp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Lp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Lp(s,"scrollDetectionMode");"string"==typeof b&&(b=Xp[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Lp(s,x,!0):Lp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Tp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,k,P=Lp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Rp(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Yp={right:0,left:1,bottom:0,top:1},Xp={gameObject:0,rectBounds:1},Ap=Phaser.Utils.Objects.GetValue;var zp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ap(e,"width"),h=Ap(e,"height");n||Ap(e,"child.expandWidth",!0)||(s[1]=0),h||Ap(e,"child.expandHeight",!0)||(r[1]=0);var a=new jd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Id(i,"child"),r=Id(s,"gameObject",void 0);if(r){var n=Id(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Id(n,"top",0),h.bottom=Id(n,"bottom",0),a.left=Id(n,"left",0),a.right=Id(n,"right",0);break;case 1:h.top=Id(n,"left",0),h.bottom=Id(n,"right",0),a.top=Id(n,"top",0),a.bottom=Id(n,"bottom",0);break;default:h.top=Id(n,"top",0),h.bottom=Id(n,"bottom",0),h.left=Id(n,"left",0),h.right=Id(n,"right",0)}e.add(r,{column:1,row:1,align:Id(s,"align","center"),padding:a,expand:{width:Id(s,"expandWidth",!0),height:Id(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Dp(t,a,"y",e);break;case 1:Dp(t,a,"x",e);break;default:Dp(t,a,"y",e),Dp(t,a,"x",e)}return a},Wp=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Bp=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},jp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(av.prototype,sv);const ov=["top","bottom","centerY","center"],lv=["left","right","centerX","center"];var dv=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=ov.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=lv.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const cv=Phaser.Utils.Objects.GetValue;class uv extends Gp{constructor(t,e){void 0===e&&(e={});var i=xd(e),s=cv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=cv(e,"clampChildOY",!1),s.clampChildOX=cv(e,"clampChildOX",!1);var r,n,h=new av(t,s);switch(t.add.existing(h),i){case 0:r=cv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=cv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:cv(e,"align.panel","center")};var a=cv(e,"space",void 0);a&&(a.child=cv(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ih(this.childrenMap.child,t),this}}var pv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:dv.call(this,t,"y",e);break;case 1:dv.call(this,t,"x",e);break;default:dv.call(this,t,"y",e),dv.call(this,t,"x",e)}return this}};Object.assign(uv.prototype,pv);const vv=Phaser.Utils.Objects.GetValue;var gv=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=fv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=mv(e,this.listCreateSliderTrackCallback),v=mv(e,this.listCreateSliderThumbCallback);d=new uv(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:vv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=fv(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},fv=function(t,e,i){var s;return i?(e.orientation="x",s=new yd(t,e)):(e.orientation="y",s=new Nl(t,e)),t.add.existing(s),s},mv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},yv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rx.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Cv={down:0,up:1},wv=Phaser.Utils.Objects.GetValue;class Sv extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),xv(t,e),t.isRexSizer&&t.layout();var i=wv(e,"touchOutsideClose",!1),s=wv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ov={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},kv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=gv.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Sv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(kv,wl,Ov);const Pv=Phaser.Utils.Objects.GetValue;class _v extends Cl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(Pv(e,"options"));var i=Pv(e,"list");this.setWrapEnable(Pv(i,"wrap",!1)),this.setCreateButtonCallback(Pv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(Pv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(Pv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(Pv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(Pv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(Pv(i,"scroller")),this.setListMouseWheelScrollerConfig(Pv(i,"mouseWheelScroller")),this.setButtonClickCallback(Pv(i,"onButtonClick")),this.setButtonOverCallback(Pv(i,"onButtonOver")),this.setButtonOutCallback(Pv(i,"onButtonOut")),this.setListExpandDirection(Pv(i,"expandDirection")),this.setListEaseInDuration(Pv(i,"easeIn",500)),this.setListEaseOutDuration(Pv(i,"easeOut",100)),this.setListTransitInCallback(Pv(i,"transitIn")),this.settListTransitOutCallback(Pv(i,"transitOut")),this.setListMaxHeight(Pv(i,"maxHeight",0)),this.setListSize(Pv(i,"width"),Pv(i,"height",0)),this.setListAlignmentMode(Pv(i,"alignParent","text")),this.setListAlignmentSide(Pv(i,"alignSide","")),this.setListBounds(Pv(i,"bounds")),this.setListSpace(Pv(i,"space")),this.setListDraggable(Pv(i,"draggable",!1)),this.setValueChangeCallback(Pv(e,"setValueCallback"),Pv(e,"setValueCallbackScope")),this.setValue(Pv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(_v.prototype,kv);const Tv=Phaser.GameObjects.Text,Ev=Phaser.Utils.Objects.GetValue;class Mv extends Tv{constructor(t,e){void 0===e&&(e={}),super(t,Ev(e,"x",0),Ev(e,"y",0),Ev(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Mv.prototype,uc);var Rv=Phaser.Renderer.WebGL.Utils,Lv={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Rv.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Dv=Phaser.Display.Canvas.CanvasPool;e();const Yv=Phaser.GameObjects.GameObject;class Xv extends Yv{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Dv.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),h=Math.ceil(n.width*t.baselineX),a=h,o=2*a;if(a=a*t.baselineY|0,s.width=h,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,h,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===h||0===o||!r.getImageData(0,0,h,o))return Dv.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexsimplelabel.js b/dist/rexsimplelabel.js index 925cd8b902..34173f9fed 100644 --- a/dist/rexsimplelabel.js +++ b/dist/rexsimplelabel.js @@ -15596,6 +15596,8 @@ this.setBackgroundColor(GetValue$E(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$E(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$E(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$E(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$E(o, 'backgroundRightX', 0)); return this; } @@ -15666,6 +15668,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -15820,6 +15828,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -16247,20 +16265,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rexsimplelabel.min.js b/dist/rexsimplelabel.min.js index 60c0049373..06d471aa56 100644 --- a/dist/rexsimplelabel.min.js +++ b/dist/rexsimplelabel.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Ai),Xi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ds,Ys,As,Xs);const Ws=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=bn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},Yn={};const An=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Yn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Wn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(Wn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Yr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),Fr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},xh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,uh,fh,mh,yh,bh,xh);var Sh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Oh=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){Oh(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,wh);var Th=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Eh={appendText:kh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Mh extends _h{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Th(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Th(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Th(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Th(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Mh.prototype,Eh);var Rh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Lh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Dh=Phaser.GameObjects.Graphics;class Yh extends Dh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ah[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ge(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ge(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Lh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Rh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Rh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ah={rectangle:0,circle:1};var Xh=function(t,e,i,s){var r=new Yh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const zh=Phaser.GameObjects.Text;var Wh=function(t){return t instanceof zh};const Fh=Phaser.GameObjects.BitmapText;var jh=function(t){return t instanceof Fh},Ih=function(t){return jh(t)?2:Wh(t)?0:1},Bh=/^[\x00-\x7F]+$/,Hh=function(t){return Bh.test(t)},Nh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Vh=0,Uh=1,$h=2,Jh=0,Kh=1,qh=2,Zh=/(?:\r\n|\r|\n)/;const Qh={none:Jh,word:Kh,char:qh,character:qh,mix:3},ta=Phaser.Renderer.WebGL.Utils;var ea={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ta.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ia=Phaser.Display.Color;var sa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ia);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ra=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},na={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,ra(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ha=Phaser.Display.Canvas.CanvasPool,aa=Phaser.GameObjects.GameObject,oa=Phaser.Utils.String.UUID;class la extends aa{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ha.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=oa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ha.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const da=Phaser.GameObjects.Components;Phaser.Class.mixin(la,[da.Alpha,da.BlendMode,da.Crop,da.Depth,da.Flip,da.GetBounds,da.Mask,da.Origin,da.Pipeline,da.PostPipeline,da.ScrollFactor,da.Tint,da.Transform,da.Visible,ea,sa,na]);var ca={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ua{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ua.prototype,ca);var pa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const va=Phaser.Math.RotateAround;var ga;const fa=Phaser.Geom.Rectangle;var ma,ya=function(t){void 0===ma&&(ma=new fa);var e=t.drawTLX,i=t.drawTLY;return ma.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ma};const ba=Phaser.Math.RotateAround;var xa,wa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===xa&&(xa={}),s=xa),s.x=e,s.y=i,0!==t.rotation&&ba(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Sa=Phaser.GameObjects.Components.TransformMatrix;var Ca,Oa,Pa={},_a=function(t,e,i,s,r){var n=wa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Pa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ca&&(Ca=new Sa,Oa=new Sa),t.parentContainer?t.getWorldTransformMatrix(Ca,Oa):Ca.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ca.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ta=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return _a(t,e,n,h,r)},ka={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ga&&(ga={}),s=ga),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&va(s,0,0,-i.rotation),s}(t,e,this,!0);return ya(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ta(this.parent,this,t,e,i)}};Object.assign(ka,pa);const Ea=Phaser.Math.DegToRad,Ma=Phaser.Math.RadToDeg,Ra=Phaser.Utils.Objects.GetValue;class La extends ua{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ma(this._rotation)}set angle(t){this.rotation=Ea(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ra(t,"width",void 0),i=Ra(t,"height",void 0),s=Ra(t,"scaleX",void 0),r=Ra(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(La.prototype,ka);const Da=Phaser.Utils.String.Pad;var Ya=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Da(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Xa=Phaser.Utils.Objects.GetValue;let za=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Xa(t,"x",0),i=Xa(t,"y",0));var s=this.cornerRadius;s.tl=Wa(Xa(t,"tl",void 0),e,i),s.tr=Wa(Xa(t,"tr",void 0),e,i),s.bl=Wa(Xa(t,"bl",void 0),e,i),s.br=Wa(Xa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Fa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Fa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Fa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Fa(this.cornerRadius.br,t)}};var Wa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ja(t),t},Fa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Xa(e,"x",0),t.y=Xa(e,"y",0)),ja(t)},ja=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ia=Phaser.Math.DegToRad;var Ba=function(t){return!t.hasOwnProperty("convex")||t.convex},Ha=function(t){return t.x>0&&t.y>0},Na=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,o,l,o,l,180,270,!1,h):Na(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,s-o,l,o,l,270,360,!1,h):Na(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,s-o,r-l,o,l,0,90,!1,h):Na(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,o,r-l,o,l,90,180,!1,h):Na(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Va=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ga(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ua=Phaser.Utils.Objects.GetValue;class $a extends La{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ua(e,"color",null),Ua(e,"color2",null),Ua(e,"horizontalGradient",!0)),this.setStroke(Ua(e,"stroke",null),Ua(e,"strokeThickness",2)),this.setCornerRadius(Ua(e,"cornerRadius",0),Ua(e,"cornerIteration",null))}set color(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Va(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ja=Phaser.Utils.Objects.GetValue;class Ka extends La{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ja(e,"color",null),Ja(e,"color2",null),Ja(e,"horizontalGradient",!0)),this.setStroke(Ja(e,"stroke",null),Ja(e,"strokeThickness",2))}set color(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ja(t,"color2",null),Ja(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ja(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const qa=Phaser.Utils.Objects.GetValue;let Za=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(qa(t,"bold",!1)),this.setItalic(qa(t,"italic",!1)),this.setFontSize(qa(t,"fontSize","16px")),this.setFontFamily(qa(t,"fontFamily","Courier")),this.setColor(qa(t,"color","#fff")),this.setStrokeStyle(qa(t,"stroke",null),qa(t,"strokeThickness",0)),this.setShadow(qa(t,"shadowColor",null),qa(t,"shadowOffsetX",0),qa(t,"shadowOffsetY",0),qa(t,"shadowBlur",0)),this.setOffset(qa(t,"offsetX",0),qa(t,"offsetY",0)),this.setSpace(qa(t,"leftSpace",0),qa(t,"rightSpace",0)),this.setAlign(qa(t,"align",void 0)),this.setBackgroundColor(qa(t,"backgroundColor",null)),this.setBackgroundHeight(qa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(qa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ya(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ya(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ya(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ya(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Qa=Phaser.Utils.Array.Remove,to=Phaser.Utils.Array.Remove,eo="text",io="image",so="drawer",ro="space",no="command";var ho=function(t){return t.type===eo&&"\n"===t.text},ao=function(t){return t.type===eo&&"\f"===t.text},oo=function(t){return t.type===eo};class lo extends La{constructor(t,e,i){super(t,eo),this.updateTextFlag=!1,this.style=new Za(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var co=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const uo=Phaser.Display.Canvas.CanvasPool;var po=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=uo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),uo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class vo extends La{constructor(t,e,i){super(t,io),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){po(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class go extends La{constructor(t,e,i,s){super(t,so),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class fo extends La{constructor(t,e){super(t,ro),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class mo extends ua{constructor(t,e,i,s,r){super(t,no),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function yo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>yo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=yo(t[i]));return e}var bo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const xo={none:0,word:1,char:2,character:2,mix:3};var wo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Po.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Po.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=To(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=To(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=To(t,"wrapMode");void 0===c&&(c=To(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=xo[c]);var u=To(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=To(t,"letterSpacing",0),v=To(t,"hAlign",0),g=To(t,"vAlign",0),f=To(t,"justifyPercentage",.25),m=bo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Mo(t,"maxLines",0);var a=0===i,o=Mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Mo(t,"letterSpacing",0),p=Mo(t,"rtl",!0),v=Mo(t,"hAlign",p?2:0),g=Mo(t,"vAlign",0),f=bo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return to(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(eo);return null===i?i=new lo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ta(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const el=Phaser.Utils.Objects.GetFastValue;var il={};class sl{constructor(t){this.pools=el(t,"pools",il)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new tl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=cl(t,r,e,i,n),a=0;a<=ol&&0!==h;a++){if((r+=h)<0){r=0;break}h=cl(t,r,e,i,n)}return a===ol&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ul(t,e,i),t},dl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},cl=function(t,e,i,s,r){var n,h=dl(t,e,r),a=dl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ul=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const pl=Phaser.Utils.Objects.GetValue,vl=Phaser.Utils.Objects.GetValue;class gl extends Mh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=vl(e,"background",void 0),r=vl(e,"icon",void 0),n=vl(e,"iconMask",void 0),h=vl(e,"text",void 0),a=vl(e,"action",void 0),o=vl(e,"actionMask",void 0),l=vl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:vl(e,"space.icon",0),top:vl(e,"space.iconTop",0),bottom:vl(e,"space.iconBottom",0),left:vl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:vl(e,"space.icon",0),left:vl(e,"space.iconLeft",0),right:vl(e,"space.iconRight",0),top:vl(e,"space.iconTop",0)});var d=vl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Xh.call(this,r,r,1)),!d){var c=vl(e,"iconSize",void 0);this.setIconSize(vl(e,"iconWidth",c),vl(e,"iconHeight",c))}}if(h){var u=vl(e,"wrapText",!1),p=vl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Ih(t)){case 0:switch("string"==typeof e&&(e=Qh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Nh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Qh[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,al(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=pl(e,"minWidth",0),s=pl(e,"minHeight",0),r=pl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ll(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ll(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=vl(e,"space.text",0),m=vl(e,"expandTextWidth",!1),y=vl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:vl(e,"space.actionTop",0),bottom:vl(e,"space.actionBottom",0),right:vl(e,"space.actionRight",0)}:{left:vl(e,"space.actionLeft",0),right:vl(e,"space.actionRight",0),bottom:vl(e,"space.actionBottom",0)},d=vl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Xh.call(this,a,a,1)),!d)){var b=vl(e,"actionSize");this.setActionSize(vl(e,"actionWidth",b),vl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var fl=Phaser.Renderer.WebGL.Utils,ml=function(t,e,i,s,r,n){for(var h=fl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Sl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Cl=Phaser.Renderer.Canvas.SetTransform;var Ol={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=xl(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&ml(r,h,e,l,a,o),e.isStroked&&bl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Cl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(_l.prototype,Ol);var Tl=function(t){return t.x>0&&t.y>0},kl=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const El=Phaser.Math.DegToRad;var Ml=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Ed=Phaser.Utils.Objects.GetValue,Md=Phaser.Utils.Objects.IsPlainObject;class Rd extends(id($l)){constructor(t,e,i,s,r,n,h,a){Md(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Md(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Md(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Td).setName("trackFill")).addShape((new Td).setName("bar")).addShape((new Td).setName("trackStroke")),this.setTrackColor(Ed(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Ed(a,"trackStrokeThickness",2),Ed(a,"trackStrokeColor",void 0)),this.setSkewX(Ed(a,"skewX",0)),this.setRTL(Ed(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Ld={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&kd(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),kd(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&kd(a,0,0,e,i,t)}};Object.assign(Rd.prototype,Ld);var Dd=function(t){return null==t||""===t||0===t.length},Yd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Dd(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Dd(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=yo(i),s=yo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Zd(t)?(this.stretchMode.edge=tc(Qd(t,"edge",0)),this.stretchMode.internal=tc(Qd(t,"internal",0))):(t=tc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ic.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const rc=Phaser.Utils.Objects.IsPlainObject,nc=Phaser.Utils.Objects.GetValue,hc=Phaser.GameObjects;var ac=void 0,oc=function(t,e){if(ac||(ac={},ti(t).events.once("destroy",(function(){for(var t in ac)ac[t].destroy();ac=void 0}))),!ac.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new hc[e](i)).setOrigin(0),ac[e]=t}return ac[e]};const lc=Phaser.GameObjects.RenderTexture;class dc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(rc(i)?(i=nc(d=i,"x",0),s=nc(d,"y",0),r=nc(d,"width",1),n=nc(d,"height",1),h=nc(d,"key",void 0),a=nc(d,"baseFrame",void 0),o=nc(d,"columns",void 0),l=nc(d,"rows",void 0)):rc(r)?(r=nc(d=r,"width",1),n=nc(d,"height",1),h=nc(d,"key",void 0),a=nc(d,"baseFrame",void 0),o=nc(d,"columns",void 0),l=nc(d,"rows",void 0)):rc(h)?(h=nc(d=h,"key",void 0),a=nc(d,"baseFrame",void 0),o=nc(d,"columns",void 0),l=nc(d,"rows",void 0)):rc(a)?(a=nc(d=a,"baseFrame",void 0),o=nc(d,"columns",void 0),l=nc(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=nc(d,"baseFrame",void 0)):rc(o)&&(o=nc(d=o,"columns",void 0),l=nc(d,"rows",void 0)),void 0===a&&(a=nc(d,"frame",void 0)),void 0===o){var c=nc(d,"leftWidth",void 0),u=nc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=nc(d,"topHeight",void 0),v=nc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(nc(d,"getFrameNameCallback",void 0)),this.setStretchMode(nc(d,"stretchMode",0)),this.setPreserveRatio(nc(d,"preserveRatio",!0));var g=nc(d,"maxFixedPartScale",1),f=nc(d,"maxFixedPartScaleX",g),m=nc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,sc),i}(lc,"rexNinePatch")){}var cc={_drawImage:function(t,e,i,s,r,n){var h=oc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=oc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(dc.prototype,cc);let uc=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(zd(t,e))return t[e];var i=t.parent;return zd(i,e)?i[e]:void 0}set(t,e,i){return zd(t,e)?t[e]=i:zd(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const pc=Phaser.Utils.Objects.GetValue;class vc extends dc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=pc(e,"effects",!0);i&&Bd(this,i),this.style=new uc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vc.prototype,jl);const gc=["alpha","tint","flipX","flipY"];var fc=function(t,e){if(!e)return t;for(var i=0,s=gc.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Ai),Xi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ds,Ys,As,Xs);const Ws=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=bn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},Yn={};const An=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Yn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Wn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(Wn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Yr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),Fr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},xh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,uh,fh,mh,yh,bh,xh);var Sh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Oh=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){Oh(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,wh);var Th=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Eh={appendText:kh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Mh extends _h{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Th(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Th(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Th(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Th(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Mh.prototype,Eh);var Rh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Lh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Dh=Phaser.GameObjects.Graphics;class Yh extends Dh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ah[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ge(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ge(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Lh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Rh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Rh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ah={rectangle:0,circle:1};var Xh=function(t,e,i,s){var r=new Yh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const zh=Phaser.GameObjects.Text;var Wh=function(t){return t instanceof zh};const Fh=Phaser.GameObjects.BitmapText;var jh=function(t){return t instanceof Fh},Ih=function(t){return jh(t)?2:Wh(t)?0:1},Bh=/^[\x00-\x7F]+$/,Hh=function(t){return Bh.test(t)},Nh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Vh=0,Uh=1,$h=2,Jh=0,Kh=1,qh=2,Zh=/(?:\r\n|\r|\n)/;const Qh={none:Jh,word:Kh,char:qh,character:qh,mix:3},ta=Phaser.Renderer.WebGL.Utils;var ea={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ta.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ia=Phaser.Display.Color;var sa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ia);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ra=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},na={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,ra(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ha=Phaser.Display.Canvas.CanvasPool,aa=Phaser.GameObjects.GameObject,oa=Phaser.Utils.String.UUID;class la extends aa{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ha.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=oa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ha.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const da=Phaser.GameObjects.Components;Phaser.Class.mixin(la,[da.Alpha,da.BlendMode,da.Crop,da.Depth,da.Flip,da.GetBounds,da.Mask,da.Origin,da.Pipeline,da.PostPipeline,da.ScrollFactor,da.Tint,da.Transform,da.Visible,ea,sa,na]);var ca={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ua{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ua.prototype,ca);var pa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const va=Phaser.Math.RotateAround;var ga;const fa=Phaser.Geom.Rectangle;var ma,ya=function(t){void 0===ma&&(ma=new fa);var e=t.drawTLX,i=t.drawTLY;return ma.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ma};const ba=Phaser.Math.RotateAround;var xa,wa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===xa&&(xa={}),s=xa),s.x=e,s.y=i,0!==t.rotation&&ba(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Sa=Phaser.GameObjects.Components.TransformMatrix;var Ca,Oa,Pa={},_a=function(t,e,i,s,r){var n=wa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Pa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ca&&(Ca=new Sa,Oa=new Sa),t.parentContainer?t.getWorldTransformMatrix(Ca,Oa):Ca.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ca.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ta=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return _a(t,e,n,h,r)},ka={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ga&&(ga={}),s=ga),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&va(s,0,0,-i.rotation),s}(t,e,this,!0);return ya(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ta(this.parent,this,t,e,i)}};Object.assign(ka,pa);const Ea=Phaser.Math.DegToRad,Ma=Phaser.Math.RadToDeg,Ra=Phaser.Utils.Objects.GetValue;class La extends ua{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ma(this._rotation)}set angle(t){this.rotation=Ea(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ra(t,"width",void 0),i=Ra(t,"height",void 0),s=Ra(t,"scaleX",void 0),r=Ra(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(La.prototype,ka);const Da=Phaser.Utils.String.Pad;var Ya=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Da(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Xa=Phaser.Utils.Objects.GetValue;let za=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Xa(t,"x",0),i=Xa(t,"y",0));var s=this.cornerRadius;s.tl=Wa(Xa(t,"tl",void 0),e,i),s.tr=Wa(Xa(t,"tr",void 0),e,i),s.bl=Wa(Xa(t,"bl",void 0),e,i),s.br=Wa(Xa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Fa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Fa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Fa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Fa(this.cornerRadius.br,t)}};var Wa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ja(t),t},Fa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Xa(e,"x",0),t.y=Xa(e,"y",0)),ja(t)},ja=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ia=Phaser.Math.DegToRad;var Ba=function(t){return!t.hasOwnProperty("convex")||t.convex},Ha=function(t){return t.x>0&&t.y>0},Na=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,o,l,o,l,180,270,!1,h):Na(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,s-o,l,o,l,270,360,!1,h):Na(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,s-o,r-l,o,l,0,90,!1,h):Na(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ha(a)?(o=a.x*g,l=a.y*f,Ba(a)?Na(t,o,r-l,o,l,90,180,!1,h):Na(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Va=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ga(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ua=Phaser.Utils.Objects.GetValue;class $a extends La{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ua(e,"color",null),Ua(e,"color2",null),Ua(e,"horizontalGradient",!0)),this.setStroke(Ua(e,"stroke",null),Ua(e,"strokeThickness",2)),this.setCornerRadius(Ua(e,"cornerRadius",0),Ua(e,"cornerIteration",null))}set color(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Va(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ja=Phaser.Utils.Objects.GetValue;class Ka extends La{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ja(e,"color",null),Ja(e,"color2",null),Ja(e,"horizontalGradient",!0)),this.setStroke(Ja(e,"stroke",null),Ja(e,"strokeThickness",2))}set color(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ya(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ja(t,"color2",null),Ja(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ja(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const qa=Phaser.Utils.Objects.GetValue;let Za=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(qa(t,"bold",!1)),this.setItalic(qa(t,"italic",!1)),this.setFontSize(qa(t,"fontSize","16px")),this.setFontFamily(qa(t,"fontFamily","Courier")),this.setColor(qa(t,"color","#fff")),this.setStrokeStyle(qa(t,"stroke",null),qa(t,"strokeThickness",0)),this.setShadow(qa(t,"shadowColor",null),qa(t,"shadowOffsetX",0),qa(t,"shadowOffsetY",0),qa(t,"shadowBlur",0)),this.setOffset(qa(t,"offsetX",0),qa(t,"offsetY",0)),this.setSpace(qa(t,"leftSpace",0),qa(t,"rightSpace",0)),this.setAlign(qa(t,"align",void 0)),this.setBackgroundColor(qa(t,"backgroundColor",null)),this.setBackgroundHeight(qa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(qa(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(qa(t,"backgroundLeftX",0)),this.setBackgroundRightX(qa(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ya(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ya(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ya(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ya(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Qa=Phaser.Utils.Array.Remove,to=Phaser.Utils.Array.Remove,eo="text",io="image",so="drawer",ro="space",no="command";var ho=function(t){return t.type===eo&&"\n"===t.text},ao=function(t){return t.type===eo&&"\f"===t.text},oo=function(t){return t.type===eo};class lo extends La{constructor(t,e,i){super(t,eo),this.updateTextFlag=!1,this.style=new Za(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var co=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const uo=Phaser.Display.Canvas.CanvasPool;var po=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=uo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),uo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class vo extends La{constructor(t,e,i){super(t,io),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){po(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class go extends La{constructor(t,e,i,s){super(t,so),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class fo extends La{constructor(t,e){super(t,ro),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class mo extends ua{constructor(t,e,i,s,r){super(t,no),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function yo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>yo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=yo(t[i]));return e}var bo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const xo={none:0,word:1,char:2,character:2,mix:3};var wo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Po.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Po.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=To(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=To(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=To(t,"wrapMode");void 0===c&&(c=To(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=xo[c]);var u=To(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=To(t,"letterSpacing",0),v=To(t,"hAlign",0),g=To(t,"vAlign",0),f=To(t,"justifyPercentage",.25),m=bo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Mo(t,"maxLines",0);var a=0===i,o=Mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Mo(t,"letterSpacing",0),p=Mo(t,"rtl",!0),v=Mo(t,"hAlign",p?2:0),g=Mo(t,"vAlign",0),f=bo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return to(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(eo);return null===i?i=new lo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ta(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const el=Phaser.Utils.Objects.GetFastValue;var il={};class sl{constructor(t){this.pools=el(t,"pools",il)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new tl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=cl(t,r,e,i,n),a=0;a<=ol&&0!==h;a++){if((r+=h)<0){r=0;break}h=cl(t,r,e,i,n)}return a===ol&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ul(t,e,i),t},dl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},cl=function(t,e,i,s,r){var n,h=dl(t,e,r),a=dl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ul=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const pl=Phaser.Utils.Objects.GetValue,vl=Phaser.Utils.Objects.GetValue;class gl extends Mh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=vl(e,"background",void 0),r=vl(e,"icon",void 0),n=vl(e,"iconMask",void 0),h=vl(e,"text",void 0),a=vl(e,"action",void 0),o=vl(e,"actionMask",void 0),l=vl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:vl(e,"space.icon",0),top:vl(e,"space.iconTop",0),bottom:vl(e,"space.iconBottom",0),left:vl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:vl(e,"space.icon",0),left:vl(e,"space.iconLeft",0),right:vl(e,"space.iconRight",0),top:vl(e,"space.iconTop",0)});var d=vl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Xh.call(this,r,r,1)),!d){var c=vl(e,"iconSize",void 0);this.setIconSize(vl(e,"iconWidth",c),vl(e,"iconHeight",c))}}if(h){var u=vl(e,"wrapText",!1),p=vl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Ih(t)){case 0:switch("string"==typeof e&&(e=Qh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Nh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Qh[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,al(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=pl(e,"minWidth",0),s=pl(e,"minHeight",0),r=pl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ll(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ll(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=vl(e,"space.text",0),m=vl(e,"expandTextWidth",!1),y=vl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:vl(e,"space.actionTop",0),bottom:vl(e,"space.actionBottom",0),right:vl(e,"space.actionRight",0)}:{left:vl(e,"space.actionLeft",0),right:vl(e,"space.actionRight",0),bottom:vl(e,"space.actionBottom",0)},d=vl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Xh.call(this,a,a,1)),!d)){var b=vl(e,"actionSize");this.setActionSize(vl(e,"actionWidth",b),vl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var fl=Phaser.Renderer.WebGL.Utils,ml=function(t,e,i,s,r,n){for(var h=fl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Sl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Cl=Phaser.Renderer.Canvas.SetTransform;var Ol={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=xl(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&ml(r,h,e,l,a,o),e.isStroked&&bl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Cl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(_l.prototype,Ol);var Tl=function(t){return t.x>0&&t.y>0},kl=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const El=Phaser.Math.DegToRad;var Ml=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Ed=Phaser.Utils.Objects.GetValue,Md=Phaser.Utils.Objects.IsPlainObject;class Rd extends(id($l)){constructor(t,e,i,s,r,n,h,a){Md(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Md(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Md(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Td).setName("trackFill")).addShape((new Td).setName("bar")).addShape((new Td).setName("trackStroke")),this.setTrackColor(Ed(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Ed(a,"trackStrokeThickness",2),Ed(a,"trackStrokeColor",void 0)),this.setSkewX(Ed(a,"skewX",0)),this.setRTL(Ed(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Ld={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&kd(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),kd(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&kd(a,0,0,e,i,t)}};Object.assign(Rd.prototype,Ld);var Dd=function(t){return null==t||""===t||0===t.length},Yd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Dd(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Dd(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=yo(i),s=yo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Zd(t)?(this.stretchMode.edge=tc(Qd(t,"edge",0)),this.stretchMode.internal=tc(Qd(t,"internal",0))):(t=tc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ic.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const rc=Phaser.Utils.Objects.IsPlainObject,nc=Phaser.Utils.Objects.GetValue,hc=Phaser.GameObjects;var ac=void 0,oc=function(t,e){if(ac||(ac={},ti(t).events.once("destroy",(function(){for(var t in ac)ac[t].destroy();ac=void 0}))),!ac.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new hc[e](i)).setOrigin(0),ac[e]=t}return ac[e]};const lc=Phaser.GameObjects.RenderTexture;class dc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(rc(i)?(i=nc(d=i,"x",0),s=nc(d,"y",0),r=nc(d,"width",1),n=nc(d,"height",1),h=nc(d,"key",void 0),a=nc(d,"baseFrame",void 0),o=nc(d,"columns",void 0),l=nc(d,"rows",void 0)):rc(r)?(r=nc(d=r,"width",1),n=nc(d,"height",1),h=nc(d,"key",void 0),a=nc(d,"baseFrame",void 0),o=nc(d,"columns",void 0),l=nc(d,"rows",void 0)):rc(h)?(h=nc(d=h,"key",void 0),a=nc(d,"baseFrame",void 0),o=nc(d,"columns",void 0),l=nc(d,"rows",void 0)):rc(a)?(a=nc(d=a,"baseFrame",void 0),o=nc(d,"columns",void 0),l=nc(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=nc(d,"baseFrame",void 0)):rc(o)&&(o=nc(d=o,"columns",void 0),l=nc(d,"rows",void 0)),void 0===a&&(a=nc(d,"frame",void 0)),void 0===o){var c=nc(d,"leftWidth",void 0),u=nc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=nc(d,"topHeight",void 0),v=nc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(nc(d,"getFrameNameCallback",void 0)),this.setStretchMode(nc(d,"stretchMode",0)),this.setPreserveRatio(nc(d,"preserveRatio",!0));var g=nc(d,"maxFixedPartScale",1),f=nc(d,"maxFixedPartScaleX",g),m=nc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,sc),i}(lc,"rexNinePatch")){}var cc={_drawImage:function(t,e,i,s,r,n){var h=oc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=oc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(dc.prototype,cc);let uc=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(zd(t,e))return t[e];var i=t.parent;return zd(i,e)?i[e]:void 0}set(t,e,i){return zd(t,e)?t[e]=i:zd(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const pc=Phaser.Utils.Objects.GetValue;class vc extends dc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=pc(e,"effects",!0);i&&Bd(this,i),this.style=new uc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vc.prototype,jl);const gc=["alpha","tint","flipX","flipY"];var fc=function(t,e){if(!e)return t;for(var i=0,s=gc.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rextextareainput.js b/dist/rextextareainput.js index 91e320331d..9290b5916d 100644 --- a/dist/rextextareainput.js +++ b/dist/rextextareainput.js @@ -24254,6 +24254,8 @@ this.setBackgroundColor(GetValue$a(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$a(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$a(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$a(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$a(o, 'backgroundRightX', 0)); return this; } @@ -24324,6 +24326,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -24478,6 +24486,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -24905,20 +24923,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -27788,7 +27810,7 @@ var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -28195,6 +28217,33 @@ }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -28843,6 +28892,7 @@ var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -28870,19 +28920,41 @@ } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -29077,6 +29149,11 @@ return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rextextareainput.min.js b/dist/rextextareainput.min.js index dbd48fb86e..5fe4b320a5 100644 --- a/dist/rextextareainput.min.js +++ b/dist/rextextareainput.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},Le={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Xe=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const xi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Oi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Oi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Li=function(t){return Ri(t,"complete")};const Xi=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Xi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Xi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Li(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Xi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Li(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,Yi),Ai.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Li(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Li(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Li(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Li(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Li(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Li(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Li(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ls={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},As={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ls,Xs,Ys,As);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?Is(e):t};class Fs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Vs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class $s extends Vs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Hi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},Ks=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},xr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class Or extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?xr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=bn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xn&&(this.state=bn)}get isSwiped(){return this.state===xn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",Cn="BEGIN",xn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,On=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Ln=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Xn={};const Yn=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Xn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(Wn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Vn}break;case Vn:t=An(Wn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Vn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Bn="BEGIN",Vn="RECOGNIZED",Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Xr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Ar.call(t,e),jr.call(t,e),Br.call(t,e),Ur.call(t,e),Nn.call(t,e),Gn.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(xh,uh,fh,mh,yh,bh,Ch);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ph=Phaser.Utils.Objects.IsPlainObject,Oh=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){Ph(e)?(e=Oh(h=e,"x",0),i=Oh(h,"y",0),s=Oh(h,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):Ph(s)?(s=Oh(h=s,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):Ph(n)&&(n=Oh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Oh(h,"space.item",0)),this.setStartChildIndex(Oh(h,"startChildIndex",0)),this.setRTL(Oh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,xh);var Th={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},kh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Eh=function(){return Array.prototype.reduce.call(arguments,Mh,0)},Mh=function(t,e){return t+e};const Dh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue,Lh=Phaser.Display.Align.CENTER;var Xh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ah(this.sizerChildren,null),vh.call(this,t),this}},Wh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ah(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ah(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ah(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Hh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Nh=Phaser.Utils.Objects.IsPlainObject,Uh=Phaser.Utils.Objects.GetValue;class Gh extends th{constructor(t,e,i,s,r,n,h,a,o,l){Nh(e)?(e=Uh(l=e,"x",0),i=Uh(l,"y",0),s=Uh(l,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(s)?(s=Uh(l=s,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(n)?(n=Uh(l=n,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(a)&&(a=Uh(l=a,"columnProportions",0),o=Uh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Uh(l,"createCellContainerCallback")),this.setIndentLeft(Uh(l,"space.indentLeftOdd",0),Uh(l,"space.indentLeftEven",0)),this.setIndentTop(Uh(l,"space.indentTopOdd",0),Uh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Uh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Hh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Gh.prototype,Bh);const $h=Phaser.Utils.Objects.GetValue;var Jh=Phaser.Renderer.WebGL.Utils,qh=function(t,e,i,s,r,n){for(var h=Jh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ea=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ia=Phaser.Renderer.Canvas.SetTransform;var sa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&qh(r,h,e,l,a,o),e.isStroked&&Zh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ia(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(na.prototype,sa);const ha=Phaser.Utils.Objects.GetValue;let aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ha(t,"x",0),i=ha(t,"y",0));var s=this.cornerRadius;s.tl=oa(ha(t,"tl",void 0),e,i),s.tr=oa(ha(t,"tr",void 0),e,i),s.bl=oa(ha(t,"bl",void 0),e,i),s.br=oa(ha(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){la(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){la(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){la(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){la(this.cornerRadius.br,t)}};var oa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),da(t),t},la=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ha(e,"x",0),t.y=ha(e,"y",0)),da(t)},da=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ca=function(t){return t.x>0&&t.y>0},ua=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const pa=Phaser.Math.DegToRad;var va=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const yo=Phaser.Utils.Objects.GetValue,bo=Phaser.Utils.Objects.IsPlainObject;class Co extends(Va(Ya)){constructor(t,e,i,s,r,n,h,a){bo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):bo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):bo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new fo).setName("trackFill")).addShape((new fo).setName("bar")).addShape((new fo).setName("trackStroke")),this.setTrackColor(yo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(yo(a,"trackStrokeThickness",2),yo(a,"trackStrokeColor",void 0)),this.setSkewX(yo(a,"skewX",0)),this.setRTL(yo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var xo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&mo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),mo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&mo(a,0,0,e,i,t)}};Object.assign(Co.prototype,xo);var wo=function(t){return null==t||""===t||0===t.length},So=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(wo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(wo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nFo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Fo(t[i]));return e}const Bo=Phaser.Utils.Objects.IsPlainObject,Vo=Phaser.Utils.Objects.GetValue;var Ho=function(t){return"string"==typeof t&&(t=No[t]),t};const No={scale:0,repeat:1};var Uo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Go={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Io),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Fo(i),s=Fo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==P&&"number"!==P||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Bo(t)?(this.stretchMode.edge=Ho(Vo(t,"edge",0)),this.stretchMode.internal=Ho(Vo(t,"internal",0))):(t=Ho(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Uo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const $o=Phaser.Utils.Objects.IsPlainObject,Jo=Phaser.Utils.Objects.GetValue,qo=Phaser.GameObjects;var Ko=void 0,Zo=function(t,e){if(Ko||(Ko={},ti(t).events.once("destroy",(function(){for(var t in Ko)Ko[t].destroy();Ko=void 0}))),!Ko.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new qo[e](i)).setOrigin(0),Ko[e]=t}return Ko[e]};const Qo=Phaser.GameObjects.RenderTexture;class tl extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if($o(i)?(i=Jo(d=i,"x",0),s=Jo(d,"y",0),r=Jo(d,"width",1),n=Jo(d,"height",1),h=Jo(d,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(r)?(r=Jo(d=r,"width",1),n=Jo(d,"height",1),h=Jo(d,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(h)?(h=Jo(d=h,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(a)?(a=Jo(d=a,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Jo(d,"baseFrame",void 0)):$o(o)&&(o=Jo(d=o,"columns",void 0),l=Jo(d,"rows",void 0)),void 0===a&&(a=Jo(d,"frame",void 0)),void 0===o){var c=Jo(d,"leftWidth",void 0),u=Jo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Jo(d,"topHeight",void 0),v=Jo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Jo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Jo(d,"stretchMode",0)),this.setPreserveRatio(Jo(d,"preserveRatio",!0));var g=Jo(d,"maxFixedPartScale",1),f=Jo(d,"maxFixedPartScaleX",g),m=Jo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Go),i}(Qo,"rexNinePatch")){}var el={_drawImage:function(t,e,i,s,r,n){var h=Zo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Zo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(tl.prototype,el);class il extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(_o(t,e))return t[e];var i=t.parent;return _o(i,e)?i[e]:void 0}set(t,e,i){return _o(t,e)?t[e]=i:_o(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const sl=Phaser.Utils.Objects.GetValue;class rl extends tl{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=sl(e,"effects",!0);i&&Do(this,i),this.style=new il(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(rl.prototype,Ta);const nl=["alpha","tint","flipX","flipY"];var hl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Po(t,e);break;case"image":s=new jo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new rl(t,e):new Yo(t,e);break;default:s=new ka(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=nl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const zl=Phaser.Utils.Objects.GetValue,Wl=Phaser.Math.Distance.Between;class jl extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=zl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(zl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(zl(t,"enable",!0)),this.holdThreshold=zl(t,"holdThreshold",50),this.pointerOutReleaseEnable=zl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Wl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Il=Phaser.Utils.Objects.GetValue;class Fl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Il(t,"value",0)),this.setSpeed(Il(t,"speed",0)),this.setAcceleration(Il(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Bl{constructor(){this.value,this.dir,this.movement=new Fl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Ul={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Gl=Phaser.Utils.Objects.GetValue;class $l extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Gl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Gl(e,"speed",.1)),this.setEnable(Gl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Gl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Jl=Phaser.Utils.Objects.GetValue;var ql=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Jl(s,l,void 0):Jl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Yl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Jl(r,"position",0);"string"==typeof p&&(p=Kl[p]);var v,g,f=Jl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Jl(s,"space.slider",void 0))&&(a?f=0:v=Jl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Jl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Jl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Jl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Jl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Jl(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Jl(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Jl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Jl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Jl(s,"scrollDetectionMode");"string"==typeof b&&(b=Zl[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Jl(s,C,!0):Jl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Nl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,w,S,P,O,_=Jl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),x=new $l(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(w=h?"t":"s",P=`scroll${i}`):(w="t",P="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),y&&(a?(S=`childO${i}`,P=`scroll${i}`):(S="childOY",P="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),x&&(O=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const Kl={right:0,left:1,bottom:0,top:1},Zl={gameObject:0,rectBounds:1},Ql=Phaser.Utils.Objects.GetValue;var td=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ql(e,"width"),h=Ql(e,"height");n||Ql(e,"child.expandWidth",!0)||(s[1]=0),h||Ql(e,"child.expandHeight",!0)||(r[1]=0);var a=new Gh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=$h(i,"child"),r=$h(s,"gameObject",void 0);if(r){var n=$h(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),a.left=$h(n,"left",0),a.right=$h(n,"right",0);break;case 1:h.top=$h(n,"left",0),h.bottom=$h(n,"right",0),a.top=$h(n,"top",0),a.bottom=$h(n,"bottom",0);break;default:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),h.left=$h(n,"left",0),h.right=$h(n,"right",0)}e.add(r,{column:1,row:1,align:$h(s,"align","center"),padding:a,expand:{width:$h(s,"expandWidth",!0),height:$h(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:ql(t,a,"y",e);break;case 1:ql(t,a,"x",e);break;default:ql(t,a,"y",e),ql(t,a,"x",e)}return a},ed=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},id=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},sd=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(jd.prototype,Yd);const Id=Phaser.Utils.String.Pad;var Fd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Id(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Bd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Vd=Phaser.Math.DegToRad;var Hd=function(t){return!t.hasOwnProperty("convex")||t.convex},Nd=function(t){return t.x>0&&t.y>0},Ud=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,o,l,o,l,180,270,!1,h):Ud(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,s-o,l,o,l,270,360,!1,h):Ud(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,s-o,r-l,o,l,0,90,!1,h):Ud(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,o,r-l,o,l,90,180,!1,h):Ud(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const $d=Phaser.Utils.Objects.GetValue;class Jd extends jd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor($d(e,"color",null),$d(e,"color2",null),$d(e,"horizontalGradient",!0)),this.setStroke($d(e,"stroke",null),$d(e,"strokeThickness",2)),this.setCornerRadius($d(e,"cornerRadius",0),$d(e,"cornerIteration",null))}set color(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Bd("color2",t,this),Bd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Bd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Bd("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Gd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qd=Phaser.Utils.Objects.GetValue;class Kd extends jd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qd(e,"color",null),qd(e,"color2",null),qd(e,"horizontalGradient",!0)),this.setStroke(qd(e,"stroke",null),qd(e,"strokeThickness",2))}set color(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,qd(t,"color2",null),qd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Zd=Phaser.Utils.Objects.GetValue;class Qd{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Zd(t,"bold",!1)),this.setItalic(Zd(t,"italic",!1)),this.setFontSize(Zd(t,"fontSize","16px")),this.setFontFamily(Zd(t,"fontFamily","Courier")),this.setColor(Zd(t,"color","#fff")),this.setStrokeStyle(Zd(t,"stroke",null),Zd(t,"strokeThickness",0)),this.setShadow(Zd(t,"shadowColor",null),Zd(t,"shadowOffsetX",0),Zd(t,"shadowOffsetY",0),Zd(t,"shadowBlur",0)),this.setOffset(Zd(t,"offsetX",0),Zd(t,"offsetY",0)),this.setSpace(Zd(t,"leftSpace",0),Zd(t,"rightSpace",0)),this.setAlign(Zd(t,"align",void 0)),this.setBackgroundColor(Zd(t,"backgroundColor",null)),this.setBackgroundHeight(Zd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Zd(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Bd("stroke",t,this),Bd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Bd("shadowOffsetX",t,this),Bd("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Qd(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Fd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Fd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Fd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Fd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const tc=Phaser.Utils.Array.Remove,ec=Phaser.Utils.Array.Remove,ic="text",sc="image",rc="drawer",nc="space",hc="command";var ac=function(t){return t.type===ic&&"\n"===t.text},oc=function(t){return t.type===ic&&"\f"===t.text},lc=function(t){return t.type===ic};class dc extends jd{constructor(t,e,i){super(t,ic),this.updateTextFlag=!1,this.style=new Qd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var cc=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const uc=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class pc extends jd{constructor(t,e,i){super(t,sc),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=uc.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),uc.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class vc extends jd{constructor(t,e,i,s){super(t,rc),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class gc extends jd{constructor(t,e){super(t,nc),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class fc extends bd{constructor(t,e,i,s,r){super(t,hc),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var mc=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const yc={none:0,word:1,char:2,character:2,mix:3};var bc=/^[\x00-\x7F]+$/,Cc=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,h=3===i,a=!n&&!h,o=t.length,l=e,d=s.word,c=0,u=!1;l0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Pc.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Pc.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_c(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=_c(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=_c(t,"wrapMode");void 0===c&&(c=_c(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=yc[c]);var u=_c(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_c(t,"letterSpacing",0),v=_c(t,"hAlign",0),g=_c(t,"vAlign",0),f=_c(t,"justifyPercentage",.25),m=mc({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=k.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=R,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ec(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ec(t,"maxLines",0);var a=0===i,o=Ec(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ec(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ec(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ec(t,"letterSpacing",0),p=Ec(t,"rtl",!0),v=Ec(t,"hAlign",p?2:0),g=Ec(t,"vAlign",0),f=mc({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),D=Math.max(D,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=D,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return De(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),tc(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ec(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ic);return null===i?i=new dc(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Xd(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const tu=Phaser.Utils.Objects.GetFastValue;var eu={};class iu{constructor(t){this.pools=tu(t,"pools",eu)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Qc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Ou(this),_u(this)),this}setNumberInput(){return this.onUpdateCallback=Pu,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Eu=Phaser.Utils.Objects.GetValue,Mu=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Du=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Wu.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(ju(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Iu=new Wu,Fu=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Bu=/\S/,Vu=new Wu;Vu.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Bu.test(t)&&!Bu.test(e)},Vu.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Gu(t,null,null,i),i," ")},Uu.equals=function(t,e){return Wu.prototype.equals.call(Uu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const $u=new Wu;$u.tokenize=function(t){return t.slice()},$u.join=$u.removeEmpty=function(t){return t};const Ju=Phaser.Utils.Array.Remove;var qu=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Ju(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Iu.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},ep={cursorMoveLeft(){if(!this.isOpened)return this;var t=Zu(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Zu(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Qu(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Zu(tp(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Qu(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Zu(tp(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ip=Phaser.Utils.Objects.IsPlainObject;class sp extends nu{constructor(t,e,i,s,r,n){ip(e)?n=e:ip(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Du(e,"wrap.vAlign")||So(e,"wrap.vAlign",s=i?"center":"top"),Du(e,"wrap.wrapMode")||So(e,"wrap.wrapMode","char"),Du(e,"wrap.maxLines")||So(e,"wrap.maxLines",s=i?1:void 0),i&&So(e,"wrap.wrapWidth",1/0),Du(e,"wrap.useDefaultTextHeight")||So(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Du(e.edit,"inputType")){var s=i?"text":"textarea";So(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Lu(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ca(n.background,"focus"),o=Ca(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Eu(e,"edit");return void 0===i&&(i={}),ou(e,i,Mu),new ku(t,i)}(this,n),Xu.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),zu.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Au.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},Le={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Xe=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const xi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Oi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Oi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Li=function(t){return Ri(t,"complete")};const Xi=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Xi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Xi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Li(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Xi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Li(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,Yi),Ai.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Li(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Li(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Li(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Li(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Li(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Li(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Li(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ls={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},As={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ls,Xs,Ys,As);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?Is(e):t};class Fs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Vs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class $s extends Vs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Hi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},Ks=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},xr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class Or extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?xr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=bn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xn&&(this.state=bn)}get isSwiped(){return this.state===xn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",Cn="BEGIN",xn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,On=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Ln=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Xn={};const Yn=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Xn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(Wn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Vn}break;case Vn:t=An(Wn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Vn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Bn="BEGIN",Vn="RECOGNIZED",Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Xr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Ar.call(t,e),jr.call(t,e),Br.call(t,e),Ur.call(t,e),Nn.call(t,e),Gn.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(xh,uh,fh,mh,yh,bh,Ch);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ph=Phaser.Utils.Objects.IsPlainObject,Oh=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){Ph(e)?(e=Oh(h=e,"x",0),i=Oh(h,"y",0),s=Oh(h,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):Ph(s)?(s=Oh(h=s,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):Ph(n)&&(n=Oh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Oh(h,"space.item",0)),this.setStartChildIndex(Oh(h,"startChildIndex",0)),this.setRTL(Oh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,xh);var Th={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},kh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Eh=function(){return Array.prototype.reduce.call(arguments,Mh,0)},Mh=function(t,e){return t+e};const Dh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue,Lh=Phaser.Display.Align.CENTER;var Xh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ah(this.sizerChildren,null),vh.call(this,t),this}},Wh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ah(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ah(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ah(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Hh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Nh=Phaser.Utils.Objects.IsPlainObject,Uh=Phaser.Utils.Objects.GetValue;class Gh extends th{constructor(t,e,i,s,r,n,h,a,o,l){Nh(e)?(e=Uh(l=e,"x",0),i=Uh(l,"y",0),s=Uh(l,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(s)?(s=Uh(l=s,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(n)?(n=Uh(l=n,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(a)&&(a=Uh(l=a,"columnProportions",0),o=Uh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Uh(l,"createCellContainerCallback")),this.setIndentLeft(Uh(l,"space.indentLeftOdd",0),Uh(l,"space.indentLeftEven",0)),this.setIndentTop(Uh(l,"space.indentTopOdd",0),Uh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Uh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Hh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Gh.prototype,Bh);const $h=Phaser.Utils.Objects.GetValue;var Jh=Phaser.Renderer.WebGL.Utils,qh=function(t,e,i,s,r,n){for(var h=Jh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ea=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ia=Phaser.Renderer.Canvas.SetTransform;var sa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&qh(r,h,e,l,a,o),e.isStroked&&Zh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ia(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(na.prototype,sa);const ha=Phaser.Utils.Objects.GetValue;let aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ha(t,"x",0),i=ha(t,"y",0));var s=this.cornerRadius;s.tl=oa(ha(t,"tl",void 0),e,i),s.tr=oa(ha(t,"tr",void 0),e,i),s.bl=oa(ha(t,"bl",void 0),e,i),s.br=oa(ha(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){la(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){la(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){la(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){la(this.cornerRadius.br,t)}};var oa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),da(t),t},la=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ha(e,"x",0),t.y=ha(e,"y",0)),da(t)},da=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ca=function(t){return t.x>0&&t.y>0},ua=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const pa=Phaser.Math.DegToRad;var va=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const yo=Phaser.Utils.Objects.GetValue,bo=Phaser.Utils.Objects.IsPlainObject;class Co extends(Va(Ya)){constructor(t,e,i,s,r,n,h,a){bo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):bo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):bo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new fo).setName("trackFill")).addShape((new fo).setName("bar")).addShape((new fo).setName("trackStroke")),this.setTrackColor(yo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(yo(a,"trackStrokeThickness",2),yo(a,"trackStrokeColor",void 0)),this.setSkewX(yo(a,"skewX",0)),this.setRTL(yo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var xo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&mo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),mo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&mo(a,0,0,e,i,t)}};Object.assign(Co.prototype,xo);var wo=function(t){return null==t||""===t||0===t.length},So=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(wo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(wo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nFo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Fo(t[i]));return e}const Bo=Phaser.Utils.Objects.IsPlainObject,Vo=Phaser.Utils.Objects.GetValue;var Ho=function(t){return"string"==typeof t&&(t=No[t]),t};const No={scale:0,repeat:1};var Uo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Go={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Io),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Fo(i),s=Fo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==P&&"number"!==P||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Bo(t)?(this.stretchMode.edge=Ho(Vo(t,"edge",0)),this.stretchMode.internal=Ho(Vo(t,"internal",0))):(t=Ho(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Uo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const $o=Phaser.Utils.Objects.IsPlainObject,Jo=Phaser.Utils.Objects.GetValue,qo=Phaser.GameObjects;var Ko=void 0,Zo=function(t,e){if(Ko||(Ko={},ti(t).events.once("destroy",(function(){for(var t in Ko)Ko[t].destroy();Ko=void 0}))),!Ko.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new qo[e](i)).setOrigin(0),Ko[e]=t}return Ko[e]};const Qo=Phaser.GameObjects.RenderTexture;class tl extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if($o(i)?(i=Jo(d=i,"x",0),s=Jo(d,"y",0),r=Jo(d,"width",1),n=Jo(d,"height",1),h=Jo(d,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(r)?(r=Jo(d=r,"width",1),n=Jo(d,"height",1),h=Jo(d,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(h)?(h=Jo(d=h,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(a)?(a=Jo(d=a,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Jo(d,"baseFrame",void 0)):$o(o)&&(o=Jo(d=o,"columns",void 0),l=Jo(d,"rows",void 0)),void 0===a&&(a=Jo(d,"frame",void 0)),void 0===o){var c=Jo(d,"leftWidth",void 0),u=Jo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Jo(d,"topHeight",void 0),v=Jo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Jo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Jo(d,"stretchMode",0)),this.setPreserveRatio(Jo(d,"preserveRatio",!0));var g=Jo(d,"maxFixedPartScale",1),f=Jo(d,"maxFixedPartScaleX",g),m=Jo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Go),i}(Qo,"rexNinePatch")){}var el={_drawImage:function(t,e,i,s,r,n){var h=Zo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Zo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(tl.prototype,el);class il extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(_o(t,e))return t[e];var i=t.parent;return _o(i,e)?i[e]:void 0}set(t,e,i){return _o(t,e)?t[e]=i:_o(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const sl=Phaser.Utils.Objects.GetValue;class rl extends tl{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=sl(e,"effects",!0);i&&Do(this,i),this.style=new il(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(rl.prototype,Ta);const nl=["alpha","tint","flipX","flipY"];var hl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Po(t,e);break;case"image":s=new jo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new rl(t,e):new Yo(t,e);break;default:s=new ka(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=nl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const zl=Phaser.Utils.Objects.GetValue,Wl=Phaser.Math.Distance.Between;class jl extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=zl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(zl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(zl(t,"enable",!0)),this.holdThreshold=zl(t,"holdThreshold",50),this.pointerOutReleaseEnable=zl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Wl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Il=Phaser.Utils.Objects.GetValue;class Fl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Il(t,"value",0)),this.setSpeed(Il(t,"speed",0)),this.setAcceleration(Il(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Bl{constructor(){this.value,this.dir,this.movement=new Fl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Ul={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Gl=Phaser.Utils.Objects.GetValue;class $l extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Gl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Gl(e,"speed",.1)),this.setEnable(Gl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Gl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Jl=Phaser.Utils.Objects.GetValue;var ql=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Jl(s,l,void 0):Jl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Yl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Jl(r,"position",0);"string"==typeof p&&(p=Kl[p]);var v,g,f=Jl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Jl(s,"space.slider",void 0))&&(a?f=0:v=Jl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Jl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Jl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Jl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Jl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Jl(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Jl(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Jl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Jl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Jl(s,"scrollDetectionMode");"string"==typeof b&&(b=Zl[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Jl(s,C,!0):Jl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Nl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,w,S,P,O,_=Jl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),x=new $l(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(w=h?"t":"s",P=`scroll${i}`):(w="t",P="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),y&&(a?(S=`childO${i}`,P=`scroll${i}`):(S="childOY",P="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),x&&(O=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const Kl={right:0,left:1,bottom:0,top:1},Zl={gameObject:0,rectBounds:1},Ql=Phaser.Utils.Objects.GetValue;var td=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ql(e,"width"),h=Ql(e,"height");n||Ql(e,"child.expandWidth",!0)||(s[1]=0),h||Ql(e,"child.expandHeight",!0)||(r[1]=0);var a=new Gh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=$h(i,"child"),r=$h(s,"gameObject",void 0);if(r){var n=$h(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),a.left=$h(n,"left",0),a.right=$h(n,"right",0);break;case 1:h.top=$h(n,"left",0),h.bottom=$h(n,"right",0),a.top=$h(n,"top",0),a.bottom=$h(n,"bottom",0);break;default:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),h.left=$h(n,"left",0),h.right=$h(n,"right",0)}e.add(r,{column:1,row:1,align:$h(s,"align","center"),padding:a,expand:{width:$h(s,"expandWidth",!0),height:$h(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:ql(t,a,"y",e);break;case 1:ql(t,a,"x",e);break;default:ql(t,a,"y",e),ql(t,a,"x",e)}return a},ed=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},id=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},sd=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(jd.prototype,Yd);const Id=Phaser.Utils.String.Pad;var Fd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Id(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Bd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Vd=Phaser.Math.DegToRad;var Hd=function(t){return!t.hasOwnProperty("convex")||t.convex},Nd=function(t){return t.x>0&&t.y>0},Ud=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,o,l,o,l,180,270,!1,h):Ud(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,s-o,l,o,l,270,360,!1,h):Ud(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,s-o,r-l,o,l,0,90,!1,h):Ud(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,o,r-l,o,l,90,180,!1,h):Ud(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const $d=Phaser.Utils.Objects.GetValue;class Jd extends jd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor($d(e,"color",null),$d(e,"color2",null),$d(e,"horizontalGradient",!0)),this.setStroke($d(e,"stroke",null),$d(e,"strokeThickness",2)),this.setCornerRadius($d(e,"cornerRadius",0),$d(e,"cornerIteration",null))}set color(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Bd("color2",t,this),Bd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Bd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Bd("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Gd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qd=Phaser.Utils.Objects.GetValue;class Kd extends jd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qd(e,"color",null),qd(e,"color2",null),qd(e,"horizontalGradient",!0)),this.setStroke(qd(e,"stroke",null),qd(e,"strokeThickness",2))}set color(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,qd(t,"color2",null),qd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Zd=Phaser.Utils.Objects.GetValue;class Qd{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Zd(t,"bold",!1)),this.setItalic(Zd(t,"italic",!1)),this.setFontSize(Zd(t,"fontSize","16px")),this.setFontFamily(Zd(t,"fontFamily","Courier")),this.setColor(Zd(t,"color","#fff")),this.setStrokeStyle(Zd(t,"stroke",null),Zd(t,"strokeThickness",0)),this.setShadow(Zd(t,"shadowColor",null),Zd(t,"shadowOffsetX",0),Zd(t,"shadowOffsetY",0),Zd(t,"shadowBlur",0)),this.setOffset(Zd(t,"offsetX",0),Zd(t,"offsetY",0)),this.setSpace(Zd(t,"leftSpace",0),Zd(t,"rightSpace",0)),this.setAlign(Zd(t,"align",void 0)),this.setBackgroundColor(Zd(t,"backgroundColor",null)),this.setBackgroundHeight(Zd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Zd(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Zd(t,"backgroundLeftX",0)),this.setBackgroundRightX(Zd(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Bd("stroke",t,this),Bd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Bd("shadowOffsetX",t,this),Bd("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Qd(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Fd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Fd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Fd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Fd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const tc=Phaser.Utils.Array.Remove,ec=Phaser.Utils.Array.Remove,ic="text",sc="image",rc="drawer",nc="space",hc="command";var ac=function(t){return t.type===ic&&"\n"===t.text},oc=function(t){return t.type===ic&&"\f"===t.text},lc=function(t){return t.type===ic};class dc extends jd{constructor(t,e,i){super(t,ic),this.updateTextFlag=!1,this.style=new Qd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var cc=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const uc=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class pc extends jd{constructor(t,e,i){super(t,sc),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=uc.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),uc.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class vc extends jd{constructor(t,e,i,s){super(t,rc),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class gc extends jd{constructor(t,e){super(t,nc),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class fc extends bd{constructor(t,e,i,s,r){super(t,hc),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var mc=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const yc={none:0,word:1,char:2,character:2,mix:3};var bc=/^[\x00-\x7F]+$/,Cc=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,h=3===i,a=!n&&!h,o=t.length,l=e,d=s.word,c=0,u=!1;l0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Pc.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Pc.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_c(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=_c(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=_c(t,"wrapMode");void 0===c&&(c=_c(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=yc[c]);var u=_c(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_c(t,"letterSpacing",0),v=_c(t,"hAlign",0),g=_c(t,"vAlign",0),f=_c(t,"justifyPercentage",.25),m=mc({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=k.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=R,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ec(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ec(t,"maxLines",0);var a=0===i,o=Ec(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ec(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ec(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ec(t,"letterSpacing",0),p=Ec(t,"rtl",!0),v=Ec(t,"hAlign",p?2:0),g=Ec(t,"vAlign",0),f=mc({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),D=Math.max(D,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=D,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return De(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),tc(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ec(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ic);return null===i?i=new dc(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Xd(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const tu=Phaser.Utils.Objects.GetFastValue;var eu={};class iu{constructor(t){this.pools=tu(t,"pools",eu)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Qc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Ou(this),_u(this)),this}setNumberInput(){return this.onUpdateCallback=Pu,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Eu=Phaser.Utils.Objects.GetValue,Mu=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Du=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}ju.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Iu(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Fu=new ju,Bu=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Vu=/\S/,Hu=new ju;Hu.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Vu.test(t)&&!Vu.test(e)},Hu.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify($u(t,null,null,i),i," ")},Gu.equals=function(t,e){return ju.prototype.equals.call(Gu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Ju=new ju;Ju.tokenize=function(t){return t.slice()},Ju.join=Ju.removeEmpty=function(t){return t};const qu=Phaser.Utils.Array.Remove;var Ku=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),qu(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Fu.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},ip={cursorMoveLeft(){if(!this.isOpened)return this;var t=Qu(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Qu(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=tp(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Qu(ep(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=tp(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Qu(ep(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const sp=Phaser.Utils.Objects.IsPlainObject;class rp extends nu{constructor(t,e,i,s,r,n){sp(e)?n=e:sp(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Du(e,"wrap.vAlign")||So(e,"wrap.vAlign",s=i?"center":"top"),Du(e,"wrap.wrapMode")||So(e,"wrap.wrapMode","char"),Du(e,"wrap.maxLines")||So(e,"wrap.maxLines",s=i?1:void 0),i&&So(e,"wrap.wrapWidth",1/0),Du(e,"wrap.useDefaultTextHeight")||So(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Du(e.edit,"inputType")){var s=i?"text":"textarea";So(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Lu(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ca(n.background,"focus"),o=Ca(n.style,"cursor"),l=Ca(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Eu(e,"edit");return void 0===i&&(i={}),ou(e,i,Mu),new ku(t,i)}(this,n),Xu.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Wu.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Au.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Yu(l)&&Object.assign(l,o),zu.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rextextbox.min.js b/dist/rextextbox.min.js index 3f9643f8a2..e9b97b9d9e 100644 --- a/dist/rextextbox.min.js +++ b/dist/rextextbox.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const e=Phaser.Scene;var i=function(t){return t instanceof e},s=function(t){return null==t||"object"!=typeof t?null:i(t)?t:t.scene&&i(t.scene)?t.scene:t.parent&&t.parent.scene&&i(t.parent.scene)?t.parent.scene:null};const r=Phaser.Game;var n=function(t){return t instanceof r},h=function(t){return null==t||"object"!=typeof t?null:n(t)?t:n(t.game)?t.game:i(t)?t.sys.game:i(t.scene)?t.scene.sys.game:void 0};const a=Phaser.Utils.Objects.GetValue;class o{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(a(e,"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))}shutdown(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)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){return this.parent=t,this.scene=s(t),this.game=h(t),this}}Object.assign(o.prototype,t);const l=Phaser.GameObjects.Text;var d=function(t){return t instanceof l};const c=Phaser.GameObjects.BitmapText;var u=function(t){return t instanceof c},p=function(t){return u(t)?2:d(t)?0:1},v=function(t,e,i){switch(p(t)){case 0:i=t.getWrappedText(e);break;case 1:i=t.getPenManager(e,i);break;case 2:i=t.maxWidth>0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},g=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},f={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(g(t)),t=this.sections.join("\n"),this.lines=v(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(b,f,y,C);const w=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class S extends o{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=p(this.parent),this.pageStartIndexes=[],this.lines=v(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(w(t,"maxLines",void 0)),this.setPageBreak(w(t,"pageBreak","\f\n")),this.setText(w(t,"text","")),this.startLineIndex=w(t,"start",-1),this.endLineIndex=w(t,"end",void 0);var e=w(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(p(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(S.prototype,b);var T={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?x(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(g(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},P=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},O=function(t,e){for(var i=void 0,s=0;s0?k(n,t,h=(a=i)-d,a):"";var c,u=e-d;u>0?(a=(h=0)+u,this.insertIndex=a,c=k(n,t,h,a)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},E={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var h=P(this.parent,t);n=O(h,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)_.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(E,T);const L=Phaser.Utils.Objects.GetFastValue,M=Phaser.Utils.Objects.GetValue;class R extends o{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(M(t,"wrap",!1)),this.setTypeMode(M(t,"typeMode",0)),this.setTypingSpeed(M(t,"speed",333)),this.setTextCallback=L(t,"setTextCallback",null),this.setTextCallbackScope=L(t,"setTextCallbackScope",null),this.setTypingContent(L(t,"text","")),this.typingIndex=L(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=L(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=D[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=g(t);this.textWrapEnable&&(e=function(t,e){switch(p(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=P(this.parent,this.text).length,this}onTyping(){var t=_.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?x(this.parent,t):this.parent.setText(t)}}const D={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(R.prototype,E);const I=Phaser.Utils.Objects.GetValue,z={page:0,line:1};var Y=!1,X=function(t){Y||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return W(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return F(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iG(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eG(t).x,getChildLocalY:t=>G(t).y};const ot=Phaser.Math.DegToRad;var lt={updateChildRotation(t){var e=G(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=G(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return G(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return G(t).rotation=ot(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=G(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>G(t).rotation},dt={updateChildScale(t){var e=G(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=G(t),i=e.parent;return e.scaleX=ht(t.scaleX,i.scaleX),e.scaleY=ht(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=G(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=G(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>G(t).scaleX,getChildLocalScaleY:t=>G(t).scaleY},ct={updateChildVisible(t){var e=G(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=G(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),G(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),G(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=G(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>G(t).visible},ut={updateChildAlpha(t){var e=G(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=G(t),i=e.parent;return e.alpha=ht(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return G(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=G(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>G(t).alpha},pt={updateChildActive(t){var e=G(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return G(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),G(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=G(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>G(t).active},vt={updateChildScrollFactor(t){var e=G(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},gt={updateCameraFilter(t){var e=G(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},ft={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},mt=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Ct=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const wt=Phaser.Utils.Array;var St={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},li=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const di=/(\S+)\[(\d+)\]/i,ci=Phaser.Utils.Objects.GetValue;var ui=function(t,e){return void 0===e?t:t[e]},pi=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ci(e,"left",0),t.right=ci(e,"right",0),t.top=ci(e,"top",0),t.bottom=ci(e,"bottom",0)),t},vi={getInnerPadding(t){return ui(this.space,t)},setInnerPadding(t,e){return pi(this.space,t,e),this},getOuterPadding(t){return ui(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return pi(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ui(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),pi(this.getSizerConfig(t).padding,e,i),this}},gi=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},fi=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},mi=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},yi=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},xi=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ci=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},bi={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},wi=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?Hi:ji,this.repeatCounter=0,this}stop(){return this.state=Bi,this}update(t,e){this.state!==Bi&&this.state!==Ui&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ni)):(this.nowTime=this.duration,this.state=Ui):this.nowTime>=0&&(this.state=Hi))}get t(){var t;switch(this.state){case Bi:case ji:case Ni:t=0;break;case Hi:t=this.nowTime/this.duration;break;case Ui:t=1}return Wi(t,0,1)}set t(t){(t=Wi(t,-1,1))<0?(this.state=ji,this.nowTime=-this.delay*t):(this.state=Hi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Bi}get isDelay(){return this.state===ji}get isCountDown(){return this.state===Hi}get isRunning(){return this.state===ji||this.state===Hi}get isDone(){return this.state===Ui}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Bi=0,ji=1,Hi=2,Ni=3,Ui=-1;class Gi extends Yi{constructor(t,e){super(t,e),this.timer=new Fi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Tweens.Builders.GetEaseFunction;class qi extends Gi{resetFromJSON(t){return this.timer.resetFromJSON(Vi(t,"timer")),this.setEnable(Vi(t,"enable",!0)),this.setTarget(Vi(t,"target",this.parent)),this.setDelay(Ji(t,"delay",0)),this.setDuration(Ji(t,"duration",1e3)),this.setEase(Vi(t,"ease","Linear")),this.setRepeat(Vi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=$i(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Zi=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,Qi=Phaser.Math.Linear;class ts extends qi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Zi(t,"mode",0)),this.setScaleRange(Ki(t,"start",void 0),Ki(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ki(t,"x",this.parent.scaleX),this.startY=Ki(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ki(e,"x",void 0),this.endY=Ki(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Qi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const es={stop:0,destroy:1,yoyo:2};var is=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ts(t,a):r.resetFromJSON(a),r.restart(),r},ss=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ts&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ts(t,h):n.resetFromJSON(h),n.restart(),n},rs=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ns=function(t){return rs(t,"complete")};const hs=Phaser.Utils.Objects.IsPlainObject;var as={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=is(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),ns(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(hs(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ss(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),ns(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ns(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(hs(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ts(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),ns(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},os={};Object.assign(os,as),os.onInitScale=function(){as.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ei.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Utils.Objects.GetAdvancedValue,cs=Phaser.Math.Linear;class us extends qi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ls(t,"mode",0)),this.setAlphaRange(ds(t,"start",this.parent.alpha),ds(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ps[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=cs(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const ps={stop:0,destroy:1,yoyo:2},vs=Phaser.Utils.Objects.IsPlainObject;var gs=function(t,e,i,s){var r,n;vs(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new us(t,h):s.resetFromJSON(h),s.restart(),s},fs=function(t,e,i,s){i instanceof us&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new us(t,r):s.resetFromJSON(r),s.restart(),s};const ms=Phaser.Utils.Objects.IsPlainObject;var ys={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ms(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=gs(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ns(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ms(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=fs(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ns(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ns(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},xs={};Object.assign(xs,ys),xs.onInitFade=function(){ys.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ei.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Cs=Phaser.Utils.Objects.GetValue,bs=Phaser.Utils.Objects.GetAdvancedValue,ws=Phaser.Math.Linear;class Ss extends qi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Cs(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=bs(t,"x",void 0),i=bs(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ts[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=bs(i,"startX",void 0),this.startY=bs(i,"startY",void 0),this.endX=bs(i,"endX",void 0),this.endY=bs(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=ws(this.startX,this.endX,i)),this.hasMoveY&&(t.y=ws(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ts={stop:0,destroy:1,yoyo:2};var Ps=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Os=Phaser.Utils.Objects.IsPlainObject,ks=Phaser.Math.Distance.Between;var _s={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Os(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ks(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ss&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ps(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ps(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ss(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),ns(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),ns(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Os(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ks(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ss&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ps(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ps(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ss(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),ns(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),ns(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Es={};Object.assign(Es,_s),Es.onInitEaseMove=function(){_s.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ei.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ls=Phaser.Utils.Objects.GetValue;class Ms extends Di{constructor(t,e){super(t,e),this.timer=new Fi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Ls(t,"timer")),this.setEnable(Ls(t,"enable",!0)),this.setMode(Ls(t,"mode",1)),this.isRunning=Ls(t,"isRunning",!1),this.setMagnitudeMode(Ls(t,"magnitudeMode",1)),this.setAxisMode(Ls(t,"axis",0)),this.setDuration(Ls(t,"duration",500)),this.setMagnitude(Ls(t,"magnitude",10)),this.ox=Ls(t,"ox",void 0),this.oy=Ls(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=Rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=Is[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=Ds[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Ls(i,"magnitude",void 0),t=Ls(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const Rs={effect:0,behavior:1},Ds={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},Is={constant:0,decay:1},zs=Phaser.Utils.Objects.IsPlainObject;var Ys={shake(t,e,i){if(zs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new Ms(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),ns(this._shake)}};const Xs=Phaser.Utils.Objects.GetValue,As=Phaser.Math.Linear;class Ws extends qi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Xs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Xs(t,"from",i),this.toValue=Xs(t,"to",i),this.setEase(Xs(t,"ease",this.ease)),this.setDuration(Xs(t,"duration",this.duration)),this.setRepeat(Xs(t,"repeat",0)),this.setDelay(Xs(t,"delay",0)),this.setRepeatDelay(Xs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=As(this.fromValue,this.toValue,i)}}const Fs=Phaser.Utils.Objects.IsPlainObject;class Bs extends o{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new Ws(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(Fs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(Fs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var js={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new Bs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),rs(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},Hs=Phaser.Utils.Array.Remove,Ns={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var nr={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,r,n){var h=s(t);return h.time.delayedCall(e,(function(){h.game.events.once("poststep",(function(){i.call(r,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},hr={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=xe),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=xe),this.transitOutCallback=t,this}},ar={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},or={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},lr={};Object.assign(lr,nr,hr,ar,or);const dr=Phaser.Utils.Objects.GetValue;class cr extends o{constructor(t,e){super(t,e),this.setTransitInTime(dr(e,"duration.in",200)),this.setTransitOutTime(dr(e,"duration.out",200)),this.setTransitInCallback(dr(e,"transitIn")),this.setTransitOutCallback(dr(e,"transitOut")),this.oneShotMode=dr(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new rr(this,{eventEmitter:!1,initState:dr(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(cr.prototype,lr);var ur=function(t){if(t.parentContainer)return ur(t.parentContainer);var e=function(t){var e=t.displayList;return Et(e)?e:null}(t);return e?ur(e):t};class pr extends o{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=ur(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const vr=Phaser.GameObjects.Rectangle;class gr extends vr{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new pr(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const fr=Phaser.Utils.Objects.GetValue;class mr extends o{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(fr(t,"hitAreaMode",0)),this.setEnable(fr(t,"enable",!0)),this.setStopMode(fr(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=yr[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var yr={default:0,fullWindow:1};const xr=Phaser.Utils.Objects.GetValue;class Cr extends gr{constructor(t,e){super(t,xr(e,"color",0),xr(e,"alpha",.8)),this.touchEventStop=new mr(this,{hitAreaMode:1})}}var br={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,is(t,e)},scaleDown(t,e){ss(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,gs(t,e)},fadeOut(t,e){fs(t,e,!1)}},wr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,gs(t,e,t.alpha)},Sr=function(t,e){fs(t,e,!1)},Tr=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Bt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Pr=Phaser.Utils.Objects.GetValue;let Or=class extends cr{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=kr.popUp),null==e.transitOut&&(e.transitOut=kr.scaleDown),e.destroy=Pr(e,"destroy",!0),super(t,e);var i=Pr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Cr(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Pr(i,"transitIn",wr)),this.setCoverTransitOutCallback(Pr(i,"transitOut",Sr)));var s=Pr(e,"touchOutsideClose",!1),r=Pr(e,"duration.hold",-1),n=Pr(e,"timeOutClose",r>=0),h=Pr(e,"anyTouchClose",!1);Pr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Pr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Tr(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=kr[t]),t){case kr.popUp:t=br.popUp;break;case kr.fadeIn:t=br.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=kr[t]),t){case kr.scaleDown:t=br.scaleDown;break;case kr.fadeOut:t=br.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const kr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var _r=function(t){return t&&"function"==typeof t},Er={modal(t,e){return _r(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Or(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Lr=function(t,e,i,s,r){_r(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Mr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Lr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Lr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Lr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Lr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Lr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Lr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Lr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Lr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Lr.call(this,"shutdown",t,e,i,s),this}},Rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Dr={},Ir=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Tr(t,e.x,e.y,i,s):!!(r=Rr(e,n,!0))&&Tr(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Ur={press:0,pointerdown:0,release:1,pointerup:1};var Gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Nr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Vr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Jr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return $r.length=0,!0;return $r.length=0,!1},$r=[];const qr=Phaser.Utils.Objects.GetValue;class Zr extends o{constructor(t,e){super(t,e),this._enable=void 0;var i=qr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(qr(t,"enable",!0)),this.setMode(qr(t,"mode",1)),this.setClickInterval(qr(t,"clickInterval",100)),this.setDragThreshold(qr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Kr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Vr:Ir)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Kr={press:0,pointerdown:0,release:1,pointerup:1};var Qr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Zr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class tn extends sr{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const en=Phaser.Utils.Objects.GetValue;class sn extends o{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new tn,this.parent.setInteractive(en(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(en(t,"enable",!0)),this.setCooldown(en(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var rn={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Ir(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new sn(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new sn(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},nn={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},hn=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=wn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Sn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=wn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Ir(t,s,e,i)}}const wn=0,Sn=1,Tn="IDLE",Pn=Phaser.Utils.Objects.GetValue,On=Phaser.Math.Distance.Between;class kn extends bn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=_n},eventEmitter:!1};this.setRecongizedStateObject(new sr(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Pn(t,"time",250)),this.setTapInterval(Pn(t,"tapInterval",200)),this.setDragThreshold(Pn(t,"threshold",9)),this.setTapOffset(Pn(t,"tapOffset",10));var e=Pn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Pn(t,"maxTaps",void 0)),this.setMinTaps(Pn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case _n:this.state=En;break;case En:var t=this.lastPointer;On(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Ln,this.state=En);break;case Ln:this.state=En}}onDragEnd(){this.state===En&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Ln))}onDrag(){this.state!==_n&&this.pointer.getDistance()>this.dragThreshold&&(this.state=_n)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===En){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=_n):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Ln:this.state=_n)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Ln&&(this.state=_n)}get isTapped(){return this.state===Ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const _n="IDLE",En="BEGIN",Ln="RECOGNIZED",Mn=Phaser.Utils.Objects.GetValue;class Rn extends bn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Dn},eventEmitter:!1};this.setRecongizedStateObject(new sr(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Mn(t,"threshold",9)),this.setHoldTime(Mn(t,"time",251)),this}onDragStart(){this.state=In,0===this.holdTime&&(this.state=zn)}onDragEnd(){this.state=Dn}onDrag(){this.state!==Dn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Dn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===In&&t-this.pointer.downTime>=this.holdTime&&(this.state=zn)}get isPressed(){return this.state===zn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Dn="IDLE",In="BEGIN",zn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.Distance.Between,Xn=Phaser.Math.Angle.Between;var An={getDt:function(){var t;return t=this.scene,h(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Yn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Xn(e.x,e.y,t.x,t.y)}},Wn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Fn={};const Bn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.RadToDeg;class Hn extends bn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Nn},eventEmitter:!1};this.setRecongizedStateObject(new sr(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Bn(t,"threshold",10)),this.setVelocityThreshold(Bn(t,"velocityThreshold",1e3)),this.setDirectionMode(Bn(t,"dir","8dir")),this}onDragStart(){this.state=Un}onDragEnd(){this.state=Nn}onDrag(){this.state===Un&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Gn&&(this.state=Nn)}get isSwiped(){return this.state===Gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Wn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Fn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(jn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Hn.prototype,An);const Nn="IDLE",Un="BEGIN",Gn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue,Jn=Phaser.Utils.Array.SpliceOne,$n=Phaser.Math.Distance.Between,qn=Phaser.Math.Angle.Between;class Zn{constructor(t,e){var i=s(t);i===t&&(t=void 0);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.gameObject=t,t&&t.setInteractive(Vn(e,"inputConfig",void 0)),this.setEventEmitter(Vn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Vn(t,"enable",!0)),this.bounds=Vn(t,"bounds",void 0),this.tracerState=Qn,this.pointers.length=0,Kt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Kt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Qn:this.tracerState=th,this.onDrag1Start();break;case th:this.tracerState=eh,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Jn(this.pointers,e),this.tracerState){case th:this.tracerState=Qn,this.onDrag1End();break;case eh:this.tracerState=th,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case th:this.onDrag1();break;case eh:this.onDrag2()}}}dragCancel(){return this.tracerState===eh&&this.onDrag2End(),this.pointers.length=0,Kt(this.movedState),this.tracerState=Qn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==eh)return 0;var t=this.pointers[0],e=this.pointers[1];return $n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==eh)return 0;var t=this.pointers[0],e=this.pointers[1];return qn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Kn.x=e.x-i.x,Kn.y=e.y-i.y}else Kn.x=0,Kn.y=0;return Kn}get centerX(){if(this.tracerState!==eh)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==eh)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==eh)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==eh)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=ih,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Ir(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Ir(t,s,e,i)}}Object.assign(Zn.prototype,t);var Kn={};const Qn=0,th=1,eh=2,ih="IDLE";Phaser.Utils.Objects.GetValue;const sh=Phaser.Math.RotateAround;var rh=function(t,e,i,s){return sh(t,e,i,s),t.rotation+=s,t},nh={};const hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Math.Angle.WrapDegrees,oh=Phaser.Math.Angle.ShortestBetween,lh=Phaser.Math.RadToDeg,dh=Phaser.Math.DegToRad;var ch={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=nh),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=ah(lh(this.angleBetween));this.angle=oh(this.prevAngle,t),this.prevAngle=t,this.state=vh}break;case vh:t=ah(lh(this.angleBetween)),this.angle=oh(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===vh}get rotation(){return dh(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,ch);const uh="IDLE",ph="BEGIN",vh="RECOGNIZED",gh=Phaser.Utils.Objects.GetValue;var fh=function(t){var e=gh(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new kn(this,e),this._tap.on("tap",(function(t,e,s){an(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),an(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const mh=Phaser.Utils.Objects.GetValue;var yh=function(t){var e=mh(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Rn(this,e),this._press.on("pressstart",(function(t,e,s){an(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){an(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const xh=Phaser.Utils.Objects.GetValue;var Ch=function(t){var e=xh(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Hn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";an(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),an(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const bh=Phaser.Utils.Objects.GetValue;var wh=function(t,e){return t.setInteractive(),bh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:bh(e,"targets",[t]),targetMode:bh(e,"targetMode","parent"),eventEmitter:bh(e,"eventEmitter",t),eventNamePrefix:bh(e,"inputEventPrefix","child.")},ln.call(t,e),un.call(t,e),gn.call(t,e),xn.call(t,e),fh.call(t,e),yh.call(t,e),Ch.call(t,e),t},Sh={getSizerConfig:function(t){return void 0===t&&(t=this),ue(t)},getChildPrevState:function(t){var e=ue(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=ge(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=He(e,"color"),s=He(e,"lineWidth");var o=He(e,"name",!1);o&&(r=He(o,"createTextCallback",Ge),n=He(o,"createTextCallbackScope",void 0),"string"==typeof(h=He(o,"align","left-top"))&&(h=ye[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Ne(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);Ve(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const Rh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue,Ih=Phaser.Display.Align.CENTER,zh={min:0,full:-1};var Yh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;Ke.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=zh[e];else if(Rh(e)){var f;e=Dh(f=e,"proportion",void 0),i=Dh(f,"align",Ih),s=Dh(f,"padding",0),r=Dh(f,"expand",!1),n=Dh(f,"key",void 0),h=Dh(f,"index",void 0),t.isRexSizer||(a=Dh(f,"minWidth",void 0),o=Dh(f,"minHeight",void 0)),l=Dh(f,"fitRatio",0),d=Dh(f,"offsetX",0),c=Dh(f,"offsetY",0),u=Dh(f,"offsetOriginX",0),p=Dh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=ye[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=Ih),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zt(t)/Yt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=qe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?zt(t):a:t.minHeight=void 0===o?Yt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},Xh={add:Yh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Yh.call(this,new Lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return Rh(i)&&(i.index=t),Yh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=Mh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const Ah=ce.prototype.clear;var Wh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Ah.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Wh.call(this,t),this}},jh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=ye[e]),this.getSizerConfig(t).align=e,this}},Hh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Nh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Uh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Gh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Pi(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,wi.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,C=0,b=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=yi.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||fi.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&_h.call(this,t,void 0),mi.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||xi.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&_h.call(this,void 0,t),Ci.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Gh,Xh,Bh,jh,Hh,Nh,Uh);var Vh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Jh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const $h=Phaser.Utils.Objects.IsPlainObject,qh=Phaser.Utils.Objects.GetValue;class Zh extends Ph{constructor(t,e,i,s,r,n,h){$h(e)?(e=qh(h=e,"x",0),i=qh(h,"y",0),s=qh(h,"width",void 0),r=qh(h,"height",void 0),n=qh(h,"orientation",0)):$h(s)?(s=qh(h=s,"width",void 0),r=qh(h,"height",void 0),n=qh(h,"orientation",0)):$h(n)&&(n=qh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(qh(h,"space.item",0)),this.setStartChildIndex(qh(h,"startChildIndex",0)),this.setRTL(qh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Jh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Vh.call(this)),this._childrenProportion}}Object.assign(Zh.prototype,Gh);var Kh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Qh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class ta extends Zh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Kh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Kh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Kh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Kh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(ta.prototype,Qh);var ea=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const ia=Phaser.GameObjects.Graphics;class sa extends ia{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=ra[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=qe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=qe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&Qt(i,this.padding),this.originX=s.originX,this.originY=s.originY,ea.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,ea.call(this,this.width,this.height,this.padding,t,e)),this}}const ra={rectangle:0,circle:1};var na=function(t,e,i,s){var r=new sa(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const ha=Phaser.Utils.Objects.GetValue,aa=Phaser.Utils.Objects.GetValue;var oa=/^[\x00-\x7F]+$/,la=function(t){return oa.test(t)},da=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},ua=2;const pa={none:0,word:1,char:ua,character:ua,mix:3};var va=function(t,e){switch(p(t)){case 0:switch("string"==typeof e&&(e=pa[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=da;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=pa[e]||0),t.style.wrapMode=e}};const ga=Phaser.Renderer.WebGL.Utils;var fa={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ga.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ma=Phaser.Display.Color;var ya={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ma);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},xa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};X();const Ca=Phaser.Display.Canvas.CanvasPool,ba=Phaser.GameObjects.GameObject,wa=Phaser.Utils.String.UUID;class Sa extends ba{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Ca.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=wa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Ca.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Ta=Phaser.GameObjects.Components;Phaser.Class.mixin(Sa,[Ta.Alpha,Ta.BlendMode,Ta.Crop,Ta.Depth,Ta.Flip,Ta.GetBounds,Ta.Mask,Ta.Origin,Ta.Pipeline,Ta.PostPipeline,Ta.ScrollFactor,Ta.Tint,Ta.Transform,Ta.Visible,fa,ya,xa]);var Pa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ks(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&Kt(this.data),this}};class Oa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Oa.prototype,Pa);var ka={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const _a=Phaser.Math.RotateAround;var Ea;const La=Phaser.Geom.Rectangle;var Ma,Ra=function(t){void 0===Ma&&(Ma=new La);var e=t.drawTLX,i=t.drawTLY;return Ma.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ma};const Da=Phaser.Math.RotateAround;var Ia,za=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ia&&(Ia={}),s=Ia),s.x=e,s.y=i,0!==t.rotation&&Da(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ya=Phaser.GameObjects.Components.TransformMatrix;var Xa,Aa,Wa={},Fa=function(t,e,i,s,r){var n=za(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Wa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Xa&&(Xa=new Ya,Aa=new Ya),t.parentContainer?t.getWorldTransformMatrix(Xa,Aa):Xa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Xa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ba=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Fa(t,e,n,h,r)},ja={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ea&&(Ea={}),s=Ea),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&_a(s,0,0,-i.rotation),s}(t,e,this,!0);return Ra(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ba(this.parent,this,t,e,i)}};Object.assign(ja,ka);const Ha=Phaser.Math.DegToRad,Na=Phaser.Math.RadToDeg,Ua=Phaser.Utils.Objects.GetValue;class Ga extends Oa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Na(this._rotation)}set angle(t){this.rotation=Ha(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ua(t,"width",void 0),i=Ua(t,"height",void 0),s=Ua(t,"scaleX",void 0),r=Ua(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ga.prototype,ja);const Va=Phaser.Utils.String.Pad;var Ja=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Va(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},$a=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const qa=Phaser.Utils.Objects.GetValue;class Za{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=qa(t,"x",0),i=qa(t,"y",0));var s=this.cornerRadius;s.tl=Ka(qa(t,"tl",void 0),e,i),s.tr=Ka(qa(t,"tr",void 0),e,i),s.bl=Ka(qa(t,"bl",void 0),e,i),s.br=Ka(qa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Qa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Qa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Qa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Qa(this.cornerRadius.br,t)}}var Ka=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),to(t),t},Qa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=qa(e,"x",0),t.y=qa(e,"y",0)),to(t)},to=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const eo=Phaser.Math.DegToRad;var io=function(t){return!t.hasOwnProperty("convex")||t.convex},so=function(t){return t.x>0&&t.y>0},ro=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,so(a)?(o=a.x*g,l=a.y*f,io(a)?ro(t,o,l,o,l,180,270,!1,h):ro(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,so(a)?(o=a.x*g,l=a.y*f,io(a)?ro(t,s-o,l,o,l,270,360,!1,h):ro(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,so(a)?(o=a.x*g,l=a.y*f,io(a)?ro(t,s-o,r-l,o,l,0,90,!1,h):ro(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,so(a)?(o=a.x*g,l=a.y*f,io(a)?ro(t,o,r-l,o,l,90,180,!1,h):ro(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const ho=Phaser.Utils.Objects.GetValue;class ao extends Ga{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ho(e,"color",null),ho(e,"color2",null),ho(e,"horizontalGradient",!0)),this.setStroke(ho(e,"stroke",null),ho(e,"strokeThickness",2)),this.setCornerRadius(ho(e,"cornerRadius",0),ho(e,"cornerIteration",null))}set color(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,$a("color2",t,this),$a("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$a("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,$a("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),no(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const oo=Phaser.Utils.Objects.GetValue;class lo extends Ga{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(oo(e,"color",null),oo(e,"color2",null),oo(e,"horizontalGradient",!0)),this.setStroke(oo(e,"stroke",null),oo(e,"strokeThickness",2))}set color(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,oo(t,"color2",null),oo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,oo(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const co=Phaser.Utils.Objects.GetValue;class uo{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(co(t,"bold",!1)),this.setItalic(co(t,"italic",!1)),this.setFontSize(co(t,"fontSize","16px")),this.setFontFamily(co(t,"fontFamily","Courier")),this.setColor(co(t,"color","#fff")),this.setStrokeStyle(co(t,"stroke",null),co(t,"strokeThickness",0)),this.setShadow(co(t,"shadowColor",null),co(t,"shadowOffsetX",0),co(t,"shadowOffsetY",0),co(t,"shadowBlur",0)),this.setOffset(co(t,"offsetX",0),co(t,"offsetY",0)),this.setSpace(co(t,"leftSpace",0),co(t,"rightSpace",0)),this.setAlign(co(t,"align",void 0)),this.setBackgroundColor(co(t,"backgroundColor",null)),this.setBackgroundHeight(co(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(co(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle($a("stroke",t,this),$a("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset($a("shadowOffsetX",t,this),$a("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new uo(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ja(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ja(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ja(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ja(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const po=Phaser.Utils.Array.Remove,vo=Phaser.Utils.Array.Remove,go="text",fo="image",mo="drawer",yo="space",xo="command";var Co=function(t){return t.type===go&&"\n"===t.text},bo=function(t){return t.type===go&&"\f"===t.text},wo=function(t){return t.type===go};class So extends Ga{constructor(t,e,i){super(t,go),this.updateTextFlag=!1,this.style=new uo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var To=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Po=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Oo extends Ga{constructor(t,e,i){super(t,fo),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Po.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Po.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class ko extends Ga{constructor(t,e,i,s){super(t,mo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class _o extends Ga{constructor(t,e){super(t,yo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Eo extends Oa{constructor(t,e,i,s,r){super(t,xo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Lo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Lo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Lo(t[i]));return e}var Mo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ro={none:0,word:1,char:2,character:2,mix:3};var Do=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Xo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Xo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Wo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Wo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Wo(t,"wrapMode");void 0===c&&(c=Wo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ro[c]);var u=Wo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Wo(t,"letterSpacing",0),v=Wo(t,"hAlign",0),g=Wo(t,"vAlign",0),f=Wo(t,"justifyPercentage",.25),m=Mo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,C=y.length;x0&&(E.push({children:L,width:M}),R=Math.max(R,M)),m.start+=_.length,m.isLastPage=!D&&m.start===k,m.maxLineWidth=R,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=jo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=jo(t,"maxLines",0);var a=0===i,o=jo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=jo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=jo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=jo(t,"letterSpacing",0),p=jo(t,"rtl",!0),v=jo(t,"hAlign",p?2:0),g=jo(t,"vAlign",0),f=Mo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:L}),M=Math.max(M,L)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=M,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,A=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return pi(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ui(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),po(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return vo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(go);return null===i?i=new So(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ba(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const pl=Phaser.Utils.Objects.GetFastValue;var vl={};class gl{constructor(t){this.pools=pl(t,"pools",vl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ul),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Sl(t,r,e,i,n),a=0;a<=Cl&&0!==h;a++){if((r+=h)<0){r=0;break}h=Sl(t,r,e,i,n)}return a===Cl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Tl(t,e,i),t},wl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Sl=function(t,e,i,s,r){var n,h=wl(t,e,r),a=wl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Tl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Pl=Phaser.Utils.Objects.GetValue;var Ol=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Pl(e,"minWidth",0),s=Pl(e,"minHeight",0),r=Pl(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return bl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),bl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const kl=Phaser.Utils.Objects.GetValue,_l=[function(t){var e=this.scene,i=ha(t,"orientation",0);this.setOrientation(i);var s=ha(t,"icon",void 0),r=ha(t,"iconMask",void 0),n=ha(t,"innerBackground",void 0),h=ha(t,"title",void 0),a=ha(t,"separator",void 0),o=ha(t,"text",void 0),l=ha(t,"action",void 0),d=ha(t,"actionMask",void 0);if(s){var c=ha(t,"align.icon","center");m=0===this.orientation?{right:ha(t,"space.icon",0),top:ha(t,"space.iconTop",0),bottom:ha(t,"space.iconBottom",0),left:ha(t,"space.iconLeft",0)}:{bottom:ha(t,"space.icon",0),left:ha(t,"space.iconLeft",0),right:ha(t,"space.iconRight",0),top:ha(t,"space.iconTop",0)};var u=ha(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:u}),r&&(r=na.call(this,s,s,1)),!u){var p=ha(t,"iconSize",void 0);this.setIconSize(ha(t,"iconWidth",p),ha(t,"iconHeight",p))}}var v=new Zh(e,{orientation:1});n&&v.addBackground(n);var g=ha(t,"space.separator",0);if(h){c=ha(t,"align.title","left");var f=ha(t,"expandTitleWidth",!1);y=ha(t,"expandTitleHeight",!1)?1:0,x=f,m={bottom:!a&&o?ha(t,"space.title",g):0,left:ha(t,"space.titleLeft",0),right:ha(t,"space.titleRight",0)},v.add(h,{proportion:y,expand:x,align:c,padding:m})}if(a){var m={top:h?g:0,bottom:o?g:0,left:ha(t,"space.separatorLeft",0),right:ha(t,"space.separatorRight",0)};v.add(a,{expand:!0,padding:m})}if(o){c=ha(t,"align.text","left");var y,x,C=ha(t,"expandTextWidth",!1);y=ha(t,"expandTextHeight",!1)?1:0,x=C,m={left:ha(t,"space.textLeft",0),right:ha(t,"space.textRight",0)},v.add(o,{proportion:y,expand:x,align:c,padding:m})}if(m=void 0,l&&(m={right:ha(t,"space.text",0)}),this.add(v,{proportion:1,padding:m}),l&&(c=ha(t,"align.action","center"),m=0===this.orientation?{top:ha(t,"space.actionTop",0),bottom:ha(t,"space.actionBottom",0),right:ha(t,"space.actionRight",0)}:{left:ha(t,"space.actionLeft",0),right:ha(t,"space.actionRight",0),bottom:ha(t,"space.actionBottom",0)},u=ha(t,"squareFitAction",!1)?1:0,this.add(l,{proportion:0,align:c,padding:m,fitRatio:u}),d&&(d=na.call(this,l,l,1)),!u)){var b=ha(t,"actionSize");this.setActionSize(ha(t,"actionWidth",b),ha(t,"actionHeight",b))}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",v),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",h),this.addChildrenMap("separator",a),this.addChildrenMap("text",o),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",d)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=aa(t,"title",void 0),s=aa(t,"separator",void 0),r=aa(t,"innerBackground",void 0),n=aa(t,"icon",void 0),h=aa(t,"iconMask",void 0),a=aa(t,"text",void 0),o=aa(t,"action",void 0),l=aa(t,"actionMask",void 0);if(i){var d=aa(t,"align.title","left"),c=aa(t,"expandTitleWidth",!1);y=aa(t,"expandTitleHeight",!1)?1:0,x=c,p={bottom:aa(t,"space.title",0),left:aa(t,"space.titleLeft",0),right:aa(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:x,align:d,padding:p})}if(s){var u=aa(t,"space.separator",0),p={top:i?u:0,bottom:a?u:0,left:aa(t,"space.separatorLeft",0),right:aa(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var v=aa(t,"orientation",0),g=new Zh(e,{orientation:v,rtl:aa(t,"rtl",!1),space:{left:aa(t,"space.innerLeft",0),right:aa(t,"space.innerRight",0),top:aa(t,"space.innerTop",0),bottom:aa(t,"space.innerBottom",0)}});if(r&&g.addBackground(r),this.add(g,{proportion:1,expand:!0}),n){d=aa(t,"align.icon","center"),p=0===g.orientation?{right:aa(t,"space.icon",0),top:aa(t,"space.iconTop",0),bottom:aa(t,"space.iconBottom",0),left:aa(t,"space.iconLeft",0)}:{bottom:aa(t,"space.icon",0),left:aa(t,"space.iconLeft",0),right:aa(t,"space.iconRight",0),top:aa(t,"space.iconTop",0)};var f=aa(t,"squareFitIcon",!1)?1:0;if(g.add(n,{proportion:0,align:d,padding:p,fitRatio:f}),h&&(h=na.call(this,n,n,1)),!f){var m=aa(t,"iconSize",void 0);this.setIconSize(aa(t,"iconWidth",m),aa(t,"iconHeight",m))}}if(a){d=aa(t,"align.text","left");var y,x,C=aa(t,"space.text",0),b=aa(t,"expandTextWidth",!1),w=aa(t,"expandTextHeight",!1);0===g.orientation?(y=b?1:0,o&&(p={right:C}),x=w):(y=w?1:0,o&&(p={bottom:C}),x=b),g.add(a,{proportion:y,expand:x,align:d,padding:p})}if(o&&(d=aa(t,"align.action","center"),p=0===g.orientation?{top:aa(t,"space.actionTop",0),bottom:aa(t,"space.actionBottom",0),right:aa(t,"space.actionRight",0)}:{left:aa(t,"space.actionLeft",0),right:aa(t,"space.actionRight",0),bottom:aa(t,"space.actionBottom",0)},f=aa(t,"squareFitAction",!1)?1:0,g.add(o,{proportion:0,align:d,padding:p,fitRatio:f}),l&&(l=na.call(this,o,o,1)),!f)){var S=aa(t,"actionSize");this.setActionSize(aa(t,"actionWidth",S),aa(t,"actionHeight",S))}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",h),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)}];class El extends ta{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=kl(e,"background",void 0);i&&this.addBackground(i);var s=kl(e,"title",void 0),r=kl(e,"text",void 0);if(s){var n=kl(e,"wrapTitle",!1),h=kl(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),va(s,n),e.expandTitleWidth=!0,xl(s)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Ol(s,{fitHeight:!0}))}if(r){var a=kl(e,"wrapText",!1),o=kl(e,"adjustTextFontSize",!1);a?(!0===a&&(a="word"),va(r,a),e.expandTextWidth=!0,xl(r)):o&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Ol(r,{fitHeight:!0}))}var l=kl(e,"layoutMode",0);(_l[l]||_l[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Ll extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=I(i,"expandTextWidth",!1),n=I(i,"expandTextHeight",!1);if(r||n){var h=p(s);switch(h){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,h=n?e:0;s.setFixedSize(i,h),i>0&&s.setWordWrapWidth(i)},1===h){var a=s.style;0===a.wrapMode&&(a.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(I(i,"typingMode","page")),this.page=new S(s,I(i,"page",void 0)),this.typing=new R(s,I(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=z[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(El)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}return Ll},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextextbox=e(); +var t,e;t=void 0,e=function(){var t={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const e=Phaser.Scene;var i=function(t){return t instanceof e},s=function(t){return null==t||"object"!=typeof t?null:i(t)?t:t.scene&&i(t.scene)?t.scene:t.parent&&t.parent.scene&&i(t.parent.scene)?t.parent.scene:null};const r=Phaser.Game;var n=function(t){return t instanceof r},h=function(t){return null==t||"object"!=typeof t?null:n(t)?t:n(t.game)?t.game:i(t)?t.sys.game:i(t.scene)?t.scene.sys.game:void 0};const a=Phaser.Utils.Objects.GetValue;class o{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(a(e,"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))}shutdown(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)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){return this.parent=t,this.scene=s(t),this.game=h(t),this}}Object.assign(o.prototype,t);const l=Phaser.GameObjects.Text;var d=function(t){return t instanceof l};const c=Phaser.GameObjects.BitmapText;var u=function(t){return t instanceof c},p=function(t){return u(t)?2:d(t)?0:1},v=function(t,e,i){switch(p(t)){case 0:i=t.getWrappedText(e);break;case 1:i=t.getPenManager(e,i);break;case 2:i=t.maxWidth>0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},g=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},f={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(g(t)),t=this.sections.join("\n"),this.lines=v(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(C,f,y,b);const w=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class S extends o{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=p(this.parent),this.pageStartIndexes=[],this.lines=v(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(w(t,"maxLines",void 0)),this.setPageBreak(w(t,"pageBreak","\f\n")),this.setText(w(t,"text","")),this.startLineIndex=w(t,"start",-1),this.endLineIndex=w(t,"end",void 0);var e=w(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(p(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(S.prototype,C);var T={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?x(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(g(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},P=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},O=function(t,e){for(var i=void 0,s=0;s0?k(n,t,h=(a=i)-d,a):"";var c,u=e-d;u>0?(a=(h=0)+u,this.insertIndex=a,c=k(n,t,h,a)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},E={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var h=P(this.parent,t);n=O(h,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)_.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(E,T);const L=Phaser.Utils.Objects.GetFastValue,M=Phaser.Utils.Objects.GetValue;class R extends o{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(M(t,"wrap",!1)),this.setTypeMode(M(t,"typeMode",0)),this.setTypingSpeed(M(t,"speed",333)),this.setTextCallback=L(t,"setTextCallback",null),this.setTextCallbackScope=L(t,"setTextCallbackScope",null),this.setTypingContent(L(t,"text","")),this.typingIndex=L(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=L(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=D[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=g(t);this.textWrapEnable&&(e=function(t,e){switch(p(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=P(this.parent,this.text).length,this}onTyping(){var t=_.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?x(this.parent,t):this.parent.setText(t)}}const D={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(R.prototype,E);const I=Phaser.Utils.Objects.GetValue,X={page:0,line:1};var z=!1,Y=function(t){z||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return W(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return F(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iG(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eG(t).x,getChildLocalY:t=>G(t).y};const ot=Phaser.Math.DegToRad;var lt={updateChildRotation(t){var e=G(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=G(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return G(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return G(t).rotation=ot(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=G(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>G(t).rotation},dt={updateChildScale(t){var e=G(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=G(t),i=e.parent;return e.scaleX=ht(t.scaleX,i.scaleX),e.scaleY=ht(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=G(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=G(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>G(t).scaleX,getChildLocalScaleY:t=>G(t).scaleY},ct={updateChildVisible(t){var e=G(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=G(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),G(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),G(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=G(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>G(t).visible},ut={updateChildAlpha(t){var e=G(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=G(t),i=e.parent;return e.alpha=ht(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return G(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=G(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>G(t).alpha},pt={updateChildActive(t){var e=G(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return G(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),G(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=G(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>G(t).active},vt={updateChildScrollFactor(t){var e=G(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},gt={updateCameraFilter(t){var e=G(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},ft={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},mt=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},bt=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const wt=Phaser.Utils.Array;var St={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},li=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const di=/(\S+)\[(\d+)\]/i,ci=Phaser.Utils.Objects.GetValue;var ui=function(t,e){return void 0===e?t:t[e]},pi=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ci(e,"left",0),t.right=ci(e,"right",0),t.top=ci(e,"top",0),t.bottom=ci(e,"bottom",0)),t},vi={getInnerPadding(t){return ui(this.space,t)},setInnerPadding(t,e){return pi(this.space,t,e),this},getOuterPadding(t){return ui(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return pi(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ui(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),pi(this.getSizerConfig(t).padding,e,i),this}},gi=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},fi=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},mi=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},yi=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},xi=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},bi=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ci={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},wi=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?Hi:ji,this.repeatCounter=0,this}stop(){return this.state=Bi,this}update(t,e){this.state!==Bi&&this.state!==Ui&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ni)):(this.nowTime=this.duration,this.state=Ui):this.nowTime>=0&&(this.state=Hi))}get t(){var t;switch(this.state){case Bi:case ji:case Ni:t=0;break;case Hi:t=this.nowTime/this.duration;break;case Ui:t=1}return Wi(t,0,1)}set t(t){(t=Wi(t,-1,1))<0?(this.state=ji,this.nowTime=-this.delay*t):(this.state=Hi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Bi}get isDelay(){return this.state===ji}get isCountDown(){return this.state===Hi}get isRunning(){return this.state===ji||this.state===Hi}get isDone(){return this.state===Ui}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Bi=0,ji=1,Hi=2,Ni=3,Ui=-1;class Gi extends zi{constructor(t,e){super(t,e),this.timer=new Fi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Tweens.Builders.GetEaseFunction;class qi extends Gi{resetFromJSON(t){return this.timer.resetFromJSON(Vi(t,"timer")),this.setEnable(Vi(t,"enable",!0)),this.setTarget(Vi(t,"target",this.parent)),this.setDelay(Ji(t,"delay",0)),this.setDuration(Ji(t,"duration",1e3)),this.setEase(Vi(t,"ease","Linear")),this.setRepeat(Vi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=$i(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Zi=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,Qi=Phaser.Math.Linear;class ts extends qi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Zi(t,"mode",0)),this.setScaleRange(Ki(t,"start",void 0),Ki(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ki(t,"x",this.parent.scaleX),this.startY=Ki(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ki(e,"x",void 0),this.endY=Ki(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Qi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const es={stop:0,destroy:1,yoyo:2};var is=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ts(t,a):r.resetFromJSON(a),r.restart(),r},ss=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ts&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ts(t,h):n.resetFromJSON(h),n.restart(),n},rs=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ns=function(t){return rs(t,"complete")};const hs=Phaser.Utils.Objects.IsPlainObject;var as={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=is(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),ns(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(hs(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ss(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),ns(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ns(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(hs(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ts(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),ns(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},os={};Object.assign(os,as),os.onInitScale=function(){as.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ei.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Utils.Objects.GetAdvancedValue,cs=Phaser.Math.Linear;class us extends qi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ls(t,"mode",0)),this.setAlphaRange(ds(t,"start",this.parent.alpha),ds(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ps[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=cs(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const ps={stop:0,destroy:1,yoyo:2},vs=Phaser.Utils.Objects.IsPlainObject;var gs=function(t,e,i,s){var r,n;vs(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new us(t,h):s.resetFromJSON(h),s.restart(),s},fs=function(t,e,i,s){i instanceof us&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new us(t,r):s.resetFromJSON(r),s.restart(),s};const ms=Phaser.Utils.Objects.IsPlainObject;var ys={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ms(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=gs(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ns(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ms(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=fs(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ns(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ns(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},xs={};Object.assign(xs,ys),xs.onInitFade=function(){ys.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ei.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const bs=Phaser.Utils.Objects.GetValue,Cs=Phaser.Utils.Objects.GetAdvancedValue,ws=Phaser.Math.Linear;class Ss extends qi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(bs(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Cs(t,"x",void 0),i=Cs(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ts[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Cs(i,"startX",void 0),this.startY=Cs(i,"startY",void 0),this.endX=Cs(i,"endX",void 0),this.endY=Cs(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=ws(this.startX,this.endX,i)),this.hasMoveY&&(t.y=ws(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ts={stop:0,destroy:1,yoyo:2};var Ps=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Os=Phaser.Utils.Objects.IsPlainObject,ks=Phaser.Math.Distance.Between;var _s={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Os(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ks(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ss&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ps(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ps(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ss(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),ns(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),ns(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Os(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ks(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ss&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ps(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ps(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ss(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),ns(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),ns(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Es={};Object.assign(Es,_s),Es.onInitEaseMove=function(){_s.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ei.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ls=Phaser.Utils.Objects.GetValue;class Ms extends Di{constructor(t,e){super(t,e),this.timer=new Fi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Ls(t,"timer")),this.setEnable(Ls(t,"enable",!0)),this.setMode(Ls(t,"mode",1)),this.isRunning=Ls(t,"isRunning",!1),this.setMagnitudeMode(Ls(t,"magnitudeMode",1)),this.setAxisMode(Ls(t,"axis",0)),this.setDuration(Ls(t,"duration",500)),this.setMagnitude(Ls(t,"magnitude",10)),this.ox=Ls(t,"ox",void 0),this.oy=Ls(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=Rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=Is[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=Ds[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Ls(i,"magnitude",void 0),t=Ls(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const Rs={effect:0,behavior:1},Ds={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},Is={constant:0,decay:1},Xs=Phaser.Utils.Objects.IsPlainObject;var zs={shake(t,e,i){if(Xs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new Ms(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),ns(this._shake)}};const Ys=Phaser.Utils.Objects.GetValue,As=Phaser.Math.Linear;class Ws extends qi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Ys(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Ys(t,"from",i),this.toValue=Ys(t,"to",i),this.setEase(Ys(t,"ease",this.ease)),this.setDuration(Ys(t,"duration",this.duration)),this.setRepeat(Ys(t,"repeat",0)),this.setDelay(Ys(t,"delay",0)),this.setRepeatDelay(Ys(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=As(this.fromValue,this.toValue,i)}}const Fs=Phaser.Utils.Objects.IsPlainObject;class Bs extends o{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new Ws(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(Fs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(Fs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var js={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new Bs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),rs(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},Hs=Phaser.Utils.Array.Remove,Ns={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var nr={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,r,n){var h=s(t);return h.time.delayedCall(e,(function(){h.game.events.once("poststep",(function(){i.call(r,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},hr={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=xe),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=xe),this.transitOutCallback=t,this}},ar={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},or={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},lr={};Object.assign(lr,nr,hr,ar,or);const dr=Phaser.Utils.Objects.GetValue;class cr extends o{constructor(t,e){super(t,e),this.setTransitInTime(dr(e,"duration.in",200)),this.setTransitOutTime(dr(e,"duration.out",200)),this.setTransitInCallback(dr(e,"transitIn")),this.setTransitOutCallback(dr(e,"transitOut")),this.oneShotMode=dr(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new rr(this,{eventEmitter:!1,initState:dr(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(cr.prototype,lr);var ur=function(t){if(t.parentContainer)return ur(t.parentContainer);var e=function(t){var e=t.displayList;return Et(e)?e:null}(t);return e?ur(e):t};class pr extends o{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=ur(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const vr=Phaser.GameObjects.Rectangle;class gr extends vr{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new pr(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const fr=Phaser.Utils.Objects.GetValue;class mr extends o{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(fr(t,"hitAreaMode",0)),this.setEnable(fr(t,"enable",!0)),this.setStopMode(fr(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=yr[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var yr={default:0,fullWindow:1};const xr=Phaser.Utils.Objects.GetValue;class br extends gr{constructor(t,e){super(t,xr(e,"color",0),xr(e,"alpha",.8)),this.touchEventStop=new mr(this,{hitAreaMode:1})}}var Cr={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,is(t,e)},scaleDown(t,e){ss(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,gs(t,e)},fadeOut(t,e){fs(t,e,!1)}},wr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,gs(t,e,t.alpha)},Sr=function(t,e){fs(t,e,!1)},Tr=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Bt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Pr=Phaser.Utils.Objects.GetValue;let Or=class extends cr{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=kr.popUp),null==e.transitOut&&(e.transitOut=kr.scaleDown),e.destroy=Pr(e,"destroy",!0),super(t,e);var i=Pr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new br(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Pr(i,"transitIn",wr)),this.setCoverTransitOutCallback(Pr(i,"transitOut",Sr)));var s=Pr(e,"touchOutsideClose",!1),r=Pr(e,"duration.hold",-1),n=Pr(e,"timeOutClose",r>=0),h=Pr(e,"anyTouchClose",!1);Pr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Pr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Tr(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=kr[t]),t){case kr.popUp:t=Cr.popUp;break;case kr.fadeIn:t=Cr.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=kr[t]),t){case kr.scaleDown:t=Cr.scaleDown;break;case kr.fadeOut:t=Cr.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const kr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var _r=function(t){return t&&"function"==typeof t},Er={modal(t,e){return _r(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Or(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Lr=function(t,e,i,s,r){_r(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Mr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Lr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Lr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Lr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Lr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Lr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Lr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Lr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Lr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Lr.call(this,"shutdown",t,e,i,s),this}},Rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Dr={},Ir=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Tr(t,e.x,e.y,i,s):!!(r=Rr(e,n,!0))&&Tr(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Ur={press:0,pointerdown:0,release:1,pointerup:1};var Gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Nr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Vr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Jr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return $r.length=0,!0;return $r.length=0,!1},$r=[];const qr=Phaser.Utils.Objects.GetValue;class Zr extends o{constructor(t,e){super(t,e),this._enable=void 0;var i=qr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(qr(t,"enable",!0)),this.setMode(qr(t,"mode",1)),this.setClickInterval(qr(t,"clickInterval",100)),this.setDragThreshold(qr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Kr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Vr:Ir)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Kr={press:0,pointerdown:0,release:1,pointerup:1};var Qr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Zr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class tn extends sr{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const en=Phaser.Utils.Objects.GetValue;class sn extends o{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new tn,this.parent.setInteractive(en(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(en(t,"enable",!0)),this.setCooldown(en(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var rn={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Ir(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new sn(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new sn(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},nn={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},hn=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=wn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Sn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=wn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Ir(t,s,e,i)}}const wn=0,Sn=1,Tn="IDLE",Pn=Phaser.Utils.Objects.GetValue,On=Phaser.Math.Distance.Between;class kn extends Cn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=_n},eventEmitter:!1};this.setRecongizedStateObject(new sr(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Pn(t,"time",250)),this.setTapInterval(Pn(t,"tapInterval",200)),this.setDragThreshold(Pn(t,"threshold",9)),this.setTapOffset(Pn(t,"tapOffset",10));var e=Pn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Pn(t,"maxTaps",void 0)),this.setMinTaps(Pn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case _n:this.state=En;break;case En:var t=this.lastPointer;On(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Ln,this.state=En);break;case Ln:this.state=En}}onDragEnd(){this.state===En&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Ln))}onDrag(){this.state!==_n&&this.pointer.getDistance()>this.dragThreshold&&(this.state=_n)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===En){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=_n):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Ln:this.state=_n)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Ln&&(this.state=_n)}get isTapped(){return this.state===Ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const _n="IDLE",En="BEGIN",Ln="RECOGNIZED",Mn=Phaser.Utils.Objects.GetValue;class Rn extends Cn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Dn},eventEmitter:!1};this.setRecongizedStateObject(new sr(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Mn(t,"threshold",9)),this.setHoldTime(Mn(t,"time",251)),this}onDragStart(){this.state=In,0===this.holdTime&&(this.state=Xn)}onDragEnd(){this.state=Dn}onDrag(){this.state!==Dn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Dn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===In&&t-this.pointer.downTime>=this.holdTime&&(this.state=Xn)}get isPressed(){return this.state===Xn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Dn="IDLE",In="BEGIN",Xn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.Distance.Between,Yn=Phaser.Math.Angle.Between;var An={getDt:function(){var t;return t=this.scene,h(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return zn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Yn(e.x,e.y,t.x,t.y)}},Wn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Fn={};const Bn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.RadToDeg;class Hn extends Cn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Nn},eventEmitter:!1};this.setRecongizedStateObject(new sr(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Bn(t,"threshold",10)),this.setVelocityThreshold(Bn(t,"velocityThreshold",1e3)),this.setDirectionMode(Bn(t,"dir","8dir")),this}onDragStart(){this.state=Un}onDragEnd(){this.state=Nn}onDrag(){this.state===Un&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Gn&&(this.state=Nn)}get isSwiped(){return this.state===Gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Wn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Fn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(jn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Hn.prototype,An);const Nn="IDLE",Un="BEGIN",Gn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue,Jn=Phaser.Utils.Array.SpliceOne,$n=Phaser.Math.Distance.Between,qn=Phaser.Math.Angle.Between;class Zn{constructor(t,e){var i=s(t);i===t&&(t=void 0);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.gameObject=t,t&&t.setInteractive(Vn(e,"inputConfig",void 0)),this.setEventEmitter(Vn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Vn(t,"enable",!0)),this.bounds=Vn(t,"bounds",void 0),this.tracerState=Qn,this.pointers.length=0,Kt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Kt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Qn:this.tracerState=th,this.onDrag1Start();break;case th:this.tracerState=eh,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Jn(this.pointers,e),this.tracerState){case th:this.tracerState=Qn,this.onDrag1End();break;case eh:this.tracerState=th,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case th:this.onDrag1();break;case eh:this.onDrag2()}}}dragCancel(){return this.tracerState===eh&&this.onDrag2End(),this.pointers.length=0,Kt(this.movedState),this.tracerState=Qn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==eh)return 0;var t=this.pointers[0],e=this.pointers[1];return $n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==eh)return 0;var t=this.pointers[0],e=this.pointers[1];return qn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Kn.x=e.x-i.x,Kn.y=e.y-i.y}else Kn.x=0,Kn.y=0;return Kn}get centerX(){if(this.tracerState!==eh)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==eh)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==eh)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==eh)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=ih,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Ir(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Ir(t,s,e,i)}}Object.assign(Zn.prototype,t);var Kn={};const Qn=0,th=1,eh=2,ih="IDLE";Phaser.Utils.Objects.GetValue;const sh=Phaser.Math.RotateAround;var rh=function(t,e,i,s){return sh(t,e,i,s),t.rotation+=s,t},nh={};const hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Math.Angle.WrapDegrees,oh=Phaser.Math.Angle.ShortestBetween,lh=Phaser.Math.RadToDeg,dh=Phaser.Math.DegToRad;var ch={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=nh),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=ah(lh(this.angleBetween));this.angle=oh(this.prevAngle,t),this.prevAngle=t,this.state=vh}break;case vh:t=ah(lh(this.angleBetween)),this.angle=oh(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===vh}get rotation(){return dh(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,ch);const uh="IDLE",ph="BEGIN",vh="RECOGNIZED",gh=Phaser.Utils.Objects.GetValue;var fh=function(t){var e=gh(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new kn(this,e),this._tap.on("tap",(function(t,e,s){an(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),an(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const mh=Phaser.Utils.Objects.GetValue;var yh=function(t){var e=mh(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Rn(this,e),this._press.on("pressstart",(function(t,e,s){an(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){an(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const xh=Phaser.Utils.Objects.GetValue;var bh=function(t){var e=xh(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Hn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";an(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),an(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Ch=Phaser.Utils.Objects.GetValue;var wh=function(t,e){return t.setInteractive(),Ch(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Ch(e,"targets",[t]),targetMode:Ch(e,"targetMode","parent"),eventEmitter:Ch(e,"eventEmitter",t),eventNamePrefix:Ch(e,"inputEventPrefix","child.")},ln.call(t,e),un.call(t,e),gn.call(t,e),xn.call(t,e),fh.call(t,e),yh.call(t,e),bh.call(t,e),t},Sh={getSizerConfig:function(t){return void 0===t&&(t=this),ue(t)},getChildPrevState:function(t){var e=ue(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=ge(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=He(e,"color"),s=He(e,"lineWidth");var o=He(e,"name",!1);o&&(r=He(o,"createTextCallback",Ge),n=He(o,"createTextCallbackScope",void 0),"string"==typeof(h=He(o,"align","left-top"))&&(h=ye[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Ne(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);Ve(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const Rh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue,Ih=Phaser.Display.Align.CENTER,Xh={min:0,full:-1};var zh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;Ke.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=Xh[e];else if(Rh(e)){var f;e=Dh(f=e,"proportion",void 0),i=Dh(f,"align",Ih),s=Dh(f,"padding",0),r=Dh(f,"expand",!1),n=Dh(f,"key",void 0),h=Dh(f,"index",void 0),t.isRexSizer||(a=Dh(f,"minWidth",void 0),o=Dh(f,"minHeight",void 0)),l=Dh(f,"fitRatio",0),d=Dh(f,"offsetX",0),c=Dh(f,"offsetY",0),u=Dh(f,"offsetOriginX",0),p=Dh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=ye[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=Ih),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Xt(t)/zt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=qe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Xt(t):a:t.minHeight=void 0===o?zt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},Yh={add:zh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),zh.call(this,new Lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return Rh(i)&&(i.index=t),zh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=Mh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const Ah=ce.prototype.clear;var Wh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Ah.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Wh.call(this,t),this}},jh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=ye[e]),this.getSizerConfig(t).align=e,this}},Hh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Nh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Uh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Gh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Pi(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,wi.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=yi.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||fi.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&_h.call(this,t,void 0),mi.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||xi.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&_h.call(this,void 0,t),bi.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Gh,Yh,Bh,jh,Hh,Nh,Uh);var Vh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Jh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const $h=Phaser.Utils.Objects.IsPlainObject,qh=Phaser.Utils.Objects.GetValue;class Zh extends Ph{constructor(t,e,i,s,r,n,h){$h(e)?(e=qh(h=e,"x",0),i=qh(h,"y",0),s=qh(h,"width",void 0),r=qh(h,"height",void 0),n=qh(h,"orientation",0)):$h(s)?(s=qh(h=s,"width",void 0),r=qh(h,"height",void 0),n=qh(h,"orientation",0)):$h(n)&&(n=qh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(qh(h,"space.item",0)),this.setStartChildIndex(qh(h,"startChildIndex",0)),this.setRTL(qh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Jh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Vh.call(this)),this._childrenProportion}}Object.assign(Zh.prototype,Gh);var Kh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Qh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class ta extends Zh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Kh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Kh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Kh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Kh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(ta.prototype,Qh);var ea=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const ia=Phaser.GameObjects.Graphics;class sa extends ia{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=ra[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=qe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=qe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&Qt(i,this.padding),this.originX=s.originX,this.originY=s.originY,ea.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,ea.call(this,this.width,this.height,this.padding,t,e)),this}}const ra={rectangle:0,circle:1};var na=function(t,e,i,s){var r=new sa(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const ha=Phaser.Utils.Objects.GetValue,aa=Phaser.Utils.Objects.GetValue;var oa=/^[\x00-\x7F]+$/,la=function(t){return oa.test(t)},da=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},ua=2;const pa={none:0,word:1,char:ua,character:ua,mix:3};var va=function(t,e){switch(p(t)){case 0:switch("string"==typeof e&&(e=pa[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=da;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=pa[e]||0),t.style.wrapMode=e}};const ga=Phaser.Renderer.WebGL.Utils;var fa={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ga.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ma=Phaser.Display.Color;var ya={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ma);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},xa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Y();const ba=Phaser.Display.Canvas.CanvasPool,Ca=Phaser.GameObjects.GameObject,wa=Phaser.Utils.String.UUID;class Sa extends Ca{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ba.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=wa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ba.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Ta=Phaser.GameObjects.Components;Phaser.Class.mixin(Sa,[Ta.Alpha,Ta.BlendMode,Ta.Crop,Ta.Depth,Ta.Flip,Ta.GetBounds,Ta.Mask,Ta.Origin,Ta.Pipeline,Ta.PostPipeline,Ta.ScrollFactor,Ta.Tint,Ta.Transform,Ta.Visible,fa,ya,xa]);var Pa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ks(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&Kt(this.data),this}};class Oa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Oa.prototype,Pa);var ka={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const _a=Phaser.Math.RotateAround;var Ea;const La=Phaser.Geom.Rectangle;var Ma,Ra=function(t){void 0===Ma&&(Ma=new La);var e=t.drawTLX,i=t.drawTLY;return Ma.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ma};const Da=Phaser.Math.RotateAround;var Ia,Xa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ia&&(Ia={}),s=Ia),s.x=e,s.y=i,0!==t.rotation&&Da(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const za=Phaser.GameObjects.Components.TransformMatrix;var Ya,Aa,Wa={},Fa=function(t,e,i,s,r){var n=Xa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Wa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ya&&(Ya=new za,Aa=new za),t.parentContainer?t.getWorldTransformMatrix(Ya,Aa):Ya.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ya.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ba=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Fa(t,e,n,h,r)},ja={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ea&&(Ea={}),s=Ea),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&_a(s,0,0,-i.rotation),s}(t,e,this,!0);return Ra(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ba(this.parent,this,t,e,i)}};Object.assign(ja,ka);const Ha=Phaser.Math.DegToRad,Na=Phaser.Math.RadToDeg,Ua=Phaser.Utils.Objects.GetValue;class Ga extends Oa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Na(this._rotation)}set angle(t){this.rotation=Ha(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ua(t,"width",void 0),i=Ua(t,"height",void 0),s=Ua(t,"scaleX",void 0),r=Ua(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ga.prototype,ja);const Va=Phaser.Utils.String.Pad;var Ja=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Va(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},$a=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const qa=Phaser.Utils.Objects.GetValue;class Za{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=qa(t,"x",0),i=qa(t,"y",0));var s=this.cornerRadius;s.tl=Ka(qa(t,"tl",void 0),e,i),s.tr=Ka(qa(t,"tr",void 0),e,i),s.bl=Ka(qa(t,"bl",void 0),e,i),s.br=Ka(qa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Qa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Qa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Qa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Qa(this.cornerRadius.br,t)}}var Ka=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),to(t),t},Qa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=qa(e,"x",0),t.y=qa(e,"y",0)),to(t)},to=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const eo=Phaser.Math.DegToRad;var io=function(t){return!t.hasOwnProperty("convex")||t.convex},so=function(t){return t.x>0&&t.y>0},ro=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,so(a)?(o=a.x*g,l=a.y*f,io(a)?ro(t,o,l,o,l,180,270,!1,h):ro(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,so(a)?(o=a.x*g,l=a.y*f,io(a)?ro(t,s-o,l,o,l,270,360,!1,h):ro(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,so(a)?(o=a.x*g,l=a.y*f,io(a)?ro(t,s-o,r-l,o,l,0,90,!1,h):ro(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,so(a)?(o=a.x*g,l=a.y*f,io(a)?ro(t,o,r-l,o,l,90,180,!1,h):ro(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const ho=Phaser.Utils.Objects.GetValue;class ao extends Ga{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ho(e,"color",null),ho(e,"color2",null),ho(e,"horizontalGradient",!0)),this.setStroke(ho(e,"stroke",null),ho(e,"strokeThickness",2)),this.setCornerRadius(ho(e,"cornerRadius",0),ho(e,"cornerIteration",null))}set color(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,$a("color2",t,this),$a("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$a("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,$a("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),no(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const oo=Phaser.Utils.Objects.GetValue;class lo extends Ga{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(oo(e,"color",null),oo(e,"color2",null),oo(e,"horizontalGradient",!0)),this.setStroke(oo(e,"stroke",null),oo(e,"strokeThickness",2))}set color(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ja(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,oo(t,"color2",null),oo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,oo(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const co=Phaser.Utils.Objects.GetValue;class uo{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(co(t,"bold",!1)),this.setItalic(co(t,"italic",!1)),this.setFontSize(co(t,"fontSize","16px")),this.setFontFamily(co(t,"fontFamily","Courier")),this.setColor(co(t,"color","#fff")),this.setStrokeStyle(co(t,"stroke",null),co(t,"strokeThickness",0)),this.setShadow(co(t,"shadowColor",null),co(t,"shadowOffsetX",0),co(t,"shadowOffsetY",0),co(t,"shadowBlur",0)),this.setOffset(co(t,"offsetX",0),co(t,"offsetY",0)),this.setSpace(co(t,"leftSpace",0),co(t,"rightSpace",0)),this.setAlign(co(t,"align",void 0)),this.setBackgroundColor(co(t,"backgroundColor",null)),this.setBackgroundHeight(co(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(co(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(co(t,"backgroundLeftX",0)),this.setBackgroundRightX(co(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle($a("stroke",t,this),$a("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset($a("shadowOffsetX",t,this),$a("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new uo(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ja(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ja(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ja(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ja(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const po=Phaser.Utils.Array.Remove,vo=Phaser.Utils.Array.Remove,go="text",fo="image",mo="drawer",yo="space",xo="command";var bo=function(t){return t.type===go&&"\n"===t.text},Co=function(t){return t.type===go&&"\f"===t.text},wo=function(t){return t.type===go};class So extends Ga{constructor(t,e,i){super(t,go),this.updateTextFlag=!1,this.style=new uo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var To=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Po=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Oo extends Ga{constructor(t,e,i){super(t,fo),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Po.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Po.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class ko extends Ga{constructor(t,e,i,s){super(t,mo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class _o extends Ga{constructor(t,e){super(t,yo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Eo extends Oa{constructor(t,e,i,s,r){super(t,xo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Lo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Lo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Lo(t[i]));return e}var Mo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ro={none:0,word:1,char:2,character:2,mix:3};var Do=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Yo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Yo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Wo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Wo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Wo(t,"wrapMode");void 0===c&&(c=Wo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ro[c]);var u=Wo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Wo(t,"letterSpacing",0),v=Wo(t,"hAlign",0),g=Wo(t,"vAlign",0),f=Wo(t,"justifyPercentage",.25),m=Mo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:L,width:M}),R=Math.max(R,M)),m.start+=_.length,m.isLastPage=!D&&m.start===k,m.maxLineWidth=R,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=jo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=jo(t,"maxLines",0);var a=0===i,o=jo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=jo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=jo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=jo(t,"letterSpacing",0),p=jo(t,"rtl",!0),v=jo(t,"hAlign",p?2:0),g=jo(t,"vAlign",0),f=Mo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:L}),M=Math.max(M,L)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=M,f.linesWidth=_.length*n;var Y=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,A=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return pi(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ui(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),po(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return vo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(go);return null===i?i=new So(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ba(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const pl=Phaser.Utils.Objects.GetFastValue;var vl={};class gl{constructor(t){this.pools=pl(t,"pools",vl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ul),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Sl(t,r,e,i,n),a=0;a<=bl&&0!==h;a++){if((r+=h)<0){r=0;break}h=Sl(t,r,e,i,n)}return a===bl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Tl(t,e,i),t},wl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Sl=function(t,e,i,s,r){var n,h=wl(t,e,r),a=wl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Tl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Pl=Phaser.Utils.Objects.GetValue;var Ol=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Pl(e,"minWidth",0),s=Pl(e,"minHeight",0),r=Pl(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Cl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Cl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const kl=Phaser.Utils.Objects.GetValue,_l=[function(t){var e=this.scene,i=ha(t,"orientation",0);this.setOrientation(i);var s=ha(t,"icon",void 0),r=ha(t,"iconMask",void 0),n=ha(t,"innerBackground",void 0),h=ha(t,"title",void 0),a=ha(t,"separator",void 0),o=ha(t,"text",void 0),l=ha(t,"action",void 0),d=ha(t,"actionMask",void 0);if(s){var c=ha(t,"align.icon","center");m=0===this.orientation?{right:ha(t,"space.icon",0),top:ha(t,"space.iconTop",0),bottom:ha(t,"space.iconBottom",0),left:ha(t,"space.iconLeft",0)}:{bottom:ha(t,"space.icon",0),left:ha(t,"space.iconLeft",0),right:ha(t,"space.iconRight",0),top:ha(t,"space.iconTop",0)};var u=ha(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:u}),r&&(r=na.call(this,s,s,1)),!u){var p=ha(t,"iconSize",void 0);this.setIconSize(ha(t,"iconWidth",p),ha(t,"iconHeight",p))}}var v=new Zh(e,{orientation:1});n&&v.addBackground(n);var g=ha(t,"space.separator",0);if(h){c=ha(t,"align.title","left");var f=ha(t,"expandTitleWidth",!1);y=ha(t,"expandTitleHeight",!1)?1:0,x=f,m={bottom:!a&&o?ha(t,"space.title",g):0,left:ha(t,"space.titleLeft",0),right:ha(t,"space.titleRight",0)},v.add(h,{proportion:y,expand:x,align:c,padding:m})}if(a){var m={top:h?g:0,bottom:o?g:0,left:ha(t,"space.separatorLeft",0),right:ha(t,"space.separatorRight",0)};v.add(a,{expand:!0,padding:m})}if(o){c=ha(t,"align.text","left");var y,x,b=ha(t,"expandTextWidth",!1);y=ha(t,"expandTextHeight",!1)?1:0,x=b,m={left:ha(t,"space.textLeft",0),right:ha(t,"space.textRight",0)},v.add(o,{proportion:y,expand:x,align:c,padding:m})}if(m=void 0,l&&(m={right:ha(t,"space.text",0)}),this.add(v,{proportion:1,padding:m}),l&&(c=ha(t,"align.action","center"),m=0===this.orientation?{top:ha(t,"space.actionTop",0),bottom:ha(t,"space.actionBottom",0),right:ha(t,"space.actionRight",0)}:{left:ha(t,"space.actionLeft",0),right:ha(t,"space.actionRight",0),bottom:ha(t,"space.actionBottom",0)},u=ha(t,"squareFitAction",!1)?1:0,this.add(l,{proportion:0,align:c,padding:m,fitRatio:u}),d&&(d=na.call(this,l,l,1)),!u)){var C=ha(t,"actionSize");this.setActionSize(ha(t,"actionWidth",C),ha(t,"actionHeight",C))}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",v),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",h),this.addChildrenMap("separator",a),this.addChildrenMap("text",o),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",d)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=aa(t,"title",void 0),s=aa(t,"separator",void 0),r=aa(t,"innerBackground",void 0),n=aa(t,"icon",void 0),h=aa(t,"iconMask",void 0),a=aa(t,"text",void 0),o=aa(t,"action",void 0),l=aa(t,"actionMask",void 0);if(i){var d=aa(t,"align.title","left"),c=aa(t,"expandTitleWidth",!1);y=aa(t,"expandTitleHeight",!1)?1:0,x=c,p={bottom:aa(t,"space.title",0),left:aa(t,"space.titleLeft",0),right:aa(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:x,align:d,padding:p})}if(s){var u=aa(t,"space.separator",0),p={top:i?u:0,bottom:a?u:0,left:aa(t,"space.separatorLeft",0),right:aa(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var v=aa(t,"orientation",0),g=new Zh(e,{orientation:v,rtl:aa(t,"rtl",!1),space:{left:aa(t,"space.innerLeft",0),right:aa(t,"space.innerRight",0),top:aa(t,"space.innerTop",0),bottom:aa(t,"space.innerBottom",0)}});if(r&&g.addBackground(r),this.add(g,{proportion:1,expand:!0}),n){d=aa(t,"align.icon","center"),p=0===g.orientation?{right:aa(t,"space.icon",0),top:aa(t,"space.iconTop",0),bottom:aa(t,"space.iconBottom",0),left:aa(t,"space.iconLeft",0)}:{bottom:aa(t,"space.icon",0),left:aa(t,"space.iconLeft",0),right:aa(t,"space.iconRight",0),top:aa(t,"space.iconTop",0)};var f=aa(t,"squareFitIcon",!1)?1:0;if(g.add(n,{proportion:0,align:d,padding:p,fitRatio:f}),h&&(h=na.call(this,n,n,1)),!f){var m=aa(t,"iconSize",void 0);this.setIconSize(aa(t,"iconWidth",m),aa(t,"iconHeight",m))}}if(a){d=aa(t,"align.text","left");var y,x,b=aa(t,"space.text",0),C=aa(t,"expandTextWidth",!1),w=aa(t,"expandTextHeight",!1);0===g.orientation?(y=C?1:0,o&&(p={right:b}),x=w):(y=w?1:0,o&&(p={bottom:b}),x=C),g.add(a,{proportion:y,expand:x,align:d,padding:p})}if(o&&(d=aa(t,"align.action","center"),p=0===g.orientation?{top:aa(t,"space.actionTop",0),bottom:aa(t,"space.actionBottom",0),right:aa(t,"space.actionRight",0)}:{left:aa(t,"space.actionLeft",0),right:aa(t,"space.actionRight",0),bottom:aa(t,"space.actionBottom",0)},f=aa(t,"squareFitAction",!1)?1:0,g.add(o,{proportion:0,align:d,padding:p,fitRatio:f}),l&&(l=na.call(this,o,o,1)),!f)){var S=aa(t,"actionSize");this.setActionSize(aa(t,"actionWidth",S),aa(t,"actionHeight",S))}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",h),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)}];class El extends ta{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=kl(e,"background",void 0);i&&this.addBackground(i);var s=kl(e,"title",void 0),r=kl(e,"text",void 0);if(s){var n=kl(e,"wrapTitle",!1),h=kl(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),va(s,n),e.expandTitleWidth=!0,xl(s)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Ol(s,{fitHeight:!0}))}if(r){var a=kl(e,"wrapText",!1),o=kl(e,"adjustTextFontSize",!1);a?(!0===a&&(a="word"),va(r,a),e.expandTextWidth=!0,xl(r)):o&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Ol(r,{fitHeight:!0}))}var l=kl(e,"layoutMode",0);(_l[l]||_l[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Ll extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=I(i,"expandTextWidth",!1),n=I(i,"expandTextHeight",!1);if(r||n){var h=p(s);switch(h){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,h=n?e:0;s.setFixedSize(i,h),i>0&&s.setWordWrapWidth(i)},1===h){var a=s.style;0===a.wrapMode&&(a.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(I(i,"typingMode","page")),this.page=new S(s,I(i,"page",void 0)),this.typing=new R(s,I(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=X[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(El)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}return Ll},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextextbox=e(); diff --git a/dist/rextextplayer.js b/dist/rextextplayer.js index 4f775e3ce7..e1b9cecd70 100644 --- a/dist/rextextplayer.js +++ b/dist/rextextplayer.js @@ -9012,6 +9012,8 @@ this.setBackgroundColor(GetValue$8(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$8(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$8(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$8(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$8(o, 'backgroundRightX', 0)); return this; } @@ -9082,6 +9084,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -9236,6 +9244,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -9671,20 +9689,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rextextplayer.min.js b/dist/rextextplayer.min.js index c24fa6d3cc..9abd6ffe4c 100644 --- a/dist/rextextplayer.min.js +++ b/dist/rextextplayer.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},e={hasProperty(t){var e=this.gameObject;return!!e.hasOwnProperty(t)||void 0!==e[t]},getProperty(t){return this.gameObject[t]},setProperty(t,e){return this.gameObject[t]=e,this},easeProperty(t){var e=t.property,i=t.value,s=t.duration,r=t.delay,n=t.ease,a=t.repeat,o=t.yoyo,h=t.from,u=t.complete,c=t.target;if(void 0===s&&(s=1e3),void 0===r&&(r=0),void 0===n&&(n="Linear"),void 0===a&&(a=0),void 0===o&&(o=!1),void 0===c&&(c=this.gameObject),h){var l=i;i=c[e],c[e]=l}return(t={targets:c,duration:s,delay:r,ease:n,repeat:a,yoyo:o,onComplete:u})[e]=i,this.addTweenTask(e,t),this},addTweenTask(t,e){var i=this.tweens,s=i[t];s&&s.remove();var r=e.onComplete;return e.onComplete=function(){i[t].remove(),i[t]=null,r&&r(e.targets,t)},(s=this.scene.tweens.add(e)).timeScale=this.timeScale,i[t]=s,this},getTweenTask(t){return this.tweens[t]},freeTweens(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},i={hasMethod(t){return"function"==typeof this.gameObject[t]},call(t,...e){if(!this.hasMethod(t))return console.warn(`[GameObjectManager] Game object '${this.name}' does not have method '${t}'`),this;var i=this.gameObject;return i[t].apply(i,e),this}},s={hasData(t){var e=this.gameObject;return!!e.data&&e.data.has(t)},getData(t){return this.gameObject.getData(t)},setData(t,e){return this.gameObject.setData(t,e),this}};class r{constructor(t,e,i){this.GOManager=t,this.tweens={},this.effects={},this.setGO(e,i)}get scene(){return this.GOManager.scene}get timeScale(){return this.GOManager.timeScale}destroy(){this.freeGO(),this.GOManager=void 0}freeGO(){return this.freeTweens(),this.gameObject.bob=void 0,this.gameObject.destroy(),this.gameObject=void 0,this}setGO(t,e){return t.goName=e,t.goType=this.GOManager.name,t.bob=this,this.gameObject=t,this.name=e,this.freeTweens(),this}setTimeScale(t){var e=this.tweens;for(var i in e){var s=e[i];s&&(s.timeScale=t)}return this}}Object.assign(r.prototype,e,i,s);var n=function(t){return t&&"!"!==t.charAt(0)},a={has(t){return this.bobs.hasOwnProperty(t)},exists(t){return this.bobs.hasOwnProperty(t)},get(t,e){if(n(t))return this.bobs[t];for(var i in void 0===e&&(e=[]),t&&(t=t.substring(1)),this.bobs)t&&i===t||e.push(this.bobs[i]);return e},getFitst(t){for(var e in t&&"!"===t.charAt(0)&&(t=t.substring(1)),this.bobs)if(!t||t!==e)return this.bobs[e];return null},getGO(t,e){var i=this.get(t);return i?Array.isArray(i)?(void 0===e&&(e=[]),i.forEach((function(t){e.push(t.gameObject)})),e):i.gameObject:null},forEachGO(t,e){for(var i in this.bobs){var s=this.bobs[i].gameObject;if(e?t.call(e,s,i,this):t(s,i,this))break}return this},getAllGO(t){for(var e in void 0===t&&(t=[]),this.bobs){var i=this.bobs[e].gameObject;t.push(i)}return t}},o=function(t){return t>>16&255},h=function(t){return t>>8&255},u=function(t){return 255&t};const c=Phaser.Events.EventEmitter;var l=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=d),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},d={},f=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=l),function(t){if(t.events)return t;var e=new c,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},g=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},p=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},v=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(b(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},C=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},_=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};Phaser.Geom.Rectangle;const P=Phaser.Math.Vector2,j=Phaser.Math.RotateAround;Phaser.GameObjects.Container;var L=void 0,R=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&j(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const B=Phaser.Utils.Objects.GetValue;var A=function(t,e,i,s,r,n,a){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===s&&(s=1),void 0===r&&(r=null),void 0===n&&(n=1),void 0===a&&(a=0);var o=function(t,e,i){return void 0===e?e=new P:!0===e&&(void 0===L&&(L=new P),e=L),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-C(t)*t.originX,e.y=t.y-_(t)*t.originY,R(t,e,i))}(t,G[0]);o.x-=a,o.y-=a;var h=function(t,e,i){return void 0===e?e=new P:!0===e&&(void 0===L&&(L=new P),e=L),t.getTopRight?t.getTopRight(e):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-_(t)*t.originY,R(t,e,i))}(t,G[1]);h.x+=a,h.y-=a;var u=function(t,e,i){return void 0===e?e=new P:!0===e&&(void 0===L&&(L=new P),e=L),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-_(t)*t.originY+_(t),R(t,e,i))}(t,G[2]);u.x+=a,u.y+=a;var c=function(t,e,i){return void 0===e?e=new P:!0===e&&(void 0===L&&(L=new P),e=L),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-C(t)*t.originX,e.y=t.y-_(t)*t.originY+_(t),R(t,e,i))}(t,G[3]);c.x-=a,c.y+=a,null!==r&&e.fillStyle(r,n).fillPoints(G,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(G,!0,!0)}},G=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],F=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i},D={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=F(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},W={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=B(i,"color"),r=B(i,"lineWidth"),n=B(i,"fillColor"),a=B(i,"fillAlpha",1),o=B(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?xt:St,this.repeatCounter=0,this}stop(){return this.state=Et,this}update(t,e){this.state!==Et&&this.state!==Mt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ot)):(this.nowTime=this.duration,this.state=Mt):this.nowTime>=0&&(this.state=xt))}get t(){var t;switch(this.state){case Et:case St:case Ot:t=0;break;case xt:t=this.nowTime/this.duration;break;case Mt:t=1}return kt(t,0,1)}set t(t){(t=kt(t,-1,1))<0?(this.state=St,this.nowTime=-this.delay*t):(this.state=xt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Et}get isDelay(){return this.state===St}get isCountDown(){return this.state===xt}get isRunning(){return this.state===St||this.state===xt}get isDone(){return this.state===Mt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Et=0,St=1,xt=2,Ot=3,Mt=-1;class Tt extends mt{constructor(t,e){super(t,e),this.timer=new wt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ct=Phaser.Utils.Objects.GetValue,_t=Phaser.Utils.Objects.GetAdvancedValue,Pt=Phaser.Tweens.Builders.GetEaseFunction;class jt extends Tt{resetFromJSON(t){return this.timer.resetFromJSON(Ct(t,"timer")),this.setEnable(Ct(t,"enable",!0)),this.setTarget(Ct(t,"target",this.parent)),this.setDelay(_t(t,"delay",0)),this.setDuration(_t(t,"duration",1e3)),this.setEase(Ct(t,"ease","Linear")),this.setRepeat(Ct(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Pt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Lt=Phaser.Sound.BaseSound;var Rt=function(t){return t instanceof Lt};const Bt=Phaser.Utils.Objects.GetValue,At=Phaser.Utils.Objects.GetAdvancedValue,Gt=Phaser.Math.Linear;class Ft extends jt{constructor(t,e,i){Rt(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Bt(t,"mode",0)),this.setEnable(Bt(t,"enable",!0)),this.setVolumeRange(At(t,"volume.start",this.parent.volume),At(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=Dt[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=Gt(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}}const Dt={stop:1,destroy:2};var Wt=function(t,e,i,s,r){Rt(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new Ft(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},$t=function(t,e,i,s){Rt(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new Ft(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const Yt=Phaser.Utils.Objects.GetValue;var Xt={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:Yt(e,"loop",this.backgroundMusicLoop),mute:Yt(e,"mute",this.backgroundMusicMute),volume:Yt(e,"volume",this.backgroundMusicVolume),detune:Yt(e,"detune",0),rate:Yt(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&Wt(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&$t(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const It=Phaser.Utils.Objects.GetValue;var Vt={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:It(e,"loop",this.backgroundMusicLoop),mute:It(e,"mute",this.backgroundMusic2Mute),volume:It(e,"volume",this.backgroundMusic2Volume),detune:It(e,"detune",0),rate:It(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&Wt(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&$t(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const Nt=Phaser.Utils.Array.Remove,zt=Phaser.Utils.Objects.GetValue;var Ut={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:zt(e,"mute",this.soundEffectsMute),volume:zt(e,"volume",this.soundEffectsVolume),detune:zt(e,"detune",0),rate:zt(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&Nt(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&Nt(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&Wt(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&$t(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)$t(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&Wt(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&$t(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)$t(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ae=Phaser.Utils.Objects.GetValue,oe=new class extends ne{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(oi.prototype,si);const hi=Phaser.Utils.String.Pad;var ui=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${hi(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ci=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const li=Phaser.Utils.Objects.GetValue;class di{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=li(t,"x",0),i=li(t,"y",0));var s=this.cornerRadius;s.tl=fi(li(t,"tl",void 0),e,i),s.tr=fi(li(t,"tr",void 0),e,i),s.bl=fi(li(t,"bl",void 0),e,i),s.br=fi(li(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){gi(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){gi(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){gi(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){gi(this.cornerRadius.br,t)}}var fi=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),pi(t),t},gi=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=li(e,"x",0),t.y=li(e,"y",0)),pi(t)},pi=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vi=Phaser.Math.DegToRad;var mi=function(t){return!t.hasOwnProperty("convex")||t.convex},yi=function(t){return t.x>0&&t.y>0},bi=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=f?1:s/f,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,h,u,h,u,180,270,!1,a):bi(t,0,0,h,u,90,0,!0,a),c=0,l=u):(t.lineTo(0,0),c=0,l=0),o=m.tr,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,s-h,u,h,u,270,360,!1,a):bi(t,s,0,h,u,180,90,!0,a)):t.lineTo(s,0),o=m.br,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,s-h,r-u,h,u,0,90,!1,a):bi(t,s,r,h,u,270,180,!0,a)):t.lineTo(s,r),o=m.bl,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,h,r-u,h,u,90,180,!1,a):bi(t,0,r,h,u,360,270,!0,a)):t.lineTo(0,r),t.lineTo(c,l),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o)&&(null!=c&&((f=l?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),f.addColorStop(1,c),o=f),e.fillStyle=o,e.fill());null!=h&&u>0&&(e.strokeStyle=h,e.lineWidth=u,e.stroke())};const wi=Phaser.Utils.Objects.GetValue;class Ei extends oi{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(wi(e,"color",null),wi(e,"color2",null),wi(e,"horizontalGradient",!0)),this.setStroke(wi(e,"stroke",null),wi(e,"strokeThickness",2)),this.setCornerRadius(wi(e,"cornerRadius",0),wi(e,"cornerIteration",null))}set color(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ci("color2",t,this),ci("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ci("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ci("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,u=t.canvas.height;null==i&&(s=0);var c=s/2;h=Math.max(1,h-s),u=Math.max(1,u-s),ki(t.canvas,t.context,c,c,h,u,r,e,i,s,n,a,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Si=Phaser.Utils.Objects.GetValue;class xi extends oi{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Si(e,"color",null),Si(e,"color2",null),Si(e,"horizontalGradient",!0)),this.setStroke(Si(e,"stroke",null),Si(e,"strokeThickness",2))}set color(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Si(t,"color2",null),Si(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Si(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Oi=Phaser.Utils.Objects.GetValue;class Mi{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Oi(t,"bold",!1)),this.setItalic(Oi(t,"italic",!1)),this.setFontSize(Oi(t,"fontSize","16px")),this.setFontFamily(Oi(t,"fontFamily","Courier")),this.setColor(Oi(t,"color","#fff")),this.setStrokeStyle(Oi(t,"stroke",null),Oi(t,"strokeThickness",0)),this.setShadow(Oi(t,"shadowColor",null),Oi(t,"shadowOffsetX",0),Oi(t,"shadowOffsetY",0),Oi(t,"shadowBlur",0)),this.setOffset(Oi(t,"offsetX",0),Oi(t,"offsetY",0)),this.setSpace(Oi(t,"leftSpace",0),Oi(t,"rightSpace",0)),this.setAlign(Oi(t,"align",void 0)),this.setBackgroundColor(Oi(t,"backgroundColor",null)),this.setBackgroundHeight(Oi(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Oi(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ci("stroke",t,this),ci("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ci("shadowOffsetX",t,this),ci("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Mi(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ui(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ui(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ui(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ui(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ti=Phaser.Utils.Array.Remove,Ci=Phaser.Utils.Array.Remove,_i="text",Pi="image",ji="drawer",Li="space",Ri="command";var Bi=function(t){return t.type===_i&&"\n"===t.text},Ai=function(t){return t.type===_i&&"\f"===t.text},Gi=function(t){return t.type===_i},Fi=function(t){return t.type===Ri};class Di extends oi{constructor(t,e,i){super(t,_i),this.updateTextFlag=!1,this.style=new Mi(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Wi=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const $i=Phaser.Display.Canvas.CanvasPool;var Yi=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var u=$i.create(null,r,n,Phaser.CANVAS,!0),c=u.getContext("2d",{willReadFrequently:!0});c.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),c.globalCompositeOperation="source-in",c.fillStyle=a,c.fillRect(0,0,r,n),h.drawImage(u,0,0,r,n,i,s,r,n),$i.remove(u)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Xi extends oi{constructor(t,e,i){super(t,Pi),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Yi(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var Ii=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class Vi extends oi{constructor(t,e,i,s){super(t,ji),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Ni extends oi{constructor(t,e){super(t,Li),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}var zi=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class Ui extends Ye{constructor(t,e,i,s,r){super(t,Ri),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Hi=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this};function Ki(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Ki(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Ki(t[i]));return e}var Ji=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const qi={none:0,word:1,char:2,character:2,mix:3};var Qi=/^[\x00-\x7F]+$/,Zi=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,a=3===i,o=!n&&!a,h=t.length,u=e,c=s.word,l=0,d=!1;u0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(u=ss.call(this)).height,a=u.ascent,i=Math.floor((h-a)/n))}else{var u;n=(u=ss.call(this)).height,a=u.ascent}}else this.fixedHeight>0?void 0===(i=ns(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=ns(t,"maxLines",0);void 0===a&&(a=n);var c=0===i,l=ns(t,"wrapMode");void 0===l&&(l=ns(t,"charWrap",!1)?"char":"word"),"string"==typeof l&&(l=qi[l]);var d=ns(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,l=0));for(var f=ns(t,"letterSpacing",0),g=ns(t,"hAlign",0),p=ns(t,"vAlign",0),v=ns(t,"justifyPercentage",.25),m=Ji({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:f,maxLines:i,hAlign:g,vAlign:p,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:l}),y=this.children,b=0,k=y.length;b0&&(_.push({children:P,width:j}),L=Math.max(L,j)),m.start+=C.length,m.isLastPage=!R&&m.start===T,m.maxLineWidth=L,m.linesHeight=_.length*n;var $=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,Y=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,u=0,c=h.length;u0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=hs(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=hs(t,"maxLines",0);var o=0===i,h=hs(t,"fixedCharacterHeight",void 0);if(void 0===h){var u=hs(t,"charPerLine",void 0);if(void 0!==u){var c=this.fixedHeight-s;h=Math.floor(c/u)}}var l=hs(t,"wrapHeight",void 0);void 0===l&&(l=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=hs(t,"letterSpacing",0),f=hs(t,"rtl",!0),g=hs(t,"hAlign",f?2:0),p=hs(t,"vAlign",0),v=Ji({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:p,lineWidth:n,fixedCharacterHeight:h,wrapHeight:l,rtl:f}),m=this.children,y=0,b=m.length;y0&&(C.push({children:_,height:P}),j=Math.max(j,P)),v.start+=T.length,v.isLastPage=v.start===M,v.maxLineHeight=j,v.linesWidth=C.length*n;var F=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,D=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,u=t.lineWidth,c=t.linesWidth;switch(n){case 1:case"center":s=(e-c)/2;break;case 2:case"right":s=e-c;break;default:s=0}o&&(s+=u);for(var l=0,d=h.length;l0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ti(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ci(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(_i);return null===i?i=new Di(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ii(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(ve(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=zs(this.delimiterLeft),e=zs(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Ns:t||(t=Js),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=Qs),this.tagExpression=t,this}setValueExpression(t){return t||(t=Qs),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==Qs||this.valueExpression!==Qs){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=zs(this.delimiterLeft),e=zs(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=Ns),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:sn,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===_i&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,rn.call(t,i.remainder)}});break}}else Fi(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},nn=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},an=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},on=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var u=n[1];return r.waitGameObjectDestroy(a,u),void t.emit(h,u);case 3:u=n[1];var c=n[2];if("number"==typeof o.getProperty(u,c))return r.waitGameObjectTweenComplete(a,u,c),void t.emit(h,u,c);var l=c,d=l.startsWith("!");return d&&(l=l.substring(1)),o.hasData(u,l)?(r.waitGameObjectDataFlag(a,u,l,!d),void t.emit(h,u,l)):void r.waitTime(0)}};const hn=Phaser.Input.Keyboard.KeyCodes;var un=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},_n=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},Pn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},jn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Ln=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Tn(a,s)&&(n=a[1],Hi.call(t,`${s}.play`,Cn,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],Hi.call(t,`${s}.stop`,_n,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Tn(n,s)&&(r=n[1],Hi.call(t,`${s}.stop`,_n,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],Hi.call(t,`${s}.pause`,Pn,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);Hi.call(t,`${s}.chain`,jn,[s,r,a],t),e.skipEvent()}}}))}];var Rn=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Ln,t.createGameObject=Sn(t.createGameObject),this.addGameObjectManager(t,Mn)},Bn=function(t,e){return 2===t.length&&t[0]===e},An=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Gn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Fn=function(t){this.getGameObjectManager(t).removeAll()},Dn=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Wn={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},$n=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var u=this.getGameObjectManager(e),c=u.getProperty(i,s);if("number"==typeof c){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=c-r:h.startsWith("from")&&(u.setProperty(i,s,c-r),r=c):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=c+r:h.startsWith("from")&&(u.setProperty(i,s,c+r),r=c):"from"===h&&(u.setProperty(i,s,r),r=c);var l=h.startsWith("yoyo");u.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:l})}};const Yn=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Bn(a,s)&&(n=a[1],Hi.call(t,`${s}.add`,An,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Bn(n,s)&&(r=n[1],Hi.call(t,`${s}.remove`,Gn,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(Hi.call(t,`${s}.removeall`,Fn,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],Hi.call(t,`${s}.call`,Dn,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,u,c,l=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Wn[t[3]]})(l,s)&&(h=l[1],u=l[2],c=l[3],"number"==typeof a&&(o=a,a=void 0),Hi.call(t,`${s}.ease`,$n,[s,h,u,r,n,a,o,c],t),e.skipEvent())}}))}],Xn=Se.addGameObjectManager;var In={addGameObjectManager(t,e){t=t?function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:We(e),i){e.length=t.length;for(var s=0,r=t.length;s>16&255},h=function(t){return t>>8&255},u=function(t){return 255&t};const c=Phaser.Events.EventEmitter;var l=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=d),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},d={},f=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=l),function(t){if(t.events)return t;var e=new c,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},g=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},p=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},v=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(b(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},C=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},P=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};Phaser.Geom.Rectangle;const _=Phaser.Math.Vector2,j=Phaser.Math.RotateAround;Phaser.GameObjects.Container;var L=void 0,R=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&j(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const B=Phaser.Utils.Objects.GetValue;var A=function(t,e,i,s,r,n,a){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===s&&(s=1),void 0===r&&(r=null),void 0===n&&(n=1),void 0===a&&(a=0);var o=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-C(t)*t.originX,e.y=t.y-P(t)*t.originY,R(t,e,i))}(t,G[0]);o.x-=a,o.y-=a;var h=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getTopRight?t.getTopRight(e):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-P(t)*t.originY,R(t,e,i))}(t,G[1]);h.x+=a,h.y-=a;var u=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-P(t)*t.originY+P(t),R(t,e,i))}(t,G[2]);u.x+=a,u.y+=a;var c=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-C(t)*t.originX,e.y=t.y-P(t)*t.originY+P(t),R(t,e,i))}(t,G[3]);c.x-=a,c.y+=a,null!==r&&e.fillStyle(r,n).fillPoints(G,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(G,!0,!0)}},G=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],F=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i},D={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=F(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},W={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=B(i,"color"),r=B(i,"lineWidth"),n=B(i,"fillColor"),a=B(i,"fillAlpha",1),o=B(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?xt:St,this.repeatCounter=0,this}stop(){return this.state=Et,this}update(t,e){this.state!==Et&&this.state!==Mt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ot)):(this.nowTime=this.duration,this.state=Mt):this.nowTime>=0&&(this.state=xt))}get t(){var t;switch(this.state){case Et:case St:case Ot:t=0;break;case xt:t=this.nowTime/this.duration;break;case Mt:t=1}return kt(t,0,1)}set t(t){(t=kt(t,-1,1))<0?(this.state=St,this.nowTime=-this.delay*t):(this.state=xt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Et}get isDelay(){return this.state===St}get isCountDown(){return this.state===xt}get isRunning(){return this.state===St||this.state===xt}get isDone(){return this.state===Mt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Et=0,St=1,xt=2,Ot=3,Mt=-1;class Tt extends mt{constructor(t,e){super(t,e),this.timer=new wt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ct=Phaser.Utils.Objects.GetValue,Pt=Phaser.Utils.Objects.GetAdvancedValue,_t=Phaser.Tweens.Builders.GetEaseFunction;class jt extends Tt{resetFromJSON(t){return this.timer.resetFromJSON(Ct(t,"timer")),this.setEnable(Ct(t,"enable",!0)),this.setTarget(Ct(t,"target",this.parent)),this.setDelay(Pt(t,"delay",0)),this.setDuration(Pt(t,"duration",1e3)),this.setEase(Ct(t,"ease","Linear")),this.setRepeat(Ct(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=_t(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Lt=Phaser.Sound.BaseSound;var Rt=function(t){return t instanceof Lt};const Bt=Phaser.Utils.Objects.GetValue,At=Phaser.Utils.Objects.GetAdvancedValue,Gt=Phaser.Math.Linear;class Ft extends jt{constructor(t,e,i){Rt(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Bt(t,"mode",0)),this.setEnable(Bt(t,"enable",!0)),this.setVolumeRange(At(t,"volume.start",this.parent.volume),At(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=Dt[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=Gt(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}}const Dt={stop:1,destroy:2};var Wt=function(t,e,i,s,r){Rt(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new Ft(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},Xt=function(t,e,i,s){Rt(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new Ft(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const $t=Phaser.Utils.Objects.GetValue;var Yt={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:$t(e,"loop",this.backgroundMusicLoop),mute:$t(e,"mute",this.backgroundMusicMute),volume:$t(e,"volume",this.backgroundMusicVolume),detune:$t(e,"detune",0),rate:$t(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&Wt(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&Xt(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const It=Phaser.Utils.Objects.GetValue;var Vt={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:It(e,"loop",this.backgroundMusicLoop),mute:It(e,"mute",this.backgroundMusic2Mute),volume:It(e,"volume",this.backgroundMusic2Volume),detune:It(e,"detune",0),rate:It(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&Wt(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&Xt(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const Nt=Phaser.Utils.Array.Remove,zt=Phaser.Utils.Objects.GetValue;var Ut={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:zt(e,"mute",this.soundEffectsMute),volume:zt(e,"volume",this.soundEffectsVolume),detune:zt(e,"detune",0),rate:zt(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&Nt(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&Nt(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&Wt(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&Xt(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)Xt(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&Wt(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&Xt(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)Xt(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ae=Phaser.Utils.Objects.GetValue,oe=new class extends ne{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(oi.prototype,si);const hi=Phaser.Utils.String.Pad;var ui=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${hi(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ci=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const li=Phaser.Utils.Objects.GetValue;class di{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=li(t,"x",0),i=li(t,"y",0));var s=this.cornerRadius;s.tl=fi(li(t,"tl",void 0),e,i),s.tr=fi(li(t,"tr",void 0),e,i),s.bl=fi(li(t,"bl",void 0),e,i),s.br=fi(li(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){gi(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){gi(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){gi(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){gi(this.cornerRadius.br,t)}}var fi=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),pi(t),t},gi=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=li(e,"x",0),t.y=li(e,"y",0)),pi(t)},pi=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vi=Phaser.Math.DegToRad;var mi=function(t){return!t.hasOwnProperty("convex")||t.convex},yi=function(t){return t.x>0&&t.y>0},bi=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=f?1:s/f,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,h,u,h,u,180,270,!1,a):bi(t,0,0,h,u,90,0,!0,a),c=0,l=u):(t.lineTo(0,0),c=0,l=0),o=m.tr,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,s-h,u,h,u,270,360,!1,a):bi(t,s,0,h,u,180,90,!0,a)):t.lineTo(s,0),o=m.br,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,s-h,r-u,h,u,0,90,!1,a):bi(t,s,r,h,u,270,180,!0,a)):t.lineTo(s,r),o=m.bl,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,h,r-u,h,u,90,180,!1,a):bi(t,0,r,h,u,360,270,!0,a)):t.lineTo(0,r),t.lineTo(c,l),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o)&&(null!=c&&((f=l?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),f.addColorStop(1,c),o=f),e.fillStyle=o,e.fill());null!=h&&u>0&&(e.strokeStyle=h,e.lineWidth=u,e.stroke())};const wi=Phaser.Utils.Objects.GetValue;class Ei extends oi{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(wi(e,"color",null),wi(e,"color2",null),wi(e,"horizontalGradient",!0)),this.setStroke(wi(e,"stroke",null),wi(e,"strokeThickness",2)),this.setCornerRadius(wi(e,"cornerRadius",0),wi(e,"cornerIteration",null))}set color(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ci("color2",t,this),ci("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ci("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ci("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,u=t.canvas.height;null==i&&(s=0);var c=s/2;h=Math.max(1,h-s),u=Math.max(1,u-s),ki(t.canvas,t.context,c,c,h,u,r,e,i,s,n,a,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Si=Phaser.Utils.Objects.GetValue;class xi extends oi{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Si(e,"color",null),Si(e,"color2",null),Si(e,"horizontalGradient",!0)),this.setStroke(Si(e,"stroke",null),Si(e,"strokeThickness",2))}set color(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Si(t,"color2",null),Si(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Si(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Oi=Phaser.Utils.Objects.GetValue;class Mi{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Oi(t,"bold",!1)),this.setItalic(Oi(t,"italic",!1)),this.setFontSize(Oi(t,"fontSize","16px")),this.setFontFamily(Oi(t,"fontFamily","Courier")),this.setColor(Oi(t,"color","#fff")),this.setStrokeStyle(Oi(t,"stroke",null),Oi(t,"strokeThickness",0)),this.setShadow(Oi(t,"shadowColor",null),Oi(t,"shadowOffsetX",0),Oi(t,"shadowOffsetY",0),Oi(t,"shadowBlur",0)),this.setOffset(Oi(t,"offsetX",0),Oi(t,"offsetY",0)),this.setSpace(Oi(t,"leftSpace",0),Oi(t,"rightSpace",0)),this.setAlign(Oi(t,"align",void 0)),this.setBackgroundColor(Oi(t,"backgroundColor",null)),this.setBackgroundHeight(Oi(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Oi(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Oi(t,"backgroundLeftX",0)),this.setBackgroundRightX(Oi(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ci("stroke",t,this),ci("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ci("shadowOffsetX",t,this),ci("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Mi(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ui(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ui(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ui(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ui(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ti=Phaser.Utils.Array.Remove,Ci=Phaser.Utils.Array.Remove,Pi="text",_i="image",ji="drawer",Li="space",Ri="command";var Bi=function(t){return t.type===Pi&&"\n"===t.text},Ai=function(t){return t.type===Pi&&"\f"===t.text},Gi=function(t){return t.type===Pi},Fi=function(t){return t.type===Ri};class Di extends oi{constructor(t,e,i){super(t,Pi),this.updateTextFlag=!1,this.style=new Mi(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,u=e.hasStroke;(h||u)&&(e.syncFont(t).syncStyle(t),u&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Wi=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Xi=Phaser.Display.Canvas.CanvasPool;var $i=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var u=Xi.create(null,r,n,Phaser.CANVAS,!0),c=u.getContext("2d",{willReadFrequently:!0});c.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),c.globalCompositeOperation="source-in",c.fillStyle=a,c.fillRect(0,0,r,n),h.drawImage(u,0,0,r,n,i,s,r,n),Xi.remove(u)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Yi extends oi{constructor(t,e,i){super(t,_i),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){$i(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var Ii=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class Vi extends oi{constructor(t,e,i,s){super(t,ji),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Ni extends oi{constructor(t,e){super(t,Li),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}var zi=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class Ui extends $e{constructor(t,e,i,s,r){super(t,Ri),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Hi=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this};function Ki(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Ki(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Ki(t[i]));return e}var Ji=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const qi={none:0,word:1,char:2,character:2,mix:3};var Qi=/^[\x00-\x7F]+$/,Zi=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,a=3===i,o=!n&&!a,h=t.length,u=e,c=s.word,l=0,d=!1;u0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(u=ss.call(this)).height,a=u.ascent,i=Math.floor((h-a)/n))}else{var u;n=(u=ss.call(this)).height,a=u.ascent}}else this.fixedHeight>0?void 0===(i=ns(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=ns(t,"maxLines",0);void 0===a&&(a=n);var c=0===i,l=ns(t,"wrapMode");void 0===l&&(l=ns(t,"charWrap",!1)?"char":"word"),"string"==typeof l&&(l=qi[l]);var d=ns(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,l=0));for(var f=ns(t,"letterSpacing",0),g=ns(t,"hAlign",0),p=ns(t,"vAlign",0),v=ns(t,"justifyPercentage",.25),m=Ji({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:f,maxLines:i,hAlign:g,vAlign:p,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:l}),y=this.children,b=0,k=y.length;b0&&(P.push({children:_,width:j}),L=Math.max(L,j)),m.start+=C.length,m.isLastPage=!R&&m.start===T,m.maxLineWidth=L,m.linesHeight=P.length*n;var X=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,$=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,u=0,c=h.length;u0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=hs(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=hs(t,"maxLines",0);var o=0===i,h=hs(t,"fixedCharacterHeight",void 0);if(void 0===h){var u=hs(t,"charPerLine",void 0);if(void 0!==u){var c=this.fixedHeight-s;h=Math.floor(c/u)}}var l=hs(t,"wrapHeight",void 0);void 0===l&&(l=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=hs(t,"letterSpacing",0),f=hs(t,"rtl",!0),g=hs(t,"hAlign",f?2:0),p=hs(t,"vAlign",0),v=Ji({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:p,lineWidth:n,fixedCharacterHeight:h,wrapHeight:l,rtl:f}),m=this.children,y=0,b=m.length;y0&&(C.push({children:P,height:_}),j=Math.max(j,_)),v.start+=T.length,v.isLastPage=v.start===M,v.maxLineHeight=j,v.linesWidth=C.length*n;var F=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,D=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,u=t.lineWidth,c=t.linesWidth;switch(n){case 1:case"center":s=(e-c)/2;break;case 2:case"right":s=e-c;break;default:s=0}o&&(s+=u);for(var l=0,d=h.length;l0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ti(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ci(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Pi);return null===i?i=new Di(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ii(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(ve(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=zs(this.delimiterLeft),e=zs(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Ns:t||(t=Js),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=Qs),this.tagExpression=t,this}setValueExpression(t){return t||(t=Qs),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==Qs||this.valueExpression!==Qs){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=zs(this.delimiterLeft),e=zs(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=Ns),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:sn,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===Pi&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,rn.call(t,i.remainder)}});break}}else Fi(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},nn=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},an=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},on=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var u=n[1];return r.waitGameObjectDestroy(a,u),void t.emit(h,u);case 3:u=n[1];var c=n[2];if("number"==typeof o.getProperty(u,c))return r.waitGameObjectTweenComplete(a,u,c),void t.emit(h,u,c);var l=c,d=l.startsWith("!");return d&&(l=l.substring(1)),o.hasData(u,l)?(r.waitGameObjectDataFlag(a,u,l,!d),void t.emit(h,u,l)):void r.waitTime(0)}};const hn=Phaser.Input.Keyboard.KeyCodes;var un=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},Pn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},_n=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},jn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Ln=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Tn(a,s)&&(n=a[1],Hi.call(t,`${s}.play`,Cn,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],Hi.call(t,`${s}.stop`,Pn,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Tn(n,s)&&(r=n[1],Hi.call(t,`${s}.stop`,Pn,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],Hi.call(t,`${s}.pause`,_n,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);Hi.call(t,`${s}.chain`,jn,[s,r,a],t),e.skipEvent()}}}))}];var Rn=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Ln,t.createGameObject=Sn(t.createGameObject),this.addGameObjectManager(t,Mn)},Bn=function(t,e){return 2===t.length&&t[0]===e},An=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Gn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Fn=function(t){this.getGameObjectManager(t).removeAll()},Dn=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Wn={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},Xn=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var u=this.getGameObjectManager(e),c=u.getProperty(i,s);if("number"==typeof c){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=c-r:h.startsWith("from")&&(u.setProperty(i,s,c-r),r=c):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=c+r:h.startsWith("from")&&(u.setProperty(i,s,c+r),r=c):"from"===h&&(u.setProperty(i,s,r),r=c);var l=h.startsWith("yoyo");u.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:l})}};const $n=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Bn(a,s)&&(n=a[1],Hi.call(t,`${s}.add`,An,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Bn(n,s)&&(r=n[1],Hi.call(t,`${s}.remove`,Gn,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(Hi.call(t,`${s}.removeall`,Fn,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],Hi.call(t,`${s}.call`,Dn,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,u,c,l=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Wn[t[3]]})(l,s)&&(h=l[1],u=l[2],c=l[3],"number"==typeof a&&(o=a,a=void 0),Hi.call(t,`${s}.ease`,Xn,[s,h,u,r,n,a,o,c],t),e.skipEvent())}}))}],Yn=Se.addGameObjectManager;var In={addGameObjectManager(t,e){t=t?function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:We(e),i){e.length=t.length;for(var s=0,r=t.length;s 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rextextplayerplugin.min.js b/dist/rextextplayerplugin.min.js index fd6fef8cc4..77443d8c7d 100644 --- a/dist/rextextplayerplugin.min.js +++ b/dist/rextextplayerplugin.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},e={hasProperty(t){var e=this.gameObject;return!!e.hasOwnProperty(t)||void 0!==e[t]},getProperty(t){return this.gameObject[t]},setProperty(t,e){return this.gameObject[t]=e,this},easeProperty(t){var e=t.property,i=t.value,s=t.duration,r=t.delay,n=t.ease,a=t.repeat,o=t.yoyo,h=t.from,u=t.complete,c=t.target;if(void 0===s&&(s=1e3),void 0===r&&(r=0),void 0===n&&(n="Linear"),void 0===a&&(a=0),void 0===o&&(o=!1),void 0===c&&(c=this.gameObject),h){var l=i;i=c[e],c[e]=l}return(t={targets:c,duration:s,delay:r,ease:n,repeat:a,yoyo:o,onComplete:u})[e]=i,this.addTweenTask(e,t),this},addTweenTask(t,e){var i=this.tweens,s=i[t];s&&s.remove();var r=e.onComplete;return e.onComplete=function(){i[t].remove(),i[t]=null,r&&r(e.targets,t)},(s=this.scene.tweens.add(e)).timeScale=this.timeScale,i[t]=s,this},getTweenTask(t){return this.tweens[t]},freeTweens(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},i={hasMethod(t){return"function"==typeof this.gameObject[t]},call(t,...e){if(!this.hasMethod(t))return console.warn(`[GameObjectManager] Game object '${this.name}' does not have method '${t}'`),this;var i=this.gameObject;return i[t].apply(i,e),this}},s={hasData(t){var e=this.gameObject;return!!e.data&&e.data.has(t)},getData(t){return this.gameObject.getData(t)},setData(t,e){return this.gameObject.setData(t,e),this}};class r{constructor(t,e,i){this.GOManager=t,this.tweens={},this.effects={},this.setGO(e,i)}get scene(){return this.GOManager.scene}get timeScale(){return this.GOManager.timeScale}destroy(){this.freeGO(),this.GOManager=void 0}freeGO(){return this.freeTweens(),this.gameObject.bob=void 0,this.gameObject.destroy(),this.gameObject=void 0,this}setGO(t,e){return t.goName=e,t.goType=this.GOManager.name,t.bob=this,this.gameObject=t,this.name=e,this.freeTweens(),this}setTimeScale(t){var e=this.tweens;for(var i in e){var s=e[i];s&&(s.timeScale=t)}return this}}Object.assign(r.prototype,e,i,s);var n=function(t){return t&&"!"!==t.charAt(0)},a={has(t){return this.bobs.hasOwnProperty(t)},exists(t){return this.bobs.hasOwnProperty(t)},get(t,e){if(n(t))return this.bobs[t];for(var i in void 0===e&&(e=[]),t&&(t=t.substring(1)),this.bobs)t&&i===t||e.push(this.bobs[i]);return e},getFitst(t){for(var e in t&&"!"===t.charAt(0)&&(t=t.substring(1)),this.bobs)if(!t||t!==e)return this.bobs[e];return null},getGO(t,e){var i=this.get(t);return i?Array.isArray(i)?(void 0===e&&(e=[]),i.forEach((function(t){e.push(t.gameObject)})),e):i.gameObject:null},forEachGO(t,e){for(var i in this.bobs){var s=this.bobs[i].gameObject;if(e?t.call(e,s,i,this):t(s,i,this))break}return this},getAllGO(t){for(var e in void 0===t&&(t=[]),this.bobs){var i=this.bobs[e].gameObject;t.push(i)}return t}},o=function(t){return t>>16&255},h=function(t){return t>>8&255},u=function(t){return 255&t};const c=Phaser.Events.EventEmitter;var l=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=d),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},d={},f=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=l),function(t){if(t.events)return t;var e=new c,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},g=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},p=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},v=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(b(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},P=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},C=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};Phaser.Geom.Rectangle;const _=Phaser.Math.Vector2,j=Phaser.Math.RotateAround;Phaser.GameObjects.Container;var L=void 0,R=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&j(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const B=Phaser.Utils.Objects.GetValue;var A=function(t,e,i,s,r,n,a){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===s&&(s=1),void 0===r&&(r=null),void 0===n&&(n=1),void 0===a&&(a=0);var o=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-P(t)*t.originX,e.y=t.y-C(t)*t.originY,R(t,e,i))}(t,G[0]);o.x-=a,o.y-=a;var h=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getTopRight?t.getTopRight(e):(e.x=t.x-P(t)*t.originX+P(t),e.y=t.y-C(t)*t.originY,R(t,e,i))}(t,G[1]);h.x+=a,h.y-=a;var u=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-P(t)*t.originX+P(t),e.y=t.y-C(t)*t.originY+C(t),R(t,e,i))}(t,G[2]);u.x+=a,u.y+=a;var c=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-P(t)*t.originX,e.y=t.y-C(t)*t.originY+C(t),R(t,e,i))}(t,G[3]);c.x-=a,c.y+=a,null!==r&&e.fillStyle(r,n).fillPoints(G,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(G,!0,!0)}},G=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],F=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i},D={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=F(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},W={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=B(i,"color"),r=B(i,"lineWidth"),n=B(i,"fillColor"),a=B(i,"fillAlpha",1),o=B(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?xt:St,this.repeatCounter=0,this}stop(){return this.state=Et,this}update(t,e){this.state!==Et&&this.state!==Mt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ot)):(this.nowTime=this.duration,this.state=Mt):this.nowTime>=0&&(this.state=xt))}get t(){var t;switch(this.state){case Et:case St:case Ot:t=0;break;case xt:t=this.nowTime/this.duration;break;case Mt:t=1}return kt(t,0,1)}set t(t){(t=kt(t,-1,1))<0?(this.state=St,this.nowTime=-this.delay*t):(this.state=xt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Et}get isDelay(){return this.state===St}get isCountDown(){return this.state===xt}get isRunning(){return this.state===St||this.state===xt}get isDone(){return this.state===Mt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Et=0,St=1,xt=2,Ot=3,Mt=-1;class Tt extends mt{constructor(t,e){super(t,e),this.timer=new wt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Pt=Phaser.Utils.Objects.GetValue,Ct=Phaser.Utils.Objects.GetAdvancedValue,_t=Phaser.Tweens.Builders.GetEaseFunction;class jt extends Tt{resetFromJSON(t){return this.timer.resetFromJSON(Pt(t,"timer")),this.setEnable(Pt(t,"enable",!0)),this.setTarget(Pt(t,"target",this.parent)),this.setDelay(Ct(t,"delay",0)),this.setDuration(Ct(t,"duration",1e3)),this.setEase(Pt(t,"ease","Linear")),this.setRepeat(Pt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=_t(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Lt=Phaser.Sound.BaseSound;var Rt=function(t){return t instanceof Lt};const Bt=Phaser.Utils.Objects.GetValue,At=Phaser.Utils.Objects.GetAdvancedValue,Gt=Phaser.Math.Linear;class Ft extends jt{constructor(t,e,i){Rt(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Bt(t,"mode",0)),this.setEnable(Bt(t,"enable",!0)),this.setVolumeRange(At(t,"volume.start",this.parent.volume),At(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=Dt[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=Gt(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}}const Dt={stop:1,destroy:2};var Wt=function(t,e,i,s,r){Rt(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new Ft(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},$t=function(t,e,i,s){Rt(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new Ft(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const Yt=Phaser.Utils.Objects.GetValue;var Xt={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:Yt(e,"loop",this.backgroundMusicLoop),mute:Yt(e,"mute",this.backgroundMusicMute),volume:Yt(e,"volume",this.backgroundMusicVolume),detune:Yt(e,"detune",0),rate:Yt(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&Wt(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&$t(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const It=Phaser.Utils.Objects.GetValue;var Vt={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:It(e,"loop",this.backgroundMusicLoop),mute:It(e,"mute",this.backgroundMusic2Mute),volume:It(e,"volume",this.backgroundMusic2Volume),detune:It(e,"detune",0),rate:It(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&Wt(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&$t(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const Nt=Phaser.Utils.Array.Remove,zt=Phaser.Utils.Objects.GetValue;var Ut={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:zt(e,"mute",this.soundEffectsMute),volume:zt(e,"volume",this.soundEffectsVolume),detune:zt(e,"detune",0),rate:zt(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&Nt(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&Nt(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&Wt(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&$t(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)$t(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&Wt(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&$t(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)$t(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ae=Phaser.Utils.Objects.GetValue,oe=new class extends ne{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(oi.prototype,si);const hi=Phaser.Utils.String.Pad;var ui=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${hi(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ci=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const li=Phaser.Utils.Objects.GetValue;class di{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=li(t,"x",0),i=li(t,"y",0));var s=this.cornerRadius;s.tl=fi(li(t,"tl",void 0),e,i),s.tr=fi(li(t,"tr",void 0),e,i),s.bl=fi(li(t,"bl",void 0),e,i),s.br=fi(li(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){gi(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){gi(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){gi(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){gi(this.cornerRadius.br,t)}}var fi=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),pi(t),t},gi=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=li(e,"x",0),t.y=li(e,"y",0)),pi(t)},pi=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vi=Phaser.Math.DegToRad;var mi=function(t){return!t.hasOwnProperty("convex")||t.convex},yi=function(t){return t.x>0&&t.y>0},bi=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=f?1:s/f,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,h,u,h,u,180,270,!1,a):bi(t,0,0,h,u,90,0,!0,a),c=0,l=u):(t.lineTo(0,0),c=0,l=0),o=m.tr,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,s-h,u,h,u,270,360,!1,a):bi(t,s,0,h,u,180,90,!0,a)):t.lineTo(s,0),o=m.br,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,s-h,r-u,h,u,0,90,!1,a):bi(t,s,r,h,u,270,180,!0,a)):t.lineTo(s,r),o=m.bl,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,h,r-u,h,u,90,180,!1,a):bi(t,0,r,h,u,360,270,!0,a)):t.lineTo(0,r),t.lineTo(c,l),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o)&&(null!=c&&((f=l?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),f.addColorStop(1,c),o=f),e.fillStyle=o,e.fill());null!=h&&u>0&&(e.strokeStyle=h,e.lineWidth=u,e.stroke())};const wi=Phaser.Utils.Objects.GetValue;class Ei extends oi{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(wi(e,"color",null),wi(e,"color2",null),wi(e,"horizontalGradient",!0)),this.setStroke(wi(e,"stroke",null),wi(e,"strokeThickness",2)),this.setCornerRadius(wi(e,"cornerRadius",0),wi(e,"cornerIteration",null))}set color(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ci("color2",t,this),ci("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ci("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ci("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,u=t.canvas.height;null==i&&(s=0);var c=s/2;h=Math.max(1,h-s),u=Math.max(1,u-s),ki(t.canvas,t.context,c,c,h,u,r,e,i,s,n,a,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Si=Phaser.Utils.Objects.GetValue;class xi extends oi{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Si(e,"color",null),Si(e,"color2",null),Si(e,"horizontalGradient",!0)),this.setStroke(Si(e,"stroke",null),Si(e,"strokeThickness",2))}set color(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Si(t,"color2",null),Si(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Si(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Oi=Phaser.Utils.Objects.GetValue;class Mi{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Oi(t,"bold",!1)),this.setItalic(Oi(t,"italic",!1)),this.setFontSize(Oi(t,"fontSize","16px")),this.setFontFamily(Oi(t,"fontFamily","Courier")),this.setColor(Oi(t,"color","#fff")),this.setStrokeStyle(Oi(t,"stroke",null),Oi(t,"strokeThickness",0)),this.setShadow(Oi(t,"shadowColor",null),Oi(t,"shadowOffsetX",0),Oi(t,"shadowOffsetY",0),Oi(t,"shadowBlur",0)),this.setOffset(Oi(t,"offsetX",0),Oi(t,"offsetY",0)),this.setSpace(Oi(t,"leftSpace",0),Oi(t,"rightSpace",0)),this.setAlign(Oi(t,"align",void 0)),this.setBackgroundColor(Oi(t,"backgroundColor",null)),this.setBackgroundHeight(Oi(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Oi(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ci("stroke",t,this),ci("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ci("shadowOffsetX",t,this),ci("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Mi(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ui(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ui(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ui(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ui(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ti=Phaser.Utils.Array.Remove,Pi=Phaser.Utils.Array.Remove,Ci="text",_i="image",ji="drawer",Li="space",Ri="command";var Bi=function(t){return t.type===Ci&&"\n"===t.text},Ai=function(t){return t.type===Ci&&"\f"===t.text},Gi=function(t){return t.type===Ci},Fi=function(t){return t.type===Ri};class Di extends oi{constructor(t,e,i){super(t,Ci),this.updateTextFlag=!1,this.style=new Mi(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Wi=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const $i=Phaser.Display.Canvas.CanvasPool;var Yi=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var u=$i.create(null,r,n,Phaser.CANVAS,!0),c=u.getContext("2d",{willReadFrequently:!0});c.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),c.globalCompositeOperation="source-in",c.fillStyle=a,c.fillRect(0,0,r,n),h.drawImage(u,0,0,r,n,i,s,r,n),$i.remove(u)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Xi extends oi{constructor(t,e,i){super(t,_i),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Yi(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var Ii=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class Vi extends oi{constructor(t,e,i,s){super(t,ji),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Ni extends oi{constructor(t,e){super(t,Li),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}var zi=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class Ui extends Ye{constructor(t,e,i,s,r){super(t,Ri),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Hi=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this};function Ki(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Ki(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Ki(t[i]));return e}var Ji=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const qi={none:0,word:1,char:2,character:2,mix:3};var Qi=/^[\x00-\x7F]+$/,Zi=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,a=3===i,o=!n&&!a,h=t.length,u=e,c=s.word,l=0,d=!1;u0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(u=ss.call(this)).height,a=u.ascent,i=Math.floor((h-a)/n))}else{var u;n=(u=ss.call(this)).height,a=u.ascent}}else this.fixedHeight>0?void 0===(i=ns(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=ns(t,"maxLines",0);void 0===a&&(a=n);var c=0===i,l=ns(t,"wrapMode");void 0===l&&(l=ns(t,"charWrap",!1)?"char":"word"),"string"==typeof l&&(l=qi[l]);var d=ns(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,l=0));for(var f=ns(t,"letterSpacing",0),g=ns(t,"hAlign",0),p=ns(t,"vAlign",0),v=ns(t,"justifyPercentage",.25),m=Ji({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:f,maxLines:i,hAlign:g,vAlign:p,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:l}),y=this.children,b=0,k=y.length;b0&&(C.push({children:_,width:j}),L=Math.max(L,j)),m.start+=P.length,m.isLastPage=!R&&m.start===T,m.maxLineWidth=L,m.linesHeight=C.length*n;var $=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,Y=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,u=0,c=h.length;u0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=hs(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=hs(t,"maxLines",0);var o=0===i,h=hs(t,"fixedCharacterHeight",void 0);if(void 0===h){var u=hs(t,"charPerLine",void 0);if(void 0!==u){var c=this.fixedHeight-s;h=Math.floor(c/u)}}var l=hs(t,"wrapHeight",void 0);void 0===l&&(l=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=hs(t,"letterSpacing",0),f=hs(t,"rtl",!0),g=hs(t,"hAlign",f?2:0),p=hs(t,"vAlign",0),v=Ji({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:p,lineWidth:n,fixedCharacterHeight:h,wrapHeight:l,rtl:f}),m=this.children,y=0,b=m.length;y0&&(P.push({children:C,height:_}),j=Math.max(j,_)),v.start+=T.length,v.isLastPage=v.start===M,v.maxLineHeight=j,v.linesWidth=P.length*n;var F=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,D=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,u=t.lineWidth,c=t.linesWidth;switch(n){case 1:case"center":s=(e-c)/2;break;case 2:case"right":s=e-c;break;default:s=0}o&&(s+=u);for(var l=0,d=h.length;l0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ti(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Pi(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ci);return null===i?i=new Di(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ii(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(ve(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=zs(this.delimiterLeft),e=zs(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Ns:t||(t=Js),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=Qs),this.tagExpression=t,this}setValueExpression(t){return t||(t=Qs),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==Qs||this.valueExpression!==Qs){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=zs(this.delimiterLeft),e=zs(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=Ns),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:sn,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===Ci&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,rn.call(t,i.remainder)}});break}}else Fi(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},nn=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},an=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},on=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var u=n[1];return r.waitGameObjectDestroy(a,u),void t.emit(h,u);case 3:u=n[1];var c=n[2];if("number"==typeof o.getProperty(u,c))return r.waitGameObjectTweenComplete(a,u,c),void t.emit(h,u,c);var l=c,d=l.startsWith("!");return d&&(l=l.substring(1)),o.hasData(u,l)?(r.waitGameObjectDataFlag(a,u,l,!d),void t.emit(h,u,l)):void r.waitTime(0)}};const hn=Phaser.Input.Keyboard.KeyCodes;var un=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},Cn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},_n=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},jn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Ln=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Tn(a,s)&&(n=a[1],Hi.call(t,`${s}.play`,Pn,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],Hi.call(t,`${s}.stop`,Cn,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Tn(n,s)&&(r=n[1],Hi.call(t,`${s}.stop`,Cn,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],Hi.call(t,`${s}.pause`,_n,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);Hi.call(t,`${s}.chain`,jn,[s,r,a],t),e.skipEvent()}}}))}];var Rn=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Ln,t.createGameObject=Sn(t.createGameObject),this.addGameObjectManager(t,Mn)},Bn=function(t,e){return 2===t.length&&t[0]===e},An=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Gn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Fn=function(t){this.getGameObjectManager(t).removeAll()},Dn=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Wn={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},$n=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var u=this.getGameObjectManager(e),c=u.getProperty(i,s);if("number"==typeof c){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=c-r:h.startsWith("from")&&(u.setProperty(i,s,c-r),r=c):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=c+r:h.startsWith("from")&&(u.setProperty(i,s,c+r),r=c):"from"===h&&(u.setProperty(i,s,r),r=c);var l=h.startsWith("yoyo");u.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:l})}};const Yn=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Bn(a,s)&&(n=a[1],Hi.call(t,`${s}.add`,An,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Bn(n,s)&&(r=n[1],Hi.call(t,`${s}.remove`,Gn,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(Hi.call(t,`${s}.removeall`,Fn,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],Hi.call(t,`${s}.call`,Dn,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,u,c,l=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Wn[t[3]]})(l,s)&&(h=l[1],u=l[2],c=l[3],"number"==typeof a&&(o=a,a=void 0),Hi.call(t,`${s}.ease`,$n,[s,h,u,r,n,a,o,c],t),e.skipEvent())}}))}],Xn=Se.addGameObjectManager;var In={addGameObjectManager(t,e){t=t?function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:We(e),i){e.length=t.length;for(var s=0,r=t.length;s>16&255},h=function(t){return t>>8&255},u=function(t){return 255&t};const c=Phaser.Events.EventEmitter;var l=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=d),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},d={},f=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=l),function(t){if(t.events)return t;var e=new c,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},g=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},p=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},v=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(b(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},P=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},C=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};Phaser.Geom.Rectangle;const _=Phaser.Math.Vector2,j=Phaser.Math.RotateAround;Phaser.GameObjects.Container;var L=void 0,R=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&j(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const B=Phaser.Utils.Objects.GetValue;var A=function(t,e,i,s,r,n,a){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===s&&(s=1),void 0===r&&(r=null),void 0===n&&(n=1),void 0===a&&(a=0);var o=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-P(t)*t.originX,e.y=t.y-C(t)*t.originY,R(t,e,i))}(t,G[0]);o.x-=a,o.y-=a;var h=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getTopRight?t.getTopRight(e):(e.x=t.x-P(t)*t.originX+P(t),e.y=t.y-C(t)*t.originY,R(t,e,i))}(t,G[1]);h.x+=a,h.y-=a;var u=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-P(t)*t.originX+P(t),e.y=t.y-C(t)*t.originY+C(t),R(t,e,i))}(t,G[2]);u.x+=a,u.y+=a;var c=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-P(t)*t.originX,e.y=t.y-C(t)*t.originY+C(t),R(t,e,i))}(t,G[3]);c.x-=a,c.y+=a,null!==r&&e.fillStyle(r,n).fillPoints(G,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(G,!0,!0)}},G=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],F=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i},D={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=F(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},W={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=B(i,"color"),r=B(i,"lineWidth"),n=B(i,"fillColor"),a=B(i,"fillAlpha",1),o=B(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?xt:St,this.repeatCounter=0,this}stop(){return this.state=Et,this}update(t,e){this.state!==Et&&this.state!==Mt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ot)):(this.nowTime=this.duration,this.state=Mt):this.nowTime>=0&&(this.state=xt))}get t(){var t;switch(this.state){case Et:case St:case Ot:t=0;break;case xt:t=this.nowTime/this.duration;break;case Mt:t=1}return kt(t,0,1)}set t(t){(t=kt(t,-1,1))<0?(this.state=St,this.nowTime=-this.delay*t):(this.state=xt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Et}get isDelay(){return this.state===St}get isCountDown(){return this.state===xt}get isRunning(){return this.state===St||this.state===xt}get isDone(){return this.state===Mt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Et=0,St=1,xt=2,Ot=3,Mt=-1;class Tt extends mt{constructor(t,e){super(t,e),this.timer=new wt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Pt=Phaser.Utils.Objects.GetValue,Ct=Phaser.Utils.Objects.GetAdvancedValue,_t=Phaser.Tweens.Builders.GetEaseFunction;class jt extends Tt{resetFromJSON(t){return this.timer.resetFromJSON(Pt(t,"timer")),this.setEnable(Pt(t,"enable",!0)),this.setTarget(Pt(t,"target",this.parent)),this.setDelay(Ct(t,"delay",0)),this.setDuration(Ct(t,"duration",1e3)),this.setEase(Pt(t,"ease","Linear")),this.setRepeat(Pt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=_t(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Lt=Phaser.Sound.BaseSound;var Rt=function(t){return t instanceof Lt};const Bt=Phaser.Utils.Objects.GetValue,At=Phaser.Utils.Objects.GetAdvancedValue,Gt=Phaser.Math.Linear;class Ft extends jt{constructor(t,e,i){Rt(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Bt(t,"mode",0)),this.setEnable(Bt(t,"enable",!0)),this.setVolumeRange(At(t,"volume.start",this.parent.volume),At(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=Dt[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=Gt(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}}const Dt={stop:1,destroy:2};var Wt=function(t,e,i,s,r){Rt(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new Ft(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},Xt=function(t,e,i,s){Rt(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new Ft(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const $t=Phaser.Utils.Objects.GetValue;var Yt={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:$t(e,"loop",this.backgroundMusicLoop),mute:$t(e,"mute",this.backgroundMusicMute),volume:$t(e,"volume",this.backgroundMusicVolume),detune:$t(e,"detune",0),rate:$t(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&Wt(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&Xt(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const It=Phaser.Utils.Objects.GetValue;var Vt={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:It(e,"loop",this.backgroundMusicLoop),mute:It(e,"mute",this.backgroundMusic2Mute),volume:It(e,"volume",this.backgroundMusic2Volume),detune:It(e,"detune",0),rate:It(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&Wt(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&Xt(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const Nt=Phaser.Utils.Array.Remove,zt=Phaser.Utils.Objects.GetValue;var Ut={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:zt(e,"mute",this.soundEffectsMute),volume:zt(e,"volume",this.soundEffectsVolume),detune:zt(e,"detune",0),rate:zt(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&Nt(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&Nt(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&Wt(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&Xt(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)Xt(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&Wt(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&Xt(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)Xt(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ae=Phaser.Utils.Objects.GetValue,oe=new class extends ne{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(oi.prototype,si);const hi=Phaser.Utils.String.Pad;var ui=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${hi(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ci=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const li=Phaser.Utils.Objects.GetValue;class di{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=li(t,"x",0),i=li(t,"y",0));var s=this.cornerRadius;s.tl=fi(li(t,"tl",void 0),e,i),s.tr=fi(li(t,"tr",void 0),e,i),s.bl=fi(li(t,"bl",void 0),e,i),s.br=fi(li(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){gi(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){gi(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){gi(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){gi(this.cornerRadius.br,t)}}var fi=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),pi(t),t},gi=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=li(e,"x",0),t.y=li(e,"y",0)),pi(t)},pi=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vi=Phaser.Math.DegToRad;var mi=function(t){return!t.hasOwnProperty("convex")||t.convex},yi=function(t){return t.x>0&&t.y>0},bi=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=f?1:s/f,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,h,u,h,u,180,270,!1,a):bi(t,0,0,h,u,90,0,!0,a),c=0,l=u):(t.lineTo(0,0),c=0,l=0),o=m.tr,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,s-h,u,h,u,270,360,!1,a):bi(t,s,0,h,u,180,90,!0,a)):t.lineTo(s,0),o=m.br,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,s-h,r-u,h,u,0,90,!1,a):bi(t,s,r,h,u,270,180,!0,a)):t.lineTo(s,r),o=m.bl,yi(o)?(h=o.x*p,u=o.y*v,mi(o)?bi(t,h,r-u,h,u,90,180,!1,a):bi(t,0,r,h,u,360,270,!0,a)):t.lineTo(0,r),t.lineTo(c,l),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o)&&(null!=c&&((f=l?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),f.addColorStop(1,c),o=f),e.fillStyle=o,e.fill());null!=h&&u>0&&(e.strokeStyle=h,e.lineWidth=u,e.stroke())};const wi=Phaser.Utils.Objects.GetValue;class Ei extends oi{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(wi(e,"color",null),wi(e,"color2",null),wi(e,"horizontalGradient",!0)),this.setStroke(wi(e,"stroke",null),wi(e,"strokeThickness",2)),this.setCornerRadius(wi(e,"cornerRadius",0),wi(e,"cornerIteration",null))}set color(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ci("color2",t,this),ci("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ci("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ci("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,u=t.canvas.height;null==i&&(s=0);var c=s/2;h=Math.max(1,h-s),u=Math.max(1,u-s),ki(t.canvas,t.context,c,c,h,u,r,e,i,s,n,a,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Si=Phaser.Utils.Objects.GetValue;class xi extends oi{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Si(e,"color",null),Si(e,"color2",null),Si(e,"horizontalGradient",!0)),this.setStroke(Si(e,"stroke",null),Si(e,"strokeThickness",2))}set color(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Si(t,"color2",null),Si(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Si(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Oi=Phaser.Utils.Objects.GetValue;class Mi{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Oi(t,"bold",!1)),this.setItalic(Oi(t,"italic",!1)),this.setFontSize(Oi(t,"fontSize","16px")),this.setFontFamily(Oi(t,"fontFamily","Courier")),this.setColor(Oi(t,"color","#fff")),this.setStrokeStyle(Oi(t,"stroke",null),Oi(t,"strokeThickness",0)),this.setShadow(Oi(t,"shadowColor",null),Oi(t,"shadowOffsetX",0),Oi(t,"shadowOffsetY",0),Oi(t,"shadowBlur",0)),this.setOffset(Oi(t,"offsetX",0),Oi(t,"offsetY",0)),this.setSpace(Oi(t,"leftSpace",0),Oi(t,"rightSpace",0)),this.setAlign(Oi(t,"align",void 0)),this.setBackgroundColor(Oi(t,"backgroundColor",null)),this.setBackgroundHeight(Oi(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Oi(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Oi(t,"backgroundLeftX",0)),this.setBackgroundRightX(Oi(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ci("stroke",t,this),ci("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ci("shadowOffsetX",t,this),ci("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Mi(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ui(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ui(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ui(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ui(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ti=Phaser.Utils.Array.Remove,Pi=Phaser.Utils.Array.Remove,Ci="text",_i="image",ji="drawer",Li="space",Ri="command";var Bi=function(t){return t.type===Ci&&"\n"===t.text},Ai=function(t){return t.type===Ci&&"\f"===t.text},Gi=function(t){return t.type===Ci},Fi=function(t){return t.type===Ri};class Di extends oi{constructor(t,e,i){super(t,Ci),this.updateTextFlag=!1,this.style=new Mi(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,u=e.hasStroke;(h||u)&&(e.syncFont(t).syncStyle(t),u&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Wi=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Xi=Phaser.Display.Canvas.CanvasPool;var $i=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var u=Xi.create(null,r,n,Phaser.CANVAS,!0),c=u.getContext("2d",{willReadFrequently:!0});c.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),c.globalCompositeOperation="source-in",c.fillStyle=a,c.fillRect(0,0,r,n),h.drawImage(u,0,0,r,n,i,s,r,n),Xi.remove(u)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Yi extends oi{constructor(t,e,i){super(t,_i),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){$i(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var Ii=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class Vi extends oi{constructor(t,e,i,s){super(t,ji),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Ni extends oi{constructor(t,e){super(t,Li),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}var zi=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class Ui extends $e{constructor(t,e,i,s,r){super(t,Ri),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Hi=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this};function Ki(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Ki(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Ki(t[i]));return e}var Ji=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const qi={none:0,word:1,char:2,character:2,mix:3};var Qi=/^[\x00-\x7F]+$/,Zi=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,a=3===i,o=!n&&!a,h=t.length,u=e,c=s.word,l=0,d=!1;u0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(u=ss.call(this)).height,a=u.ascent,i=Math.floor((h-a)/n))}else{var u;n=(u=ss.call(this)).height,a=u.ascent}}else this.fixedHeight>0?void 0===(i=ns(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=ns(t,"maxLines",0);void 0===a&&(a=n);var c=0===i,l=ns(t,"wrapMode");void 0===l&&(l=ns(t,"charWrap",!1)?"char":"word"),"string"==typeof l&&(l=qi[l]);var d=ns(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,l=0));for(var f=ns(t,"letterSpacing",0),g=ns(t,"hAlign",0),p=ns(t,"vAlign",0),v=ns(t,"justifyPercentage",.25),m=Ji({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:f,maxLines:i,hAlign:g,vAlign:p,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:l}),y=this.children,b=0,k=y.length;b0&&(C.push({children:_,width:j}),L=Math.max(L,j)),m.start+=P.length,m.isLastPage=!R&&m.start===T,m.maxLineWidth=L,m.linesHeight=C.length*n;var X=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,$=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,u=0,c=h.length;u0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=hs(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=hs(t,"maxLines",0);var o=0===i,h=hs(t,"fixedCharacterHeight",void 0);if(void 0===h){var u=hs(t,"charPerLine",void 0);if(void 0!==u){var c=this.fixedHeight-s;h=Math.floor(c/u)}}var l=hs(t,"wrapHeight",void 0);void 0===l&&(l=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=hs(t,"letterSpacing",0),f=hs(t,"rtl",!0),g=hs(t,"hAlign",f?2:0),p=hs(t,"vAlign",0),v=Ji({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:p,lineWidth:n,fixedCharacterHeight:h,wrapHeight:l,rtl:f}),m=this.children,y=0,b=m.length;y0&&(P.push({children:C,height:_}),j=Math.max(j,_)),v.start+=T.length,v.isLastPage=v.start===M,v.maxLineHeight=j,v.linesWidth=P.length*n;var F=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,D=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,u=t.lineWidth,c=t.linesWidth;switch(n){case 1:case"center":s=(e-c)/2;break;case 2:case"right":s=e-c;break;default:s=0}o&&(s+=u);for(var l=0,d=h.length;l0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[e]}(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ti(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Pi(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ci);return null===i?i=new Di(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ii(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(ve(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=zs(this.delimiterLeft),e=zs(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Ns:t||(t=Js),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=Qs),this.tagExpression=t,this}setValueExpression(t){return t||(t=Qs),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==Qs||this.valueExpression!==Qs){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=zs(this.delimiterLeft),e=zs(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=Ns),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:sn,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===Ci&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,rn.call(t,i.remainder)}});break}}else Fi(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},nn=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},an=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},on=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var u=n[1];return r.waitGameObjectDestroy(a,u),void t.emit(h,u);case 3:u=n[1];var c=n[2];if("number"==typeof o.getProperty(u,c))return r.waitGameObjectTweenComplete(a,u,c),void t.emit(h,u,c);var l=c,d=l.startsWith("!");return d&&(l=l.substring(1)),o.hasData(u,l)?(r.waitGameObjectDataFlag(a,u,l,!d),void t.emit(h,u,l)):void r.waitTime(0)}};const hn=Phaser.Input.Keyboard.KeyCodes;var un=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},Cn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},_n=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},jn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Ln=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Tn(a,s)&&(n=a[1],Hi.call(t,`${s}.play`,Pn,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],Hi.call(t,`${s}.stop`,Cn,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Tn(n,s)&&(r=n[1],Hi.call(t,`${s}.stop`,Cn,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],Hi.call(t,`${s}.pause`,_n,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);Hi.call(t,`${s}.chain`,jn,[s,r,a],t),e.skipEvent()}}}))}];var Rn=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Ln,t.createGameObject=Sn(t.createGameObject),this.addGameObjectManager(t,Mn)},Bn=function(t,e){return 2===t.length&&t[0]===e},An=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Gn=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Fn=function(t){this.getGameObjectManager(t).removeAll()},Dn=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Wn={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},Xn=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var u=this.getGameObjectManager(e),c=u.getProperty(i,s);if("number"==typeof c){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=c-r:h.startsWith("from")&&(u.setProperty(i,s,c-r),r=c):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=c+r:h.startsWith("from")&&(u.setProperty(i,s,c+r),r=c):"from"===h&&(u.setProperty(i,s,r),r=c);var l=h.startsWith("yoyo");u.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:l})}};const $n=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Bn(a,s)&&(n=a[1],Hi.call(t,`${s}.add`,An,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Bn(n,s)&&(r=n[1],Hi.call(t,`${s}.remove`,Gn,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(Hi.call(t,`${s}.removeall`,Fn,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],Hi.call(t,`${s}.call`,Dn,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,u,c,l=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Wn[t[3]]})(l,s)&&(h=l[1],u=l[2],c=l[3],"number"==typeof a&&(o=a,a=void 0),Hi.call(t,`${s}.ease`,Xn,[s,h,u,r,n,a,o,c],t),e.skipEvent())}}))}],Yn=Se.addGameObjectManager;var In={addGameObjectManager(t,e){t=t?function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:We(e),i){e.length=t.length;for(var s=0,r=t.length;s 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rextitlelabel.min.js b/dist/rextitlelabel.min.js index 19bafc32b1..8f1c137022 100644 --- a/dist/rextitlelabel.min.js +++ b/dist/rextitlelabel.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=T(t.scaleX,i.scaleX),e.scaleY=T(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=T(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var B={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const _e=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?fi:gi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=fi))}get t(){var t;switch(this.state){case vi:case gi:case mi:t=0;break;case fi:t=this.nowTime/this.duration;break;case yi:t=1}return ui(t,0,1)}set t(t){(t=ui(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===fi}get isRunning(){return this.state===gi||this.state===fi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,gi=1,fi=2,mi=3,yi=-1;class xi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends xi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ti=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;class ki extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ti(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const _i={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,zi),Yi.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Fi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,Ji=Phaser.Math.Linear;class qi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=$i(t,"x",void 0),i=$i(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=$i(i,"startX",void 0),this.startY=$i(i,"startY",void 0),this.endX=$i(i,"endX",void 0),this.endY=$i(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ji(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ji(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends hi{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,cs=Phaser.Math.Linear;class us extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=cs(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new us(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},fs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},zs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ys={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ds,Ls,zs,Ys);const As=Phaser.Utils.Objects.GetValue;class Ws extends ei{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ws.prototype,Xs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Fs(e):t};class Is extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class js extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends js{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var $s={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Qs=class extends Ws{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Js)),this.setCoverTransitOutCallback(Ks(i,"transitOut",qs)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=$s.popUp;break;case tr.fadeIn:t=$s.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=$s.scaleDown;break;case tr.fadeOut:t=$s.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},br=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Cr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return wr.length=0,!0;return wr.length=0,!1},wr=[];const Sr=Phaser.Utils.Objects.GetValue;class Tr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?br:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Tr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Ms{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class Er extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Mr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Jr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const $r=0,Jr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=an,0===this.holdTime&&(this.state=on)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&t-this.pointer.downTime>=this.holdTime&&(this.state=on)}get isPressed(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xn&&(this.state=mn)}get isSwiped(){return this.state===xn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",xn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case kn:this.tracerState=On,this.onDrag1End();break;case _n:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(Tn.prototype,Ve);var Pn={};const On=0,kn=1,_n=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Dn={};const Ln=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var Wn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(Xn(this.angleBetween));this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Bn}break;case Bn:t=zn(Xn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Bn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Fn="IDLE",In="BEGIN",Bn="RECOGNIZED",jn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},Yr.call(t,e),Wr.call(t,e),Br.call(t,e),Ur.call(t,e),Hn.call(t,e),Un.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",de),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ce(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;fe.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=oh[e];else if(nh(e)){var f;e=hh(f=e,"proportion",void 0),i=hh(f,"align",ah),s=hh(f,"padding",0),r=hh(f,"expand",!1),n=hh(f,"key",void 0),h=hh(f,"index",void 0),t.isRexSizer||(a=hh(f,"minWidth",void 0),o=hh(f,"minHeight",void 0)),l=hh(f,"fitRatio",0),d=hh(f,"offsetX",0),c=hh(f,"offsetY",0),u=hh(f,"offsetOriginX",0),p=hh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ve(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Et.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eh.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(xh,dh,vh,gh,fh,mh,yh);var bh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Th extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=bh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,xh);var Ph=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Oh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class kh extends Th{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Ph(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Ph(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Ph(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Ph(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(kh.prototype,Oh);var _h=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Eh=Phaser.GameObjects.Graphics;class Mh extends Eh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Rh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,_h.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,_h.call(this,this.width,this.height,this.padding,t,e)),this}}const Rh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Mh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Lh=Phaser.Utils.Objects.GetValue,zh=Phaser.Utils.Objects.GetValue,Yh=Phaser.GameObjects.Text;var Xh=function(t){return t instanceof Yh};const Ah=Phaser.GameObjects.BitmapText;var Wh=function(t){return t instanceof Ah},Fh=/^[\x00-\x7F]+$/,Ih=function(t){return Fh.test(t)},Bh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Hh=2;const Nh={none:0,word:1,char:Hh,character:Hh,mix:3};var Uh=function(t,e){var i=function(t){return Wh(t)?2:Xh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Nh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Bh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Nh[e]||0),t.style.wrapMode=e}};const Gh=Phaser.Renderer.WebGL.Utils;var Vh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Gh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const $h=Phaser.Display.Color;var Jh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new $h);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},qh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Zh=Phaser.Display.Canvas.CanvasPool,Kh=Phaser.GameObjects.GameObject,Qh=Phaser.Utils.String.UUID;class ta extends Kh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Zh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Qh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Zh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ea=Phaser.GameObjects.Components;Phaser.Class.mixin(ta,[ea.Alpha,ea.BlendMode,ea.Crop,ea.Depth,ea.Flip,ea.GetBounds,ea.Mask,ea.Origin,ea.Pipeline,ea.PostPipeline,ea.ScrollFactor,ea.Tint,ea.Transform,ea.Visible,Vh,Jh,qh]);var ia={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ps(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class sa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(sa.prototype,ia);var ra={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const na=Phaser.Math.RotateAround;var ha;const aa=Phaser.Geom.Rectangle;var oa,la=function(t){void 0===oa&&(oa=new aa);var e=t.drawTLX,i=t.drawTLY;return oa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),oa};const da=Phaser.Math.RotateAround;var ca,ua=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ca&&(ca={}),s=ca),s.x=e,s.y=i,0!==t.rotation&&da(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const pa=Phaser.GameObjects.Components.TransformMatrix;var va,ga,fa={},ma=function(t,e,i,s,r){var n=ua(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=fa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===va&&(va=new pa,ga=new pa),t.parentContainer?t.getWorldTransformMatrix(va,ga):va.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),va.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},ya=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ma(t,e,n,h,r)},xa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ha&&(ha={}),s=ha),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&na(s,0,0,-i.rotation),s}(t,e,this,!0);return la(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ya(this.parent,this,t,e,i)}};Object.assign(xa,ra);const ba=Phaser.Math.DegToRad,Ca=Phaser.Math.RadToDeg,wa=Phaser.Utils.Objects.GetValue;class Sa extends sa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ca(this._rotation)}set angle(t){this.rotation=ba(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=wa(t,"width",void 0),i=wa(t,"height",void 0),s=wa(t,"scaleX",void 0),r=wa(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Sa.prototype,xa);const Ta=Phaser.Utils.String.Pad;var Pa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ta(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Oa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const ka=Phaser.Utils.Objects.GetValue;class _a{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ka(t,"x",0),i=ka(t,"y",0));var s=this.cornerRadius;s.tl=Ea(ka(t,"tl",void 0),e,i),s.tr=Ea(ka(t,"tr",void 0),e,i),s.bl=Ea(ka(t,"bl",void 0),e,i),s.br=Ea(ka(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ma(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ma(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ma(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ma(this.cornerRadius.br,t)}}var Ea=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ra(t),t},Ma=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ka(e,"x",0),t.y=ka(e,"y",0)),Ra(t)},Ra=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Da=Phaser.Math.DegToRad;var La=function(t){return!t.hasOwnProperty("convex")||t.convex},za=function(t){return t.x>0&&t.y>0},Ya=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,za(a)?(o=a.x*g,l=a.y*f,La(a)?Ya(t,o,l,o,l,180,270,!1,h):Ya(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,za(a)?(o=a.x*g,l=a.y*f,La(a)?Ya(t,s-o,l,o,l,270,360,!1,h):Ya(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,za(a)?(o=a.x*g,l=a.y*f,La(a)?Ya(t,s-o,r-l,o,l,0,90,!1,h):Ya(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,za(a)?(o=a.x*g,l=a.y*f,La(a)?Ya(t,o,r-l,o,l,90,180,!1,h):Ya(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Aa=Phaser.Utils.Objects.GetValue;class Wa extends Sa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Aa(e,"color",null),Aa(e,"color2",null),Aa(e,"horizontalGradient",!0)),this.setStroke(Aa(e,"stroke",null),Aa(e,"strokeThickness",2)),this.setCornerRadius(Aa(e,"cornerRadius",0),Aa(e,"cornerIteration",null))}set color(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Oa("color2",t,this),Oa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Oa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Xa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Fa=Phaser.Utils.Objects.GetValue;class Ia extends Sa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Fa(e,"color",null),Fa(e,"color2",null),Fa(e,"horizontalGradient",!0)),this.setStroke(Fa(e,"stroke",null),Fa(e,"strokeThickness",2))}set color(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Fa(t,"color2",null),Fa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ba=Phaser.Utils.Objects.GetValue;class ja{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ba(t,"bold",!1)),this.setItalic(Ba(t,"italic",!1)),this.setFontSize(Ba(t,"fontSize","16px")),this.setFontFamily(Ba(t,"fontFamily","Courier")),this.setColor(Ba(t,"color","#fff")),this.setStrokeStyle(Ba(t,"stroke",null),Ba(t,"strokeThickness",0)),this.setShadow(Ba(t,"shadowColor",null),Ba(t,"shadowOffsetX",0),Ba(t,"shadowOffsetY",0),Ba(t,"shadowBlur",0)),this.setOffset(Ba(t,"offsetX",0),Ba(t,"offsetY",0)),this.setSpace(Ba(t,"leftSpace",0),Ba(t,"rightSpace",0)),this.setAlign(Ba(t,"align",void 0)),this.setBackgroundColor(Ba(t,"backgroundColor",null)),this.setBackgroundHeight(Ba(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ba(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Oa("stroke",t,this),Oa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Oa("shadowOffsetX",t,this),Oa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new ja(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Pa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Pa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Pa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Pa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ha=Phaser.Utils.Array.Remove,Na=Phaser.Utils.Array.Remove,Ua="text",Ga="image",Va="drawer",$a="space",Ja="command";var qa=function(t){return t.type===Ua&&"\n"===t.text},Za=function(t){return t.type===Ua&&"\f"===t.text},Ka=function(t){return t.type===Ua};class Qa extends Sa{constructor(t,e,i){super(t,Ua),this.updateTextFlag=!1,this.style=new ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var to=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const eo=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class io extends Sa{constructor(t,e,i){super(t,Ga),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=eo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),eo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class so extends Sa{constructor(t,e,i,s){super(t,Va),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class ro extends Sa{constructor(t,e){super(t,$a),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class no extends sa{constructor(t,e,i,s,r){super(t,Ja),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function ho(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ho(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ho(t[i]));return e}var ao=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const oo={none:0,word:1,char:2,character:2,mix:3};var lo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=vo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=vo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=fo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=fo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=fo(t,"wrapMode");void 0===c&&(c=fo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=oo[c]);var u=fo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=fo(t,"letterSpacing",0),v=fo(t,"hAlign",0),g=fo(t,"vAlign",0),f=fo(t,"justifyPercentage",.25),m=ao({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=xo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=xo(t,"maxLines",0);var a=0===i,o=xo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=xo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=xo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=xo(t,"letterSpacing",0),p=xo(t,"rtl",!0),v=xo(t,"hAlign",p?2:0),g=xo(t,"vAlign",0),f=ao({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Me(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ha(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Na(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ua);return null===i?i=new Qa(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ya(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const No=Phaser.Utils.Objects.GetFastValue;var Uo={};class Go{constructor(t){this.pools=No(t,"pools",Uo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Ho),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=tl(t,r,e,i,n),a=0;a<=Zo&&0!==h;a++){if((r+=h)<0){r=0;break}h=tl(t,r,e,i,n)}return a===Zo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),el(t,e,i),t},Qo=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},tl=function(t,e,i,s,r){var n,h=Qo(t,e,r),a=Qo(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},el=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const il=Phaser.Utils.Objects.GetValue;var sl=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=il(e,"minWidth",0),s=il(e,"minHeight",0),r=il(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Ko(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Ko(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const rl=Phaser.Utils.Objects.GetValue,nl=[function(t){var e=this.scene,i=Lh(t,"orientation",0);this.setOrientation(i);var s=Lh(t,"icon",void 0),r=Lh(t,"iconMask",void 0),n=Lh(t,"innerBackground",void 0),h=Lh(t,"title",void 0),a=Lh(t,"separator",void 0),o=Lh(t,"text",void 0),l=Lh(t,"action",void 0),d=Lh(t,"actionMask",void 0);if(s){var c=Lh(t,"align.icon","center");m=0===this.orientation?{right:Lh(t,"space.icon",0),top:Lh(t,"space.iconTop",0),bottom:Lh(t,"space.iconBottom",0),left:Lh(t,"space.iconLeft",0)}:{bottom:Lh(t,"space.icon",0),left:Lh(t,"space.iconLeft",0),right:Lh(t,"space.iconRight",0),top:Lh(t,"space.iconTop",0)};var u=Lh(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:u}),r&&(r=Dh.call(this,s,s,1)),!u){var p=Lh(t,"iconSize",void 0);this.setIconSize(Lh(t,"iconWidth",p),Lh(t,"iconHeight",p))}}var v=new Th(e,{orientation:1});n&&v.addBackground(n);var g=Lh(t,"space.separator",0);if(h){c=Lh(t,"align.title","left");var f=Lh(t,"expandTitleWidth",!1);y=Lh(t,"expandTitleHeight",!1)?1:0,x=f,m={bottom:!a&&o?Lh(t,"space.title",g):0,left:Lh(t,"space.titleLeft",0),right:Lh(t,"space.titleRight",0)},v.add(h,{proportion:y,expand:x,align:c,padding:m})}if(a){var m={top:h?g:0,bottom:o?g:0,left:Lh(t,"space.separatorLeft",0),right:Lh(t,"space.separatorRight",0)};v.add(a,{expand:!0,padding:m})}if(o){c=Lh(t,"align.text","left");var y,x,b=Lh(t,"expandTextWidth",!1);y=Lh(t,"expandTextHeight",!1)?1:0,x=b,m={left:Lh(t,"space.textLeft",0),right:Lh(t,"space.textRight",0)},v.add(o,{proportion:y,expand:x,align:c,padding:m})}if(m=void 0,l&&(m={right:Lh(t,"space.text",0)}),this.add(v,{proportion:1,padding:m}),l&&(c=Lh(t,"align.action","center"),m=0===this.orientation?{top:Lh(t,"space.actionTop",0),bottom:Lh(t,"space.actionBottom",0),right:Lh(t,"space.actionRight",0)}:{left:Lh(t,"space.actionLeft",0),right:Lh(t,"space.actionRight",0),bottom:Lh(t,"space.actionBottom",0)},u=Lh(t,"squareFitAction",!1)?1:0,this.add(l,{proportion:0,align:c,padding:m,fitRatio:u}),d&&(d=Dh.call(this,l,l,1)),!u)){var C=Lh(t,"actionSize");this.setActionSize(Lh(t,"actionWidth",C),Lh(t,"actionHeight",C))}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",v),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",h),this.addChildrenMap("separator",a),this.addChildrenMap("text",o),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",d)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=zh(t,"title",void 0),s=zh(t,"separator",void 0),r=zh(t,"innerBackground",void 0),n=zh(t,"icon",void 0),h=zh(t,"iconMask",void 0),a=zh(t,"text",void 0),o=zh(t,"action",void 0),l=zh(t,"actionMask",void 0);if(i){var d=zh(t,"align.title","left"),c=zh(t,"expandTitleWidth",!1);y=zh(t,"expandTitleHeight",!1)?1:0,x=c,p={bottom:zh(t,"space.title",0),left:zh(t,"space.titleLeft",0),right:zh(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:x,align:d,padding:p})}if(s){var u=zh(t,"space.separator",0),p={top:i?u:0,bottom:a?u:0,left:zh(t,"space.separatorLeft",0),right:zh(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var v=zh(t,"orientation",0),g=new Th(e,{orientation:v,rtl:zh(t,"rtl",!1),space:{left:zh(t,"space.innerLeft",0),right:zh(t,"space.innerRight",0),top:zh(t,"space.innerTop",0),bottom:zh(t,"space.innerBottom",0)}});if(r&&g.addBackground(r),this.add(g,{proportion:1,expand:!0}),n){d=zh(t,"align.icon","center"),p=0===g.orientation?{right:zh(t,"space.icon",0),top:zh(t,"space.iconTop",0),bottom:zh(t,"space.iconBottom",0),left:zh(t,"space.iconLeft",0)}:{bottom:zh(t,"space.icon",0),left:zh(t,"space.iconLeft",0),right:zh(t,"space.iconRight",0),top:zh(t,"space.iconTop",0)};var f=zh(t,"squareFitIcon",!1)?1:0;if(g.add(n,{proportion:0,align:d,padding:p,fitRatio:f}),h&&(h=Dh.call(this,n,n,1)),!f){var m=zh(t,"iconSize",void 0);this.setIconSize(zh(t,"iconWidth",m),zh(t,"iconHeight",m))}}if(a){d=zh(t,"align.text","left");var y,x,b=zh(t,"space.text",0),C=zh(t,"expandTextWidth",!1),w=zh(t,"expandTextHeight",!1);0===g.orientation?(y=C?1:0,o&&(p={right:b}),x=w):(y=w?1:0,o&&(p={bottom:b}),x=C),g.add(a,{proportion:y,expand:x,align:d,padding:p})}if(o&&(d=zh(t,"align.action","center"),p=0===g.orientation?{top:zh(t,"space.actionTop",0),bottom:zh(t,"space.actionBottom",0),right:zh(t,"space.actionRight",0)}:{left:zh(t,"space.actionLeft",0),right:zh(t,"space.actionRight",0),bottom:zh(t,"space.actionBottom",0)},f=zh(t,"squareFitAction",!1)?1:0,g.add(o,{proportion:0,align:d,padding:p,fitRatio:f}),l&&(l=Dh.call(this,o,o,1)),!f)){var S=zh(t,"actionSize");this.setActionSize(zh(t,"actionWidth",S),zh(t,"actionHeight",S))}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",h),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)}];return class extends kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=rl(e,"background",void 0);i&&this.addBackground(i);var s=rl(e,"title",void 0),r=rl(e,"text",void 0);if(s){var n=rl(e,"wrapTitle",!1),h=rl(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Uh(s,n),e.expandTitleWidth=!0,qo(s)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,sl(s,{fitHeight:!0}))}if(r){var a=rl(e,"wrapText",!1),o=rl(e,"adjustTextFontSize",!1);a?(!0===a&&(a="word"),Uh(r,a),e.expandTextWidth=!0,qo(r)):o&&(e.expandTextWidth=!0,e.expandTextHeight=!0,sl(r,{fitHeight:!0}))}var l=rl(e,"layoutMode",0);(nl[l]||nl[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextitlelabel=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=T(t.scaleX,i.scaleX),e.scaleY=T(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=T(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},z=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var B={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const _e=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Xe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ye=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?fi:gi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=fi))}get t(){var t;switch(this.state){case vi:case gi:case mi:t=0;break;case fi:t=this.nowTime/this.duration;break;case yi:t=1}return ui(t,0,1)}set t(t){(t=ui(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===fi}get isRunning(){return this.state===gi||this.state===fi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,gi=1,fi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const xi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends bi{resetFromJSON(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ti=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;class ki extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ti(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const _i={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Xi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Xi),zi.onInitScale=function(){Xi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Fi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,Ji=Phaser.Math.Linear;class qi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=$i(t,"x",void 0),i=$i(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=$i(i,"startX",void 0),this.startY=$i(i,"startY",void 0),this.endX=$i(i,"endX",void 0),this.endY=$i(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ji(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ji(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends hi{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,cs=Phaser.Math.Linear;class us extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=cs(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new us(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},fs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Xs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ys={};Object.assign(Ys,Ds,Ls,Xs,zs);const As=Phaser.Utils.Objects.GetValue;class Ws extends ei{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ws.prototype,Ys);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Fs(e):t};class Is extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class js extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends js{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var $s={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Qs=class extends Ws{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Js)),this.setCoverTransitOutCallback(Ks(i,"transitOut",qs)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=$s.popUp;break;case tr.fadeIn:t=$s.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=$s.scaleDown;break;case tr.fadeOut:t=$s.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},xr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Cr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return wr.length=0,!0;return wr.length=0,!1},wr=[];const Sr=Phaser.Utils.Objects.GetValue;class Tr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?xr:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Tr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Ms{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class Er extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Mr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Jr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const $r=0,Jr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=an,0===this.holdTime&&(this.state=on)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&t-this.pointer.downTime>=this.holdTime&&(this.state=on)}get isPressed(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",xn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(xn(e,"inputConfig",void 0)),this.setEventEmitter(xn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(xn(t,"enable",!0)),this.bounds=xn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case kn:this.tracerState=On,this.onDrag1End();break;case _n:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(Tn.prototype,Ve);var Pn={};const On=0,kn=1,_n=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Dn={};const Ln=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var Wn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Yn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Bn}break;case Bn:t=Xn(Yn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Bn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Fn="IDLE",In="BEGIN",Bn="RECOGNIZED",jn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},zr.call(t,e),Wr.call(t,e),Br.call(t,e),Ur.call(t,e),Hn.call(t,e),Un.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",de),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ce(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;fe.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=oh[e];else if(nh(e)){var f;e=hh(f=e,"proportion",void 0),i=hh(f,"align",ah),s=hh(f,"padding",0),r=hh(f,"expand",!1),n=hh(f,"key",void 0),h=hh(f,"index",void 0),t.isRexSizer||(a=hh(f,"minWidth",void 0),o=hh(f,"minHeight",void 0)),l=hh(f,"fitRatio",0),d=hh(f,"offsetX",0),c=hh(f,"offsetY",0),u=hh(f,"offsetOriginX",0),p=hh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ve(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Et.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Xe.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eh.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(bh,dh,vh,gh,fh,mh,yh);var xh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Th extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=xh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,bh);var Ph=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Oh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class kh extends Th{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Ph(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Ph(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Ph(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Ph(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(kh.prototype,Oh);var _h=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Eh=Phaser.GameObjects.Graphics;class Mh extends Eh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Rh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,_h.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,_h.call(this,this.width,this.height,this.padding,t,e)),this}}const Rh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Mh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Lh=Phaser.Utils.Objects.GetValue,Xh=Phaser.Utils.Objects.GetValue,zh=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof zh};const Ah=Phaser.GameObjects.BitmapText;var Wh=function(t){return t instanceof Ah},Fh=/^[\x00-\x7F]+$/,Ih=function(t){return Fh.test(t)},Bh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Hh=2;const Nh={none:0,word:1,char:Hh,character:Hh,mix:3};var Uh=function(t,e){var i=function(t){return Wh(t)?2:Yh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Nh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Bh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Nh[e]||0),t.style.wrapMode=e}};const Gh=Phaser.Renderer.WebGL.Utils;var Vh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Gh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const $h=Phaser.Display.Color;var Jh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new $h);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},qh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Zh=Phaser.Display.Canvas.CanvasPool,Kh=Phaser.GameObjects.GameObject,Qh=Phaser.Utils.String.UUID;class ta extends Kh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Zh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Qh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Zh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ea=Phaser.GameObjects.Components;Phaser.Class.mixin(ta,[ea.Alpha,ea.BlendMode,ea.Crop,ea.Depth,ea.Flip,ea.GetBounds,ea.Mask,ea.Origin,ea.Pipeline,ea.PostPipeline,ea.ScrollFactor,ea.Tint,ea.Transform,ea.Visible,Vh,Jh,qh]);var ia={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ps(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class sa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(sa.prototype,ia);var ra={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const na=Phaser.Math.RotateAround;var ha;const aa=Phaser.Geom.Rectangle;var oa,la=function(t){void 0===oa&&(oa=new aa);var e=t.drawTLX,i=t.drawTLY;return oa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),oa};const da=Phaser.Math.RotateAround;var ca,ua=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ca&&(ca={}),s=ca),s.x=e,s.y=i,0!==t.rotation&&da(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const pa=Phaser.GameObjects.Components.TransformMatrix;var va,ga,fa={},ma=function(t,e,i,s,r){var n=ua(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=fa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===va&&(va=new pa,ga=new pa),t.parentContainer?t.getWorldTransformMatrix(va,ga):va.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),va.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},ya=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ma(t,e,n,h,r)},ba={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ha&&(ha={}),s=ha),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&na(s,0,0,-i.rotation),s}(t,e,this,!0);return la(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ya(this.parent,this,t,e,i)}};Object.assign(ba,ra);const xa=Phaser.Math.DegToRad,Ca=Phaser.Math.RadToDeg,wa=Phaser.Utils.Objects.GetValue;class Sa extends sa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ca(this._rotation)}set angle(t){this.rotation=xa(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=wa(t,"width",void 0),i=wa(t,"height",void 0),s=wa(t,"scaleX",void 0),r=wa(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Sa.prototype,ba);const Ta=Phaser.Utils.String.Pad;var Pa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ta(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Oa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const ka=Phaser.Utils.Objects.GetValue;class _a{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ka(t,"x",0),i=ka(t,"y",0));var s=this.cornerRadius;s.tl=Ea(ka(t,"tl",void 0),e,i),s.tr=Ea(ka(t,"tr",void 0),e,i),s.bl=Ea(ka(t,"bl",void 0),e,i),s.br=Ea(ka(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ma(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ma(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ma(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ma(this.cornerRadius.br,t)}}var Ea=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ra(t),t},Ma=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ka(e,"x",0),t.y=ka(e,"y",0)),Ra(t)},Ra=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Da=Phaser.Math.DegToRad;var La=function(t){return!t.hasOwnProperty("convex")||t.convex},Xa=function(t){return t.x>0&&t.y>0},za=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Xa(a)?(o=a.x*g,l=a.y*f,La(a)?za(t,o,l,o,l,180,270,!1,h):za(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Xa(a)?(o=a.x*g,l=a.y*f,La(a)?za(t,s-o,l,o,l,270,360,!1,h):za(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Xa(a)?(o=a.x*g,l=a.y*f,La(a)?za(t,s-o,r-l,o,l,0,90,!1,h):za(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Xa(a)?(o=a.x*g,l=a.y*f,La(a)?za(t,o,r-l,o,l,90,180,!1,h):za(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Aa=Phaser.Utils.Objects.GetValue;class Wa extends Sa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Aa(e,"color",null),Aa(e,"color2",null),Aa(e,"horizontalGradient",!0)),this.setStroke(Aa(e,"stroke",null),Aa(e,"strokeThickness",2)),this.setCornerRadius(Aa(e,"cornerRadius",0),Aa(e,"cornerIteration",null))}set color(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Oa("color2",t,this),Oa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Oa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ya(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Fa=Phaser.Utils.Objects.GetValue;class Ia extends Sa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Fa(e,"color",null),Fa(e,"color2",null),Fa(e,"horizontalGradient",!0)),this.setStroke(Fa(e,"stroke",null),Fa(e,"strokeThickness",2))}set color(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Pa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Fa(t,"color2",null),Fa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ba=Phaser.Utils.Objects.GetValue;class ja{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ba(t,"bold",!1)),this.setItalic(Ba(t,"italic",!1)),this.setFontSize(Ba(t,"fontSize","16px")),this.setFontFamily(Ba(t,"fontFamily","Courier")),this.setColor(Ba(t,"color","#fff")),this.setStrokeStyle(Ba(t,"stroke",null),Ba(t,"strokeThickness",0)),this.setShadow(Ba(t,"shadowColor",null),Ba(t,"shadowOffsetX",0),Ba(t,"shadowOffsetY",0),Ba(t,"shadowBlur",0)),this.setOffset(Ba(t,"offsetX",0),Ba(t,"offsetY",0)),this.setSpace(Ba(t,"leftSpace",0),Ba(t,"rightSpace",0)),this.setAlign(Ba(t,"align",void 0)),this.setBackgroundColor(Ba(t,"backgroundColor",null)),this.setBackgroundHeight(Ba(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ba(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Ba(t,"backgroundLeftX",0)),this.setBackgroundRightX(Ba(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Oa("stroke",t,this),Oa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Oa("shadowOffsetX",t,this),Oa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new ja(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Pa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Pa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Pa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Pa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ha=Phaser.Utils.Array.Remove,Na=Phaser.Utils.Array.Remove,Ua="text",Ga="image",Va="drawer",$a="space",Ja="command";var qa=function(t){return t.type===Ua&&"\n"===t.text},Za=function(t){return t.type===Ua&&"\f"===t.text},Ka=function(t){return t.type===Ua};class Qa extends Sa{constructor(t,e,i){super(t,Ua),this.updateTextFlag=!1,this.style=new ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var to=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const eo=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class io extends Sa{constructor(t,e,i){super(t,Ga),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=eo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),eo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class so extends Sa{constructor(t,e,i,s){super(t,Va),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class ro extends Sa{constructor(t,e){super(t,$a),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class no extends sa{constructor(t,e,i,s,r){super(t,Ja),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function ho(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ho(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ho(t[i]));return e}var ao=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const oo={none:0,word:1,char:2,character:2,mix:3};var lo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=vo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=vo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=fo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=fo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=fo(t,"wrapMode");void 0===c&&(c=fo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=oo[c]);var u=fo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=fo(t,"letterSpacing",0),v=fo(t,"hAlign",0),g=fo(t,"vAlign",0),f=fo(t,"justifyPercentage",.25),m=ao({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=bo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=bo(t,"maxLines",0);var a=0===i,o=bo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=bo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=bo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=bo(t,"letterSpacing",0),p=bo(t,"rtl",!0),v=bo(t,"hAlign",p?2:0),g=bo(t,"vAlign",0),f=ao({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Me(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ha(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Na(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ua);return null===i?i=new Qa(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ya(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const No=Phaser.Utils.Objects.GetFastValue;var Uo={};class Go{constructor(t){this.pools=No(t,"pools",Uo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Ho),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=tl(t,r,e,i,n),a=0;a<=Zo&&0!==h;a++){if((r+=h)<0){r=0;break}h=tl(t,r,e,i,n)}return a===Zo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),el(t,e,i),t},Qo=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},tl=function(t,e,i,s,r){var n,h=Qo(t,e,r),a=Qo(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},el=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const il=Phaser.Utils.Objects.GetValue;var sl=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=il(e,"minWidth",0),s=il(e,"minHeight",0),r=il(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Ko(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Ko(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const rl=Phaser.Utils.Objects.GetValue,nl=[function(t){var e=this.scene,i=Lh(t,"orientation",0);this.setOrientation(i);var s=Lh(t,"icon",void 0),r=Lh(t,"iconMask",void 0),n=Lh(t,"innerBackground",void 0),h=Lh(t,"title",void 0),a=Lh(t,"separator",void 0),o=Lh(t,"text",void 0),l=Lh(t,"action",void 0),d=Lh(t,"actionMask",void 0);if(s){var c=Lh(t,"align.icon","center");m=0===this.orientation?{right:Lh(t,"space.icon",0),top:Lh(t,"space.iconTop",0),bottom:Lh(t,"space.iconBottom",0),left:Lh(t,"space.iconLeft",0)}:{bottom:Lh(t,"space.icon",0),left:Lh(t,"space.iconLeft",0),right:Lh(t,"space.iconRight",0),top:Lh(t,"space.iconTop",0)};var u=Lh(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:u}),r&&(r=Dh.call(this,s,s,1)),!u){var p=Lh(t,"iconSize",void 0);this.setIconSize(Lh(t,"iconWidth",p),Lh(t,"iconHeight",p))}}var v=new Th(e,{orientation:1});n&&v.addBackground(n);var g=Lh(t,"space.separator",0);if(h){c=Lh(t,"align.title","left");var f=Lh(t,"expandTitleWidth",!1);y=Lh(t,"expandTitleHeight",!1)?1:0,b=f,m={bottom:!a&&o?Lh(t,"space.title",g):0,left:Lh(t,"space.titleLeft",0),right:Lh(t,"space.titleRight",0)},v.add(h,{proportion:y,expand:b,align:c,padding:m})}if(a){var m={top:h?g:0,bottom:o?g:0,left:Lh(t,"space.separatorLeft",0),right:Lh(t,"space.separatorRight",0)};v.add(a,{expand:!0,padding:m})}if(o){c=Lh(t,"align.text","left");var y,b,x=Lh(t,"expandTextWidth",!1);y=Lh(t,"expandTextHeight",!1)?1:0,b=x,m={left:Lh(t,"space.textLeft",0),right:Lh(t,"space.textRight",0)},v.add(o,{proportion:y,expand:b,align:c,padding:m})}if(m=void 0,l&&(m={right:Lh(t,"space.text",0)}),this.add(v,{proportion:1,padding:m}),l&&(c=Lh(t,"align.action","center"),m=0===this.orientation?{top:Lh(t,"space.actionTop",0),bottom:Lh(t,"space.actionBottom",0),right:Lh(t,"space.actionRight",0)}:{left:Lh(t,"space.actionLeft",0),right:Lh(t,"space.actionRight",0),bottom:Lh(t,"space.actionBottom",0)},u=Lh(t,"squareFitAction",!1)?1:0,this.add(l,{proportion:0,align:c,padding:m,fitRatio:u}),d&&(d=Dh.call(this,l,l,1)),!u)){var C=Lh(t,"actionSize");this.setActionSize(Lh(t,"actionWidth",C),Lh(t,"actionHeight",C))}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",v),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",h),this.addChildrenMap("separator",a),this.addChildrenMap("text",o),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",d)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=Xh(t,"title",void 0),s=Xh(t,"separator",void 0),r=Xh(t,"innerBackground",void 0),n=Xh(t,"icon",void 0),h=Xh(t,"iconMask",void 0),a=Xh(t,"text",void 0),o=Xh(t,"action",void 0),l=Xh(t,"actionMask",void 0);if(i){var d=Xh(t,"align.title","left"),c=Xh(t,"expandTitleWidth",!1);y=Xh(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:Xh(t,"space.title",0),left:Xh(t,"space.titleLeft",0),right:Xh(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:d,padding:p})}if(s){var u=Xh(t,"space.separator",0),p={top:i?u:0,bottom:a?u:0,left:Xh(t,"space.separatorLeft",0),right:Xh(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var v=Xh(t,"orientation",0),g=new Th(e,{orientation:v,rtl:Xh(t,"rtl",!1),space:{left:Xh(t,"space.innerLeft",0),right:Xh(t,"space.innerRight",0),top:Xh(t,"space.innerTop",0),bottom:Xh(t,"space.innerBottom",0)}});if(r&&g.addBackground(r),this.add(g,{proportion:1,expand:!0}),n){d=Xh(t,"align.icon","center"),p=0===g.orientation?{right:Xh(t,"space.icon",0),top:Xh(t,"space.iconTop",0),bottom:Xh(t,"space.iconBottom",0),left:Xh(t,"space.iconLeft",0)}:{bottom:Xh(t,"space.icon",0),left:Xh(t,"space.iconLeft",0),right:Xh(t,"space.iconRight",0),top:Xh(t,"space.iconTop",0)};var f=Xh(t,"squareFitIcon",!1)?1:0;if(g.add(n,{proportion:0,align:d,padding:p,fitRatio:f}),h&&(h=Dh.call(this,n,n,1)),!f){var m=Xh(t,"iconSize",void 0);this.setIconSize(Xh(t,"iconWidth",m),Xh(t,"iconHeight",m))}}if(a){d=Xh(t,"align.text","left");var y,b,x=Xh(t,"space.text",0),C=Xh(t,"expandTextWidth",!1),w=Xh(t,"expandTextHeight",!1);0===g.orientation?(y=C?1:0,o&&(p={right:x}),b=w):(y=w?1:0,o&&(p={bottom:x}),b=C),g.add(a,{proportion:y,expand:b,align:d,padding:p})}if(o&&(d=Xh(t,"align.action","center"),p=0===g.orientation?{top:Xh(t,"space.actionTop",0),bottom:Xh(t,"space.actionBottom",0),right:Xh(t,"space.actionRight",0)}:{left:Xh(t,"space.actionLeft",0),right:Xh(t,"space.actionRight",0),bottom:Xh(t,"space.actionBottom",0)},f=Xh(t,"squareFitAction",!1)?1:0,g.add(o,{proportion:0,align:d,padding:p,fitRatio:f}),l&&(l=Dh.call(this,o,o,1)),!f)){var S=Xh(t,"actionSize");this.setActionSize(Xh(t,"actionWidth",S),Xh(t,"actionHeight",S))}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",h),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)}];return class extends kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=rl(e,"background",void 0);i&&this.addBackground(i);var s=rl(e,"title",void 0),r=rl(e,"text",void 0);if(s){var n=rl(e,"wrapTitle",!1),h=rl(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Uh(s,n),e.expandTitleWidth=!0,qo(s)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,sl(s,{fitHeight:!0}))}if(r){var a=rl(e,"wrapText",!1),o=rl(e,"adjustTextFontSize",!1);a?(!0===a&&(a="word"),Uh(r,a),e.expandTextWidth=!0,qo(r)):o&&(e.expandTextWidth=!0,e.expandTextHeight=!0,sl(r,{fitHeight:!0}))}var l=rl(e,"layoutMode",0);(nl[l]||nl[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextitlelabel=e(); diff --git a/dist/rextoast.js b/dist/rextoast.js index 24246ae8c1..e8e658354c 100644 --- a/dist/rextoast.js +++ b/dist/rextoast.js @@ -15596,6 +15596,8 @@ this.setBackgroundColor(GetValue$9(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$9(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$9(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$9(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$9(o, 'backgroundRightX', 0)); return this; } @@ -15666,6 +15668,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -15820,6 +15828,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -16247,20 +16265,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rextoast.min.js b/dist/rextoast.min.js index 0bd0474db0..7cbce2a427 100644 --- a/dist/rextoast.min.js +++ b/dist/rextoast.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=T(t.scaleX,i.scaleX),e.scaleY=T(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=T(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},X=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const _e=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?fi:gi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=fi))}get t(){var t;switch(this.state){case vi:case gi:case mi:t=0;break;case fi:t=this.nowTime/this.duration;break;case yi:t=1}return ui(t,0,1)}set t(t){(t=ui(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===fi}get isRunning(){return this.state===gi||this.state===fi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,gi=1,fi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const xi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends bi{resetFromJSON(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ti=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;class ki extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ti(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const _i={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Ii extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Bi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class qi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends hi{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,cs=Phaser.Math.Linear;class us extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=cs(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new us(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},fs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ds,Ls,Ys,Xs);const As=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Is(e):t};class Ws extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;class Bs extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends Bs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e)},fadeOut(t,e){Hi(t,e,!1)}},$s=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha)},qs=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",$s)),this.setCoverTransitOutCallback(Ks(i,"transitOut",qs)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=Js.popUp;break;case tr.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=Js.scaleDown;break;case tr.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Tr=Phaser.Utils.Objects.GetValue;class Or extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Tr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Tr(t,"enable",!0)),this.setMode(Tr(t,"mode",1)),this.setClickInterval(Tr(t,"clickInterval",100)),this.setDragThreshold(Tr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Ms{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Dr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Zr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const $r=0,qr=1,Zr="IDLE",Kr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Kr(t,"time",250)),this.setTapInterval(Kr(t,"tapInterval",200)),this.setDragThreshold(Kr(t,"threshold",9)),this.setTapOffset(Kr(t,"tapOffset",10));var e=Kr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Kr(t,"maxTaps",void 0)),this.setMinTaps(Kr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;const dn=Phaser.Math.Distance.Between,cn=Phaser.Math.Angle.Between;var un={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)}},pn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vn={};const gn=Phaser.Utils.Objects.GetValue,fn=Phaser.Math.RadToDeg;class mn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=yn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(gn(t,"threshold",10)),this.setVelocityThreshold(gn(t,"velocityThreshold",1e3)),this.setDirectionMode(gn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=yn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xn&&(this.state=yn)}get isSwiped(){return this.state===xn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=pn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(fn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(mn.prototype,un);const yn="IDLE",bn="BEGIN",xn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,Tn=Phaser.Math.Angle.Between;class On{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=En,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],wn(this.pointers,e),this.tracerState){case _n:this.tracerState=kn,this.onDrag1End();break;case En:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case En:this.onDrag2()}}}dragCancel(){return this.tracerState===En&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Mn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(On.prototype,Ve);var Pn={};const kn=0,_n=1,En=2,Mn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Ln={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Ln),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(An(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Bn}break;case Bn:t=Xn(An(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Bn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Wn="IDLE",jn="BEGIN",Bn="RECOGNIZED",Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new mn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Yr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},zr.call(t,e),Ir.call(t,e),Br.call(t,e),Gr.call(t,e),Nn.call(t,e),Gn.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",de),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ce(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const hh=Phaser.Utils.Objects.IsPlainObject,ah=Phaser.Utils.Objects.GetValue,oh=Phaser.Display.Align.CENTER,lh={min:0,full:-1};var dh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;fe.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=lh[e];else if(hh(e)){var f;e=ah(f=e,"proportion",void 0),i=ah(f,"align",oh),s=ah(f,"padding",0),r=ah(f,"expand",!1),n=ah(f,"key",void 0),h=ah(f,"index",void 0),t.isRexSizer||(a=ah(f,"minWidth",void 0),o=ah(f,"minHeight",void 0)),l=ah(f,"fitRatio",0),d=ah(f,"offsetX",0),c=ah(f,"offsetY",0),u=ah(f,"offsetOriginX",0),p=ah(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=oh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ve(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ch={add:dh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),dh.call(this,new rh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return hh(i)&&(i.index=t),dh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=nh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const uh=Et.prototype.clear;var ph=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),uh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ph.call(this,t),this}},fh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},mh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},yh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ih.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ih.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(xh,ch,gh,fh,mh,yh,bh);var Ch=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},wh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Sh=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Oh extends Qn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):Sh(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):Sh(n)&&(n=Th(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=wh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ch.call(this)),this._childrenProportion}}Object.assign(Oh.prototype,xh);var Ph=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class _h extends Oh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Ph(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Ph(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Ph(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Ph(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(_h.prototype,kh);var Eh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Dh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Eh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Eh.call(this,this.width,this.height,this.padding,t,e)),this}}const Dh={rectangle:0,circle:1};var Lh=function(t,e,i,s){var r=new Rh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Yh=Phaser.GameObjects.Text;var Xh=function(t){return t instanceof Yh};const zh=Phaser.GameObjects.BitmapText;var Ah=function(t){return t instanceof zh},Fh=/^[\x00-\x7F]+$/,Ih=function(t){return Fh.test(t)},Wh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Bh=2;const Hh={none:0,word:1,char:Bh,character:Bh,mix:3};var Nh=function(t,e){var i=function(t){return Ah(t)?2:Xh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Hh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Wh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Hh[e]||0),t.style.wrapMode=e}};const Uh=Phaser.Renderer.WebGL.Utils;var Gh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Uh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Vh=Phaser.Display.Color;var Jh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Vh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},$h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const qh=Phaser.Display.Canvas.CanvasPool,Zh=Phaser.GameObjects.GameObject,Kh=Phaser.Utils.String.UUID;class Qh extends Zh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=qh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Kh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){qh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ta=Phaser.GameObjects.Components;Phaser.Class.mixin(Qh,[ta.Alpha,ta.BlendMode,ta.Crop,ta.Depth,ta.Flip,ta.GetBounds,ta.Mask,ta.Origin,ta.Pipeline,ta.PostPipeline,ta.ScrollFactor,ta.Tint,ta.Transform,ta.Visible,Gh,Jh,$h]);var ea={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Os(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ia{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ia.prototype,ea);var sa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ra=Phaser.Math.RotateAround;var na;const ha=Phaser.Geom.Rectangle;var aa,oa=function(t){void 0===aa&&(aa=new ha);var e=t.drawTLX,i=t.drawTLY;return aa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),aa};const la=Phaser.Math.RotateAround;var da,ca=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===da&&(da={}),s=da),s.x=e,s.y=i,0!==t.rotation&&la(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ua=Phaser.GameObjects.Components.TransformMatrix;var pa,va,ga={},fa=function(t,e,i,s,r){var n=ca(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ga);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===pa&&(pa=new ua,va=new ua),t.parentContainer?t.getWorldTransformMatrix(pa,va):pa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),pa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},ma=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return fa(t,e,n,h,r)},ya={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===na&&(na={}),s=na),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ra(s,0,0,-i.rotation),s}(t,e,this,!0);return oa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ma(this.parent,this,t,e,i)}};Object.assign(ya,sa);const ba=Phaser.Math.DegToRad,xa=Phaser.Math.RadToDeg,Ca=Phaser.Utils.Objects.GetValue;class wa extends ia{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return xa(this._rotation)}set angle(t){this.rotation=ba(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ca(t,"width",void 0),i=Ca(t,"height",void 0),s=Ca(t,"scaleX",void 0),r=Ca(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(wa.prototype,ya);const Sa=Phaser.Utils.String.Pad;var Ta=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Sa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Oa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Pa=Phaser.Utils.Objects.GetValue;class ka{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Pa(t,"x",0),i=Pa(t,"y",0));var s=this.cornerRadius;s.tl=_a(Pa(t,"tl",void 0),e,i),s.tr=_a(Pa(t,"tr",void 0),e,i),s.bl=_a(Pa(t,"bl",void 0),e,i),s.br=_a(Pa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ea(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ea(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ea(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ea(this.cornerRadius.br,t)}}var _a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ma(t),t},Ea=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Pa(e,"x",0),t.y=Pa(e,"y",0)),Ma(t)},Ma=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ra=Phaser.Math.DegToRad;var Da=function(t){return!t.hasOwnProperty("convex")||t.convex},La=function(t){return t.x>0&&t.y>0},Ya=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,La(a)?(o=a.x*g,l=a.y*f,Da(a)?Ya(t,o,l,o,l,180,270,!1,h):Ya(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,La(a)?(o=a.x*g,l=a.y*f,Da(a)?Ya(t,s-o,l,o,l,270,360,!1,h):Ya(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,La(a)?(o=a.x*g,l=a.y*f,Da(a)?Ya(t,s-o,r-l,o,l,0,90,!1,h):Ya(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,La(a)?(o=a.x*g,l=a.y*f,Da(a)?Ya(t,o,r-l,o,l,90,180,!1,h):Ya(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const za=Phaser.Utils.Objects.GetValue;class Aa extends wa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2)),this.setCornerRadius(za(e,"cornerRadius",0),za(e,"cornerIteration",null))}set color(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Oa("color2",t,this),Oa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Oa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Xa(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Fa=Phaser.Utils.Objects.GetValue;class Ia extends wa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Fa(e,"color",null),Fa(e,"color2",null),Fa(e,"horizontalGradient",!0)),this.setStroke(Fa(e,"stroke",null),Fa(e,"strokeThickness",2))}set color(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Fa(t,"color2",null),Fa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Wa=Phaser.Utils.Objects.GetValue;class ja{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Wa(t,"bold",!1)),this.setItalic(Wa(t,"italic",!1)),this.setFontSize(Wa(t,"fontSize","16px")),this.setFontFamily(Wa(t,"fontFamily","Courier")),this.setColor(Wa(t,"color","#fff")),this.setStrokeStyle(Wa(t,"stroke",null),Wa(t,"strokeThickness",0)),this.setShadow(Wa(t,"shadowColor",null),Wa(t,"shadowOffsetX",0),Wa(t,"shadowOffsetY",0),Wa(t,"shadowBlur",0)),this.setOffset(Wa(t,"offsetX",0),Wa(t,"offsetY",0)),this.setSpace(Wa(t,"leftSpace",0),Wa(t,"rightSpace",0)),this.setAlign(Wa(t,"align",void 0)),this.setBackgroundColor(Wa(t,"backgroundColor",null)),this.setBackgroundHeight(Wa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Wa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Oa("stroke",t,this),Oa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Oa("shadowOffsetX",t,this),Oa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new ja(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ta(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ta(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ta(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ta(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ba=Phaser.Utils.Array.Remove,Ha=Phaser.Utils.Array.Remove,Na="text",Ua="image",Ga="drawer",Va="space",Ja="command";var $a=function(t){return t.type===Na&&"\n"===t.text},qa=function(t){return t.type===Na&&"\f"===t.text},Za=function(t){return t.type===Na};class Ka extends wa{constructor(t,e,i){super(t,Na),this.updateTextFlag=!1,this.style=new ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Qa=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const to=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class eo extends wa{constructor(t,e,i){super(t,Ua),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=to.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),to.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class io extends wa{constructor(t,e,i,s){super(t,Ga),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class so extends wa{constructor(t,e){super(t,Va),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class ro extends ia{constructor(t,e,i,s,r){super(t,Ja),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function no(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>no(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=no(t[i]));return e}var ho=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const ao={none:0,word:1,char:2,character:2,mix:3};var oo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=po.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=po.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=go(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=go(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=go(t,"wrapMode");void 0===c&&(c=go(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=ao[c]);var u=go(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=go(t,"letterSpacing",0),v=go(t,"hAlign",0),g=go(t,"vAlign",0),f=go(t,"justifyPercentage",.25),m=ho({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var W=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=yo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=yo(t,"maxLines",0);var a=0===i,o=yo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=yo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=yo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=yo(t,"letterSpacing",0),p=yo(t,"rtl",!0),v=yo(t,"hAlign",p?2:0),g=yo(t,"vAlign",0),f=ho({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Me(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ba(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ha(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Na);return null===i?i=new Ka(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ma(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ho=Phaser.Utils.Objects.GetFastValue;var No={};class Uo{constructor(t){this.pools=Ho(t,"pools",No)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Bo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Qo(t,r,e,i,n),a=0;a<=qo&&0!==h;a++){if((r+=h)<0){r=0;break}h=Qo(t,r,e,i,n)}return a===qo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),tl(t,e,i),t},Ko=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Qo=function(t,e,i,s,r){var n,h=Ko(t,e,r),a=Ko(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},tl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const el=Phaser.Utils.Objects.GetValue,il=Phaser.Utils.Objects.GetValue;class sl extends _h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=il(e,"background",void 0),r=il(e,"icon",void 0),n=il(e,"iconMask",void 0),h=il(e,"text",void 0),a=il(e,"action",void 0),o=il(e,"actionMask",void 0),l=il(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:il(e,"space.icon",0),top:il(e,"space.iconTop",0),bottom:il(e,"space.iconBottom",0),left:il(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:il(e,"space.icon",0),left:il(e,"space.iconLeft",0),right:il(e,"space.iconRight",0),top:il(e,"space.iconTop",0)});var d=il(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Lh.call(this,r,r,1)),!d){var c=il(e,"iconSize",void 0);this.setIconSize(il(e,"iconWidth",c),il(e,"iconHeight",c))}}if(h){var u=il(e,"wrapText",!1),p=il(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Nh(h,u),e.expandTextWidth=!0,$o(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=el(e,"minWidth",0),s=el(e,"minHeight",0),r=el(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Zo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Zo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=il(e,"space.text",0),m=il(e,"expandTextWidth",!1),y=il(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:il(e,"space.actionTop",0),bottom:il(e,"space.actionBottom",0),right:il(e,"space.actionRight",0)}:{left:il(e,"space.actionLeft",0),right:il(e,"space.actionRight",0),bottom:il(e,"space.actionBottom",0)},d=il(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Lh.call(this,a,a,1)),!d)){var b=il(e,"actionSize");this.setActionSize(il(e,"actionWidth",b),il(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var rl=function(t,e){t.popUp(e)},nl=function(t,e){t.scaleDown(e)},hl=function(t,e){t.fadeIn(e)},al=function(t,e){t.fadeOut(e)};const ol={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ll={setDisplayTime(t){return this.displayTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInTime(t){return this.transitInTime=t,this},setTransitInCallback(t){switch("string"==typeof t&&(t=ol[t]),t){case ol.popUp:t=rl;break;case ol.fadeIn:t=hl}return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){switch("string"==typeof t&&(t=ol[t]),t){case ol.scaleDown:t=nl;break;case ol.fadeOut:t=al}return t||(t=At),this.transitOutCallback=t,this}},dl={showMessage(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift()}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[0,[this.emit,"transitin",this,this.transitInTime]],[this.transitInTime,[At]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[0,[this.emit,"transitout",this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[At]]];return this.player.load(e,this).once("complete",(function(){this.showMessage()}),this).start(),this},removeAllMessages(){return this.messages.length=0,this}};const cl=Phaser.Utils.Objects.GetValue;class ul extends hi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.isRunning=cl(t,"isRunning",!1),this.timeScale=cl(t,"timeScale",1),this.now=cl(t,"now",0),this}toJSON(){return{isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}start(t){return void 0===t&&(t=0),this.delta=0,this.now=t,super.start(),this}seek(t){return this.now=t,this}setTimeScale(t){return this.timeScale=t,this}tick(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}class pl extends ul{startTicking(){super.startTicking(),this.scene.sys.events.on("update",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&this.scene.sys.events.off("update",this.update,this)}update(t,e){return this.isRunning&&0!==this.timeScale?(this.tick(e),this):this}}var vl=function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=e.length),t.length=s-i;for(var r=0,n=t.length;r=0;n--)s=yl(t[n],e,i);else for(var n=0,h=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(or(s)||(s=vl(Sl,i,1)),yl(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=Ol[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=Tl[t]),this.timeUnit=t,this}}var Sl=[];const Tl={ms:0,s:1,sec:1},Ol={abs:0,absolute:0,inc:1,increment:1},Pl=Phaser.Utils.Objects.GetValue;class kl extends sl{constructor(t,e){void 0===e&&(e={text:createDefaultTextObject(t)}),super(t,e),this.type="rexToast",this.setTransitInTime(Pl(e,"duration.in",200)),this.setDisplayTime(Pl(e,"duration.hold",1200)),this.setTransitOutTime(Pl(e,"duration.out",200)),this.setTransitInCallback(Pl(e,"transitIn",ol.popUp)),this.setTransitOutCallback(Pl(e,"transitOut",ol.scaleDown)),this.player=new wl(this,{dtMode:1}),this.messages=[],this.scaleX0=void 0,this.scaleY0=void 0,this.setVisible(!1)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,super.destroy(t))}setScale(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,super.setScale(t,e),this}get isShowingMessage(){return this.player.isPlaying}}return Object.assign(kl.prototype,ll,dl),kl},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextoast=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=T(t.scaleX,i.scaleX),e.scaleY=T(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=T(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const _e=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Xe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?fi:gi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=fi))}get t(){var t;switch(this.state){case vi:case gi:case mi:t=0;break;case fi:t=this.nowTime/this.duration;break;case yi:t=1}return ui(t,0,1)}set t(t){(t=ui(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===fi}get isRunning(){return this.state===gi||this.state===fi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,gi=1,fi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const xi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends bi{resetFromJSON(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ti=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;class ki extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ti(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const _i={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Xi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Xi),Yi.onInitScale=function(){Xi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Ii extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Bi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class qi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends hi{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,cs=Phaser.Math.Linear;class us extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=cs(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new us(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},fs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Xs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ys={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ds,Ls,Xs,Ys);const As=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Is(e):t};class Ws extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;class Bs extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends Bs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e)},fadeOut(t,e){Hi(t,e,!1)}},$s=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha)},qs=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",$s)),this.setCoverTransitOutCallback(Ks(i,"transitOut",qs)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=Js.popUp;break;case tr.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=Js.scaleDown;break;case tr.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Tr=Phaser.Utils.Objects.GetValue;class Or extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Tr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Tr(t,"enable",!0)),this.setMode(Tr(t,"mode",1)),this.setClickInterval(Tr(t,"clickInterval",100)),this.setDragThreshold(Tr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Ms{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Dr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Zr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const $r=0,qr=1,Zr="IDLE",Kr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Kr(t,"time",250)),this.setTapInterval(Kr(t,"tapInterval",200)),this.setDragThreshold(Kr(t,"threshold",9)),this.setTapOffset(Kr(t,"tapOffset",10));var e=Kr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Kr(t,"maxTaps",void 0)),this.setMinTaps(Kr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;const dn=Phaser.Math.Distance.Between,cn=Phaser.Math.Angle.Between;var un={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)}},pn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vn={};const gn=Phaser.Utils.Objects.GetValue,fn=Phaser.Math.RadToDeg;class mn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=yn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(gn(t,"threshold",10)),this.setVelocityThreshold(gn(t,"velocityThreshold",1e3)),this.setDirectionMode(gn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=yn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xn&&(this.state=yn)}get isSwiped(){return this.state===xn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=pn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(fn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(mn.prototype,un);const yn="IDLE",bn="BEGIN",xn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,Tn=Phaser.Math.Angle.Between;class On{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=En,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],wn(this.pointers,e),this.tracerState){case _n:this.tracerState=kn,this.onDrag1End();break;case En:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case En:this.onDrag2()}}}dragCancel(){return this.tracerState===En&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Mn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(On.prototype,Ve);var Pn={};const kn=0,_n=1,En=2,Mn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Ln={};const Xn=Phaser.Utils.Objects.GetValue,Yn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Ln),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Yn(An(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Bn}break;case Bn:t=Yn(An(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Bn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Wn="IDLE",jn="BEGIN",Bn="RECOGNIZED",Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new mn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Xr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},zr.call(t,e),Ir.call(t,e),Br.call(t,e),Gr.call(t,e),Nn.call(t,e),Gn.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",de),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ce(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const hh=Phaser.Utils.Objects.IsPlainObject,ah=Phaser.Utils.Objects.GetValue,oh=Phaser.Display.Align.CENTER,lh={min:0,full:-1};var dh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;fe.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=lh[e];else if(hh(e)){var f;e=ah(f=e,"proportion",void 0),i=ah(f,"align",oh),s=ah(f,"padding",0),r=ah(f,"expand",!1),n=ah(f,"key",void 0),h=ah(f,"index",void 0),t.isRexSizer||(a=ah(f,"minWidth",void 0),o=ah(f,"minHeight",void 0)),l=ah(f,"fitRatio",0),d=ah(f,"offsetX",0),c=ah(f,"offsetY",0),u=ah(f,"offsetOriginX",0),p=ah(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=oh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ve(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ch={add:dh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),dh.call(this,new rh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return hh(i)&&(i.index=t),dh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=nh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const uh=Et.prototype.clear;var ph=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),uh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ph.call(this,t),this}},fh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},mh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},yh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Xe.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ih.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ih.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(xh,ch,gh,fh,mh,yh,bh);var Ch=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},wh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Sh=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Oh extends Qn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):Sh(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):Sh(n)&&(n=Th(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=wh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ch.call(this)),this._childrenProportion}}Object.assign(Oh.prototype,xh);var Ph=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class _h extends Oh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Ph(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Ph(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Ph(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Ph(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(_h.prototype,kh);var Eh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Dh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Eh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Eh.call(this,this.width,this.height,this.padding,t,e)),this}}const Dh={rectangle:0,circle:1};var Lh=function(t,e,i,s){var r=new Rh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Xh=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Xh};const zh=Phaser.GameObjects.BitmapText;var Ah=function(t){return t instanceof zh},Fh=/^[\x00-\x7F]+$/,Ih=function(t){return Fh.test(t)},Wh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Bh=2;const Hh={none:0,word:1,char:Bh,character:Bh,mix:3};var Nh=function(t,e){var i=function(t){return Ah(t)?2:Yh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Hh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Wh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Hh[e]||0),t.style.wrapMode=e}};const Uh=Phaser.Renderer.WebGL.Utils;var Gh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Uh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Vh=Phaser.Display.Color;var Jh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Vh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},$h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const qh=Phaser.Display.Canvas.CanvasPool,Zh=Phaser.GameObjects.GameObject,Kh=Phaser.Utils.String.UUID;class Qh extends Zh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=qh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Kh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){qh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ta=Phaser.GameObjects.Components;Phaser.Class.mixin(Qh,[ta.Alpha,ta.BlendMode,ta.Crop,ta.Depth,ta.Flip,ta.GetBounds,ta.Mask,ta.Origin,ta.Pipeline,ta.PostPipeline,ta.ScrollFactor,ta.Tint,ta.Transform,ta.Visible,Gh,Jh,$h]);var ea={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Os(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ia{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ia.prototype,ea);var sa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ra=Phaser.Math.RotateAround;var na;const ha=Phaser.Geom.Rectangle;var aa,oa=function(t){void 0===aa&&(aa=new ha);var e=t.drawTLX,i=t.drawTLY;return aa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),aa};const la=Phaser.Math.RotateAround;var da,ca=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===da&&(da={}),s=da),s.x=e,s.y=i,0!==t.rotation&&la(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ua=Phaser.GameObjects.Components.TransformMatrix;var pa,va,ga={},fa=function(t,e,i,s,r){var n=ca(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ga);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===pa&&(pa=new ua,va=new ua),t.parentContainer?t.getWorldTransformMatrix(pa,va):pa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),pa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},ma=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return fa(t,e,n,h,r)},ya={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===na&&(na={}),s=na),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ra(s,0,0,-i.rotation),s}(t,e,this,!0);return oa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ma(this.parent,this,t,e,i)}};Object.assign(ya,sa);const ba=Phaser.Math.DegToRad,xa=Phaser.Math.RadToDeg,Ca=Phaser.Utils.Objects.GetValue;class wa extends ia{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return xa(this._rotation)}set angle(t){this.rotation=ba(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ca(t,"width",void 0),i=Ca(t,"height",void 0),s=Ca(t,"scaleX",void 0),r=Ca(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(wa.prototype,ya);const Sa=Phaser.Utils.String.Pad;var Ta=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Sa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Oa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Pa=Phaser.Utils.Objects.GetValue;class ka{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Pa(t,"x",0),i=Pa(t,"y",0));var s=this.cornerRadius;s.tl=_a(Pa(t,"tl",void 0),e,i),s.tr=_a(Pa(t,"tr",void 0),e,i),s.bl=_a(Pa(t,"bl",void 0),e,i),s.br=_a(Pa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ea(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ea(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ea(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ea(this.cornerRadius.br,t)}}var _a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ma(t),t},Ea=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Pa(e,"x",0),t.y=Pa(e,"y",0)),Ma(t)},Ma=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ra=Phaser.Math.DegToRad;var Da=function(t){return!t.hasOwnProperty("convex")||t.convex},La=function(t){return t.x>0&&t.y>0},Xa=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,La(a)?(o=a.x*g,l=a.y*f,Da(a)?Xa(t,o,l,o,l,180,270,!1,h):Xa(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,La(a)?(o=a.x*g,l=a.y*f,Da(a)?Xa(t,s-o,l,o,l,270,360,!1,h):Xa(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,La(a)?(o=a.x*g,l=a.y*f,Da(a)?Xa(t,s-o,r-l,o,l,0,90,!1,h):Xa(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,La(a)?(o=a.x*g,l=a.y*f,Da(a)?Xa(t,o,r-l,o,l,90,180,!1,h):Xa(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const za=Phaser.Utils.Objects.GetValue;class Aa extends wa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2)),this.setCornerRadius(za(e,"cornerRadius",0),za(e,"cornerIteration",null))}set color(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Oa("color2",t,this),Oa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Oa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ya(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Fa=Phaser.Utils.Objects.GetValue;class Ia extends wa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Fa(e,"color",null),Fa(e,"color2",null),Fa(e,"horizontalGradient",!0)),this.setStroke(Fa(e,"stroke",null),Fa(e,"strokeThickness",2))}set color(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ta(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Fa(t,"color2",null),Fa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Wa=Phaser.Utils.Objects.GetValue;class ja{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Wa(t,"bold",!1)),this.setItalic(Wa(t,"italic",!1)),this.setFontSize(Wa(t,"fontSize","16px")),this.setFontFamily(Wa(t,"fontFamily","Courier")),this.setColor(Wa(t,"color","#fff")),this.setStrokeStyle(Wa(t,"stroke",null),Wa(t,"strokeThickness",0)),this.setShadow(Wa(t,"shadowColor",null),Wa(t,"shadowOffsetX",0),Wa(t,"shadowOffsetY",0),Wa(t,"shadowBlur",0)),this.setOffset(Wa(t,"offsetX",0),Wa(t,"offsetY",0)),this.setSpace(Wa(t,"leftSpace",0),Wa(t,"rightSpace",0)),this.setAlign(Wa(t,"align",void 0)),this.setBackgroundColor(Wa(t,"backgroundColor",null)),this.setBackgroundHeight(Wa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Wa(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Wa(t,"backgroundLeftX",0)),this.setBackgroundRightX(Wa(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Oa("stroke",t,this),Oa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Oa("shadowOffsetX",t,this),Oa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new ja(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ta(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ta(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ta(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ta(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ba=Phaser.Utils.Array.Remove,Ha=Phaser.Utils.Array.Remove,Na="text",Ua="image",Ga="drawer",Va="space",Ja="command";var $a=function(t){return t.type===Na&&"\n"===t.text},qa=function(t){return t.type===Na&&"\f"===t.text},Za=function(t){return t.type===Na};class Ka extends wa{constructor(t,e,i){super(t,Na),this.updateTextFlag=!1,this.style=new ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Qa=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const to=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class eo extends wa{constructor(t,e,i){super(t,Ua),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=to.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),to.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class io extends wa{constructor(t,e,i,s){super(t,Ga),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class so extends wa{constructor(t,e){super(t,Va),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class ro extends ia{constructor(t,e,i,s,r){super(t,Ja),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function no(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>no(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=no(t[i]));return e}var ho=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const ao={none:0,word:1,char:2,character:2,mix:3};var oo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=po.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=po.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=go(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=go(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=go(t,"wrapMode");void 0===c&&(c=go(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=ao[c]);var u=go(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=go(t,"letterSpacing",0),v=go(t,"hAlign",0),g=go(t,"vAlign",0),f=go(t,"justifyPercentage",.25),m=ho({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var W=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=yo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=yo(t,"maxLines",0);var a=0===i,o=yo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=yo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=yo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=yo(t,"letterSpacing",0),p=yo(t,"rtl",!0),v=yo(t,"hAlign",p?2:0),g=yo(t,"vAlign",0),f=ho({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Me(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ba(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ha(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Na);return null===i?i=new Ka(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ma(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ho=Phaser.Utils.Objects.GetFastValue;var No={};class Uo{constructor(t){this.pools=Ho(t,"pools",No)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Bo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Qo(t,r,e,i,n),a=0;a<=qo&&0!==h;a++){if((r+=h)<0){r=0;break}h=Qo(t,r,e,i,n)}return a===qo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),tl(t,e,i),t},Ko=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Qo=function(t,e,i,s,r){var n,h=Ko(t,e,r),a=Ko(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},tl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const el=Phaser.Utils.Objects.GetValue,il=Phaser.Utils.Objects.GetValue;class sl extends _h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=il(e,"background",void 0),r=il(e,"icon",void 0),n=il(e,"iconMask",void 0),h=il(e,"text",void 0),a=il(e,"action",void 0),o=il(e,"actionMask",void 0),l=il(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:il(e,"space.icon",0),top:il(e,"space.iconTop",0),bottom:il(e,"space.iconBottom",0),left:il(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:il(e,"space.icon",0),left:il(e,"space.iconLeft",0),right:il(e,"space.iconRight",0),top:il(e,"space.iconTop",0)});var d=il(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Lh.call(this,r,r,1)),!d){var c=il(e,"iconSize",void 0);this.setIconSize(il(e,"iconWidth",c),il(e,"iconHeight",c))}}if(h){var u=il(e,"wrapText",!1),p=il(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Nh(h,u),e.expandTextWidth=!0,$o(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=el(e,"minWidth",0),s=el(e,"minHeight",0),r=el(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Zo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Zo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=il(e,"space.text",0),m=il(e,"expandTextWidth",!1),y=il(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:il(e,"space.actionTop",0),bottom:il(e,"space.actionBottom",0),right:il(e,"space.actionRight",0)}:{left:il(e,"space.actionLeft",0),right:il(e,"space.actionRight",0),bottom:il(e,"space.actionBottom",0)},d=il(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Lh.call(this,a,a,1)),!d)){var b=il(e,"actionSize");this.setActionSize(il(e,"actionWidth",b),il(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var rl=function(t,e){t.popUp(e)},nl=function(t,e){t.scaleDown(e)},hl=function(t,e){t.fadeIn(e)},al=function(t,e){t.fadeOut(e)};const ol={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ll={setDisplayTime(t){return this.displayTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInTime(t){return this.transitInTime=t,this},setTransitInCallback(t){switch("string"==typeof t&&(t=ol[t]),t){case ol.popUp:t=rl;break;case ol.fadeIn:t=hl}return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){switch("string"==typeof t&&(t=ol[t]),t){case ol.scaleDown:t=nl;break;case ol.fadeOut:t=al}return t||(t=At),this.transitOutCallback=t,this}},dl={showMessage(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift()}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[0,[this.emit,"transitin",this,this.transitInTime]],[this.transitInTime,[At]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[0,[this.emit,"transitout",this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[At]]];return this.player.load(e,this).once("complete",(function(){this.showMessage()}),this).start(),this},removeAllMessages(){return this.messages.length=0,this}};const cl=Phaser.Utils.Objects.GetValue;class ul extends hi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.isRunning=cl(t,"isRunning",!1),this.timeScale=cl(t,"timeScale",1),this.now=cl(t,"now",0),this}toJSON(){return{isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}start(t){return void 0===t&&(t=0),this.delta=0,this.now=t,super.start(),this}seek(t){return this.now=t,this}setTimeScale(t){return this.timeScale=t,this}tick(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}class pl extends ul{startTicking(){super.startTicking(),this.scene.sys.events.on("update",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&this.scene.sys.events.off("update",this.update,this)}update(t,e){return this.isRunning&&0!==this.timeScale?(this.tick(e),this):this}}var vl=function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=e.length),t.length=s-i;for(var r=0,n=t.length;r=0;n--)s=yl(t[n],e,i);else for(var n=0,h=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(or(s)||(s=vl(Sl,i,1)),yl(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=Ol[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=Tl[t]),this.timeUnit=t,this}}var Sl=[];const Tl={ms:0,s:1,sec:1},Ol={abs:0,absolute:0,inc:1,increment:1},Pl=Phaser.Utils.Objects.GetValue;class kl extends sl{constructor(t,e){void 0===e&&(e={text:createDefaultTextObject(t)}),super(t,e),this.type="rexToast",this.setTransitInTime(Pl(e,"duration.in",200)),this.setDisplayTime(Pl(e,"duration.hold",1200)),this.setTransitOutTime(Pl(e,"duration.out",200)),this.setTransitInCallback(Pl(e,"transitIn",ol.popUp)),this.setTransitOutCallback(Pl(e,"transitOut",ol.scaleDown)),this.player=new wl(this,{dtMode:1}),this.messages=[],this.scaleX0=void 0,this.scaleY0=void 0,this.setVisible(!1)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,super.destroy(t))}setScale(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,super.setScale(t,e),this}get isShowingMessage(){return this.player.isPlaying}}return Object.assign(kl.prototype,ll,dl),kl},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextoast=e(); diff --git a/dist/rextrees.js b/dist/rextrees.js index faf140e337..865d1dd0c5 100644 --- a/dist/rextrees.js +++ b/dist/rextrees.js @@ -21572,6 +21572,8 @@ this.setBackgroundColor(GetValue$B(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$B(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$B(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$B(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$B(o, 'backgroundRightX', 0)); return this; } @@ -21642,6 +21644,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -21796,6 +21804,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -22223,20 +22241,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, diff --git a/dist/rextrees.min.js b/dist/rextrees.min.js index 43b36bc148..196f6143fe 100644 --- a/dist/rextrees.min.js +++ b/dist/rextrees.min.js @@ -1,6 +1,6 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new ki(t,h):r.resetFromJSON(h),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new ki(t,a):n.resetFromJSON(a),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new ki(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,a):s.resetFromJSON(a),s.restart(),s},Ni=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends hi{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ds,As,Ys,zs);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Xs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),a=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Zs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class an extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=bn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(Wn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(Wn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},zr.call(t,e),jr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(a=oe(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ha=Phaser.Utils.Objects.IsPlainObject,oa=Phaser.Utils.Objects.GetValue,la=Phaser.Display.Align.CENTER,da={min:0,full:-1};var ca=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=da[e];else if(ha(e)){var f;e=oa(f=e,"proportion",void 0),i=oa(f,"align",la),s=oa(f,"padding",0),r=oa(f,"expand",!1),n=oa(f,"key",void 0),a=oa(f,"index",void 0),t.isRexSizer||(h=oa(f,"minWidth",void 0),o=oa(f,"minHeight",void 0)),l=oa(f,"fitRatio",0),d=oa(f,"offsetX",0),c=oa(f,"offsetY",0),u=oa(f,"offsetOriginX",0),p=oa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=la),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ua={add:ca,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ca.call(this,new na(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ha(i)&&(i.index=t),ca.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=aa.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const pa=Et.prototype.clear;var va=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),pa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,va.call(this,t),this}},ma={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ya={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ba={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},xa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sa.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sa.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(wa,ua,fa,ma,ya,ba,xa);var Sa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ca={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Oa=function(t){return"string"==typeof t&&(t=Ca[t]),t};const Pa=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Ta extends ta{constructor(t,e,i,s,r,n,a){Pa(e)?(e=_a(a=e,"x",0),i=_a(a,"y",0),s=_a(a,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Pa(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Pa(n)&&(n=_a(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(_a(a,"space.item",0)),this.setStartChildIndex(_a(a,"startChildIndex",0)),this.setRTL(_a(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Oa(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sa.call(this)),this._childrenProportion}}Object.assign(Ta.prototype,wa);var ka=function(t){return class extends t{get isTree(){return!1}get isNode(){return!1}setText(t){return this.text=t,this}get text(){return this.nodeBody.text}set text(t){var e=this.nodeBody;e.setText&&e.setText(t)}setTexture(t,e){var i=this.nodeBody;return i.setTexture&&i.setTexture(t,e),this}get texture(){var t=this.nodeBody;if(t)return t.texture}get frame(){var t=this.nodeBody;if(t)return t.frame}}};class Ea extends js{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ma={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Ra=function(t,e){zi.popUp.call(t,e,this.expandDirection)},La=function(t,e){zi.scaleDown.call(t,e,this.expandDirection)},Da={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Ra.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=La.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Aa=Phaser.Utils.Objects.GetValue;class Ya extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=Aa(e,"space"),a=1===this.orientation?"left":"top",h=Aa(e,"align.title",a),o=Aa(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:Aa(n,"titleLeft",0),right:Aa(n,"titleRight",0),top:Aa(n,"titleTop",0),bottom:Aa(n,"titleBottom",0)}});var l=Aa(e,"toggleByTarget",void 0),d=Aa(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&xr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Ea(r),!Aa(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=Aa(e,"align.child","left");var u=(o=Aa(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:Aa(n,"childLeft",0),right:Aa(n,"childRight",0),top:Aa(n,"childTop",0),bottom:Aa(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Aa(p,"duration",200)),this.setExpandCallback(Aa(p,"expandCallback",void 0)),this.setCollapseCallback(Aa(p,"collapseCallback",void 0)),this.reLayoutTarget=Aa(e,"reLayoutTarget",void 0);var v=e.onExpandStart;v&&this.on("expand.start",v);var g=e.onExpandComplete;g&&this.on("expand.complete",g);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=Aa(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Ya.prototype,Ma,Da);var za={getTreePatent(t){if(void 0===t&&(t=this),t.rexSizer)return t.rexSizer.treeParent},getTreeRoot(t){var e;for(void 0===t&&(t=this);;){if(!t.rexSizer)return;if(null===(e=t.rexSizer.treeParent))return t;t=e}},getTreesSizer(t){var e=this.getTreeRoot(t);return e?e.getParentSizer():null},isGrandsonNode(t){if(void 0===t||!t.rexSizer)return!1;for(var e;;){if(!t.rexSizer)return!1;if((e=t.rexSizer.treeParent)===this)return!0;if(null===e)return!1;t=e}return!1}},Xa=function(t,e,i,s,r=!1){var n;return bt(e)?(n=e,delete e[key]):ir(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Wa=Phaser.Renderer.WebGL.Utils,ja=function(t,e,i,s,r,n){for(var a=Wa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Na=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ga=Phaser.Renderer.Canvas.SetTransform;var Va={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ba(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&ja(r,a,e,l,h,o),e.isStroked&&Ia(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ga(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign($a.prototype,Va);const Ja=Phaser.Utils.Objects.GetValue;let Ka=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ja(t,"x",0),i=Ja(t,"y",0));var s=this.cornerRadius;s.tl=qa(Ja(t,"tl",void 0),e,i),s.tr=qa(Ja(t,"tr",void 0),e,i),s.bl=qa(Ja(t,"bl",void 0),e,i),s.br=qa(Ja(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Za(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Za(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Za(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Za(this.cornerRadius.br,t)}};var qa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Qa(t),t},Za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ja(e,"x",0),t.y=Ja(e,"y",0)),Qa(t)},Qa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},th=function(t){return t.x>0&&t.y>0},eh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ih=Phaser.Math.DegToRad;var sh=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const ro=Phaser.Utils.Objects.GetValue,no=Phaser.Utils.Objects.IsPlainObject;class ao extends(Mh(Sh)){constructor(t,e,i,s,r,n,a,h){no(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):no(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):no(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new io).setName("trackFill")).addShape((new io).setName("bar")).addShape((new io).setName("trackStroke")),this.setTrackColor(ro(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ro(h,"trackStrokeThickness",2),ro(h,"trackStrokeColor",void 0)),this.setSkewX(ro(h,"skewX",0)),this.setRTL(ro(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ho={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&so(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),so(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&so(h,0,0,e,i,t)}};Object.assign(ao.prototype,ho);var oo=function(t){return null==t||""===t||0===t.length},lo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(oo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(oo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nko(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ko(t[i]));return e}const Eo=Phaser.Utils.Objects.IsPlainObject,Mo=Phaser.Utils.Objects.GetValue;var Ro=function(t){return"string"==typeof t&&(t=Lo[t]),t};const Lo={scale:0,repeat:1};var Do=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ao={_beginDraw:Xt,_drawImage:Xt,_drawTileSprite:Xt,_endDraw:Xt,setGetFrameNameCallback:function(t){return void 0===t&&(t=To),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=ko(i),s=ko(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Eo(t)?(this.stretchMode.edge=Ro(Mo(t,"edge",0)),this.stretchMode.internal=Ro(Mo(t,"internal",0))):(t=Ro(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Do.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Yo=Phaser.Utils.Objects.IsPlainObject,zo=Phaser.Utils.Objects.GetValue,Xo=Phaser.GameObjects;var Wo=void 0,jo=function(t,e){if(Wo||(Wo={},ti(t).events.once("destroy",(function(){for(var t in Wo)Wo[t].destroy();Wo=void 0}))),!Wo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new Xo[e](i)).setOrigin(0),Wo[e]=t}return Wo[e]};const Fo=Phaser.GameObjects.RenderTexture;class Io extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Yo(i)?(i=zo(d=i,"x",0),s=zo(d,"y",0),r=zo(d,"width",1),n=zo(d,"height",1),a=zo(d,"key",void 0),h=zo(d,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Yo(r)?(r=zo(d=r,"width",1),n=zo(d,"height",1),a=zo(d,"key",void 0),h=zo(d,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Yo(a)?(a=zo(d=a,"key",void 0),h=zo(d,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Yo(h)?(h=zo(d=h,"baseFrame",void 0),o=zo(d,"columns",void 0),l=zo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=zo(d,"baseFrame",void 0)):Yo(o)&&(o=zo(d=o,"columns",void 0),l=zo(d,"rows",void 0)),void 0===h&&(h=zo(d,"frame",void 0)),void 0===o){var c=zo(d,"leftWidth",void 0),u=zo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=zo(d,"topHeight",void 0),v=zo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(zo(d,"getFrameNameCallback",void 0)),this.setStretchMode(zo(d,"stretchMode",0)),this.setPreserveRatio(zo(d,"preserveRatio",!0));var g=zo(d,"maxFixedPartScale",1),f=zo(d,"maxFixedPartScaleX",g),m=zo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ao),i}(Fo,"rexNinePatch")){}var Bo={_drawImage:function(t,e,i,s,r,n){var a=jo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=jo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Io.prototype,Bo);let Ho=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(po(t,e))return t[e];var i=t.parent;return po(i,e)?i[e]:void 0}set(t,e,i){return po(t,e)?t[e]=i:po(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const No=Phaser.Utils.Objects.GetValue;class Go extends Io{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=No(e,"effects",!0);i&&yo(this,i),this.style=new Ho(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Go.prototype,vh);const Vo=["alpha","tint","flipX","flipY"];var Uo=function(t,e){if(!e)return t;for(var i=0,s=Vo.length;i0&&r.push(o.join("")),r},vl=0,gl=1,fl=2,ml=0,yl=1,bl=2,xl=/(?:\r\n|\r|\n)/;const wl={none:ml,word:yl,char:bl,character:bl,mix:3},Sl=Phaser.Renderer.WebGL.Utils;var Cl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Sl.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Ol=Phaser.Display.Color;var Pl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Ol);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},_l=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},Tl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,_l(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const kl=Phaser.Display.Canvas.CanvasPool,El=Phaser.GameObjects.GameObject,Ml=Phaser.Utils.String.UUID;class Rl extends El{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=kl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Ml(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){kl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Ll=Phaser.GameObjects.Components;Phaser.Class.mixin(Rl,[Ll.Alpha,Ll.BlendMode,Ll.Crop,Ll.Depth,Ll.Flip,Ll.GetBounds,Ll.Mask,Ll.Origin,Ll.Pipeline,Ll.PostPipeline,Ll.ScrollFactor,Ll.Tint,Ll.Transform,Ll.Visible,Cl,Pl,Tl]);class Dl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Dl.prototype,Lh);var Al={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Yl=Phaser.Math.RotateAround;var zl;const Xl=Phaser.Geom.Rectangle;var Wl,jl=function(t){void 0===Wl&&(Wl=new Xl);var e=t.drawTLX,i=t.drawTLY;return Wl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Wl};const Fl=Phaser.Math.RotateAround;var Il,Bl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Il&&(Il={}),s=Il),s.x=e,s.y=i,0!==t.rotation&&Fl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Hl=Phaser.GameObjects.Components.TransformMatrix;var Nl,Gl,Vl={},Ul=function(t,e,i,s,r){var n=Bl(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Vl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Nl&&(Nl=new Hl,Gl=new Hl),t.parentContainer?t.getWorldTransformMatrix(Nl,Gl):Nl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Nl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},$l=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Ul(t,e,n,a,r)},Jl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===zl&&(zl={}),s=zl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Yl(s,0,0,-i.rotation),s}(t,e,this,!0);return jl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return $l(this.parent,this,t,e,i)}};Object.assign(Jl,Al);const Kl=Phaser.Math.DegToRad,ql=Phaser.Math.RadToDeg,Zl=Phaser.Utils.Objects.GetValue;class Ql extends Dl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ql(this._rotation)}set angle(t){this.rotation=Kl(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Zl(t,"width",void 0),i=Zl(t,"height",void 0),s=Zl(t,"scaleX",void 0),r=Zl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ql.prototype,Jl);const td=Phaser.Utils.String.Pad;var ed=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${td(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},id=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const sd=Phaser.Math.DegToRad;var rd=function(t){return!t.hasOwnProperty("convex")||t.convex},nd=function(t){return t.x>0&&t.y>0},ad=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,nd(h)?(o=h.x*g,l=h.y*f,rd(h)?ad(t,o,l,o,l,180,270,!1,a):ad(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,nd(h)?(o=h.x*g,l=h.y*f,rd(h)?ad(t,s-o,l,o,l,270,360,!1,a):ad(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,nd(h)?(o=h.x*g,l=h.y*f,rd(h)?ad(t,s-o,r-l,o,l,0,90,!1,a):ad(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,nd(h)?(o=h.x*g,l=h.y*f,rd(h)?ad(t,o,r-l,o,l,90,180,!1,a):ad(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},od=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),hd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const ld=Phaser.Utils.Objects.GetValue;class dd extends Ql{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ld(e,"color",null),ld(e,"color2",null),ld(e,"horizontalGradient",!0)),this.setStroke(ld(e,"stroke",null),ld(e,"strokeThickness",2)),this.setCornerRadius(ld(e,"cornerRadius",0),ld(e,"cornerIteration",null))}set color(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ed(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,id("color2",t,this),id("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,id("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,id("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){od(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const cd=Phaser.Utils.Objects.GetValue;class ud extends Ql{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(cd(e,"color",null),cd(e,"color2",null),cd(e,"horizontalGradient",!0)),this.setStroke(cd(e,"stroke",null),cd(e,"strokeThickness",2))}set color(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ed(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,cd(t,"color2",null),cd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,cd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const pd=Phaser.Utils.Objects.GetValue;let vd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(pd(t,"bold",!1)),this.setItalic(pd(t,"italic",!1)),this.setFontSize(pd(t,"fontSize","16px")),this.setFontFamily(pd(t,"fontFamily","Courier")),this.setColor(pd(t,"color","#fff")),this.setStrokeStyle(pd(t,"stroke",null),pd(t,"strokeThickness",0)),this.setShadow(pd(t,"shadowColor",null),pd(t,"shadowOffsetX",0),pd(t,"shadowOffsetY",0),pd(t,"shadowBlur",0)),this.setOffset(pd(t,"offsetX",0),pd(t,"offsetY",0)),this.setSpace(pd(t,"leftSpace",0),pd(t,"rightSpace",0)),this.setAlign(pd(t,"align",void 0)),this.setBackgroundColor(pd(t,"backgroundColor",null)),this.setBackgroundHeight(pd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(pd(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(id("stroke",t,this),id("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(id("shadowOffsetX",t,this),id("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ed(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ed(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ed(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ed(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const gd=Phaser.Utils.Array.Remove,fd=Phaser.Utils.Array.Remove,md="text",yd="image",bd="drawer",xd="space",wd="command";var Sd=function(t){return t.type===md&&"\n"===t.text},Cd=function(t){return t.type===md&&"\f"===t.text},Od=function(t){return t.type===md};class Pd extends Ql{constructor(t,e,i){super(t,md),this.updateTextFlag=!1,this.style=new vd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var h=e.hasFill,o=e.hasStroke;(h||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var _d=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Td=Phaser.Display.Canvas.CanvasPool;var kd=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Td.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Td.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Ed extends Ql{constructor(t,e,i){super(t,yd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){kd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Md extends Ql{constructor(t,e,i,s){super(t,bd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Rd extends Ql{constructor(t,e){super(t,xd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Ld extends Dl{constructor(t,e,i,s,r){super(t,wd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Dd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ad={none:0,word:1,char:2,character:2,mix:3};var Yd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=jd.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=jd.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Id(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Id(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Id(t,"wrapMode");void 0===c&&(c=Id(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ad[c]);var u=Id(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Id(t,"letterSpacing",0),v=Id(t,"hAlign",0),g=Id(t,"vAlign",0),f=Id(t,"justifyPercentage",.25),m=Dd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Nd(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Nd(t,"maxLines",0);var h=0===i,o=Nd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Nd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Nd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Nd(t,"letterSpacing",0),p=Nd(t,"rtl",!0),v=Nd(t,"hAlign",p?2:0),g=Nd(t,"vAlign",0),f=Dd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),gd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return fd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(md);return null===i?i=new Pd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),$l(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const gc=Phaser.Utils.Objects.GetFastValue;var fc={};class mc{constructor(t){this.pools=gc(t,"pools",fc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new vc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Pc(t,r,e,i,n),h=0;h<=Sc&&0!==a;h++){if((r+=a)<0){r=0;break}a=Pc(t,r,e,i,n)}return h===Sc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),_c(t,e,i),t},Oc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Pc=function(t,e,i,s,r){var n,a=Oc(t,e,r),h=Oc(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},_c=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Tc=Phaser.Utils.Objects.GetValue,kc=Phaser.Utils.Objects.GetValue;class Ec extends Qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=kc(e,"background",void 0),r=kc(e,"icon",void 0),n=kc(e,"iconMask",void 0),a=kc(e,"text",void 0),h=kc(e,"action",void 0),o=kc(e,"actionMask",void 0),l=kc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:kc(e,"space.icon",0),top:kc(e,"space.iconTop",0),bottom:kc(e,"space.iconBottom",0),left:kc(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:kc(e,"space.icon",0),left:kc(e,"space.iconLeft",0),right:kc(e,"space.iconRight",0),top:kc(e,"space.iconTop",0)});var d=kc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=rl.call(this,r,r,1)),!d){var c=kc(e,"iconSize",void 0);this.setIconSize(kc(e,"iconWidth",c),kc(e,"iconHeight",c))}}if(a){var u=kc(e,"wrapText",!1),p=kc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ll(t)){case 0:switch("string"==typeof e&&(e=wl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ul;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=wl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,wc(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Tc(e,"minWidth",0),s=Tc(e,"minHeight",0),r=Tc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Cc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Cc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=kc(e,"space.text",0),m=kc(e,"expandTextWidth",!1),y=kc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,h&&(i={right:f}),g=y):(v=y?1:0,h&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(h&&(i=0===this.orientation?{top:kc(e,"space.actionTop",0),bottom:kc(e,"space.actionBottom",0),right:kc(e,"space.actionRight",0)}:{left:kc(e,"space.actionLeft",0),right:kc(e,"space.actionRight",0),bottom:kc(e,"space.actionBottom",0)},d=kc(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=rl.call(this,h,h,1)),!d)){var b=kc(e,"actionSize");this.setActionSize(kc(e,"actionWidth",b),kc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}const Mc=Phaser.GameObjects.Text,Rc=Phaser.Utils.Objects.GetValue;class Lc extends Mc{constructor(t,e){void 0===e&&(e={}),super(t,Rc(e,"x",0),Rc(e,"y",0),Rc(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Lc.prototype,vh);var Dc=Phaser.Renderer.WebGL.Utils,Ac={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Dc.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.style.resolution,a/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Yc=Phaser.Display.Canvas.CanvasPool;e();const zc=Phaser.GameObjects.GameObject;class Xc extends zc{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Yc.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),h=a,o=2*h;if(h=h*t.baselineY|0,s.width=a,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,a,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,h),i.left=0,0===a||0===o||!r.getImageData(0,0,a,o))return Yc.remove(s),i;for(var l=r.getImageData(0,0,a,o).data,d=!1,c=0;c=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new ki(t,h):r.resetFromJSON(h),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new ki(t,a):n.resetFromJSON(a),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new ki(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,a):s.resetFromJSON(a),s.restart(),s},Ni=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends hi{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ds,As,Ys,Xs);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,zs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),a=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Zs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class an extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=bn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Wn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(Wn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),jr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(a=oe(o,"align","left-top"))&&(a=Xt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ha=Phaser.Utils.Objects.IsPlainObject,oa=Phaser.Utils.Objects.GetValue,la=Phaser.Display.Align.CENTER,da={min:0,full:-1};var ca=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=da[e];else if(ha(e)){var f;e=oa(f=e,"proportion",void 0),i=oa(f,"align",la),s=oa(f,"padding",0),r=oa(f,"expand",!1),n=oa(f,"key",void 0),a=oa(f,"index",void 0),t.isRexSizer||(h=oa(f,"minWidth",void 0),o=oa(f,"minHeight",void 0)),l=oa(f,"fitRatio",0),d=oa(f,"offsetX",0),c=oa(f,"offsetY",0),u=oa(f,"offsetOriginX",0),p=oa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=la),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ua={add:ca,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ca.call(this,new na(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ha(i)&&(i.index=t),ca.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=aa.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const pa=Et.prototype.clear;var va=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),pa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,va.call(this,t),this}},ma={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},ya={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ba={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},xa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sa.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sa.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(wa,ua,fa,ma,ya,ba,xa);var Sa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ca={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Oa=function(t){return"string"==typeof t&&(t=Ca[t]),t};const Pa=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Ta extends ta{constructor(t,e,i,s,r,n,a){Pa(e)?(e=_a(a=e,"x",0),i=_a(a,"y",0),s=_a(a,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Pa(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Pa(n)&&(n=_a(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(_a(a,"space.item",0)),this.setStartChildIndex(_a(a,"startChildIndex",0)),this.setRTL(_a(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Oa(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sa.call(this)),this._childrenProportion}}Object.assign(Ta.prototype,wa);var ka=function(t){return class extends t{get isTree(){return!1}get isNode(){return!1}setText(t){return this.text=t,this}get text(){return this.nodeBody.text}set text(t){var e=this.nodeBody;e.setText&&e.setText(t)}setTexture(t,e){var i=this.nodeBody;return i.setTexture&&i.setTexture(t,e),this}get texture(){var t=this.nodeBody;if(t)return t.texture}get frame(){var t=this.nodeBody;if(t)return t.frame}}};class Ea extends js{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ma={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Ra=function(t,e){Xi.popUp.call(t,e,this.expandDirection)},La=function(t,e){Xi.scaleDown.call(t,e,this.expandDirection)},Da={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Ra.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=La.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Aa=Phaser.Utils.Objects.GetValue;class Ya extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=Aa(e,"space"),a=1===this.orientation?"left":"top",h=Aa(e,"align.title",a),o=Aa(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:Aa(n,"titleLeft",0),right:Aa(n,"titleRight",0),top:Aa(n,"titleTop",0),bottom:Aa(n,"titleBottom",0)}});var l=Aa(e,"toggleByTarget",void 0),d=Aa(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&xr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Ea(r),!Aa(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=Aa(e,"align.child","left");var u=(o=Aa(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:Aa(n,"childLeft",0),right:Aa(n,"childRight",0),top:Aa(n,"childTop",0),bottom:Aa(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Aa(p,"duration",200)),this.setExpandCallback(Aa(p,"expandCallback",void 0)),this.setCollapseCallback(Aa(p,"collapseCallback",void 0)),this.reLayoutTarget=Aa(e,"reLayoutTarget",void 0);var v=e.onExpandStart;v&&this.on("expand.start",v);var g=e.onExpandComplete;g&&this.on("expand.complete",g);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=Aa(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Ya.prototype,Ma,Da);var Xa={getTreePatent(t){if(void 0===t&&(t=this),t.rexSizer)return t.rexSizer.treeParent},getTreeRoot(t){var e;for(void 0===t&&(t=this);;){if(!t.rexSizer)return;if(null===(e=t.rexSizer.treeParent))return t;t=e}},getTreesSizer(t){var e=this.getTreeRoot(t);return e?e.getParentSizer():null},isGrandsonNode(t){if(void 0===t||!t.rexSizer)return!1;for(var e;;){if(!t.rexSizer)return!1;if((e=t.rexSizer.treeParent)===this)return!0;if(null===e)return!1;t=e}return!1}},za=function(t,e,i,s,r=!1){var n;return bt(e)?(n=e,delete e[key]):ir(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Wa=Phaser.Renderer.WebGL.Utils,ja=function(t,e,i,s,r,n){for(var a=Wa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Na=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ga=Phaser.Renderer.Canvas.SetTransform;var Va={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ba(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&ja(r,a,e,l,h,o),e.isStroked&&Ia(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ga(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign($a.prototype,Va);const Ja=Phaser.Utils.Objects.GetValue;let Ka=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ja(t,"x",0),i=Ja(t,"y",0));var s=this.cornerRadius;s.tl=qa(Ja(t,"tl",void 0),e,i),s.tr=qa(Ja(t,"tr",void 0),e,i),s.bl=qa(Ja(t,"bl",void 0),e,i),s.br=qa(Ja(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Za(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Za(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Za(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Za(this.cornerRadius.br,t)}};var qa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Qa(t),t},Za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ja(e,"x",0),t.y=Ja(e,"y",0)),Qa(t)},Qa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},th=function(t){return t.x>0&&t.y>0},eh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ih=Phaser.Math.DegToRad;var sh=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const ro=Phaser.Utils.Objects.GetValue,no=Phaser.Utils.Objects.IsPlainObject;class ao extends(Mh(Sh)){constructor(t,e,i,s,r,n,a,h){no(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):no(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):no(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new io).setName("trackFill")).addShape((new io).setName("bar")).addShape((new io).setName("trackStroke")),this.setTrackColor(ro(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ro(h,"trackStrokeThickness",2),ro(h,"trackStrokeColor",void 0)),this.setSkewX(ro(h,"skewX",0)),this.setRTL(ro(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ho={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&so(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),so(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&so(h,0,0,e,i,t)}};Object.assign(ao.prototype,ho);var oo=function(t){return null==t||""===t||0===t.length},lo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(oo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(oo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nko(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ko(t[i]));return e}const Eo=Phaser.Utils.Objects.IsPlainObject,Mo=Phaser.Utils.Objects.GetValue;var Ro=function(t){return"string"==typeof t&&(t=Lo[t]),t};const Lo={scale:0,repeat:1};var Do=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ao={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=To),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=ko(i),s=ko(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Eo(t)?(this.stretchMode.edge=Ro(Mo(t,"edge",0)),this.stretchMode.internal=Ro(Mo(t,"internal",0))):(t=Ro(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Do.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Yo=Phaser.Utils.Objects.IsPlainObject,Xo=Phaser.Utils.Objects.GetValue,zo=Phaser.GameObjects;var Wo=void 0,jo=function(t,e){if(Wo||(Wo={},ti(t).events.once("destroy",(function(){for(var t in Wo)Wo[t].destroy();Wo=void 0}))),!Wo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new zo[e](i)).setOrigin(0),Wo[e]=t}return Wo[e]};const Fo=Phaser.GameObjects.RenderTexture;class Io extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Yo(i)?(i=Xo(d=i,"x",0),s=Xo(d,"y",0),r=Xo(d,"width",1),n=Xo(d,"height",1),a=Xo(d,"key",void 0),h=Xo(d,"baseFrame",void 0),o=Xo(d,"columns",void 0),l=Xo(d,"rows",void 0)):Yo(r)?(r=Xo(d=r,"width",1),n=Xo(d,"height",1),a=Xo(d,"key",void 0),h=Xo(d,"baseFrame",void 0),o=Xo(d,"columns",void 0),l=Xo(d,"rows",void 0)):Yo(a)?(a=Xo(d=a,"key",void 0),h=Xo(d,"baseFrame",void 0),o=Xo(d,"columns",void 0),l=Xo(d,"rows",void 0)):Yo(h)?(h=Xo(d=h,"baseFrame",void 0),o=Xo(d,"columns",void 0),l=Xo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Xo(d,"baseFrame",void 0)):Yo(o)&&(o=Xo(d=o,"columns",void 0),l=Xo(d,"rows",void 0)),void 0===h&&(h=Xo(d,"frame",void 0)),void 0===o){var c=Xo(d,"leftWidth",void 0),u=Xo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Xo(d,"topHeight",void 0),v=Xo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Xo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Xo(d,"stretchMode",0)),this.setPreserveRatio(Xo(d,"preserveRatio",!0));var g=Xo(d,"maxFixedPartScale",1),f=Xo(d,"maxFixedPartScaleX",g),m=Xo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ao),i}(Fo,"rexNinePatch")){}var Bo={_drawImage:function(t,e,i,s,r,n){var a=jo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=jo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Io.prototype,Bo);let Ho=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(po(t,e))return t[e];var i=t.parent;return po(i,e)?i[e]:void 0}set(t,e,i){return po(t,e)?t[e]=i:po(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const No=Phaser.Utils.Objects.GetValue;class Go extends Io{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=No(e,"effects",!0);i&&yo(this,i),this.style=new Ho(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Go.prototype,vh);const Vo=["alpha","tint","flipX","flipY"];var Uo=function(t,e){if(!e)return t;for(var i=0,s=Vo.length;i0&&r.push(o.join("")),r},vl=0,gl=1,fl=2,ml=0,yl=1,bl=2,xl=/(?:\r\n|\r|\n)/;const wl={none:ml,word:yl,char:bl,character:bl,mix:3},Sl=Phaser.Renderer.WebGL.Utils;var Cl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Sl.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Ol=Phaser.Display.Color;var Pl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Ol);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},_l=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},Tl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,_l(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const kl=Phaser.Display.Canvas.CanvasPool,El=Phaser.GameObjects.GameObject,Ml=Phaser.Utils.String.UUID;class Rl extends El{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=kl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Ml(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){kl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Ll=Phaser.GameObjects.Components;Phaser.Class.mixin(Rl,[Ll.Alpha,Ll.BlendMode,Ll.Crop,Ll.Depth,Ll.Flip,Ll.GetBounds,Ll.Mask,Ll.Origin,Ll.Pipeline,Ll.PostPipeline,Ll.ScrollFactor,Ll.Tint,Ll.Transform,Ll.Visible,Cl,Pl,Tl]);class Dl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Dl.prototype,Lh);var Al={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Yl=Phaser.Math.RotateAround;var Xl;const zl=Phaser.Geom.Rectangle;var Wl,jl=function(t){void 0===Wl&&(Wl=new zl);var e=t.drawTLX,i=t.drawTLY;return Wl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Wl};const Fl=Phaser.Math.RotateAround;var Il,Bl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Il&&(Il={}),s=Il),s.x=e,s.y=i,0!==t.rotation&&Fl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Hl=Phaser.GameObjects.Components.TransformMatrix;var Nl,Gl,Vl={},Ul=function(t,e,i,s,r){var n=Bl(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Vl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Nl&&(Nl=new Hl,Gl=new Hl),t.parentContainer?t.getWorldTransformMatrix(Nl,Gl):Nl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Nl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},$l=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Ul(t,e,n,a,r)},Jl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Xl&&(Xl={}),s=Xl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Yl(s,0,0,-i.rotation),s}(t,e,this,!0);return jl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return $l(this.parent,this,t,e,i)}};Object.assign(Jl,Al);const Kl=Phaser.Math.DegToRad,ql=Phaser.Math.RadToDeg,Zl=Phaser.Utils.Objects.GetValue;class Ql extends Dl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ql(this._rotation)}set angle(t){this.rotation=Kl(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Zl(t,"width",void 0),i=Zl(t,"height",void 0),s=Zl(t,"scaleX",void 0),r=Zl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ql.prototype,Jl);const td=Phaser.Utils.String.Pad;var ed=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${td(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},id=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const sd=Phaser.Math.DegToRad;var rd=function(t){return!t.hasOwnProperty("convex")||t.convex},nd=function(t){return t.x>0&&t.y>0},ad=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,nd(h)?(o=h.x*g,l=h.y*f,rd(h)?ad(t,o,l,o,l,180,270,!1,a):ad(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,nd(h)?(o=h.x*g,l=h.y*f,rd(h)?ad(t,s-o,l,o,l,270,360,!1,a):ad(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,nd(h)?(o=h.x*g,l=h.y*f,rd(h)?ad(t,s-o,r-l,o,l,0,90,!1,a):ad(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,nd(h)?(o=h.x*g,l=h.y*f,rd(h)?ad(t,o,r-l,o,l,90,180,!1,a):ad(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},od=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),hd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const ld=Phaser.Utils.Objects.GetValue;class dd extends Ql{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ld(e,"color",null),ld(e,"color2",null),ld(e,"horizontalGradient",!0)),this.setStroke(ld(e,"stroke",null),ld(e,"strokeThickness",2)),this.setCornerRadius(ld(e,"cornerRadius",0),ld(e,"cornerIteration",null))}set color(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ed(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,id("color2",t,this),id("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,id("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,id("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){od(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const cd=Phaser.Utils.Objects.GetValue;class ud extends Ql{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(cd(e,"color",null),cd(e,"color2",null),cd(e,"horizontalGradient",!0)),this.setStroke(cd(e,"stroke",null),cd(e,"strokeThickness",2))}set color(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ed(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ed(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,cd(t,"color2",null),cd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,cd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const pd=Phaser.Utils.Objects.GetValue;let vd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(pd(t,"bold",!1)),this.setItalic(pd(t,"italic",!1)),this.setFontSize(pd(t,"fontSize","16px")),this.setFontFamily(pd(t,"fontFamily","Courier")),this.setColor(pd(t,"color","#fff")),this.setStrokeStyle(pd(t,"stroke",null),pd(t,"strokeThickness",0)),this.setShadow(pd(t,"shadowColor",null),pd(t,"shadowOffsetX",0),pd(t,"shadowOffsetY",0),pd(t,"shadowBlur",0)),this.setOffset(pd(t,"offsetX",0),pd(t,"offsetY",0)),this.setSpace(pd(t,"leftSpace",0),pd(t,"rightSpace",0)),this.setAlign(pd(t,"align",void 0)),this.setBackgroundColor(pd(t,"backgroundColor",null)),this.setBackgroundHeight(pd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(pd(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(pd(t,"backgroundLeftX",0)),this.setBackgroundRightX(pd(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(id("stroke",t,this),id("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(id("shadowOffsetX",t,this),id("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ed(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ed(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ed(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ed(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const gd=Phaser.Utils.Array.Remove,fd=Phaser.Utils.Array.Remove,md="text",yd="image",bd="drawer",xd="space",wd="command";var Sd=function(t){return t.type===md&&"\n"===t.text},Cd=function(t){return t.type===md&&"\f"===t.text},Od=function(t){return t.type===md};class Pd extends Ql{constructor(t,e,i){super(t,md),this.updateTextFlag=!1,this.style=new vd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var h=n-a;t.fillRect(s,h,r,a)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var _d=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Td=Phaser.Display.Canvas.CanvasPool;var kd=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Td.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Td.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Ed extends Ql{constructor(t,e,i){super(t,yd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){kd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Md extends Ql{constructor(t,e,i,s){super(t,bd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Rd extends Ql{constructor(t,e){super(t,xd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Ld extends Dl{constructor(t,e,i,s,r){super(t,wd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Dd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ad={none:0,word:1,char:2,character:2,mix:3};var Yd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=jd.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=jd.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Id(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Id(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Id(t,"wrapMode");void 0===c&&(c=Id(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ad[c]);var u=Id(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Id(t,"letterSpacing",0),v=Id(t,"hAlign",0),g=Id(t,"vAlign",0),f=Id(t,"justifyPercentage",.25),m=Dd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Nd(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Nd(t,"maxLines",0);var h=0===i,o=Nd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Nd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Nd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Nd(t,"letterSpacing",0),p=Nd(t,"rtl",!0),v=Nd(t,"hAlign",p?2:0),g=Nd(t,"vAlign",0),f=Dd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),gd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return fd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(md);return null===i?i=new Pd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),$l(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const gc=Phaser.Utils.Objects.GetFastValue;var fc={};class mc{constructor(t){this.pools=gc(t,"pools",fc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new vc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Pc(t,r,e,i,n),h=0;h<=Sc&&0!==a;h++){if((r+=a)<0){r=0;break}a=Pc(t,r,e,i,n)}return h===Sc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),_c(t,e,i),t},Oc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Pc=function(t,e,i,s,r){var n,a=Oc(t,e,r),h=Oc(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},_c=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Tc=Phaser.Utils.Objects.GetValue,kc=Phaser.Utils.Objects.GetValue;class Ec extends Qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=kc(e,"background",void 0),r=kc(e,"icon",void 0),n=kc(e,"iconMask",void 0),a=kc(e,"text",void 0),h=kc(e,"action",void 0),o=kc(e,"actionMask",void 0),l=kc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:kc(e,"space.icon",0),top:kc(e,"space.iconTop",0),bottom:kc(e,"space.iconBottom",0),left:kc(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:kc(e,"space.icon",0),left:kc(e,"space.iconLeft",0),right:kc(e,"space.iconRight",0),top:kc(e,"space.iconTop",0)});var d=kc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=rl.call(this,r,r,1)),!d){var c=kc(e,"iconSize",void 0);this.setIconSize(kc(e,"iconWidth",c),kc(e,"iconHeight",c))}}if(a){var u=kc(e,"wrapText",!1),p=kc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ll(t)){case 0:switch("string"==typeof e&&(e=wl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ul;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=wl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,wc(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Tc(e,"minWidth",0),s=Tc(e,"minHeight",0),r=Tc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Cc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Cc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=kc(e,"space.text",0),m=kc(e,"expandTextWidth",!1),y=kc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,h&&(i={right:f}),g=y):(v=y?1:0,h&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(h&&(i=0===this.orientation?{top:kc(e,"space.actionTop",0),bottom:kc(e,"space.actionBottom",0),right:kc(e,"space.actionRight",0)}:{left:kc(e,"space.actionLeft",0),right:kc(e,"space.actionRight",0),bottom:kc(e,"space.actionBottom",0)},d=kc(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=rl.call(this,h,h,1)),!d)){var b=kc(e,"actionSize");this.setActionSize(kc(e,"actionWidth",b),kc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}const Mc=Phaser.GameObjects.Text,Rc=Phaser.Utils.Objects.GetValue;class Lc extends Mc{constructor(t,e){void 0===e&&(e={}),super(t,Rc(e,"x",0),Rc(e,"y",0),Rc(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Lc.prototype,vh);var Dc=Phaser.Renderer.WebGL.Utils,Ac={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Dc.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.style.resolution,a/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Yc=Phaser.Display.Canvas.CanvasPool;e();const Xc=Phaser.GameObjects.GameObject;class zc extends Xc{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Yc.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),h=a,o=2*h;if(h=h*t.baselineY|0,s.width=a,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,a,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,h),i.left=0,0===a||0===o||!r.getImageData(0,0,a,o))return Yc.remove(s),i;for(var l=r.getImageData(0,0,a,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Fc=Phaser.Display.Canvas.CanvasPool;var Ic=function(t){var e=Fc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Fc.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,Fc.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,v=4*h,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==ml&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=wl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=Hc(t,l,d);else{var u=Bc(t,l,d);c&&(u=c(u)),this[h]=u}}var p=Hc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Hc(t,"fill",null);null!==v&&(this.color=ed(v));var g=Hc(t,"metrics",!1);return g?this.metrics={ascent:Hc(g,"ascent",0),descent:Hc(g,"descent",0),fontSize:Hc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ic(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Ic(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Hc(t,"fontFamily","Courier"),this.fontSize=Hc(t,"fontSize","16px"),this.fontStyle=Hc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ed(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ed(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ed(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ed(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ed(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ed(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ed(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=wl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Hc(e,"fontFamily",this.fontFamily),this.fontSize=Hc(e,"fontSize",this.fontSize),this.fontStyle=Hc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Gc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),od(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,v=a.valign,g=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Vc=Phaser.Utils.Objects.GetValue,Uc=vl,$c=gl;class Jc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Vc(t,"text",""),this.x=Vc(t,"x",0),this.y=Vc(t,"y",0),this.width=Vc(t,"width",0);var e=Vc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Vc(t,"newLineMode",0),this.startIndex=Vc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===$c&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Uc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===$c&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Kc=Phaser.Utils.Objects.GetFastValue,qc=vl,Zc=fl;class Qc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Kc(t,"tagToText",Xt),this.tagToTextScope=Kc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var tu={};const eu=Phaser.Geom.Rectangle;var iu=new vc;class su{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&mu(g)){""!==b?a.push(n.getLine(b,x,du)):0===w&&r>0&&a.push(n.getLine("",0,du)),a.push(...gu(g,e,pu,s,0,n));var C=a.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,du)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&a.push(n.getLine(b,x,l))}return a},fu=function(t,e){var i;switch(e){case uu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==bu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Qc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Pp(this.sizerChildren,null),va.call(this,t),this}},Tp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Pp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Rp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Pp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Pp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Dp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Ap=Phaser.Utils.Objects.IsPlainObject,Yp=Phaser.Utils.Objects.GetValue;class zp extends ta{constructor(t,e,i,s,r,n,a,h,o,l){Ap(e)?(e=Yp(l=e,"x",0),i=Yp(l,"y",0),s=Yp(l,"width",void 0),r=Yp(l,"height",void 0),n=Yp(l,"column",l.col||0),a=Yp(l,"row",0),h=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(s)?(s=Yp(l=s,"width",void 0),r=Yp(l,"height",void 0),n=Yp(l,"column",l.col||0),a=Yp(l,"row",0),h=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(n)?(n=Yp(l=n,"column",l.col||0),a=Yp(l,"row",0),h=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(h)&&(h=Yp(l=h,"columnProportions",0),o=Yp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Yp(l,"createCellContainerCallback")),this.setIndentLeft(Yp(l,"space.indentLeftOdd",0),Yp(l,"space.indentLeftEven",0)),this.setIndentTop(Yp(l,"space.indentTopOdd",0),Yp(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,Yp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Lp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Dp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(zp.prototype,Rp);const Xp=Phaser.Utils.Objects.GetValue,Wp=Phaser.Math.Percent;var jp=function(t,e,i){var s;return t.y===e.y?s=Wp(i.x,t.x,e.x):t.x===e.x&&(s=Wp(i.y,t.y,e.y)),s},Fp=function(t,e,i){var s,r;this.enable&&(Ip.x=e,Ip.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=jp(s,r,Ip))},Ip={},Bp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Hp.x=t.worldX,Hp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=jp(s,r,Hp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Hp={},Np=function(t,e){void 0===e&&(e=Gp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return he(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Gp={};const Vp=Phaser.Display.Align.LEFT_CENTER,Up=Phaser.Display.Align.TOP_CENTER;var $p={};const Jp=Phaser.Display.Align.RIGHT_CENTER,Kp=Phaser.Display.Align.BOTTOM_CENTER;var qp={};const Zp=Phaser.Math.Linear;var Qp={};const tv=Phaser.Display.Align.LEFT_CENTER,ev=Phaser.Display.Align.TOP_CENTER,iv=Phaser.Display.Align.RIGHT_CENTER,sv=Phaser.Display.Align.BOTTOM_CENTER,rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Utils.Objects.IsPlainObject,av=Phaser.Math.Clamp,hv=Phaser.Math.Snap.To;class ov extends(Mh(Ta)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=rv(e,"reverseAxis",!1);var i=rv(e,"background",void 0),s=rv(e,"track",void 0),r=rv(e,"indicator",void 0),n=rv(e,"thumb",void 0);if(i&&(nv(i)&&(i=$o(t,i)),this.addBackground(i)),s&&(nv(s)&&(s=$o(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(nv(r)&&(r=$o(t,r)),this.pin(r)),n){nv(n)&&(n=$o(t,n)),this.pin(n);var a=rv(e,"thumbOffsetX",0),h=rv(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=rv(e,"input",0);switch("string"==typeof o&&(o=lv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Fp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Bp,this).on("pointermove",Bp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(rv(e,"enable",void 0)),this.setGap(rv(e,"gap",void 0)),this.setValue(rv(e,"value",0),rv(e,"min",void 0),rv(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=hv(t,this.gap));var e=this._value;this._value=av(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const lv={pan:0,drag:0,click:1,none:-1};var dv={getStartPoint:function(t){if(void 0===t&&(t=$p),this.childrenMap.thumb){var e=0===this.orientation?Vp:Up;Np.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=qp),this.childrenMap.thumb){var e=0===this.orientation?Jp:Kp;Np.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Qp),s.x=Zp(e.x,i.x,t),s.y=Zp(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?iv:sv:0===this.orientation?tv:ev,ae(e,this,r),this.resetChildPositionState(e)}};Object.assign(ov.prototype,dv);const cv=Phaser.Utils.Objects.GetValue;class uv extends Ta{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=cv(e,"background",void 0),n=cv(e,"buttons",void 0),a=cv(n,"top",cv(n,"left",void 0)),h=cv(n,"bottom",cv(n,"right",void 0)),o=cv(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===cv(o,"width",void 0)?1:0:void 0===cv(o,"height",void 0)?1:0,i=new ov(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=cv(e,"valuechangeCallback",null);if(null!==d){var c=cv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(cv(e,"enable",void 0)),this.setValue(cv(e,"value",0)),this.setScrollStep(cv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class pv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const vv=Phaser.Utils.Objects.GetValue,gv=Phaser.Math.Distance.Between;class fv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=vv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(vv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(vv(t,"enable",!0)),this.holdThreshold=vv(t,"holdThreshold",50),this.pointerOutReleaseEnable=vv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:gv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const mv=Phaser.Utils.Objects.GetValue;class yv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(mv(t,"value",0)),this.setSpeed(mv(t,"speed",0)),this.setAcceleration(mv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class bv{constructor(){this.value,this.dir,this.movement=new yv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Cv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ov=Phaser.Utils.Objects.GetValue;class Pv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ov(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ov(e,"speed",.1)),this.setEnable(Ov(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ov(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const _v=Phaser.Utils.Objects.GetValue;var Tv=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?_v(s,l,void 0):_v(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new uv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=_v(r,"position",0);"string"==typeof p&&(p=kv[p]);var v,g,f=_v(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=_v(s,"space.slider",void 0))&&(h?f=0:v=_v(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,a?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:_v(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:_v(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:_v(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:_v(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=_v(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=_v(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=_v(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=_v(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=_v(s,"scrollDetectionMode");"string"==typeof b&&(b=Ev[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?_v(s,x,!0):_v(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Sv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=_v(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new Pv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(h?(S=a?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(h?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=h?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const kv={right:0,left:1,bottom:0,top:1},Ev={gameObject:0,rectBounds:1},Mv=Phaser.Utils.Objects.GetValue;var Rv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Mv(e,"width"),a=Mv(e,"height");n||Mv(e,"child.expandWidth",!0)||(s[1]=0),a||Mv(e,"child.expandHeight",!0)||(r[1]=0);var h=new zp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Xp(i,"child"),r=Xp(s,"gameObject",void 0);if(r){var n=Xp(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=Xp(n,"top",0),a.bottom=Xp(n,"bottom",0),h.left=Xp(n,"left",0),h.right=Xp(n,"right",0);break;case 1:a.top=Xp(n,"left",0),a.bottom=Xp(n,"right",0),h.top=Xp(n,"top",0),h.bottom=Xp(n,"bottom",0);break;default:a.top=Xp(n,"top",0),a.bottom=Xp(n,"bottom",0),a.left=Xp(n,"left",0),a.right=Xp(n,"right",0)}e.add(r,{column:1,row:1,align:Xp(s,"align","center"),padding:h,expand:{width:Xp(s,"expandWidth",!0),height:Xp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Tv(t,h,"y",e);break;case 1:Tv(t,h,"x",e);break;default:Tv(t,h,"y",e),Tv(t,h,"x",e)}return h},Lv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Dv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Av=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Fv.call(this,-this.textOY)),0),e=Iv.call(this,t)+this.textOY,i=Bv.call(this,t);return function(t,e){switch(ll(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Hv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Gv.call(this,t,n,a),he(t,s,r,n,a,e.align),e.preOffsetY=0,Hv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Uv=Phaser.Utils.Objects.IsPlainObject,$v=Phaser.Utils.Objects.GetValue,Jv=Phaser.Display.Align.TOP_LEFT;class Kv extends ta{constructor(t,e,i,s,r,n){Uv(e)?(e=$v(n=e,"x",0),i=$v(n,"y",0),s=$v(n,"width",void 0),r=$v(n,"height",void 0)):Uv(s)&&(s=$v(n=s,"width",void 0),r=$v(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=$v(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode($v(n,"clampTextOY",!0)),this.alwaysScrollable=$v(n,"alwaysScrollable",!1);var a=$v(n,"background",void 0),h=$v(n,"text",void 0);void 0===h&&(h=qv(t)),this.textCropEnable=$v(n,"textCrop",!!h.setCrop);var o=$v(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=Jv,l.padding=ge(0),l.expand=!0,this.textObject=h,this.textObjectType=ll(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=rl.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Fv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Iv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var qv=function(t){return t.add.text(0,0,"")};Object.assign(Kv.prototype,Vv);var Zv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Qv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const tg=Phaser.Utils.Objects.GetValue;class eg extends Wv{constructor(t,e){void 0===e&&(e={});var i=tg(e,"text",void 0),s=tg(e,"textWidth",void 0),r=tg(e,"textHeight",void 0),n=tg(e,"textCrop",!!i.setCrop),a=tg(e,"textMask",!n),h=tg(e,"content",""),o=new Kv(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:tg(e,"clampChildOY",!1),alwaysScrollable:tg(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=tg(e,"space",void 0);l&&(l.child=tg(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(eg.prototype,Zv,Qv);const ig=Phaser.Utils.Objects.GetValue;var sg=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new gp(t,e);break;case"bbcodetext":case"bbcode":s=new cp(t,0,0,"",e);break;case"label":s=new ag(t,e);break;case"textarea":s=function(t,e,i){e=e?ko(e):{};var s=ig(i,"background",$o),r=ig(i,"text",sg),n=ig(i,"track",$o),a=ig(i,"thumb",$o);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new eg(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Lc(t,e)}return Uo(s,e),t.add.existing(s),s},rg=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Go(t,e):new So(t,e);break;case"roundRectangle":s=new gh(t,e);break;default:s=new _o(t,e)}return Uo(s,e),t.add.existing(s),s};const ng=Phaser.Utils.Objects.GetValue;class ag extends Ec{constructor(t,e,i){e=function(t,e,i){e=e?ko(e):{};var s=ng(i,"background",$o),r=ng(i,"text",sg),n=ng(i,"icon",rg),a=ng(i,"action",rg);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return hg(this.getChildren(),"setActiveState",t),this}setHoverState(t){return hg(this.getChildren(),"setHoverState",t),this}setDisableState(t){return hg(this.getChildren(),"setDisableState",t),this}}var hg=function(t,e,i){for(var s=0,r=t.length;s0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Cg(r,"x",null);null!==n?(t=n,i=n):(t=Cg(r,"left",0),i=Cg(r,"right",t));var a=Cg(r,"y",null);null!==a?(e=a,s=a):(e=Cg(r,"top",0),s=Cg(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return _g(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Pg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const kg={right:0,down:1,left:2,up:3};var Eg=function(t){return"string"==typeof t&&(t=kg[t]),t%=4};Object.assign(Tg.prototype,wg,Sg);var Mg=function(t,e,i){var s=new Tg(t,e);return t.add.existing(s),s.on("expand.start",(function(t){t.setDirection("down")})).on("collapse.complete",(function(t){t.setDirection("right")})),s};const Rg=Phaser.Utils.Objects.GetValue,Lg=Phaser.Utils.Objects.GetValue,Dg=Phaser.Utils.Objects.Clone,Ag=Phaser.Utils.Objects.GetValue;class Yg extends(ka(Ya)){constructor(t,e){void 0===e&&(e={});var i=Xa(t,Ag(e,"background"),{isLeaf:!1},Jo,!1),s=function(t,e){var i=new Ta(t,{orientation:Lg(e,"childrenOrientation","y")});t.add.existing(i);var s=Xa(t,Lg(e,"childrenBackground"),{isLeaf:!1},Jo,!1);return s&&i.addBackground(s),i}(t,e),r=s.childrenMap.items,n=function(t,e){var i=new dg(t,e,{isLeaf:!1});t.add.existing(i);var s=Xa(t,Rg(e,"toggleButton"),{isLeaf:!1},Mg,!0);return i.insert(0,s,{padding:{right:Rg(e,"space.toggleButton",0)},fitRatio:1}),i.addChildrenMap("toggleButton",s),i}(t,e),a=n.childrenMap.toggleButton,h=n.childrenMap.nodeBody,o=Oa(Ag(e,"orientation","y")),l=e.space;if(l){var d=Ag(l,"indent",0);l.childLeft=Ag(l,"indentLeft",1===o?d:0),l.childRight=Ag(l,"indentRight",0),l.childTop=Ag(l,"indentTop",0===o?d:0),l.childBottom=Ag(l,"indentBottom",0)}super(t,{background:i,title:n,child:s,toggleByTarget:a,transition:e.transition,orientation:o,space:l,align:e.align,expand:e.expand}),this.type="rexTree",this.rexSizer.treeParent=null,this.nodesMap={},this.configSave=e,this.nodeBody=h,this.addChildrenMap("toggleButton",a),this.addChildrenMap("nodeBody",h),this.addChildrenMap("childrenNodes",r),this.on("expand.start",(function(){a.emit("expand.start",a),zg(this,"expand.start")}),this).on("expand.complete",(function(){a.emit("expand.complete",a),zg(this,"expand.complete")})).on("collapse.start",(function(){a.emit("collapse.start",a),zg(this,"collapse.start")})).on("collapse.complete",(function(){a.emit("collapse.complete",a),zg(this,"collapse.complete")}));var c=this;c._postAddCallback=function(){var t=Ag(e,"expanded",!0);void 0!==t&&c.setExpandedState(t),delete c._postAddCallback}}destroy(t){this.scene&&!this.ignoreDestroy&&(this.configSave=void 0,Clear(this.nodesMap),this.nodesMap=void 0,super.destroy(t))}get isTree(){return!0}createTree(t){return Yg.CreateTree(this.scene,this.configSave,t)}isTreeObject(t){return t&&t instanceof Yg}}Yg.CreateTree=function(t,e,i){return new Yg(t,function(t,e){var i=t?Dg(t):{};if(!e)return i;for(var s in e)i[s]=e[s];return i}(e,i))};var zg=function(t,e){var i=t.getTreesSizer();i&&i.emit(e,t)};Object.assign(Yg.prototype,fg);const Xg=Phaser.Utils.String.UUID;var Wg={addTree(t){return bt(t)&&(t={nodeBody:t,nodeKey:nodeKey}),this.insertTree(void 0,t)},insertTree(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=Xg());var s=Yg.CreateTree(this.scene,this.treeConfig,e);return cg(this,s),s.nodeKey=i,this.treesMap[i]=s,this.insert(t,s,{expand:!0}),s._postAddCallback(),s}},jg={removeTree(t,e){return"string"==typeof t&&(t=this.getTree(t)),t?(delete this.treesMap[t.nodeKey],t.nodeKey=null,this.remove(t,e),this):this},removeAllNodes(t){var e=this.treesMap;for(var i in e)this.removeTree(e[i],t);return this}},Fg={getTree(t){return this.treesMap[t]},getTrees(t){for(var e in void 0===t&&(t=[]),this.treesMap)t.push(this.treesMap[e]);return t},getNode(t){var e=t.indexOf(".");if(-1===e)return this.getTree(t);var i=this.getTree(t.substring(0,e));return i?i.getNode(t.substring(e+1)):void 0}},Ig={pointToChild:function(t,e,i,s){for(var r in this.treesMap){var n=this.treesMap[r];if(lr(n.nodeBody,t,e,i,s))return n;var a=n.pointToChild(t,e,i,s);if(a)return a}return null},setChildrenInteractive:function(t){return void 0===t&&(t={}),t.targetMode="parent",t.targetSizers=[this],qn(this,t),this}};Object.assign(Ig,Wg,jg,Fg);const Bg=Phaser.Utils.Objects.GetValue;class Hg extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation="y"),super(t,e),this.type="rexTrees",this.treesMap={},this.treeConfig=Bg(e,"tree")}destroy(t){this.scene&&!this.ignoreDestroy&&(this.treeConfig=void 0,Clear(this.treesMap),this.treesMap=void 0,super.destroy(t))}}return Object.assign(Hg.prototype,Ig),Hg},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextrees=e(); + */const Fc=Phaser.Display.Canvas.CanvasPool;var Ic=function(t){var e=Fc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Fc.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,Fc.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,v=4*h,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==ml&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=wl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=Hc(t,l,d);else{var u=Bc(t,l,d);c&&(u=c(u)),this[h]=u}}var p=Hc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Hc(t,"fill",null);null!==v&&(this.color=ed(v));var g=Hc(t,"metrics",!1);return g?this.metrics={ascent:Hc(g,"ascent",0),descent:Hc(g,"descent",0),fontSize:Hc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ic(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Ic(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Hc(t,"fontFamily","Courier"),this.fontSize=Hc(t,"fontSize","16px"),this.fontStyle=Hc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ed(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ed(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ed(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ed(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ed(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ed(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ed(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=ed(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=wl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Hc(e,"fontFamily",this.fontFamily),this.fontSize=Hc(e,"fontSize",this.fontSize),this.fontStyle=Hc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Gc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),od(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,v=a.valign,g=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Vc=Phaser.Utils.Objects.GetValue,Uc=vl,$c=gl;class Jc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Vc(t,"text",""),this.x=Vc(t,"x",0),this.y=Vc(t,"y",0),this.width=Vc(t,"width",0);var e=Vc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Vc(t,"newLineMode",0),this.startIndex=Vc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===$c&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Uc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===$c&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Kc=Phaser.Utils.Objects.GetFastValue,qc=vl,Zc=fl;class Qc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Kc(t,"tagToText",zt),this.tagToTextScope=Kc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var tu={};const eu=Phaser.Geom.Rectangle;var iu=new vc;class su{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&mu(g)){""!==b?a.push(n.getLine(b,x,du)):0===w&&r>0&&a.push(n.getLine("",0,du)),a.push(...gu(g,e,pu,s,0,n));var C=a.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,du)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&a.push(n.getLine(b,x,l))}return a},fu=function(t,e){var i;switch(e){case uu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==bu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Qc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Pp(this.sizerChildren,null),va.call(this,t),this}},Tp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Pp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Rp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Pp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Pp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Dp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Ap=Phaser.Utils.Objects.IsPlainObject,Yp=Phaser.Utils.Objects.GetValue;class Xp extends ta{constructor(t,e,i,s,r,n,a,h,o,l){Ap(e)?(e=Yp(l=e,"x",0),i=Yp(l,"y",0),s=Yp(l,"width",void 0),r=Yp(l,"height",void 0),n=Yp(l,"column",l.col||0),a=Yp(l,"row",0),h=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(s)?(s=Yp(l=s,"width",void 0),r=Yp(l,"height",void 0),n=Yp(l,"column",l.col||0),a=Yp(l,"row",0),h=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(n)?(n=Yp(l=n,"column",l.col||0),a=Yp(l,"row",0),h=Yp(l,"columnProportions",0),o=Yp(l,"rowProportions",0)):Ap(h)&&(h=Yp(l=h,"columnProportions",0),o=Yp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Yp(l,"createCellContainerCallback")),this.setIndentLeft(Yp(l,"space.indentLeftOdd",0),Yp(l,"space.indentLeftEven",0)),this.setIndentTop(Yp(l,"space.indentTopOdd",0),Yp(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,Yp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Lp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Dp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Xp.prototype,Rp);const zp=Phaser.Utils.Objects.GetValue,Wp=Phaser.Math.Percent;var jp=function(t,e,i){var s;return t.y===e.y?s=Wp(i.x,t.x,e.x):t.x===e.x&&(s=Wp(i.y,t.y,e.y)),s},Fp=function(t,e,i){var s,r;this.enable&&(Ip.x=e,Ip.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=jp(s,r,Ip))},Ip={},Bp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Hp.x=t.worldX,Hp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=jp(s,r,Hp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Hp={},Np=function(t,e){void 0===e&&(e=Gp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return he(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Gp={};const Vp=Phaser.Display.Align.LEFT_CENTER,Up=Phaser.Display.Align.TOP_CENTER;var $p={};const Jp=Phaser.Display.Align.RIGHT_CENTER,Kp=Phaser.Display.Align.BOTTOM_CENTER;var qp={};const Zp=Phaser.Math.Linear;var Qp={};const tv=Phaser.Display.Align.LEFT_CENTER,ev=Phaser.Display.Align.TOP_CENTER,iv=Phaser.Display.Align.RIGHT_CENTER,sv=Phaser.Display.Align.BOTTOM_CENTER,rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Utils.Objects.IsPlainObject,av=Phaser.Math.Clamp,hv=Phaser.Math.Snap.To;class ov extends(Mh(Ta)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=rv(e,"reverseAxis",!1);var i=rv(e,"background",void 0),s=rv(e,"track",void 0),r=rv(e,"indicator",void 0),n=rv(e,"thumb",void 0);if(i&&(nv(i)&&(i=$o(t,i)),this.addBackground(i)),s&&(nv(s)&&(s=$o(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(nv(r)&&(r=$o(t,r)),this.pin(r)),n){nv(n)&&(n=$o(t,n)),this.pin(n);var a=rv(e,"thumbOffsetX",0),h=rv(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=rv(e,"input",0);switch("string"==typeof o&&(o=lv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Fp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Bp,this).on("pointermove",Bp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(rv(e,"enable",void 0)),this.setGap(rv(e,"gap",void 0)),this.setValue(rv(e,"value",0),rv(e,"min",void 0),rv(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=hv(t,this.gap));var e=this._value;this._value=av(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const lv={pan:0,drag:0,click:1,none:-1};var dv={getStartPoint:function(t){if(void 0===t&&(t=$p),this.childrenMap.thumb){var e=0===this.orientation?Vp:Up;Np.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=qp),this.childrenMap.thumb){var e=0===this.orientation?Jp:Kp;Np.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Qp),s.x=Zp(e.x,i.x,t),s.y=Zp(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?iv:sv:0===this.orientation?tv:ev,ae(e,this,r),this.resetChildPositionState(e)}};Object.assign(ov.prototype,dv);const cv=Phaser.Utils.Objects.GetValue;class uv extends Ta{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=cv(e,"background",void 0),n=cv(e,"buttons",void 0),a=cv(n,"top",cv(n,"left",void 0)),h=cv(n,"bottom",cv(n,"right",void 0)),o=cv(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===cv(o,"width",void 0)?1:0:void 0===cv(o,"height",void 0)?1:0,i=new ov(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=cv(e,"valuechangeCallback",null);if(null!==d){var c=cv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(cv(e,"enable",void 0)),this.setValue(cv(e,"value",0)),this.setScrollStep(cv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class pv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const vv=Phaser.Utils.Objects.GetValue,gv=Phaser.Math.Distance.Between;class fv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=vv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(vv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(vv(t,"enable",!0)),this.holdThreshold=vv(t,"holdThreshold",50),this.pointerOutReleaseEnable=vv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:gv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const mv=Phaser.Utils.Objects.GetValue;class yv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(mv(t,"value",0)),this.setSpeed(mv(t,"speed",0)),this.setAcceleration(mv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class bv{constructor(){this.value,this.dir,this.movement=new yv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Cv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ov=Phaser.Utils.Objects.GetValue;class Pv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ov(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ov(e,"speed",.1)),this.setEnable(Ov(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ov(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const _v=Phaser.Utils.Objects.GetValue;var Tv=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?_v(s,l,void 0):_v(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new uv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=_v(r,"position",0);"string"==typeof p&&(p=kv[p]);var v,g,f=_v(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=_v(s,"space.slider",void 0))&&(h?f=0:v=_v(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,a?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:_v(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:_v(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:_v(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:_v(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=_v(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=_v(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=_v(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=_v(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=_v(s,"scrollDetectionMode");"string"==typeof b&&(b=Ev[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?_v(s,x,!0):_v(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Sv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=_v(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new Pv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(h?(S=a?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(h?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=h?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const kv={right:0,left:1,bottom:0,top:1},Ev={gameObject:0,rectBounds:1},Mv=Phaser.Utils.Objects.GetValue;var Rv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Mv(e,"width"),a=Mv(e,"height");n||Mv(e,"child.expandWidth",!0)||(s[1]=0),a||Mv(e,"child.expandHeight",!0)||(r[1]=0);var h=new Xp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=zp(i,"child"),r=zp(s,"gameObject",void 0);if(r){var n=zp(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=zp(n,"top",0),a.bottom=zp(n,"bottom",0),h.left=zp(n,"left",0),h.right=zp(n,"right",0);break;case 1:a.top=zp(n,"left",0),a.bottom=zp(n,"right",0),h.top=zp(n,"top",0),h.bottom=zp(n,"bottom",0);break;default:a.top=zp(n,"top",0),a.bottom=zp(n,"bottom",0),a.left=zp(n,"left",0),a.right=zp(n,"right",0)}e.add(r,{column:1,row:1,align:zp(s,"align","center"),padding:h,expand:{width:zp(s,"expandWidth",!0),height:zp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Tv(t,h,"y",e);break;case 1:Tv(t,h,"x",e);break;default:Tv(t,h,"y",e),Tv(t,h,"x",e)}return h},Lv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Dv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Av=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Fv.call(this,-this.textOY)),0),e=Iv.call(this,t)+this.textOY,i=Bv.call(this,t);return function(t,e){switch(ll(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Hv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Gv.call(this,t,n,a),he(t,s,r,n,a,e.align),e.preOffsetY=0,Hv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Uv=Phaser.Utils.Objects.IsPlainObject,$v=Phaser.Utils.Objects.GetValue,Jv=Phaser.Display.Align.TOP_LEFT;class Kv extends ta{constructor(t,e,i,s,r,n){Uv(e)?(e=$v(n=e,"x",0),i=$v(n,"y",0),s=$v(n,"width",void 0),r=$v(n,"height",void 0)):Uv(s)&&(s=$v(n=s,"width",void 0),r=$v(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=$v(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode($v(n,"clampTextOY",!0)),this.alwaysScrollable=$v(n,"alwaysScrollable",!1);var a=$v(n,"background",void 0),h=$v(n,"text",void 0);void 0===h&&(h=qv(t)),this.textCropEnable=$v(n,"textCrop",!!h.setCrop);var o=$v(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=Jv,l.padding=ge(0),l.expand=!0,this.textObject=h,this.textObjectType=ll(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=rl.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Fv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Iv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var qv=function(t){return t.add.text(0,0,"")};Object.assign(Kv.prototype,Vv);var Zv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Qv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const tg=Phaser.Utils.Objects.GetValue;class eg extends Wv{constructor(t,e){void 0===e&&(e={});var i=tg(e,"text",void 0),s=tg(e,"textWidth",void 0),r=tg(e,"textHeight",void 0),n=tg(e,"textCrop",!!i.setCrop),a=tg(e,"textMask",!n),h=tg(e,"content",""),o=new Kv(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:tg(e,"clampChildOY",!1),alwaysScrollable:tg(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=tg(e,"space",void 0);l&&(l.child=tg(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(eg.prototype,Zv,Qv);const ig=Phaser.Utils.Objects.GetValue;var sg=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new gp(t,e);break;case"bbcodetext":case"bbcode":s=new cp(t,0,0,"",e);break;case"label":s=new ag(t,e);break;case"textarea":s=function(t,e,i){e=e?ko(e):{};var s=ig(i,"background",$o),r=ig(i,"text",sg),n=ig(i,"track",$o),a=ig(i,"thumb",$o);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new eg(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Lc(t,e)}return Uo(s,e),t.add.existing(s),s},rg=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Go(t,e):new So(t,e);break;case"roundRectangle":s=new gh(t,e);break;default:s=new _o(t,e)}return Uo(s,e),t.add.existing(s),s};const ng=Phaser.Utils.Objects.GetValue;class ag extends Ec{constructor(t,e,i){e=function(t,e,i){e=e?ko(e):{};var s=ng(i,"background",$o),r=ng(i,"text",sg),n=ng(i,"icon",rg),a=ng(i,"action",rg);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return hg(this.getChildren(),"setActiveState",t),this}setHoverState(t){return hg(this.getChildren(),"setHoverState",t),this}setDisableState(t){return hg(this.getChildren(),"setDisableState",t),this}}var hg=function(t,e,i){for(var s=0,r=t.length;s0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Cg(r,"x",null);null!==n?(t=n,i=n):(t=Cg(r,"left",0),i=Cg(r,"right",t));var a=Cg(r,"y",null);null!==a?(e=a,s=a):(e=Cg(r,"top",0),s=Cg(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return _g(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Pg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const kg={right:0,down:1,left:2,up:3};var Eg=function(t){return"string"==typeof t&&(t=kg[t]),t%=4};Object.assign(Tg.prototype,wg,Sg);var Mg=function(t,e,i){var s=new Tg(t,e);return t.add.existing(s),s.on("expand.start",(function(t){t.setDirection("down")})).on("collapse.complete",(function(t){t.setDirection("right")})),s};const Rg=Phaser.Utils.Objects.GetValue,Lg=Phaser.Utils.Objects.GetValue,Dg=Phaser.Utils.Objects.Clone,Ag=Phaser.Utils.Objects.GetValue;class Yg extends(ka(Ya)){constructor(t,e){void 0===e&&(e={});var i=za(t,Ag(e,"background"),{isLeaf:!1},Jo,!1),s=function(t,e){var i=new Ta(t,{orientation:Lg(e,"childrenOrientation","y")});t.add.existing(i);var s=za(t,Lg(e,"childrenBackground"),{isLeaf:!1},Jo,!1);return s&&i.addBackground(s),i}(t,e),r=s.childrenMap.items,n=function(t,e){var i=new dg(t,e,{isLeaf:!1});t.add.existing(i);var s=za(t,Rg(e,"toggleButton"),{isLeaf:!1},Mg,!0);return i.insert(0,s,{padding:{right:Rg(e,"space.toggleButton",0)},fitRatio:1}),i.addChildrenMap("toggleButton",s),i}(t,e),a=n.childrenMap.toggleButton,h=n.childrenMap.nodeBody,o=Oa(Ag(e,"orientation","y")),l=e.space;if(l){var d=Ag(l,"indent",0);l.childLeft=Ag(l,"indentLeft",1===o?d:0),l.childRight=Ag(l,"indentRight",0),l.childTop=Ag(l,"indentTop",0===o?d:0),l.childBottom=Ag(l,"indentBottom",0)}super(t,{background:i,title:n,child:s,toggleByTarget:a,transition:e.transition,orientation:o,space:l,align:e.align,expand:e.expand}),this.type="rexTree",this.rexSizer.treeParent=null,this.nodesMap={},this.configSave=e,this.nodeBody=h,this.addChildrenMap("toggleButton",a),this.addChildrenMap("nodeBody",h),this.addChildrenMap("childrenNodes",r),this.on("expand.start",(function(){a.emit("expand.start",a),Xg(this,"expand.start")}),this).on("expand.complete",(function(){a.emit("expand.complete",a),Xg(this,"expand.complete")})).on("collapse.start",(function(){a.emit("collapse.start",a),Xg(this,"collapse.start")})).on("collapse.complete",(function(){a.emit("collapse.complete",a),Xg(this,"collapse.complete")}));var c=this;c._postAddCallback=function(){var t=Ag(e,"expanded",!0);void 0!==t&&c.setExpandedState(t),delete c._postAddCallback}}destroy(t){this.scene&&!this.ignoreDestroy&&(this.configSave=void 0,Clear(this.nodesMap),this.nodesMap=void 0,super.destroy(t))}get isTree(){return!0}createTree(t){return Yg.CreateTree(this.scene,this.configSave,t)}isTreeObject(t){return t&&t instanceof Yg}}Yg.CreateTree=function(t,e,i){return new Yg(t,function(t,e){var i=t?Dg(t):{};if(!e)return i;for(var s in e)i[s]=e[s];return i}(e,i))};var Xg=function(t,e){var i=t.getTreesSizer();i&&i.emit(e,t)};Object.assign(Yg.prototype,fg);const zg=Phaser.Utils.String.UUID;var Wg={addTree(t){return bt(t)&&(t={nodeBody:t,nodeKey:nodeKey}),this.insertTree(void 0,t)},insertTree(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=zg());var s=Yg.CreateTree(this.scene,this.treeConfig,e);return cg(this,s),s.nodeKey=i,this.treesMap[i]=s,this.insert(t,s,{expand:!0}),s._postAddCallback(),s}},jg={removeTree(t,e){return"string"==typeof t&&(t=this.getTree(t)),t?(delete this.treesMap[t.nodeKey],t.nodeKey=null,this.remove(t,e),this):this},removeAllNodes(t){var e=this.treesMap;for(var i in e)this.removeTree(e[i],t);return this}},Fg={getTree(t){return this.treesMap[t]},getTrees(t){for(var e in void 0===t&&(t=[]),this.treesMap)t.push(this.treesMap[e]);return t},getNode(t){var e=t.indexOf(".");if(-1===e)return this.getTree(t);var i=this.getTree(t.substring(0,e));return i?i.getNode(t.substring(e+1)):void 0}},Ig={pointToChild:function(t,e,i,s){for(var r in this.treesMap){var n=this.treesMap[r];if(lr(n.nodeBody,t,e,i,s))return n;var a=n.pointToChild(t,e,i,s);if(a)return a}return null},setChildrenInteractive:function(t){return void 0===t&&(t={}),t.targetMode="parent",t.targetSizers=[this],qn(this,t),this}};Object.assign(Ig,Wg,jg,Fg);const Bg=Phaser.Utils.Objects.GetValue;class Hg extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation="y"),super(t,e),this.type="rexTrees",this.treesMap={},this.treeConfig=Bg(e,"tree")}destroy(t){this.scene&&!this.ignoreDestroy&&(this.treeConfig=void 0,Clear(this.treesMap),this.treesMap=void 0,super.destroy(t))}}return Object.assign(Hg.prototype,Ig),Hg},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextrees=e(); diff --git a/dist/rextweaker.js b/dist/rextweaker.js index 5ba41411d1..26744cb7c3 100644 --- a/dist/rextweaker.js +++ b/dist/rextweaker.js @@ -16432,6 +16432,8 @@ this.setBackgroundColor(GetValue$1w(o, 'backgroundColor', null)); this.setBackgroundHeight(GetValue$1w(o, 'backgroundHeight', undefined)); this.setBackgroundBottomY(GetValue$1w(o, 'backgroundBottomY', undefined)); + this.setBackgroundLeftX(GetValue$1w(o, 'backgroundLeftX', 0)); + this.setBackgroundRightX(GetValue$1w(o, 'backgroundRightX', 0)); return this; } @@ -16502,6 +16504,12 @@ if (o.hasOwnProperty('backgroundBottomY')) { this.setBackgroundBottomY(o.backgroundBottomY); } + if (o.hasOwnProperty('backgroundLeftX')) { + this.setBackgroundLeftX(o.backgroundLeftX); + } + if (o.hasOwnProperty('backgroundRightX')) { + this.setBackgroundRightX(o.backgroundRightX); + } return this; } @@ -16656,6 +16664,16 @@ return this; } + setBackgroundLeftX(x) { + this.backgroundLeftX = x; + return this; + } + + setBackgroundRightX(x) { + this.backgroundRightX = x; + return this; + } + setOffsetX(offsetX) { if (offsetX === undefined) { offsetX = 0; @@ -17083,20 +17101,24 @@ if (textStyle.hasBackgroundColor) { context.fillStyle = textStyle.backgroundColor; - var x = this.drawTLX; - var width = this.drawTRX - x + 1; // Add extra 1 pixel width + var leftX = this.drawTLX + textStyle.backgroundLeftX; + var rightX = this.drawTRX + textStyle.backgroundRightX; + var x = leftX; + var width = rightX - leftX + 1; // Add extra 1 pixel width - var bottomY = textStyle.backgroundBottomY; - if (bottomY == null) { - bottomY = this.drawBLY; - } - var height = textStyle.backgroundHeight; - if (height == null) { - height = bottomY - this.drawTLY; - } - var y = bottomY - height; + if (width > 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -40228,7 +40250,7 @@ var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -40635,6 +40657,33 @@ }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -41283,6 +41332,7 @@ var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -41310,19 +41360,41 @@ } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -41517,6 +41589,11 @@ return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rextweaker.min.js b/dist/rextweaker.min.js index aa1352533c..0541d0c961 100644 --- a/dist/rextweaker.min.js +++ b/dist/rextweaker.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=k(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},B=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Y=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var X={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ae={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Be=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ye=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ie=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ki(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let Ei=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Ri=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},Li=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ai=function(t){return Di(t,"complete")};const Bi=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Bi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ai(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Bi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ai(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ai(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Bi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ai(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Wi={};Object.assign(Wi,zi),Wi.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Xi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(Ii(t,"start",this.parent.alpha),Ii(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,a):s.resetFromJSON(a),s.restart(),s},Gi=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Ui=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ai(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ai(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ai(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ni),$i.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ki=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ki(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=ts(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=ts(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ai(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ai(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=ts(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=ts(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ai(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ai(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class as extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new as(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ai(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Di(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ws={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},Is={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ws,Ys,Is,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Xs);var Vs=function(t){if(t.parentContainer)return Vs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Vs(e):t};class Gs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Vs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Us=Phaser.GameObjects.Rectangle;let Ns=class extends Us{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Gs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const $s=Phaser.Utils.Objects.GetValue;class Ks extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Ks(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},er=function(t,e){Gi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),a=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ar=function(t){return t&&"function"==typeof t},hr={modal(t,e){return ar(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){ar(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return _r.length=0,!0;return _r.length=0,!1},_r=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Rr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Dr extends Bs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Ar=Phaser.Utils.Objects.GetValue;class Br extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Ar(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Ar(t,"enable",!0)),this.setCooldown(Ar(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Br(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Br(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Wr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Yr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class an extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=hn)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=kn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cn(t,"threshold",10)),this.setVelocityThreshold(Cn(t,"velocityThreshold",1e3)),this.setDirectionMode(Cn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=kn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=kn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=bn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=xn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,yn);const kn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Dn:this.tracerState=An,this.onDrag1Start();break;case An:this.tracerState=Bn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],_n(this.pointers,e),this.tracerState){case An:this.tracerState=Dn,this.onDrag1End();break;case Bn:this.tracerState=An,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case An:this.onDrag1();break;case Bn:this.onDrag2()}}}dragCancel(){return this.tracerState===Bn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Bn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Bn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=zn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Ke);var Ln={};const Dn=0,An=1,Bn=2,zn="IDLE";Phaser.Utils.Objects.GetValue;const Wn=Phaser.Math.RotateAround;var Yn=function(t,e,i,s){return Wn(t,e,i,s),t.rotation+=s,t},In={};const jn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Vn=Phaser.Math.DegToRad;var Gn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=In),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=Xn(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Vn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Gn);const Un="IDLE",Nn="BEGIN",$n="RECOGNIZED",Kn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Kn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new an(this,e),this._tap.on("tap",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ir(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var ta=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ir(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ir(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const ea=Phaser.Utils.Objects.GetValue;var ia=function(t,e){return t.setInteractive(),ea(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:ea(e,"targets",[t]),targetMode:ea(e,"targetMode","parent"),eventEmitter:ea(e,"eventEmitter",t),eventNamePrefix:ea(e,"inputEventPrefix","child.")},Xr.call(t,e),Vr.call(t,e),Nr.call(t,e),qr.call(t,e),Jn.call(t,e),Zn.call(t,e),ta.call(t,e),t},sa={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=At(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(a=le(o,"align","left-top"))&&(a=Wt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ua=Phaser.Utils.Objects.IsPlainObject,pa=Phaser.Utils.Objects.GetValue,va=Phaser.Display.Align.CENTER,ga={min:0,full:-1};var fa=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=ga[e];else if(ua(e)){var f;e=pa(f=e,"proportion",void 0),i=pa(f,"align",va),s=pa(f,"padding",0),r=pa(f,"expand",!1),n=pa(f,"key",void 0),a=pa(f,"index",void 0),t.isRexSizer||(h=pa(f,"minWidth",void 0),o=pa(f,"minHeight",void 0)),l=pa(f,"fitRatio",0),d=pa(f,"offsetX",0),c=pa(f,"offsetY",0),u=pa(f,"offsetOriginX",0),p=pa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Wt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=va),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ma={add:fa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fa.call(this,new da(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ua(i)&&(i.index=t),fa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ca.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ya=Mt.prototype.clear;var ba=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ya.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ba.call(this,t),this}},wa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Wt[e]),this.getSizerConfig(t).align=e,this}},Sa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ka={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Pa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oa.call(this,t,void 0),We.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ie.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oa.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Pa,ma,Ca,wa,Sa,ka,Oa);var Ta=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ea=function(t){return"string"==typeof t&&(t=_a[t]),t};const Ma=Phaser.Utils.Objects.IsPlainObject,Ra=Phaser.Utils.Objects.GetValue;class La extends na{constructor(t,e,i,s,r,n,a){Ma(e)?(e=Ra(a=e,"x",0),i=Ra(a,"y",0),s=Ra(a,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ma(s)?(s=Ra(a=s,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ma(n)&&(n=Ra(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ra(a,"space.item",0)),this.setStartChildIndex(Ra(a,"startChildIndex",0)),this.setRTL(Ra(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ea(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ta.call(this)),this._childrenProportion}}Object.assign(La.prototype,Pa);var Da=function(t,e,i,s){return e/t<=i?e/(s-1):0},Aa=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},h=this.sizerChildren,o=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=h.length;ch.height/2)){r>(o=Ba(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=Ba(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const Wa=Phaser.Utils.Objects.IsPlainObject,Ya=Phaser.Utils.Objects.GetValue,Ia=Phaser.Display.Align.CENTER;var ja=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),Wa(e)&&(e=Ya(o=e,"padding",0),i=Ya(o,"key",void 0),s=Ya(o,"index",void 0),r=Ya(o,"offsetX",0),n=Ya(o,"offsetY",0),a=Ya(o,"offsetOriginX",0),h=Ya(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===h&&(h=0),(o=this.getSizerConfig(t)).align=Ia,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=a,o.alignOffsetOriginY=h,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,h,o},Xa={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ba.call(this,t),this}},Va={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(o.join("")),r},yh=0,bh=1,xh=2,Ch=0,wh=1,Sh=2,kh=/(?:\r\n|\r|\n)/;const Oh={none:Ch,word:wh,char:Sh,character:Sh,mix:3},Ph=Phaser.Renderer.WebGL.Utils;var Th={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Ph.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const _h=Phaser.Display.Color;var Eh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new _h);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Mh=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},Rh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Mh(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Lh=Phaser.Display.Canvas.CanvasPool,Dh=Phaser.GameObjects.GameObject,Ah=Phaser.Utils.String.UUID;let Bh=class extends Dh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Lh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Ah(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Lh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const zh=Phaser.GameObjects.Components;Phaser.Class.mixin(Bh,[zh.Alpha,zh.BlendMode,zh.Crop,zh.Depth,zh.Flip,zh.GetBounds,zh.Mask,zh.Origin,zh.Pipeline,zh.PostPipeline,zh.ScrollFactor,zh.Tint,zh.Transform,zh.Visible,Th,Eh,Rh]);var Wh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class Yh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Yh.prototype,Wh);var Ih={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const jh=Phaser.Math.RotateAround;var Xh;const Fh=Phaser.Geom.Rectangle;var Hh,Vh=function(t){void 0===Hh&&(Hh=new Fh);var e=t.drawTLX,i=t.drawTLY;return Hh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Hh};const Gh=Phaser.Math.RotateAround;var Uh,Nh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Uh&&(Uh={}),s=Uh),s.x=e,s.y=i,0!==t.rotation&&Gh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const $h=Phaser.GameObjects.Components.TransformMatrix;var Kh,Jh,qh={},Zh=function(t,e,i,s,r){var n=Nh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=qh);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Kh&&(Kh=new $h,Jh=new $h),t.parentContainer?t.getWorldTransformMatrix(Kh,Jh):Kh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Kh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Qh=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Zh(t,e,n,a,r)},to={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Xh&&(Xh={}),s=Xh),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&jh(s,0,0,-i.rotation),s}(t,e,this,!0);return Vh(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Qh(this.parent,this,t,e,i)}};Object.assign(to,Ih);const eo=Phaser.Math.DegToRad,io=Phaser.Math.RadToDeg,so=Phaser.Utils.Objects.GetValue;class ro extends Yh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return io(this._rotation)}set angle(t){this.rotation=eo(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=so(t,"width",void 0),i=so(t,"height",void 0),s=so(t,"scaleX",void 0),r=so(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ro.prototype,to);const no=Phaser.Utils.String.Pad;var ao=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${no(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ho=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const oo=Phaser.Utils.Objects.GetValue;let lo=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=oo(t,"x",0),i=oo(t,"y",0));var s=this.cornerRadius;s.tl=co(oo(t,"tl",void 0),e,i),s.tr=co(oo(t,"tr",void 0),e,i),s.bl=co(oo(t,"bl",void 0),e,i),s.br=co(oo(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){uo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){uo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){uo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){uo(this.cornerRadius.br,t)}};var co=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),po(t),t},uo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=oo(e,"x",0),t.y=oo(e,"y",0)),po(t)},po=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vo=Phaser.Math.DegToRad;var go=function(t){return!t.hasOwnProperty("convex")||t.convex},fo=function(t){return t.x>0&&t.y>0},mo=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,o,l,o,l,180,270,!1,a):mo(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,s-o,l,o,l,270,360,!1,a):mo(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,s-o,r-l,o,l,0,90,!1,a):mo(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,o,r-l,o,l,90,180,!1,a):mo(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},bo=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),yo(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const xo=Phaser.Utils.Objects.GetValue;class Co extends ro{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(xo(e,"color",null),xo(e,"color2",null),xo(e,"horizontalGradient",!0)),this.setStroke(xo(e,"stroke",null),xo(e,"strokeThickness",2)),this.setCornerRadius(xo(e,"cornerRadius",0),xo(e,"cornerIteration",null))}set color(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ao(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ho("color2",t,this),ho("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ho("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ho("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){bo(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const wo=Phaser.Utils.Objects.GetValue;class So extends ro{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(wo(e,"color",null),wo(e,"color2",null),wo(e,"horizontalGradient",!0)),this.setStroke(wo(e,"stroke",null),wo(e,"strokeThickness",2))}set color(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ao(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,wo(t,"color2",null),wo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wo(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const ko=Phaser.Utils.Objects.GetValue;let Oo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(ko(t,"bold",!1)),this.setItalic(ko(t,"italic",!1)),this.setFontSize(ko(t,"fontSize","16px")),this.setFontFamily(ko(t,"fontFamily","Courier")),this.setColor(ko(t,"color","#fff")),this.setStrokeStyle(ko(t,"stroke",null),ko(t,"strokeThickness",0)),this.setShadow(ko(t,"shadowColor",null),ko(t,"shadowOffsetX",0),ko(t,"shadowOffsetY",0),ko(t,"shadowBlur",0)),this.setOffset(ko(t,"offsetX",0),ko(t,"offsetY",0)),this.setSpace(ko(t,"leftSpace",0),ko(t,"rightSpace",0)),this.setAlign(ko(t,"align",void 0)),this.setBackgroundColor(ko(t,"backgroundColor",null)),this.setBackgroundHeight(ko(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ko(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ho("stroke",t,this),ho("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ho("shadowOffsetX",t,this),ho("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ao(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ao(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ao(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ao(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Po=Phaser.Utils.Array.Remove,To=Phaser.Utils.Array.Remove,_o="text",Eo="image",Mo="drawer",Ro="space",Lo="command";var Do=function(t){return t.type===_o&&"\n"===t.text},Ao=function(t){return t.type===_o&&"\f"===t.text},Bo=function(t){return t.type===_o};class zo extends ro{constructor(t,e,i){super(t,_o),this.updateTextFlag=!1,this.style=new Oo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var h=e.hasFill,o=e.hasStroke;(h||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Wo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yo=Phaser.Display.Canvas.CanvasPool;var Io=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Yo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Yo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class jo extends ro{constructor(t,e,i){super(t,Eo),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Io(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Xo extends ro{constructor(t,e,i,s){super(t,Mo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Fo extends ro{constructor(t,e){super(t,Ro),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Ho extends Yh{constructor(t,e,i,s,r){super(t,Lo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Vo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Vo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Vo(t[i]));return e}var Go=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Uo={none:0,word:1,char:2,character:2,mix:3};var No=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=qo.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=qo.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Qo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Qo(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Qo(t,"wrapMode");void 0===c&&(c=Qo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Uo[c]);var u=Qo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Qo(t,"letterSpacing",0),v=Qo(t,"hAlign",0),g=Qo(t,"vAlign",0),f=Qo(t,"justifyPercentage",.25),m=Go({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=il(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=il(t,"maxLines",0);var h=0===i,o=il(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=il(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=il(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=il(t,"letterSpacing",0),p=il(t,"rtl",!0),v=il(t,"hAlign",p?2:0),g=il(t,"vAlign",0),f=Go({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,Y=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Le(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Po(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return To(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(_o);return null===i?i=new zo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Qh(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Tl=Phaser.Utils.Objects.GetFastValue;var _l={};class El{constructor(t){this.pools=Tl(t,"pools",_l)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Pl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Wl(t,r,e,i,n),h=0;h<=Al&&0!==a;h++){if((r+=a)<0){r=0;break}a=Wl(t,r,e,i,n)}return h===Al&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Yl(t,e,i),t},zl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Wl=function(t,e,i,s,r){var n,a=zl(t,e,r),h=zl(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},Yl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Il=Phaser.Utils.Objects.GetValue,jl=Phaser.Utils.Objects.GetValue;class Xl extends ih{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=jl(e,"background",void 0),r=jl(e,"icon",void 0),n=jl(e,"iconMask",void 0),a=jl(e,"text",void 0),h=jl(e,"action",void 0),o=jl(e,"actionMask",void 0),l=jl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:jl(e,"space.icon",0),top:jl(e,"space.iconTop",0),bottom:jl(e,"space.iconBottom",0),left:jl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:jl(e,"space.icon",0),left:jl(e,"space.iconLeft",0),right:jl(e,"space.iconRight",0),top:jl(e,"space.iconTop",0)});var d=jl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=oh.call(this,r,r,1)),!d){var c=jl(e,"iconSize",void 0);this.setIconSize(jl(e,"iconWidth",c),jl(e,"iconHeight",c))}}if(a){var u=jl(e,"wrapText",!1),p=jl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ph(t)){case 0:switch("string"==typeof e&&(e=Oh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=fh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Oh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Dl(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Il(e,"minWidth",0),s=Il(e,"minHeight",0),r=Il(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Bl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Bl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=jl(e,"space.text",0),m=jl(e,"expandTextWidth",!1),y=jl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,h&&(i={right:f}),g=y):(v=y?1:0,h&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(h&&(i=0===this.orientation?{top:jl(e,"space.actionTop",0),bottom:jl(e,"space.actionBottom",0),right:jl(e,"space.actionRight",0)}:{left:jl(e,"space.actionLeft",0),right:jl(e,"space.actionRight",0),bottom:jl(e,"space.actionBottom",0)},d=jl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=oh.call(this,h,h,1)),!d)){var b=jl(e,"actionSize");this.setActionSize(jl(e,"actionWidth",b),jl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}var Fl=Phaser.Renderer.WebGL.Utils,Hl=function(t,e,i,s,r,n){for(var a=Fl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},$l=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Kl=Phaser.Renderer.Canvas.SetTransform;var Jl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ul(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Hl(r,a,e,l,h,o),e.isStroked&&Gl(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Kl(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Zl.prototype,Jl);var Ql=function(t){return t.x>0&&t.y>0},td=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ed=Phaser.Math.DegToRad;var id=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=sc(t,"tl",0),this.radiusTR=sc(t,"tr",0),this.radiusBL=sc(t,"bl",0),this.radiusBR=sc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?id(e,e,e,e,180,270,!1,r,t):id(0,0,e,e,90,0,!0,r,t):td(0,0,t),(e=this.radiusTR)>0?this._convexTR?id(i-e,e,e,e,270,360,!1,r,t):id(i,0,e,e,180,90,!0,r,t):td(i,0,t),(e=this.radiusBR)>0?this._convexBR?id(i-e,s-e,e,e,0,90,!1,r,t):id(i,s,e,e,270,180,!0,r,t):td(i,s,t),(e=this.radiusBL)>0?this._convexBL?id(e,s-e,e,e,90,180,!1,r,t):id(0,s,e,e,360,270,!0,r,t):td(0,s,t),t.push(t[0],t[1]),jd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var nc=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const ac=Phaser.Utils.Objects.GetValue,hc=Phaser.Utils.Objects.IsPlainObject;class oc extends(Md(wd)){constructor(t,e,i,s,r,n,a,h){hc(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):hc(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):hc(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new ic).setName("trackFill")).addShape((new ic).setName("bar")).addShape((new ic).setName("trackStroke")),this.setTrackColor(ac(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ac(h,"trackStrokeThickness",2),ac(h,"trackStrokeColor",void 0)),this.setSkewX(ac(h,"skewX",0)),this.setRTL(ac(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var lc={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&nc(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),nc(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&nc(h,0,0,e,i,t)}};Object.assign(oc.prototype,lc);var dc=function(t){return null==t||""===t||0===t.length},cc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(dc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(dc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Vo(i),s=Vo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var k=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==k&&"number"!==k||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Ec(t)?(this.stretchMode.edge=Rc(Mc(t,"edge",0)),this.stretchMode.internal=Rc(Mc(t,"internal",0))):(t=Rc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Dc.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Bc=Phaser.Utils.Objects.IsPlainObject,zc=Phaser.Utils.Objects.GetValue,Wc=Phaser.GameObjects;var Yc=void 0,Ic=function(t,e){if(Yc||(Yc={},ei(t).events.once("destroy",(function(){for(var t in Yc)Yc[t].destroy();Yc=void 0}))),!Yc.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Wc[e](i)).setOrigin(0),Yc[e]=t}return Yc[e]};const jc=Phaser.GameObjects.RenderTexture;class Xc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Bc(i)?(i=zc(d=i,"x",0),s=zc(d,"y",0),r=zc(d,"width",1),n=zc(d,"height",1),a=zc(d,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(r)?(r=zc(d=r,"width",1),n=zc(d,"height",1),a=zc(d,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(a)?(a=zc(d=a,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(h)?(h=zc(d=h,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=zc(d,"baseFrame",void 0)):Bc(o)&&(o=zc(d=o,"columns",void 0),l=zc(d,"rows",void 0)),void 0===h&&(h=zc(d,"frame",void 0)),void 0===o){var c=zc(d,"leftWidth",void 0),u=zc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=zc(d,"topHeight",void 0),v=zc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(zc(d,"getFrameNameCallback",void 0)),this.setStretchMode(zc(d,"stretchMode",0)),this.setPreserveRatio(zc(d,"preserveRatio",!0));var g=zc(d,"maxFixedPartScale",1),f=zc(d,"maxFixedPartScaleX",g),m=zc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ac),i}(jc,"rexNinePatch")){}var Fc={_drawImage:function(t,e,i,s,r,n){var a=Ic(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ic(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Xc.prototype,Fc);let Hc=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(vc(t,e))return t[e];var i=t.parent;return vc(i,e)?i[e]:void 0}set(t,e,i){return vc(t,e)?t[e]=i:vc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Vc=Phaser.Utils.Objects.GetValue;class Gc extends Xc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Vc(e,"effects",!0);i&&bc(this,i),this.style=new Hc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Gc.prototype,vd);const Uc=["alpha","tint","flipX","flipY"];var Nc=function(t,e){if(!e)return t;for(var i=0,s=Uc.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=k(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},B=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Y=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var X={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ae={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Be=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ye=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ie=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ki(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let Ei=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Ri=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},Li=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ai=function(t){return Di(t,"complete")};const Bi=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Bi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ai(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Bi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ai(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ai(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Bi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ai(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Wi={};Object.assign(Wi,zi),Wi.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Xi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(Ii(t,"start",this.parent.alpha),Ii(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,a):s.resetFromJSON(a),s.restart(),s},Gi=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Ui=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ai(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ai(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ai(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ni),$i.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ki=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ki(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=ts(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=ts(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ai(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ai(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=ts(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=ts(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ai(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ai(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class as extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new as(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ai(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Di(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ws={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},Is={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ws,Ys,Is,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Xs);var Vs=function(t){if(t.parentContainer)return Vs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Vs(e):t};class Gs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Vs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Us=Phaser.GameObjects.Rectangle;let Ns=class extends Us{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Gs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const $s=Phaser.Utils.Objects.GetValue;class Ks extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Ks(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},er=function(t,e){Gi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),a=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ar=function(t){return t&&"function"==typeof t},hr={modal(t,e){return ar(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){ar(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return _r.length=0,!0;return _r.length=0,!1},_r=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Rr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Dr extends Bs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Ar=Phaser.Utils.Objects.GetValue;class Br extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Ar(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Ar(t,"enable",!0)),this.setCooldown(Ar(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Br(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Br(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Wr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Yr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class an extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=hn)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=kn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cn(t,"threshold",10)),this.setVelocityThreshold(Cn(t,"velocityThreshold",1e3)),this.setDirectionMode(Cn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=kn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=kn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=bn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=xn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,yn);const kn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Dn:this.tracerState=An,this.onDrag1Start();break;case An:this.tracerState=Bn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],_n(this.pointers,e),this.tracerState){case An:this.tracerState=Dn,this.onDrag1End();break;case Bn:this.tracerState=An,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case An:this.onDrag1();break;case Bn:this.onDrag2()}}}dragCancel(){return this.tracerState===Bn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Bn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Bn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=zn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Ke);var Ln={};const Dn=0,An=1,Bn=2,zn="IDLE";Phaser.Utils.Objects.GetValue;const Wn=Phaser.Math.RotateAround;var Yn=function(t,e,i,s){return Wn(t,e,i,s),t.rotation+=s,t},In={};const jn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Vn=Phaser.Math.DegToRad;var Gn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=In),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=Xn(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Vn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Gn);const Un="IDLE",Nn="BEGIN",$n="RECOGNIZED",Kn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Kn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new an(this,e),this._tap.on("tap",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ir(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ir(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var ta=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ir(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ir(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const ea=Phaser.Utils.Objects.GetValue;var ia=function(t,e){return t.setInteractive(),ea(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:ea(e,"targets",[t]),targetMode:ea(e,"targetMode","parent"),eventEmitter:ea(e,"eventEmitter",t),eventNamePrefix:ea(e,"inputEventPrefix","child.")},Xr.call(t,e),Vr.call(t,e),Nr.call(t,e),qr.call(t,e),Jn.call(t,e),Zn.call(t,e),ta.call(t,e),t},sa={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=At(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(a=le(o,"align","left-top"))&&(a=Wt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ua=Phaser.Utils.Objects.IsPlainObject,pa=Phaser.Utils.Objects.GetValue,va=Phaser.Display.Align.CENTER,ga={min:0,full:-1};var fa=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=ga[e];else if(ua(e)){var f;e=pa(f=e,"proportion",void 0),i=pa(f,"align",va),s=pa(f,"padding",0),r=pa(f,"expand",!1),n=pa(f,"key",void 0),a=pa(f,"index",void 0),t.isRexSizer||(h=pa(f,"minWidth",void 0),o=pa(f,"minHeight",void 0)),l=pa(f,"fitRatio",0),d=pa(f,"offsetX",0),c=pa(f,"offsetY",0),u=pa(f,"offsetOriginX",0),p=pa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Wt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=va),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ma={add:fa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fa.call(this,new da(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ua(i)&&(i.index=t),fa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ca.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ya=Mt.prototype.clear;var ba=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ya.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ba.call(this,t),this}},wa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Wt[e]),this.getSizerConfig(t).align=e,this}},Sa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ka={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Pa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oa.call(this,t,void 0),We.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ie.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oa.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Pa,ma,Ca,wa,Sa,ka,Oa);var Ta=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ea=function(t){return"string"==typeof t&&(t=_a[t]),t};const Ma=Phaser.Utils.Objects.IsPlainObject,Ra=Phaser.Utils.Objects.GetValue;class La extends na{constructor(t,e,i,s,r,n,a){Ma(e)?(e=Ra(a=e,"x",0),i=Ra(a,"y",0),s=Ra(a,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ma(s)?(s=Ra(a=s,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ma(n)&&(n=Ra(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ra(a,"space.item",0)),this.setStartChildIndex(Ra(a,"startChildIndex",0)),this.setRTL(Ra(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ea(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ta.call(this)),this._childrenProportion}}Object.assign(La.prototype,Pa);var Da=function(t,e,i,s){return e/t<=i?e/(s-1):0},Aa=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},h=this.sizerChildren,o=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=h.length;ch.height/2)){r>(o=Ba(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=Ba(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const Wa=Phaser.Utils.Objects.IsPlainObject,Ya=Phaser.Utils.Objects.GetValue,Ia=Phaser.Display.Align.CENTER;var ja=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),Wa(e)&&(e=Ya(o=e,"padding",0),i=Ya(o,"key",void 0),s=Ya(o,"index",void 0),r=Ya(o,"offsetX",0),n=Ya(o,"offsetY",0),a=Ya(o,"offsetOriginX",0),h=Ya(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===h&&(h=0),(o=this.getSizerConfig(t)).align=Ia,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=a,o.alignOffsetOriginY=h,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,h,o},Xa={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ba.call(this,t),this}},Va={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(o.join("")),r},yh=0,bh=1,xh=2,Ch=0,wh=1,Sh=2,kh=/(?:\r\n|\r|\n)/;const Oh={none:Ch,word:wh,char:Sh,character:Sh,mix:3},Ph=Phaser.Renderer.WebGL.Utils;var Th={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Ph.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const _h=Phaser.Display.Color;var Eh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new _h);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Mh=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},Rh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Mh(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Lh=Phaser.Display.Canvas.CanvasPool,Dh=Phaser.GameObjects.GameObject,Ah=Phaser.Utils.String.UUID;let Bh=class extends Dh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Lh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Ah(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Lh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const zh=Phaser.GameObjects.Components;Phaser.Class.mixin(Bh,[zh.Alpha,zh.BlendMode,zh.Crop,zh.Depth,zh.Flip,zh.GetBounds,zh.Mask,zh.Origin,zh.Pipeline,zh.PostPipeline,zh.ScrollFactor,zh.Tint,zh.Transform,zh.Visible,Th,Eh,Rh]);var Wh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class Yh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Yh.prototype,Wh);var Ih={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const jh=Phaser.Math.RotateAround;var Xh;const Fh=Phaser.Geom.Rectangle;var Hh,Vh=function(t){void 0===Hh&&(Hh=new Fh);var e=t.drawTLX,i=t.drawTLY;return Hh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Hh};const Gh=Phaser.Math.RotateAround;var Uh,Nh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Uh&&(Uh={}),s=Uh),s.x=e,s.y=i,0!==t.rotation&&Gh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const $h=Phaser.GameObjects.Components.TransformMatrix;var Kh,Jh,qh={},Zh=function(t,e,i,s,r){var n=Nh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=qh);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Kh&&(Kh=new $h,Jh=new $h),t.parentContainer?t.getWorldTransformMatrix(Kh,Jh):Kh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Kh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Qh=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Zh(t,e,n,a,r)},to={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Xh&&(Xh={}),s=Xh),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&jh(s,0,0,-i.rotation),s}(t,e,this,!0);return Vh(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Qh(this.parent,this,t,e,i)}};Object.assign(to,Ih);const eo=Phaser.Math.DegToRad,io=Phaser.Math.RadToDeg,so=Phaser.Utils.Objects.GetValue;class ro extends Yh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return io(this._rotation)}set angle(t){this.rotation=eo(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=so(t,"width",void 0),i=so(t,"height",void 0),s=so(t,"scaleX",void 0),r=so(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ro.prototype,to);const no=Phaser.Utils.String.Pad;var ao=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${no(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ho=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const oo=Phaser.Utils.Objects.GetValue;let lo=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=oo(t,"x",0),i=oo(t,"y",0));var s=this.cornerRadius;s.tl=co(oo(t,"tl",void 0),e,i),s.tr=co(oo(t,"tr",void 0),e,i),s.bl=co(oo(t,"bl",void 0),e,i),s.br=co(oo(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){uo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){uo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){uo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){uo(this.cornerRadius.br,t)}};var co=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),po(t),t},uo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=oo(e,"x",0),t.y=oo(e,"y",0)),po(t)},po=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vo=Phaser.Math.DegToRad;var go=function(t){return!t.hasOwnProperty("convex")||t.convex},fo=function(t){return t.x>0&&t.y>0},mo=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,o,l,o,l,180,270,!1,a):mo(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,s-o,l,o,l,270,360,!1,a):mo(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,s-o,r-l,o,l,0,90,!1,a):mo(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,fo(h)?(o=h.x*g,l=h.y*f,go(h)?mo(t,o,r-l,o,l,90,180,!1,a):mo(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},bo=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),yo(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const xo=Phaser.Utils.Objects.GetValue;class Co extends ro{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(xo(e,"color",null),xo(e,"color2",null),xo(e,"horizontalGradient",!0)),this.setStroke(xo(e,"stroke",null),xo(e,"strokeThickness",2)),this.setCornerRadius(xo(e,"cornerRadius",0),xo(e,"cornerIteration",null))}set color(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ao(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ho("color2",t,this),ho("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ho("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ho("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){bo(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const wo=Phaser.Utils.Objects.GetValue;class So extends ro{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(wo(e,"color",null),wo(e,"color2",null),wo(e,"horizontalGradient",!0)),this.setStroke(wo(e,"stroke",null),wo(e,"strokeThickness",2))}set color(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ao(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ao(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,wo(t,"color2",null),wo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wo(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const ko=Phaser.Utils.Objects.GetValue;let Oo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(ko(t,"bold",!1)),this.setItalic(ko(t,"italic",!1)),this.setFontSize(ko(t,"fontSize","16px")),this.setFontFamily(ko(t,"fontFamily","Courier")),this.setColor(ko(t,"color","#fff")),this.setStrokeStyle(ko(t,"stroke",null),ko(t,"strokeThickness",0)),this.setShadow(ko(t,"shadowColor",null),ko(t,"shadowOffsetX",0),ko(t,"shadowOffsetY",0),ko(t,"shadowBlur",0)),this.setOffset(ko(t,"offsetX",0),ko(t,"offsetY",0)),this.setSpace(ko(t,"leftSpace",0),ko(t,"rightSpace",0)),this.setAlign(ko(t,"align",void 0)),this.setBackgroundColor(ko(t,"backgroundColor",null)),this.setBackgroundHeight(ko(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ko(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(ko(t,"backgroundLeftX",0)),this.setBackgroundRightX(ko(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ho("stroke",t,this),ho("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ho("shadowOffsetX",t,this),ho("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ao(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ao(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ao(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ao(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Po=Phaser.Utils.Array.Remove,To=Phaser.Utils.Array.Remove,_o="text",Eo="image",Mo="drawer",Ro="space",Lo="command";var Do=function(t){return t.type===_o&&"\n"===t.text},Ao=function(t){return t.type===_o&&"\f"===t.text},Bo=function(t){return t.type===_o};class zo extends ro{constructor(t,e,i){super(t,_o),this.updateTextFlag=!1,this.style=new Oo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var h=n-a;t.fillRect(s,h,r,a)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Wo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yo=Phaser.Display.Canvas.CanvasPool;var Io=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Yo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Yo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class jo extends ro{constructor(t,e,i){super(t,Eo),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Io(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Xo extends ro{constructor(t,e,i,s){super(t,Mo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Fo extends ro{constructor(t,e){super(t,Ro),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Ho extends Yh{constructor(t,e,i,s,r){super(t,Lo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Vo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Vo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Vo(t[i]));return e}var Go=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Uo={none:0,word:1,char:2,character:2,mix:3};var No=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=qo.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=qo.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Qo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Qo(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Qo(t,"wrapMode");void 0===c&&(c=Qo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Uo[c]);var u=Qo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Qo(t,"letterSpacing",0),v=Qo(t,"hAlign",0),g=Qo(t,"vAlign",0),f=Qo(t,"justifyPercentage",.25),m=Go({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=il(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=il(t,"maxLines",0);var h=0===i,o=il(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=il(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=il(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=il(t,"letterSpacing",0),p=il(t,"rtl",!0),v=il(t,"hAlign",p?2:0),g=il(t,"vAlign",0),f=Go({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,Y=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Le(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Po(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return To(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(_o);return null===i?i=new zo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Qh(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Tl=Phaser.Utils.Objects.GetFastValue;var _l={};class El{constructor(t){this.pools=Tl(t,"pools",_l)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Pl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Wl(t,r,e,i,n),h=0;h<=Al&&0!==a;h++){if((r+=a)<0){r=0;break}a=Wl(t,r,e,i,n)}return h===Al&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Yl(t,e,i),t},zl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Wl=function(t,e,i,s,r){var n,a=zl(t,e,r),h=zl(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},Yl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Il=Phaser.Utils.Objects.GetValue,jl=Phaser.Utils.Objects.GetValue;class Xl extends ih{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=jl(e,"background",void 0),r=jl(e,"icon",void 0),n=jl(e,"iconMask",void 0),a=jl(e,"text",void 0),h=jl(e,"action",void 0),o=jl(e,"actionMask",void 0),l=jl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:jl(e,"space.icon",0),top:jl(e,"space.iconTop",0),bottom:jl(e,"space.iconBottom",0),left:jl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:jl(e,"space.icon",0),left:jl(e,"space.iconLeft",0),right:jl(e,"space.iconRight",0),top:jl(e,"space.iconTop",0)});var d=jl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=oh.call(this,r,r,1)),!d){var c=jl(e,"iconSize",void 0);this.setIconSize(jl(e,"iconWidth",c),jl(e,"iconHeight",c))}}if(a){var u=jl(e,"wrapText",!1),p=jl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ph(t)){case 0:switch("string"==typeof e&&(e=Oh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=fh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Oh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Dl(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Il(e,"minWidth",0),s=Il(e,"minHeight",0),r=Il(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Bl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Bl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=jl(e,"space.text",0),m=jl(e,"expandTextWidth",!1),y=jl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,h&&(i={right:f}),g=y):(v=y?1:0,h&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(h&&(i=0===this.orientation?{top:jl(e,"space.actionTop",0),bottom:jl(e,"space.actionBottom",0),right:jl(e,"space.actionRight",0)}:{left:jl(e,"space.actionLeft",0),right:jl(e,"space.actionRight",0),bottom:jl(e,"space.actionBottom",0)},d=jl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=oh.call(this,h,h,1)),!d)){var b=jl(e,"actionSize");this.setActionSize(jl(e,"actionWidth",b),jl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}var Fl=Phaser.Renderer.WebGL.Utils,Hl=function(t,e,i,s,r,n){for(var a=Fl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},$l=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Kl=Phaser.Renderer.Canvas.SetTransform;var Jl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ul(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Hl(r,a,e,l,h,o),e.isStroked&&Gl(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Kl(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Zl.prototype,Jl);var Ql=function(t){return t.x>0&&t.y>0},td=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ed=Phaser.Math.DegToRad;var id=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=sc(t,"tl",0),this.radiusTR=sc(t,"tr",0),this.radiusBL=sc(t,"bl",0),this.radiusBR=sc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?id(e,e,e,e,180,270,!1,r,t):id(0,0,e,e,90,0,!0,r,t):td(0,0,t),(e=this.radiusTR)>0?this._convexTR?id(i-e,e,e,e,270,360,!1,r,t):id(i,0,e,e,180,90,!0,r,t):td(i,0,t),(e=this.radiusBR)>0?this._convexBR?id(i-e,s-e,e,e,0,90,!1,r,t):id(i,s,e,e,270,180,!0,r,t):td(i,s,t),(e=this.radiusBL)>0?this._convexBL?id(e,s-e,e,e,90,180,!1,r,t):id(0,s,e,e,360,270,!0,r,t):td(0,s,t),t.push(t[0],t[1]),jd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var nc=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const ac=Phaser.Utils.Objects.GetValue,hc=Phaser.Utils.Objects.IsPlainObject;class oc extends(Md(wd)){constructor(t,e,i,s,r,n,a,h){hc(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):hc(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):hc(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new ic).setName("trackFill")).addShape((new ic).setName("bar")).addShape((new ic).setName("trackStroke")),this.setTrackColor(ac(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ac(h,"trackStrokeThickness",2),ac(h,"trackStrokeColor",void 0)),this.setSkewX(ac(h,"skewX",0)),this.setRTL(ac(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var lc={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&nc(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),nc(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&nc(h,0,0,e,i,t)}};Object.assign(oc.prototype,lc);var dc=function(t){return null==t||""===t||0===t.length},cc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(dc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(dc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Vo(i),s=Vo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var k=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==k&&"number"!==k||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Ec(t)?(this.stretchMode.edge=Rc(Mc(t,"edge",0)),this.stretchMode.internal=Rc(Mc(t,"internal",0))):(t=Rc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Dc.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Bc=Phaser.Utils.Objects.IsPlainObject,zc=Phaser.Utils.Objects.GetValue,Wc=Phaser.GameObjects;var Yc=void 0,Ic=function(t,e){if(Yc||(Yc={},ei(t).events.once("destroy",(function(){for(var t in Yc)Yc[t].destroy();Yc=void 0}))),!Yc.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Wc[e](i)).setOrigin(0),Yc[e]=t}return Yc[e]};const jc=Phaser.GameObjects.RenderTexture;class Xc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Bc(i)?(i=zc(d=i,"x",0),s=zc(d,"y",0),r=zc(d,"width",1),n=zc(d,"height",1),a=zc(d,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(r)?(r=zc(d=r,"width",1),n=zc(d,"height",1),a=zc(d,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(a)?(a=zc(d=a,"key",void 0),h=zc(d,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Bc(h)?(h=zc(d=h,"baseFrame",void 0),o=zc(d,"columns",void 0),l=zc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=zc(d,"baseFrame",void 0)):Bc(o)&&(o=zc(d=o,"columns",void 0),l=zc(d,"rows",void 0)),void 0===h&&(h=zc(d,"frame",void 0)),void 0===o){var c=zc(d,"leftWidth",void 0),u=zc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=zc(d,"topHeight",void 0),v=zc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(zc(d,"getFrameNameCallback",void 0)),this.setStretchMode(zc(d,"stretchMode",0)),this.setPreserveRatio(zc(d,"preserveRatio",!0));var g=zc(d,"maxFixedPartScale",1),f=zc(d,"maxFixedPartScaleX",g),m=zc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ac),i}(jc,"rexNinePatch")){}var Fc={_drawImage:function(t,e,i,s,r,n){var a=Ic(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ic(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Xc.prototype,Fc);let Hc=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(vc(t,e))return t[e];var i=t.parent;return vc(i,e)?i[e]:void 0}set(t,e,i){return vc(t,e)?t[e]=i:vc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Vc=Phaser.Utils.Objects.GetValue;class Gc extends Xc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Vc(e,"effects",!0);i&&bc(this,i),this.style=new Hc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Gc.prototype,vd);const Uc=["alpha","tint","flipX","flipY"];var Nc=function(t,e){if(!e)return t;for(var i=0,s=Uc.length;i * @copyright 2018 Photon Storm Ltd. @@ -8,4 +8,4 @@ var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),pars * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var Vg=function(t,e){var i=yt(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},Gg=function(t,e,i){return $c(t,Vg(e,i))};class Ug extends Hs{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ng={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},$g=function(t,e){Wi.popUp.call(t,e,this.expandDirection)},Kg=function(t,e){Wi.scaleDown.call(t,e,this.expandDirection)},Jg={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=$g.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Kg.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const qg=Phaser.Utils.Objects.GetValue;let Zg=class extends La{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=qg(e,"space"),a=1===this.orientation?"left":"top",h=qg(e,"align.title",a),o=qg(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:qg(n,"titleLeft",0),right:qg(n,"titleRight",0),top:qg(n,"titleTop",0),bottom:qg(n,"titleBottom",0)}});var l=qg(e,"toggleByTarget",void 0),d=qg(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&Or.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Ug(r),!qg(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=qg(e,"align.child","left");var u=(o=qg(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:qg(n,"childLeft",0),right:qg(n,"childRight",0),top:qg(n,"childTop",0),bottom:qg(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(qg(p,"duration",200)),this.setExpandCallback(qg(p,"expandCallback",void 0)),this.setCollapseCallback(qg(p,"collapseCallback",void 0)),this.reLayoutTarget=qg(e,"reLayoutTarget",void 0);var v=e.onExpandStart;v&&this.on("expand.start",v);var g=e.onExpandComplete;g&&this.on("expand.complete",g);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=qg(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(Zg.prototype,Ng,Jg);var Qg={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},tf={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class ef extends Zg{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(ef.prototype,Qg,tf);const sf=Phaser.Utils.Objects.GetValue,rf=Phaser.Utils.Objects.GetValue,nf=La.prototype.add,af=La.prototype.addSpace;var hf=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&af.call(this),nf.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&af.call(this),this.hasTailSpace=s}else nf.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;nf.call(this,t,{index:r,proportion:i,expand:!0})}else nf.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},of={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)cf.call(this,e[i],t);return this}},pf=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},vf=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,pf.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},gf={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),vf.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&Tf.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Lf.call(this,e[i],t);return this}};const Af=Phaser.Utils.Objects.GetValue;class Bf extends Ka{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new wf({parent:this,eventEmitter:Af(e,"eventEmitter",this),groupName:Af(e,"groupName",void 0),clickConfig:Af(e,"click",void 0)}).setButtonsType(e);var s=Af(e,"background",void 0),r=Af(e,"buttons",void 0);this.buttonsAlign=Af(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Bf.prototype,Ef,Df,Cf,kf);var zf=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Wf[i])}void 0===s?s={}:!0===s&&(s=Yf);var n=e.width/t.width,a=e.height/t.height,h=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*h,s.height=t.height*h,s};const Wf={fit:0,FIT:0,envelop:1,ENVELOP:1};var Yf={},If={},jf={};const Xf=Phaser.Utils.Objects.IsPlainObject,Ff=Phaser.Utils.Objects.GetValue,Hf=Phaser.Display.Align.CENTER,Vf=Phaser.Utils.String.UUID;var Gf={add:function(t,e,i,s,r,n,a,h,o,l){var d,c;ye.call(this,t),Xf(e)&&(e=Ff(u=e,"key",void 0),i=Ff(u,"align",Hf),s=Ff(u,"padding",0),r=Ff(u,"expand",!0),t.isRexSizer||(n=Ff(u,"minWidth",t._minWidth),a=Ff(u,"minHeight",t._minHeighted)),h=Ff(u,"offsetX",0),o=Ff(u,"offsetY",0),d=Ff(u,"offsetOriginX",0),c=Ff(u,"offsetOriginY",0),l=Ff(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=Vf()),"string"==typeof i&&(i=Wt[i]),void 0===i&&(i=Hf),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===h&&(h=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=fe(s),Xf(r)?(u.expandWidth=Ff(r,"width",!1),u.expandHeight=Ff(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),u.alignOffsetX=h,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Uf={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ba.call(this,t),this}},Nf={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,h,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,yr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(If.width=e.aspectRatio,If.height=1,jf.width=l,jf.height=d,l=(c=zf(If,jf,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),aa(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,br.call(this,t,s,r,n,a,e.align,h,o))}};Object.assign(Nf,Gf,Uf);const $f=Phaser.Utils.Objects.IsPlainObject,Kf=Phaser.Utils.Objects.GetValue;class Jf extends na{constructor(t,e,i,s,r,n){$f(e)?(e=Kf(n=e,"x",0),i=Kf(n,"y",0),s=Kf(n,"width",void 0),r=Kf(n,"height",void 0)):$f(s)&&(s=Kf(n=s,"width",void 0),r=Kf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Jf.prototype,Nf);const qf=Jf.prototype.add;var Zf=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),qf.call(this,t,e,i,s,r,n,a,h,o),this},Qf={add:Zf,addPage:Zf};const tm=Mt.prototype.setChildVisible;var em={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(tm.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(tm.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(em,Qf);const im=Phaser.Utils.Objects.GetValue;class sm extends Jf{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(im(e,"swapMode",0)),this.setFadeInDuration(im(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=rm[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(sm.prototype,em);const rm={invisible:0,destroy:1},nm=Phaser.Utils.Objects.IsPlainObject,am=Phaser.Utils.Objects.GetValue,hm=Phaser.Utils.String.UUID;var om={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},lm={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},dm={top:1,left:3,right:5,bottom:7},cm={top:"bottom",left:"right",right:"left",bottom:"top"},um={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},pm={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Rm=Phaser.Utils.Objects.GetValue;class Lm extends La{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Rm(e,"background",void 0),s=Rm(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Rm(e,"space.title",0)}});var r=Rm(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Lm.prototype,Em,Mm);const Dm=Phaser.Utils.Objects.GetValue,Am=Phaser.Utils.Objects.GetValue;var Bm=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const zm=Phaser.Geom.Intersects.RectangleToRectangle,Wm=Phaser.Geom.Rectangle.Overlaps;var Ym=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Im=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},jm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Xm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Fm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Hm=Phaser.Utils.Objects.GetValue,Vm={update:0,everyTick:1};var Gm={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Hm(t,"updateMode",0)),this.enableChildrenMask(Hm(t,"padding",0)),this.setMaskLayer(Hm(t,"layer",void 0)),this.onMaskGameObjectVisible=Hm(t,"onVisible"),this.onMaskGameObjectInvisible=Hm(t,"onInvisible"),this.maskGameObjectCallbackScope=Hm(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Vm[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=oh.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,h,o,l=!!s||!!r,d=t.getBounds(),c=Bm(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Jm.prototype,Um);const qm=["top","bottom","centerY","center"],Zm=["left","right","centerX","center"];var Qm=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=qm.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=Zm.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const ty=Phaser.Utils.Objects.GetValue;class ey extends ag{constructor(t,e){void 0===e&&(e={});var i=Yp(e),s=ty(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ty(e,"clampChildOY",!1),s.clampChildOX=ty(e,"clampChildOX",!1);var r,n,a=new Jm(t,s);switch(t.add.existing(a),i){case 0:r=ty(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ty(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:ty(e,"align.panel","center")};var h=ty(e,"space",void 0);h&&(h.child=ty(h,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ia(this.childrenMap.child,t),this}}var iy={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Qm.call(this,t,"y",e);break;case 1:Qm.call(this,t,"x",e);break;default:Qm.call(this,t,"y",e),Qm.call(this,t,"x",e)}return this}};Object.assign(ey.prototype,iy);var sy={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},ry={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class ny extends ey{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(ny.prototype,sy,ry);const ay=Phaser.Utils.Objects.GetValue,hy=Phaser.Utils.Objects.GetValue,oy=Phaser.Utils.Objects.GetValue;var ly={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=oy(t,"onGetValue"),this.onSetValue=oy(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},dy={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},cy={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const uy=Phaser.Utils.Objects.GetValue;class py extends La{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=uy(e,"proportion.title",0),h=uy(e,"space.title",0);i=0===this.orientation?{right:h}:{bottom:h},this.add(s,{proportion:a,expand:!0,padding:i});var o=r.defaultProportion;void 0===o&&(o=e.defaultExpandWidth?1:0),a=uy(e,"proportion.inputField",o),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(py.prototype,ly,dy,cy);var vy=function(t,e,i){var s=new Eg(t,i);return t.add.existing(s),s},gy=function(t){return void 0===t&&(t=La),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},fy=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=wy(this.styles,"inputRow")||{},r=Cy(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return $c(t,Vg(e,i))}(this.scene,t,Sy(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),ky(this,Vo(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,h=t.drawY,o=a+t.drawTLX,l=a+t.drawTRX,d=h+t.drawTLY,c=h+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Ny(this),$y(this)),this}setNumberInput(){return this.onUpdateCallback=Uy,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const qy=Phaser.Utils.Objects.GetValue,Zy=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Qy=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(h,h+a.count));h+=a.count,a.added||(o+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}ab.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,h=t.length,o=1,l=a+h;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=h)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=h)return n(hb(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,h=a-s,o=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const ob=new ab,lb=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,db=/\S/,cb=new ab;cb.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!db.test(t)&&!db.test(e)},cb.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(gb(t,null,null,i),i," ")},vb.equals=function(t,e){return ab.prototype.equals.call(vb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const fb=new ab;fb.tokenize=function(t){return t.slice()},fb.join=fb.removeEmpty=function(t){return t};const mb=Phaser.Utils.Array.Remove;var yb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),mb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,ob.diff(o,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},Sb={cursorMoveLeft(){if(!this.isOpened)return this;var t=xb(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=xb(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Cb(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=xb(wb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Cb(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=xb(wb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const kb=Phaser.Utils.Objects.IsPlainObject;class Ob extends Ll{constructor(t,e,i,s,r,n){kb(e)?n=e:kb(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Qy(e,"wrap.vAlign")||cc(e,"wrap.vAlign",s=i?"center":"top"),Qy(e,"wrap.wrapMode")||cc(e,"wrap.wrapMode","char"),Qy(e,"wrap.maxLines")||cc(e,"wrap.maxLines",s=i?1:void 0),i&&cc(e,"wrap.wrapWidth",1/0),Qy(e,"wrap.useDefaultTextHeight")||cc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Qy(e.edit,"inputType")){var s=i?"text":"textarea";cc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new eb(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=od(n.background,"focus"),o=od(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=qy(e,"edit");return void 0===i&&(i={}),My(e,i,Zy),new Jy(t,i)}(this,n),ib.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),nb.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),rb.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=Tb(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},Eb={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Mb={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Rb=Phaser.Utils.Objects.GetValue;class Lb extends ag{constructor(t,e){void 0===e&&(e={});var i,s=Rb(e,"text");xt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new Ob(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,h,o=Rb(e,"space",void 0);o&&(o.child=Rb(o,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=h!==e;a=t,h=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=Rb(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(Lb.prototype,Eb,Mb);var Db={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?Vo(e):{}:e||(e={});var s=new Lb(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},Ab={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=Tb(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const Bb=Phaser.Utils.Objects.GetValue,zb=Phaser.Math.Linear,Wb=Phaser.Math.Snap.Floor;var Yb={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=Bb(s,r),a=function(t,e){var i=new Mv(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=Bb(e,"proportion.range.slider",h),l=void 0===n;t.add(a,{proportion:o,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=Tb(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=Bb(e,"proportion.range.inputText",h),t.add(c,{proportion:o,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=zb(t.minValue,t.maxValue,a.value);t.step&&(e=Wb(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Ib=function(t,e){var i=new Pf(t,e);return t.add.existing(i),i};const jb=Phaser.Utils.Objects.GetValue;var Xb={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=jb(e,"incDec")||{},r={text:null,action:null},n=Ib(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=Tb(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign(Vo(r),s.incButton||{}),d=xm(i,l),c=Object.assign(Vo(r),s.decButton||{}),u=xm(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,o,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Ax(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const zx=Phaser.Utils.Objects.GetValue;var Wx=function(t,e){var i=zx(e,"expandDirection",void 0);"string"==typeof i&&(i=Yx[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",Qy(s=e,r="alignTarget")?Ms(s,r):n&&Qy(s,n)?Ms(s,n):a&&Qy(s,a)?Ms(s,a):h),c=zx(e,"alignTargetY",d),u=zx(e,"alignOffsetX",0),p=zx(e,"alignOffsetY",0),v=zx(e,"alignSide","").includes("right"),g=zx(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,b=f||m?0:1;t.setOrigin(y,b),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=g;x||(x=At(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Yx={down:0,up:1},Ix=Phaser.Utils.Objects.GetValue;class jx extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Wx(t,e),t.isRexSizer&&t.layout();var i=Ix(e,"touchOutsideClose",!1),s=Ix(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Xx={openColorPicker:function(){if(!this.colorPicker){var t=Bx.call(this).layout(),e=new jx(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Xx,ex);const Fx=Phaser.Utils.Objects.GetValue;class Hx extends tx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Fx(i,"width",160),Fx(i,"height",170));var n=Fx(i,"background");r=n?function(t){return $c(t,n)}:Fx(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Fx(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Fx(i,"expandDirection")),this.setColorPickerEaseInDuration(Fx(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Fx(i,"easeOut",200)),this.setColorPickerTransitInCallback(Fx(i,"transitIn")),this.setColorPickerTransitOutCallback(Fx(i,"transitOut")),this.setColorPickerBounds(Fx(i,"bounds"));var a=Fx(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var h=e.colorComponents;if(s&&!1!==h&&null!==h){this.setColorComponentsHeight(Fx(h,"height",30)),this.setColorComponentsFormatLabelConfig(Fx(h,"formatLabel"));var o=Fx(h,"inputText");o||(o=Fx(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=Fx(h,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(Hx.prototype,Xx);var Vx={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?Vo(e):{}:e||(e={});var s=new Hx(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Gx={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Ux={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Nx={buildShapes(){this.addShape((new rc).setName("box")).addShape((new ic).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,h=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;o.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?o.setRadius(u/2):o.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,v=1*p,g=2*p,f=3*p;l.startAt(v,g).lineTo(g,f).lineTo(f,v).offset(r+d,n+d).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(h,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},$x={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new vs(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},Kx={};Object.assign(Kx,Gx,Ux,Nx,$x);const Jx=23730,qx=Phaser.Utils.Objects.GetValue,Zx=Phaser.Utils.Objects.IsPlainObject;class Qx extends wd{constructor(t,e,i,s,r,n,a){Zx(e)?(e=qx(a=e,"x",0),i=qx(a,"y",0),s=qx(a,"width",2),r=qx(a,"height",2),n=qx(a,"color",Jx)):Zx(n)&&(n=qx(a=n,"color",Jx)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Jx),this.setBoxShape(qx(a,"circleBox",!1)),this.setBoxFillStyle(n,qx(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(qx(a,"uncheckedColor",null),qx(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(qx(a,"boxLineWidth",4),qx(a,"boxStrokeColor",n),qx(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,qx(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),qx(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(qx(a,"checkerColor",16777215),qx(a,"checkerAlpha",1)),this.setBoxSize(qx(a,"boxSize",1)),this.setCheckerSize(qx(a,"checkerSize",1)),this.setCheckerAnimationDuration(qx(a,"animationDuration",150)),this.buildShapes();var h=qx(a,"checked");void 0===h&&(h=qx(a,"value",!1)),this.setValue(h)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(Qx.prototype,Kx);const tC=Phaser.Utils.Objects.GetValue,eC=Phaser.Utils.Objects.IsPlainObject;class iC extends Qx{constructor(t,e,i,s,r,n,a){eC(e)?(e=tC(a=e,"x",0),i=tC(a,"y",0),s=tC(a,"width",2),r=tC(a,"height",2),n=tC(a,"color",Jx)):eC(n)&&(n=tC(a=n,"color",Jx)),super(t,e,i,s,r,n,a),this._click=new Sr(this,tC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(tC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var sC={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new iC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},rC={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},nC={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},aC={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},hC=function(t,e,i){return(e-t)*i+t},oC=function(t){return t>>16&255},lC=function(t){return t>>8&255},dC=function(t){return 255&t};const cC=Phaser.Math.Linear;var uC={buildShapes(){this.addShape((new rc).setName("track")).addShape((new rc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,h=(e-n)/2,o=e*this.trackRadius;s.setTopLeftPosition(a,h).setSize(r,n).setRadius(o)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&hC(oC(l),oC(d),c))<<16|(255&hC(lC(l),lC(d),c))<<8|255&hC(dC(l),dC(d),c)),p=cC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var v=this.getShape("thumb");if(this.isSizeChanged){var g=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;v.setSize(g,f).setRadius(m)}var y=cC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;v.setCenterPosition(y,b),v.fillStyle(this.thumbColor,this.thumbAlpha)}},pC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new vs(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},vC={};Object.assign(vC,rC,nC,aC,uC,pC);const gC=Phaser.Utils.Objects.GetValue,fC=Phaser.Utils.Objects.IsPlainObject,mC=23730;class yC extends wd{constructor(t,e,i,s,r,n,a){fC(e)?(e=gC(a=e,"x",0),i=gC(a,"y",0),s=gC(a,"width",2),r=gC(a,"height",2),n=gC(a,"color",mC)):fC(n)&&(n=gC(a=n,"color",mC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=mC),this.setTrackFillStyle(n,gC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(gC(a,"falseValueTrackColor",function(t){var e=.3*oC(t)+.59*lC(t)+.11*dC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),gC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(gC(a,"thumbColor",16777215),gC(a,"thumbAlpha",1)),this.setTrackSize(gC(a,"trackWidth",.9),gC(a,"trackHeight",.5)),this.setTrackRadius(gC(a,"trackRadius",.5*this.trackHeight));var h=gC(a,"thumbHeight",void 0),o=gC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(gC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(gC(a,"thumbLeft",.3),gC(a,"thumbRight",void 0)),this.setRTL(gC(a,"rtl",!1)),this.setToggleAnimationDuration(gC(a,"animationDuration",150)),this.buildShapes(),this.setValue(gC(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(yC.prototype,vC);const bC=Phaser.Utils.Objects.GetValue;class xC extends yC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new Sr(this,bC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(bC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var CC={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new xC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},wC={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=SC[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const SC={down:0,up:1},kC=Phaser.Utils.Objects.GetValue;var OC=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,h=n.length;a0||this.listMaxHeight>0)){if(s=PC(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=TC(e,this.listCreateSliderTrackCallback),v=TC(e,this.listCreateSliderThumbCallback);d=new ey(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:kC(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=PC(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},PC=function(t,e,i){var s;return i?(e.orientation="x",s=new Bf(t,e)):(e.orientation="y",s=new Pf(t,e)),t.add.existing(s),s},TC=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},_C={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},EC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=OC.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new jx(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(EC,wC,_C);const MC=Phaser.Utils.Objects.GetValue;class RC extends Xl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(MC(e,"options"));var i=MC(e,"list");this.setWrapEnable(MC(i,"wrap",!1)),this.setCreateButtonCallback(MC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(MC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(MC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(MC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(MC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(MC(i,"scroller")),this.setListMouseWheelScrollerConfig(MC(i,"mouseWheelScroller")),this.setButtonClickCallback(MC(i,"onButtonClick")),this.setButtonOverCallback(MC(i,"onButtonOver")),this.setButtonOutCallback(MC(i,"onButtonOut")),this.setListExpandDirection(MC(i,"expandDirection")),this.setListEaseInDuration(MC(i,"easeIn",500)),this.setListEaseOutDuration(MC(i,"easeOut",100)),this.setListTransitInCallback(MC(i,"transitIn")),this.settListTransitOutCallback(MC(i,"transitOut")),this.setListMaxHeight(MC(i,"maxHeight",0)),this.setListSize(MC(i,"width"),MC(i,"height",0)),this.setListAlignmentMode(MC(i,"alignParent","text")),this.setListAlignmentSide(MC(i,"alignSide","")),this.setListBounds(MC(i,"bounds")),this.setListSpace(MC(i,"space")),this.setListDraggable(MC(i,"draggable",!1)),this.setValueChangeCallback(MC(e,"setValueCallback"),MC(e,"setValueCallbackScope")),this.setValue(MC(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(RC.prototype,EC);var LC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?Vo(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,h=_g(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=xm(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(h.list.createTrackCallback=function(t){return $c(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return $c(t,l)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h}(t,e);var i=new RC(t,e);return t.add.existing(i),i},DC=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=LC(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=DC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const BC=Phaser.Utils.Objects.GetValue;var zC={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?Vo(e.button):{},r=BC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=Ib(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n=0;i--)cf.call(this,e[i],t);return this}},pf=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},vf=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,pf.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},gf={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),vf.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&Tf.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Lf.call(this,e[i],t);return this}};const Af=Phaser.Utils.Objects.GetValue;class Bf extends Ka{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new wf({parent:this,eventEmitter:Af(e,"eventEmitter",this),groupName:Af(e,"groupName",void 0),clickConfig:Af(e,"click",void 0)}).setButtonsType(e);var s=Af(e,"background",void 0),r=Af(e,"buttons",void 0);this.buttonsAlign=Af(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Bf.prototype,Ef,Df,Cf,kf);var zf=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Wf[i])}void 0===s?s={}:!0===s&&(s=Yf);var n=e.width/t.width,a=e.height/t.height,h=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*h,s.height=t.height*h,s};const Wf={fit:0,FIT:0,envelop:1,ENVELOP:1};var Yf={},If={},jf={};const Xf=Phaser.Utils.Objects.IsPlainObject,Ff=Phaser.Utils.Objects.GetValue,Hf=Phaser.Display.Align.CENTER,Vf=Phaser.Utils.String.UUID;var Gf={add:function(t,e,i,s,r,n,a,h,o,l){var d,c;ye.call(this,t),Xf(e)&&(e=Ff(u=e,"key",void 0),i=Ff(u,"align",Hf),s=Ff(u,"padding",0),r=Ff(u,"expand",!0),t.isRexSizer||(n=Ff(u,"minWidth",t._minWidth),a=Ff(u,"minHeight",t._minHeighted)),h=Ff(u,"offsetX",0),o=Ff(u,"offsetY",0),d=Ff(u,"offsetOriginX",0),c=Ff(u,"offsetOriginY",0),l=Ff(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=Vf()),"string"==typeof i&&(i=Wt[i]),void 0===i&&(i=Hf),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===h&&(h=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=fe(s),Xf(r)?(u.expandWidth=Ff(r,"width",!1),u.expandHeight=Ff(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),u.alignOffsetX=h,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Uf={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ba.call(this,t),this}},Nf={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,h,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,yr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(If.width=e.aspectRatio,If.height=1,jf.width=l,jf.height=d,l=(c=zf(If,jf,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),aa(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,br.call(this,t,s,r,n,a,e.align,h,o))}};Object.assign(Nf,Gf,Uf);const $f=Phaser.Utils.Objects.IsPlainObject,Kf=Phaser.Utils.Objects.GetValue;class Jf extends na{constructor(t,e,i,s,r,n){$f(e)?(e=Kf(n=e,"x",0),i=Kf(n,"y",0),s=Kf(n,"width",void 0),r=Kf(n,"height",void 0)):$f(s)&&(s=Kf(n=s,"width",void 0),r=Kf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Jf.prototype,Nf);const qf=Jf.prototype.add;var Zf=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),qf.call(this,t,e,i,s,r,n,a,h,o),this},Qf={add:Zf,addPage:Zf};const tm=Mt.prototype.setChildVisible;var em={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(tm.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(tm.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(em,Qf);const im=Phaser.Utils.Objects.GetValue;class sm extends Jf{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(im(e,"swapMode",0)),this.setFadeInDuration(im(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=rm[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(sm.prototype,em);const rm={invisible:0,destroy:1},nm=Phaser.Utils.Objects.IsPlainObject,am=Phaser.Utils.Objects.GetValue,hm=Phaser.Utils.String.UUID;var om={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},lm={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},dm={top:1,left:3,right:5,bottom:7},cm={top:"bottom",left:"right",right:"left",bottom:"top"},um={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},pm={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Rm=Phaser.Utils.Objects.GetValue;class Lm extends La{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Rm(e,"background",void 0),s=Rm(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Rm(e,"space.title",0)}});var r=Rm(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Lm.prototype,Em,Mm);const Dm=Phaser.Utils.Objects.GetValue,Am=Phaser.Utils.Objects.GetValue;var Bm=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const zm=Phaser.Geom.Intersects.RectangleToRectangle,Wm=Phaser.Geom.Rectangle.Overlaps;var Ym=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Im=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},jm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Xm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Fm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Hm=Phaser.Utils.Objects.GetValue,Vm={update:0,everyTick:1};var Gm={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Hm(t,"updateMode",0)),this.enableChildrenMask(Hm(t,"padding",0)),this.setMaskLayer(Hm(t,"layer",void 0)),this.onMaskGameObjectVisible=Hm(t,"onVisible"),this.onMaskGameObjectInvisible=Hm(t,"onInvisible"),this.maskGameObjectCallbackScope=Hm(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Vm[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=oh.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,h,o,l=!!s||!!r,d=t.getBounds(),c=Bm(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Jm.prototype,Um);const qm=["top","bottom","centerY","center"],Zm=["left","right","centerX","center"];var Qm=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=qm.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=Zm.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const ty=Phaser.Utils.Objects.GetValue;class ey extends ag{constructor(t,e){void 0===e&&(e={});var i=Yp(e),s=ty(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ty(e,"clampChildOY",!1),s.clampChildOX=ty(e,"clampChildOX",!1);var r,n,a=new Jm(t,s);switch(t.add.existing(a),i){case 0:r=ty(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ty(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:ty(e,"align.panel","center")};var h=ty(e,"space",void 0);h&&(h.child=ty(h,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ia(this.childrenMap.child,t),this}}var iy={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Qm.call(this,t,"y",e);break;case 1:Qm.call(this,t,"x",e);break;default:Qm.call(this,t,"y",e),Qm.call(this,t,"x",e)}return this}};Object.assign(ey.prototype,iy);var sy={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},ry={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class ny extends ey{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(ny.prototype,sy,ry);const ay=Phaser.Utils.Objects.GetValue,hy=Phaser.Utils.Objects.GetValue,oy=Phaser.Utils.Objects.GetValue;var ly={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=oy(t,"onGetValue"),this.onSetValue=oy(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},dy={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},cy={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const uy=Phaser.Utils.Objects.GetValue;class py extends La{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=uy(e,"proportion.title",0),h=uy(e,"space.title",0);i=0===this.orientation?{right:h}:{bottom:h},this.add(s,{proportion:a,expand:!0,padding:i});var o=r.defaultProportion;void 0===o&&(o=e.defaultExpandWidth?1:0),a=uy(e,"proportion.inputField",o),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(py.prototype,ly,dy,cy);var vy=function(t,e,i){var s=new Eg(t,i);return t.add.existing(s),s},gy=function(t){return void 0===t&&(t=La),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},fy=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=wy(this.styles,"inputRow")||{},r=Cy(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return $c(t,Vg(e,i))}(this.scene,t,Sy(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),ky(this,Vo(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,h=t.drawY,o=a+t.drawTLX,l=a+t.drawTRX,d=h+t.drawTLY,c=h+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Ny(this),$y(this)),this}setNumberInput(){return this.onUpdateCallback=Uy,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const qy=Phaser.Utils.Objects.GetValue,Zy=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Qy=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(h,h+a.count));h+=a.count,a.added||(o+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}hb.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,h=t.length,o=1,l=a+h;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=h)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=h)return n(ob(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,h=a-s,o=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const lb=new hb,db=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,cb=/\S/,ub=new hb;ub.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!cb.test(t)&&!cb.test(e)},ub.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(fb(t,null,null,i),i," ")},gb.equals=function(t,e){return hb.prototype.equals.call(gb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const mb=new hb;mb.tokenize=function(t){return t.slice()},mb.join=mb.removeEmpty=function(t){return t};const yb=Phaser.Utils.Array.Remove;var bb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),yb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,lb.diff(o,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},kb={cursorMoveLeft(){if(!this.isOpened)return this;var t=Cb(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Cb(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=wb(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Cb(Sb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=wb(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Cb(Sb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Ob=Phaser.Utils.Objects.IsPlainObject;class Pb extends Ll{constructor(t,e,i,s,r,n){Ob(e)?n=e:Ob(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Qy(e,"wrap.vAlign")||cc(e,"wrap.vAlign",s=i?"center":"top"),Qy(e,"wrap.wrapMode")||cc(e,"wrap.wrapMode","char"),Qy(e,"wrap.maxLines")||cc(e,"wrap.maxLines",s=i?1:void 0),i&&cc(e,"wrap.wrapWidth",1/0),Qy(e,"wrap.useDefaultTextHeight")||cc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Qy(e.edit,"inputType")){var s=i?"text":"textarea";cc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new eb(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=od(n.background,"focus"),o=od(n.style,"cursor"),l=od(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=qy(e,"edit");return void 0===i&&(i={}),My(e,i,Zy),new Jy(t,i)}(this,n),ib.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),ab.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),rb.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),sb(l)&&Object.assign(l,o),nb.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=_b(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},Mb={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Rb={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Lb=Phaser.Utils.Objects.GetValue;class Db extends ag{constructor(t,e){void 0===e&&(e={});var i,s=Lb(e,"text");xt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new Pb(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,h,o=Lb(e,"space",void 0);o&&(o.child=Lb(o,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=h!==e;a=t,h=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=Lb(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(Db.prototype,Mb,Rb);var Ab={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?Vo(e):{}:e||(e={});var s=new Db(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},Bb={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=_b(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const zb=Phaser.Utils.Objects.GetValue,Wb=Phaser.Math.Linear,Yb=Phaser.Math.Snap.Floor;var Ib={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=zb(s,r),a=function(t,e){var i=new Mv(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=zb(e,"proportion.range.slider",h),l=void 0===n;t.add(a,{proportion:o,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=_b(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=zb(e,"proportion.range.inputText",h),t.add(c,{proportion:o,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=Wb(t.minValue,t.maxValue,a.value);t.step&&(e=Yb(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},jb=function(t,e){var i=new Pf(t,e);return t.add.existing(i),i};const Xb=Phaser.Utils.Objects.GetValue;var Fb={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=Xb(e,"incDec")||{},r={text:null,action:null},n=jb(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=_b(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign(Vo(r),s.incButton||{}),d=xm(i,l),c=Object.assign(Vo(r),s.decButton||{}),u=xm(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,o,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Bx(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const Wx=Phaser.Utils.Objects.GetValue;var Yx=function(t,e){var i=Wx(e,"expandDirection",void 0);"string"==typeof i&&(i=Ix[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",Qy(s=e,r="alignTarget")?Ms(s,r):n&&Qy(s,n)?Ms(s,n):a&&Qy(s,a)?Ms(s,a):h),c=Wx(e,"alignTargetY",d),u=Wx(e,"alignOffsetX",0),p=Wx(e,"alignOffsetY",0),v=Wx(e,"alignSide","").includes("right"),g=Wx(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,b=f||m?0:1;t.setOrigin(y,b),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=g;x||(x=At(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Ix={down:0,up:1},jx=Phaser.Utils.Objects.GetValue;class Xx extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Yx(t,e),t.isRexSizer&&t.layout();var i=jx(e,"touchOutsideClose",!1),s=jx(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Fx={openColorPicker:function(){if(!this.colorPicker){var t=zx.call(this).layout(),e=new Xx(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Fx,ix);const Hx=Phaser.Utils.Objects.GetValue;class Vx extends ex{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Hx(i,"width",160),Hx(i,"height",170));var n=Hx(i,"background");r=n?function(t){return $c(t,n)}:Hx(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Hx(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Hx(i,"expandDirection")),this.setColorPickerEaseInDuration(Hx(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Hx(i,"easeOut",200)),this.setColorPickerTransitInCallback(Hx(i,"transitIn")),this.setColorPickerTransitOutCallback(Hx(i,"transitOut")),this.setColorPickerBounds(Hx(i,"bounds"));var a=Hx(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var h=e.colorComponents;if(s&&!1!==h&&null!==h){this.setColorComponentsHeight(Hx(h,"height",30)),this.setColorComponentsFormatLabelConfig(Hx(h,"formatLabel"));var o=Hx(h,"inputText");o||(o=Hx(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=Hx(h,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(Vx.prototype,Fx);var Gx={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?Vo(e):{}:e||(e={});var s=new Vx(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Ux={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Nx={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},$x={buildShapes(){this.addShape((new rc).setName("box")).addShape((new ic).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,h=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;o.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?o.setRadius(u/2):o.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,v=1*p,g=2*p,f=3*p;l.startAt(v,g).lineTo(g,f).lineTo(f,v).offset(r+d,n+d).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(h,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},Kx={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new vs(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},Jx={};Object.assign(Jx,Ux,Nx,$x,Kx);const qx=23730,Zx=Phaser.Utils.Objects.GetValue,Qx=Phaser.Utils.Objects.IsPlainObject;class tC extends wd{constructor(t,e,i,s,r,n,a){Qx(e)?(e=Zx(a=e,"x",0),i=Zx(a,"y",0),s=Zx(a,"width",2),r=Zx(a,"height",2),n=Zx(a,"color",qx)):Qx(n)&&(n=Zx(a=n,"color",qx)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=qx),this.setBoxShape(Zx(a,"circleBox",!1)),this.setBoxFillStyle(n,Zx(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(Zx(a,"uncheckedColor",null),Zx(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(Zx(a,"boxLineWidth",4),Zx(a,"boxStrokeColor",n),Zx(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,Zx(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),Zx(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(Zx(a,"checkerColor",16777215),Zx(a,"checkerAlpha",1)),this.setBoxSize(Zx(a,"boxSize",1)),this.setCheckerSize(Zx(a,"checkerSize",1)),this.setCheckerAnimationDuration(Zx(a,"animationDuration",150)),this.buildShapes();var h=Zx(a,"checked");void 0===h&&(h=Zx(a,"value",!1)),this.setValue(h)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(tC.prototype,Jx);const eC=Phaser.Utils.Objects.GetValue,iC=Phaser.Utils.Objects.IsPlainObject;class sC extends tC{constructor(t,e,i,s,r,n,a){iC(e)?(e=eC(a=e,"x",0),i=eC(a,"y",0),s=eC(a,"width",2),r=eC(a,"height",2),n=eC(a,"color",qx)):iC(n)&&(n=eC(a=n,"color",qx)),super(t,e,i,s,r,n,a),this._click=new Sr(this,eC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(eC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var rC={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new sC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},nC={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},aC={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},hC={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},oC=function(t,e,i){return(e-t)*i+t},lC=function(t){return t>>16&255},dC=function(t){return t>>8&255},cC=function(t){return 255&t};const uC=Phaser.Math.Linear;var pC={buildShapes(){this.addShape((new rc).setName("track")).addShape((new rc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,h=(e-n)/2,o=e*this.trackRadius;s.setTopLeftPosition(a,h).setSize(r,n).setRadius(o)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&oC(lC(l),lC(d),c))<<16|(255&oC(dC(l),dC(d),c))<<8|255&oC(cC(l),cC(d),c)),p=uC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var v=this.getShape("thumb");if(this.isSizeChanged){var g=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;v.setSize(g,f).setRadius(m)}var y=uC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;v.setCenterPosition(y,b),v.fillStyle(this.thumbColor,this.thumbAlpha)}},vC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new vs(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},gC={};Object.assign(gC,nC,aC,hC,pC,vC);const fC=Phaser.Utils.Objects.GetValue,mC=Phaser.Utils.Objects.IsPlainObject,yC=23730;class bC extends wd{constructor(t,e,i,s,r,n,a){mC(e)?(e=fC(a=e,"x",0),i=fC(a,"y",0),s=fC(a,"width",2),r=fC(a,"height",2),n=fC(a,"color",yC)):mC(n)&&(n=fC(a=n,"color",yC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=yC),this.setTrackFillStyle(n,fC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(fC(a,"falseValueTrackColor",function(t){var e=.3*lC(t)+.59*dC(t)+.11*cC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),fC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(fC(a,"thumbColor",16777215),fC(a,"thumbAlpha",1)),this.setTrackSize(fC(a,"trackWidth",.9),fC(a,"trackHeight",.5)),this.setTrackRadius(fC(a,"trackRadius",.5*this.trackHeight));var h=fC(a,"thumbHeight",void 0),o=fC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(fC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(fC(a,"thumbLeft",.3),fC(a,"thumbRight",void 0)),this.setRTL(fC(a,"rtl",!1)),this.setToggleAnimationDuration(fC(a,"animationDuration",150)),this.buildShapes(),this.setValue(fC(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(bC.prototype,gC);const xC=Phaser.Utils.Objects.GetValue;class CC extends bC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new Sr(this,xC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(xC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var wC={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new CC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},SC={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=kC[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const kC={down:0,up:1},OC=Phaser.Utils.Objects.GetValue;var PC=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,h=n.length;a0||this.listMaxHeight>0)){if(s=TC(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=_C(e,this.listCreateSliderTrackCallback),v=_C(e,this.listCreateSliderThumbCallback);d=new ey(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:OC(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=TC(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},TC=function(t,e,i){var s;return i?(e.orientation="x",s=new Bf(t,e)):(e.orientation="y",s=new Pf(t,e)),t.add.existing(s),s},_C=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},EC={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},MC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=PC.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Xx(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(MC,SC,EC);const RC=Phaser.Utils.Objects.GetValue;class LC extends Xl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(RC(e,"options"));var i=RC(e,"list");this.setWrapEnable(RC(i,"wrap",!1)),this.setCreateButtonCallback(RC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(RC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(RC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(RC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(RC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(RC(i,"scroller")),this.setListMouseWheelScrollerConfig(RC(i,"mouseWheelScroller")),this.setButtonClickCallback(RC(i,"onButtonClick")),this.setButtonOverCallback(RC(i,"onButtonOver")),this.setButtonOutCallback(RC(i,"onButtonOut")),this.setListExpandDirection(RC(i,"expandDirection")),this.setListEaseInDuration(RC(i,"easeIn",500)),this.setListEaseOutDuration(RC(i,"easeOut",100)),this.setListTransitInCallback(RC(i,"transitIn")),this.settListTransitOutCallback(RC(i,"transitOut")),this.setListMaxHeight(RC(i,"maxHeight",0)),this.setListSize(RC(i,"width"),RC(i,"height",0)),this.setListAlignmentMode(RC(i,"alignParent","text")),this.setListAlignmentSide(RC(i,"alignSide","")),this.setListBounds(RC(i,"bounds")),this.setListSpace(RC(i,"space")),this.setListDraggable(RC(i,"draggable",!1)),this.setValueChangeCallback(RC(e,"setValueCallback"),RC(e,"setValueCallbackScope")),this.setValue(RC(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(LC.prototype,MC);var DC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?Vo(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,h=_g(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=xm(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(h.list.createTrackCallback=function(t){return $c(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return $c(t,l)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h}(t,e);var i=new LC(t,e);return t.add.existing(i),i},AC=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=DC(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=AC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const zC=Phaser.Utils.Objects.GetValue;var WC={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?Vo(e.button):{},r=zC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=jb(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n 0) { + var bottomY = textStyle.backgroundBottomY; + if (bottomY == null) { + bottomY = this.drawBLY; + } + var height = textStyle.backgroundHeight; + if (height == null) { + height = bottomY - this.drawTLY; + } + var y = bottomY - height; - context.fillRect(x, y, width, height); + context.fillRect(x, y, width, height); + } } var hasFill = textStyle.hasFill, @@ -23916,7 +23938,7 @@ var child = textObject.getCharChild(i); if (child) { - var eventName = (inPrevSelectionRange) ? 'cursorout' : 'cursorin'; + var eventName = (inPrevSelectionRange) ? 'rangeout' : 'rangein'; textObject.emit(eventName, child, i, textObject); } } @@ -24477,6 +24499,33 @@ }, this); }; + var RegisterRangeStyle = function (rangeStyle) { + if (IsEmpty(rangeStyle)) { + return; + } + + this + .setRangeStyle(rangeStyle) + .on('rangein', function (child) { + var rangeStyle = this.rangeStyle; + var styleSave = GetPartialData(child.style, rangeStyle); + if (IsKeyValueEqual(rangeStyle, styleSave)) { + return; + } + + child.styleSave = styleSave; + child.modifyStyle(rangeStyle); + }, this) + .on('rangeout', function (child) { + if (!child.styleSave) { + return; + } + + child.modifyStyle(child.styleSave); + child.styleSave = undefined; + }, this); + }; + var RegisterFocusStyle = function (focusStyle) { if (IsEmpty(focusStyle)) { return; @@ -25125,6 +25174,7 @@ var focusStyle = ExtractByPrefix(config.background, 'focus'); var cursorStyle = ExtractByPrefix(config.style, 'cursor'); + var rangeStyle = ExtractByPrefix(config.style, 'range'); super(scene, x, y, fixedWidth, fixedHeight, config); this.type = 'rexCanvasInput'; @@ -25152,19 +25202,41 @@ } RegisterCursorStyle.call(this, cursorStyle); + if (config.rangeStyle) { + Object.assign(rangeStyle, config.rangeStyle); + } + if (IsEmpty(rangeStyle)) { + Object.assign(rangeStyle, cursorStyle); + } + RegisterRangeStyle.call(this, rangeStyle); + + var addCharCallback = config.onAddChar; if (addCharCallback) { this.on('addchar', addCharCallback); } + var cursorInCallback = config.onCursorIn; + if (cursorInCallback) { + this.on('cursorin', cursorInCallback); + } + var cursorOutCallback = config.onCursorOut; if (cursorOutCallback) { this.on('cursorout', cursorOutCallback); } - var cursorInCallback = config.onCursorIn; - if (cursorInCallback) { - this.on('cursorin', cursorInCallback); + + var useCursorCallback = !config.onRangeIn && !config.onRangeOut; + var rangeInCallback = (!useCursorCallback) ? config.onRangeIn : config.onCursorIn; + if (rangeInCallback) { + this.on('rangein', rangeInCallback); } + + var rangeOutCallback = (!useCursorCallback) ? config.onRangeOut : config.onCursorOut; + if (rangeOutCallback) { + this.on('rangeout', rangeOutCallback); + } + var moveCursorCallback = config.onMoveCursor; if (moveCursorCallback) { this.on('movecursor', moveCursorCallback); @@ -25359,6 +25431,11 @@ return this; } + setRangeStyle(style) { + this.rangeStyle = style; + return this; + } + setNumberInput() { this.textEdit .setNumberInput() diff --git a/dist/rexuiplugin.min.js b/dist/rexuiplugin.min.js index 387bdf9a44..f6e6eaba45 100644 --- a/dist/rexuiplugin.min.js +++ b/dist/rexuiplugin.min.js @@ -1,11 +1,11 @@ -var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,t.events.once("destroy",this.destroy,this)}destroy(){this.scene=null}static register(e,i){t.prototype[e]=i}}var e=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};function i(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>i(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let s in t)t.hasOwnProperty(s)&&(e[s]=i(t[s]));return e}const s=Phaser.Utils.Objects.IsPlainObject,r=Phaser.Utils.Objects.GetValue;var n=function(t){return"string"==typeof t&&(t=a[t]),t};const a={scale:0,repeat:1};var o=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},h=function(){},l={_beginDraw:h,_drawImage:h,_drawTileSprite:h,_endDraw:h,setGetFrameNameCallback:function(t){return void 0===t&&(t=e),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,s,r){Array.isArray(e)&&(r=s,s=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof s&&arguments.length>=6?(s=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):void 0===s&&void 0===r&&void 0!==this.columns.data&&void 0!==this.rows.data?(s=this.columns.data,r=this.rows.data):(s=i(s),r=i(r)),this.textureKey=t,this.baseFrameName=e,this.columns.data=s,this.columns.count=s?s.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=r,this.rows.count=r?r.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var n=this.scene.sys.textures.get(t);if(!n)return this.clear(),this;if(!s||!r)return this.clear(),this;for(var a=n.get(e),o=a.width,h=0,l=0,d=s.length;l0?o/h:0,u=a.height,p=0;for(l=0,d=r.length;l0?0:f,x=0,l=0;for(var S=s.length;l0?0:m),m>=1&&f>=1){var P=typeof(y=this.getFrameNameCallback(l,k,e));"string"!==P&&"number"!==P||n.add(y,0,x+a.cutX,C+a.cutY,m,f)}x+=m}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(u,p);if(u>g){var v=(u-g)*h;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return s(t)?(this.stretchMode.edge=n(r(t,"edge",0)),this.stretchMode.internal=n(r(t,"internal",0))):(t=n(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return o.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const d=Phaser.Utils.Objects.IsPlainObject,c=Phaser.Utils.Objects.GetValue;var u=function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(d(i)?(i=c(u=i,"x",0),s=c(u,"y",0),r=c(u,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(r)?(r=c(u=r,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(a)?(a=c(u=a,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(o)?(o=c(u=o,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=c(u,"baseFrame",void 0)):d(h)&&(h=c(u=h,"columns",void 0),l=c(u,"rows",void 0)),void 0===o&&(o=c(u,"frame",void 0)),void 0===h){var p=c(u,"leftWidth",void 0),g=c(u,"rightWidth",void 0);void 0!==p&&void 0!==g&&(h=[p,void 0,g])}if(void 0===l){var v=c(u,"topHeight",void 0),f=c(u,"bottomHeight",void 0);void 0!==v&&void 0!==f&&(l=[v,void 0,f])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(c(u,"getFrameNameCallback",void 0)),this.setStretchMode(c(u,"stretchMode",0)),this.setPreserveRatio(c(u,"preserveRatio",!0));var m=c(u,"maxFixedPartScale",1),y=c(u,"maxFixedPartScaleX",m),b=c(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(y,b),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,l),i};const p=Phaser.Game;var g=function(t){return t instanceof p};const v=Phaser.Scene;var f=function(t){return t instanceof v},m=function(t){return null==t||"object"!=typeof t?null:g(t)?t:g(t.game)?t.game:f(t)?t.sys.game:f(t.scene)?t.scene.sys.game:void 0};const y=Phaser.GameObjects;var b=void 0,x=function(t,e){if(b||(b={},m(t).events.once("destroy",(function(){for(var t in b)b[t].destroy();b=void 0}))),!b.hasOwnProperty(e)){var i=m(t).scene.systemScene;(t=new y[e](i)).setOrigin(0),b[e]=t}return b[e]};const C=Phaser.GameObjects.RenderTexture;let k=class extends(u(C,"rexNinePatch")){};var w={_drawImage:function(t,e,i,s,r,n){var a=x(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=x(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(k.prototype,w);var S=function(t){return null==t||""===t||0===t.length},P=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(S(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(S(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const D=Phaser.Utils.Objects.GetValue;var A={};let j=class{constructor(t){this.pools=D(t,"pools",A)}destroy(){this.pools=void 0}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new I),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0},N=function(t,e){return t._depth-e._depth};const $=Phaser.GameObjects.Components;Phaser.Class.mixin(H,[$.Alpha,$.BlendMode,$.ComputedSize,$.Depth,$.GetBounds,$.Mask,$.Origin,$.Pipeline,$.PostPipeline,$.ScrollFactor,$.Transform,$.Visible,M,B]);const K="image";var J=function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,n=i,a=0;a0&&!ot(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}setFlipX(t){return void 0===t&&(t=!0),this.flipX=t,this}setFlipY(t){return void 0===t&&(t=!0),this.flipY=t,this}resetFlip(){return this.flipX=!1,this.flipY=!1,this}get tint(){return void 0===this._tint?this.parent.tint:this._tint}set tint(t){this._tint=t}setTint(t){return this.tint=t,this.tintFill=!1,this}setTintFill(t){return this.tint=t,this.tintFill=!0,this}clearTint(){return this.setTint(16777215),this}resetTint(){return this.tint=void 0,this.tintFill=void 0,this}get tintFill(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill}set tintFill(t){this._tintFill=t}reset(){return super.reset(),this.resetFlip().resetTint().setFrame(),this}modifyPorperties(t){return t?(t.hasOwnProperty("width")&&(t.displayWidth=t.width,delete t.width),t.hasOwnProperty("height")&&(t.displayHeight=t.height,delete t.height),t.hasOwnProperty("frame")&&this.setFrame(t.frame),super.modifyPorperties(t),t.hasOwnProperty("flipX")&&this.setFlipX(t.flipX),t.hasOwnProperty("flipY")&&this.setFlipY(t.flipY),t.hasOwnProperty("tint")&&this.setTint(t.tint),t.hasOwnProperty("tintFill")&&this.setTintFill(t.tintFill),this):this}};var lt={webglRender:function(t,e,i,s,r,n,a,o){var h=this._width,l=this._height,d=h*this.originX,c=l*this.originY,u=this.x-s,p=this.y-r,g=1,v=1;this.flipX&&(u+=h-2*d,g=-1),this.flipY&&(p+=l-2*c,v=-1),at.applyITRS(u,p,this.rotation,this.scaleX*g,this.scaleY*v),e.multiply(at,at);var f=-d,m=-c,y=f+h,b=m+l,x=at.setQuad(f,m,y,b,o),C=this.frame.u0,k=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=nt(this.tint,this.alpha*i);t.batchQuad(this.parent,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],C,k,w,S,P,P,P,P,this.tintFill,n,a)},canvasRender:function(t,e,i,s){t.save();var r=this._width,n=this._height,a=r*this.originX,o=n*this.originY,h=this.x-a,l=this.y-o,d=1,c=1;this.flipX&&(h+=r,d=-1),this.flipY&&(l+=n,c=-1),s&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*d,this.scaleY*c);var u=this.frame;t.drawImage(u.source.image,u.cutX,u.cutY,r,n,0,0,r,n),t.restore()}};Object.assign(ht.prototype,lt);var dt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(K):null;return null===i?i=new ht(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},ct={_drawImage:function(t,e,i,s,r,n){dt(this,{frame:e,x:i,y:s,width:r,height:n})},_drawTileSprite:function(t,e,i,s,r,n){var a=this.texture.get(e),o=a.width,h=a.height,l=Math.floor(r/o),d=Math.floor(n/h);i+=(r-l*o)/2,s+=(n-d*h)/2;for(var c=0;c>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},bt=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const xt=Phaser.Renderer.Canvas.SetTransform;var Ct={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=mt(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&>(r,a,e,l,o,h),e.isStroked&&ft(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(xt(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(wt.prototype,Ct);const St=Phaser.Utils.Objects.GetValue;let Pt=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=St(t,"x",0),i=St(t,"y",0));var s=this.cornerRadius;s.tl=Tt(St(t,"tl",void 0),e,i),s.tr=Tt(St(t,"tr",void 0),e,i),s.bl=Tt(St(t,"bl",void 0),e,i),s.br=Tt(St(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ot(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ot(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ot(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ot(this.cornerRadius.br,t)}};var Tt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Mt(t),t},Ot=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=St(e,"x",0),t.y=St(e,"y",0)),Mt(t)},Mt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Et=function(t){return t.x>0&&t.y>0},_t=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Rt=Phaser.Math.DegToRad;var Lt=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,l,h,l,180,270,!1,a):ee(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,l,h,l,270,360,!1,a):ee(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,r-l,h,l,0,90,!1,a):ee(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,r-l,h,l,90,180,!1,a):ee(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()},Qt=function(t){return!t.hasOwnProperty("convex")||t.convex},te=function(t){return t.x>0&&t.y>0},ee=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())}(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}},se=function(){ie(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration)};const re=Phaser.Utils.Objects.GetValue;let ne=class extends Nt{constructor(t,e,i,s,r,n,a,o,h,l,d,c){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=1),super(t,e,i,s,r,c),this.type="rexRoundRectangleCanvas";var u=re(n,"radius",n),p=re(n,"iteration",void 0);this.setRadius(u),this.setIteration(p),this.setFillStyle(a,l,d),this.setStrokeStyle(o,h)}get radius(){return this._radius}set radius(t){this.dirty|=this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this}get iteration(){return this._iteration}set iteration(t){this.dirty|=this._iteration!=t,this._iteration=t}setIteration(t){return this.iteration=t,this}get fillStyle(){return this._fillStyle}set fillStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t}get fillColor2(){return this._fillColor2}set fillColor2(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setFillStyle(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t}setStrokeStyle(t,e){return this.strokeStyle=t,this.lineWidth=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),se.call(this)}),this),this}};t.register("roundRectangleCanvas",(function(t,e,i,s,r,n,a,o,h,l){var d=new ne(this.scene,t,e,i,s,r,n,a,o,h,l);return this.scene.add.existing(d),d})),P(window,"RexPlugins.UI.RoundRectangleCanvas",ne);var ae=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},oe=function(t,e,i){e&&!ae(t,`${e}X`)&&(Object.defineProperty(t,`${e}X`,{get:function(){return i.x},set:function(e){i.x=e,t.dirty=!0}}),Object.defineProperty(t,`${e}Y`,{get:function(){return i.y},set:function(e){i.y=e,t.dirty=!0}}),Object.defineProperty(t,`${e}T`,{get:function(){return i.t},set:function(e){i.t=e,t.dirty=!0}}))},he={setTLPosition(t,e){return this.geom.setTLPosition(t,e),this.dirty=!0,this},setTRPosition(t,e){return this.geom.setTRPosition(t,e),this.dirty=!0,this},setBLPosition(t,e){return this.geom.setBLPosition(t,e),this.dirty=!0,this},setBRPosition(t,e){return this.geom.setBRPosition(t,e),this.dirty=!0,this},resetCornerPosition(){return this.geom.resetCornerPosition(),this.dirty=!0,this},insertTopSidePoint(t,e,i,s){var r=this.geom.topSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a=0;f--)y=g[f],b=pe(d,h,y.t)+y.x,x=pe(c,l,y.t)+y.y,_t(b,x,e);for(_t(d,c,e),fe(v),f=v.length-1;f>=0;f--)y=v[f],b=pe(r,d,y.t)+y.x,x=pe(n,c,y.t)+y.y,_t(b,x,e);return e.push(e[0],e[1]),this.pathIndexes=ge(e),this}get tlx(){return this.geom.tlx}set tlx(t){this.geom.tlx=t,this.dirty=!0}get tly(){return this.geom.tly}set tly(t){this.geom.tly=t,this.dirty=!0}get trx(){return this.geom.trx}set trx(t){this.geom.trx=t,this.dirty=!0}get try(){return this.geom.try}set try(t){this.geom.try=t,this.dirty=!0}get blx(){return this.geom.blx}set blx(t){this.geom.blx=t,this.dirty=!0}get bly(){return this.geom.bly}set bly(t){this.geom.bly=t,this.dirty=!0}get brx(){return this.geom.brx}set brx(t){this.geom.brx=t,this.dirty=!0}get bry(){return this.geom.bry}set bry(t){this.geom.bry=t,this.dirty=!0}get leftSidePoints(){return this.geom.leftSidePoints}get topSidePoints(){return this.geom.topSidePoints}get bottomSidePoints(){return this.geom.bottomSidePoints}get rightSidePoints(){return this.geom.rightSidePoints}}var fe=function(t){t.length<=1||t.sort((function(t,e){return t.t-e.t}))};Object.assign(ve.prototype,he),t.register("QuadShape",(function(t,e,i,s,r,n){var a=new ve(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.QuadShape",ve);var me=Phaser.Renderer.WebGL.Utils,ye={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=me.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.style.resolution,a/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const be=Phaser.Display.Canvas.CanvasPool;F();const xe=Phaser.GameObjects.GameObject;class Ce extends xe{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=be.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),o=a,h=2*o;if(o=o*t.baselineY|0,s.width=a,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,o),i.left=0,0===a||0===h||!r.getImageData(0,0,a,h))return be.remove(s),i;for(var l=r.getImageData(0,0,a,h).data,d=!1,c=0;ci(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let s in t)t.hasOwnProperty(s)&&(e[s]=i(t[s]));return e}const s=Phaser.Utils.Objects.IsPlainObject,r=Phaser.Utils.Objects.GetValue;var n=function(t){return"string"==typeof t&&(t=a[t]),t};const a={scale:0,repeat:1};var o=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},h=function(){},l={_beginDraw:h,_drawImage:h,_drawTileSprite:h,_endDraw:h,setGetFrameNameCallback:function(t){return void 0===t&&(t=e),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,s,r){Array.isArray(e)&&(r=s,s=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof s&&arguments.length>=6?(s=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):void 0===s&&void 0===r&&void 0!==this.columns.data&&void 0!==this.rows.data?(s=this.columns.data,r=this.rows.data):(s=i(s),r=i(r)),this.textureKey=t,this.baseFrameName=e,this.columns.data=s,this.columns.count=s?s.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=r,this.rows.count=r?r.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var n=this.scene.sys.textures.get(t);if(!n)return this.clear(),this;if(!s||!r)return this.clear(),this;for(var a=n.get(e),o=a.width,h=0,l=0,d=s.length;l0?o/h:0,u=a.height,p=0;for(l=0,d=r.length;l0?0:f,x=0,l=0;for(var S=s.length;l0?0:m),m>=1&&f>=1){var P=typeof(y=this.getFrameNameCallback(l,k,e));"string"!==P&&"number"!==P||n.add(y,0,x+a.cutX,C+a.cutY,m,f)}x+=m}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(u,p);if(u>g){var v=(u-g)*h;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return s(t)?(this.stretchMode.edge=n(r(t,"edge",0)),this.stretchMode.internal=n(r(t,"internal",0))):(t=n(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return o.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const d=Phaser.Utils.Objects.IsPlainObject,c=Phaser.Utils.Objects.GetValue;var u=function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(d(i)?(i=c(u=i,"x",0),s=c(u,"y",0),r=c(u,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(r)?(r=c(u=r,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(a)?(a=c(u=a,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(o)?(o=c(u=o,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=c(u,"baseFrame",void 0)):d(h)&&(h=c(u=h,"columns",void 0),l=c(u,"rows",void 0)),void 0===o&&(o=c(u,"frame",void 0)),void 0===h){var p=c(u,"leftWidth",void 0),g=c(u,"rightWidth",void 0);void 0!==p&&void 0!==g&&(h=[p,void 0,g])}if(void 0===l){var v=c(u,"topHeight",void 0),f=c(u,"bottomHeight",void 0);void 0!==v&&void 0!==f&&(l=[v,void 0,f])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(c(u,"getFrameNameCallback",void 0)),this.setStretchMode(c(u,"stretchMode",0)),this.setPreserveRatio(c(u,"preserveRatio",!0));var m=c(u,"maxFixedPartScale",1),y=c(u,"maxFixedPartScaleX",m),b=c(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(y,b),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,l),i};const p=Phaser.Game;var g=function(t){return t instanceof p};const v=Phaser.Scene;var f=function(t){return t instanceof v},m=function(t){return null==t||"object"!=typeof t?null:g(t)?t:g(t.game)?t.game:f(t)?t.sys.game:f(t.scene)?t.scene.sys.game:void 0};const y=Phaser.GameObjects;var b=void 0,x=function(t,e){if(b||(b={},m(t).events.once("destroy",(function(){for(var t in b)b[t].destroy();b=void 0}))),!b.hasOwnProperty(e)){var i=m(t).scene.systemScene;(t=new y[e](i)).setOrigin(0),b[e]=t}return b[e]};const C=Phaser.GameObjects.RenderTexture;let k=class extends(u(C,"rexNinePatch")){};var w={_drawImage:function(t,e,i,s,r,n){var a=x(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=x(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(k.prototype,w);var S=function(t){return null==t||""===t||0===t.length},P=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(S(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(S(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const D=Phaser.Utils.Objects.GetValue;var A={};let j=class{constructor(t){this.pools=D(t,"pools",A)}destroy(){this.pools=void 0}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new I),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0},N=function(t,e){return t._depth-e._depth};const $=Phaser.GameObjects.Components;Phaser.Class.mixin(H,[$.Alpha,$.BlendMode,$.ComputedSize,$.Depth,$.GetBounds,$.Mask,$.Origin,$.Pipeline,$.PostPipeline,$.ScrollFactor,$.Transform,$.Visible,M,B]);const K="image";var J=function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,n=i,a=0;a0&&!ot(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}setFlipX(t){return void 0===t&&(t=!0),this.flipX=t,this}setFlipY(t){return void 0===t&&(t=!0),this.flipY=t,this}resetFlip(){return this.flipX=!1,this.flipY=!1,this}get tint(){return void 0===this._tint?this.parent.tint:this._tint}set tint(t){this._tint=t}setTint(t){return this.tint=t,this.tintFill=!1,this}setTintFill(t){return this.tint=t,this.tintFill=!0,this}clearTint(){return this.setTint(16777215),this}resetTint(){return this.tint=void 0,this.tintFill=void 0,this}get tintFill(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill}set tintFill(t){this._tintFill=t}reset(){return super.reset(),this.resetFlip().resetTint().setFrame(),this}modifyPorperties(t){return t?(t.hasOwnProperty("width")&&(t.displayWidth=t.width,delete t.width),t.hasOwnProperty("height")&&(t.displayHeight=t.height,delete t.height),t.hasOwnProperty("frame")&&this.setFrame(t.frame),super.modifyPorperties(t),t.hasOwnProperty("flipX")&&this.setFlipX(t.flipX),t.hasOwnProperty("flipY")&&this.setFlipY(t.flipY),t.hasOwnProperty("tint")&&this.setTint(t.tint),t.hasOwnProperty("tintFill")&&this.setTintFill(t.tintFill),this):this}};var lt={webglRender:function(t,e,i,s,r,n,a,o){var h=this._width,l=this._height,d=h*this.originX,c=l*this.originY,u=this.x-s,p=this.y-r,g=1,v=1;this.flipX&&(u+=h-2*d,g=-1),this.flipY&&(p+=l-2*c,v=-1),at.applyITRS(u,p,this.rotation,this.scaleX*g,this.scaleY*v),e.multiply(at,at);var f=-d,m=-c,y=f+h,b=m+l,x=at.setQuad(f,m,y,b,o),C=this.frame.u0,k=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=nt(this.tint,this.alpha*i);t.batchQuad(this.parent,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],C,k,w,S,P,P,P,P,this.tintFill,n,a)},canvasRender:function(t,e,i,s){t.save();var r=this._width,n=this._height,a=r*this.originX,o=n*this.originY,h=this.x-a,l=this.y-o,d=1,c=1;this.flipX&&(h+=r,d=-1),this.flipY&&(l+=n,c=-1),s&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*d,this.scaleY*c);var u=this.frame;t.drawImage(u.source.image,u.cutX,u.cutY,r,n,0,0,r,n),t.restore()}};Object.assign(ht.prototype,lt);var dt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(K):null;return null===i?i=new ht(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},ct={_drawImage:function(t,e,i,s,r,n){dt(this,{frame:e,x:i,y:s,width:r,height:n})},_drawTileSprite:function(t,e,i,s,r,n){var a=this.texture.get(e),o=a.width,h=a.height,l=Math.floor(r/o),d=Math.floor(n/h);i+=(r-l*o)/2,s+=(n-d*h)/2;for(var c=0;c>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},bt=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const xt=Phaser.Renderer.Canvas.SetTransform;var Ct={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=mt(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&>(r,a,e,l,o,h),e.isStroked&&ft(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(xt(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(wt.prototype,Ct);const St=Phaser.Utils.Objects.GetValue;let Pt=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=St(t,"x",0),i=St(t,"y",0));var s=this.cornerRadius;s.tl=Tt(St(t,"tl",void 0),e,i),s.tr=Tt(St(t,"tr",void 0),e,i),s.bl=Tt(St(t,"bl",void 0),e,i),s.br=Tt(St(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ot(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ot(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ot(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ot(this.cornerRadius.br,t)}};var Tt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Mt(t),t},Ot=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=St(e,"x",0),t.y=St(e,"y",0)),Mt(t)},Mt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Et=function(t){return t.x>0&&t.y>0},_t=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Rt=Phaser.Math.DegToRad;var Lt=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,l,h,l,180,270,!1,a):ee(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,l,h,l,270,360,!1,a):ee(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,r-l,h,l,0,90,!1,a):ee(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,r-l,h,l,90,180,!1,a):ee(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()},Qt=function(t){return!t.hasOwnProperty("convex")||t.convex},te=function(t){return t.x>0&&t.y>0},ee=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())}(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}},se=function(){ie(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration)};const re=Phaser.Utils.Objects.GetValue;let ne=class extends Nt{constructor(t,e,i,s,r,n,a,o,h,l,d,c){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=1),super(t,e,i,s,r,c),this.type="rexRoundRectangleCanvas";var u=re(n,"radius",n),p=re(n,"iteration",void 0);this.setRadius(u),this.setIteration(p),this.setFillStyle(a,l,d),this.setStrokeStyle(o,h)}get radius(){return this._radius}set radius(t){this.dirty|=this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this}get iteration(){return this._iteration}set iteration(t){this.dirty|=this._iteration!=t,this._iteration=t}setIteration(t){return this.iteration=t,this}get fillStyle(){return this._fillStyle}set fillStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t}get fillColor2(){return this._fillColor2}set fillColor2(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setFillStyle(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t}setStrokeStyle(t,e){return this.strokeStyle=t,this.lineWidth=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),se.call(this)}),this),this}};t.register("roundRectangleCanvas",(function(t,e,i,s,r,n,a,o,h,l){var d=new ne(this.scene,t,e,i,s,r,n,a,o,h,l);return this.scene.add.existing(d),d})),P(window,"RexPlugins.UI.RoundRectangleCanvas",ne);var ae=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},oe=function(t,e,i){e&&!ae(t,`${e}X`)&&(Object.defineProperty(t,`${e}X`,{get:function(){return i.x},set:function(e){i.x=e,t.dirty=!0}}),Object.defineProperty(t,`${e}Y`,{get:function(){return i.y},set:function(e){i.y=e,t.dirty=!0}}),Object.defineProperty(t,`${e}T`,{get:function(){return i.t},set:function(e){i.t=e,t.dirty=!0}}))},he={setTLPosition(t,e){return this.geom.setTLPosition(t,e),this.dirty=!0,this},setTRPosition(t,e){return this.geom.setTRPosition(t,e),this.dirty=!0,this},setBLPosition(t,e){return this.geom.setBLPosition(t,e),this.dirty=!0,this},setBRPosition(t,e){return this.geom.setBRPosition(t,e),this.dirty=!0,this},resetCornerPosition(){return this.geom.resetCornerPosition(),this.dirty=!0,this},insertTopSidePoint(t,e,i,s){var r=this.geom.topSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a=0;f--)y=g[f],b=pe(d,h,y.t)+y.x,x=pe(c,l,y.t)+y.y,_t(b,x,e);for(_t(d,c,e),fe(v),f=v.length-1;f>=0;f--)y=v[f],b=pe(r,d,y.t)+y.x,x=pe(n,c,y.t)+y.y,_t(b,x,e);return e.push(e[0],e[1]),this.pathIndexes=ge(e),this}get tlx(){return this.geom.tlx}set tlx(t){this.geom.tlx=t,this.dirty=!0}get tly(){return this.geom.tly}set tly(t){this.geom.tly=t,this.dirty=!0}get trx(){return this.geom.trx}set trx(t){this.geom.trx=t,this.dirty=!0}get try(){return this.geom.try}set try(t){this.geom.try=t,this.dirty=!0}get blx(){return this.geom.blx}set blx(t){this.geom.blx=t,this.dirty=!0}get bly(){return this.geom.bly}set bly(t){this.geom.bly=t,this.dirty=!0}get brx(){return this.geom.brx}set brx(t){this.geom.brx=t,this.dirty=!0}get bry(){return this.geom.bry}set bry(t){this.geom.bry=t,this.dirty=!0}get leftSidePoints(){return this.geom.leftSidePoints}get topSidePoints(){return this.geom.topSidePoints}get bottomSidePoints(){return this.geom.bottomSidePoints}get rightSidePoints(){return this.geom.rightSidePoints}}var fe=function(t){t.length<=1||t.sort((function(t,e){return t.t-e.t}))};Object.assign(ve.prototype,he),t.register("QuadShape",(function(t,e,i,s,r,n){var a=new ve(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.QuadShape",ve);var me=Phaser.Renderer.WebGL.Utils,ye={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=me.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.style.resolution,a/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const be=Phaser.Display.Canvas.CanvasPool;F();const xe=Phaser.GameObjects.GameObject;class Ce extends xe{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=be.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),o=a,h=2*o;if(o=o*t.baselineY|0,s.width=a,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,o),i.left=0,0===a||0===h||!r.getImageData(0,0,a,h))return be.remove(s),i;for(var l=r.getImageData(0,0,a,h).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Se=Phaser.Display.Canvas.CanvasPool;var Pe=function(t){var e=Se.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Se.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;if(h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,Se.remove(e),a;var d,c,u=i.getImageData(0,0,o,l).data,p=u.length,g=4*o,v=0,f=!1;for(d=0;dh;d--){for(c=0;c0&&this.wrapMode!==Ee&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Be[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=De(t,l,d);else{var u=Ie(t,l,d);c&&(u=c(u)),this[o]=u}}var p=De(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=De(t,"fill",null);null!==g&&(this.color=Jt(g));var v=De(t,"metrics",!1);return v?this.metrics={ascent:De(v,"ascent",0),descent:De(v,"descent",0),fontSize:De(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Pe(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Pe(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=De(t,"fontFamily","Courier"),this.fontSize=De(t,"fontSize","16px"),this.fontStyle=De(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Jt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Jt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Jt(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Jt(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Jt(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Jt(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Jt(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Be[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=De(e,"fontFamily",this.fontFamily),this.fontSize=De(e,"fontSize",this.fontSize),this.fontStyle=De(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}};var je=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},ze={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),ie(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Fe=Phaser.Utils.Objects.GetValue,Ye=Te,Xe=Oe;class We{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Fe(t,"text",""),this.x=Fe(t,"x",0),this.y=Fe(t,"y",0),this.width=Fe(t,"width",0);var e=Fe(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Fe(t,"newLineMode",0),this.startIndex=Fe(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Xe&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ye&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Xe&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var Ve=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:q(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var $e={};const Ke=Phaser.Geom.Rectangle;var Je=new I;class qe{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&pi(v)){""!==b?a.push(n.getLine(b,x,ai)):0===C&&r>0&&a.push(n.getLine("",0,ai)),a.push(...ci(v,e,li,s,0,n));var w=a.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,ai)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},ui=function(t,e){var i;switch(e){case hi:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vi&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ne({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}};var gs=function(t){for(var e,i,s,r={},n=0,a=(t=t.split(";")).length;n=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px","")));break;case"shadow":o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.offsetX=parseInt(o[1].replace("px",""))),h>=3&&(s.offsetY=parseInt(o[2].replace("px",""))),h>=4&&(s.blur=parseInt(o[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px",""))),h>=3&&(s.offset=parseInt(o[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":s=parseFloat(s)}r[i]=s}return r},vs=function(t){return 0===(t=t.replace(Cs,"")).length},fs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,ms=/<\s*class=/i,ys=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,bs=/<\s*style=/i,xs=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Cs=/^\s+|\s+$/;const ks=Phaser.Utils.Objects.GetValue;class ws extends Yi{constructor(t,e,i,s,r){var n=ks(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new ps(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}t.register("tagText",(function(t,e,i,s){var r=new ws(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",ws);const Ss=Phaser.Utils.Objects.GetValue;var Ps=function(t,e){return void 0===e?t:t[e]},Ts=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ss(e,"left",0),t.right=Ss(e,"right",0),t.top=Ss(e,"top",0),t.bottom=Ss(e,"bottom",0)),t};let Os=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Os.prototype,Z);var Ms={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Es=Phaser.Math.RotateAround;var _s;const Rs=Phaser.Geom.Rectangle;var Ls,Bs=function(t){void 0===Ls&&(Ls=new Rs);var e=t.drawTLX,i=t.drawTLY;return Ls.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ls};const Is=Phaser.Math.RotateAround;var Ds,As=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ds&&(Ds={}),s=Ds),s.x=e,s.y=i,0!==t.rotation&&Is(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const js=Phaser.GameObjects.Components.TransformMatrix;var zs,Fs,Ys={},Xs=function(t,e,i,s,r){var n=As(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ys);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===zs&&(zs=new js,Fs=new js),t.parentContainer?t.getWorldTransformMatrix(zs,Fs):zs.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),zs.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Ws=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Xs(t,e,n,a,r)},Vs={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===_s&&(_s={}),s=_s),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Es(s,0,0,-i.rotation),s}(t,e,this,!0);return Bs(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ws(this.parent,this,t,e,i)}};Object.assign(Vs,Ms);const Gs=Phaser.Math.DegToRad,Hs=Phaser.Math.RadToDeg,Us=Phaser.Utils.Objects.GetValue;class Ns extends Os{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Hs(this._rotation)}set angle(t){this.rotation=Gs(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Us(t,"width",void 0),i=Us(t,"height",void 0),s=Us(t,"scaleX",void 0),r=Us(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ns.prototype,Vs);var $s=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ks=Phaser.Utils.Objects.GetValue;class Js extends Ns{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ks(e,"color",null),Ks(e,"color2",null),Ks(e,"horizontalGradient",!0)),this.setStroke(Ks(e,"stroke",null),Ks(e,"strokeThickness",2)),this.setCornerRadius(Ks(e,"cornerRadius",0),Ks(e,"cornerIteration",null))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,$s("color2",t,this),$s("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$s("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,$s("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){ie(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qs(e,"color",null),qs(e,"color2",null),qs(e,"horizontalGradient",!0)),this.setStroke(qs(e,"stroke",null),qs(e,"strokeThickness",2))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,qs(t,"color2",null),qs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qs(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Qs=Phaser.Utils.Objects.GetValue;class tr{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Qs(t,"bold",!1)),this.setItalic(Qs(t,"italic",!1)),this.setFontSize(Qs(t,"fontSize","16px")),this.setFontFamily(Qs(t,"fontFamily","Courier")),this.setColor(Qs(t,"color","#fff")),this.setStrokeStyle(Qs(t,"stroke",null),Qs(t,"strokeThickness",0)),this.setShadow(Qs(t,"shadowColor",null),Qs(t,"shadowOffsetX",0),Qs(t,"shadowOffsetY",0),Qs(t,"shadowBlur",0)),this.setOffset(Qs(t,"offsetX",0),Qs(t,"offsetY",0)),this.setSpace(Qs(t,"leftSpace",0),Qs(t,"rightSpace",0)),this.setAlign(Qs(t,"align",void 0)),this.setBackgroundColor(Qs(t,"backgroundColor",null)),this.setBackgroundHeight(Qs(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Qs(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle($s("stroke",t,this),$s("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset($s("shadowOffsetX",t,this),$s("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tr(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Jt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Jt(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Jt(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Jt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const er=Phaser.Utils.Array.Remove,ir=Phaser.Utils.Array.Remove,sr="text",rr="image",nr="drawer",ar="space",or="command";var hr=function(t){return t.type===sr&&"\n"===t.text},lr=function(t){return t.type===sr&&"\f"===t.text},dr=function(t){return t.type===sr},cr=function(t){return t.type===or};class ur extends Ns{constructor(t,e,i){super(t,sr),this.updateTextFlag=!1,this.style=new tr(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var pr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class gr extends Ns{constructor(t,e,i){super(t,rr),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Pi(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var vr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class fr extends Ns{constructor(t,e,i,s){super(t,nr),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}let mr=class extends Ns{constructor(t,e){super(t,ar),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}};var yr=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class br extends Os{constructor(t,e,i,s,r){super(t,or),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var xr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},Cr=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const kr={none:0,word:1,char:2,character:2,mix:3};var wr=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Or.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Or.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Er(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Er(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Er(t,"wrapMode");void 0===c&&(c=Er(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=kr[c]);var u=Er(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Er(t,"letterSpacing",0),g=Er(t,"hAlign",0),v=Er(t,"vAlign",0),f=Er(t,"justifyPercentage",.25),m=Cr({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:_,width:R}),L=Math.max(L,R)),m.start+=M.length,m.isLastPage=!B&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Lr(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Lr(t,"maxLines",0);var o=0===i,h=Lr(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Lr(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Lr(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Lr(t,"letterSpacing",0),p=Lr(t,"rtl",!0),g=Lr(t,"hAlign",p?2:0),v=Lr(t,"vAlign",0),f=Cr({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(M.push({children:E,height:_}),R=Math.max(R,_)),f.start+=O.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=M.length*n;var j=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Ts(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Ps(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),er(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ir(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(sr);return null===i?i=new ur(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ws(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r>16&255},yn=function(t){return t>>8&255},bn=function(t){return 255&t};const xn=Phaser.Events.EventEmitter;var Cn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=kn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},kn={},wn=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cn),function(t){if(t.events)return t;var e=new xn,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Pn=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mn(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},jn=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},zn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Fn=Phaser.Geom.Rectangle,Yn=Phaser.Math.Vector2,Xn=Phaser.Math.RotateAround,Wn=Phaser.GameObjects.Container;var Vn=function(t,e){if(void 0===e?e=new Fn:!0===e&&(void 0===Gn&&(Gn=new Fn),e=Gn),t.getBounds&&!(t instanceof Wn))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Hn(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Un(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,$n(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Hn(t,e),i=e.x,s=e.y,Un(t,e),r=e.x,n=e.y,Nn(t,e),a=e.x,o=e.y,$n(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Gn=void 0,Hn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-jn(t)*t.originX,e.y=t.y-zn(t)*t.originY,qn(t,e,i))},Un=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getTopRight?t.getTopRight(e):(e.x=t.x-jn(t)*t.originX+jn(t),e.y=t.y-zn(t)*t.originY,qn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-jn(t)*t.originX,e.y=t.y-zn(t)*t.originY+zn(t),qn(t,e,i))},$n=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-jn(t)*t.originX+jn(t),e.y=t.y-zn(t)*t.originY+zn(t),qn(t,e,i))},Kn=function(t,e,i){void 0===e?e=new Yn:!0===e&&(void 0===Jn&&(Jn=new Yn),e=Jn);var s=jn(t),r=zn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),qn(t,e,i)},Jn=void 0,qn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Xn(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Zn(i,"color"),r=Zn(i,"lineWidth"),n=Zn(i,"fillColor"),a=Zn(i,"fillAlpha",1),o=Zn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Ga:Va,this.repeatCounter=0,this}stop(){return this.state=Wa,this}update(t,e){this.state!==Wa&&this.state!==Ua&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ha)):(this.nowTime=this.duration,this.state=Ua):this.nowTime>=0&&(this.state=Ga))}get t(){var t;switch(this.state){case Wa:case Va:case Ha:t=0;break;case Ga:t=this.nowTime/this.duration;break;case Ua:t=1}return Ya(t,0,1)}set t(t){(t=Ya(t,-1,1))<0?(this.state=Va,this.nowTime=-this.delay*t):(this.state=Ga,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Wa}get isDelay(){return this.state===Va}get isCountDown(){return this.state===Ga}get isRunning(){return this.state===Va||this.state===Ga}get isDone(){return this.state===Ua}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Wa=0,Va=1,Ga=2,Ha=3,Ua=-1;class Na extends ja{constructor(t,e){super(t,e),this.timer=new Xa}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const $a=Phaser.Utils.Objects.GetValue,Ka=Phaser.Utils.Objects.GetAdvancedValue,Ja=Phaser.Tweens.Builders.GetEaseFunction;class qa extends Na{resetFromJSON(t){return this.timer.resetFromJSON($a(t,"timer")),this.setEnable($a(t,"enable",!0)),this.setTarget($a(t,"target",this.parent)),this.setDelay(Ka(t,"delay",0)),this.setDuration(Ka(t,"duration",1e3)),this.setEase($a(t,"ease","Linear")),this.setRepeat($a(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ja(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Za=Phaser.Sound.BaseSound;var Qa=function(t){return t instanceof Za};const to=Phaser.Utils.Objects.GetValue,eo=Phaser.Utils.Objects.GetAdvancedValue,io=Phaser.Math.Linear;let so=class extends qa{constructor(t,e,i){Qa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(to(t,"mode",0)),this.setEnable(to(t,"enable",!0)),this.setVolumeRange(eo(t,"volume.start",this.parent.volume),eo(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ro[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=io(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const ro={stop:1,destroy:2};var no=function(t,e,i,s,r){Qa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new so(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ao=function(t,e,i,s){Qa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new so(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const oo=Phaser.Utils.Objects.GetValue;var ho={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:oo(e,"loop",this.backgroundMusicLoop),mute:oo(e,"mute",this.backgroundMusicMute),volume:oo(e,"volume",this.backgroundMusicVolume),detune:oo(e,"detune",0),rate:oo(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&no(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ao(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const lo=Phaser.Utils.Objects.GetValue;var co={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:lo(e,"loop",this.backgroundMusicLoop),mute:lo(e,"mute",this.backgroundMusic2Mute),volume:lo(e,"volume",this.backgroundMusic2Volume),detune:lo(e,"detune",0),rate:lo(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&no(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ao(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const uo=Phaser.Utils.Array.Remove,po=Phaser.Utils.Objects.GetValue;var go={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:po(e,"mute",this.soundEffectsMute),volume:po(e,"volume",this.soundEffectsVolume),detune:po(e,"detune",0),rate:po(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&uo(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&uo(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&no(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ao(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ao(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&no(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ao(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ao(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(J(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Zo:t||(t=th),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=ih),this.tagExpression=t,this}setValueExpression(t){return t||(t=ih),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==ih||this.valueExpression!==ih){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=Zo),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:ol,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===sr&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,hl.call(t,i.remainder)}});break}}else cr(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},ll=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},dl=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},cl=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var l=n[1];return r.waitGameObjectDestroy(a,l),void t.emit(h,l);case 3:l=n[1];var d=n[2];if("number"==typeof o.getProperty(l,d))return r.waitGameObjectTweenComplete(a,l,d),void t.emit(h,l,d);var c=d,u=c.startsWith("!");return u&&(c=c.substring(1)),o.hasData(l,c)?(r.waitGameObjectDataFlag(a,l,c,!u),void t.emit(h,l,c)):void r.waitTime(0)}};const ul=Phaser.Input.Keyboard.KeyCodes;var pl=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},Ml=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},_l=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Rl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Tl(a,s)&&(n=a[1],xr.call(t,`${s}.play`,Ol,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ml,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Tl(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ml,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.pause`,El,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);xr.call(t,`${s}.chain`,_l,[s,r,a],t),e.skipEvent()}}}))}];var Ll=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Rl,t.createGameObject=kl(t.createGameObject),this.addGameObjectManager(t,Pl)},Bl=function(t,e){return 2===t.length&&t[0]===e},Il=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Dl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Al=function(t){this.getGameObjectManager(t).removeAll()},jl=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},zl={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},Fl=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var l=this.getGameObjectManager(e),d=l.getProperty(i,s);if("number"==typeof d){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=d-r:h.startsWith("from")&&(l.setProperty(i,s,d-r),r=d):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=d+r:h.startsWith("from")&&(l.setProperty(i,s,d+r),r=d):"from"===h&&(l.setProperty(i,s,r),r=d);var c=h.startsWith("yoyo");l.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:c})}};const Yl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Bl(a,s)&&(n=a[1],xr.call(t,`${s}.add`,Il,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Bl(n,s)&&(r=n[1],xr.call(t,`${s}.remove`,Dl,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(xr.call(t,`${s}.removeall`,Al,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],xr.call(t,`${s}.call`,jl,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,l,d,c=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&zl[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),xr.call(t,`${s}.ease`,Fl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Xl=Vo.addGameObjectManager;var Wl={addGameObjectManager(t,e){(t=t?Ve(t):{}).name||console.warn("[TextPlayer] Parameter 'name' is required in addGameObjectManager(config) method");var i=t.defaultLayer,s=t.createGameObject,r=this.layerManager;t.createGameObject=function(t,...e){var n=s.call(this,t,...e);return i&&r&&r.addToLayer(i,n),n},Xl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Yl]:Yl).length;a0)return ad.length=0,!0;return ad.length=0,!1},ad=[],od=void 0;const hd=Phaser.Utils.Objects.GetValue;var ld=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=hd(e,n,s[1]))&&(i[s[0]]=r);return i},dd=function(t){t.addEventListener("touchstart",cd,!1),t.addEventListener("touchmove",cd,!1),t.addEventListener("touchend",cd,!1),t.addEventListener("mousedown",cd,!1),t.addEventListener("mouseup",cd,!1),t.addEventListener("mousemove",cd,!1)},cd=function(t){t.stopPropagation()},ud=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},pd=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",ud,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(Ca.call(this.clickOutSideTarget,this.parent),xa.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},gd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",ud,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const vd=Phaser.Utils.Objects.GetValue;var fd=function(t,e){var i,s=vd(e,"inputType",void 0);void 0===s&&(s=vd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=vd(e,"style",void 0),n=i.style;ld(id,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",ld(ed,e,i),dd(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){pd.call(t)})),i.addEventListener("blur",(function(e){gd.call(t)})),i},md={open:function(){return this.isOpened||this.readOnly||((t=this)!==od&&(void 0!==od&&od.close(),od=t),this.node||(this.node=fd(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===od&&(od=void 0),this.setBlur(),this):this}};const yd=Phaser.Utils.Objects.GetValue;class bd extends La{constructor(t,e){super(t);var i=yd(e,"inputType",void 0);void 0===i&&(i=yd(e,"type","text")),this.setEnterCloseEnable(yd(e,"enterClose","textarea"!==i));var s=yd(e,"onOpen",void 0);s||(s=yd(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=yd(e,"clickOutSideTarget",void 0);var r=yd(e,"onClose",void 0);r||(r=yd(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=yd(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return sd(t,e,"inputType"),sd(t,e,"type"),sd(t,e,"style"),sd(t,e,id),sd(t,e,ed),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){rd(this.parent,t)||this.close()}setEnterCloseEnable(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}initText(){}updateText(){}get text(){return this.node?this.node.value:""}set text(t){this.node&&(this.node.value=t)}setText(t){return this.text=t,this}get maxLength(){return this.nodeConfig.maxLength}set maxLength(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t)}setMaxLength(t){return this.maxLength=t,this}get minLength(){return this.nodeConfig.minLength}set minLength(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t)}setMinLength(t){return this.minLength=t,this}get placeholder(){return this.node.placeholder}set placeholder(t){this.node&&(this.node.placeholder=t)}setPlaceholder(t){return this.placeholder=t,this}selectText(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}selectAll(){return this.selectText(),this}get selectionStart(){return this.node?this.node.selectionStart:0}get selectionEnd(){return this.node?this.node.selectionEnd:0}get selectedText(){if(!this.node)return"";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}get cursorPosition(){return this.node?this.node.selectionStart:0}set cursorPosition(t){this.node&&this.node.setSelectionRange(t,t)}setCursorPosition(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}get tooltip(){return this.node?this.node.title:""}set tooltip(t){if(!this.node)return this;this.node.title=t}setTooltip(t){return this.tooltip=t,this}setTextChangedCallback(t){return this.onTextChanged=t,this}get readOnly(){return this.nodeConfig.readOnly}set readOnly(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t)}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}get spellCheck(){return this.node?this.node.spellcheck:""}set spellCheck(t){this.node&&(this.node.spellcheck=t)}setSpellCheck(t){return this.spellCheck=t,this}get fontColor(){if(this.node)return this.node.style.color}set fontColor(t){this.node&&(this.node.style.color=t)}setFontColor(t){return this.fontColor=t,this}setStyle(t,e){return this.node?(this.node.style[t]=e,this):this}getStyle(t){if(this.node)return this.node.style[t]}scrollToBottom(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}setEnabled(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}setBlur(){return this.node?(this.node.blur(),this):this}setFocus(){return this.node?(this.node.focus(),this):this}get isFocused(){return this.isOpened}}Object.assign(bd.prototype,md);var xd=function(t,e,i){t=t.replace(" ","");var s=i.previousText;if(t===s)return t;if(isNaN(t)){i.emit("nan",t,i),t=s;var r=i.cursorPosition-1;i.setText(t),i.setCursorPosition(r)}else i.previousText=t;return t},Cd=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,s=t.parent,r=e;r=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Cd(this),kd(this)),this}setNumberInput(){return this.onUpdateCallback=xd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Pd=Phaser.Utils.Objects.GetValue,Td=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Od=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const _d=Phaser.GameObjects.Zone;let Rd=class extends _d{constructor(t){super(t,0,0,2,2),this.fullWindow=new Ed(this)}};var Ld=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Bd=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},Id=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}zd.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(Fd(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Yd=new zd,Xd=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Wd=/\S/,Vd=new zd;Vd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Wd.test(t)&&!Wd.test(e)},Vd.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Nd(t,null,null,i),i," ")},Ud.equals=function(t,e){return zd.prototype.equals.call(Ud,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const $d=new zd;$d.tokenize=function(t){return t.slice()},$d.join=$d.removeEmpty=function(t){return t};const Kd=Phaser.Utils.Array.Remove;var Jd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Kd(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Yd.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},ec={cursorMoveLeft(){if(!this.isOpened)return this;var t=Zd(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Zd(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Qd(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Zd(tc(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Qd(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Zd(tc(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ic=Phaser.Utils.Objects.IsPlainObject;class sc extends hn{constructor(t,e,i,s,r,n){ic(e)?n=e:ic(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Od(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Od(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Od(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Od(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Od(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Rd(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Ld(n.background,"focus"),h=Ld(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Pd(e,"edit");return void 0===i&&(i={}),sd(e,i,Td),new Sd(t,i)}(this,n),Bd.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),jd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Ad.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Kc(t,"tl",0),this.radiusTR=Kc(t,"tr",0),this.radiusBL=Kc(t,"bl",0),this.radiusBR=Kc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Lt(e,e,e,e,180,270,!1,r,t):Lt(0,0,e,e,90,0,!0,r,t):_t(0,0,t),(e=this.radiusTR)>0?this._convexTR?Lt(i-e,e,e,e,270,360,!1,r,t):Lt(i,0,e,e,180,90,!0,r,t):_t(i,0,t),(e=this.radiusBR)>0?this._convexBR?Lt(i-e,s-e,e,e,0,90,!1,r,t):Lt(i,s,e,e,270,180,!0,r,t):_t(i,s,t),(e=this.radiusBL)>0?this._convexBL?Lt(e,s-e,e,e,90,180,!1,r,t):Lt(0,s,e,e,360,270,!0,r,t):_t(0,s,t),t.push(t[0],t[1]),_c(this.x,this.y,t),super.updateData(),this}}const qc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var Zc={buildShapes(){this.addShape((new Jc).setName("box")).addShape((new Nc).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}};const Qc=Phaser.Utils.Objects.GetValue,tu=Phaser.Math.Linear;class eu extends qa{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Qc(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Qc(t,"from",i),this.toValue=Qc(t,"to",i),this.setEase(Qc(t,"ease",this.ease)),this.setDuration(Qc(t,"duration",this.duration)),this.setRepeat(Qc(t,"repeat",0)),this.setDelay(Qc(t,"delay",0)),this.setRepeatDelay(Qc(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=tu(this.fromValue,this.toValue,i)}}var iu={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new eu(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},su={};Object.assign(su,vc,fc,Zc,iu);const ru=23730,nu=Phaser.Utils.Objects.GetValue,au=Phaser.Utils.Objects.IsPlainObject;class ou extends gc{constructor(t,e,i,s,r,n,a){au(e)?(e=nu(a=e,"x",0),i=nu(a,"y",0),s=nu(a,"width",2),r=nu(a,"height",2),n=nu(a,"color",ru)):au(n)&&(n=nu(a=n,"color",ru)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=ru),this.setBoxShape(nu(a,"circleBox",!1)),this.setBoxFillStyle(n,nu(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(nu(a,"uncheckedColor",null),nu(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(nu(a,"boxLineWidth",4),nu(a,"boxStrokeColor",n),nu(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,nu(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),nu(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(nu(a,"checkerColor",16777215),nu(a,"checkerAlpha",1)),this.setBoxSize(nu(a,"boxSize",1)),this.setCheckerSize(nu(a,"checkerSize",1)),this.setCheckerAnimationDuration(nu(a,"animationDuration",150)),this.buildShapes();var o=nu(a,"checked");void 0===o&&(o=nu(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(ou.prototype,su);const hu=Phaser.Utils.Objects.GetValue;class lu extends La{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(hu(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(hu(t,"enable",!0)),this.setMode(hu(t,"mode",1)),this.setClickInterval(hu(t,"clickInterval",100)),this.setDragThreshold(hu(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=du[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const du={press:0,pointerdown:0,release:1,pointerup:1},cu=Phaser.Utils.Objects.GetValue,uu=Phaser.Utils.Objects.IsPlainObject;class pu extends ou{constructor(t,e,i,s,r,n,a){uu(e)?(e=cu(a=e,"x",0),i=cu(a,"y",0),s=cu(a,"width",2),r=cu(a,"height",2),n=cu(a,"color",ru)):uu(n)&&(n=cu(a=n,"color",ru)),super(t,e,i,s,r,n,a),this._click=new lu(this,cu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(cu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("checkbox",(function(t,e,i,s,r,n){var a=new pu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",pu);var gu={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},vu={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},fu={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},mu=function(t,e,i){return(e-t)*i+t};const yu=Phaser.Math.Linear;var bu={buildShapes(){this.addShape((new Jc).setName("track")).addShape((new Jc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&mu(mn(l),mn(d),c))<<16|(255&mu(yn(l),yn(d),c))<<8|255&mu(bn(l),bn(d),c)),p=yu(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=yu(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},xu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new eu(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},Cu={};Object.assign(Cu,gu,vu,fu,bu,xu);const ku=Phaser.Utils.Objects.GetValue,wu=Phaser.Utils.Objects.IsPlainObject,Su=23730;class Pu extends gc{constructor(t,e,i,s,r,n,a){wu(e)?(e=ku(a=e,"x",0),i=ku(a,"y",0),s=ku(a,"width",2),r=ku(a,"height",2),n=ku(a,"color",Su)):wu(n)&&(n=ku(a=n,"color",Su)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Su),this.setTrackFillStyle(n,ku(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(ku(a,"falseValueTrackColor",function(t){var e=.3*mn(t)+.59*yn(t)+.11*bn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),ku(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(ku(a,"thumbColor",16777215),ku(a,"thumbAlpha",1)),this.setTrackSize(ku(a,"trackWidth",.9),ku(a,"trackHeight",.5)),this.setTrackRadius(ku(a,"trackRadius",.5*this.trackHeight));var o=ku(a,"thumbHeight",void 0),h=ku(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(ku(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(ku(a,"thumbLeft",.3),ku(a,"thumbRight",void 0)),this.setRTL(ku(a,"rtl",!1)),this.setToggleAnimationDuration(ku(a,"animationDuration",150)),this.buildShapes(),this.setValue(ku(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(Pu.prototype,Cu);const Tu=Phaser.Utils.Objects.GetValue;class Ou extends Pu{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new lu(this,Tu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Tu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("toggleSwitch",(function(t,e,i,s,r,n){var a=new Ou(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Ou);var Mu={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Eu extends Nt{}Object.assign(Eu.prototype,Mu),t.register("canvas",(function(t,e,i,s){var r=new Eu(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Eu);const _u=Phaser.Utils.Objects.GetValue;class Ru extends Nt{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexCircleMaskImage",this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={maskType:i});var s=_u(i,"maskType",0),r=_u(i,"backgroundColor",void 0),n=_u(i,"strokeColor",void 0),a=_u(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Lu[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var o=this.scene.sys.textures.getFrame(t,e);if(!o)return this;o.cutWidth!==this.width||o.cutHeight!==this.height?this.setCanvasSize(o.cutWidth,o.cutHeight):this.clear();var h=this.canvas,l=this.context,d=h.width,c=h.height;null!=r&&(l.fillStyle=r,l.fillRect(0,0,d,c)),l.save(),l.beginPath();var u=a/2;switch(s){case 1:var p=(m=Math.floor(d/2))-u,g=(y=Math.floor(c/2))-u;l.ellipse(m,y,p,g,0,0,2*Math.PI);break;case 2:var v=_u(i,"radius",0),f=_u(i,"iteration",void 0);Zt(l,u,u,d-a,c-a,v,f);break;default:var m=Math.floor(d/2),y=Math.floor(c/2),b=Math.min(m,y)-u;l.arc(m,y,b,0,2*Math.PI)}return null!=n&&(l.strokeStyle=n,l.lineWidth=a,l.stroke()),l.clip(),this.loadTexture(t,e),l.restore(),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}const Lu={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new Ru(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",Ru);const Bu=Phaser.Utils.Objects.GetValue;class Iu extends Nt{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexAlphaMaskImage",this.maskFrame=null,this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={mask:{key:i}});var s=Bu(i,"mask.key"),r=Bu(i,"mask.frame"),n=Bu(i,"mask.invertAlpha",!1),a=Bu(i,"mask.scale"),o=Bu(i,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var h=s?this.scene.sys.textures.get(s):null;this.maskFrame=h?h.get(r):null}this._textureKey=t,this._frameName=e;var l=this.maskFrame;if(null===l)return this.loadTexture(t,e),this.dirty=!0,this;var d=null!=o;this.loadTexture(t,e);var c,u,p=this.canvas,g=this.context,v=p.width,f=p.height;g.save(),g.globalCompositeOperation=n?"destination-out":"destination-in",null!=this._maskScale?(c=l.cutWidth*this._maskScale,u=l.cutHeight*this._maskScale):(c=v,u=f);var m=(v-c)/2,y=(f-u)/2;return this.drawFrame(this._maskKey,this._maskFrame,m,y,c,u),g.restore(),d&&(g.save(),g.globalCompositeOperation="destination-over",g.fillStyle=o,g.fillRect(0,0,v,f),g.restore()),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}t.register("alphaMaskImage",(function(t,e,i,s,r){var n=new Iu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Iu);const Du=Phaser.Math.Linear,Au=Phaser.Math.Percent;var ju={setValue(t,e,i){return null==t||(void 0!==e&&(t=Au(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=Au(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Du(t,e,i)),i}};const zu=Phaser.Math.Percent;var Fu={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=zu(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new eu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new eu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Yu=Phaser.Utils.Objects.GetValue,Xu=Phaser.Math.Clamp;function Wu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Yu(t,"eventEmitter",this);var e=Yu(t,"valuechangeCallback",null);if(null!==e){var i=Yu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Yu(t,"easeValue.duration",0)).setEaseValueFunction(Yu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Xu(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,ju,Fu),e}const Vu=Phaser.Math.RadToDeg,Gu=Phaser.Math.DegToRad;var Hu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Gu(n),d=Gu(a),c=Math.cos(l),u=Math.sin(l),p=Math.cos(d),g=Math.sin(d);return t.startAt(e+c*s,i+u*s),t.arc(e,i,s,n,a,o),h&&0===r||(t.lineTo(e+p*r,i+g*r),r>0&&t.arc(e,i,r,a,n,!o)),t.close(),t},Uu={buildShapes(){var t=this.iterations;this.addShape((new Nc).setIterations(t).setName("track")).addShape((new Nc).setIterations(t).setName("bar")).addShape((new wc).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Hu(r,t,t,i,s,0,360,!1)):r.reset();var n,a,o,h=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(n=!1,a=0,o=360):(n=this.anticlockwise,a=Vu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Hu(h,t,t,i+1,s-1,a,o,!1)):h.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const Nu=Phaser.Utils.Objects.GetValue,$u=Phaser.Utils.Objects.IsPlainObject,Ku=Phaser.Math.Clamp,Ju=Phaser.Math.DegToRad(270);let qu=class extends(Wu(gc)){constructor(t,e,i,s,r,n,a){$u(e)&&(e=Nu(a=e,"x",0),i=Nu(a,"y",0),s=Nu(a,"radius",1),r=Nu(a,"barColor",void 0),n=Nu(a,"value",0)),void 0===s&&(s=1);var o=2*s;super(t,e,i,o,o),this.type="rexCircularProgress",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Nu(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Nu(a,"centerColor",void 0)),this.setThickness(Nu(a,"thickness",.2)),this.setStartAngle(Nu(a,"startAngle",Ju)),this.setAnticlockwise(Nu(a,"anticlockwise",!1)),this.iterations=Nu(a,"iterations",128),this.buildShapes(),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Ku(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}};Object.assign(qu.prototype,Uu),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new qu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",qu);var Zu=function(t,e,i,s,r,n,a,o,h,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=o&&(e.strokeStyle=o,e.lineWidth=h,e.stroke())};const Qu=Phaser.Math.PI2;var tp=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,o=this.startAngle,h=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),Zu(0,n,e,e,s,s,void 0,this.trackColor,i,o,h,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?h:a?(o-l*this.value+Qu)%Qu:(o+l*this.value)%Qu,n.save(),this.barColor2){var u=e+s*Math.cos(o),p=e+s*Math.sin(o),g=e+s*Math.cos(d),v=e+s*Math.sin(d),f=n.createLinearGradient(u,p,g,v);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;Zu(0,n,e,e,s,s,void 0,c,i,o,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),Zu(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,o,h,l,d){void 0===h&&null!=o&&(h=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=o,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=o&&"none"!==o&&h>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const ep=Phaser.Utils.Objects.GetValue,ip=Phaser.Utils.Objects.IsPlainObject,sp=Phaser.Math.Clamp,rp=Phaser.Math.DegToRad(270),np=Phaser.Math.PI2;class ap extends(Wu(Nt)){constructor(t,e,i,s,r,n,a){ip(e)&&(e=ep(a=e,"x",0),i=ep(a,"y",0),s=ep(a,"radius",1),r=ep(a,"barColor",void 0),n=ep(a,"value",0));var o=2*s;super(t,e,i,o,o,ep(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(ep(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(ep(a,"barColor2",void 0)),this.setCenterColor(ep(a,"centerColor",void 0)),this.setThickness(ep(a,"thickness",.2)),this.setStartAngle(ep(a,"startAngle",rp)),this.setEndAngle(ep(a,"endAngle",this.startAngle+np)),this.setAnticlockwise(ep(a,"anticlockwise",!1)),this.setTextColor(ep(a,"textColor",void 0)),this.setTextStrokeColor(ep(a,"textStrokeColor",void 0),ep(a,"textStrokeThickness",void 0));var h=ep(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(ep(a,"textSize","16px"),ep(a,"textFamily","Courier"),ep(a,"textStyle","")),this.setTextFormatCallback(ep(a,"textFormatCallback",void 0),ep(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=op(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=op(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=op(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=sp(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),tp.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var op=function(t,e,i){return i?t<=e?np+t-e:t-e:t>=e?np+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new ap(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",ap);var hp=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const lp=Phaser.Utils.Objects.GetValue,dp=Phaser.Utils.Objects.IsPlainObject;let cp=class extends(Wu(gc)){constructor(t,e,i,s,r,n,a,o){dp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):dp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):dp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Nc).setName("trackFill")).addShape((new Nc).setName("bar")).addShape((new Nc).setName("trackStroke")),this.setTrackColor(lp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(lp(o,"trackStrokeThickness",2),lp(o,"trackStrokeColor",void 0)),this.setSkewX(lp(o,"skewX",0)),this.setRTL(lp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}};var up={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&hp(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),hp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&hp(o,0,0,e,i,t)}};Object.assign(cp.prototype,up),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new cp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",cp);var pp=function(t,e,i,s,r){t.setIterations(r).start();var n=s.tl;if(Et(n))if(n.convex){var a=n.x,o=n.y;t.ellipticalArc(a,o,n.x,n.y,180,270,!1)}else a=0,o=0,t.ellipticalArc(a,o,n.x,n.y,90,0,!0);else t.lineTo(0,0);return n=s.tr,Et(n)?n.convex?(a=e-n.x,o=n.y,t.ellipticalArc(a,o,n.x,n.y,270,360,!1)):(a=e,o=0,t.ellipticalArc(a,o,n.x,n.y,180,90,!0)):t.lineTo(e,0),n=s.br,Et(n)?n.convex?(a=e-n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,0,90,!1)):(a=e,o=i,t.ellipticalArc(a,o,n.x,n.y,270,180,!0)):t.lineTo(e,i),n=s.bl,Et(n)?n.convex?(a=n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,90,180,!1)):(a=0,o=i,t.ellipticalArc(a,o,n.x,n.y,360,270,!0)):t.lineTo(0,i),t.close(),t},gp=Phaser.Math.RadToDeg,vp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(Et(a)){l=n>a.x?90:gp(Math.acos((a.x-n)/a.x));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,0);if(a=s.tr,Et(a)&&n>e-a.x){var l=90-gp(Math.acos((n-(e-a.x))/a.x));o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)}else t.lineTo(n,0);a=s.br,Et(a)&&n>e-a.x?(l=90-gp(Math.acos((n-(e-a.x))/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)):t.lineTo(n,i),a=s.bl,Et(a)?(l=n>a.x?90:gp(Math.acos((a.x-n)/a.x)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,i)},fp=Phaser.Math.RadToDeg,mp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(Et(a)){l=n>a.y?90:fp(Math.acos((a.y-n)/a.y));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)}else t.lineTo(0,0);if(a=s.tr,Et(a)?(l=n>a.y?90:fp(Math.acos((a.y-n)/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)):t.lineTo(e,0),a=s.br,Et(a)&&n>i-a.y){var l=90-fp(Math.acos((n-(i-a.y))/a.y));o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)}else t.lineTo(e,n);a=s.bl,Et(a)&&n>i-a.y?(l=90-fp(Math.acos((n-(i-a.y))/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,n)},yp=Phaser.Math.RadToDeg,bp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(Et(a)){l=n>a.x?90:yp(Math.acos((a.x-n)/a.x));var o=e-a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)}else t.lineTo(e,0);if(a=s.br,Et(a)?(l=n>a.x?90:yp(Math.acos((a.x-n)/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)):t.lineTo(e,i),a=s.bl,Et(a)&&n>e-a.x){var l=90-yp(Math.acos((n-(e-a.x))/a.x));o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)}else t.lineTo(e-n,i);a=s.tl,Et(a)&&n>e-a.x?(l=90-yp(Math.acos((n-(e-a.x))/a.x)),o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)):t.lineTo(e-n,0)},xp=Phaser.Math.RadToDeg,Cp=function(t,e,i,s,r){var n=i*r,a=s.br;if(Et(a)){l=n>a.y?90:xp(Math.acos((a.y-n)/a.y));var o=e-a.x,h=i-a.y;t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)}else t.lineTo(e,i);if(a=s.bl,Et(a)?(l=n>a.y?90:xp(Math.acos((a.y-n)/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)):t.lineTo(0,i),a=s.tl,Et(a)&&n>i-a.y){var l=90-xp(Math.acos((n-(i-a.y))/a.y));o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,i-n);a=s.tr,Et(a)&&n>i-a.y?(l=90-xp(Math.acos((n-(i-a.y))/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)):t.lineTo(e,i-n)},kp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},wp=function(t){return"string"==typeof t&&(t=kp[t]),t};const Sp=Phaser.Utils.Objects.GetValue,Pp=Phaser.Utils.Objects.IsPlainObject;class Tp extends(Wu(gc)){constructor(t,e,i,s,r,n,a,o,h){Pp(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Pp(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Pp(n)&&(n=(h=n).radius,a=h.barColor,o=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===o&&(o=0),super(t,e,i,s,r,h),this.type="rexRoundRectangleProgress",this.bootProgressBase(h),this.addShape((new Nc).setName("trackFill")).addShape((new Nc).setName("bar")).addShape((new Nc).setName("trackStroke")),this.setTrackColor(Sp(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Sp(h,"trackStrokeThickness",2),Sp(h,"trackStrokeColor",void 0)),this.setOrientation(Sp(h,"orientation",0)),this.setRTL(Sp(h,"rtl",!1)),this.rrGeom=new Pt,this.setRadius(n),this.setIteration(Sp(n,"iteration",void 0)),this.setValue(o)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){t=wp(t),this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Op={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,n=this.rtl,a=this.iteration+1,o=this.getShape("trackFill");o.fillStyle(this.trackColor),o.isFilled&&pp(o,t,e,i,a);var h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&function(t,e,i,s,r,n,a,o){t.setIterations(o).start(),0===r||(1===r?pp(t,e,i,s,o):((0===n?a?bp:vp:a?Cp:mp)(t,e,i,s,r),t.close()))}(h,t,e,i,s,r,n,a);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&pp(l,t,e,i,a)}};Object.assign(Tp.prototype,Op),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Tp(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Tp);var Mp=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Mp(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},_p=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var o;return r>=0?((o=n[0]).x=t+r,o.y=e,(o=n[1]).x=i+r,o.y=e,(o=n[2]).x=i,o.y=s,(o=n[3]).x=t,o.y=s):((o=n[0]).x=t,o.y=e,(o=n[1]).x=i,o.y=e,(o=n[2]).x=i-r,o.y=s,(o=n[3]).x=t-r,o.y=s),n};const Rp=Phaser.Utils.Objects.GetValue,Lp=Phaser.Utils.Objects.IsPlainObject;class Bp extends(Wu(Nt)){constructor(t,e,i,s,r,n,a,o){Lp(e)?(e=Rp(o=e,"x",0),i=Rp(o,"y",0),s=Rp(o,"width",2),r=Rp(o,"height",2),n=Rp(o,"barColor",void 0),a=Rp(o,"value",0)):Lp(s)?(s=Rp(o=s,"width",2),r=Rp(o,"height",2),n=Rp(o,"barColor",void 0),a=Rp(o,"value",0)):Lp(n)&&(n=Rp(o=n,"barColor",void 0),a=Rp(o,"value",0)),super(t,e,i,s,r,Rp(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(Rp(o,"trackColor",void 0)),this.setBarColor(n,Rp(o,"barColor2",void 0),Rp(o,"isHorizontalGradient",void 0)),this.setTrackStroke(Rp(o,"trackStrokeThickness",2),Rp(o,"trackStrokeColor",void 0)),this.setSkewX(Rp(o,"skewX",0)),this.setRTL(Rp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Ep.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new Bp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",Bp),Phaser.Math.Wrap;const Ip=Phaser.Math.Linear;var Dp=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Ip(b.a.x,x.a.x,C),e=Ip(b.a.y,x.a.y,C),i=Ip(b.b.x,x.b.x,C),s=Ip(b.b.y,x.b.y,C),r=Ip(b.c.x,x.c.x,C),n=Ip(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Ap=(0,Phaser.Math.DegToRad)(120);var jp=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Ap),i+s*Math.sin(r+Ap)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Ap),i+s*Math.sin(r-Ap)),this.arrowOnly?t.end():t.close()},zp={buildShapes(){this.addShape((new Nc).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Dp.call(this):jp.call(this)}},Fp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new eu(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Yp=Phaser.Utils.Objects.GetValue,Xp=Phaser.Utils.Objects.IsPlainObject,Wp=Phaser.Math.DegToRad,Vp=Phaser.Math.RadToDeg;class Gp extends gc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Xp(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Up(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Yp(r,"x",null);null!==n?(t=n,i=n):(t=Yp(r,"left",0),i=Yp(r,"right",t));var a=Yp(r,"y",null);null!==a?(e=a,s=a):(e=Yp(r,"top",0),s=Yp(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Vp(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Wp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Hp={right:0,down:1,left:2,up:3};var Up=function(t){return"string"==typeof t&&(t=Hp[t]),t%=4};Object.assign(Gp.prototype,zp,Fp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Gp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Gp),F();const Np=Phaser.GameObjects.Zone,$p=Phaser.Utils.Array.Add,Kp=Phaser.Utils.Array.Remove;let Jp=class extends Np{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[]}destroy(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),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return $p(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Kp(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iig(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eig(t).x,getChildLocalY:t=>ig(t).y};const yg=Phaser.Math.DegToRad;var bg={updateChildRotation(t){var e=ig(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=ig(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return ig(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return ig(t).rotation=yg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=ig(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>ig(t).rotation},xg={updateChildScale(t){var e=ig(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=ig(t),i=e.parent;return e.scaleX=fg(t.scaleX,i.scaleX),e.scaleY=fg(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=ig(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=ig(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>ig(t).scaleX,getChildLocalScaleY:t=>ig(t).scaleY},Cg={updateChildVisible(t){var e=ig(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=ig(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),ig(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),ig(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=ig(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>ig(t).visible},kg={updateChildAlpha(t){var e=ig(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=ig(t),i=e.parent;return e.alpha=fg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return ig(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=ig(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>ig(t).alpha},wg={updateChildActive(t){var e=ig(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return ig(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),ig(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=ig(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>ig(t).active},Sg={updateChildScrollFactor(t){var e=ig(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Pg={updateCameraFilter(t){var e=ig(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Tg={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Og=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},Mg={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Eg=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Rg=Phaser.Utils.Array;var Lg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Hv=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Uv=/(\S+)\[(\d+)\]/i;var Nv={getInnerPadding(t){return Ps(this.space,t)},setInnerPadding(t,e){return Ts(this.space,t,e),this},getOuterPadding(t){return Ps(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ts(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ps(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ts(this.getSizerConfig(t).padding,e,i),this}},$v=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Kv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Jv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},qv=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Zv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Qv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},tf={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},ef=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var gm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=_a(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},vm={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=h),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=h),this.transitOutCallback=t,this}},fm={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},mm={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},ym={};Object.assign(ym,gm,vm,fm,mm);const bm=Phaser.Utils.Objects.GetValue;class xm extends La{constructor(t,e){super(t,e),this.setTransitInTime(bm(e,"duration.in",200)),this.setTransitOutTime(bm(e,"duration.out",200)),this.setTransitInCallback(bm(e,"transitIn")),this.setTransitOutCallback(bm(e,"transitOut")),this.oneShotMode=bm(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new pm(this,{eventEmitter:!1,initState:bm(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(xm.prototype,ym);const Cm=Phaser.GameObjects.Rectangle;class km extends Cm{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ed(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const wm=Phaser.Utils.Objects.GetValue;class Sm extends La{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(wm(t,"hitAreaMode",0)),this.setEnable(wm(t,"enable",!0)),this.setStopMode(wm(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Pm[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Pm={default:0,fullWindow:1};const Tm=Phaser.Utils.Objects.GetValue;class Om extends km{constructor(t,e){super(t,Tm(e,"color",0),Tm(e,"alpha",.8)),this.touchEventStop=new Sm(this,{hitAreaMode:1})}}var Mm={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,mf(t,e)},scaleDown(t,e){yf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Mf(t,e)},fadeOut(t,e){Ef(t,e,!1)}},Em=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Mf(t,e,t.alpha)},_m=function(t,e){Ef(t,e,!1)},Rm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Vn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Lm=Phaser.Utils.Objects.GetValue;let Bm=class extends xm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Im.popUp),null==e.transitOut&&(e.transitOut=Im.scaleDown),e.destroy=Lm(e,"destroy",!0),super(t,e);var i=Lm(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Om(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Lm(i,"transitIn",Em)),this.setCoverTransitOutCallback(Lm(i,"transitOut",_m)));var s=Lm(e,"touchOutsideClose",!1),r=Lm(e,"duration.hold",-1),n=Lm(e,"timeOutClose",r>=0),a=Lm(e,"anyTouchClose",!1);Lm(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Lm(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Rm(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Im[t]),t){case Im.popUp:t=Mm.popUp;break;case Im.fadeIn:t=Mm.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Im[t]),t){case Im.scaleDown:t=Mm.scaleDown;break;case Im.fadeOut:t=Mm.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Im={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Dm=function(t,e){var i=new Bm(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i},Am=function(t,e){t.emit("modal.requestClose",e)},jm=function(t){return t&&"function"==typeof t},zm={modal(t,e){return jm(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=Dm(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return Am(this,t),this}},Fm=function(t,e,i,s,r){jm(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Ym={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Fm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Fm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Fm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Fm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Fm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Fm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Fm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Fm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Fm.call(this,"shutdown",t,e,i,s),this}},Xm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Wm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Wm={},Vm=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Rm(t,e.x,e.y,i,s):!!(r=Xm(e,n,!0))&&Rm(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const iy={press:0,pointerdown:0,release:1,pointerup:1};var sy={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new ey(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class ry extends um{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const ny=Phaser.Utils.Objects.GetValue;class ay extends La{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ry,this.parent.setInteractive(ny(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(ny(t,"enable",!0)),this.setCooldown(ny(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var oy={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Vm(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new ay(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new ay(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},hy={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},ly=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Py,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ty&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Py,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Oy,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Vm(t,s,e,i)}}const Py=0,Ty=1,Oy="IDLE",My=Phaser.Utils.Objects.GetValue,Ey=Phaser.Math.Distance.Between;class _y extends Sy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Ry},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(My(t,"time",250)),this.setTapInterval(My(t,"tapInterval",200)),this.setDragThreshold(My(t,"threshold",9)),this.setTapOffset(My(t,"tapOffset",10));var e=My(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(My(t,"maxTaps",void 0)),this.setMinTaps(My(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Ry:this.state=Ly;break;case Ly:var t=this.lastPointer;Ey(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=By,this.state=Ly);break;case By:this.state=Ly}}onDragEnd(){this.state===Ly&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=By))}onDrag(){this.state!==Ry&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ry)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Ly){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Ry):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=By:this.state=Ry)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===By&&(this.state=Ry)}get isTapped(){return this.state===By}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Ry="IDLE",Ly="BEGIN",By="RECOGNIZED",Iy=Phaser.Utils.Objects.GetValue;class Dy extends Sy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Ay},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Iy(t,"threshold",9)),this.setHoldTime(Iy(t,"time",251)),this}onDragStart(){this.state=jy,0===this.holdTime&&(this.state=zy)}onDragEnd(){this.state=Ay}onDrag(){this.state!==Ay&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ay)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===jy&&t-this.pointer.downTime>=this.holdTime&&(this.state=zy)}get isPressed(){return this.state===zy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Ay="IDLE",jy="BEGIN",zy="RECOGNIZED",Fy=Phaser.Utils.Objects.GetValue;class Yy extends Sy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=Xm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Xy},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Fy(t,"threshold",10)),this}onDragStart(){this.state=Wy,0===this.dragThreshold&&(this.state=Vy)}onDragEnd(){this.state=Xy}onDrag(){switch(this.state){case Wy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Vy,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case Vy:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=Xm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Vy}setDragThreshold(t){return this.dragThreshold=t,this}}const Xy="IDLE",Wy="BEGIN",Vy="RECOGNIZED",Gy=Phaser.Math.Distance.Between,Hy=Phaser.Math.Angle.Between;var Uy={getDt:function(){return nc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Gy(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Hy(e.x,e.y,t.x,t.y)}},Ny={"up&down":0,"left&right":1,"4dir":2,"8dir":3},$y={};const Ky=Phaser.Utils.Objects.GetValue,Jy=Phaser.Math.RadToDeg;class qy extends Sy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Zy},eventEmitter:!1};this.setRecongizedStateObject(new um(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ky(t,"threshold",10)),this.setVelocityThreshold(Ky(t,"velocityThreshold",1e3)),this.setDirectionMode(Ky(t,"dir","8dir")),this}onDragStart(){this.state=Qy}onDragEnd(){this.state=Zy}onDrag(){this.state===Qy&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=tb))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tb&&(this.state=Zy)}get isSwiped(){return this.state===tb}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Ny[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=$y),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Jy(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(qy.prototype,Uy);const Zy="IDLE",Qy="BEGIN",tb="RECOGNIZED",eb=Phaser.Utils.Objects.GetValue,ib=Phaser.Utils.Array.SpliceOne,sb=Phaser.Math.Distance.Between,rb=Phaser.Math.Angle.Between;class nb{constructor(t,e){var i=_a(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(eb(e,"inputConfig",void 0)),this.setEventEmitter(eb(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(eb(t,"enable",!0)),this.bounds=eb(t,"bounds",void 0),this.tracerState=ob,this.pointers.length=0,q(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,q(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case ob:this.tracerState=hb,this.onDrag1Start();break;case hb:this.tracerState=lb,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],ib(this.pointers,e),this.tracerState){case hb:this.tracerState=ob,this.onDrag1End();break;case lb:this.tracerState=hb,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case hb:this.onDrag1();break;case lb:this.onDrag2()}}}dragCancel(){return this.tracerState===lb&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=ob,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==lb)return 0;var t=this.pointers[0],e=this.pointers[1];return sb(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==lb)return 0;var t=this.pointers[0],e=this.pointers[1];return rb(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;ab.x=e.x-i.x,ab.y=e.y-i.y}else ab.x=0,ab.y=0;return ab}get centerX(){if(this.tracerState!==lb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==lb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==lb)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==lb)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=db,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Vm(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Vm(t,s,e,i)}}Object.assign(nb.prototype,ln);var ab={};const ob=0,hb=1,lb=2,db="IDLE",cb=Phaser.Utils.Objects.GetValue;class ub extends nb{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=pb},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cb(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=gb,0===this.dragThreshold&&(this.state=vb)}onDrag2End(){this.state=pb}onDrag2(){switch(this.state){case gb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=vb}break;case vb:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===vb}setDragThreshold(t){return this.dragThreshold=t,this}}const pb="IDLE",gb="BEGIN",vb="RECOGNIZED",fb=Phaser.Math.RotateAround;var mb=function(t,e,i,s){return fb(t,e,i,s),t.rotation+=s,t},yb={};const bb=Phaser.Utils.Objects.GetValue,xb=Phaser.Math.Angle.WrapDegrees,Cb=Phaser.Math.Angle.ShortestBetween,kb=Phaser.Math.RadToDeg,wb=Phaser.Math.DegToRad;class Sb extends nb{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevAngle=void 0,i.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("rotatestart",i)},exit:function(){i.emit("rotateend",i)}}},init:function(){this.state=Tb},eventEmitter:!1};this.setRecongizedStateObject(new um(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(bb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=xb(kb(this.angleBetween)),this.state=Ob,0===this.dragThreshold&&(this.state=Mb)}onDrag2End(){this.state=Tb}onDrag2(){switch(this.state){case Ob:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=xb(kb(this.angleBetween));this.angle=Cb(this.prevAngle,t),this.prevAngle=t,this.state=Mb}break;case Mb:t=xb(kb(this.angleBetween)),this.angle=Cb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Mb}get rotation(){return wb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var Pb={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=yb),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=Lv(s),Ub(r)?(u.expandWidth=Nb(r,"width",!1),u.expandHeight=Nb(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?jn(t):n),u.expandHeight&&(t.minHeight=void 0===a?zn(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}};const qb=qg.prototype.clear;var Zb=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),qb.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Gb.width=e.aspectRatio,Gb.height=1,Hb.width=l,Hb.height=d,l=(c=Yb(Gb,Hb,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),Vb(t,this)):nf(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=jn(t)),void 0===d&&(d=zn(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,Jm.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(tx,Jb,Qb);var ex=function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null};const ix=Phaser.Utils.Objects.IsPlainObject,sx=Phaser.Utils.Objects.GetValue;class rx extends Fb{constructor(t,e,i,s,r,n){ix(e)?(e=sx(n=e,"x",0),i=sx(n,"y",0),s=sx(n,"width",void 0),r=sx(n,"height",void 0)):ix(s)&&(s=sx(n=s,"width",void 0),r=sx(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return ex(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(rx.prototype,tx);var nx=Phaser.Math.Distance.Between,ax=function(t,e,i){var s=t.width/2;return nx(s,s,e,i)<=s};const ox=Phaser.Math.Angle.Between,hx=Phaser.Math.Angle.Normalize;var lx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(ax(s,e,i)){var r=s.width/2,n=s.startAngle,a=ox(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=hx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},dx=function(){this.sizerChildren.knob.on("pointerdown",lx,this).on("pointermove",lx,this).setInteractive()};const cx=Phaser.Math.Angle.Between,ux=Phaser.Math.Angle.Wrap;var px=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;ax(s,e,i)&&fx.call(this,t)}},gx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case bx:ax(s,e,i)&&fx.call(this,t);break;case xx:ax(s,e,i)?yx.call(this):mx.call(this)}}},vx=function(t,e,i){this.enable&&this.panPointer===t&&mx.call(this)},fx=function(t){this.panPointer=t,this.panState=xx},mx=function(){this.panPointer=void 0,this.panState=bx},yx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=cx(i.x,i.y,t.x,t.y),r=cx(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=ux(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const bx=0,xx=1;var Cx=function(){this.sizerChildren.knob.on("pointerdown",px,this).on("pointermove",gx,this).on("pointerup",vx,this).setInteractive(),this.panPointer=void 0,this.panState=bx},kx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},wx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:kx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(kx.call(this,t)),e.layout&&e.layout()),this}};const Sx=Phaser.Utils.Objects.GetValue,Px=Phaser.Math.Snap.To;class Tx extends(Wu(rx)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Sx(e,"background",void 0),s=Sx(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Sx(e,"textFormatCallback",void 0),Sx(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new ap(t,e);r.setDepth(Sx(e,"knobDepth",0)),r._value=-1,t.add.existing(r),this.add(r,"knob"),s&&(this.add(s,"text","center",0,!1),t.children.moveBelow(r,s)),this.addChildrenMap("background",i),this.addChildrenMap("knob",r),this.addChildrenMap("text",s),this.setEnable(Sx(e,"enable",void 0)),this.setGap(Sx(e,"gap",void 0)),this.setValue(Sx(e,"value",0),Sx(e,"min",void 0),Sx(e,"max",void 0));var n=Sx(e,"input",0);switch("string"==typeof n&&(n=Ox[n]),n){case 0:Cx.call(this);break;case 1:dx.call(this)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t){return this.gap=t,this}get value(){return this.sizerChildren.knob.value}set value(t){void 0!==this.gap&&(t=Px(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter))}}const Ox={pan:0,drag:0,click:1,none:-1};Object.assign(Tx.prototype,wx),t.register("knob",(function(t){var e=new Tx(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",Tx);const Mx={arc:kc,circle:wc,curve:class extends xc{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;ethis.value)for(var d=0;dthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0?d.pop().setTexture(u,O):r(c,u,O),h&&c.add.existing(T),l){var M=b+k*P+a*k,E=x+w*S+o*w;T.setOrigin(a,o).setPosition(M,E).setScale(v,f).setRotation(m),lk(T,b,x,m)}C.push(T)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a))),e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode&&(s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))))};Object.assign(bk.prototype,uk);const Ck={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new bk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",bk);const kk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,wk=Phaser.Utils.Objects.GetValue,Sk=Phaser.Math.Clamp;class Pk extends kk{constructor(t){super({name:"rexDissolvePostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n// Scene buffer\nuniform sampler2D uMainSampler;\nuniform sampler2D uMainSampler2;\n\nuniform int resizeMode;\nuniform float progress;\nuniform float fromRatio;\nuniform float toRatio;\nvarying vec2 outFragCoord;\n// Effect parameters\nuniform float noiseX;\nuniform float noiseY;\nuniform float noiseZ;\nuniform float fromEdgeStart;\nuniform float fromEdgeWidth;\nuniform float toEdgeStart;\nuniform float toEdgeWidth;\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nvec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); }\nfloat Perlin(vec3 P) {\n vec3 i0 = mod289(floor(P)), i1 = mod289(i0 + vec3(1.0));\n vec3 f0 = fract(P), f1 = f0 - vec3(1.0), f = fade(f0);\n vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x), iy = vec4(i0.yy, i1.yy);\n vec4 iz0 = i0.zzzz, iz1 = i1.zzzz;\n vec4 ixy = permute(permute(ix) + iy), ixy0 = permute(ixy + iz0), ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0), gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n vec4 gx1 = ixy1 * (1.0 / 7.0), gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0); gx1 = fract(gx1);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0), sz0 = step(gz0, vec4(0.0));\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1), sz1 = step(gz1, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g0 = vec3(gx0.x,gy0.x,gz0.x), g1 = vec3(gx0.y,gy0.y,gz0.y),\n g2 = vec3(gx0.z,gy0.z,gz0.z), g3 = vec3(gx0.w,gy0.w,gz0.w),\n g4 = vec3(gx1.x,gy1.x,gz1.x), g5 = vec3(gx1.y,gy1.y,gz1.y),\n g6 = vec3(gx1.z,gy1.z,gz1.z), g7 = vec3(gx1.w,gy1.w,gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g0,g0), dot(g2,g2), dot(g1,g1), dot(g3,g3)));\n vec4 norm1 = taylorInvSqrt(vec4(dot(g4,g4), dot(g6,g6), dot(g5,g5), dot(g7,g7)));\n g0 *= norm0.x; g2 *= norm0.y; g1 *= norm0.z; g3 *= norm0.w;\n g4 *= norm1.x; g6 *= norm1.y; g5 *= norm1.z; g7 *= norm1.w;\n vec4 nz = mix(vec4(dot(g0, vec3(f0.x, f0.y, f0.z)), dot(g1, vec3(f1.x, f0.y, f0.z)),\n dot(g2, vec3(f0.x, f1.y, f0.z)), dot(g3, vec3(f1.x, f1.y, f0.z))),\n vec4(dot(g4, vec3(f0.x, f0.y, f1.z)), dot(g5, vec3(f1.x, f0.y, f1.z)),\n dot(g6, vec3(f0.x, f1.y, f1.z)), dot(g7, vec3(f1.x, f1.y, f1.z))), f.z);\n return 2.2 * mix(mix(nz.x,nz.z,f.y), mix(nz.y,nz.w,f.y), f.x);\n}\nfloat Perlin(vec2 P) { return Perlin(vec3(P, 0.0)); }\n\n\nvec4 getFromColor (vec2 uv) {\n return texture2D(uMainSampler, uv);\n}\n\nvec4 getToColor (vec2 uv) {\n if (resizeMode == 2) {\n // cover\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(min(fromRatio / toRatio, 1.0), min((toRatio / fromRatio), 1.0)));\n } else if (resizeMode == 1) {\n // contain\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(max(fromRatio / toRatio, 1.0), max((toRatio / fromRatio), 1.0)));\n } else {\n // stretch\n return texture2D(uMainSampler2, vec2(uv.x, 1.0 - uv.y));\n }\n}\n\nvec4 transition (vec2 uv) { \n vec4 colorFront = getFromColor(uv);\n vec4 colorTo = getToColor(uv);\n\n float noise = (Perlin(vec3(uv.x * noiseX, uv.y * noiseY, noiseZ)) + 1.0) / 2.0\n * (1.0 - (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth))\n + (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth) * 0.5;\n vec4 colorResult = colorFront * smoothstep(progress - (fromEdgeStart + fromEdgeWidth), progress - fromEdgeStart, noise)\n + colorTo * smoothstep((1.0 - progress) - (toEdgeStart + toEdgeWidth), (1.0 - progress) - toEdgeStart, (1.0 - noise));\n return colorResult;\n}\n\nvoid main () {\n vec2 uv = outFragCoord;\n gl_FragColor = transition(uv);\n}\n"}),this._progress=0,this.toFrame=null,this.targetTexture=null,this.resizeMode=1,this.toRatio=1,this.noiseX=0,this.noiseY=0,this.noiseZ=0,this.fromEdgeStart=.01,this.fromEdgeWidth=.05,this.toEdgeStart=.01,this.toEdgeWidth=.05}resetFromJSON(t){return this.setProgress(wk(t,"progress",0)),this.setTransitionTargetTexture(wk(t,"toTexture","__DEFAULT"),wk(t,"toFrame",void 0),wk(t,"resizeMode",1)),this.setNoise(wk(t,"noiseX",void 0),wk(t,"noiseY",void 0),wk(t,"noiseZ",void 0)),this.setFromEdge(wk(t,"fromEdgeStart",.01),wk(t,"fromEdgeWidth",.05)),this.setToEdge(wk(t,"toEdgeStart",.01),wk(t,"toEdgeWidth",.05)),this}onBoot(){}onPreRender(){this.set1f("progress",this.progress),this.set1i("resizeMode",this.resizeMode),this.set1f("noiseX",this.noiseX),this.set1f("noiseY",this.noiseY),this.set1f("noiseZ",this.noiseZ),this.set1f("fromEdgeStart",this.fromEdgeStart),this.set1f("fromEdgeWidth",this.fromEdgeWidth),this.set1f("toEdgeStart",this.toEdgeStart),this.set1f("toEdgeWidth",this.toEdgeWidth)}onDraw(t){this.set1f("fromRatio",t.width/t.height),this.set1f("toRatio",this.toRatio),this.set1i("uMainSampler2",1),this.bindTexture(this.targetTexture,1),this.bindAndDraw(t)}get progress(){return this._progress}set progress(t){this._progress=Sk(t,0,1)}setProgress(t){return this.progress=t,this}setTransitionTargetTexture(t,e,i){void 0===t&&(t="__DEFAULT");var s=this.game.textures.getFrame(t,e);return s||(s=this.game.textures.getFrame("__DEFAULT")),this.toRatio=s.width/s.height,this.toFrame=s,this.targetTexture=s.glTexture,void 0!==i&&(this.resizeMode=i),this}setResizeMode(t){return"string"==typeof t&&(t=Tk[t]),this.resizeMode=t,this}setNoise(t,e,i){return void 0===t&&(t=4+6*Math.random()),void 0===e&&(e=4+6*Math.random()),void 0===i&&(i=10*Math.random()),this.noiseX=t,this.noiseY=e,this.noiseZ=i,this}setFromEdge(t,e){return this.fromEdgeStart=t,this.fromEdgeWidth=e,this}setToEdge(t,e){return this.toEdgeStart=t,this.toEdgeWidth=e,this}}var Tk={stretch:0,contain:1,cover:2};const Ok=Phaser.Utils.Array.SpliceOne,Mk=.1,Ek=[function(t){t.addTransitionMode("slideAwayRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}})},function(t){t.addTransitionMode("slideRight",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(s-1);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideLeft",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(1-s);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideDown",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(s-1);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideUp",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(1-s);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("pushRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0),r=i.width*(s-1),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0),r=i.width*(1-s),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r),r=i.height*(s-1),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r),r=i.height*(1-s),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("zoomOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=1-s;t.setChildLocalScale(e,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1)}}).addTransitionMode("zoomIn",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=s;t.setChildLocalScale(i,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(i,1,1)}}).addTransitionMode("zoomInOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(r=1-So(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-So(s),t.setChildLocalScale(i,r,r))},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildLocalScale(i,1,1),t.setChildVisible(i,!0),i.tint=16777215}})},function(t){t.addTransitionMode("fade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(s=So(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=So(s),r=Math.floor(255*(1-s)),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}}).addTransitionMode("crossFade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){t.setChildLocalAlpha(e,1-s),t.setChildLocalAlpha(i,s)},onComplete:function(t,e,i,s){t.setChildLocalAlpha(e,1)}})},function(t){var e,i=(e=t.scene,new Vx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){this.getShape("rect").fillStyle(16777215).setSize(this.width*this.value,this.height*this.value).setCenterPosition(this.centerX,this.centerY)}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("irisOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=So(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=So(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Vx(e,{type:"Graphics",create:[{name:"pie",type:"arc"}],update:function(){var t=2*Math.max(this.width,this.height),e=90*this.value;this.getShape("pie").fillStyle(16777215).setCenterPosition(this.centerX,0).setRadius(t).setAngle(90-e,90+e).setPie()}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("pieOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=So(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=So(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Vx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){var t=this.getShape("rect").fillStyle(16777215),e=1-this.value;switch(this.wipeMode){case"right":t.setSize(this.width*e,this.height).setTopLeftPosition(this.width-t.width,0);break;case"left":t.setSize(this.width*e,this.height).setTopLeftPosition(0,0);break;case"down":t.setSize(this.width,this.height*e).setTopLeftPosition(0,this.height-t.height);break;case"up":t.setSize(this.width,this.height*e).setTopLeftPosition(0,0)}}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("wipeRight",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="right"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeLeft",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="left"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeDown",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="down"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeUp",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="up"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}})},function(t){var e=function(t,e){var i=new Vx(t,{type:"Graphics",create:{rectangle:e},update:function(){for(var t=this.getShapes(),i=this.width/e,s=0;s=0;s--)(a=r[s])instanceof e&&(a.destroy(),Ok(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,Pk),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Mk,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Mk,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Mk,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Mk,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class _k extends bk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Ek.length;at.dropEnable}),this.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var s in this.filters){for(var r=this.filters[s],n=[],a=0,o=i.length;a0&&this.emit(`drop.${s}`,n)}}),this)}get files(){return this._files}}Object.assign(gw.prototype,lw),t.register("fileDropZone",(function(t){var e=new gw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",gw);const vw=Phaser.Math.Wrap;var fw=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,a=0,o=n.length;a(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const xw=Phaser.Utils.Objects.IsPlainObject,Cw=Phaser.Utils.Objects.GetValue,kw=Phaser.Display.Align.CENTER,ww={min:0,full:-1};var Sw=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,p;Iv.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=ww[e];else if(xw(e)){var f;e=Cw(f=e,"proportion",void 0),i=Cw(f,"align",kw),s=Cw(f,"padding",0),r=Cw(f,"expand",!1),n=Cw(f,"key",void 0),a=Cw(f,"index",void 0),t.isRexSizer||(o=Cw(f,"minWidth",void 0),h=Cw(f,"minHeight",void 0)),l=Cw(f,"fitRatio",0),d=Cw(f,"offsetX",0),c=Cw(f,"offsetY",0),u=Cw(f,"offsetOriginX",0),p=Cw(f,"offsetOriginY",0)}return"string"==typeof i&&(i=tv[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=kw),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=jn(t)/zn(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=Lv(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?jn(t):o:t.minHeight=void 0===h?zn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Pw={add:Sw,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Sw.call(this,new yw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return xw(i)&&(i.index=t),Sw.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=bw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Tw=Phaser.Utils.Array.Remove;var Ow={remove(t,e){return this.getParentSizer(t)!==this||(Tw(this.sizerChildren,t),Xv.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Zb.call(this,t),this}},Mw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=tv[e]),this.getSizerConfig(t).align=e,this}},Ew={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},_w={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Rw={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Lw={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(nf(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,ef.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=qv.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Kv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&fw.call(this,t,void 0),Jv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Zv.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&fw.call(this,void 0,t),Qv.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Lw,Pw,Ow,Mw,Ew,_w,Rw);var Bw=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i};const Iw=Phaser.Utils.Objects.IsPlainObject,Dw=Phaser.Utils.Objects.GetValue;class Aw extends Fb{constructor(t,e,i,s,r,n,a){Iw(e)?(e=Dw(a=e,"x",0),i=Dw(a,"y",0),s=Dw(a,"width",void 0),r=Dw(a,"height",void 0),n=Dw(a,"orientation",0)):Iw(s)?(s=Dw(a=s,"width",void 0),r=Dw(a,"height",void 0),n=Dw(a,"orientation",0)):Iw(n)&&(n=Dw(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Dw(a,"space.item",0)),this.setStartChildIndex(Dw(a,"startChildIndex",0)),this.setRTL(Dw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=wp(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Bw.call(this)),this._childrenProportion}}Object.assign(Aw.prototype,Lw);var jw=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},zw={appendText:Mi,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Fw extends Aw{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(jw(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(jw(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&jw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&jw(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Fw.prototype,zw);var Yw=function(t,e,i,s){var r=new sk(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Xw=Phaser.GameObjects.Text;var Ww=function(t){return t instanceof Xw};const Vw=Phaser.GameObjects.BitmapText;var Gw=function(t){return t instanceof Vw},Hw=function(t){return Gw(t)?2:Ww(t)?0:1},Uw=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},$w=function(t,e){switch(Hw(t)){case 0:switch("string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Uw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e}},Kw=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof hn}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Gw(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return Ww(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const Jw=65535;var qw=function(t,e,i){if(null==e)return t;if(0===e)return tS(t,0,i),t;var s=t.text.length;if(0===s)return tS(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},a=Qw(t,r,e,i,n),o=0;o<=Jw&&0!==a;o++){if((r+=a)<0){r=0;break}a=Qw(t,r,e,i,n)}return o===Jw&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),tS(t,e,i),t},Zw=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Qw=function(t,e,i,s,r){var n,a=Zw(t,e,r),o=Zw(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},tS=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const eS=Phaser.Utils.Objects.GetValue;var iS=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=eS(e,"minWidth",0),s=eS(e,"minHeight",0),r=eS(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return qw(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),qw(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const sS=Phaser.Utils.Objects.GetValue;class rS extends Fw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=sS(e,"background",void 0),r=sS(e,"icon",void 0),n=sS(e,"iconMask",void 0),a=sS(e,"text",void 0),o=sS(e,"action",void 0),h=sS(e,"actionMask",void 0),l=sS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:sS(e,"space.icon",0),top:sS(e,"space.iconTop",0),bottom:sS(e,"space.iconBottom",0),left:sS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:sS(e,"space.icon",0),left:sS(e,"space.iconLeft",0),right:sS(e,"space.iconRight",0),top:sS(e,"space.iconTop",0)});var d=sS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Yw.call(this,r,r,1)),!d){var c=sS(e,"iconSize",void 0);this.setIconSize(sS(e,"iconWidth",c),sS(e,"iconHeight",c))}}if(a){var u=sS(e,"wrapText",!1),p=sS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),$w(a,u),e.expandTextWidth=!0,Kw(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,iS(a,{fitHeight:!0}));var g,v,f=sS(e,"space.text",0),m=sS(e,"expandTextWidth",!1),y=sS(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:sS(e,"space.actionTop",0),bottom:sS(e,"space.actionBottom",0),right:sS(e,"space.actionRight",0)}:{left:sS(e,"space.actionLeft",0),right:sS(e,"space.actionRight",0),bottom:sS(e,"space.actionBottom",0)},d=sS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Yw.call(this,o,o,1)),!d)){var b=sS(e,"actionSize");this.setActionSize(sS(e,"actionWidth",b),sS(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}const nS=Phaser.Utils.Objects.GetValue;var aS=function(t,e){var i=nS(e,"canvas"),s=nS(i,"width",128),r=nS(i,"height",128),n=new Eu(t,0,0,s,r);t.add.existing(n);var a=nS(i,"key"),o=nS(i,"frame"),h=nS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const oS=Phaser.Utils.Objects.GetValue;var hS=function(t,e){var i=oS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const lS=Phaser.Utils.Objects.GetValue,dS={accept:"image/*",multiple:!1};var cS=function(t,e){if(0!==e.length){var i=t.childrenMap.icon,s=i.image,r=e[0];return s.loadFromFilePromise(r).then((function(){return i.scaleImage(),t.emit("select",r,t),Promise.resolve(r)}))}},uS={async openPromise(){var t=this;return Zk(this.scene.game,dS).then((function(e){return cS(t,e.files)}))},open(){return this.openPromise(),this},setClickOpenEnable(t){return void 0===t&&(t=!0),this.clickBehavior&&this.clickBehavior.setEnable(t),this.fileChooser&&this.fileChooser.setOpenEnable(t),this}},pS={getFileName:function(t){if(!t)return null;var e=t.name;return e.substr(0,e.lastIndexOf("."))},saveTexture:function(t){return this.childrenMap.canvas.generateTexture(t),this}};Object.assign(pS,uS);const gS=Phaser.Utils.Objects.GetValue;class vS extends rS{constructor(t,e){var i=function(t,e){var i=new Dk(t,{scaleUp:nS(e,"scaleUpIcon",!1),background:nS(e,"iconBackground"),image:aS(t,e)});return t.add.existing(i),i}(t,e);e.icon=i,super(t,e),this.type="rexImageFileInputLabel";var s=this.iconWidth,r=this.iconWidth;void 0!==s&&void 0!==r&&i.resize(s,r),this.clickTarget=hS(this,e),this.clickTarget&&(gS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new nw(e,dS);return e.add.existing(i),t.pin(i),i.on("change",(function(){cS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=hS(t,e);if(i){var s=lS(e,"click"),r=new lu(i,s);return r.on("click",t.open,t),r}}(this,e)),this.addChildrenMap("canvas",i.image),this.addChildrenMap("iconBackground",i.background),this.addChildrenMap("fileChooser",this.fileChooser)}postLayout(t,e,i){this.fileChooser&&(this.fileChooser.syncTo(this.clickTarget),this.resetChildState(this.fileChooser)),super.postLayout(t,e,i)}}Object.assign(vS.prototype,pS),t.register("imageInputLabel",(function(t){var e=new vS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",vS);let fS=class extends La{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const mS=Phaser.Utils.Objects.GetValue;class yS extends La{constructor(t,e){super(t,e),this.style=mS(e,"style",this);var i=mS(e,"propertiesMap");this.activeStyle=bS(e,"active",i),this.hoverStyle=bS(e,"hover",i),this.disableStyle=bS(e,"disable",i),this.onModifyStyle=mS(e,"onModifyStyle")}getStyle(t){return Id(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Dd(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return xS.call(this,"active",t),this}setHoverState(t){return xS.call(this,"hover",t),this}setDisableState(t){return xS.call(this,"disable",t),this}}var bS=function(t,e,i){var s=Ld(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},xS=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},CS={addStyleManager(t){return this.styleManager=new yS(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};const kS=Phaser.GameObjects.Image,wS=Phaser.Utils.Objects.GetValue;class SS extends kS{constructor(t,e){void 0===e&&(e={}),super(t,wS(e,"x",0),wS(e,"y",0),wS(e,"key",""),wS(e,"frame",void 0)),this.type="rexStatesImage";var i=wS(e,"effects",!0);i&&Mn(this,i),this.style=new fS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(SS.prototype,CS),t.register("statesImage",(function(t){var e=new SS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",SS);class PS extends At{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=TS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const TS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(PS.prototype,CS),t.register("statesRoundRectangle",(function(t){var e=new PS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",PS);let OS=class extends La{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const MS=Phaser.GameObjects.NineSlice,ES=Phaser.Utils.Objects.GetValue;class _S extends MS{constructor(t,e){void 0===e&&(e={}),super(t,ES(e,"x",0),ES(e,"y",0),ES(e,"key",null),ES(e,"frame",null),ES(e,"width",0),ES(e,"height",0),ES(e,"leftWidth",0),ES(e,"rightWidth",0),ES(e,"topHeight",0),ES(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=ES(e,"effects",!0);i&&Mn(this,i),this.style=new OS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_S.prototype,CS),t.register("statesNineSlice",(function(t){var e=new _S(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",_S);let RS=class extends La{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const LS=Phaser.Utils.Objects.GetValue;class BS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=LS(e,"effects",!0);i&&Mn(this,i),this.style=new RS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(BS.prototype,CS),t.register("statesNinePatch",(function(t){var e=new BS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",BS);const IS=Phaser.GameObjects.Text,DS=Phaser.Utils.Objects.GetValue;class AS extends IS{constructor(t,e){void 0===e&&(e={}),super(t,DS(e,"x",0),DS(e,"y",0),DS(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(AS.prototype,CS),t.register("statesText",(function(t){var e=new AS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",AS);class jS extends La{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get fontSize(){return this.parent.fontSize}set fontSize(t){this.parent.setFontSize(t)}get tint(){return this.parent.tintTopLeft}set tint(t){this.parent.setTint(t)}get letterSpacing(){return this.parent.letterSpacing}set letterSpacing(t){this.parent.setLetterSpacing(t)}get lineSpacing(){return this.parent.lineSpacing}set lineSpacing(t){this.parent.setLineSpacing(t)}}const zS=Phaser.GameObjects.BitmapText,FS=Phaser.Utils.Objects.GetValue;class YS extends zS{constructor(t,e){void 0===e&&(e={});var i=FS(e,"x",0),s=FS(e,"y",0),r=FS(e,"font",""),n=FS(e,"fontSize",!1),a=FS(e,"align",0),o=FS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=FS(e,"effects",!0);h&&Mn(this,h),this.style=new jS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(YS.prototype,CS),t.register("statesBitmapText",(function(t){var e=new YS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",YS);class XS extends cp{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),P(e,"easeValue.duration",e.easeDuration),P(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=WS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const WS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(XS.prototype,CS),t.register("statesBarRectangle",(function(t){var e=new XS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",XS);var VS=function(t,e){void 0===e&&(e={}),void 0===e.options&&(e.options={});var i=e.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var s=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(s=!0,i.animation={});var r=i.animation;s&&(r.duration=0);var n=r.onProgress;r.onProgress=function(e){n&&n(e),t.needRedraw()};var a=r.onComplete;return r.onComplete=function(e){a&&a(e),t.needRedraw()},e};let GS=class extends Eu{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.type="rexChart",this.chart=void 0,void 0!==n&&this.setChart(n)}destroy(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),super.destroy(t))}resize(t,e){if(t===this.width&&e===this.height)return this;if(super.resize(t,e),this.chart){var i=this.chart;i.height=this.canvas.height,i.width=this.canvas.width,i.aspectRatio=i.height?i.width/i.height:null,i.update()}return this}};var HS={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,VS(this,t)),this):(console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');"),this)},getChartDataset:function(t){if(void 0!==this.chart){if("string"!=typeof t)return this.chart.data.datasets[t];for(var e,i=this.chart.data.datasets,s=0,r=i.length;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return QS(this.sizerChildren,null),Zb.call(this,t),this}},eP={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)QS(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},nP={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=qv.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,QS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)QS(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},oP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const hP=Phaser.Utils.Objects.IsPlainObject,lP=Phaser.Utils.Objects.GetValue;class dP extends Fb{constructor(t,e,i,s,r,n,a,o,h,l){hP(e)?(e=lP(l=e,"x",0),i=lP(l,"y",0),s=lP(l,"width",void 0),r=lP(l,"height",void 0),n=lP(l,"column",l.col||0),a=lP(l,"row",0),o=lP(l,"columnProportions",0),h=lP(l,"rowProportions",0)):hP(s)?(s=lP(l=s,"width",void 0),r=lP(l,"height",void 0),n=lP(l,"column",l.col||0),a=lP(l,"row",0),o=lP(l,"columnProportions",0),h=lP(l,"rowProportions",0)):hP(n)?(n=lP(l=n,"column",l.col||0),a=lP(l,"row",0),o=lP(l,"columnProportions",0),h=lP(l,"rowProportions",0)):hP(o)&&(o=lP(l=o,"columnProportions",0),h=lP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(lP(l,"createCellContainerCallback")),this.setIndentLeft(lP(l,"space.indentLeftOdd",0),lP(l,"space.indentLeftEven",0)),this.setIndentTop(lP(l,"space.indentTopOdd",0),lP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,lP(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=aP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=oP.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(dP.prototype,nP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new dP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",dP);var cP=function(t,e,i,s){return e/t<=i?e/(s-1):0},uP=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=pP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=pP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const vP=Phaser.Utils.Objects.IsPlainObject,fP=Phaser.Utils.Objects.GetValue,mP=Phaser.Display.Align.CENTER;var yP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(Iv.call(this,t),vP(e)&&(e=fP(h=e,"padding",0),i=fP(h,"key",void 0),s=fP(h,"index",void 0),r=fP(h,"offsetX",0),n=fP(h,"offsetY",0),a=fP(h,"offsetOriginX",0),o=fP(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=mP,h.padding=Lv(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},bP={add(t,e,i){if(Gm(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Zb.call(this,t),this}},kP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const uT=Phaser.Utils.Objects.GetValue,pT=Phaser.Math.Distance.Between;class gT extends La{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=uT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(uT(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(uT(t,"enable",!0)),this.holdThreshold=uT(t,"holdThreshold",50),this.pointerOutReleaseEnable=uT(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return nc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:pT(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Vm(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Vm(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const vT=Phaser.Utils.Objects.GetValue;class fT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(vT(t,"value",0)),this.setSpeed(vT(t,"speed",0)),this.setAcceleration(vT(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class mT{constructor(){this.value,this.dir,this.movement=new fT}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const CT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},kT=Phaser.Utils.Objects.GetValue;class wT extends La{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=kT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(kT(e,"speed",.1)),this.setEnable(kT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(kT(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Vm(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const ST=Phaser.Utils.Objects.GetValue;var PT=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?ST(s,l,void 0):ST(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Ve(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new dT(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=ST(r,"position",0);"string"==typeof p&&(p=TT[p]);var g,v,f=ST(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=ST(s,"space.slider",void 0))&&(o?f=0:g=ST(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:ST(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:ST(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:ST(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:ST(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=ST(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=ST(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=ST(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ST(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ST(s,"scrollDetectionMode");"string"==typeof b&&(b=OT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ST(s,x,!0):ST(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new xT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=ST(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new wT(h,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(k=a?"t":"s",S=`scroll${i}`):(k="t",S="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(S,t)}))),y&&(o?(w=`childO${i}`,S=`scroll${i}`):(w="childOY",S="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(S,t)}))),C&&(P=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const TT={right:0,left:1,bottom:0,top:1},OT={gameObject:0,rectBounds:1},MT=Phaser.Utils.Objects.GetValue;var ET=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=MT(e,"width"),a=MT(e,"height");n||MT(e,"child.expandWidth",!0)||(s[1]=0),a||MT(e,"child.expandHeight",!0)||(r[1]=0);var o=new dP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=DP(i,"child"),r=DP(s,"gameObject",void 0);if(r){var n=DP(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=DP(n,"top",0),a.bottom=DP(n,"bottom",0),o.left=DP(n,"left",0),o.right=DP(n,"right",0);break;case 1:a.top=DP(n,"left",0),a.bottom=DP(n,"right",0),o.top=DP(n,"top",0),o.bottom=DP(n,"bottom",0);break;default:a.top=DP(n,"top",0),a.bottom=DP(n,"bottom",0),a.left=DP(n,"left",0),a.right=DP(n,"right",0)}e.add(r,{column:1,row:1,align:DP(s,"align","center"),padding:o,expand:{width:DP(s,"expandWidth",!0),height:DP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:PT(t,o,"y",e);break;case 1:PT(t,o,"x",e);break;default:PT(t,o,"y",e),PT(t,o,"x",e)}return o},_T=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},RT=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},LT=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},FT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},YT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},XT=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var s=this.lines.getLineStartIndex(t),r=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(s,r,!0)}return e},WT=function(t,e){switch(Hw(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}},VT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&>.call(this)},GT=function(){if(this.textObject.setCrop){var t,e,i=this.textObject.rexSizer.offsetY;i<=0?(t=-i,e=this.height):(t=0,e=this.height-i),this.textObject.setCrop(0,t,this.width,e)}},HT=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var s=t.style,r=Math.max(e,0);0===this.textObjectType?s.wordWrapWidth=r:(0===s.wrapMode&&(s.wrapMode=1),s.wrapWidth=r);break;case 2:t.setMaxWidth(e)}this.setText()}},UT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=zT(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(FT.call(this,-this.textOY)),0),e=YT.call(this,t)+this.textOY,i=XT.call(this,t);return WT(this.textObject,i),this.textObject.rexSizer.offsetY=e,VT.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,ef.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,HT.call(this,t,n,a),Sv(t,s,r,n,a,e.align),e.preOffsetY=0,VT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const NT=Phaser.Utils.Objects.IsPlainObject,$T=Phaser.Utils.Objects.GetValue,KT=Phaser.Display.Align.TOP_LEFT;class JT extends Fb{constructor(t,e,i,s,r,n){NT(e)?(e=$T(n=e,"x",0),i=$T(n,"y",0),s=$T(n,"width",void 0),r=$T(n,"height",void 0)):NT(s)&&(s=$T(n=s,"width",void 0),r=$T(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=$T(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode($T(n,"clampTextOY",!0)),this.alwaysScrollable=$T(n,"alwaysScrollable",!1);var a=$T(n,"background",void 0),o=$T(n,"text",void 0);void 0===o&&(o=qT(t)),this.textCropEnable=$T(n,"textCrop",!!o.setCrop);var h=$T(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=KT,l.padding=Lv(0),l.expand=!0,this.textObject=o,this.textObjectType=Hw(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Yw.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(FT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=YT.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var qT=function(t){return t.add.text(0,0,"")};Object.assign(JT.prototype,UT);var ZT={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},QT={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const tO=Phaser.Utils.Objects.GetValue;class eO extends AT{constructor(t,e){void 0===e&&(e={});var i=tO(e,"text",void 0),s=tO(e,"textWidth",void 0),r=tO(e,"textHeight",void 0),n=tO(e,"textCrop",!!i.setCrop),a=tO(e,"textMask",!n),o=tO(e,"content",""),h=new JT(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:tO(e,"clampChildOY",!1),alwaysScrollable:tO(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=tO(e,"space",void 0);l&&(l.child=tO(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(eO.prototype,ZT,QT);const iO=Phaser.Utils.Objects.GetValue;var sO=function(t,e,s){e=e?i(e):{};var r=iO(s,"background",RP),n=iO(s,"text",rO),a=iO(s,"track",RP),o=iO(s,"thumb",RP);r?e.background=r(t,e.background):delete e.background,n?e.text=n(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),a?h.track=a(t,h.track):delete h.track,o?h.thumb=o(t,h.thumb):delete h.thumb,e.slider=h);var l=new eO(t,e);return t.add.existing(l),l},rO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new YS(t,e);break;case"bbcodetext":case"bbcode":s=new ds(t,0,0,"",e);break;case"label":s=new hO(t,e);break;case"textarea":s=sO(t,e);break;default:s=new AS(t,e)}return _P(s,e),t.add.existing(s),s},nO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new BS(t,e):new _S(t,e);break;case"roundRectangle":s=new PS(t,e);break;default:s=new SS(t,e)}return _P(s,e),t.add.existing(s),s};const aO=Phaser.Utils.Objects.GetValue;var oO=function(t,e,s){e=e?i(e):{};var r=aO(s,"background",RP),n=aO(s,"text",rO),a=aO(s,"icon",nO),o=aO(s,"action",nO);return null!==e.background&&r?e.background=r(t,e.background):delete e.background,null!==e.text&&n?e.text=n(t,e.text):delete e.text,null!==e.icon&&a?e.icon=a(t,e.icon):delete e.icon,null!==e.action&&o?e.action=o(t,e.action):delete e.action,e};class hO extends rS{constructor(t,e,i){super(t,e=oO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return lO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return lO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return lO(this.getChildren(),"setDisableState",t),this}}var lO=function(t,e,i){for(var s=0,r=t.length;sthis.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=OO(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(Gm(s)||(s=Ic(LO,i,1)),OO(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=IO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=BO[t]),this.timeUnit=t,this}}var LO=[];const BO={ms:0,s:1,sec:1},IO={abs:0,absolute:0,inc:1,increment:1};var DO=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,h).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},AO={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const jO=Phaser.Utils.Objects.GetValue;class zO extends PO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(jO(e,"easeDuration",1e3)),this.levelCounter=new TO(jO(e,"levelCounter")),this.player=new RO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",DO,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}Object.assign(zO.prototype,AO),t.register("expBar",(function(t){var e=new zO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",zO);const FO=Aw.prototype.add,YO=Aw.prototype.addSpace;var XO=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&YO.call(this),FO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&YO.call(this),this.hasTailSpace=s}else FO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;FO.call(this,t,{index:r,proportion:i,expand:!0})}else FO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},WO={addButton(t){if(Gm(t))for(var e=t,i=0,s=e.length;i=0;i--)HO.call(this,e[i],t);return this}},NO=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},$O=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,NO.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},KO={add(t){return this.buttons.push(t),t._click||(t._click=new lu(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),$O.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)cM.call(this,e[i],t);return this}};const pM=Phaser.Utils.Objects.GetValue;class gM extends dP{constructor(t,e){void 0===e&&(e={});var i=pM(e,"row",0),s=pM(e,"column",e.col||0),r=pM(e,"createCellContainerCallback"),n=pM(e,"buttons",void 0),a=pM(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;hr&&vM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)xM.call(this,e[i],t);return this}};const kM=Phaser.Utils.Objects.GetValue;class wM extends OP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new iM({parent:this,eventEmitter:kM(e,"eventEmitter",this),groupName:kM(e,"groupName",void 0),clickConfig:kM(e,"click",void 0)}).setButtonsType(e);var s=kM(e,"background",void 0),r=kM(e,"buttons",void 0);this.buttonsAlign=kM(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(wM.prototype,mM,CM,eM,rM),t.register("fixWidthButtons",(function(t){var e=new wM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",wM);var SM={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const PM=Phaser.Utils.Objects.GetValue;class TM extends rS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new nw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(PM(e,"accept","")),this.setMultiple(PM(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}Object.assign(TM.prototype,SM),t.register("fileSelectorButton",(function(t){var e=new TM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",TM);var OM={getChoice(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable(t){var e=this.childrenMap.choicesSizer;return!!e&&e.getButtonEnable(t)},getActionEnable(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this},hasAnyChoice(){var t=this.childrenMap.choicesSizer;return!!t&&t.hasAnyButton()},hasAnyAction(){var t=this.childrenMap.actionsSizer;return!!t&&t.hasAnyButton()},hasAnyToolbar(){var t=this.childrenMap.toolbarSizer;return!!t&&t.hasAnyButton()},hasAnyLeftToolbar(){var t=this.childrenMap.leftToolbarSizer;return!!t&&t.hasAnyButton()}},MM={onCreateModalBehavior(t){t.on("button.click",(function(e,i,s,r,n){var a=!1;switch(i){case"actions":a=!0;break;case"choices":t.hasAnyAction()||(a=!0)}if(a){var o={index:s,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0}t.modalClose(o)}}))},modal(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,zm.modal.call(this,t,e),this}},EM={};Object.assign(EM,OM,MM);const _M=Phaser.Utils.Objects.GetValue;class RM extends Aw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=_M(e,"eventEmitter",this);var i,s,r,n,a=_M(e,"background",void 0),o=_M(e,"title",void 0),h=_M(e,"toolbar",void 0),l=_M(e,"toolbarBackground",void 0),d=_M(e,"leftToolbar",void 0),c=_M(e,"leftToolbarBackground",void 0),u=_M(e,"content",void 0),p=_M(e,"description",void 0),g=_M(e,"choices",void 0),v=_M(e,"choicesBackground",void 0),f=_M(e,"actions",void 0),m=_M(e,"actionsBackground",void 0),y=_M(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new aM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:_M(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new aM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:_M(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&_M(e,"expand.title",!0),C=_M(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new Aw(t,{orientation:0}):new rx(t),t.add.existing(b);var w=!!k||{height:!0};if(n&&b.add(n,{align:"left",expand:w}),o){k&&!x&&"right"===C&&b.addSpace();var S={left:_M(e,"space.titleLeft",0),right:_M(e,"space.titleRight",0)},P=x?1:0;b.add(o,{align:C,proportion:P,expand:w,padding:S}),k&&!x&&"left"===C&&b.addSpace()}r&&(k&&!o&&b.addSpace(),b.add(r,{align:"right",expand:w})),(u||p||g||f)&&(S={bottom:_M(e,"space.title",0),top:_M(e,"space.titleTop",0)}),P=_M(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=_M(e,"align.content","center"),O=_M(e,"space.content",0),M=(S={left:_M(e,"space.contentLeft",0),right:_M(e,"space.contentRight",0),bottom:p||g||f?O:0},P=_M(e,"proportion.content",0),_M(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=_M(e,"align.description","center");var E=_M(e,"space.description",0);S={left:_M(e,"space.descriptionLeft",0),right:_M(e,"space.descriptionRight",0),bottom:g||f?E:0},P=_M(e,"proportion.description",0),M=_M(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=_M(e,"choicesType","").split("-"),R=LM(_,"wrap")?wM:LM(_,"grid")?gM:aM,L=LM(_,"radio")?"radio":LM(_,"checkboxes")?"checkboxes":void 0,B={left:_M(e,"space.choicesBackgroundLeft",0),right:_M(e,"space.choicesBackgroundRight",0),top:_M(e,"space.choicesBackgroundTop",0),bottom:_M(e,"space.choicesBackgroundBottom",0)},I=_M(e,"space.choice",0);R===aM?B.item=I:R===wM?(B.item=I,B.line=_M(e,"space.choiceLine",I)):(B.column=_M(e,"space.choiceColumn",I),B.row=_M(e,"space.choiceRow",I));var D={width:_M(e,"choicesWidth",void 0),height:_M(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:_M(e,"choicesSetValueCallback",void 0),setValueCallbackScope:_M(e,"choicesSetValueCallbackScope",void 0)};R===aM&&(D.orientation=LM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var A=_M(e,"space.choices",0);S={left:_M(e,"space.choicesLeft",0),right:_M(e,"space.choicesRight",0),bottom:f?A:0},T=_M(e,"align.choices","center"),P=_M(e,"proportion.choices",0),M=_M(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new aM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:_M(e,"space.action",0)},expand:_M(e,"expand.actions",!1),align:_M(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:_M(e,"space.actionsLeft",0),right:_M(e,"space.actionsRight",0),bottom:_M(e,"space.actionsBottom",0)},P=_M(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),IM(this,"click"),IM(this,"over"),IM(this,"out"),IM(this,"enable"),IM(this,"disable"),this.addChildrenMap("background",a),this.addChildrenMap("title",o),this.addChildrenMap("toolbar",h),this.addChildrenMap("leftToolbar",d),this.addChildrenMap("content",u),this.addChildrenMap("description",p),this.addChildrenMap("choices",i?i.buttons:void 0),this.addChildrenMap("actions",s?s.buttons:void 0),this.addChildrenMap("choicesSizer",i),this.addChildrenMap("actionsSizer",s),this.addChildrenMap("toolbarSizer",r),this.addChildrenMap("leftToolbarSizer",n)}}var LM=function(t,e){return-1!==t.indexOf(e)},BM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},IM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){BM.hasOwnProperty(s)&&t.emit(`${BM[s]}.${e}`,i,r,n,a)}))};Object.assign(RM.prototype,EM),t.register("dialog",(function(t){var e=new RM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",RM);var DM=function(t,e,i){var s=new hO(t,e,i);return t.add.existing(s),s},AM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},jM=function(t){var e=this.childrenMap.content;if(null===(t=t.content))e.hide();else if(e.show(),e.resetDisplayContent)e.resetDisplayContent(t);else{var i=t||"";e.setText(i)}},zM=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var s=this.scene,r=this.defaultActionConfig,n=this.defaultActionButtonCreator,a=0,o=i.length;a=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var a=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=UE(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;sthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(F_.prototype,D_);const Y_=["top","bottom","centerY","center"],X_=["left","right","centerX","center"];var W_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Y_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=X_.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const V_=Phaser.Utils.Objects.GetValue;class G_ extends AT{constructor(t,e){void 0===e&&(e={});var i=BP(e),s=V_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=V_(e,"clampChildOY",!1),s.clampChildOX=V_(e,"clampChildOX",!1);var r,n,a=new F_(t,s);switch(t.add.existing(a),i){case 0:r=V_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=V_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:V_(e,"align.panel","center")};var o=V_(e,"space",void 0);o&&(o.child=V_(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Ab(this.childrenMap.child,t),this}}var H_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:W_.call(this,t,"y",e);break;case 1:W_.call(this,t,"x",e);break;default:W_.call(this,t,"y",e),W_.call(this,t,"x",e)}return this}};Object.assign(G_.prototype,H_);const U_=Phaser.Utils.Objects.GetValue;var N_=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=$_(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=K_(e,this.listCreateSliderTrackCallback),g=K_(e,this.listCreateSliderThumbCallback);d=new G_(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:U_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=$_(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},$_=function(t,e,i){var s;return i?(e.orientation="x",s=new wM(t,e)):(e.orientation="y",s=new aM(t,e)),t.add.existing(s),s},K_=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const J_=Phaser.Utils.Objects.GetValue;var q_=function(t,e){var i=J_(e,"expandDirection",void 0);"string"==typeof i&&(i=Z_[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Od(s=e,r="alignTarget")?J(s,r):n&&Od(s,n)?J(s,n):a&&Od(s,a)?J(s,a):o),c=J_(e,"alignTargetY",d),u=J_(e,"alignOffsetX",0),p=J_(e,"alignOffsetY",0),g=J_(e,"alignSide","").includes("right"),v=J_(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=oa(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Z_={down:0,up:1},Q_=Phaser.Utils.Objects.GetValue;class tR extends xm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){mf(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new vf(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),q_(t,e),t.isRexSizer&&t.layout();var i=Q_(e,"touchOutsideClose",!1),s=Q_(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Rm(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var eR={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},iR={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=N_.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new tR(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(iR,B_,eR);const sR=Phaser.Utils.Objects.GetValue;class rR extends rS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(sR(e,"options"));var i=sR(e,"list");this.setWrapEnable(sR(i,"wrap",!1)),this.setCreateButtonCallback(sR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(sR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(sR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(sR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(sR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(sR(i,"scroller")),this.setListMouseWheelScrollerConfig(sR(i,"mouseWheelScroller")),this.setButtonClickCallback(sR(i,"onButtonClick")),this.setButtonOverCallback(sR(i,"onButtonOver")),this.setButtonOutCallback(sR(i,"onButtonOut")),this.setListExpandDirection(sR(i,"expandDirection")),this.setListEaseInDuration(sR(i,"easeIn",500)),this.setListEaseOutDuration(sR(i,"easeOut",100)),this.setListTransitInCallback(sR(i,"transitIn")),this.settListTransitOutCallback(sR(i,"transitOut")),this.setListMaxHeight(sR(i,"maxHeight",0)),this.setListSize(sR(i,"width"),sR(i,"height",0)),this.setListAlignmentMode(sR(i,"alignParent","text")),this.setListAlignmentSide(sR(i,"alignSide","")),this.setListBounds(sR(i,"bounds")),this.setListSpace(sR(i,"space")),this.setListDraggable(sR(i,"draggable",!1)),this.setValueChangeCallback(sR(e,"setValueCallback"),sR(e,"setValueCallbackScope")),this.setValue(sR(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(rR.prototype,iR),t.register("dropDownList",(function(t){var e=new rR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",rR);var nR=function(t,e,s){void 0===s&&(s={});var r=(e=e?i(e):{}).label||e.button,n=e.button||e.label;delete e.label,delete e.button;var a=s.label||s.button||s,o=s.button||s.label||s,h=oO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=DM(t,n,o).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var l=e.track;l&&(h.list.createTrackCallback=function(t){return RP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return RP(t,d)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h};class aR extends rR{constructor(t,e,i){super(t,e=nR(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(cR,oR,lR,dR);const uR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class pR extends La{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Hw(this.parent),this.pageStartIndexes=[],this.lines=zT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(uR(t,"maxLines",void 0)),this.setPageBreak(uR(t,"pageBreak","\f\n")),this.setText(uR(t,"text","")),this.startLineIndex=uR(t,"start",-1),this.endLineIndex=uR(t,"end",void 0);var e=uR(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Hw(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(pR.prototype,cR);var gR={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?WT(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(je(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},vR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},fR=function(t,e){for(var i=void 0,s=0;s0?mR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=mR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},bR={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=vR(this.parent,t);n=fR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)yR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(bR,gR);const xR=Phaser.Utils.Objects.GetFastValue,CR=Phaser.Utils.Objects.GetValue;class kR extends La{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(CR(t,"wrap",!1)),this.setTypeMode(CR(t,"typeMode",0)),this.setTypingSpeed(CR(t,"speed",333)),this.setTextCallback=xR(t,"setTextCallback",null),this.setTextCallbackScope=xR(t,"setTextCallbackScope",null),this.setTypingContent(xR(t,"text","")),this.typingIndex=xR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=xR(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=wR[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=je(t);this.textWrapEnable&&(e=function(t,e){switch(Hw(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=vR(this.parent,this.text).length,this}onTyping(){var t=yR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?WT(this.parent,t):this.parent.setText(t)}}const wR={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(kR.prototype,bR);const SR=Phaser.Utils.Objects.GetValue,PR={page:0,line:1};class TR extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=SR(i,"expandTextWidth",!1),n=SR(i,"expandTextHeight",!1);if(r||n){var a=Hw(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(SR(i,"typingMode","page")),this.page=new pR(s,SR(i,"page",void 0)),this.typing=new kR(s,SR(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=PR[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(gO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new TR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",TR);class OR extends TR{constructor(t,e,i){super(t,e=fO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new OR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",OR);const MR=Phaser.Utils.Objects.GetValue;class ER extends Aw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=MR(e,"background",void 0),a=MR(e,"icon",void 0),o=MR(e,"iconMask",void 0),h=MR(e,"slider",void 0),l=MR(e,"text",void 0),d=MR(e,"space.icon",0),c=MR(e,"space.slider",0);(n&&this.addBackground(n),a&&(0===this.orientation?(h||l)&&(s={right:d}):(h||l)&&(s={bottom:d}),this.add(a,{proportion:0,align:"center",padding:s}),o&&(o=Yw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new aT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===MR(h,"width",void 0)?1:0:void 0===MR(h,"height",void 0)?1:0,this.add(i,{proportion:r,align:"center",padding:s}));l&&this.add(l),this.addChildrenMap("background",n),this.addChildrenMap("icon",a),this.addChildrenMap("iconMask",o),this.addChildrenMap("slider",i),this.addChildrenMap("text",l);var u=MR(e,"valuechangeCallback",null);if(null!==u){var p=MR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(MR(e,"enable",void 0)),this.setValue(MR(e,"value",0))}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}get text(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")}set text(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t))}setText(t){return this.text=t,this}}t.register("numberBar",(function(t){var e=new ER(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",ER),t.register("scrollBar",(function(t){var e=new dT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",dT);const _R=Phaser.Utils.Objects.GetValue,RR={leftTop:"left-top",centerTop:"center-top",rightTop:"right-top",leftCenter:"left-center",center:"center",rightCenter:"right-center",leftBottom:"left-bottom",centerBottom:"center-bottom",rightBottom:"right-bottom"};class LR extends rx{constructor(t,e){super(t,e),this.type="rexBadge";var i=_R(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=_R(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),RR){var n=_R(e,r,void 0);n&&(this.add(n,{key:r,align:RR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new LR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",LR);const BR=rx.prototype.add;var IR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),BR.call(this,t,e,i,s,r,n,a,o,h),this},DR={add:IR,addPage:IR};const AR=qg.prototype.setChildVisible;var jR={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(AR.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(AR.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(jR,DR);const zR=Phaser.Utils.Objects.GetValue;class FR extends rx{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(zR(e,"swapMode",0)),this.setFadeInDuration(zR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=YR[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(FR.prototype,jR);const YR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new FR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",FR);const XR=Phaser.GameObjects.Mesh;class WR extends XR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const VR=Phaser.Math.Vector3,GR=Phaser.Math.Matrix4;var HR=new VR,UR=new VR,NR=new GR;const $R=Phaser.Utils.Objects.IsPlainObject,KR=Phaser.Utils.Objects.GetValue,JR=Phaser.Geom.Mesh.GenerateGridVerts,qR=Phaser.Math.RadToDeg,ZR=Phaser.Math.DegToRad,QR=1+1/Math.sin(ZR(45));let tL=class extends WR{constructor(t,e,i,s,r,n){$R(e)&&(e=KR(n=e,"x",0),i=KR(n,"y",0),s=KR(n,"key",null),r=KR(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(QR),this.hideCCW=KR(n,"hideCCW",!0);var a=KR(n,"gridWidth",0),o=KR(n,"gridHeight",a);this.resetVerts(a,o),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(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,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,JR({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return qR(this.rotationX)}set angleX(t){this.rotationX=ZR(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return qR(this.rotationY)}set angleY(t){this.rotationY=ZR(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return qR(this.rotationZ)}set angleZ(t){this.rotationZ=ZR(t)}transformVerts(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=r,this.transformInfo.rotateZ=n,function(t,e,i,s,r,n,a){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),HR.set(e,i,s),UR.set(r,n,a),NR.fromRotationXYTranslation(UR,HR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},YL={top:1,left:3,right:5,bottom:7},XL={top:"bottom",left:"right",right:"left",bottom:"top"},WL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},VL={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i=a.y)continue;break;case 2:if(n.x<=a.x)continue;break;case 3:if(n.x>=a.x)continue}GB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},NB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(WB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;VB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return UB(this,e,this.transitInTime),this},removeMessage(t){if(this.getParentSizer(t)!==this)return this;if(!t.__isDestroying){t.__isDestroying=!0;var e=this.transitOutTime;return this.transitOutCallback(t,e,this),VB.call(t,e+10,(function(){delete t.__isDestroying,t.destroy()})),this}},removeAllMessages(){for(var t=this.childrenMap.items,e=0,i=t.length;e0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new WI(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a},GI={openColorPicker:function(){if(!this.colorPicker){var t=VI.call(this).layout(),e=new tR(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(GI,cI);const HI=Phaser.Utils.Objects.GetValue;class UI extends dI{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(HI(i,"width",160),HI(i,"height",170));var n=HI(i,"background");r=n?function(t){return RP(t,n)}:HI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(HI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(HI(i,"expandDirection")),this.setColorPickerEaseInDuration(HI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(HI(i,"easeOut",200)),this.setColorPickerTransitInCallback(HI(i,"transitIn")),this.setColorPickerTransitOutCallback(HI(i,"transitOut")),this.setColorPickerBounds(HI(i,"bounds"));var a=HI(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(HI(o,"height",30)),this.setColorComponentsFormatLabelConfig(HI(o,"formatLabel"));var h=HI(o,"inputText");h||(h=HI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=HI(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(UI.prototype,GI),t.register("colorInput",(function(t){var e=new UI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",UI),t.register("colorInputLite",(function(t){var e=new dI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",dI),t.register("colorPicker",(function(t){var e=new BI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",BI),t.register("colorComponents",(function(t){var e=new YI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",YI);var NI=function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&b0&&xh;d--){for(c=0;c0&&this.wrapMode!==Ee&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Be[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=De(t,l,d);else{var u=Ie(t,l,d);c&&(u=c(u)),this[o]=u}}var p=De(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=De(t,"fill",null);null!==g&&(this.color=Jt(g));var v=De(t,"metrics",!1);return v?this.metrics={ascent:De(v,"ascent",0),descent:De(v,"descent",0),fontSize:De(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Pe(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Pe(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=De(t,"fontFamily","Courier"),this.fontSize=De(t,"fontSize","16px"),this.fontStyle=De(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Jt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Jt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Jt(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Jt(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Jt(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Jt(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Jt(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Be[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=De(e,"fontFamily",this.fontFamily),this.fontSize=De(e,"fontSize",this.fontSize),this.fontStyle=De(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}};var je=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},ze={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),ie(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Fe=Phaser.Utils.Objects.GetValue,Xe=Te,Ye=Oe;class We{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Fe(t,"text",""),this.x=Fe(t,"x",0),this.y=Fe(t,"y",0),this.width=Fe(t,"width",0);var e=Fe(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Fe(t,"newLineMode",0),this.startIndex=Fe(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Ye&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Xe&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Ye&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var Ve=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:q(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var $e={};const Ke=Phaser.Geom.Rectangle;var Je=new I;class qe{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&pi(v)){""!==b?a.push(n.getLine(b,x,ai)):0===C&&r>0&&a.push(n.getLine("",0,ai)),a.push(...ci(v,e,li,s,0,n));var w=a.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,ai)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},ui=function(t,e){var i;switch(e){case hi:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vi&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ne({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}};var gs=function(t){for(var e,i,s,r={},n=0,a=(t=t.split(";")).length;n=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px","")));break;case"shadow":o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.offsetX=parseInt(o[1].replace("px",""))),h>=3&&(s.offsetY=parseInt(o[2].replace("px",""))),h>=4&&(s.blur=parseInt(o[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px",""))),h>=3&&(s.offset=parseInt(o[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":s=parseFloat(s)}r[i]=s}return r},vs=function(t){return 0===(t=t.replace(Cs,"")).length},fs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,ms=/<\s*class=/i,ys=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,bs=/<\s*style=/i,xs=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Cs=/^\s+|\s+$/;const ks=Phaser.Utils.Objects.GetValue;class ws extends Xi{constructor(t,e,i,s,r){var n=ks(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new ps(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}t.register("tagText",(function(t,e,i,s){var r=new ws(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",ws);const Ss=Phaser.Utils.Objects.GetValue;var Ps=function(t,e){return void 0===e?t:t[e]},Ts=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ss(e,"left",0),t.right=Ss(e,"right",0),t.top=Ss(e,"top",0),t.bottom=Ss(e,"bottom",0)),t};let Os=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Os.prototype,Z);var Ms={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Es=Phaser.Math.RotateAround;var _s;const Rs=Phaser.Geom.Rectangle;var Ls,Bs=function(t){void 0===Ls&&(Ls=new Rs);var e=t.drawTLX,i=t.drawTLY;return Ls.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ls};const Is=Phaser.Math.RotateAround;var Ds,As=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ds&&(Ds={}),s=Ds),s.x=e,s.y=i,0!==t.rotation&&Is(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const js=Phaser.GameObjects.Components.TransformMatrix;var zs,Fs,Xs={},Ys=function(t,e,i,s,r){var n=As(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Xs);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===zs&&(zs=new js,Fs=new js),t.parentContainer?t.getWorldTransformMatrix(zs,Fs):zs.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),zs.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Ws=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Ys(t,e,n,a,r)},Vs={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===_s&&(_s={}),s=_s),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Es(s,0,0,-i.rotation),s}(t,e,this,!0);return Bs(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ws(this.parent,this,t,e,i)}};Object.assign(Vs,Ms);const Gs=Phaser.Math.DegToRad,Hs=Phaser.Math.RadToDeg,Us=Phaser.Utils.Objects.GetValue;class Ns extends Os{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Hs(this._rotation)}set angle(t){this.rotation=Gs(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Us(t,"width",void 0),i=Us(t,"height",void 0),s=Us(t,"scaleX",void 0),r=Us(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ns.prototype,Vs);var $s=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ks=Phaser.Utils.Objects.GetValue;class Js extends Ns{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ks(e,"color",null),Ks(e,"color2",null),Ks(e,"horizontalGradient",!0)),this.setStroke(Ks(e,"stroke",null),Ks(e,"strokeThickness",2)),this.setCornerRadius(Ks(e,"cornerRadius",0),Ks(e,"cornerIteration",null))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,$s("color2",t,this),$s("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$s("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,$s("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){ie(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qs(e,"color",null),qs(e,"color2",null),qs(e,"horizontalGradient",!0)),this.setStroke(qs(e,"stroke",null),qs(e,"strokeThickness",2))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,qs(t,"color2",null),qs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qs(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Qs=Phaser.Utils.Objects.GetValue;class tr{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Qs(t,"bold",!1)),this.setItalic(Qs(t,"italic",!1)),this.setFontSize(Qs(t,"fontSize","16px")),this.setFontFamily(Qs(t,"fontFamily","Courier")),this.setColor(Qs(t,"color","#fff")),this.setStrokeStyle(Qs(t,"stroke",null),Qs(t,"strokeThickness",0)),this.setShadow(Qs(t,"shadowColor",null),Qs(t,"shadowOffsetX",0),Qs(t,"shadowOffsetY",0),Qs(t,"shadowBlur",0)),this.setOffset(Qs(t,"offsetX",0),Qs(t,"offsetY",0)),this.setSpace(Qs(t,"leftSpace",0),Qs(t,"rightSpace",0)),this.setAlign(Qs(t,"align",void 0)),this.setBackgroundColor(Qs(t,"backgroundColor",null)),this.setBackgroundHeight(Qs(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Qs(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Qs(t,"backgroundLeftX",0)),this.setBackgroundRightX(Qs(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle($s("stroke",t,this),$s("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset($s("shadowOffsetX",t,this),$s("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tr(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Jt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Jt(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Jt(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Jt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const er=Phaser.Utils.Array.Remove,ir=Phaser.Utils.Array.Remove,sr="text",rr="image",nr="drawer",ar="space",or="command";var hr=function(t){return t.type===sr&&"\n"===t.text},lr=function(t){return t.type===sr&&"\f"===t.text},dr=function(t){return t.type===sr},cr=function(t){return t.type===or};class ur extends Ns{constructor(t,e,i){super(t,sr),this.updateTextFlag=!1,this.style=new tr(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var pr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class gr extends Ns{constructor(t,e,i){super(t,rr),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Pi(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var vr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class fr extends Ns{constructor(t,e,i,s){super(t,nr),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}let mr=class extends Ns{constructor(t,e){super(t,ar),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}};var yr=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class br extends Os{constructor(t,e,i,s,r){super(t,or),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var xr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},Cr=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const kr={none:0,word:1,char:2,character:2,mix:3};var wr=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Or.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Or.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Er(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Er(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Er(t,"wrapMode");void 0===c&&(c=Er(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=kr[c]);var u=Er(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Er(t,"letterSpacing",0),g=Er(t,"hAlign",0),v=Er(t,"vAlign",0),f=Er(t,"justifyPercentage",.25),m=Cr({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:_,width:R}),L=Math.max(L,R)),m.start+=M.length,m.isLastPage=!B&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var X=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,Y=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Lr(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Lr(t,"maxLines",0);var o=0===i,h=Lr(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Lr(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Lr(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Lr(t,"letterSpacing",0),p=Lr(t,"rtl",!0),g=Lr(t,"hAlign",p?2:0),v=Lr(t,"vAlign",0),f=Cr({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(M.push({children:E,height:_}),R=Math.max(R,_)),f.start+=O.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=M.length*n;var j=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Ts(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Ps(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),er(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ir(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(sr);return null===i?i=new ur(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ws(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r>16&255},yn=function(t){return t>>8&255},bn=function(t){return 255&t};const xn=Phaser.Events.EventEmitter;var Cn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=kn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},kn={},wn=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cn),function(t){if(t.events)return t;var e=new xn,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Pn=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mn(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},jn=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},zn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Fn=Phaser.Geom.Rectangle,Xn=Phaser.Math.Vector2,Yn=Phaser.Math.RotateAround,Wn=Phaser.GameObjects.Container;var Vn=function(t,e){if(void 0===e?e=new Fn:!0===e&&(void 0===Gn&&(Gn=new Fn),e=Gn),t.getBounds&&!(t instanceof Wn))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Hn(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Un(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,$n(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Hn(t,e),i=e.x,s=e.y,Un(t,e),r=e.x,n=e.y,Nn(t,e),a=e.x,o=e.y,$n(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Gn=void 0,Hn=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===Jn&&(Jn=new Xn),e=Jn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-jn(t)*t.originX,e.y=t.y-zn(t)*t.originY,qn(t,e,i))},Un=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===Jn&&(Jn=new Xn),e=Jn),t.getTopRight?t.getTopRight(e):(e.x=t.x-jn(t)*t.originX+jn(t),e.y=t.y-zn(t)*t.originY,qn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===Jn&&(Jn=new Xn),e=Jn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-jn(t)*t.originX,e.y=t.y-zn(t)*t.originY+zn(t),qn(t,e,i))},$n=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===Jn&&(Jn=new Xn),e=Jn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-jn(t)*t.originX+jn(t),e.y=t.y-zn(t)*t.originY+zn(t),qn(t,e,i))},Kn=function(t,e,i){void 0===e?e=new Xn:!0===e&&(void 0===Jn&&(Jn=new Xn),e=Jn);var s=jn(t),r=zn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),qn(t,e,i)},Jn=void 0,qn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Yn(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Zn(i,"color"),r=Zn(i,"lineWidth"),n=Zn(i,"fillColor"),a=Zn(i,"fillAlpha",1),o=Zn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Ga:Va,this.repeatCounter=0,this}stop(){return this.state=Wa,this}update(t,e){this.state!==Wa&&this.state!==Ua&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ha)):(this.nowTime=this.duration,this.state=Ua):this.nowTime>=0&&(this.state=Ga))}get t(){var t;switch(this.state){case Wa:case Va:case Ha:t=0;break;case Ga:t=this.nowTime/this.duration;break;case Ua:t=1}return Xa(t,0,1)}set t(t){(t=Xa(t,-1,1))<0?(this.state=Va,this.nowTime=-this.delay*t):(this.state=Ga,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Wa}get isDelay(){return this.state===Va}get isCountDown(){return this.state===Ga}get isRunning(){return this.state===Va||this.state===Ga}get isDone(){return this.state===Ua}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Wa=0,Va=1,Ga=2,Ha=3,Ua=-1;class Na extends ja{constructor(t,e){super(t,e),this.timer=new Ya}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const $a=Phaser.Utils.Objects.GetValue,Ka=Phaser.Utils.Objects.GetAdvancedValue,Ja=Phaser.Tweens.Builders.GetEaseFunction;class qa extends Na{resetFromJSON(t){return this.timer.resetFromJSON($a(t,"timer")),this.setEnable($a(t,"enable",!0)),this.setTarget($a(t,"target",this.parent)),this.setDelay(Ka(t,"delay",0)),this.setDuration(Ka(t,"duration",1e3)),this.setEase($a(t,"ease","Linear")),this.setRepeat($a(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ja(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Za=Phaser.Sound.BaseSound;var Qa=function(t){return t instanceof Za};const to=Phaser.Utils.Objects.GetValue,eo=Phaser.Utils.Objects.GetAdvancedValue,io=Phaser.Math.Linear;let so=class extends qa{constructor(t,e,i){Qa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(to(t,"mode",0)),this.setEnable(to(t,"enable",!0)),this.setVolumeRange(eo(t,"volume.start",this.parent.volume),eo(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ro[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=io(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const ro={stop:1,destroy:2};var no=function(t,e,i,s,r){Qa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new so(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ao=function(t,e,i,s){Qa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new so(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const oo=Phaser.Utils.Objects.GetValue;var ho={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:oo(e,"loop",this.backgroundMusicLoop),mute:oo(e,"mute",this.backgroundMusicMute),volume:oo(e,"volume",this.backgroundMusicVolume),detune:oo(e,"detune",0),rate:oo(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&no(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ao(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const lo=Phaser.Utils.Objects.GetValue;var co={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:lo(e,"loop",this.backgroundMusicLoop),mute:lo(e,"mute",this.backgroundMusic2Mute),volume:lo(e,"volume",this.backgroundMusic2Volume),detune:lo(e,"detune",0),rate:lo(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&no(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ao(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const uo=Phaser.Utils.Array.Remove,po=Phaser.Utils.Objects.GetValue;var go={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:po(e,"mute",this.soundEffectsMute),volume:po(e,"volume",this.soundEffectsVolume),detune:po(e,"detune",0),rate:po(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&uo(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&uo(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&no(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ao(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ao(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&no(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ao(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ao(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(J(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Zo:t||(t=th),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=ih),this.tagExpression=t,this}setValueExpression(t){return t||(t=ih),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==ih||this.valueExpression!==ih){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=Zo),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:ol,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===sr&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,hl.call(t,i.remainder)}});break}}else cr(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},ll=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},dl=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},cl=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var l=n[1];return r.waitGameObjectDestroy(a,l),void t.emit(h,l);case 3:l=n[1];var d=n[2];if("number"==typeof o.getProperty(l,d))return r.waitGameObjectTweenComplete(a,l,d),void t.emit(h,l,d);var c=d,u=c.startsWith("!");return u&&(c=c.substring(1)),o.hasData(l,c)?(r.waitGameObjectDataFlag(a,l,c,!u),void t.emit(h,l,c)):void r.waitTime(0)}};const ul=Phaser.Input.Keyboard.KeyCodes;var pl=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},Ml=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},_l=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Rl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Tl(a,s)&&(n=a[1],xr.call(t,`${s}.play`,Ol,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ml,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Tl(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ml,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.pause`,El,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);xr.call(t,`${s}.chain`,_l,[s,r,a],t),e.skipEvent()}}}))}];var Ll=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Rl,t.createGameObject=kl(t.createGameObject),this.addGameObjectManager(t,Pl)},Bl=function(t,e){return 2===t.length&&t[0]===e},Il=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Dl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Al=function(t){this.getGameObjectManager(t).removeAll()},jl=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},zl={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},Fl=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var l=this.getGameObjectManager(e),d=l.getProperty(i,s);if("number"==typeof d){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=d-r:h.startsWith("from")&&(l.setProperty(i,s,d-r),r=d):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=d+r:h.startsWith("from")&&(l.setProperty(i,s,d+r),r=d):"from"===h&&(l.setProperty(i,s,r),r=d);var c=h.startsWith("yoyo");l.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:c})}};const Xl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Bl(a,s)&&(n=a[1],xr.call(t,`${s}.add`,Il,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Bl(n,s)&&(r=n[1],xr.call(t,`${s}.remove`,Dl,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(xr.call(t,`${s}.removeall`,Al,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],xr.call(t,`${s}.call`,jl,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,l,d,c=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&zl[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),xr.call(t,`${s}.ease`,Fl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Yl=Vo.addGameObjectManager;var Wl={addGameObjectManager(t,e){(t=t?Ve(t):{}).name||console.warn("[TextPlayer] Parameter 'name' is required in addGameObjectManager(config) method");var i=t.defaultLayer,s=t.createGameObject,r=this.layerManager;t.createGameObject=function(t,...e){var n=s.call(this,t,...e);return i&&r&&r.addToLayer(i,n),n},Yl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Xl]:Xl).length;a0)return ad.length=0,!0;return ad.length=0,!1},ad=[],od=void 0;const hd=Phaser.Utils.Objects.GetValue;var ld=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=hd(e,n,s[1]))&&(i[s[0]]=r);return i},dd=function(t){t.addEventListener("touchstart",cd,!1),t.addEventListener("touchmove",cd,!1),t.addEventListener("touchend",cd,!1),t.addEventListener("mousedown",cd,!1),t.addEventListener("mouseup",cd,!1),t.addEventListener("mousemove",cd,!1)},cd=function(t){t.stopPropagation()},ud=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},pd=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",ud,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(Ca.call(this.clickOutSideTarget,this.parent),xa.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},gd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",ud,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const vd=Phaser.Utils.Objects.GetValue;var fd=function(t,e){var i,s=vd(e,"inputType",void 0);void 0===s&&(s=vd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=vd(e,"style",void 0),n=i.style;ld(id,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",ld(ed,e,i),dd(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){pd.call(t)})),i.addEventListener("blur",(function(e){gd.call(t)})),i},md={open:function(){return this.isOpened||this.readOnly||((t=this)!==od&&(void 0!==od&&od.close(),od=t),this.node||(this.node=fd(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===od&&(od=void 0),this.setBlur(),this):this}};const yd=Phaser.Utils.Objects.GetValue;class bd extends La{constructor(t,e){super(t);var i=yd(e,"inputType",void 0);void 0===i&&(i=yd(e,"type","text")),this.setEnterCloseEnable(yd(e,"enterClose","textarea"!==i));var s=yd(e,"onOpen",void 0);s||(s=yd(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=yd(e,"clickOutSideTarget",void 0);var r=yd(e,"onClose",void 0);r||(r=yd(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=yd(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return sd(t,e,"inputType"),sd(t,e,"type"),sd(t,e,"style"),sd(t,e,id),sd(t,e,ed),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){rd(this.parent,t)||this.close()}setEnterCloseEnable(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}initText(){}updateText(){}get text(){return this.node?this.node.value:""}set text(t){this.node&&(this.node.value=t)}setText(t){return this.text=t,this}get maxLength(){return this.nodeConfig.maxLength}set maxLength(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t)}setMaxLength(t){return this.maxLength=t,this}get minLength(){return this.nodeConfig.minLength}set minLength(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t)}setMinLength(t){return this.minLength=t,this}get placeholder(){return this.node.placeholder}set placeholder(t){this.node&&(this.node.placeholder=t)}setPlaceholder(t){return this.placeholder=t,this}selectText(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}selectAll(){return this.selectText(),this}get selectionStart(){return this.node?this.node.selectionStart:0}get selectionEnd(){return this.node?this.node.selectionEnd:0}get selectedText(){if(!this.node)return"";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}get cursorPosition(){return this.node?this.node.selectionStart:0}set cursorPosition(t){this.node&&this.node.setSelectionRange(t,t)}setCursorPosition(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}get tooltip(){return this.node?this.node.title:""}set tooltip(t){if(!this.node)return this;this.node.title=t}setTooltip(t){return this.tooltip=t,this}setTextChangedCallback(t){return this.onTextChanged=t,this}get readOnly(){return this.nodeConfig.readOnly}set readOnly(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t)}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}get spellCheck(){return this.node?this.node.spellcheck:""}set spellCheck(t){this.node&&(this.node.spellcheck=t)}setSpellCheck(t){return this.spellCheck=t,this}get fontColor(){if(this.node)return this.node.style.color}set fontColor(t){this.node&&(this.node.style.color=t)}setFontColor(t){return this.fontColor=t,this}setStyle(t,e){return this.node?(this.node.style[t]=e,this):this}getStyle(t){if(this.node)return this.node.style[t]}scrollToBottom(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}setEnabled(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}setBlur(){return this.node?(this.node.blur(),this):this}setFocus(){return this.node?(this.node.focus(),this):this}get isFocused(){return this.isOpened}}Object.assign(bd.prototype,md);var xd=function(t,e,i){t=t.replace(" ","");var s=i.previousText;if(t===s)return t;if(isNaN(t)){i.emit("nan",t,i),t=s;var r=i.cursorPosition-1;i.setText(t),i.setCursorPosition(r)}else i.previousText=t;return t},Cd=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,s=t.parent,r=e;r=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Cd(this),kd(this)),this}setNumberInput(){return this.onUpdateCallback=xd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Pd=Phaser.Utils.Objects.GetValue,Td=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Od=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const _d=Phaser.GameObjects.Zone;let Rd=class extends _d{constructor(t){super(t,0,0,2,2),this.fullWindow=new Ed(this)}};var Ld=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Bd=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},Id=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Fd.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(Xd(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Yd=new Fd,Wd=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Vd=/\S/,Gd=new Fd;Gd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Vd.test(t)&&!Vd.test(e)},Gd.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify($d(t,null,null,i),i," ")},Nd.equals=function(t,e){return Fd.prototype.equals.call(Nd,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Kd=new Fd;Kd.tokenize=function(t){return t.slice()},Kd.join=Kd.removeEmpty=function(t){return t};const Jd=Phaser.Utils.Array.Remove;var qd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Jd(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Yd.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},ic={cursorMoveLeft(){if(!this.isOpened)return this;var t=Qd(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Qd(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=tc(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Qd(ec(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=tc(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Qd(ec(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const sc=Phaser.Utils.Objects.IsPlainObject;class rc extends hn{constructor(t,e,i,s,r,n){sc(e)?n=e:sc(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Od(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Od(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Od(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Od(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Od(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Rd(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Ld(n.background,"focus"),h=Ld(n.style,"cursor"),l=Ld(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Pd(e,"edit");return void 0===i&&(i={}),sd(e,i,Td),new Sd(t,i)}(this,n),Bd.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),zd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Ad.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),gn(l)&&Object.assign(l,h),jd.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Jc(t,"tl",0),this.radiusTR=Jc(t,"tr",0),this.radiusBL=Jc(t,"bl",0),this.radiusBR=Jc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Lt(e,e,e,e,180,270,!1,r,t):Lt(0,0,e,e,90,0,!0,r,t):_t(0,0,t),(e=this.radiusTR)>0?this._convexTR?Lt(i-e,e,e,e,270,360,!1,r,t):Lt(i,0,e,e,180,90,!0,r,t):_t(i,0,t),(e=this.radiusBR)>0?this._convexBR?Lt(i-e,s-e,e,e,0,90,!1,r,t):Lt(i,s,e,e,270,180,!0,r,t):_t(i,s,t),(e=this.radiusBL)>0?this._convexBL?Lt(e,s-e,e,e,90,180,!1,r,t):Lt(0,s,e,e,360,270,!0,r,t):_t(0,s,t),t.push(t[0],t[1]),Rc(this.x,this.y,t),super.updateData(),this}}const Zc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var Qc={buildShapes(){this.addShape((new qc).setName("box")).addShape((new $c).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}};const tu=Phaser.Utils.Objects.GetValue,eu=Phaser.Math.Linear;class iu extends qa{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=tu(t,"key","value");var i=e[this.propertyKey];return this.fromValue=tu(t,"from",i),this.toValue=tu(t,"to",i),this.setEase(tu(t,"ease",this.ease)),this.setDuration(tu(t,"duration",this.duration)),this.setRepeat(tu(t,"repeat",0)),this.setDelay(tu(t,"delay",0)),this.setRepeatDelay(tu(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=eu(this.fromValue,this.toValue,i)}}var su={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new iu(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},ru={};Object.assign(ru,fc,mc,Qc,su);const nu=23730,au=Phaser.Utils.Objects.GetValue,ou=Phaser.Utils.Objects.IsPlainObject;class hu extends vc{constructor(t,e,i,s,r,n,a){ou(e)?(e=au(a=e,"x",0),i=au(a,"y",0),s=au(a,"width",2),r=au(a,"height",2),n=au(a,"color",nu)):ou(n)&&(n=au(a=n,"color",nu)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=nu),this.setBoxShape(au(a,"circleBox",!1)),this.setBoxFillStyle(n,au(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(au(a,"uncheckedColor",null),au(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(au(a,"boxLineWidth",4),au(a,"boxStrokeColor",n),au(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,au(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),au(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(au(a,"checkerColor",16777215),au(a,"checkerAlpha",1)),this.setBoxSize(au(a,"boxSize",1)),this.setCheckerSize(au(a,"checkerSize",1)),this.setCheckerAnimationDuration(au(a,"animationDuration",150)),this.buildShapes();var o=au(a,"checked");void 0===o&&(o=au(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(hu.prototype,ru);const lu=Phaser.Utils.Objects.GetValue;class du extends La{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(lu(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(lu(t,"enable",!0)),this.setMode(lu(t,"mode",1)),this.setClickInterval(lu(t,"clickInterval",100)),this.setDragThreshold(lu(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=cu[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const cu={press:0,pointerdown:0,release:1,pointerup:1},uu=Phaser.Utils.Objects.GetValue,pu=Phaser.Utils.Objects.IsPlainObject;class gu extends hu{constructor(t,e,i,s,r,n,a){pu(e)?(e=uu(a=e,"x",0),i=uu(a,"y",0),s=uu(a,"width",2),r=uu(a,"height",2),n=uu(a,"color",nu)):pu(n)&&(n=uu(a=n,"color",nu)),super(t,e,i,s,r,n,a),this._click=new du(this,uu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(uu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("checkbox",(function(t,e,i,s,r,n){var a=new gu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",gu);var vu={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},fu={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},mu={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},yu=function(t,e,i){return(e-t)*i+t};const bu=Phaser.Math.Linear;var xu={buildShapes(){this.addShape((new qc).setName("track")).addShape((new qc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&yu(mn(l),mn(d),c))<<16|(255&yu(yn(l),yn(d),c))<<8|255&yu(bn(l),bn(d),c)),p=bu(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=bu(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},Cu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new iu(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},ku={};Object.assign(ku,vu,fu,mu,xu,Cu);const wu=Phaser.Utils.Objects.GetValue,Su=Phaser.Utils.Objects.IsPlainObject,Pu=23730;class Tu extends vc{constructor(t,e,i,s,r,n,a){Su(e)?(e=wu(a=e,"x",0),i=wu(a,"y",0),s=wu(a,"width",2),r=wu(a,"height",2),n=wu(a,"color",Pu)):Su(n)&&(n=wu(a=n,"color",Pu)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Pu),this.setTrackFillStyle(n,wu(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(wu(a,"falseValueTrackColor",function(t){var e=.3*mn(t)+.59*yn(t)+.11*bn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),wu(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(wu(a,"thumbColor",16777215),wu(a,"thumbAlpha",1)),this.setTrackSize(wu(a,"trackWidth",.9),wu(a,"trackHeight",.5)),this.setTrackRadius(wu(a,"trackRadius",.5*this.trackHeight));var o=wu(a,"thumbHeight",void 0),h=wu(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(wu(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(wu(a,"thumbLeft",.3),wu(a,"thumbRight",void 0)),this.setRTL(wu(a,"rtl",!1)),this.setToggleAnimationDuration(wu(a,"animationDuration",150)),this.buildShapes(),this.setValue(wu(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(Tu.prototype,ku);const Ou=Phaser.Utils.Objects.GetValue;class Mu extends Tu{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new du(this,Ou(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Ou(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("toggleSwitch",(function(t,e,i,s,r,n){var a=new Mu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Mu);var Eu={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class _u extends Nt{}Object.assign(_u.prototype,Eu),t.register("canvas",(function(t,e,i,s){var r=new _u(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",_u);const Ru=Phaser.Utils.Objects.GetValue;class Lu extends Nt{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexCircleMaskImage",this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={maskType:i});var s=Ru(i,"maskType",0),r=Ru(i,"backgroundColor",void 0),n=Ru(i,"strokeColor",void 0),a=Ru(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Bu[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var o=this.scene.sys.textures.getFrame(t,e);if(!o)return this;o.cutWidth!==this.width||o.cutHeight!==this.height?this.setCanvasSize(o.cutWidth,o.cutHeight):this.clear();var h=this.canvas,l=this.context,d=h.width,c=h.height;null!=r&&(l.fillStyle=r,l.fillRect(0,0,d,c)),l.save(),l.beginPath();var u=a/2;switch(s){case 1:var p=(m=Math.floor(d/2))-u,g=(y=Math.floor(c/2))-u;l.ellipse(m,y,p,g,0,0,2*Math.PI);break;case 2:var v=Ru(i,"radius",0),f=Ru(i,"iteration",void 0);Zt(l,u,u,d-a,c-a,v,f);break;default:var m=Math.floor(d/2),y=Math.floor(c/2),b=Math.min(m,y)-u;l.arc(m,y,b,0,2*Math.PI)}return null!=n&&(l.strokeStyle=n,l.lineWidth=a,l.stroke()),l.clip(),this.loadTexture(t,e),l.restore(),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}const Bu={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new Lu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",Lu);const Iu=Phaser.Utils.Objects.GetValue;class Du extends Nt{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexAlphaMaskImage",this.maskFrame=null,this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={mask:{key:i}});var s=Iu(i,"mask.key"),r=Iu(i,"mask.frame"),n=Iu(i,"mask.invertAlpha",!1),a=Iu(i,"mask.scale"),o=Iu(i,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var h=s?this.scene.sys.textures.get(s):null;this.maskFrame=h?h.get(r):null}this._textureKey=t,this._frameName=e;var l=this.maskFrame;if(null===l)return this.loadTexture(t,e),this.dirty=!0,this;var d=null!=o;this.loadTexture(t,e);var c,u,p=this.canvas,g=this.context,v=p.width,f=p.height;g.save(),g.globalCompositeOperation=n?"destination-out":"destination-in",null!=this._maskScale?(c=l.cutWidth*this._maskScale,u=l.cutHeight*this._maskScale):(c=v,u=f);var m=(v-c)/2,y=(f-u)/2;return this.drawFrame(this._maskKey,this._maskFrame,m,y,c,u),g.restore(),d&&(g.save(),g.globalCompositeOperation="destination-over",g.fillStyle=o,g.fillRect(0,0,v,f),g.restore()),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}t.register("alphaMaskImage",(function(t,e,i,s,r){var n=new Du(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Du);const Au=Phaser.Math.Linear,ju=Phaser.Math.Percent;var zu={setValue(t,e,i){return null==t||(void 0!==e&&(t=ju(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=ju(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Au(t,e,i)),i}};const Fu=Phaser.Math.Percent;var Xu={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Fu(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new iu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new iu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Yu=Phaser.Utils.Objects.GetValue,Wu=Phaser.Math.Clamp;function Vu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Yu(t,"eventEmitter",this);var e=Yu(t,"valuechangeCallback",null);if(null!==e){var i=Yu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Yu(t,"easeValue.duration",0)).setEaseValueFunction(Yu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Wu(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,zu,Xu),e}const Gu=Phaser.Math.RadToDeg,Hu=Phaser.Math.DegToRad;var Uu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Hu(n),d=Hu(a),c=Math.cos(l),u=Math.sin(l),p=Math.cos(d),g=Math.sin(d);return t.startAt(e+c*s,i+u*s),t.arc(e,i,s,n,a,o),h&&0===r||(t.lineTo(e+p*r,i+g*r),r>0&&t.arc(e,i,r,a,n,!o)),t.close(),t},Nu={buildShapes(){var t=this.iterations;this.addShape((new $c).setIterations(t).setName("track")).addShape((new $c).setIterations(t).setName("bar")).addShape((new Sc).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Uu(r,t,t,i,s,0,360,!1)):r.reset();var n,a,o,h=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(n=!1,a=0,o=360):(n=this.anticlockwise,a=Gu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Uu(h,t,t,i+1,s-1,a,o,!1)):h.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const $u=Phaser.Utils.Objects.GetValue,Ku=Phaser.Utils.Objects.IsPlainObject,Ju=Phaser.Math.Clamp,qu=Phaser.Math.DegToRad(270);let Zu=class extends(Vu(vc)){constructor(t,e,i,s,r,n,a){Ku(e)&&(e=$u(a=e,"x",0),i=$u(a,"y",0),s=$u(a,"radius",1),r=$u(a,"barColor",void 0),n=$u(a,"value",0)),void 0===s&&(s=1);var o=2*s;super(t,e,i,o,o),this.type="rexCircularProgress",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor($u(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor($u(a,"centerColor",void 0)),this.setThickness($u(a,"thickness",.2)),this.setStartAngle($u(a,"startAngle",qu)),this.setAnticlockwise($u(a,"anticlockwise",!1)),this.iterations=$u(a,"iterations",128),this.buildShapes(),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Ju(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}};Object.assign(Zu.prototype,Nu),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new Zu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",Zu);var Qu=function(t,e,i,s,r,n,a,o,h,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=o&&(e.strokeStyle=o,e.lineWidth=h,e.stroke())};const tp=Phaser.Math.PI2;var ep=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,o=this.startAngle,h=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),Qu(0,n,e,e,s,s,void 0,this.trackColor,i,o,h,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?h:a?(o-l*this.value+tp)%tp:(o+l*this.value)%tp,n.save(),this.barColor2){var u=e+s*Math.cos(o),p=e+s*Math.sin(o),g=e+s*Math.cos(d),v=e+s*Math.sin(d),f=n.createLinearGradient(u,p,g,v);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;Qu(0,n,e,e,s,s,void 0,c,i,o,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),Qu(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,o,h,l,d){void 0===h&&null!=o&&(h=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=o,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=o&&"none"!==o&&h>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const ip=Phaser.Utils.Objects.GetValue,sp=Phaser.Utils.Objects.IsPlainObject,rp=Phaser.Math.Clamp,np=Phaser.Math.DegToRad(270),ap=Phaser.Math.PI2;class op extends(Vu(Nt)){constructor(t,e,i,s,r,n,a){sp(e)&&(e=ip(a=e,"x",0),i=ip(a,"y",0),s=ip(a,"radius",1),r=ip(a,"barColor",void 0),n=ip(a,"value",0));var o=2*s;super(t,e,i,o,o,ip(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(ip(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(ip(a,"barColor2",void 0)),this.setCenterColor(ip(a,"centerColor",void 0)),this.setThickness(ip(a,"thickness",.2)),this.setStartAngle(ip(a,"startAngle",np)),this.setEndAngle(ip(a,"endAngle",this.startAngle+ap)),this.setAnticlockwise(ip(a,"anticlockwise",!1)),this.setTextColor(ip(a,"textColor",void 0)),this.setTextStrokeColor(ip(a,"textStrokeColor",void 0),ip(a,"textStrokeThickness",void 0));var h=ip(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(ip(a,"textSize","16px"),ip(a,"textFamily","Courier"),ip(a,"textStyle","")),this.setTextFormatCallback(ip(a,"textFormatCallback",void 0),ip(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=hp(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=hp(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=hp(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=rp(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),ep.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var hp=function(t,e,i){return i?t<=e?ap+t-e:t-e:t>=e?ap+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new op(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",op);var lp=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const dp=Phaser.Utils.Objects.GetValue,cp=Phaser.Utils.Objects.IsPlainObject;let up=class extends(Vu(vc)){constructor(t,e,i,s,r,n,a,o){cp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):cp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):cp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new $c).setName("trackFill")).addShape((new $c).setName("bar")).addShape((new $c).setName("trackStroke")),this.setTrackColor(dp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(dp(o,"trackStrokeThickness",2),dp(o,"trackStrokeColor",void 0)),this.setSkewX(dp(o,"skewX",0)),this.setRTL(dp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}};var pp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&lp(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),lp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&lp(o,0,0,e,i,t)}};Object.assign(up.prototype,pp),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new up(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",up);var gp=function(t,e,i,s,r){t.setIterations(r).start();var n=s.tl;if(Et(n))if(n.convex){var a=n.x,o=n.y;t.ellipticalArc(a,o,n.x,n.y,180,270,!1)}else a=0,o=0,t.ellipticalArc(a,o,n.x,n.y,90,0,!0);else t.lineTo(0,0);return n=s.tr,Et(n)?n.convex?(a=e-n.x,o=n.y,t.ellipticalArc(a,o,n.x,n.y,270,360,!1)):(a=e,o=0,t.ellipticalArc(a,o,n.x,n.y,180,90,!0)):t.lineTo(e,0),n=s.br,Et(n)?n.convex?(a=e-n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,0,90,!1)):(a=e,o=i,t.ellipticalArc(a,o,n.x,n.y,270,180,!0)):t.lineTo(e,i),n=s.bl,Et(n)?n.convex?(a=n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,90,180,!1)):(a=0,o=i,t.ellipticalArc(a,o,n.x,n.y,360,270,!0)):t.lineTo(0,i),t.close(),t},vp=Phaser.Math.RadToDeg,fp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(Et(a)){l=n>a.x?90:vp(Math.acos((a.x-n)/a.x));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,0);if(a=s.tr,Et(a)&&n>e-a.x){var l=90-vp(Math.acos((n-(e-a.x))/a.x));o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)}else t.lineTo(n,0);a=s.br,Et(a)&&n>e-a.x?(l=90-vp(Math.acos((n-(e-a.x))/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)):t.lineTo(n,i),a=s.bl,Et(a)?(l=n>a.x?90:vp(Math.acos((a.x-n)/a.x)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,i)},mp=Phaser.Math.RadToDeg,yp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(Et(a)){l=n>a.y?90:mp(Math.acos((a.y-n)/a.y));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)}else t.lineTo(0,0);if(a=s.tr,Et(a)?(l=n>a.y?90:mp(Math.acos((a.y-n)/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)):t.lineTo(e,0),a=s.br,Et(a)&&n>i-a.y){var l=90-mp(Math.acos((n-(i-a.y))/a.y));o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)}else t.lineTo(e,n);a=s.bl,Et(a)&&n>i-a.y?(l=90-mp(Math.acos((n-(i-a.y))/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,n)},bp=Phaser.Math.RadToDeg,xp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(Et(a)){l=n>a.x?90:bp(Math.acos((a.x-n)/a.x));var o=e-a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)}else t.lineTo(e,0);if(a=s.br,Et(a)?(l=n>a.x?90:bp(Math.acos((a.x-n)/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)):t.lineTo(e,i),a=s.bl,Et(a)&&n>e-a.x){var l=90-bp(Math.acos((n-(e-a.x))/a.x));o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)}else t.lineTo(e-n,i);a=s.tl,Et(a)&&n>e-a.x?(l=90-bp(Math.acos((n-(e-a.x))/a.x)),o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)):t.lineTo(e-n,0)},Cp=Phaser.Math.RadToDeg,kp=function(t,e,i,s,r){var n=i*r,a=s.br;if(Et(a)){l=n>a.y?90:Cp(Math.acos((a.y-n)/a.y));var o=e-a.x,h=i-a.y;t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)}else t.lineTo(e,i);if(a=s.bl,Et(a)?(l=n>a.y?90:Cp(Math.acos((a.y-n)/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)):t.lineTo(0,i),a=s.tl,Et(a)&&n>i-a.y){var l=90-Cp(Math.acos((n-(i-a.y))/a.y));o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,i-n);a=s.tr,Et(a)&&n>i-a.y?(l=90-Cp(Math.acos((n-(i-a.y))/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)):t.lineTo(e,i-n)},wp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Sp=function(t){return"string"==typeof t&&(t=wp[t]),t};const Pp=Phaser.Utils.Objects.GetValue,Tp=Phaser.Utils.Objects.IsPlainObject;class Op extends(Vu(vc)){constructor(t,e,i,s,r,n,a,o,h){Tp(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Tp(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Tp(n)&&(n=(h=n).radius,a=h.barColor,o=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===o&&(o=0),super(t,e,i,s,r,h),this.type="rexRoundRectangleProgress",this.bootProgressBase(h),this.addShape((new $c).setName("trackFill")).addShape((new $c).setName("bar")).addShape((new $c).setName("trackStroke")),this.setTrackColor(Pp(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Pp(h,"trackStrokeThickness",2),Pp(h,"trackStrokeColor",void 0)),this.setOrientation(Pp(h,"orientation",0)),this.setRTL(Pp(h,"rtl",!1)),this.rrGeom=new Pt,this.setRadius(n),this.setIteration(Pp(n,"iteration",void 0)),this.setValue(o)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){t=Sp(t),this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Mp={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,n=this.rtl,a=this.iteration+1,o=this.getShape("trackFill");o.fillStyle(this.trackColor),o.isFilled&&gp(o,t,e,i,a);var h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&function(t,e,i,s,r,n,a,o){t.setIterations(o).start(),0===r||(1===r?gp(t,e,i,s,o):((0===n?a?xp:fp:a?kp:yp)(t,e,i,s,r),t.close()))}(h,t,e,i,s,r,n,a);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&gp(l,t,e,i,a)}};Object.assign(Op.prototype,Mp),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Op(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Op);var Ep=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Ep(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Rp=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var o;return r>=0?((o=n[0]).x=t+r,o.y=e,(o=n[1]).x=i+r,o.y=e,(o=n[2]).x=i,o.y=s,(o=n[3]).x=t,o.y=s):((o=n[0]).x=t,o.y=e,(o=n[1]).x=i,o.y=e,(o=n[2]).x=i-r,o.y=s,(o=n[3]).x=t-r,o.y=s),n};const Lp=Phaser.Utils.Objects.GetValue,Bp=Phaser.Utils.Objects.IsPlainObject;class Ip extends(Vu(Nt)){constructor(t,e,i,s,r,n,a,o){Bp(e)?(e=Lp(o=e,"x",0),i=Lp(o,"y",0),s=Lp(o,"width",2),r=Lp(o,"height",2),n=Lp(o,"barColor",void 0),a=Lp(o,"value",0)):Bp(s)?(s=Lp(o=s,"width",2),r=Lp(o,"height",2),n=Lp(o,"barColor",void 0),a=Lp(o,"value",0)):Bp(n)&&(n=Lp(o=n,"barColor",void 0),a=Lp(o,"value",0)),super(t,e,i,s,r,Lp(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(Lp(o,"trackColor",void 0)),this.setBarColor(n,Lp(o,"barColor2",void 0),Lp(o,"isHorizontalGradient",void 0)),this.setTrackStroke(Lp(o,"trackStrokeThickness",2),Lp(o,"trackStrokeColor",void 0)),this.setSkewX(Lp(o,"skewX",0)),this.setRTL(Lp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),_p.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new Ip(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",Ip),Phaser.Math.Wrap;const Dp=Phaser.Math.Linear;var Ap=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Dp(b.a.x,x.a.x,C),e=Dp(b.a.y,x.a.y,C),i=Dp(b.b.x,x.b.x,C),s=Dp(b.b.y,x.b.y,C),r=Dp(b.c.x,x.c.x,C),n=Dp(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const jp=(0,Phaser.Math.DegToRad)(120);var zp=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+jp),i+s*Math.sin(r+jp)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-jp),i+s*Math.sin(r-jp)),this.arrowOnly?t.end():t.close()},Fp={buildShapes(){this.addShape((new $c).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Ap.call(this):zp.call(this)}},Xp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new iu(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Yp=Phaser.Utils.Objects.GetValue,Wp=Phaser.Utils.Objects.IsPlainObject,Vp=Phaser.Math.DegToRad,Gp=Phaser.Math.RadToDeg;class Hp extends vc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Wp(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Np(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Yp(r,"x",null);null!==n?(t=n,i=n):(t=Yp(r,"left",0),i=Yp(r,"right",t));var a=Yp(r,"y",null);null!==a?(e=a,s=a):(e=Yp(r,"top",0),s=Yp(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Gp(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Vp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Up={right:0,down:1,left:2,up:3};var Np=function(t){return"string"==typeof t&&(t=Up[t]),t%=4};Object.assign(Hp.prototype,Fp,Xp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Hp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Hp),F();const $p=Phaser.GameObjects.Zone,Kp=Phaser.Utils.Array.Add,Jp=Phaser.Utils.Array.Remove;let qp=class extends $p{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[]}destroy(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),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return Kp(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Jp(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;isg(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;esg(t).x,getChildLocalY:t=>sg(t).y};const bg=Phaser.Math.DegToRad;var xg={updateChildRotation(t){var e=sg(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=sg(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return sg(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return sg(t).rotation=bg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=sg(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>sg(t).rotation},Cg={updateChildScale(t){var e=sg(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=sg(t),i=e.parent;return e.scaleX=mg(t.scaleX,i.scaleX),e.scaleY=mg(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=sg(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=sg(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>sg(t).scaleX,getChildLocalScaleY:t=>sg(t).scaleY},kg={updateChildVisible(t){var e=sg(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=sg(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),sg(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),sg(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=sg(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>sg(t).visible},wg={updateChildAlpha(t){var e=sg(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=sg(t),i=e.parent;return e.alpha=mg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return sg(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=sg(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>sg(t).alpha},Sg={updateChildActive(t){var e=sg(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return sg(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),sg(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=sg(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>sg(t).active},Pg={updateChildScrollFactor(t){var e=sg(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Tg={updateCameraFilter(t){var e=sg(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Og={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Mg=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},Eg={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},_g=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Lg=Phaser.Utils.Array;var Bg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Uv=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Nv=/(\S+)\[(\d+)\]/i;var $v={getInnerPadding(t){return Ps(this.space,t)},setInnerPadding(t,e){return Ts(this.space,t,e),this},getOuterPadding(t){return Ps(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ts(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ps(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ts(this.getSizerConfig(t).padding,e,i),this}},Kv=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Jv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},qv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Zv=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Qv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},tf=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ef={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},sf=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var vm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=_a(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},fm={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=h),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=h),this.transitOutCallback=t,this}},mm={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},ym={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},bm={};Object.assign(bm,vm,fm,mm,ym);const xm=Phaser.Utils.Objects.GetValue;class Cm extends La{constructor(t,e){super(t,e),this.setTransitInTime(xm(e,"duration.in",200)),this.setTransitOutTime(xm(e,"duration.out",200)),this.setTransitInCallback(xm(e,"transitIn")),this.setTransitOutCallback(xm(e,"transitOut")),this.oneShotMode=xm(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new gm(this,{eventEmitter:!1,initState:xm(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Cm.prototype,bm);const km=Phaser.GameObjects.Rectangle;class wm extends km{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ed(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Sm=Phaser.Utils.Objects.GetValue;class Pm extends La{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Sm(t,"hitAreaMode",0)),this.setEnable(Sm(t,"enable",!0)),this.setStopMode(Sm(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Tm[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Tm={default:0,fullWindow:1};const Om=Phaser.Utils.Objects.GetValue;class Mm extends wm{constructor(t,e){super(t,Om(e,"color",0),Om(e,"alpha",.8)),this.touchEventStop=new Pm(this,{hitAreaMode:1})}}var Em={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,yf(t,e)},scaleDown(t,e){bf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ef(t,e)},fadeOut(t,e){_f(t,e,!1)}},_m=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ef(t,e,t.alpha)},Rm=function(t,e){_f(t,e,!1)},Lm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Vn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Bm=Phaser.Utils.Objects.GetValue;let Im=class extends Cm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Dm.popUp),null==e.transitOut&&(e.transitOut=Dm.scaleDown),e.destroy=Bm(e,"destroy",!0),super(t,e);var i=Bm(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Mm(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Bm(i,"transitIn",_m)),this.setCoverTransitOutCallback(Bm(i,"transitOut",Rm)));var s=Bm(e,"touchOutsideClose",!1),r=Bm(e,"duration.hold",-1),n=Bm(e,"timeOutClose",r>=0),a=Bm(e,"anyTouchClose",!1);Bm(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Bm(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Lm(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Dm[t]),t){case Dm.popUp:t=Em.popUp;break;case Dm.fadeIn:t=Em.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Dm[t]),t){case Dm.scaleDown:t=Em.scaleDown;break;case Dm.fadeOut:t=Em.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Dm={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Am=function(t,e){var i=new Im(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i},jm=function(t,e){t.emit("modal.requestClose",e)},zm=function(t){return t&&"function"==typeof t},Fm={modal(t,e){return zm(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=Am(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return jm(this,t),this}},Xm=function(t,e,i,s,r){zm(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Ym={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Xm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Xm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Xm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Xm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Xm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Xm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Xm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Xm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Xm.call(this,"shutdown",t,e,i,s),this}},Wm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Vm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Vm={},Gm=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Lm(t,e.x,e.y,i,s):!!(r=Wm(e,n,!0))&&Lm(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const sy={press:0,pointerdown:0,release:1,pointerup:1};var ry={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new iy(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class ny extends pm{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const ay=Phaser.Utils.Objects.GetValue;class oy extends La{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ny,this.parent.setInteractive(ay(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(ay(t,"enable",!0)),this.setCooldown(ay(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var hy={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Gm(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new oy(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new oy(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},ly={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},dy=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ty,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Oy&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ty,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=My,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Gm(t,s,e,i)}}const Ty=0,Oy=1,My="IDLE",Ey=Phaser.Utils.Objects.GetValue,_y=Phaser.Math.Distance.Between;class Ry extends Py{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Ly},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Ey(t,"time",250)),this.setTapInterval(Ey(t,"tapInterval",200)),this.setDragThreshold(Ey(t,"threshold",9)),this.setTapOffset(Ey(t,"tapOffset",10));var e=Ey(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Ey(t,"maxTaps",void 0)),this.setMinTaps(Ey(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Ly:this.state=By;break;case By:var t=this.lastPointer;_y(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Iy,this.state=By);break;case Iy:this.state=By}}onDragEnd(){this.state===By&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Iy))}onDrag(){this.state!==Ly&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ly)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===By){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Ly):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Iy:this.state=Ly)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Iy&&(this.state=Ly)}get isTapped(){return this.state===Iy}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Ly="IDLE",By="BEGIN",Iy="RECOGNIZED",Dy=Phaser.Utils.Objects.GetValue;class Ay extends Py{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=jy},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Dy(t,"threshold",9)),this.setHoldTime(Dy(t,"time",251)),this}onDragStart(){this.state=zy,0===this.holdTime&&(this.state=Fy)}onDragEnd(){this.state=jy}onDrag(){this.state!==jy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=jy)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===zy&&t-this.pointer.downTime>=this.holdTime&&(this.state=Fy)}get isPressed(){return this.state===Fy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const jy="IDLE",zy="BEGIN",Fy="RECOGNIZED",Xy=Phaser.Utils.Objects.GetValue;class Yy extends Py{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=Wm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Wy},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Xy(t,"threshold",10)),this}onDragStart(){this.state=Vy,0===this.dragThreshold&&(this.state=Gy)}onDragEnd(){this.state=Wy}onDrag(){switch(this.state){case Vy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Gy,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case Gy:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=Wm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Gy}setDragThreshold(t){return this.dragThreshold=t,this}}const Wy="IDLE",Vy="BEGIN",Gy="RECOGNIZED",Hy=Phaser.Math.Distance.Between,Uy=Phaser.Math.Angle.Between;var Ny={getDt:function(){return ac(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Hy(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Uy(e.x,e.y,t.x,t.y)}},$y={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Ky={};const Jy=Phaser.Utils.Objects.GetValue,qy=Phaser.Math.RadToDeg;class Zy extends Py{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Qy},eventEmitter:!1};this.setRecongizedStateObject(new pm(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Jy(t,"threshold",10)),this.setVelocityThreshold(Jy(t,"velocityThreshold",1e3)),this.setDirectionMode(Jy(t,"dir","8dir")),this}onDragStart(){this.state=tb}onDragEnd(){this.state=Qy}onDrag(){this.state===tb&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=eb))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===eb&&(this.state=Qy)}get isSwiped(){return this.state===eb}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=$y[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Ky),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(qy(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Zy.prototype,Ny);const Qy="IDLE",tb="BEGIN",eb="RECOGNIZED",ib=Phaser.Utils.Objects.GetValue,sb=Phaser.Utils.Array.SpliceOne,rb=Phaser.Math.Distance.Between,nb=Phaser.Math.Angle.Between;class ab{constructor(t,e){var i=_a(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(ib(e,"inputConfig",void 0)),this.setEventEmitter(ib(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(ib(t,"enable",!0)),this.bounds=ib(t,"bounds",void 0),this.tracerState=hb,this.pointers.length=0,q(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,q(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case hb:this.tracerState=lb,this.onDrag1Start();break;case lb:this.tracerState=db,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],sb(this.pointers,e),this.tracerState){case lb:this.tracerState=hb,this.onDrag1End();break;case db:this.tracerState=lb,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case lb:this.onDrag1();break;case db:this.onDrag2()}}}dragCancel(){return this.tracerState===db&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=hb,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==db)return 0;var t=this.pointers[0],e=this.pointers[1];return rb(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==db)return 0;var t=this.pointers[0],e=this.pointers[1];return nb(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;ob.x=e.x-i.x,ob.y=e.y-i.y}else ob.x=0,ob.y=0;return ob}get centerX(){if(this.tracerState!==db)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==db)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==db)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==db)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=cb,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Gm(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Gm(t,s,e,i)}}Object.assign(ab.prototype,ln);var ob={};const hb=0,lb=1,db=2,cb="IDLE",ub=Phaser.Utils.Objects.GetValue;class pb extends ab{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=gb},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ub(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=vb,0===this.dragThreshold&&(this.state=fb)}onDrag2End(){this.state=gb}onDrag2(){switch(this.state){case vb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=fb}break;case fb:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===fb}setDragThreshold(t){return this.dragThreshold=t,this}}const gb="IDLE",vb="BEGIN",fb="RECOGNIZED",mb=Phaser.Math.RotateAround;var yb=function(t,e,i,s){return mb(t,e,i,s),t.rotation+=s,t},bb={};const xb=Phaser.Utils.Objects.GetValue,Cb=Phaser.Math.Angle.WrapDegrees,kb=Phaser.Math.Angle.ShortestBetween,wb=Phaser.Math.RadToDeg,Sb=Phaser.Math.DegToRad;class Pb extends ab{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevAngle=void 0,i.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("rotatestart",i)},exit:function(){i.emit("rotateend",i)}}},init:function(){this.state=Ob},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=Cb(wb(this.angleBetween)),this.state=Mb,0===this.dragThreshold&&(this.state=Eb)}onDrag2End(){this.state=Ob}onDrag2(){switch(this.state){case Mb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Cb(wb(this.angleBetween));this.angle=kb(this.prevAngle,t),this.prevAngle=t,this.state=Eb}break;case Eb:t=Cb(wb(this.angleBetween)),this.angle=kb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Eb}get rotation(){return Sb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var Tb={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=bb),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=Bv(s),Nb(r)?(u.expandWidth=$b(r,"width",!1),u.expandHeight=$b(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?jn(t):n),u.expandHeight&&(t.minHeight=void 0===a?zn(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}};const Zb=Zg.prototype.clear;var Qb=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Zb.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Hb.width=e.aspectRatio,Hb.height=1,Ub.width=l,Ub.height=d,l=(c=Yb(Hb,Ub,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),Gb(t,this)):af(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=jn(t)),void 0===d&&(d=zn(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,qm.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(ex,qb,tx);var ix=function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null};const sx=Phaser.Utils.Objects.IsPlainObject,rx=Phaser.Utils.Objects.GetValue;class nx extends Xb{constructor(t,e,i,s,r,n){sx(e)?(e=rx(n=e,"x",0),i=rx(n,"y",0),s=rx(n,"width",void 0),r=rx(n,"height",void 0)):sx(s)&&(s=rx(n=s,"width",void 0),r=rx(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return ix(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(nx.prototype,ex);var ax=Phaser.Math.Distance.Between,ox=function(t,e,i){var s=t.width/2;return ax(s,s,e,i)<=s};const hx=Phaser.Math.Angle.Between,lx=Phaser.Math.Angle.Normalize;var dx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(ox(s,e,i)){var r=s.width/2,n=s.startAngle,a=hx(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=lx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},cx=function(){this.sizerChildren.knob.on("pointerdown",dx,this).on("pointermove",dx,this).setInteractive()};const ux=Phaser.Math.Angle.Between,px=Phaser.Math.Angle.Wrap;var gx=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;ox(s,e,i)&&mx.call(this,t)}},vx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case xx:ox(s,e,i)&&mx.call(this,t);break;case Cx:ox(s,e,i)?bx.call(this):yx.call(this)}}},fx=function(t,e,i){this.enable&&this.panPointer===t&&yx.call(this)},mx=function(t){this.panPointer=t,this.panState=Cx},yx=function(){this.panPointer=void 0,this.panState=xx},bx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=ux(i.x,i.y,t.x,t.y),r=ux(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=px(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const xx=0,Cx=1;var kx=function(){this.sizerChildren.knob.on("pointerdown",gx,this).on("pointermove",vx,this).on("pointerup",fx,this).setInteractive(),this.panPointer=void 0,this.panState=xx},wx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},Sx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:wx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(wx.call(this,t)),e.layout&&e.layout()),this}};const Px=Phaser.Utils.Objects.GetValue,Tx=Phaser.Math.Snap.To;class Ox extends(Vu(nx)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Px(e,"background",void 0),s=Px(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Px(e,"textFormatCallback",void 0),Px(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new op(t,e);r.setDepth(Px(e,"knobDepth",0)),r._value=-1,t.add.existing(r),this.add(r,"knob"),s&&(this.add(s,"text","center",0,!1),t.children.moveBelow(r,s)),this.addChildrenMap("background",i),this.addChildrenMap("knob",r),this.addChildrenMap("text",s),this.setEnable(Px(e,"enable",void 0)),this.setGap(Px(e,"gap",void 0)),this.setValue(Px(e,"value",0),Px(e,"min",void 0),Px(e,"max",void 0));var n=Px(e,"input",0);switch("string"==typeof n&&(n=Mx[n]),n){case 0:kx.call(this);break;case 1:cx.call(this)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t){return this.gap=t,this}get value(){return this.sizerChildren.knob.value}set value(t){void 0!==this.gap&&(t=Tx(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter))}}const Mx={pan:0,drag:0,click:1,none:-1};Object.assign(Ox.prototype,Sx),t.register("knob",(function(t){var e=new Ox(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",Ox);const Ex={arc:wc,circle:Sc,curve:class extends Cc{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;ethis.value)for(var d=0;dthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0?d.pop().setTexture(u,O):r(c,u,O),h&&c.add.existing(T),l){var M=b+k*P+a*k,E=x+w*S+o*w;T.setOrigin(a,o).setPosition(M,E).setScale(v,f).setRotation(m),dk(T,b,x,m)}C.push(T)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a))),e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode&&(s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))))};Object.assign(xk.prototype,pk);const kk={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new xk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",xk);const wk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,Sk=Phaser.Utils.Objects.GetValue,Pk=Phaser.Math.Clamp;class Tk extends wk{constructor(t){super({name:"rexDissolvePostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n// Scene buffer\nuniform sampler2D uMainSampler;\nuniform sampler2D uMainSampler2;\n\nuniform int resizeMode;\nuniform float progress;\nuniform float fromRatio;\nuniform float toRatio;\nvarying vec2 outFragCoord;\n// Effect parameters\nuniform float noiseX;\nuniform float noiseY;\nuniform float noiseZ;\nuniform float fromEdgeStart;\nuniform float fromEdgeWidth;\nuniform float toEdgeStart;\nuniform float toEdgeWidth;\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nvec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); }\nfloat Perlin(vec3 P) {\n vec3 i0 = mod289(floor(P)), i1 = mod289(i0 + vec3(1.0));\n vec3 f0 = fract(P), f1 = f0 - vec3(1.0), f = fade(f0);\n vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x), iy = vec4(i0.yy, i1.yy);\n vec4 iz0 = i0.zzzz, iz1 = i1.zzzz;\n vec4 ixy = permute(permute(ix) + iy), ixy0 = permute(ixy + iz0), ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0), gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n vec4 gx1 = ixy1 * (1.0 / 7.0), gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0); gx1 = fract(gx1);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0), sz0 = step(gz0, vec4(0.0));\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1), sz1 = step(gz1, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g0 = vec3(gx0.x,gy0.x,gz0.x), g1 = vec3(gx0.y,gy0.y,gz0.y),\n g2 = vec3(gx0.z,gy0.z,gz0.z), g3 = vec3(gx0.w,gy0.w,gz0.w),\n g4 = vec3(gx1.x,gy1.x,gz1.x), g5 = vec3(gx1.y,gy1.y,gz1.y),\n g6 = vec3(gx1.z,gy1.z,gz1.z), g7 = vec3(gx1.w,gy1.w,gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g0,g0), dot(g2,g2), dot(g1,g1), dot(g3,g3)));\n vec4 norm1 = taylorInvSqrt(vec4(dot(g4,g4), dot(g6,g6), dot(g5,g5), dot(g7,g7)));\n g0 *= norm0.x; g2 *= norm0.y; g1 *= norm0.z; g3 *= norm0.w;\n g4 *= norm1.x; g6 *= norm1.y; g5 *= norm1.z; g7 *= norm1.w;\n vec4 nz = mix(vec4(dot(g0, vec3(f0.x, f0.y, f0.z)), dot(g1, vec3(f1.x, f0.y, f0.z)),\n dot(g2, vec3(f0.x, f1.y, f0.z)), dot(g3, vec3(f1.x, f1.y, f0.z))),\n vec4(dot(g4, vec3(f0.x, f0.y, f1.z)), dot(g5, vec3(f1.x, f0.y, f1.z)),\n dot(g6, vec3(f0.x, f1.y, f1.z)), dot(g7, vec3(f1.x, f1.y, f1.z))), f.z);\n return 2.2 * mix(mix(nz.x,nz.z,f.y), mix(nz.y,nz.w,f.y), f.x);\n}\nfloat Perlin(vec2 P) { return Perlin(vec3(P, 0.0)); }\n\n\nvec4 getFromColor (vec2 uv) {\n return texture2D(uMainSampler, uv);\n}\n\nvec4 getToColor (vec2 uv) {\n if (resizeMode == 2) {\n // cover\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(min(fromRatio / toRatio, 1.0), min((toRatio / fromRatio), 1.0)));\n } else if (resizeMode == 1) {\n // contain\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(max(fromRatio / toRatio, 1.0), max((toRatio / fromRatio), 1.0)));\n } else {\n // stretch\n return texture2D(uMainSampler2, vec2(uv.x, 1.0 - uv.y));\n }\n}\n\nvec4 transition (vec2 uv) { \n vec4 colorFront = getFromColor(uv);\n vec4 colorTo = getToColor(uv);\n\n float noise = (Perlin(vec3(uv.x * noiseX, uv.y * noiseY, noiseZ)) + 1.0) / 2.0\n * (1.0 - (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth))\n + (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth) * 0.5;\n vec4 colorResult = colorFront * smoothstep(progress - (fromEdgeStart + fromEdgeWidth), progress - fromEdgeStart, noise)\n + colorTo * smoothstep((1.0 - progress) - (toEdgeStart + toEdgeWidth), (1.0 - progress) - toEdgeStart, (1.0 - noise));\n return colorResult;\n}\n\nvoid main () {\n vec2 uv = outFragCoord;\n gl_FragColor = transition(uv);\n}\n"}),this._progress=0,this.toFrame=null,this.targetTexture=null,this.resizeMode=1,this.toRatio=1,this.noiseX=0,this.noiseY=0,this.noiseZ=0,this.fromEdgeStart=.01,this.fromEdgeWidth=.05,this.toEdgeStart=.01,this.toEdgeWidth=.05}resetFromJSON(t){return this.setProgress(Sk(t,"progress",0)),this.setTransitionTargetTexture(Sk(t,"toTexture","__DEFAULT"),Sk(t,"toFrame",void 0),Sk(t,"resizeMode",1)),this.setNoise(Sk(t,"noiseX",void 0),Sk(t,"noiseY",void 0),Sk(t,"noiseZ",void 0)),this.setFromEdge(Sk(t,"fromEdgeStart",.01),Sk(t,"fromEdgeWidth",.05)),this.setToEdge(Sk(t,"toEdgeStart",.01),Sk(t,"toEdgeWidth",.05)),this}onBoot(){}onPreRender(){this.set1f("progress",this.progress),this.set1i("resizeMode",this.resizeMode),this.set1f("noiseX",this.noiseX),this.set1f("noiseY",this.noiseY),this.set1f("noiseZ",this.noiseZ),this.set1f("fromEdgeStart",this.fromEdgeStart),this.set1f("fromEdgeWidth",this.fromEdgeWidth),this.set1f("toEdgeStart",this.toEdgeStart),this.set1f("toEdgeWidth",this.toEdgeWidth)}onDraw(t){this.set1f("fromRatio",t.width/t.height),this.set1f("toRatio",this.toRatio),this.set1i("uMainSampler2",1),this.bindTexture(this.targetTexture,1),this.bindAndDraw(t)}get progress(){return this._progress}set progress(t){this._progress=Pk(t,0,1)}setProgress(t){return this.progress=t,this}setTransitionTargetTexture(t,e,i){void 0===t&&(t="__DEFAULT");var s=this.game.textures.getFrame(t,e);return s||(s=this.game.textures.getFrame("__DEFAULT")),this.toRatio=s.width/s.height,this.toFrame=s,this.targetTexture=s.glTexture,void 0!==i&&(this.resizeMode=i),this}setResizeMode(t){return"string"==typeof t&&(t=Ok[t]),this.resizeMode=t,this}setNoise(t,e,i){return void 0===t&&(t=4+6*Math.random()),void 0===e&&(e=4+6*Math.random()),void 0===i&&(i=10*Math.random()),this.noiseX=t,this.noiseY=e,this.noiseZ=i,this}setFromEdge(t,e){return this.fromEdgeStart=t,this.fromEdgeWidth=e,this}setToEdge(t,e){return this.toEdgeStart=t,this.toEdgeWidth=e,this}}var Ok={stretch:0,contain:1,cover:2};const Mk=Phaser.Utils.Array.SpliceOne,Ek=.1,_k=[function(t){t.addTransitionMode("slideAwayRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}})},function(t){t.addTransitionMode("slideRight",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(s-1);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideLeft",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(1-s);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideDown",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(s-1);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideUp",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(1-s);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("pushRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0),r=i.width*(s-1),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0),r=i.width*(1-s),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r),r=i.height*(s-1),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r),r=i.height*(1-s),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("zoomOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=1-s;t.setChildLocalScale(e,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1)}}).addTransitionMode("zoomIn",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=s;t.setChildLocalScale(i,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(i,1,1)}}).addTransitionMode("zoomInOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(r=1-So(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-So(s),t.setChildLocalScale(i,r,r))},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildLocalScale(i,1,1),t.setChildVisible(i,!0),i.tint=16777215}})},function(t){t.addTransitionMode("fade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(s=So(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=So(s),r=Math.floor(255*(1-s)),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}}).addTransitionMode("crossFade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){t.setChildLocalAlpha(e,1-s),t.setChildLocalAlpha(i,s)},onComplete:function(t,e,i,s){t.setChildLocalAlpha(e,1)}})},function(t){var e,i=(e=t.scene,new Gx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){this.getShape("rect").fillStyle(16777215).setSize(this.width*this.value,this.height*this.value).setCenterPosition(this.centerX,this.centerY)}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("irisOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=So(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=So(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Gx(e,{type:"Graphics",create:[{name:"pie",type:"arc"}],update:function(){var t=2*Math.max(this.width,this.height),e=90*this.value;this.getShape("pie").fillStyle(16777215).setCenterPosition(this.centerX,0).setRadius(t).setAngle(90-e,90+e).setPie()}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("pieOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=So(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=So(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Gx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){var t=this.getShape("rect").fillStyle(16777215),e=1-this.value;switch(this.wipeMode){case"right":t.setSize(this.width*e,this.height).setTopLeftPosition(this.width-t.width,0);break;case"left":t.setSize(this.width*e,this.height).setTopLeftPosition(0,0);break;case"down":t.setSize(this.width,this.height*e).setTopLeftPosition(0,this.height-t.height);break;case"up":t.setSize(this.width,this.height*e).setTopLeftPosition(0,0)}}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("wipeRight",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="right"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeLeft",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="left"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeDown",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="down"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeUp",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="up"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}})},function(t){var e=function(t,e){var i=new Gx(t,{type:"Graphics",create:{rectangle:e},update:function(){for(var t=this.getShapes(),i=this.width/e,s=0;s=0;s--)(a=r[s])instanceof e&&(a.destroy(),Mk(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,Tk),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ek,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ek,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ek,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ek,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class Rk extends xk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=_k.length;at.dropEnable}),this.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var s in this.filters){for(var r=this.filters[s],n=[],a=0,o=i.length;a0&&this.emit(`drop.${s}`,n)}}),this)}get files(){return this._files}}Object.assign(vw.prototype,dw),t.register("fileDropZone",(function(t){var e=new vw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",vw);const fw=Phaser.Math.Wrap;var mw=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,a=0,o=n.length;a(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const Cw=Phaser.Utils.Objects.IsPlainObject,kw=Phaser.Utils.Objects.GetValue,ww=Phaser.Display.Align.CENTER,Sw={min:0,full:-1};var Pw=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,p;Dv.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=Sw[e];else if(Cw(e)){var f;e=kw(f=e,"proportion",void 0),i=kw(f,"align",ww),s=kw(f,"padding",0),r=kw(f,"expand",!1),n=kw(f,"key",void 0),a=kw(f,"index",void 0),t.isRexSizer||(o=kw(f,"minWidth",void 0),h=kw(f,"minHeight",void 0)),l=kw(f,"fitRatio",0),d=kw(f,"offsetX",0),c=kw(f,"offsetY",0),u=kw(f,"offsetOriginX",0),p=kw(f,"offsetOriginY",0)}return"string"==typeof i&&(i=ev[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=ww),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=jn(t)/zn(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=Bv(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?jn(t):o:t.minHeight=void 0===h?zn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Tw={add:Pw,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Pw.call(this,new bw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Cw(i)&&(i.index=t),Pw.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=xw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Ow=Phaser.Utils.Array.Remove;var Mw={remove(t,e){return this.getParentSizer(t)!==this||(Ow(this.sizerChildren,t),Wv.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Qb.call(this,t),this}},Ew={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=ev[e]),this.getSizerConfig(t).align=e,this}},_w={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Rw={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Lw={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Bw={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(af(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,sf.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Zv.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Jv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&mw.call(this,t,void 0),qv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Qv.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&mw.call(this,void 0,t),tf.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Bw,Tw,Mw,Ew,_w,Rw,Lw);var Iw=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i};const Dw=Phaser.Utils.Objects.IsPlainObject,Aw=Phaser.Utils.Objects.GetValue;class jw extends Xb{constructor(t,e,i,s,r,n,a){Dw(e)?(e=Aw(a=e,"x",0),i=Aw(a,"y",0),s=Aw(a,"width",void 0),r=Aw(a,"height",void 0),n=Aw(a,"orientation",0)):Dw(s)?(s=Aw(a=s,"width",void 0),r=Aw(a,"height",void 0),n=Aw(a,"orientation",0)):Dw(n)&&(n=Aw(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Aw(a,"space.item",0)),this.setStartChildIndex(Aw(a,"startChildIndex",0)),this.setRTL(Aw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Sp(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Iw.call(this)),this._childrenProportion}}Object.assign(jw.prototype,Bw);var zw=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Fw={appendText:Mi,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Xw extends jw{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(zw(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(zw(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&zw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&zw(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Xw.prototype,Fw);var Yw=function(t,e,i,s){var r=new rk(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Ww=Phaser.GameObjects.Text;var Vw=function(t){return t instanceof Ww};const Gw=Phaser.GameObjects.BitmapText;var Hw=function(t){return t instanceof Gw},Uw=function(t){return Hw(t)?2:Vw(t)?0:1},Nw=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Kw=function(t,e){switch(Uw(t)){case 0:switch("string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Nw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e}},Jw=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof hn}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Hw(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return Vw(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const qw=65535;var Zw=function(t,e,i){if(null==e)return t;if(0===e)return eS(t,0,i),t;var s=t.text.length;if(0===s)return eS(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},a=tS(t,r,e,i,n),o=0;o<=qw&&0!==a;o++){if((r+=a)<0){r=0;break}a=tS(t,r,e,i,n)}return o===qw&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),eS(t,e,i),t},Qw=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},tS=function(t,e,i,s,r){var n,a=Qw(t,e,r),o=Qw(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},eS=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const iS=Phaser.Utils.Objects.GetValue;var sS=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=iS(e,"minWidth",0),s=iS(e,"minHeight",0),r=iS(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Zw(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Zw(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const rS=Phaser.Utils.Objects.GetValue;class nS extends Xw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=rS(e,"background",void 0),r=rS(e,"icon",void 0),n=rS(e,"iconMask",void 0),a=rS(e,"text",void 0),o=rS(e,"action",void 0),h=rS(e,"actionMask",void 0),l=rS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:rS(e,"space.icon",0),top:rS(e,"space.iconTop",0),bottom:rS(e,"space.iconBottom",0),left:rS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:rS(e,"space.icon",0),left:rS(e,"space.iconLeft",0),right:rS(e,"space.iconRight",0),top:rS(e,"space.iconTop",0)});var d=rS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Yw.call(this,r,r,1)),!d){var c=rS(e,"iconSize",void 0);this.setIconSize(rS(e,"iconWidth",c),rS(e,"iconHeight",c))}}if(a){var u=rS(e,"wrapText",!1),p=rS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Kw(a,u),e.expandTextWidth=!0,Jw(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,sS(a,{fitHeight:!0}));var g,v,f=rS(e,"space.text",0),m=rS(e,"expandTextWidth",!1),y=rS(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:rS(e,"space.actionTop",0),bottom:rS(e,"space.actionBottom",0),right:rS(e,"space.actionRight",0)}:{left:rS(e,"space.actionLeft",0),right:rS(e,"space.actionRight",0),bottom:rS(e,"space.actionBottom",0)},d=rS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Yw.call(this,o,o,1)),!d)){var b=rS(e,"actionSize");this.setActionSize(rS(e,"actionWidth",b),rS(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}const aS=Phaser.Utils.Objects.GetValue;var oS=function(t,e){var i=aS(e,"canvas"),s=aS(i,"width",128),r=aS(i,"height",128),n=new _u(t,0,0,s,r);t.add.existing(n);var a=aS(i,"key"),o=aS(i,"frame"),h=aS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const hS=Phaser.Utils.Objects.GetValue;var lS=function(t,e){var i=hS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const dS=Phaser.Utils.Objects.GetValue,cS={accept:"image/*",multiple:!1};var uS=function(t,e){if(0!==e.length){var i=t.childrenMap.icon,s=i.image,r=e[0];return s.loadFromFilePromise(r).then((function(){return i.scaleImage(),t.emit("select",r,t),Promise.resolve(r)}))}},pS={async openPromise(){var t=this;return Qk(this.scene.game,cS).then((function(e){return uS(t,e.files)}))},open(){return this.openPromise(),this},setClickOpenEnable(t){return void 0===t&&(t=!0),this.clickBehavior&&this.clickBehavior.setEnable(t),this.fileChooser&&this.fileChooser.setOpenEnable(t),this}},gS={getFileName:function(t){if(!t)return null;var e=t.name;return e.substr(0,e.lastIndexOf("."))},saveTexture:function(t){return this.childrenMap.canvas.generateTexture(t),this}};Object.assign(gS,pS);const vS=Phaser.Utils.Objects.GetValue;class fS extends nS{constructor(t,e){var i=function(t,e){var i=new Ak(t,{scaleUp:aS(e,"scaleUpIcon",!1),background:aS(e,"iconBackground"),image:oS(t,e)});return t.add.existing(i),i}(t,e);e.icon=i,super(t,e),this.type="rexImageFileInputLabel";var s=this.iconWidth,r=this.iconWidth;void 0!==s&&void 0!==r&&i.resize(s,r),this.clickTarget=lS(this,e),this.clickTarget&&(vS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new aw(e,cS);return e.add.existing(i),t.pin(i),i.on("change",(function(){uS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=lS(t,e);if(i){var s=dS(e,"click"),r=new du(i,s);return r.on("click",t.open,t),r}}(this,e)),this.addChildrenMap("canvas",i.image),this.addChildrenMap("iconBackground",i.background),this.addChildrenMap("fileChooser",this.fileChooser)}postLayout(t,e,i){this.fileChooser&&(this.fileChooser.syncTo(this.clickTarget),this.resetChildState(this.fileChooser)),super.postLayout(t,e,i)}}Object.assign(fS.prototype,gS),t.register("imageInputLabel",(function(t){var e=new fS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",fS);let mS=class extends La{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const yS=Phaser.Utils.Objects.GetValue;class bS extends La{constructor(t,e){super(t,e),this.style=yS(e,"style",this);var i=yS(e,"propertiesMap");this.activeStyle=xS(e,"active",i),this.hoverStyle=xS(e,"hover",i),this.disableStyle=xS(e,"disable",i),this.onModifyStyle=yS(e,"onModifyStyle")}getStyle(t){return Id(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Dd(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return CS.call(this,"active",t),this}setHoverState(t){return CS.call(this,"hover",t),this}setDisableState(t){return CS.call(this,"disable",t),this}}var xS=function(t,e,i){var s=Ld(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},CS=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},kS={addStyleManager(t){return this.styleManager=new bS(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};const wS=Phaser.GameObjects.Image,SS=Phaser.Utils.Objects.GetValue;class PS extends wS{constructor(t,e){void 0===e&&(e={}),super(t,SS(e,"x",0),SS(e,"y",0),SS(e,"key",""),SS(e,"frame",void 0)),this.type="rexStatesImage";var i=SS(e,"effects",!0);i&&Mn(this,i),this.style=new mS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(PS.prototype,kS),t.register("statesImage",(function(t){var e=new PS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",PS);class TS extends At{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=OS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const OS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(TS.prototype,kS),t.register("statesRoundRectangle",(function(t){var e=new TS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",TS);let MS=class extends La{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const ES=Phaser.GameObjects.NineSlice,_S=Phaser.Utils.Objects.GetValue;class RS extends ES{constructor(t,e){void 0===e&&(e={}),super(t,_S(e,"x",0),_S(e,"y",0),_S(e,"key",null),_S(e,"frame",null),_S(e,"width",0),_S(e,"height",0),_S(e,"leftWidth",0),_S(e,"rightWidth",0),_S(e,"topHeight",0),_S(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=_S(e,"effects",!0);i&&Mn(this,i),this.style=new MS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(RS.prototype,kS),t.register("statesNineSlice",(function(t){var e=new RS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",RS);let LS=class extends La{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const BS=Phaser.Utils.Objects.GetValue;class IS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=BS(e,"effects",!0);i&&Mn(this,i),this.style=new LS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(IS.prototype,kS),t.register("statesNinePatch",(function(t){var e=new IS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",IS);const DS=Phaser.GameObjects.Text,AS=Phaser.Utils.Objects.GetValue;class jS extends DS{constructor(t,e){void 0===e&&(e={}),super(t,AS(e,"x",0),AS(e,"y",0),AS(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(jS.prototype,kS),t.register("statesText",(function(t){var e=new jS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",jS);class zS extends La{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get fontSize(){return this.parent.fontSize}set fontSize(t){this.parent.setFontSize(t)}get tint(){return this.parent.tintTopLeft}set tint(t){this.parent.setTint(t)}get letterSpacing(){return this.parent.letterSpacing}set letterSpacing(t){this.parent.setLetterSpacing(t)}get lineSpacing(){return this.parent.lineSpacing}set lineSpacing(t){this.parent.setLineSpacing(t)}}const FS=Phaser.GameObjects.BitmapText,XS=Phaser.Utils.Objects.GetValue;class YS extends FS{constructor(t,e){void 0===e&&(e={});var i=XS(e,"x",0),s=XS(e,"y",0),r=XS(e,"font",""),n=XS(e,"fontSize",!1),a=XS(e,"align",0),o=XS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=XS(e,"effects",!0);h&&Mn(this,h),this.style=new zS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(YS.prototype,kS),t.register("statesBitmapText",(function(t){var e=new YS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",YS);class WS extends up{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),P(e,"easeValue.duration",e.easeDuration),P(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=VS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const VS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(WS.prototype,kS),t.register("statesBarRectangle",(function(t){var e=new WS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",WS);var GS=function(t,e){void 0===e&&(e={}),void 0===e.options&&(e.options={});var i=e.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var s=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(s=!0,i.animation={});var r=i.animation;s&&(r.duration=0);var n=r.onProgress;r.onProgress=function(e){n&&n(e),t.needRedraw()};var a=r.onComplete;return r.onComplete=function(e){a&&a(e),t.needRedraw()},e};let HS=class extends _u{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.type="rexChart",this.chart=void 0,void 0!==n&&this.setChart(n)}destroy(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),super.destroy(t))}resize(t,e){if(t===this.width&&e===this.height)return this;if(super.resize(t,e),this.chart){var i=this.chart;i.height=this.canvas.height,i.width=this.canvas.width,i.aspectRatio=i.height?i.width/i.height:null,i.update()}return this}};var US={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,GS(this,t)),this):(console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');"),this)},getChartDataset:function(t){if(void 0!==this.chart){if("string"!=typeof t)return this.chart.data.datasets[t];for(var e,i=this.chart.data.datasets,s=0,r=i.length;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return tP(this.sizerChildren,null),Qb.call(this,t),this}},iP={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)tP(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},aP={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Zv.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,tP(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)tP(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},hP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const lP=Phaser.Utils.Objects.IsPlainObject,dP=Phaser.Utils.Objects.GetValue;class cP extends Xb{constructor(t,e,i,s,r,n,a,o,h,l){lP(e)?(e=dP(l=e,"x",0),i=dP(l,"y",0),s=dP(l,"width",void 0),r=dP(l,"height",void 0),n=dP(l,"column",l.col||0),a=dP(l,"row",0),o=dP(l,"columnProportions",0),h=dP(l,"rowProportions",0)):lP(s)?(s=dP(l=s,"width",void 0),r=dP(l,"height",void 0),n=dP(l,"column",l.col||0),a=dP(l,"row",0),o=dP(l,"columnProportions",0),h=dP(l,"rowProportions",0)):lP(n)?(n=dP(l=n,"column",l.col||0),a=dP(l,"row",0),o=dP(l,"columnProportions",0),h=dP(l,"rowProportions",0)):lP(o)&&(o=dP(l=o,"columnProportions",0),h=dP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(dP(l,"createCellContainerCallback")),this.setIndentLeft(dP(l,"space.indentLeftOdd",0),dP(l,"space.indentLeftEven",0)),this.setIndentTop(dP(l,"space.indentTopOdd",0),dP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,dP(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=oP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=hP.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(cP.prototype,aP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new cP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",cP);var uP=function(t,e,i,s){return e/t<=i?e/(s-1):0},pP=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=gP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=gP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const fP=Phaser.Utils.Objects.IsPlainObject,mP=Phaser.Utils.Objects.GetValue,yP=Phaser.Display.Align.CENTER;var bP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(Dv.call(this,t),fP(e)&&(e=mP(h=e,"padding",0),i=mP(h,"key",void 0),s=mP(h,"index",void 0),r=mP(h,"offsetX",0),n=mP(h,"offsetY",0),a=mP(h,"offsetOriginX",0),o=mP(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=yP,h.padding=Bv(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},xP={add(t,e,i){if(Hm(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Qb.call(this,t),this}},wP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const pT=Phaser.Utils.Objects.GetValue,gT=Phaser.Math.Distance.Between;class vT extends La{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=pT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(pT(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(pT(t,"enable",!0)),this.holdThreshold=pT(t,"holdThreshold",50),this.pointerOutReleaseEnable=pT(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return ac(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:gT(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Gm(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Gm(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const fT=Phaser.Utils.Objects.GetValue;class mT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(fT(t,"value",0)),this.setSpeed(fT(t,"speed",0)),this.setAcceleration(fT(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class yT{constructor(){this.value,this.dir,this.movement=new mT}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const kT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},wT=Phaser.Utils.Objects.GetValue;class ST extends La{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=wT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(wT(e,"speed",.1)),this.setEnable(wT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(wT(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Gm(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const PT=Phaser.Utils.Objects.GetValue;var TT=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?PT(s,l,void 0):PT(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Ve(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new cT(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=PT(r,"position",0);"string"==typeof p&&(p=OT[p]);var g,v,f=PT(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=PT(s,"space.slider",void 0))&&(o?f=0:g=PT(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:PT(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:PT(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:PT(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:PT(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=PT(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=PT(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=PT(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=PT(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=PT(s,"scrollDetectionMode");"string"==typeof b&&(b=MT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?PT(s,x,!0):PT(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new CT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=PT(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new ST(h,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(k=a?"t":"s",S=`scroll${i}`):(k="t",S="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(S,t)}))),y&&(o?(w=`childO${i}`,S=`scroll${i}`):(w="childOY",S="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(S,t)}))),C&&(P=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const OT={right:0,left:1,bottom:0,top:1},MT={gameObject:0,rectBounds:1},ET=Phaser.Utils.Objects.GetValue;var _T=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ET(e,"width"),a=ET(e,"height");n||ET(e,"child.expandWidth",!0)||(s[1]=0),a||ET(e,"child.expandHeight",!0)||(r[1]=0);var o=new cP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=AP(i,"child"),r=AP(s,"gameObject",void 0);if(r){var n=AP(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=AP(n,"top",0),a.bottom=AP(n,"bottom",0),o.left=AP(n,"left",0),o.right=AP(n,"right",0);break;case 1:a.top=AP(n,"left",0),a.bottom=AP(n,"right",0),o.top=AP(n,"top",0),o.bottom=AP(n,"bottom",0);break;default:a.top=AP(n,"top",0),a.bottom=AP(n,"bottom",0),a.left=AP(n,"left",0),a.right=AP(n,"right",0)}e.add(r,{column:1,row:1,align:AP(s,"align","center"),padding:o,expand:{width:AP(s,"expandWidth",!0),height:AP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:TT(t,o,"y",e);break;case 1:TT(t,o,"x",e);break;default:TT(t,o,"y",e),TT(t,o,"x",e)}return o},RT=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},LT=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},BT=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},XT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},YT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},WT=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var s=this.lines.getLineStartIndex(t),r=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(s,r,!0)}return e},VT=function(t,e){switch(Uw(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}},GT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&HT.call(this)},HT=function(){if(this.textObject.setCrop){var t,e,i=this.textObject.rexSizer.offsetY;i<=0?(t=-i,e=this.height):(t=0,e=this.height-i),this.textObject.setCrop(0,t,this.width,e)}},UT=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var s=t.style,r=Math.max(e,0);0===this.textObjectType?s.wordWrapWidth=r:(0===s.wrapMode&&(s.wrapMode=1),s.wrapWidth=r);break;case 2:t.setMaxWidth(e)}this.setText()}},NT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=FT(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(XT.call(this,-this.textOY)),0),e=YT.call(this,t)+this.textOY,i=WT.call(this,t);return VT(this.textObject,i),this.textObject.rexSizer.offsetY=e,GT.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,sf.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,UT.call(this,t,n,a),Pv(t,s,r,n,a,e.align),e.preOffsetY=0,GT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const $T=Phaser.Utils.Objects.IsPlainObject,KT=Phaser.Utils.Objects.GetValue,JT=Phaser.Display.Align.TOP_LEFT;class qT extends Xb{constructor(t,e,i,s,r,n){$T(e)?(e=KT(n=e,"x",0),i=KT(n,"y",0),s=KT(n,"width",void 0),r=KT(n,"height",void 0)):$T(s)&&(s=KT(n=s,"width",void 0),r=KT(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=KT(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(KT(n,"clampTextOY",!0)),this.alwaysScrollable=KT(n,"alwaysScrollable",!1);var a=KT(n,"background",void 0),o=KT(n,"text",void 0);void 0===o&&(o=ZT(t)),this.textCropEnable=KT(n,"textCrop",!!o.setCrop);var h=KT(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=JT,l.padding=Bv(0),l.expand=!0,this.textObject=o,this.textObjectType=Uw(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Yw.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(XT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=YT.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var ZT=function(t){return t.add.text(0,0,"")};Object.assign(qT.prototype,NT);var QT={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},tO={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const eO=Phaser.Utils.Objects.GetValue;class iO extends jT{constructor(t,e){void 0===e&&(e={});var i=eO(e,"text",void 0),s=eO(e,"textWidth",void 0),r=eO(e,"textHeight",void 0),n=eO(e,"textCrop",!!i.setCrop),a=eO(e,"textMask",!n),o=eO(e,"content",""),h=new qT(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:eO(e,"clampChildOY",!1),alwaysScrollable:eO(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=eO(e,"space",void 0);l&&(l.child=eO(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(iO.prototype,QT,tO);const sO=Phaser.Utils.Objects.GetValue;var rO=function(t,e,s){e=e?i(e):{};var r=sO(s,"background",LP),n=sO(s,"text",nO),a=sO(s,"track",LP),o=sO(s,"thumb",LP);r?e.background=r(t,e.background):delete e.background,n?e.text=n(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),a?h.track=a(t,h.track):delete h.track,o?h.thumb=o(t,h.thumb):delete h.thumb,e.slider=h);var l=new iO(t,e);return t.add.existing(l),l},nO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new YS(t,e);break;case"bbcodetext":case"bbcode":s=new ds(t,0,0,"",e);break;case"label":s=new lO(t,e);break;case"textarea":s=rO(t,e);break;default:s=new jS(t,e)}return RP(s,e),t.add.existing(s),s},aO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new IS(t,e):new RS(t,e);break;case"roundRectangle":s=new TS(t,e);break;default:s=new PS(t,e)}return RP(s,e),t.add.existing(s),s};const oO=Phaser.Utils.Objects.GetValue;var hO=function(t,e,s){e=e?i(e):{};var r=oO(s,"background",LP),n=oO(s,"text",nO),a=oO(s,"icon",aO),o=oO(s,"action",aO);return null!==e.background&&r?e.background=r(t,e.background):delete e.background,null!==e.text&&n?e.text=n(t,e.text):delete e.text,null!==e.icon&&a?e.icon=a(t,e.icon):delete e.icon,null!==e.action&&o?e.action=o(t,e.action):delete e.action,e};class lO extends nS{constructor(t,e,i){super(t,e=hO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return dO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return dO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return dO(this.getChildren(),"setDisableState",t),this}}var dO=function(t,e,i){for(var s=0,r=t.length;sthis.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=MO(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(Hm(s)||(s=Dc(BO,i,1)),MO(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=DO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=IO[t]),this.timeUnit=t,this}}var BO=[];const IO={ms:0,s:1,sec:1},DO={abs:0,absolute:0,inc:1,increment:1};var AO=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,h).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},jO={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const zO=Phaser.Utils.Objects.GetValue;class FO extends TO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(zO(e,"easeDuration",1e3)),this.levelCounter=new OO(zO(e,"levelCounter")),this.player=new LO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",AO,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}Object.assign(FO.prototype,jO),t.register("expBar",(function(t){var e=new FO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",FO);const XO=jw.prototype.add,YO=jw.prototype.addSpace;var WO=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&YO.call(this),XO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&YO.call(this),this.hasTailSpace=s}else XO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;XO.call(this,t,{index:r,proportion:i,expand:!0})}else XO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},VO={addButton(t){if(Hm(t))for(var e=t,i=0,s=e.length;i=0;i--)UO.call(this,e[i],t);return this}},$O=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},KO=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,$O.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},JO={add(t){return this.buttons.push(t),t._click||(t._click=new du(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),KO.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)uM.call(this,e[i],t);return this}};const gM=Phaser.Utils.Objects.GetValue;class vM extends cP{constructor(t,e){void 0===e&&(e={});var i=gM(e,"row",0),s=gM(e,"column",e.col||0),r=gM(e,"createCellContainerCallback"),n=gM(e,"buttons",void 0),a=gM(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;hr&&fM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)CM.call(this,e[i],t);return this}};const wM=Phaser.Utils.Objects.GetValue;class SM extends MP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new sM({parent:this,eventEmitter:wM(e,"eventEmitter",this),groupName:wM(e,"groupName",void 0),clickConfig:wM(e,"click",void 0)}).setButtonsType(e);var s=wM(e,"background",void 0),r=wM(e,"buttons",void 0);this.buttonsAlign=wM(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(SM.prototype,yM,kM,iM,nM),t.register("fixWidthButtons",(function(t){var e=new SM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",SM);var PM={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const TM=Phaser.Utils.Objects.GetValue;class OM extends nS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new aw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(TM(e,"accept","")),this.setMultiple(TM(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}Object.assign(OM.prototype,PM),t.register("fileSelectorButton",(function(t){var e=new OM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",OM);var MM={getChoice(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable(t){var e=this.childrenMap.choicesSizer;return!!e&&e.getButtonEnable(t)},getActionEnable(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this},hasAnyChoice(){var t=this.childrenMap.choicesSizer;return!!t&&t.hasAnyButton()},hasAnyAction(){var t=this.childrenMap.actionsSizer;return!!t&&t.hasAnyButton()},hasAnyToolbar(){var t=this.childrenMap.toolbarSizer;return!!t&&t.hasAnyButton()},hasAnyLeftToolbar(){var t=this.childrenMap.leftToolbarSizer;return!!t&&t.hasAnyButton()}},EM={onCreateModalBehavior(t){t.on("button.click",(function(e,i,s,r,n){var a=!1;switch(i){case"actions":a=!0;break;case"choices":t.hasAnyAction()||(a=!0)}if(a){var o={index:s,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0}t.modalClose(o)}}))},modal(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,Fm.modal.call(this,t,e),this}},_M={};Object.assign(_M,MM,EM);const RM=Phaser.Utils.Objects.GetValue;class LM extends jw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=RM(e,"eventEmitter",this);var i,s,r,n,a=RM(e,"background",void 0),o=RM(e,"title",void 0),h=RM(e,"toolbar",void 0),l=RM(e,"toolbarBackground",void 0),d=RM(e,"leftToolbar",void 0),c=RM(e,"leftToolbarBackground",void 0),u=RM(e,"content",void 0),p=RM(e,"description",void 0),g=RM(e,"choices",void 0),v=RM(e,"choicesBackground",void 0),f=RM(e,"actions",void 0),m=RM(e,"actionsBackground",void 0),y=RM(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new oM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:RM(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new oM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:RM(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&RM(e,"expand.title",!0),C=RM(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new jw(t,{orientation:0}):new nx(t),t.add.existing(b);var w=!!k||{height:!0};if(n&&b.add(n,{align:"left",expand:w}),o){k&&!x&&"right"===C&&b.addSpace();var S={left:RM(e,"space.titleLeft",0),right:RM(e,"space.titleRight",0)},P=x?1:0;b.add(o,{align:C,proportion:P,expand:w,padding:S}),k&&!x&&"left"===C&&b.addSpace()}r&&(k&&!o&&b.addSpace(),b.add(r,{align:"right",expand:w})),(u||p||g||f)&&(S={bottom:RM(e,"space.title",0),top:RM(e,"space.titleTop",0)}),P=RM(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=RM(e,"align.content","center"),O=RM(e,"space.content",0),M=(S={left:RM(e,"space.contentLeft",0),right:RM(e,"space.contentRight",0),bottom:p||g||f?O:0},P=RM(e,"proportion.content",0),RM(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=RM(e,"align.description","center");var E=RM(e,"space.description",0);S={left:RM(e,"space.descriptionLeft",0),right:RM(e,"space.descriptionRight",0),bottom:g||f?E:0},P=RM(e,"proportion.description",0),M=RM(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=RM(e,"choicesType","").split("-"),R=BM(_,"wrap")?SM:BM(_,"grid")?vM:oM,L=BM(_,"radio")?"radio":BM(_,"checkboxes")?"checkboxes":void 0,B={left:RM(e,"space.choicesBackgroundLeft",0),right:RM(e,"space.choicesBackgroundRight",0),top:RM(e,"space.choicesBackgroundTop",0),bottom:RM(e,"space.choicesBackgroundBottom",0)},I=RM(e,"space.choice",0);R===oM?B.item=I:R===SM?(B.item=I,B.line=RM(e,"space.choiceLine",I)):(B.column=RM(e,"space.choiceColumn",I),B.row=RM(e,"space.choiceRow",I));var D={width:RM(e,"choicesWidth",void 0),height:RM(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:RM(e,"choicesSetValueCallback",void 0),setValueCallbackScope:RM(e,"choicesSetValueCallbackScope",void 0)};R===oM&&(D.orientation=BM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var A=RM(e,"space.choices",0);S={left:RM(e,"space.choicesLeft",0),right:RM(e,"space.choicesRight",0),bottom:f?A:0},T=RM(e,"align.choices","center"),P=RM(e,"proportion.choices",0),M=RM(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new oM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:RM(e,"space.action",0)},expand:RM(e,"expand.actions",!1),align:RM(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:RM(e,"space.actionsLeft",0),right:RM(e,"space.actionsRight",0),bottom:RM(e,"space.actionsBottom",0)},P=RM(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),DM(this,"click"),DM(this,"over"),DM(this,"out"),DM(this,"enable"),DM(this,"disable"),this.addChildrenMap("background",a),this.addChildrenMap("title",o),this.addChildrenMap("toolbar",h),this.addChildrenMap("leftToolbar",d),this.addChildrenMap("content",u),this.addChildrenMap("description",p),this.addChildrenMap("choices",i?i.buttons:void 0),this.addChildrenMap("actions",s?s.buttons:void 0),this.addChildrenMap("choicesSizer",i),this.addChildrenMap("actionsSizer",s),this.addChildrenMap("toolbarSizer",r),this.addChildrenMap("leftToolbarSizer",n)}}var BM=function(t,e){return-1!==t.indexOf(e)},IM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},DM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){IM.hasOwnProperty(s)&&t.emit(`${IM[s]}.${e}`,i,r,n,a)}))};Object.assign(LM.prototype,_M),t.register("dialog",(function(t){var e=new LM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",LM);var AM=function(t,e,i){var s=new lO(t,e,i);return t.add.existing(s),s},jM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},zM=function(t){var e=this.childrenMap.content;if(null===(t=t.content))e.hide();else if(e.show(),e.resetDisplayContent)e.resetDisplayContent(t);else{var i=t||"";e.setText(i)}},FM=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var s=this.scene,r=this.defaultActionConfig,n=this.defaultActionButtonCreator,a=0,o=i.length;a=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var a=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=NE(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;sthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(X_.prototype,A_);const Y_=["top","bottom","centerY","center"],W_=["left","right","centerX","center"];var V_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Y_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=W_.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const G_=Phaser.Utils.Objects.GetValue;class H_ extends jT{constructor(t,e){void 0===e&&(e={});var i=IP(e),s=G_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=G_(e,"clampChildOY",!1),s.clampChildOX=G_(e,"clampChildOX",!1);var r,n,a=new X_(t,s);switch(t.add.existing(a),i){case 0:r=G_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=G_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:G_(e,"align.panel","center")};var o=G_(e,"space",void 0);o&&(o.child=G_(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),jb(this.childrenMap.child,t),this}}var U_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:V_.call(this,t,"y",e);break;case 1:V_.call(this,t,"x",e);break;default:V_.call(this,t,"y",e),V_.call(this,t,"x",e)}return this}};Object.assign(H_.prototype,U_);const N_=Phaser.Utils.Objects.GetValue;var $_=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=K_(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=J_(e,this.listCreateSliderTrackCallback),g=J_(e,this.listCreateSliderThumbCallback);d=new H_(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:N_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=K_(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},K_=function(t,e,i){var s;return i?(e.orientation="x",s=new SM(t,e)):(e.orientation="y",s=new oM(t,e)),t.add.existing(s),s},J_=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const q_=Phaser.Utils.Objects.GetValue;var Z_=function(t,e){var i=q_(e,"expandDirection",void 0);"string"==typeof i&&(i=Q_[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Od(s=e,r="alignTarget")?J(s,r):n&&Od(s,n)?J(s,n):a&&Od(s,a)?J(s,a):o),c=q_(e,"alignTargetY",d),u=q_(e,"alignOffsetX",0),p=q_(e,"alignOffsetY",0),g=q_(e,"alignSide","").includes("right"),v=q_(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=oa(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Q_={down:0,up:1},tR=Phaser.Utils.Objects.GetValue;class eR extends Cm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){yf(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new ff(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Z_(t,e),t.isRexSizer&&t.layout();var i=tR(e,"touchOutsideClose",!1),s=tR(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Lm(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var iR={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},sR={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=$_.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new eR(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(sR,I_,iR);const rR=Phaser.Utils.Objects.GetValue;class nR extends nS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(rR(e,"options"));var i=rR(e,"list");this.setWrapEnable(rR(i,"wrap",!1)),this.setCreateButtonCallback(rR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(rR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(rR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(rR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(rR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(rR(i,"scroller")),this.setListMouseWheelScrollerConfig(rR(i,"mouseWheelScroller")),this.setButtonClickCallback(rR(i,"onButtonClick")),this.setButtonOverCallback(rR(i,"onButtonOver")),this.setButtonOutCallback(rR(i,"onButtonOut")),this.setListExpandDirection(rR(i,"expandDirection")),this.setListEaseInDuration(rR(i,"easeIn",500)),this.setListEaseOutDuration(rR(i,"easeOut",100)),this.setListTransitInCallback(rR(i,"transitIn")),this.settListTransitOutCallback(rR(i,"transitOut")),this.setListMaxHeight(rR(i,"maxHeight",0)),this.setListSize(rR(i,"width"),rR(i,"height",0)),this.setListAlignmentMode(rR(i,"alignParent","text")),this.setListAlignmentSide(rR(i,"alignSide","")),this.setListBounds(rR(i,"bounds")),this.setListSpace(rR(i,"space")),this.setListDraggable(rR(i,"draggable",!1)),this.setValueChangeCallback(rR(e,"setValueCallback"),rR(e,"setValueCallbackScope")),this.setValue(rR(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(nR.prototype,sR),t.register("dropDownList",(function(t){var e=new nR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",nR);var aR=function(t,e,s){void 0===s&&(s={});var r=(e=e?i(e):{}).label||e.button,n=e.button||e.label;delete e.label,delete e.button;var a=s.label||s.button||s,o=s.button||s.label||s,h=hO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=AM(t,n,o).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var l=e.track;l&&(h.list.createTrackCallback=function(t){return LP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return LP(t,d)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h};class oR extends nR{constructor(t,e,i){super(t,e=aR(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(uR,hR,dR,cR);const pR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class gR extends La{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Uw(this.parent),this.pageStartIndexes=[],this.lines=FT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(pR(t,"maxLines",void 0)),this.setPageBreak(pR(t,"pageBreak","\f\n")),this.setText(pR(t,"text","")),this.startLineIndex=pR(t,"start",-1),this.endLineIndex=pR(t,"end",void 0);var e=pR(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Uw(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(gR.prototype,uR);var vR={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?VT(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(je(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},fR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},mR=function(t,e){for(var i=void 0,s=0;s0?yR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=yR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},xR={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=fR(this.parent,t);n=mR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)bR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(xR,vR);const CR=Phaser.Utils.Objects.GetFastValue,kR=Phaser.Utils.Objects.GetValue;class wR extends La{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(kR(t,"wrap",!1)),this.setTypeMode(kR(t,"typeMode",0)),this.setTypingSpeed(kR(t,"speed",333)),this.setTextCallback=CR(t,"setTextCallback",null),this.setTextCallbackScope=CR(t,"setTextCallbackScope",null),this.setTypingContent(CR(t,"text","")),this.typingIndex=CR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=CR(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=SR[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=je(t);this.textWrapEnable&&(e=function(t,e){switch(Uw(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=fR(this.parent,this.text).length,this}onTyping(){var t=bR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?VT(this.parent,t):this.parent.setText(t)}}const SR={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(wR.prototype,xR);const PR=Phaser.Utils.Objects.GetValue,TR={page:0,line:1};class OR extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=PR(i,"expandTextWidth",!1),n=PR(i,"expandTextHeight",!1);if(r||n){var a=Uw(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(PR(i,"typingMode","page")),this.page=new gR(s,PR(i,"page",void 0)),this.typing=new wR(s,PR(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=TR[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(vO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new OR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",OR);class MR extends OR{constructor(t,e,i){super(t,e=mO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new MR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",MR);const ER=Phaser.Utils.Objects.GetValue;class _R extends jw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=ER(e,"background",void 0),a=ER(e,"icon",void 0),o=ER(e,"iconMask",void 0),h=ER(e,"slider",void 0),l=ER(e,"text",void 0),d=ER(e,"space.icon",0),c=ER(e,"space.slider",0);(n&&this.addBackground(n),a&&(0===this.orientation?(h||l)&&(s={right:d}):(h||l)&&(s={bottom:d}),this.add(a,{proportion:0,align:"center",padding:s}),o&&(o=Yw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new oT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===ER(h,"width",void 0)?1:0:void 0===ER(h,"height",void 0)?1:0,this.add(i,{proportion:r,align:"center",padding:s}));l&&this.add(l),this.addChildrenMap("background",n),this.addChildrenMap("icon",a),this.addChildrenMap("iconMask",o),this.addChildrenMap("slider",i),this.addChildrenMap("text",l);var u=ER(e,"valuechangeCallback",null);if(null!==u){var p=ER(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(ER(e,"enable",void 0)),this.setValue(ER(e,"value",0))}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}get text(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")}set text(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t))}setText(t){return this.text=t,this}}t.register("numberBar",(function(t){var e=new _R(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",_R),t.register("scrollBar",(function(t){var e=new cT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",cT);const RR=Phaser.Utils.Objects.GetValue,LR={leftTop:"left-top",centerTop:"center-top",rightTop:"right-top",leftCenter:"left-center",center:"center",rightCenter:"right-center",leftBottom:"left-bottom",centerBottom:"center-bottom",rightBottom:"right-bottom"};class BR extends nx{constructor(t,e){super(t,e),this.type="rexBadge";var i=RR(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=RR(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),LR){var n=RR(e,r,void 0);n&&(this.add(n,{key:r,align:LR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new BR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",BR);const IR=nx.prototype.add;var DR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),IR.call(this,t,e,i,s,r,n,a,o,h),this},AR={add:DR,addPage:DR};const jR=Zg.prototype.setChildVisible;var zR={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(jR.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(jR.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(zR,AR);const FR=Phaser.Utils.Objects.GetValue;class XR extends nx{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(FR(e,"swapMode",0)),this.setFadeInDuration(FR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=YR[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(XR.prototype,zR);const YR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new XR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",XR);const WR=Phaser.GameObjects.Mesh;class VR extends WR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const GR=Phaser.Math.Vector3,HR=Phaser.Math.Matrix4;var UR=new GR,NR=new GR,$R=new HR;const KR=Phaser.Utils.Objects.IsPlainObject,JR=Phaser.Utils.Objects.GetValue,qR=Phaser.Geom.Mesh.GenerateGridVerts,ZR=Phaser.Math.RadToDeg,QR=Phaser.Math.DegToRad,tL=1+1/Math.sin(QR(45));let eL=class extends VR{constructor(t,e,i,s,r,n){KR(e)&&(e=JR(n=e,"x",0),i=JR(n,"y",0),s=JR(n,"key",null),r=JR(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(tL),this.hideCCW=JR(n,"hideCCW",!0);var a=JR(n,"gridWidth",0),o=JR(n,"gridHeight",a);this.resetVerts(a,o),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(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,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,qR({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return ZR(this.rotationX)}set angleX(t){this.rotationX=QR(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return ZR(this.rotationY)}set angleY(t){this.rotationY=QR(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return ZR(this.rotationZ)}set angleZ(t){this.rotationZ=QR(t)}transformVerts(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=r,this.transformInfo.rotateZ=n,function(t,e,i,s,r,n,a){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),UR.set(e,i,s),NR.set(r,n,a),$R.fromRotationXYTranslation(NR,UR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},YL={top:1,left:3,right:5,bottom:7},WL={top:"bottom",left:"right",right:"left",bottom:"top"},VL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},GL={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i=a.y)continue;break;case 2:if(n.x<=a.x)continue;break;case 3:if(n.x>=a.x)continue}HB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},$B={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(VB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;GB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return NB(this,e,this.transitInTime),this},removeMessage(t){if(this.getParentSizer(t)!==this)return this;if(!t.__isDestroying){t.__isDestroying=!0;var e=this.transitOutTime;return this.transitOutCallback(t,e,this),GB.call(t,e+10,(function(){delete t.__isDestroying,t.destroy()})),this}},removeAllMessages(){for(var t=this.childrenMap.items,e=0,i=t.length;e0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new VI(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a},HI={openColorPicker:function(){if(!this.colorPicker){var t=GI.call(this).layout(),e=new eR(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(HI,uI);const UI=Phaser.Utils.Objects.GetValue;class NI extends cI{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(UI(i,"width",160),UI(i,"height",170));var n=UI(i,"background");r=n?function(t){return LP(t,n)}:UI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(UI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(UI(i,"expandDirection")),this.setColorPickerEaseInDuration(UI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(UI(i,"easeOut",200)),this.setColorPickerTransitInCallback(UI(i,"transitIn")),this.setColorPickerTransitOutCallback(UI(i,"transitOut")),this.setColorPickerBounds(UI(i,"bounds"));var a=UI(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(UI(o,"height",30)),this.setColorComponentsFormatLabelConfig(UI(o,"formatLabel"));var h=UI(o,"inputText");h||(h=UI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=UI(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(NI.prototype,HI),t.register("colorInput",(function(t){var e=new NI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",NI),t.register("colorInputLite",(function(t){var e=new cI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",cI),t.register("colorPicker",(function(t){var e=new II(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",II),t.register("colorComponents",(function(t){var e=new YI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",YI);var $I=function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&b0&&x * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var yD=function(t,e){var i=Ve(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},bD=function(t,e,i){return RP(t,yD(e,i))},xD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},CD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class kD extends QL{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(kD.prototype,xD,CD);const wD=Phaser.Utils.Objects.GetValue,SD=Phaser.Utils.Objects.GetValue;var PD={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const zD=Phaser.Utils.Objects.GetValue;class FD extends Aw{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=zD(e,"background",void 0),s=zD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:zD(e,"space.title",0)}});var r=zD(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(FD.prototype,AD,jD);const YD=Phaser.Utils.Objects.GetValue,XD=Phaser.Utils.Objects.GetValue;var WD={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},VD={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class GD extends G_{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(GD.prototype,WD,VD);const HD=Phaser.Utils.Objects.GetValue,UD=Phaser.Utils.Objects.GetValue,ND=Phaser.Utils.Objects.GetValue;var $D={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=ND(t,"onGetValue"),this.onSetValue=ND(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},KD={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},JD={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const qD=Phaser.Utils.Objects.GetValue;class ZD extends Aw{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=qD(e,"proportion.title",0),o=qD(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=qD(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(ZD.prototype,$D,KD,JD);var QD=function(t,e,i){var s=new fD(t,i);return t.add.existing(s),s},tA=function(t){return void 0===t&&(t=Aw),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},eA=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=oA(this.styles,"inputRow")||{},r=aA(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return RP(t,yD(e,i))}(this.scene,t,hA(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,s){return"boolean"==typeof e&&(s=e,e=void 0),void 0===s&&(s=!0),lA(this,i(t),e,s),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=aE(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},gA={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var s=t.scene;this.type="rexTweaker.TextAreaInput";var r=e.inputTextArea;void 0===r&&(r={}),r.hasOwnProperty("text")||(r.text=e.inputText),r.hasOwnProperty("slider")||(r.slider=e.slider);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new _B(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"inputText"}),n.on("close",(function(){t.setValue(n.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},vA={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=aE(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const fA=Phaser.Utils.Objects.GetValue,mA=Phaser.Math.Linear,yA=Phaser.Math.Snap.Floor;var bA={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=fA(s,r),a=function(t,e){var i=new aT(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=fA(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=aE(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=fA(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=mA(t.minValue,t.maxValue,a.value);t.step&&(e=yA(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},xA=function(t,e){var i=new aM(t,e);return t.add.existing(i),i};const CA=Phaser.Utils.Objects.GetValue;var kA={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=CA(e,"incDec")||{},n={text:null,action:null},a=xA(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=aE(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=DM(s,d),u=Object.assign(i(n),r.decButton||{}),p=DM(s,u);a.addButton(c),a.addButton(p);var g=r.inputTextIndex||0;a.insert(g,l,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,a.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ColorInput";var r=e.colorInput;void 0===r&&(r={}),r.hasOwnProperty("inputText")||(r.inputText=e.inputText);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new UI(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"colorInput"}),n.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},SA={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new pu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},PA={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new Ou(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},TA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=function(t,e){e=nR(t,e);var i=new rR(t,e);return t.add.existing(i),i}(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=TA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const MA=Phaser.Utils.Objects.GetValue;var EA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ButtonsInput";var r=e.button?i(e.button):{},n=MA(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=xA(s,{expand:n});a.buttonConfig=r,t.add(a,{proportion:1,expand:!0,key:"list"}),a.on("button.click",(function(e,i,s,r){var n=a.options[i];n&&(t._selectedIndex=i,t.setValue(n.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;nr?n:-n),d.localY=u+(c>s?a:-a)}};const tj=Phaser.Utils.Objects.IsPlainObject,ej=Phaser.Utils.Objects.GetValue,ij=Phaser.Math.DegToRad,sj=Phaser.Math.RadToDeg;class rj extends ZA{constructor(t,e,i,s,r){if(tj(e)){var n=e;e=ej(n,"x",0),i=ej(n,"y",0),s=ej(n,"key",null),r=ej(n,"frame",null)}super(t,e,i,s,r),this.type="rexSkewmage",this._skewX=0,this._skewY=0}get skewX(){return this._skewX}set skewX(t){this._skewX=t,QA(this,this._skewX,this._skewY)}get skewXDeg(){return sj(this._skewX)}set skewXDeg(t){this.skewX=ij(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,QA(this,this._skewX,this._skewY)}get skewYDeg(){return sj(this._skewY)}set skewYDeg(t){this.skewY=ij(t)}setSkewX(t){return this.skewX=t,this}setSkewY(t){return this.skewY=t,this}setSkew(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}setSkewXDeg(t){return this.skewXDeg=t,this}setSkewYDeg(t){return this.skewYDeg=t,this}setSkewDeg(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}const nj=Phaser.Utils.Objects.IsPlainObject,aj=Phaser.Utils.Objects.GetValue;class oj extends rj{constructor(t,e,i,s,r){if(nj(e)){var n=e;e=aj(n,"x",0),i=aj(n,"y",0),s=aj(n,"width",32),r=aj(n,"height",32)}super(t,e,i,iL(t,s,r),null),this.type="rexSkewRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}}class hj extends(OL(oj)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new hj(t,e)})),P(window,"RexPlugins.UI.Skew",hj),t.register("anchor",(function(t,e){return new cf(t,e)})),P(window,"RexPlugins.UI.Anchor",cf),t.register("textTyping",(function(t,e){return new kR(t,e)})),P(window,"RexPlugins.UI.TextTyping",kR),t.register("textPage",(function(t,e){return new pR(t,e)})),P(window,"RexPlugins.UI.TextPage",pR);var lj=void 0;const dj=Phaser.Utils.Objects.GetValue,cj=Phaser.Utils.Objects.Clone;var uj=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const pj=Phaser.Utils.Objects.GetValue,gj=Phaser.Utils.Objects.Merge;var vj={open:function(t,e){var i;void 0===t&&(t={}),t=gj(t,this.openConfig),(i=this)!==lj&&(void 0!==lj&&lj.close(),lj=i),jm(t)&&(e=t,t=void 0);var s=pj(t,"inputType",void 0);void 0===s&&(s=pj(t,"type","text")),void 0===e&&(e=pj(t,"onClose",void 0));var r=pj(t,"onOpen",void 0),n=pj(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=cj(e);var i=t.scene,s=t.style,r=dj(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=dj(e,"text",t.text),e.fontFamily=dj(e,"fontFamily",s.fontFamily),e.fontSize=dj(e,"fontSize",s.fontSize),e.color=dj(e,"color",s.color),e.backgroundColor=r,e.direction=dj(e,"rtl",s.rtl)?"rtl":"ltr",e.align=dj(e,"align",uj(s)),"rtl"===e.direction&&Ww(t)&&(e.align="right");var n=t.padding;n.left>0&&(e.paddingLeft=`${n.left}px`),n.right>0&&(e.paddingRight=`${n.right}px`),s.backgroundCornerRadius&&(e.borderRadius=dj(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new Hk(i,t.x,t.y,dj(e,"width",t.width),dj(e,"height",t.height),e);a.setScale(t.scaleX,t.scaleY).setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(a):i.add.existing(a),a}(this.parent,t).on("textchange",(function(t){var e=t.text;n?n(this.parent,e):this.parent.text=e}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,pj(t,"enterClose","textarea"!==s)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=function(t,e,i){return t.time.delayedCall(0,e,[],i)}(this.scene,(function(){this.scene.input.once("pointerdown",this.close,this),r&&r(this.parent),this.emit("open",this.parent)}),this),this},close:function(){return this===lj&&(lj=void 0),this.parent.setVisible(!0),this.inputText&&(this.inputText.destroy(),this.inputText=void 0),this.delayCall&&(this.delayCall.remove(),this.delayCall=void 0),this.scene.input.keyboard.off("keydown-ENTER",this.close,this),this.scene.input.off("pointerdown",this.close,this),this.onClose&&this.onClose(this.parent),this.emit("close",this.parent),this}};const fj=Phaser.Utils.Objects.GetValue;class mj extends La{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),fj(e,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open()}),this).setInteractive()}shutdown(t){this.isShutdown||(this.close(),super.shutdown(t))}setOpenConfig(t){return void 0===t&&(t={}),this.openConfig=t,this}get isOpened(){return void 0!==this.inputText}get text(){return this.isOpened?this.inputText.text:this.parent.text}}Object.assign(mj.prototype,vj),t.register("textEdit",(function(t,e){return new mj(t,e)})),P(window,"RexPlugins.UI.TextEdit",mj),t.register("layerManager",(function(t){return new Ma(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",Ma);class yj extends Phaser.Plugins.ScenePlugin{constructor(e,i){super(e,i),this.add=new t(e)}boot(){this.scene.events.on("destroy",this.destroy,this)}destroy(){this.add.destroy(),super.destroy()}isInTouching(t,e,i,s){return!!t.visible&&Vm(t,e,i,s)}get viewport(){return oa(this.scene,this.scene.cameras.main,!0)}}var bj={getParentSizer:Zp,getTopmostSizer:Qp,removeFromParent:dE,hide:rm,show:sm,isShown:nm,confirmAction:QM,edit:function(t,e,i){return t._edit||(t._edit=new mj(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:Kw,fontSizeExpandText:iS,fontSizeResize:qw,setFontSizeToFitWidth:qw,waitEvent:nl,waitComplete:al,delayPromise:$k,setChildrenInteractive:Ab,fadeIn:Mf,fadeOutDestroy:Ef,easeMoveTo:Ff,easeMoveFrom:Yf,modal:Dm,modalPromise:function(t,e){var i=Dm(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:Am,requestDrag:NI,openFileChooser:Zk};return Object.assign(yj.prototype,bj),yj},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e(); + */var bD=function(t,e){var i=Ve(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},xD=function(t,e,i){return LP(t,bD(e,i))},CD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},kD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class wD extends tB{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(wD.prototype,CD,kD);const SD=Phaser.Utils.Objects.GetValue,PD=Phaser.Utils.Objects.GetValue;var TD={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const FD=Phaser.Utils.Objects.GetValue;class XD extends jw{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=FD(e,"background",void 0),s=FD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:FD(e,"space.title",0)}});var r=FD(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(XD.prototype,jD,zD);const YD=Phaser.Utils.Objects.GetValue,WD=Phaser.Utils.Objects.GetValue;var VD={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},GD={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class HD extends H_{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(HD.prototype,VD,GD);const UD=Phaser.Utils.Objects.GetValue,ND=Phaser.Utils.Objects.GetValue,$D=Phaser.Utils.Objects.GetValue;var KD={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=$D(t,"onGetValue"),this.onSetValue=$D(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},JD={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},qD={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const ZD=Phaser.Utils.Objects.GetValue;class QD extends jw{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=ZD(e,"proportion.title",0),o=ZD(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=ZD(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(QD.prototype,KD,JD,qD);var tA=function(t,e,i){var s=new mD(t,i);return t.add.existing(s),s},eA=function(t){return void 0===t&&(t=jw),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},iA=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=hA(this.styles,"inputRow")||{},r=oA(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return LP(t,bD(e,i))}(this.scene,t,lA(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,s){return"boolean"==typeof e&&(s=e,e=void 0),void 0===s&&(s=!0),dA(this,i(t),e,s),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=oE(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},vA={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var s=t.scene;this.type="rexTweaker.TextAreaInput";var r=e.inputTextArea;void 0===r&&(r={}),r.hasOwnProperty("text")||(r.text=e.inputText),r.hasOwnProperty("slider")||(r.slider=e.slider);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new RB(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"inputText"}),n.on("close",(function(){t.setValue(n.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},fA={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=oE(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const mA=Phaser.Utils.Objects.GetValue,yA=Phaser.Math.Linear,bA=Phaser.Math.Snap.Floor;var xA={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=mA(s,r),a=function(t,e){var i=new oT(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=mA(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=oE(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=mA(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=yA(t.minValue,t.maxValue,a.value);t.step&&(e=bA(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},CA=function(t,e){var i=new oM(t,e);return t.add.existing(i),i};const kA=Phaser.Utils.Objects.GetValue;var wA={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=kA(e,"incDec")||{},n={text:null,action:null},a=CA(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=oE(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=AM(s,d),u=Object.assign(i(n),r.decButton||{}),p=AM(s,u);a.addButton(c),a.addButton(p);var g=r.inputTextIndex||0;a.insert(g,l,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,a.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ColorInput";var r=e.colorInput;void 0===r&&(r={}),r.hasOwnProperty("inputText")||(r.inputText=e.inputText);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new NI(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"colorInput"}),n.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},PA={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new gu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},TA={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new Mu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},OA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=function(t,e){e=aR(t,e);var i=new nR(t,e);return t.add.existing(i),i}(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=OA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const EA=Phaser.Utils.Objects.GetValue;var _A={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ButtonsInput";var r=e.button?i(e.button):{},n=EA(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=CA(s,{expand:n});a.buttonConfig=r,t.add(a,{proportion:1,expand:!0,key:"list"}),a.on("button.click",(function(e,i,s,r){var n=a.options[i];n&&(t._selectedIndex=i,t.setValue(n.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;nr?n:-n),d.localY=u+(c>s?a:-a)}};const ej=Phaser.Utils.Objects.IsPlainObject,ij=Phaser.Utils.Objects.GetValue,sj=Phaser.Math.DegToRad,rj=Phaser.Math.RadToDeg;class nj extends QA{constructor(t,e,i,s,r){if(ej(e)){var n=e;e=ij(n,"x",0),i=ij(n,"y",0),s=ij(n,"key",null),r=ij(n,"frame",null)}super(t,e,i,s,r),this.type="rexSkewmage",this._skewX=0,this._skewY=0}get skewX(){return this._skewX}set skewX(t){this._skewX=t,tj(this,this._skewX,this._skewY)}get skewXDeg(){return rj(this._skewX)}set skewXDeg(t){this.skewX=sj(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,tj(this,this._skewX,this._skewY)}get skewYDeg(){return rj(this._skewY)}set skewYDeg(t){this.skewY=sj(t)}setSkewX(t){return this.skewX=t,this}setSkewY(t){return this.skewY=t,this}setSkew(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}setSkewXDeg(t){return this.skewXDeg=t,this}setSkewYDeg(t){return this.skewYDeg=t,this}setSkewDeg(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}const aj=Phaser.Utils.Objects.IsPlainObject,oj=Phaser.Utils.Objects.GetValue;class hj extends nj{constructor(t,e,i,s,r){if(aj(e)){var n=e;e=oj(n,"x",0),i=oj(n,"y",0),s=oj(n,"width",32),r=oj(n,"height",32)}super(t,e,i,sL(t,s,r),null),this.type="rexSkewRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}}class lj extends(ML(hj)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new lj(t,e)})),P(window,"RexPlugins.UI.Skew",lj),t.register("anchor",(function(t,e){return new uf(t,e)})),P(window,"RexPlugins.UI.Anchor",uf),t.register("textTyping",(function(t,e){return new wR(t,e)})),P(window,"RexPlugins.UI.TextTyping",wR),t.register("textPage",(function(t,e){return new gR(t,e)})),P(window,"RexPlugins.UI.TextPage",gR);var dj=void 0;const cj=Phaser.Utils.Objects.GetValue,uj=Phaser.Utils.Objects.Clone;var pj=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const gj=Phaser.Utils.Objects.GetValue,vj=Phaser.Utils.Objects.Merge;var fj={open:function(t,e){var i;void 0===t&&(t={}),t=vj(t,this.openConfig),(i=this)!==dj&&(void 0!==dj&&dj.close(),dj=i),zm(t)&&(e=t,t=void 0);var s=gj(t,"inputType",void 0);void 0===s&&(s=gj(t,"type","text")),void 0===e&&(e=gj(t,"onClose",void 0));var r=gj(t,"onOpen",void 0),n=gj(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=uj(e);var i=t.scene,s=t.style,r=cj(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=cj(e,"text",t.text),e.fontFamily=cj(e,"fontFamily",s.fontFamily),e.fontSize=cj(e,"fontSize",s.fontSize),e.color=cj(e,"color",s.color),e.backgroundColor=r,e.direction=cj(e,"rtl",s.rtl)?"rtl":"ltr",e.align=cj(e,"align",pj(s)),"rtl"===e.direction&&Vw(t)&&(e.align="right");var n=t.padding;n.left>0&&(e.paddingLeft=`${n.left}px`),n.right>0&&(e.paddingRight=`${n.right}px`),s.backgroundCornerRadius&&(e.borderRadius=cj(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new Uk(i,t.x,t.y,cj(e,"width",t.width),cj(e,"height",t.height),e);a.setScale(t.scaleX,t.scaleY).setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(a):i.add.existing(a),a}(this.parent,t).on("textchange",(function(t){var e=t.text;n?n(this.parent,e):this.parent.text=e}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,gj(t,"enterClose","textarea"!==s)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=function(t,e,i){return t.time.delayedCall(0,e,[],i)}(this.scene,(function(){this.scene.input.once("pointerdown",this.close,this),r&&r(this.parent),this.emit("open",this.parent)}),this),this},close:function(){return this===dj&&(dj=void 0),this.parent.setVisible(!0),this.inputText&&(this.inputText.destroy(),this.inputText=void 0),this.delayCall&&(this.delayCall.remove(),this.delayCall=void 0),this.scene.input.keyboard.off("keydown-ENTER",this.close,this),this.scene.input.off("pointerdown",this.close,this),this.onClose&&this.onClose(this.parent),this.emit("close",this.parent),this}};const mj=Phaser.Utils.Objects.GetValue;class yj extends La{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),mj(e,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open()}),this).setInteractive()}shutdown(t){this.isShutdown||(this.close(),super.shutdown(t))}setOpenConfig(t){return void 0===t&&(t={}),this.openConfig=t,this}get isOpened(){return void 0!==this.inputText}get text(){return this.isOpened?this.inputText.text:this.parent.text}}Object.assign(yj.prototype,fj),t.register("textEdit",(function(t,e){return new yj(t,e)})),P(window,"RexPlugins.UI.TextEdit",yj),t.register("layerManager",(function(t){return new Ma(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",Ma);class bj extends Phaser.Plugins.ScenePlugin{constructor(e,i){super(e,i),this.add=new t(e)}boot(){this.scene.events.on("destroy",this.destroy,this)}destroy(){this.add.destroy(),super.destroy()}isInTouching(t,e,i,s){return!!t.visible&&Gm(t,e,i,s)}get viewport(){return oa(this.scene,this.scene.cameras.main,!0)}}var xj={getParentSizer:Qp,getTopmostSizer:tg,removeFromParent:cE,hide:nm,show:rm,isShown:am,confirmAction:tE,edit:function(t,e,i){return t._edit||(t._edit=new yj(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:Jw,fontSizeExpandText:sS,fontSizeResize:Zw,setFontSizeToFitWidth:Zw,waitEvent:nl,waitComplete:al,delayPromise:Kk,setChildrenInteractive:jb,fadeIn:Ef,fadeOutDestroy:_f,easeMoveTo:Xf,easeMoveFrom:Yf,modal:Am,modalPromise:function(t,e){var i=Am(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:jm,requestDrag:$I,openFileChooser:Qk};return Object.assign(bj.prototype,xj),bj},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e(); diff --git a/docs/site/canvasinput/index.html b/docs/site/canvasinput/index.html index 35df196f1f..abb2d1ee81 100644 --- a/docs/site/canvasinput/index.html +++ b/docs/site/canvasinput/index.html @@ -10363,6 +10363,12 @@

    Create instance // 'cursor.color': ... // 'cursor.backgroundColor': ... // 'cursor.xxx': ... + + // Style when range selecting + // 'range.color': ... + // 'range.backgroundColor': ... + // 'range.xxx': ... + // Using cursor style if no range style is given }, cursorStyle: undefined, @@ -10420,6 +10426,20 @@

    Create instance // }); // }, + // onRangeOut: function(child, cursorIndex, canvasInput) { + // child.modifyStyle({ + // + // }); + // }, + + // onRangeIn: function(child, cursorIndex, canvasInput) { + // child.modifyStyle({ + // + // }); + // }, + + // Use 'onCursorIn' and 'onCursorOut' if 'onRangeOut' and 'onRangeIn' are not given + // parseTextCallback: function(text) { // return text; // }. @@ -10502,6 +10522,24 @@

    Create instancecharacter child +
  • onRangeOut : Callback invoked when leaving range-selecting on a character child +
    function(child, index, canvasInput) {
    +    child.modifyStyle({...})
    +}
    +
      +
    • child : character child
    • +
    • Use onCursorOut callback if onRangeOut and onRangeIn callbacks are not given, for backward compatible.
    • +
    +
  • +
  • onRangeIn : Callback invoked when entering range-selecting on a character child +
    function(child, index, canvasInput) {
    +    child.modifyStyle({...})
    +}
    +
      +
    • child : character child
    • +
    • Use onCursorIn callback if onRangeOut and onRangeIn callbacks are not given, for backward compatible.
    • +
    +
  • parseTextCallback : Callback of parsing text (txt.text) to value (txt.value) +
  • Number input

    txt.setNumberInput();
    diff --git a/docs/site/search/search_index.json b/docs/site/search/search_index.json
    index 8fb9e4d6c4..e1eb79d96f 100644
    --- a/docs/site/search/search_index.json
    +++ b/docs/site/search/search_index.json
    @@ -1 +1 @@
    -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Home","text":""},{"location":"#phaser","title":"Phaser","text":"

    Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

    "},{"location":"#links","title":"Links","text":""},{"location":"#phaser3","title":"Phaser3","text":"
    • FAQ
    • Official discord channel
    • API document
    • Examples
    • Bug report
    "},{"location":"#rex-plugins","title":"Rex plugins","text":"
    • Plugin list
      • Demos
    • Discord channel
    • Bug report
    • Feature suggestion & discussion
    "},{"location":"achievements/","title":"CSV Achievements","text":""},{"location":"achievements/#introduction","title":"Introduction","text":"

    Achievements in a csv table.

    • Author: Rex
    • Member of scene
    "},{"location":"achievements/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"achievements/#install-plugin","title":"Install plugin","text":""},{"location":"achievements/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexachievementsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexachievementsplugin.min.js', true);\n
    • Add conditions-table object
      var achievements = scene.plugins.get('rexachievementsplugin').add();\n
    "},{"location":"achievements/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AchievementsPlugin from 'phaser3-rex-plugins/plugins/achievements-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAchievements',\nplugin: AchievementsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add conditions-table object
      var achievements = scene.plugins.get('rexAchievements').add();\n
    "},{"location":"achievements/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Achievements from 'phaser3-rex-plugins/plugins/achievements.js';\n
    • Add conditions-table object
      var achievements = new Achievements();\n
    "},{"location":"achievements/#create-instance","title":"Create instance","text":"
    var achievements = scene.plugins.get('rexAchievements').add();\n
    "},{"location":"achievements/#load-table-from-csv-string","title":"Load table from csv string","text":"
    achievements.loadCSV(csvString, {\n// delimiter: ','\n});\n

    For exameple, csv string

    A A Lv1 Ach1 >= 10 < 20 Lv1 Ach2 >= 20 < 50 Lv1 Ach3 >= 50
    ,A,A\nLv1,Ach1,>= 10,<= 20,\nLv1,Ach2,>= 20,< 50,\nLv1,Ach3,>= 50,,\n
    • 1st column : Level names
    • 2nd column : Achievement names
    • Other columns : Condtions
    • 1st row : Variable names of conditions.

    means that:

    Lv1, Ach1: (A>=10) && (A<20)\nLv1, Ach2: (A>=20) && (A<50)\nLv1, Ach3: (A>=50)\n
    "},{"location":"achievements/#test","title":"Test","text":"
    1. Run test
      var achievements.runTest(levelName, values);\n
      • levelName : Level name, in 1st column of achievements table.
      • values : Inputs in Key-value pairs
    2. Get obtained states
      var states = achievements.getObtainedState(levelName);\n
      • states : Obtained states of levelName
        {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n
        • wasObtained : Obtained this achievement achievementName before last testing.
        • justObtained : Obtained this achievement achievementName at last testing.

    or

    var states = achievements.getTestResults(levelName, values);\n
    "},{"location":"achievements/#get-obtained-states","title":"Get obtained states","text":"
    • Get obtained states of an achievement in a level
      var state = achievements.getObtainedState(levelName, achievementName);\n
      • state : Obtained states of achievementName, in level levelName
        {\nwasObtained: boolean,\njustObtained: boolean\n}\n
        • wasObtained : Obtained this achievement achievementName before last testing.
        • justObtained : Obtained this achievement achievementName at last testing.
    • Get obtained states of a level
      var state = achievements.getObtainedState(levelName);\n
      • states : Obtained states of levelName
        {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n
    • Get obtained states of all levels
      var state = achievements.getObtainedState();\n// var state = achievements.getObtainedStates();\n
      • states : Obtained states of all levels
        {\nlevelName: {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n}\n
    • For each obtained state in a level
      achievements.forEachObtainedState(levelName, function(levelName, achievementName, state) {\n\n}, scope)\n
      • state : Obtained states of achievementName, in level levelName
        {\nwasObtained: boolean,\njustObtained: boolean\n}\n
    "},{"location":"achievements/#get-name","title":"Get name","text":"
    • Name of levels
      var names = achievements.getLevelNames();\n// var names = achievements.getLevelNames(out);\n
    • Name of achievements in a level
      var names = achievements.getAchievementNames(levelName);\n// var names = achievements.getAchievementNames(levelName, out);\n
    "},{"location":"achievements/#save-load-obtained-states","title":"Save & load obtained states","text":"
    • Get obtained states
      var states = achievements.getObtainedStates();\n
    • Load obtained states
      achievements.loadObtainedStates(states);\n
    "},{"location":"achievements/#set-obtained-state","title":"Set obtained state","text":"
    • Set wasObtained, justObtained properties to true.
      achievements.setObtainedState(levelName, achievementName);\n
    • Set wasObtained, justObtained properties to false.
      achievements.clearObtainedState(levelName, achievementName);\n// achievements.setObtainedState(levelName, achievementName, false);\n
    "},{"location":"alphamaskimage/","title":"Alpha mask image","text":""},{"location":"alphamaskimage/#introduction","title":"Introduction","text":"

    Load a texture, then apply an alpha mask from another texture. Extended from canvas plugin.

    • Author: Rex
    • Game object
    "},{"location":"alphamaskimage/#live-demos","title":"Live demos","text":"
    • Alpha-mask-image
    "},{"location":"alphamaskimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"alphamaskimage/#install-plugin","title":"Install plugin","text":""},{"location":"alphamaskimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexalphamaskimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexalphamaskimageplugin.min.js', true);\n
    • Add alpha-mask-image object
      var image = scene.add.rexAlphaMaskImage(x, y, key, frame, config);\n
    "},{"location":"alphamaskimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AlphaMaskImagePlugin from 'phaser3-rex-plugins/plugins/alphamaskimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAlphaMaskImagePlugin',\nplugin: AlphaMaskImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add alpha-mask-image object
      var image = scene.add.rexAlphaMaskImage(x, y, key, frame, config);\n
    "},{"location":"alphamaskimage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import AlphaMaskImage from 'phaser3-rex-plugins/plugins/alphamaskimage.js';\n
    • Add alpha-mask-image object
      var image = new AlphaMaskImage(scene, x, y, key, frame, config);\nscene.add.existing(image);\n
    "},{"location":"alphamaskimage/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAlphaMaskImagePlugin',\nplugin: AlphaMaskImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"alphamaskimage/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexAlphaMaskImage(x, y, key, frame, {\nmask: {\nkey: textureKey,\n// frame: frameName,\n// invertAlpha: false,\n// scale: undefined,\n}\n\n// backgroundColor: undefined,\n});\n

    or

    var image = scene.add.rexAlphaMaskImage(x, y, key, {\nmask: {\nkey: textureKey,\n// frame: frameName,\n// invertAlpha: false,\n// scale: undefined,\n}\n\n// backgroundColor: undefined,\n});\n
    • key, frame : Texture key, frame name of target texture.
    • mask.key, mask.frame : Texture key, frame name of the mask texture.
    • mask.invertAlpha :
      • false : Mask non-alpha (alpha === 0) area. Default behavior.
      • true : Mask alpha (alpha > 0) area.
    • mask.scale :
      • undefined : Expand mask texture size to fit target texture.
      • A number : Scale mask texture size.
    • backgroundColor : Background color filled with masked area.
      • undefiined : No background color.

    Add image from JSON

    var image = scene.make.rexAlphaMaskImage({\nx: 0,\ny: 0,\nkey: key,\nframe: name,\nmask: {\nkey: textureKey,\n// frame: frameName,\n// invertAlpha: false,\n// scale: undefined,\n}\n\n// backgroundColor: undefined,\n\nadd: true\n});\n
    "},{"location":"alphamaskimage/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImage extends AlphaMaskImage {\nconstructor(scene, x, y, key, frame, config) {\nsuper(scene, x, y, key, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImage(scene, key, frame, config);\n
    "},{"location":"alphamaskimage/#set-texture","title":"Set texture","text":"
    image.setTexture(key, frame);\n// image.setTexture(key, frame, mask);\n

    or

    image.setTexture(key, frame, {\nmask: {\nkey: textureKey,\n// frame: frameName,\n// invertAlpha: false,\n// scale: undefined,\n}\n\n// backgroundColor: undefined,\n});\n
    • mask.key, mask.frame : Texture key, frame name of the mask texture.
    • mask.invertAlpha :
      • false : Mask non-alpha (alpha === 0) area. Default behavior.
      • true : Mask alpha (alpha > 0) area.
    • mask.scale :
      • undefined : Expand mask texture size to fit target texture.
      • A number : Scale mask texture size.
    • backgroundColor : Background color filled with masked area.
      • undefiined : No background color.
    "},{"location":"alphamaskimage/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"alphamaskimage/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"alphamaskimage/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"anchor/","title":"Anchor","text":""},{"location":"anchor/#introduction","title":"Introduction","text":"

    Set size and position based on visible window.

    Note

    Visible window will be changed when scale mode is ENVELOP, WIDTH_CONTROLS_HEIGHT, or HEIGHT_CONTROLS_WIDTH.

    • Author: Rex
    • Behavior of game object
    "},{"location":"anchor/#live-demos","title":"Live demos","text":"
    • Anchor
    • Resize
    • Camera zoom/scroll
    "},{"location":"anchor/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"anchor/#install-plugin","title":"Install plugin","text":""},{"location":"anchor/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexanchorplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexanchorplugin.min.js', true);\n
    • Add anchor behavior
      var anchor = scene.plugins.get('rexanchorplugin').add(gameObject, config);\n
    "},{"location":"anchor/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AnchorPlugin from 'phaser3-rex-plugins/plugins/anchor-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAnchor',\nplugin: AnchorPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add anchor behavior
      var anchor = scene.plugins.get('rexAnchor').add(gameObject, config);\n
    "},{"location":"anchor/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Anchor from 'phaser3-rex-plugins/plugins/anchor.js';\n
    • Add anchor behavior
      var anchor = new Anchor(gameObject, config);\n
    "},{"location":"anchor/#create-instance","title":"Create instance","text":"
    var anchor = scene.plugins.get('rexAnchor').add(gameObject, {\n// left: '0%+0',\n// right: '0%+0',\n// centerX: '0%+0',\n// x: '0%+0',\n\n// top: '0%+0',\n// bottom: '0%+0',\n// centerY: '0%+0',\n// y: '0%+0',\n\n// width: '100%+0',\n// height: '100%+0',\n// onResizeCallback: function(width, height, gameObject, anchor) {},\n// onResizeCallbackScope: undefined,\n\n// onUpdateViewportCallback: function(viewport, gameObject, anchor) {},\n// onUpdateViewportCallbackScope: undefined,\n\n// enable: true\n});\n
    • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • 'left'(=0%), 'center'(=50%), 'right'(=100%)
        • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
      • Offset : '+n', or '-n'.

    For example, anchor game object's left bound to viewport's left+10, centerY to viewport's center

    {\nleft: 'left+10',\ncenterY: 'center'\n}\n
    • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0 ~ 100.
      • Padding : '+n', or '-n'.
    • onResizeCallback, onResizeCallbackScope : Callback of resizing game object
      • undefined : Default resize method.
      • Custom method
        function(width, height, gameObject, anchor) {\n// gameObject.setSize(width, height);\n// gameObject.setDisplaySize(width, height);\n// ...\n}\n
      • null or false : No callback
    • onUpdateViewportCallback, onUpdateViewportCallback : Callback invoked when viewport changed (anchor)

      fucntion(viewport, gameObject, anchor) {\n// Can change properties of viewport here\n// var centerX = viewport.centerX,\n//     centerY = viewport.centerY;\n// viewport.width *= 0.8;\n// viewport.height *= 0.9;\n// viewport.centerX = centerX;\n// viewport.centerY = centerY;\n}\n

      • viewport\uff1a A rectangle object
    • enable :

      • undefined, or true : Anchor game object under 'resize' event of scale manager.
      • false : Won't anchor game object automatially.
    "},{"location":"anchor/#reset-config","title":"Reset config","text":"
    anchor.resetFromJSON({\n// left: '0%+0',\n// right: '0%+0',\n// centerX: '0%+0',\n// x: '0%+0',\n\n// top: '0%+0',\n// bottom: '0%+0',\n// centerY: '0%+0',\n// y: '0%+0',\n\n// width: '100%+0',\n// height: '100%+0',    \n\n// onUpdateViewportCallback: function(viewport, gameObject, anchor) {}\n// onUpdateViewportCallbackScope: undefined,\n})\n
    • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0~100
        • 'left'(=0%), 'center'(=50%), 'right'(=100%)
        • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
      • Offset : '+n', or '-n'
    • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0 ~ 100.
      • Padding : '+n', or '-n'.
    • onResizeCallback, onResizeCallbackScope : Callback of resizing game object
      function(width, height, gameObject, anchor) {\n// gameObject.setSize(width, height);\n// gameObject.setDisplaySize(width, height);\n// ...\n}\n
    "},{"location":"anchor/#set-onupdateviewport-callback","title":"Set OnUpdateViewport callback","text":"
    anchor.setUpdateViewportCallback(callback, scope);\n
    • callback :
      fucntion(viewport, gameObject, anchor) {\n// Can change properties of viewport here\n// var centerX = viewport.centerX,\n//     centerY = viewport.centerY;\n// viewport.width *= 0.8;\n// viewport.height *= 0.9;\n// viewport.centerX = centerX;\n// viewport.centerY = centerY;\n}\n
      • viewport\uff1a A rectangle object
    "},{"location":"anchor/#manual-anchor","title":"Manual anchor","text":"
    anchor.anchor();\n
    "},{"location":"anchor/#auto-anchor","title":"Auto anchor","text":"
    • Anchor game object under 'resize' event of scale manager.
      anchor.autoAnchor();\n// anchor.autoAnchor(true);\n
    • Disable auto-anchor
      anchor.autoAnchor(false);\n
    "},{"location":"angle/","title":"Angle","text":""},{"location":"angle/#introduction","title":"Introduction","text":"

    Convert angle value, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"angle/#usage","title":"Usage","text":""},{"location":"angle/#degree-radians","title":"Degree <-> Radians","text":"
    • Degree to radians
      var rad = Phaser.Math.DegToRad(deg);\n
    • Radians to degree
      var deg = Phaser.Math.RadToDeg(rad);  // deg : -180 ~ 180\n
    "},{"location":"angle/#wrap","title":"Wrap","text":"
    • Wrap angle (radians) in the range of -PI to PI
      var rad = Phaser.Math.Angle.Wrap(angle);\n
    • Wrap angle (radians) in the range of 0 to 2*PI
      var rad = Phaser.Math.Angle.Normalize(angle);\n
    • Wrap angle (degrees) in the range of -180 to 180
      var deg = Phaser.Math.Angle.WrapDegrees(angle);\n
    "},{"location":"angle/#angle-between-points","title":"Angle between points","text":"
    • Angle from (0,0) to vector (x2 - x1 , y2 - y1)
      var rad = Phaser.Math.Angle.Between(x1, y1, x2, y2);\n
      var rad = Phaser.Math.Angle.BetweenPoints(point1, point2);\n
    "},{"location":"angle/#angle-between-angles","title":"Angle between angles","text":"
    • Shortest angle (degrees) between 2 angles
      var deg = Phaser.Math.Angle.ShortestBetween(angle1, angle2)\n
      • angle1, angle2 : Angle in degrees in the range of -180 to 180
      • deg : Shortest angle in degrees
        • deg > 0 : Counter-ClockWise rotation
        • deg < 0 : ClockWise rotation
    "},{"location":"angle/#rotate-around-position","title":"Rotate around position","text":"
    • Rotate a point around x and y by the given angle.
      var out = Phaser.Math.RotateAround(point, x, y, angle);\n
    • Rotate a point around x and y by the given angle and distance.
      var out = Phaser.Math.RotateAroundDistance(point, x, y, angle, distance);\n
    "},{"location":"angle/#rotate-to-angle","title":"Rotate to angle","text":"
    var rad = Phaser.Math.Angle.RotateTo(currentAngle, targetAngle, lerp)\n
    • currentAngle, : The current angle, in radians.
    • targetAngle : The target angle to rotate to, in radians.
    • lerp : The lerp value to add to the current angle.
    "},{"location":"angle/#random-angle","title":"Random angle","text":"
    • Returns a random angle in the range [-pi, pi].
      var angle = Phaser.Math.Angle.Random();\n
    • Returns a random angle in the range [-180, 180].
      var angle = Phaser.Math.Angle.RandomDegrees();\n
    "},{"location":"animation/","title":"Animation","text":""},{"location":"animation/#introduction","title":"Introduction","text":"

    Animation and animations manager.

    • Author: Richard Davey
    "},{"location":"animation/#usage","title":"Usage","text":""},{"location":"animation/#animation-manager","title":"Animation manager","text":""},{"location":"animation/#add-animation","title":"Add animation","text":"
    var animationConfig = {\nkey: '',\n\nframes: [],\n\nsortFrames: true,\ndefaultTextureKey: null,\nskipMissedFrames: true,\nrandomFrame: false,\n\n// time\ndelay: 0,\nduration: null,\nframeRate: null,\ntimeScale: 1,\n\n// repeat\nrepeat: 0,              // set to (-1) to repeat forever\nrepeatDelay: 0,\nyoyo: false,\n\n// visible\nshowBeforeDelay: false,\nshowOnStart: false,\nhideOnComplete: false\n};\n\nscene.anims.create(animationConfig);\n
    • key : Unique key of this animation data
    • frames : An array of {key, frame}
      • Properties
        {\nkey: '',\nframe: '', // string, or number\nduration: 0\n}\n
        • duration : The duration, in ms, of this frame of the animation.
      • A string : Texture key.
      • Every frame in the atlas
        scene.anims.generateFrameNames(key);\n
      • Frame sequence indexing from start to end
        var config = ;\nscene.anims.generateFrameNames(key,\n{\nprefix: '',\nstart: 0,\nend: 0,\nsuffix: '',\nzeroPad: 0,\n// outputArray: [], // Append frames into this array\n});\n
        • prefix + Pad(i, zeroPad, '0', 1) + suffix, i: start ~ end
      • Custom frame sequence
        var config = ;\nscene.anims.generateFrameNames(key,\n{\nprefix: '',\nsuffix: '',\nzeroPad: 0,\nframes: [ ... ]\n// outputArray: [], // Append frames into this array\n});\n
        • prefix + Pad(frames[i], zeroPad, '0', 1) + suffix
    • sortFrames : Frame names numerically sorted. Default value is true.
    • defaultTextureKey : The key of the texture all frames of the animation will use. Can be overridden on a per frame basis.
    • skipMissedFrames : Skip frames if the time lags, or always advanced anyway? Default value is true.
    • randomFrame : Start playback of this animation from a randomly selected frame? Default value is false.
    • delay : Delay before starting playback. Value given in milliseconds.
    • duration : How long the animation should play for in milliseconds. If not given its derived from frameRate.
    • frameRate : The frame rate of playback in frames per second. Default value is 24.
    • timeScale : The time scale to be applied to playback of this animation. Default value is 1.
    • repeat : Number of times to repeat the animation. Default value is 0.
      • -1 : Infinity
    • repeatDelay : Delay before the animation repeats. Value given in milliseconds.
    • yoyo : Should the animation yoyo? (reverse back down to the start) before repeating? Default value is false.
    • showBeforeDelay : If this animation has a delay, should it show the first frame immediately (true), or only after the delay (false)
    • showOnStart : Should sprite.visible = true when the animation starts to play? This happens after any delay, if set. Default value is false.
    • hideOnComplete : Should sprite.visible = false when the animation finishes? Default value is false.
    "},{"location":"animation/#add-from-aseprite","title":"Add from Aseprite","text":"

    Aseprite

    scene.anims.createFromAseprite(key);\n// scene.anims.createFromAseprite(key, tags, target);\n
    • key : The key of the loaded Aseprite atlas.
    • tags :
      • undefined : Load all tags.
      • Array of string tag : Load these tags.
    • target : Create the animations on this target Sprite.
      • undefined : Created globally in this Animation Manager. Default behavior.
    "},{"location":"animation/#remove-animation","title":"Remove animation","text":"
    scene.anims.remove(key);\n
    "},{"location":"animation/#delay-between-two-animations","title":"Delay between two animations","text":"
    • Add
      scene.anims.addMix(animA, animB, delay);\n
      • animA, animB : String key of an animation, or an instance of animation.
    • Remove
      scene.anims.removeMix(animA, animB);\n// scene.anims.removeMix(animA);\n
    • Get
      var delay = scene.anims.getMix(animA, animB);\n
    "},{"location":"animation/#play-animation","title":"Play animation","text":"
    • Play
      scene.anims.play(key, children);\n
    • Stagger play (delay play)
      scene.anims.staggerPlay(key, children, stagger, staggerFirst);\n
      • children : An array of Game Objects to play the animation on
      • stagger : The amount of time, in milliseconds, to offset each play time by
      • staggerFirst : Set true to apply delay on 1st child
    "},{"location":"animation/#pause-all-animations","title":"Pause all animations","text":"
    scene.anims.pauseAll();\n
    "},{"location":"animation/#resume-all-animations","title":"Resume all animations","text":"
    scene.anims.resumeAll();\n
    "},{"location":"animation/#global-time-scale","title":"Global time scale","text":"
    • Get
      var timeScale = scene.anims.globalTimeScale;\n
    • Set
      scene.anims.globalTimeScale = timeScale;\n
    "},{"location":"animation/#has-animation","title":"Has animation","text":"
    var hasAnim = scene.anims.exists(key);\n
    "},{"location":"animation/#exportload","title":"Export/load","text":"
    • Export JSON
      var json = scene.anims.toJSON();\n
    • Load from JSON
      scene.anims.fromJSON(json);\n// scene.anims.fromJSON(json, clearCurrentAnimations);\n
      • Load JSON in preload stage javascript scene.load.json(key, url);
      • Load animation in preload stage
        scene.load.animation(key, url);\n
    "},{"location":"animation/#events","title":"Events","text":"
    • On add animation
      scene.anims.on('add', function(key, anim) {});\n
    • On remove animation
      scene.anims.on('remove', function(key, anim) {});\n
    • On pause all animations
      scene.anims.on('pauseall', function() {});\n
    • On resume all animations
      scene.anims.on('resumeall', function() {});\n
    "},{"location":"animation/#animation-object","title":"Animation object","text":"
    var anim = scene.anims.get(key);\n
    "},{"location":"animation/#add-frame","title":"Add frame","text":"
    • Append frames
      anim.addFrame(frame);\n
      • frame : scene.anims.generateFrameNames(key, config)
    • Insert frames at index
      anim.addFrameAt(index, frame);\n
      • frame : scene.anims.generateFrameNames(key, config)
    "},{"location":"animation/#remove-frame","title":"Remove frame","text":"
    • Remove frame at
      anim.removeFrameAt(index);\n
    • Remove frame
      anim.removeFrame(frame);\n
    "},{"location":"animation/#get-frame","title":"Get frame","text":"
    • Has frame index
      var HasFrameAt = anim.checkFrame(index);\n
    • Get frame at index
      var frame = anim.getFrameAt(index);\n
    • Get last frame
      var frame = anim.getLastFrame();\n
    "},{"location":"animation/#export","title":"Export","text":"
    • Export JSON
      var json = anim.toJSON();\n
      or
      var jsonString = JSON.stringify(anim);\n
    "},{"location":"arcade-body/","title":"Body","text":""},{"location":"arcade-body/#introduction","title":"Introduction","text":"

    Arcade physics body.

    • Author: Richard Davey
    "},{"location":"arcade-body/#usage","title":"Usage","text":""},{"location":"arcade-body/#get-physics-body","title":"Get physics body","text":"
    1. Enable physics world
    2. Add existing game object(s) to physics world
      • Add a game object
        var gameObject = scene.physics.add.existing(gameObject, bodyType);\n
        • bodyType :
          • 0 : Dynamic body
          • 1 : Static body
      • Add game objects
        scene.physics.world.enable(gameObjects, bodyType);\n
        • gameObjects : An array of game objects, or a group object
        • bodyType :
          • 0 : Dynamic body
          • 1 : Static body
    3. Get physics body
      var body = gameObject.body;\n
    "},{"location":"arcade-body/#enable","title":"Enable","text":"

    Whether this Body is updated by the physics simulation.

    • Enable (default)
      body.setEnable();\n
      or
      body.enable = true;\n
    • Disable
      body.setEnable(false);\n
      or
      body.enable = false;\n
    "},{"location":"arcade-body/#direct-control","title":"Direct control","text":"

    Enable directControl when game object is controlled by tween or dragging. Default behavior is disable.

    • Enable
      body.setDirectControl();\n// body.setDirectControl(true);\n
      or
      body.directControl = true;\n
    • Disable
      body.setDirectControl(false);\n
      or
      body.directControl = false;\n
    "},{"location":"arcade-body/#immovable","title":"Immovable","text":"

    Whether this Body can be moved by collisions with another Body.

    • Enable
      body.setImmovable();\n// body.immovable = true;\n
    • Disable (defalut)
      body.setImmovable(false);\n// body.immovable = false;\n
    • Get
      var immovable = body.immovable;\n
    "},{"location":"arcade-body/#pushable","title":"Pushable","text":"

    Sets if this Body can be pushed by another Body.

    • Enable (default value of dynamic body)
      body.pushable = true;\n
    • Disable, reflect back all of the velocity it is given to the colliding body.
      body.pushable = false;\n
    • Get
      var pushable = body.pushable;\n
    "},{"location":"arcade-body/#moveable","title":"Moveable","text":"

    Whether the Body's position and rotation are affected by its velocity, acceleration, drag, and gravity.

    • Enable (default)
      body.moves = true;\n
    • Disable
      body.moves = false;\n
    • Get
      var moves = body.moves;\n
    "},{"location":"arcade-body/#destroy","title":"Destroy","text":"

    Physics body will be destroyed automatically when game object is destroyed.

    "},{"location":"arcade-body/#movement","title":"Movement","text":""},{"location":"arcade-body/#velocity","title":"Velocity","text":"
    • Set
      body.setVelocity(x,y);\n
      or
      body.setVelocityX(x);\nbody.setVelocityY(x);\n
    • Get
      var vx = body.velocity.x;\nvar vy = body.velocity.y;\n
    "},{"location":"arcade-body/#max-speed","title":"Max speed","text":"
    • Set
      body.setMaxSpeed(speed);\n
    • Get
      var speed = body.maxSpeed;\n
    "},{"location":"arcade-body/#max-velocity","title":"Max velocity","text":"
    • Set
      body.setMaxVelocity(x, y);\n
      or
      body.setMaxVelocityX(x);\nbody.setMaxVelocityY(y);\n
    • Get
      var vx = body.maxVelocity.x;\nvar vy = body.maxVelocity.y;\n
    "},{"location":"arcade-body/#acceleration","title":"Acceleration","text":"
    • Set
      body.setAcceleration(x, y);\n
      or
      body.setAccelerationX(x);\nbody.setAccelerationY(y);\n
    • Get
      var ax = body.acceleration.x;\nvar ay = body.acceleration.y;\n
    "},{"location":"arcade-body/#gravity","title":"Gravity","text":"
    • Set
      body.setGravity(x, y);\n
      or
      body.setGravityX(x);\nbody.setGravityY(y);\n
    • Get
      var gx = body.gravity.x;\nvar gy = body.gravity.y;\n
    • Enables (default)
      body.setAllowGravity();\n
    • Disable
      body.setAllowGravity(false);\n
    "},{"location":"arcade-body/#drag","title":"Drag","text":"

    Reduces speed per second.

    • Set
      body.setDrag(x, y);\n
      or
      body.setDragX(x);\nbody.setDragY(y);\n
    • Get
      var dx = body.drag.x;\nvar dy = body.drag.y;\n
    • Enables (default)
      body.setAllowDrag();\n
    • Disable
      body.setAllowDrag(false);\n
    • Enable Damping (default: disable)
      body.setDamping(true);\n// body.useDamping = true;\n
    "},{"location":"arcade-body/#slide-factor","title":"Slide factor","text":"

    The Slide Factor controls how much velocity is preserved when this Body is pushed by another Body.

    body.slideFactor.set(x, y);\n
    • x, y :
      • 1 : Take on all velocity given in the push. Default value.
      • 0 : Allow this Body to be pushed but then remain completely still after the push ends, such as you see in a game like Sokoban.
      • Other value between 0 ~ 1 : Keep x/y of the original velocity when the push ends.
        • Combine this with the setDrag() method to create deceleration.
    "},{"location":"arcade-body/#reset-position","title":"Reset position","text":"
    body.reset(x, y);\n
    "},{"location":"arcade-body/#stop","title":"Stop","text":"

    Sets acceleration, velocity, and speed to zero.

    body.stop();\n
    "},{"location":"arcade-body/#friction","title":"Friction","text":"

    If this Body is immovable and in motion, this the proportion of this Body's movement received by the riding body on each axis.

    • Set
      body.setFriction(x, y);\n
      or
      body.setFrictionX(x);\nbody.setFrictionY(y);\n
    • Get
      var fx = body.friction.x;\nvar fy = body.friction.y;\n
    "},{"location":"arcade-body/#speed","title":"Speed","text":"
    • The absolute (non-negative) change in this Body's horizontal/vertical position from the previous step.
      var dx = body.deltaAbsX();\nvar dy = body.deltaAbsY();\n
    "},{"location":"arcade-body/#rotation","title":"Rotation","text":""},{"location":"arcade-body/#allow-rotation","title":"Allow rotation","text":"

    Whether this Body's rotation is affected by its angular acceleration and velocity.

    • Enable (default)
      body.setAllowRotation();\n
    • Disable
      body.setAllowRotation(false);\n
    • Get
      var allowRotation = body.allowRotation;\n
    "},{"location":"arcade-body/#angular-velocity","title":"Angular velocity","text":"
    • Set
      body.setAngularVelocity(v);\n
    • Get
      var av = body.angularVelocity;\n
    "},{"location":"arcade-body/#angular-acceleration","title":"Angular acceleration","text":"
    • Set
      body.setAngularAcceleration(v);\n
    • Get
      var aa = body.angularAcceleration;\n
    "},{"location":"arcade-body/#angular-drag","title":"Angular drag","text":"

    Reduces angular speed per second.

    • Set
      body.setAngularDrag(v);\n
    • Get
      var ad = body.angularDrag;\n
    "},{"location":"arcade-body/#collision","title":"Collision","text":""},{"location":"arcade-body/#collision-category","title":"Collision category","text":"

    A body is only below to one collision category. A body can collide with multiple collision categories. The default is that all bodies collide with all others.

    • Collision category
      • Get
        var collisionCategory = body.collisionCategory;\n
      • Set
        body.setCollisionCategory(category);\n
        • category :
          • (1 << 0)
          • (1 << 1)
          • (1 << 2)
          • ...
          • (1 << 31)
      • Reset collision category, to default behavior (all bodies collide with all others)
        body.resetCollisionCategory();\n
        • Set collisionCategory to 1.
        • Set collisionMask to 1
    • Collision mask
      • Get
        var collisionMask = body.collisionMask;\n
      • Set
        body.setCollidesWith(categories);\n
        • categories : A single category value, or an array of them.
      • Add
        body.addCollidesWith(category):\n
        • category : A single category value.
      • Remove
        body.removeCollidesWith(category);\n
        • category : A single category value.
    "},{"location":"arcade-body/#collision-bound","title":"Collision bound","text":"
    • Rectangle
      body.setSize(width, height, center);\n
      • center : false to set body's offset to (0, 0).
        • Not work in Graphics object.
    • Circle
      body.setCircle(radius, offsetX, offsetY);\n
    "},{"location":"arcade-body/#offset","title":"Offset","text":"
    body.setOffset(x, y);\n
    "},{"location":"arcade-body/#push-out","title":"Push out","text":"
    scene.physics.add.collider(objectsA, objectsB);\n
    • objectsA, objectsB :
      • A game object
      • Game objects in array (Add or remove game objects)
      • Physics group (Add or remove game objects)
      • Group (Add or remove game objects)
    "},{"location":"arcade-body/#callbacks","title":"Callbacks","text":"

    Add collider

    "},{"location":"arcade-body/#point-inside","title":"Point inside","text":"
    var hit = body.hitTest(x, y);\n
    "},{"location":"arcade-body/#is-colliding","title":"Is colliding","text":"
    • Is colliding this tick
      var isColliding = body.touching;\n
      • isColliding :
        {\nnone: true,\nup: true,\ndown: true,\nleft: true,\nright: true\n}\n
    • Was colliding previous tick
      var wasColliding = body.wasTouching;\n
      • wasColliding :
        {\nnone: true,\nup: true,\ndown: true,\nleft: true,\nright: true\n}\n
    "},{"location":"arcade-body/#bounce","title":"Bounce","text":"
    • Set
      body.setBounce(x, y);\n
      or
      body.setBounceX(x);\nbody.setBounceY(y);\n
    • Get
      var bx = body.bounce.x;\nvar by = body.bounce.y;\n
    "},{"location":"arcade-body/#world-bounds","title":"World bounds","text":"
    • Default world bounds
    • Custom world bounds :
      body.setBoundsRectangle(bounds);\n
      • bounds : A rectangle object.
    • Enable
      body.setCollideWorldBounds();\n
    • Disable (default)
      body.setCollideWorldBounds(false);\n
    • Get world bounds rectangle
      var top = body.world.bounds.top;\nvar bottom = body.world.bounds.bottom;\nvar left = body.world.bounds.left;\nvar right = body.world.bounds.right;\n
    "},{"location":"arcade-body/#blocked","title":"Blocked","text":"

    Whether this Body is colliding with a tile or the world boundary.

    • Blocked when moveing down
      var onFloor = body.onFloor(); // blocked.down\n
    • Blocked when moveing up
      var onCeiling = body.onCeiling();  // blocked.up\n
    • Blocked when moveing left or right
      var onWall = body.onWall();  // blocked.left || this.blocked.right\n
    • State
      var blocked = body.blocked;\n
      • blocked :
        {\nnone: true,\nup: false,\ndown: false,\nleft: false,\nright: false\n}\n
    "},{"location":"arcade-body/#mass","title":"Mass","text":"
    • Set
      body.setMass(m);\n
    • Get
      var m = body.mass;\n
    "},{"location":"arcade-body/#static-body","title":"Static body","text":""},{"location":"arcade-body/#sync","title":"Sync","text":"

    Syncs the Bodies position and size with its parent Game Object.

    body.updateFromGameObject();\n
    "},{"location":"arcade-body/#debug","title":"Debug","text":"
    • Bounds of Body
      • Enable drawing body
        body.debugShowBody = true;\n
      • Color
        body.debugBodyColor = 0xff00ff;\n
    • Direction and magnitude of velocity
      • Enable drawing body
        body.debugShowVelocity = true;\n
    "},{"location":"arcade-gameobject/","title":"Game object","text":""},{"location":"arcade-gameobject/#introduction","title":"Introduction","text":"

    Arcade physics Image/Sprite/Group object.

    • Author: Richard Davey
    "},{"location":"arcade-gameobject/#usage","title":"Usage","text":""},{"location":"arcade-gameobject/#add-physics-object","title":"Add physics object","text":"

    Enable physics world

    "},{"location":"arcade-gameobject/#image-object","title":"Image object","text":"
    • Static object, extends from Image object
      var image = scene.physics.add.staticImage(x, y, key);\n
    • Dynamic object, extends from Image object
      var image = scene.physics.add.image(x, y, key);\n
    "},{"location":"arcade-gameobject/#sprite-object","title":"Sprite object","text":"
    • Static object, extends from Sprite object
      var image = scene.physics.add.staticSprite(x, y, key, frame);\n
    • Dynamic object, extends from Sprite object
      var image = scene.physics.add.sprite(x, y, key, frame);\n
    "},{"location":"arcade-gameobject/#group","title":"Group","text":"
    • Static sprite objects, extends from Group object
      var group = scene.physics.add.staticGroup(children, config);\n// var group = scene.physics.add.staticGroup(config);\n
    • Dynamic sprite objects, extends from Group object
      var group = scene.physics.add.group(children, config);\n// var group = scene.physics.add.staticGroup(config);\n
      • config
        var config = {\nclassType: ArcadeSprite,\nenable: true,\ncollideWorldBounds: false,\ncustomBoundsRectangle: null,\naccelerationX: 0,\naccelerationY: 0,\nallowDrag: true,\nallowGravity: true,\nallowRotation: true,\nuseDamping: false,\nbounceX: 0,\nbounceY: 0,\ndragX: 0,\ndragY: 0,\ngravityX: 0,\ngravityY: 0,\nfrictionX: 0,\nfrictionY: 0,\nmaxSpeed: -1,\nvelocityX: 0,\nvelocityY: 0,\nmaxVelocityX: 10000,\nmaxVelocityY: 10000,\nangularVelocity: 0,\nangularAcceleration: 0,\nangularDrag: 0,\nmass: 0,\nimmovable: false,\n\nmaxSize: -1,\nrunChildUpdate: false\n};\n
    "},{"location":"arcade-gameobject/#enable","title":"Enable","text":"
    • Enable body
      gameObject.enableBody();\n// gameObject.enableBody(false, 0, 0, enableGameObject, showGameObject);\n
      • Enable and reset position
        gameObject.enableBody(true, x, y);\n// gameObject.enableBody(true, x, y, enableGameObject, showGameObject);\n
      • enableGameObject : Also activate this Game Object.
      • showGameObject : Also show this Game Object.
    • Disable body
      gameObject.disableBody();\n// gameObject.disableBody(disableGameObject, hideGameObject);\n
      • disableGameObject : Also deactivate this Game Object.
      • hideGameObject : Also hide this Game Object.
    "},{"location":"arcade-gameobject/#movement","title":"Movement","text":""},{"location":"arcade-gameobject/#velocity","title":"Velocity","text":"
    • Set
      gameObject.setVelocity(x, y);\n
      or
      gameObject.setVelocityX(x);\ngameObject.setVelocityY(y);\n
    • Get
      var vx = gameObject.body.velocity.x;\nvar vy = gameObject.body.velocity.y;\n
    "},{"location":"arcade-gameobject/#max-velocity","title":"Max velocity","text":"
    • Set
      gameObject.setMaxVelocity(x, y);\n
    • Get
      var vx = gameObject.body.maxVelocity.x;\nvar vy = gameObject.body.maxVelocity.y;\n
    "},{"location":"arcade-gameobject/#acceleration","title":"Acceleration","text":"
    • Set
      gameObject.setAcceleration(x, y);\n
      or
      gameObject.setAccelerationX(x);\ngameObject.setAccelerationY(y);\n
    • Get
      var ax = gameObject.body.acceleration.x;\nvar ay = gameObject.body.acceleration.y;\n
    "},{"location":"arcade-gameobject/#gravity","title":"Gravity","text":"
    • Set
      gameObject.setGravity(x, y);\n
      or
      gameObject.setGravityX(x);\ngameObject.setGravityY(y);\n
    • Get
      var gx = gameObject.body.gravity.x;\nvar gy = gameObject.body.gravity.y;\n
    "},{"location":"arcade-gameobject/#drag","title":"Drag","text":"
    • Set
      gameObject.setDrag(x, y);\n
      or
      gameObject.setDragX(x);\ngameObject.setDragY(y);\n
    • Get
      var dx = gameObject.body.drag.x;\nvar dy = gameObject.body.drag.y;\n
    • Enable damping
      gameObject.setDamping(value);\n
    "},{"location":"arcade-gameobject/#immovable","title":"Immovable","text":"
    • Enable
      gameObject.setImmovable();\n
    • Disable
      gameObject.setImmovable(false);\n
    • Get
      var immovable = gameObject.body.immovable;\n
    "},{"location":"arcade-gameobject/#pushable","title":"Pushable","text":"
    • Enable
      gameObject.setPushable();\n
    • Disable
      gameObject.setPushable(false);\n
    • Get
      var pushable = gameObject.body.pushable;\n
    "},{"location":"arcade-gameobject/#slide-factor","title":"Slide factor","text":"

    The Slide Factor controls how much velocity is preserved when this Body is pushed by another Body.

    gameObject.setSlideFactor(x, y);\n
    • x, y :
      • 1 : Take on all velocity given in the push. Default value.
      • 0 : Allow this Body to be pushed but then remain completely still after the push ends, such as you see in a game like Sokoban.
      • Other value between 0 ~ 1 : Keep x/y of the original velocity when the push ends.
        • Combine this with the setDrag() method to create deceleration.
    "},{"location":"arcade-gameobject/#friction","title":"Friction","text":"

    If this Body is immovable and in motion, this the proportion of this Body's movement received by the riding body on each axis.

    • Set
      gameObject.setFriction(x, y);\n
      or
      gameObject.setFrictionX(x);\ngameObject.setFrictionY(y);\n
    • Get
      var fx = gameObject.body.friction.x;\nvar fy = gameObject.body.friction.y;\n
    "},{"location":"arcade-gameobject/#direct-control","title":"Direct control","text":"

    Enable directControl when game object is controlled by tween or dragging. Default behavior is disable.

    • Enable
      gameObject.setDirectControl();\n// gameObject.setDirectControl(true);\n
    • Disable
      gameObject.setDirectControl(false);\n

    Use case

    Enable setDirectControl when game object is controlled by tween or dragging.

    "},{"location":"arcade-gameobject/#rotation","title":"Rotation","text":""},{"location":"arcade-gameobject/#allow-rotation","title":"Allow rotation","text":"

    Whether this Body's rotation is affected by its angular acceleration and velocity.

    • Enable (default)
      body.setAllowRotation();\n
    • Disable
      body.setAllowRotation(false);\n
    • Get
      var allowRotation = gameObject.body.allowRotation;\n
    "},{"location":"arcade-gameobject/#angular-velocity","title":"Angular velocity","text":"
    • Set
      gameObject.setAngularVelocity(v);\n
    • Get
      var av = gameObject.body.angularVelocity;\n
    "},{"location":"arcade-gameobject/#angular-acceleration","title":"Angular acceleration","text":"

    -Set

    gameObject.setAngularAcceleration(v);\n
    - Get
    var aa = gameObject.body.angularAcceleration;\n

    "},{"location":"arcade-gameobject/#angular-drag","title":"Angular drag","text":"
    • Set
      gameObject.setAngularDrag(v);\n
    • Get
      var ad = gameObject.body.angularDrag;\n
    "},{"location":"arcade-gameobject/#collision","title":"Collision","text":""},{"location":"arcade-gameobject/#collision-category","title":"Collision category","text":"

    A body is only below to one collision category. A body can collide with multiple collision categories. The default is that all bodies collide with all others.

    • Collision category
      • Get
        var collisionCategory = gameObject.body.collisionCategory;\n
      • Set
        gameObject.setCollisionCategory(category);\n
        • category :
          • (1 << 0)
          • (1 << 1)
          • (1 << 2)
          • ...
          • (1 << 31)
      • Reset collision category, to default behavior (all bodies collide with all others)
        gameObject.resetCollisionCategory();\n
        • Set collisionCategory to 1.
        • Set collisionMask to 1
    • Collision mask
      • Get
        var collisionMask = gameObject.body.collisionMask;\n
      • Set
        gameObject.setCollidesWith(categories);\n
        • categories : A single category value, or an array of them.
      • Add
        gameObject.addCollidesWith(category):\n
        • category : A single category value.
      • Remove
        gameObject.removeCollidesWith(category);\n
        • category : A single category value.
    "},{"location":"arcade-gameobject/#collision-bound","title":"Collision bound","text":"
    • Rectangle
      gameObject.setBodySize(width, height, center);\n
      • center : false to set body's offset to (0, 0)
    • Circle
      gameObject.setCircle(radius, offsetX, offsetY);\n
    "},{"location":"arcade-gameobject/#offset","title":"Offset","text":"
    gameObject.setOffset(x, y);\n
    "},{"location":"arcade-gameobject/#push-out","title":"Push out","text":"
    scene.physics.add.collider(objectsA, objectsB);\n
    • objectsA, objectsB :
      • A game object
      • Game objects in array (Add or remove game objects)
      • Physics group (Add or remove game objects)
      • Group (Add or remove game objects)
    "},{"location":"arcade-gameobject/#callbacks","title":"Callbacks","text":"

    Add collider

    "},{"location":"arcade-gameobject/#point-inside","title":"Point inside","text":"
    var hit = gameObject.hitTest(x, y);\n
    "},{"location":"arcade-gameobject/#bounce","title":"Bounce","text":"
    • Set
      gameObject.setBounce(x, y);\n
      or
      gameObject.setBounceX(x);\ngameObject.setBounceY(y);\n
    • Get
      var bx = gameObject.body.bounce.x;\nvar by = gameObject.body.bounce.y;\n
    • Enable bounce when colliding with the world boundary
      gameObject.setCollideWorldBounds();\n
    • Disable bounce when colliding with the world boundary
      gameObject.setCollideWorldBounds(false);\n
    "},{"location":"arcade-gameobject/#mass","title":"Mass","text":"
    • Set
      gameObject.setMass(m);\n
    • Get
      var m = gameObject.body.mass;\n
    "},{"location":"arcade-gameobject/#static-game-object","title":"Static game object","text":""},{"location":"arcade-gameobject/#sync","title":"Sync","text":"

    Syncs the Bodies position and size in static game object.

    gameObject.refreshBody();\n
    "},{"location":"arcade-gameobject/#methods-of-group","title":"Methods of group","text":"
    group.setVelocity(x, y, step);\n
    group.setVelocityX(value, step);\n
    group.setVelocityY(value, step);\n
    group.refresh();  // call this method when position of game objects were changed in static object group\n
    "},{"location":"arcade-gameobject/#debug","title":"Debug","text":"
    gameObject.setDebug(showBody, showVelocity, bodyColor);\n
    gameObject.setDebugBodyColor(bodyColor);\n
    "},{"location":"arcade-tcrp-player/","title":"Player","text":""},{"location":"arcade-tcrp-player/#introduction","title":"Introduction","text":"

    Player of T ime-C ommand-R ecorder-P layer with Arcade physics engine, to run commands on time.

    • Author: Rex
    • Member of scene

    Arcade physics engine is fixed-step based, not tick time based.

    This Arcade-TCRP has better result of replaying, which store step count via WORLD_STEP(worldstep) event.

    "},{"location":"arcade-tcrp-player/#live-demos","title":"Live demos","text":"
    • Player
    "},{"location":"arcade-tcrp-player/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"arcade-tcrp-player/#install-plugin","title":"Install plugin","text":""},{"location":"arcade-tcrp-player/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexarcadetcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexarcadetcrpplugin.min.js', true);\n
    • Create instance
      var player = scene.plugins.get('rexarcadetcrpplugin').addPlayer(scene, config);\n
    "},{"location":"arcade-tcrp-player/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/arcadetcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var player = scene.plugins.get('rexTCRP').addPlayer(scene, config);\n
    "},{"location":"arcade-tcrp-player/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/arcadetcrp.js';\n
    • Create instance
      var player = new TCRP.Player(scene, config);\n
    "},{"location":"arcade-tcrp-player/#create-instance","title":"Create instance","text":"
    var player = scene.plugins.get('rexTCRP').addPlayer(scene, {\n// commands: [],       // [[time, command], [time, command], ...]\n// timeScale: 1,\n// scope: undefined\n});\n
    • commands : see next section
    • timeScale : An integer equal or larger than 1
    "},{"location":"arcade-tcrp-player/#load-commands","title":"Load commands","text":"
    player.load(commands, scope);\n
    • Commands : see also Run commands
      [\n[time, command],\n[time, command],\n...\n]\n
      • Format of each row :
        [time, fnName, param0, param1, ...]\n// [time, callback, param0, param1, ...]\n
        [time, [fnName, param0, param1, ...]]\n// [time, [callback, param0, param1, ...]]\n
        [time, [command0, command1, ...]]\n
      • time : Time in step-count
    "},{"location":"arcade-tcrp-player/#start-playing","title":"Start playing","text":"
    player.start();\n// player.start(startAt);  // Start-at time in step-count\n
    "},{"location":"arcade-tcrp-player/#events","title":"Events","text":"
    • Complete
      player.on('complete', function(player){});\n
    • Run command
      player.on('runcommand', function(commands, scope){});\n
    "},{"location":"arcade-tcrp-player/#pause-resume-stop-playing","title":"Pause, Resume, stop playing","text":"
    player.pause();\nplayer.resume();\nplayer.stop();\n
    "},{"location":"arcade-tcrp-player/#seek-elapsed-time","title":"Seek elapsed time","text":"
    player.seek(time);   // Elapsed time in step-count\n
    "},{"location":"arcade-tcrp-player/#state-of-player","title":"State of player","text":"
    var isPlaying = player.isPlaying;\nvar completed = player.completed;\nvar now = player.now;\n
    "},{"location":"arcade-tcrp-player/#time-scale","title":"Time-scale","text":"
    • Set
      player.setTimeScale(value);\n// player.timeScale = value;\n
      • timeScale : An integer equal or larger than 1
    • Get
      var timeScale = player.timeScale;\n
    "},{"location":"arcade-tcrp-recorder/","title":"Recoder","text":""},{"location":"arcade-tcrp-recorder/#introduction","title":"Introduction","text":"

    Recorder of T ime-C ommand-R ecorder-P layer with Arcade physics engine, to store commands with time.

    • Author: Rex
    • Member of scene

    Arcade physics engine is fixed-step based, not tick time based.

    This Arcade-TCRP has better result of replaying, which store step count via WORLD_STEP(worldstep) event.

    "},{"location":"arcade-tcrp-recorder/#live-demos","title":"Live demos","text":"
    • Player
    "},{"location":"arcade-tcrp-recorder/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"arcade-tcrp-recorder/#install-plugin","title":"Install plugin","text":""},{"location":"arcade-tcrp-recorder/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexarcadetcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexarcadetcrpplugin.min.js', true);\n
    • Create instance
      var recorder = scene.plugins.get('rexarcadetcrpplugin').addRecorder(scene);\n
    "},{"location":"arcade-tcrp-recorder/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/arcadetcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var recorder = scene.plugins.get('rexTCRP').addRecorder(scene);\n
    "},{"location":"arcade-tcrp-recorder/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/arcadetcrp.js';\n
    • Create instance
      var recorder = new TCRP.Recorder(scene);\n
    "},{"location":"arcade-tcrp-recorder/#create-instance","title":"Create instance","text":"
    var recorder = scene.plugins.get('rexTCRP').addRecorder(scene);\n
    "},{"location":"arcade-tcrp-recorder/#start-recording","title":"Start recording","text":"
    recorder.start();\n// recorder.start(startAt);  // start-at in step-count\n
    "},{"location":"arcade-tcrp-recorder/#push-commands","title":"Push commands","text":"
    recorder.addCommand([fnName, param0, param1, ...]);\n// recorder.addCommand([command0, command1, ...]);\n// recorder.addCommand([fnName, param0, param1, ...], offset);  // time-offset in step-count\n

    See also Run commands

    "},{"location":"arcade-tcrp-recorder/#get-commands","title":"Get commands","text":"
    var commands = recorder.getCommands();        // Get a shallow copy of commands\n// var commands = recorder.getCommands(true); // Get reference of commands\n

    Format of return commands:

    [\n[time, [command]],\n[time, [command0,command1]],\n...\n]\n
    • time : Time in step-count
    "},{"location":"arcade-tcrp-recorder/#pause-resume-stop-recording","title":"Pause, Resume, stop recording","text":"
    recorder.pause();\nrecorder.resume();\nrecorder.stop();\n
    "},{"location":"arcade-tcrp-recorder/#seek-elapsed-time","title":"Seek elapsed time","text":"
    recorder.seek(time);   // elapsed time in step-count\n
    "},{"location":"arcade-tcrp-recorder/#state-of-recorder","title":"State of recorder","text":"
    var isRecording = recorder.isRecording;\nvar now = recorder.now;\n
    • now : Now time in step-count.
    "},{"location":"arcade-tcrp-recorder/#time-scale","title":"Time-scale","text":"
    • Set
      recorder.setTimeScale(value);\n// recorder.timeScale = value;\n
      • timeScale : An integer equal or larger than 1
    • Get
      var timeScale = recorder.timeScale;\n
    "},{"location":"arcade-tcrp-step-runner/","title":"Step runner","text":""},{"location":"arcade-tcrp-step-runner/#introduction","title":"Introduction","text":"

    Execute command in next WORLD_STEP(worldstep) event, to synchronize command execution with step-counter of Recorder of Arcade-TCRP.

    • Author: Rex
    • Member of scene

    Command might be executed before or after WORLD_STEP(worldstep) event, which is emitted in scene's update event.

    • Before: Command is executed in any input(touch/keyboard) event, or in scene's preupdate event.
    • After: Command is executed in scene.updat() method.
    "},{"location":"arcade-tcrp-step-runner/#live-demos","title":"Live demos","text":"
    • Player
    "},{"location":"arcade-tcrp-step-runner/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"arcade-tcrp-step-runner/#install-plugin","title":"Install plugin","text":""},{"location":"arcade-tcrp-step-runner/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexarcadetcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexarcadetcrpplugin.min.js', true);\n
    • Create instance
      var stepRunner = scene.plugins.get('rexarcadetcrpplugin').addStepRunner(scene);\n
    "},{"location":"arcade-tcrp-step-runner/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/arcadetcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var stepRunner = scene.plugins.get('rexTCRP').addStepRunner(scene);\n
    "},{"location":"arcade-tcrp-step-runner/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/arcadetcrp.js';\n
    • Create instance
      var stepRunner = new TCRP.StepRunner(scene);\n
    "},{"location":"arcade-tcrp-step-runner/#create-instance","title":"Create instance","text":"
    var stepRunner = scene.plugins.get('rexTCRP').addStepRunner(scene);\n
    "},{"location":"arcade-tcrp-step-runner/#push-commands","title":"Push commands","text":"
    stepRunner.add(commands, scope);\n

    See also Run commands

    "},{"location":"arcade-tcrp-step-runner/#offset-recorder","title":"Offset recorder","text":"

    Since commands will be executed in next WORLD_STEP(worldstep) event, recorder have to add 1 step-count offset.

    • Offset at recording start
      recorder.start(1);\n
    • Add offset when pushing commands
      recorder.addCommand([fnName, param0, param1, ...], 1);\n
    "},{"location":"arcade-world/","title":"World","text":""},{"location":"arcade-world/#introduction","title":"Introduction","text":"

    World of Arcade physics engine in phaser.

    • Author: Richard Davey
    "},{"location":"arcade-world/#usage","title":"Usage","text":""},{"location":"arcade-world/#configuration","title":"Configuration","text":"
    var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n//    x: 0,\n//    y: 0,\n//    width: scene.sys.scale.width,\n//    height: scene.sys.scale.height,\n//    gravity: {\n//        x: 0,\n//        y: 0\n//    },\n//    checkCollision: {\n//        up: true,\n//        down: true,\n//        left: true,\n//        right: true\n//    },\n//    customUpdate: false,\n//    fixedStep: true,\n//    fps: 60,\n//    timeScale: 1,     // 2.0 = half speed, 0.5 = double speed\n//    customUpdate: false,\n//    overlapBias: 4,\n//    tileBias: 16,\n//    forceX: false,\n//    isPaused: false,\n//    debug: false,\n//    debugShowBody: true,\n//    debugShowStaticBody: true,\n//    debugShowVelocity: true,\n//    debugBodyColor: 0xff00ff,\n//    debugStaticBodyColor: 0x0000ff,\n//    debugVelocityColor: 0x00ff00,\n//    maxEntries: 16,\n//    useTree: true   // set false if amount of dynamic bodies > 5000\n}\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"arcade-world/#update","title":"Update","text":"
    • Default updating : World updating every tick
    • Custom updating :
      1. Set customUpdate of arcade config to false.
        • Enable world updating : scene.physics.enableUpdate()
        • Disable world updating : scene.physics.disableUpdate()
      2. Run world updating manually
        scene.physics.world.update(time, delta);\n
      3. Enable/disable world updating
        • Enable : scene.physics.enableUpdate()
        • Disable : scene.physics.disableUpdate()
    "},{"location":"arcade-world/#step","title":"Step","text":"
    • Advances the simulation by a single step.
      scene.physics.world.singleStep();\n
    • Advances the simulation by a time increment.
      scene.physics.world.step(delta);\n
    "},{"location":"arcade-world/#events","title":"Events","text":"
    • World step
      scene.physics.world.on('worldstep', function(delta) { /* ... */ });\n
      • delta : The delta time amount of this step, in seconds.
    "},{"location":"arcade-world/#control","title":"Control","text":""},{"location":"arcade-world/#pause","title":"Pause","text":"
    scene.physics.pause();\n
    "},{"location":"arcade-world/#resume","title":"Resume","text":"
    scene.physics.resume();\n
    "},{"location":"arcade-world/#events_1","title":"Events","text":"
    • Pause world
      scene.physics.world.on('pause', function() { /* ... */ });\n
    • Resume world
      scene.physics.world.on('resume', function() { /* ... */ });\n
    "},{"location":"arcade-world/#duration-per-frame","title":"Duration per frame","text":"
    • Time scale
      scene.physics.world.timeScale = timeScale;\n
      • 1.0 = normal speed
      • 2.0 = half speed
      • 0.5 = double speed
    • FPS
      scene.physics.world.setFPS(framerate);\n
    "},{"location":"arcade-world/#tile-filter-options","title":"Tile filter options","text":"
    var option = scene.physics.world.tileFilterOptions;\n
    • option
      {\nisColliding: true,\nisNotEmpty: true,\nhasInterestingFace: true\n}\n
    "},{"location":"arcade-world/#body","title":"Body","text":""},{"location":"arcade-world/#enable","title":"Enable","text":"
    scene.physics.world.enable(gameObject);\n// scene.physics.world.enable(gameObject, bodyType);\n
    • gameObject : A game object, or array of game objects, or game objects in a Group
    • bodyType :
      • 0 : Dynamic body. Default value.
      • 1 : Static body.

    Or

    scene.physics.add.existing(gameObject, bodyType);\n

    See arcade-body

    "},{"location":"arcade-world/#disable","title":"Disable","text":"
    scene.physics.world.disable(gameObject);\n
    • gameObject : A game object, or array of game objects, or game objects in a Group
    "},{"location":"arcade-world/#addremove-body","title":"Add/remove body","text":"
    • Add body to the local search trees.
      scene.physics.world.add(body);\n
    • Remove body from the local search trees.
      scene.physics.world.disableBody(body);\n
    "},{"location":"arcade-world/#collision","title":"Collision","text":""},{"location":"arcade-world/#set-bound","title":"Set bound","text":"

    See bound in body object, or game object.

    "},{"location":"arcade-world/#collider-callback","title":"Collider & callback","text":"
    • Add collider
      • Push out
        scene.physics.add.collider(objectsA, objectsB);\n
      • Performs a collision check and separation between the two physics enabled objects given.
        var collider = scene.physics.add.collider(objectsA, objectsB, collideCallback);\n// var collider = scene.physics.add.collider(objectsA, objectsB, collideCallback, processCallback, callbackContext);\n
      • If you don't require separation then use overlap instead.
        var collider = scene.physics.add.overlap(objectsA, objectsB, collideCallback);\n// var collider = scene.physics.add.overlap(objectsA, objectsB, collideCallback, processCallback, callbackContext);\n
      • Parameters
        • objectsA, objectsB :
          • A game object
          • An array contains Game objects (Add or remove game objects)
          • Physics group/Group (Add or remove game objects)
          • An array contains Physics group/Group
        • collideCallback :
          var collideCallback = function(gameObject1, gameObject2) {\n// ...\n}\n
        • processCallback : Fired when gameObject1 intersects gameObject2, optional.
          var processCallback = function(gameObject1, gameObject2) {\nreturn true;  // return false will discard remaining collision checking\n}\n
    • Remove collider
      scene.physics.world.removeCollider(collider);\n
    • Deactivate collider
      collider.active = false;  // Set true to activate again\n
    • Name of collider (unused by engine)
      collider.name = name;\n
    "},{"location":"arcade-world/#testing-wo-collider","title":"Testing wo collider","text":"
    • Test overlapping
      var isOverlapping = scene.physics.world.overlap(object1, object2);\n
      or
      var isOverlapping = scene.physics.world.overlap(object1, object2, collideCallback);\n// var isOverlapping = scene.physics.world.overlap(object1, object2, collideCallback, processCallback, callbackContext);\n
    • Test colliding, also push out
      var isCollided = scene.physics.world.collide(object1, object2);\n
      or
      var isCollided = scene.physics.world.collide(object1, object2, collideCallback);\n// var isCollided = scene.physics.world.collide(object1, object2, collideCallback, processCallback, callbackContext);\n
    "},{"location":"arcade-world/#events_2","title":"Events","text":"
    • Two bodies overlap and at least one of them has their onOverlap property set to true.
      scene.physics.world.on('overlap', function(gameObject1, gameObject2, body1, body2) { /* ... */ });\n
    • Two bodies overlap and at least one of them has their onCollide property set to true.
      scene.physics.world.on('collide', function(gameObject1, gameObject2, body1, body2) { /* ... */ });\n
    • A body overlaps with a Tile and has its onOverlap property set to true.
      scene.physics.world.on('tileoverlap', function(gameObject, tile, body) { /* ... */ });\n
    • A body overlaps with a Tile and has its onCollide property set to true.
      scene.physics.world.on('tilecollide', function(gameObject, tile, body) { /* ... */ });\n
    "},{"location":"arcade-world/#world-bounds","title":"World bounds","text":""},{"location":"arcade-world/#enable_1","title":"Enable","text":"
    • Body : Set body.setCollideWorldBounds() to enable worldBounds property.
    • World :
      • Set bounds rectangle and enable bounds
        scene.physics.world.setBounds(x, y, width, height);\n// scene.physics.world.setBounds(x, y, width, height, checkLeft, checkRight, checkUp, checkDown);\n
      • Set bounds rectangle
        scene.physics.world.bounds.setTo(x, y, width, height);\n
        or
        scene.physics.world.bounds.x = x;\nscene.physics.world.bounds.y = y;\nscene.physics.world.bounds.width = width;\nscene.physics.world.bounds.height = height;\n
      • Enable bounds
        scene.physics.world.setBoundsCollision();\n// scene.physics.world.setBoundsCollision(left, right, up, down);\n
        or
        scene.physics.world.checkCollision.left = left;\nscene.physics.world.checkCollision.right = right;\nscene.physics.world.checkCollision.up = up;\nscene.physics.world.checkCollision.down = down;\n
      • Get bounds rectangle
        var top = scene.physics.world.bounds.top;\nvar bottom = scene.physics.world.bounds.bottom;\nvar left = scene.physics.world.bounds.left;\nvar right = scene.physics.world.bounds.right;\n
    "},{"location":"arcade-world/#bodies-inside-an-area","title":"Bodies inside an area","text":"
    • Overlap a rectangle area
      var bodies = scene.physics.overlapRect(x, y, width, height, includeDynamic, includeStatic);\n
      • includeDynamic : Set true to search Dynamic Bodies
      • includeStatic : Set true to search Static Bodies
    • Overlap a circle area
      var bodies = scene.physics.overlapCirc(x, y, radius, includeDynamic, includeStatic);\n
      • includeDynamic : Set true to search Dynamic Bodies
      • includeStatic : Set true to search Static Bodies
    "},{"location":"arcade-world/#events_3","title":"Events","text":"
    • World bounds
      scene.physics.world.on('worldbounds', function(body, blockedUp, blockedDown, blockedLeft, blockedRight) { /* ... */ });\n
    "},{"location":"arcade-world/#wrap","title":"Wrap","text":"
    scene.physics.world.wrap(gameObject, padding);\n
    • gameObject:
      • game object
      • group
      • array of game objects
    "},{"location":"arcade-world/#move-to","title":"Move to","text":"
    • Move to position with a steady velocity
      scene.physics.moveTo(gameObject, x, y, speed, maxTime);\n
    • Move to object with a steady velocity
      scene.physics.moveToObject(gameObject, destination, speed, maxTime);\n
    "},{"location":"arcade-world/#accelerate-to","title":"Accelerate to","text":"
    • Accelerate to position
      scene.physics.accelerateTo(gameObject, x, y, acceleration, xSpeedMax, ySpeedMax);\n
    • Accelerate to object
      scene.physics.accelerateToObject(gameObject, destination, acceleration, xSpeedMax, ySpeedMax);\n
    "},{"location":"arcade-world/#gravity","title":"Gravity","text":"
    • Set
      scene.physics.world.gravity.x = gx;\nscene.physics.world.gravity.y = gy;\n
    • Get
      var gx = scene.physics.world.gravity.x;\nvar gy = scene.physics.world.gravity.y;\n

    Total Gravity = world.gravity + body.gravity

    "},{"location":"arcade-world/#bodies","title":"Bodies","text":""},{"location":"arcade-world/#closestfurthest","title":"Closest/furthest","text":"
    • Closest
      var body = scene.physics.closest(point);  // point: {x,y}\n// var body = scene.physics.closest(point, targets);\n
      • targets : Array of Arcade Physics Game Object, Body or Static Body.
    • Furthest
      var body = scene.physics.furthest(point);  // point: {x,y}\n// var body = scene.physics.furthest(point, targets);\n
      • targets : Array of Arcade Physics Game Object, Body or Static Body.
    "},{"location":"arcade-world/#debug","title":"Debug","text":""},{"location":"arcade-world/#draw-body-velocity","title":"Draw body & velocity","text":"
    • Bounds of dynamic Body
      • Enable drawing body
        scene.physics.world.defaults.debugShowBody = true;\n
      • Color
        scene.physics.world.defaults.bodyDebugColor = 0xff00ff;\n
    • Bounds of static Body
      • Enable drawing body
        scene.physics.world.defaults.debugShowStaticBody = true;\n
      • Color
        scene.physics.world.defaults.staticBodyDebugColor = 0x0000ff;\n
    • Direction and magnitude of velocity
      • Enable drawing body
        scene.physics.world.defaults.debugShowVelocity = true;\n
      • Color
        scene.physics.world.defaults.velocityDebugColor = 0x00ff00;\n
    "},{"location":"arcade-world/#graphics","title":"Graphics","text":"

    Draw debug body & velocity on a Graphics object.

    var graphics = scene.physics.world.debugGraphic;\n
    • Set visible
      scene.physics.world.debugGraphic.setVisible();\n
    • Set invisible
      scene.physics.world.debugGraphic.setVisible(false);\n
    "},{"location":"arcade-world/#update-loop","title":"Update loop","text":"
    1. scene.sys.events: update
      1. Update position & angle of each body
      2. Process each collider
      3. Update final position of each body
      4. Emit worldstep event
    2. scene.sys.events: postupdate
      1. Draw debug graphics
    graph TB\n\nSceneEventUpdate>\"scene.sys.events: update<br><br>Update arcade world<br>gameObject.preUpdate()\"]\nSceneUpdate[\"scene.update()\"]\nSceneEventPostUpdate>\"scene.sys.events: postupdate<br><br>Post update arcade world\"]\nRender\n\nSceneEventUpdate --> SceneUpdate\nSceneUpdate --> SceneEventPostUpdate\nSceneEventPostUpdate --> Render
    "},{"location":"array-addremove/","title":"Add/remove","text":""},{"location":"array-addremove/#introduction","title":"Introduction","text":"

    Add/insert/remove item(s) of an array, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"array-addremove/#usage","title":"Usage","text":""},{"location":"array-addremove/#add-item","title":"Add item","text":"
    Phaser.Utils.Array.Add(arr, item);\n// Phaser.Utils.Array.Add(arr, item, limit, callback, context);\n
    • item : An item, or an array of items.
    • limit : Optional limit which caps the size of the array.
    • callback : A callback to be invoked for each item successfully added to the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#insert-item-at","title":"Insert item at","text":"
    Phaser.Utils.Array.AddAt(arr, item, index);\n// Phaser.Utils.Array.AddAt(arr, item, index, limit, callback, context);\n
    • index : The index in the array where the item will be inserted.
    • item : An item, or an array of items.
    • limit : Optional limit which caps the size of the array.
    • callback : A callback to be invoked for each item successfully added to the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#remove-item","title":"Remove item","text":"
    Phaser.Utils.Array.Remove(arr, item);\n// Phaser.Utils.Array.Remove(arr, item, callback, context);\n
    • item : An item, or an array of items.
    • callback : A callback to be invoked for each item successfully removed from the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#remove-item-at","title":"Remove item at","text":"
    var removed = Phaser.Utils.Array.RemoveAt(arr, index);\n// var removed = Phaser.Utils.Array.RemoveAt(arr, index, callback, context);\n
    • removed : Removed item.
    • index : The array index to remove the item from. The index must be in bounds or it will throw an error.
    • callback : A callback to be invoked for each item successfully removed from the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#remove-items-between","title":"Remove items between","text":"
    var removed = Phaser.Utils.Array.RemoveBetween(arr, startIndex, endIndex);\n// var removed = Phaser.Utils.Array.RemoveBetween(arr, startIndex, endIndex, callback, context);\n
    • removed : Removed items.
    • startIndex : The start index to remove from.
    • callback : The end index to remove to.
    • callback : A callback to be invoked for each item successfully removed from the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#remove-random-item","title":"Remove random item","text":"
    var item = Phaser.Utils.Array.RemoveRandomElement(arr);\n
    "},{"location":"array-addremove/#replace-item","title":"Replace item","text":"

    Replaces an element of the array with the new element. The new element cannot already be a member of the array.

    Phaser.Utils.Array.Replace(arr, oldItem, newItem);\n
    • oldItem : An item in array.
    • newItem : Another item, which is not in array.
    "},{"location":"array-filter/","title":"Filter/Map","text":""},{"location":"array-filter/#introduction","title":"Introduction","text":"

    Built-in javascript object.

    • Author: Built-in javascript function
    "},{"location":"array-filter/#usage","title":"Usage","text":""},{"location":"array-filter/#run-function-for-each-element","title":"Run function for each element","text":"
    arr.forEach(function(element, index, arr) {\n//\n}, scope);\n
    "},{"location":"array-filter/#filter-elements","title":"Filter elements","text":"

    Creates a new array with all elements that pass the test function.

    var result = arr.filter(function(element, index, arr) {\nreturn true; // false\n}, scope);\n
    "},{"location":"array-filter/#find-one-element","title":"Find one element","text":"
    var element = arr.find(function(element, index, arr) {\nreturn true; // false\n}, scope);\n
    "},{"location":"array-filter/#map-elements-to-a-new-array","title":"Map elements to a new array","text":"
    var newArray = arr.map(function(element, index, arr) {\nreturn newElement;\n}, scope);\n
    "},{"location":"array-random/","title":"Random","text":""},{"location":"array-random/#introduction","title":"Introduction","text":"

    Random operation of an array, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"array-random/#usage","title":"Usage","text":""},{"location":"array-random/#get-random-item","title":"Get random item","text":"
    var item = Phaser.Utils.Array.GetRandom(arr);\n// var item = Phaser.Utils.Array.GetRandom(arr, startIndex, length);\n
    "},{"location":"array-random/#remove-random-item","title":"Remove random item","text":"
    var item = Phaser.Utils.Array.RemoveRandomElement(arr);\n// var item = Phaser.Utils.Array.RemoveRandomElement(arr, startIndex, length);\n
    "},{"location":"array-random/#shuffle","title":"Shuffle","text":"
    var arr = Phaser.Utils.Array.Shuffle(arr);\n
    "},{"location":"array-sort/","title":"Sort","text":""},{"location":"array-sort/#introduction","title":"Introduction","text":"

    Array sorting, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"array-sort/#usage","title":"Usage","text":""},{"location":"array-sort/#built-in-array-sort","title":"Built-in array sort","text":"
    var out = arr.sort(compareFunction);\n
    • compareFunction : A function that defines an alternative sort order.
      function(a, b) {\n// return a - b;\n}\n
      • Return a negative value
      • Return 0
      • Return a positive value
    "},{"location":"array-sort/#stable-array-sort","title":"Stable array sort","text":"
    var out = Phaser.Utils.Array.StableSort(arr, compareFunction);\n
    "},{"location":"array-sort/#shuffle","title":"Shuffle","text":"
    var arr = Phaser.Utils.Array.Shuffle(arr);\n
    "},{"location":"array-sort/#move-item","title":"Move item","text":"
    • Moves the given element to the top of the array.
      Phaser.Utils.Array.BringToTop(arr, item);\n
    • Moves the given element to the bottom of the array.
      Phaser.Utils.Array.SendToBack(arr, item);\n
    • Moves the given array element up.
      Phaser.Utils.Array.MoveUp(array, item);\n
    • Moves the given array element down.
      Phaser.Utils.Array.MoveDown(array, item);\n
    • Moves an element in an array to a new position.
      Phaser.Utils.Array.MoveTo(array, item, index);\n
    • Swaps the position of two elements.
      Phaser.Utils.Array.Swap(array, item1, item2);\n
    • Moves the element at the start of the array to the end, shifting all items in the process.
      Phaser.Utils.Array.RotateLeft(array, steps);\n
      • steps : The number of times to shift the array.
    • Moves the element at the end of the array to the start, shifting all items in the process.
      Phaser.Utils.Array.RotateRight(array, steps);\n
      • steps : The number of times to shift the array.
    "},{"location":"audio/","title":"Audio","text":""},{"location":"audio/#introduction","title":"Introduction","text":"

    Play sounds, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"audio/#usage","title":"Usage","text":""},{"location":"audio/#configuration","title":"Configuration","text":""},{"location":"audio/#web-audio","title":"Web audio","text":"

    Web audio is the default audio context.

    "},{"location":"audio/#html5-audio","title":"Html5 audio","text":"
    var config = {\n// ....\naudio: {\ndisableWebAudio: true\n}\n// ....\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"audio/#no-audio","title":"No audio","text":"
    var config = {\n// ....\naudio: {\nnoAudio: true\n}\n// ....\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"audio/#load-audio-file","title":"Load audio file","text":"
    scene.load.audio(key, urls);  // urls: an array of file url\n// scene.load.audio(key, urls, {instances: 1}, xhrSettings);\n

    See loader

    "},{"location":"audio/#decode-audio","title":"Decode audio","text":"
    scene.sound.decodeAudio(key, audioData);\n
    • audioData : Audio data
      • A base64 encoded string
      • An audio media-type data uri
      • An ArrayBuffer instance

    Or

    scene.sound.decodeAudio(audioFiles);\n
    • audioFiles : An array of {key, data}
      • data : Audio data
        • A base64 encoded string
        • An audio media-type data uri
        • An ArrayBuffer instance
    "},{"location":"audio/#decoded-events","title":"Decoded events","text":"
    • Finished decoding an audio data
      scene.sound.on('decoded', key);\n
    • Finished decoding all audio data
      scene.sound.on('decodedall');\n
    "},{"location":"audio/#unlock-audio","title":"Unlock audio","text":"

    Unlocks Web Audio API/HTML5 Audio loading on the initial input event.

    scene.sound.unlock();\n
    "},{"location":"audio/#play-sound","title":"Play sound","text":"

    Sound instance will be destroyed when playback ends.

    scene.sound.play(key);\n

    or

    scene.sound.play(key, config);\n/*\nvar sound = scene.sound.add(key);\nsound.play(config);\n*/\n
    "},{"location":"audio/#position-of-the-spatial-audio-listener","title":"Position of the Spatial Audio listener","text":"
    scene.sound.setListenerPosition(x, y)\n
    • x, y : The x/y position of the Spatial Audio listener. Default value is center of the game canvas.

    Note

    Web audio only

    "},{"location":"audio/#sound-instance","title":"Sound instance","text":""},{"location":"audio/#create-sound-instance","title":"Create sound instance","text":"
    var music = scene.sound.add(key);\n
    var music = scene.sound.add(key, config);\n
    "},{"location":"audio/#configuration_1","title":"Configuration","text":"
    {\nmute: false,\nvolume: 1,\nrate: 1,\ndetune: 0,\nseek: 0,\nloop: false,\ndelay: 0,\n\n// source of the spatial sound\nsource: {\nx: 0,\ny: 0,\nz: 0,\npanningModel: 'equalpower',\ndistanceModel: 'inverse',\norientationX: 0,\norientationY: 0,\norientationZ: -1,\nrefDistance: 1,\nmaxDistance: 10000,\nrolloffFactor: 1,\nconeInnerAngle: 360,\nconeOuterAngle: 0,\nconeOuterGain: 0,\nfollow: undefined\n}\n}\n
    • source : Source of the spatial sound
      • x, y : The horizontal/vertical position of the audio in a right-hand Cartesian coordinate system.
      • z : Represents the longitudinal (back and forth) position of the audio in a right-hand Cartesian coordinate system.
      • panningModel : An enumerated value determining which spatialization algorithm to use to position the audio in 3D space.
        • 'equalpower'
        • 'HRTF'
      • orientationX, orientationY : The horizontal/vertical position of the audio source's vector in a right-hand Cartesian coordinate system.
      • orientationZ : Represents the longitudinal (back and forth) position of the audio source's vector in a right-hand Cartesian coordinate system.
      • refDistance : A double value representing the reference distance for reducing volume as the audio source moves further from the listener. For distances greater than this the volume will be reduced based on rolloffFactor and distanceModel.
      • maxDistance : The maximum distance between the audio source and the listener, after which the volume is not reduced any further.
      • rolloffFactor : A double value describing how quickly the volume is reduced as the source moves away from the listener. This value is used by all distance models.
      • coneInnerAngle : The angle, in degrees, of a cone inside of which there will be no volume reduction.
      • coneOuterAngle : The angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the coneOuterGain property.
      • coneOuterGain : The amount of volume reduction outside the cone defined by the coneOuterAngle attribute. Its default value is 0, meaning that no sound can be heard. A value between 0 and 1.
      • follow : Set this Sound object to automatically track the x/y position of this object. Can be a Phaser Game Object, Vec2 or anything that exposes public x/y properties.
    "},{"location":"audio/#play-sound-instance","title":"Play sound instance","text":"
    • Start playing
      music.play();\n
    • Start playing with configuration
      music.play(config);\n
      • config
    • Stop
      music.stop();\n
    • Pause
      music.pause();\n
    • Resume
      music.resume();\n
    "},{"location":"audio/#methods","title":"Methods","text":""},{"location":"audio/#mute","title":"Mute","text":"
    • Set
      music.setMute(mute); // mute: true/false\n// music.mute = mute;\n
    • Get
      var mute = music.mute;\n
    "},{"location":"audio/#volume","title":"Volume","text":"
    • Set
      music.setVolume(volume); // volume: 0 to 1\n// music.volume = volume;\n
    • Get
      var volume = music.volume;\n
    "},{"location":"audio/#detune","title":"Detune","text":"
    • Set
      music.setDetune(detune); // detune: -1200 to 1200\n// music.detune = detune;\n
    • Get
      var detune = music.detune;\n
    "},{"location":"audio/#play-rate","title":"Play-rate","text":"
    • Set
      music.setRate(rate); // rate: 1.0(normal speed), 0.5(half speed), 2.0(double speed)\n// music.rate = rate;\n
    • Get
      var rate = music.rate;\n
    "},{"location":"audio/#seek-to","title":"Seek to","text":"
    • Seek to
      music.setSeek(time); // seek: playback time\n// music.seek = seek;\n
    • Get current playback time
      var time = music.seek;  // return 0 when playback ends\n
    "},{"location":"audio/#loop","title":"Loop","text":"
    • Set
      music.setLoop(loop); // loop: true/false\n// music.loop = loop;\n
    • Get
      var loop = music.loop;\n
    "},{"location":"audio/#properties","title":"Properties","text":"
    • Duration : duration of this sound
      var duration = music.duration;\n
    • Is playing
      var isPlaying = music.isPlaying;\n
    • Is paused
      var isPaused = music.isPaused;\n
    • Asset key
      var key = music.key;\n
    "},{"location":"audio/#events","title":"Events","text":"
    • Start playing
      music.once('play', function(music){});\n
    • Playback end
      music.once('complete', function(music){});\n
    • Looping
      music.once('looped', function(music){});\n
    • Pause
      music.once('pause', function(music){});\n
    • Resume
      music.once('resume', function(music){});\n
    • Stop
      music.once('stop', function(music){});\n
    • Set mute
      music.once('mute', function(music, mute){});\n
    • Set volume
      music.once('volume', function(music, volume){});\n
    • Set detune
      music.once('detune', function(music, detune){});\n
    • Set play-rate
      music.once('rate', function(music, rate){});\n
    • Seek to
      music.once('seek', function(music, time){});\n
    • set loop
      music.once('loop', function(music, loop){});\n
    "},{"location":"audio/#play-marked-sound","title":"Play marked sound","text":"

    Sound instance will be destroyed when playback ends.

    scene.sound.play(key, marker);\n
    "},{"location":"audio/#marker","title":"Marker","text":"
    {\nname: '',\nstart: 0,\nduration: music.duration,\nconfig: {\nmute: false,\nvolume: 1,\nrate: 1,\ndetune: 0,\nseek: 0,\nloop: false,\ndelay: 0\n}\n}\n
    "},{"location":"audio/#markers-in-sound-instance","title":"Markers in sound instance","text":""},{"location":"audio/#add-marker","title":"Add marker","text":"
    music.addMarker(marker);\n

    Marker

    "},{"location":"audio/#play-marked-sound_1","title":"Play marked sound","text":"
    music.play(markerName);\n
    music.play(markerName, config);\n

    config

    "},{"location":"audio/#audio-sprite","title":"Audio sprite","text":""},{"location":"audio/#load-audio-sprite","title":"Load audio sprite","text":"
    scene.load.audioSprite(key, urls, markersConfig, config);\n

    See loader

    Format of markersConfig

    {\nresources: urls, // an array of audio files\nspritemap: {\nmarkerName0: {\nstart: 0,\nend: 0\n},\nmarkerName1: {\nstart: 0,\nend: 0\n}\n// ...\n}\n}\n

    "},{"location":"audio/#play-sound_1","title":"Play sound","text":"

    Create a sound instance then play the marked section, this sound instance will be destroyed when playback ends.

    scene.sound.playAudioSprite(key, markerName, config);\n

    config

    "},{"location":"audio/#sound-instance_1","title":"Sound instance","text":"

    Create a sound instance with markers.

    var music = scene.sound.addAudioSprite(key, config);\n

    config

    "},{"location":"audio/#play-sound-instance_1","title":"Play sound instance","text":"
    music.play(markerName);\n
    music.play(markerName, config);\n

    config

    "},{"location":"audio/#sound-manager","title":"Sound manager","text":""},{"location":"audio/#mute_1","title":"Mute","text":"
    • Set
      scene.sound.setMute(mute); // mute: true/false\n// scene.sound.mute = mute;\n
    • Get
      var mute = scene.sound.mute;\n
    "},{"location":"audio/#volume_1","title":"Volume","text":"
    • Set
      scene.sound.setVolume(volume); // volume: 0 to 1\n// scene.sound.volume = volume;\n
    • Get
      var volume = scene.sound.volume;\n
    "},{"location":"audio/#detune_1","title":"Detune","text":"
    • Set
      scene.sound.setDetune(detune); // detune: -1200 to 1200\n// scene.sound.detune = detune;\n
    • Get
      var detune = scene.sound.detune;\n
    "},{"location":"audio/#play-rate_1","title":"Play-rate","text":"
    • Set
      scene.sound.setRate(rate); // rate: 1.0(normal speed), 0.5(half speed), 2.0(double speed)\n// scene.sound.rate = rate;\n
    • Get
      var rate = scene.sound.rate;\n
    "},{"location":"audio/#get-music-instance","title":"Get music instance","text":"
    • Get first by key
      var music = scene.sound.get(key); // music instance, or null\n
    • Get all by key
      var musicArray = scene.sound.getAll(key); // music instance, or null\n
    • Get all
      var musicArray = scene.sound.getAll();\n
    • Get all playing
      var musicArray = scene.sound.getAllPlaying();\n
    "},{"location":"audio/#is-playing","title":"Is playing","text":"
    • Is any sound playing
      var isPlaying = scene.sound.isPlaying();\n
    • Is any sound playing by key
      var isPlaying = scene.sound.isPlaying(key);\n
    "},{"location":"audio/#remove-music-instance","title":"Remove music instance","text":"
    • Remove by key
      var removed = scene.sound.removeByKey(key);\n
      • removed : The number of matching sound objects that were removed.
    • Remove all
      scene.sound.removeAll();\n
    "},{"location":"audio/#stop-music-instance","title":"Stop music instance","text":"
    • Stop by key
      var stopped = scene.sound.stopByKey(key);\n
      • stopped : How many sounds were stopped.
    • Stop all
      scene.sound.stopAll();\n
    "},{"location":"audio/#analyser","title":"Analyser","text":"

    Analyser node is only available in Web audio mode.

    1. Create analyser node
      var analyser = scene.sound.context.createAnalyser();\n
    2. Configure analyser node
      analyser.smoothingTimeConstant = 1;\nanalyser.fftSize = 8192;\nanalyser.minDecibels = -90;\nanalyser.maxDecibels = -10;\n
      • smoothingTimeConstant : Averaging constant with the last analysis frame.
        • 0(no time averaging) ~ 1. Default value is 0.8.
      • fftSize : Window size.
        • 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768. Defaults to 2048.
      • minDecibels : Minimum decibel value for scaling the FFT analysis data.
        • 0 dB is the loudest possible sound, -10 dB is a 10th of that, etc. The default value is -100 dB
      • maxDecibels : Maximum decibel value for scaling the FFT analysis data.
        • The default value is -30 dB.
    3. Set source of analyser node
      • Global volume nodee -> analyser node
        scene.sound.masterVolumeNode.connect(analyser);\n
      • A sound instance -> analyser node
        music.volumeNode.connect(analyser);\n
    4. Ouput analyser node to audio context
      analyser.connect(scene.sound.context.destination);\n
    5. Create output data array
      var dataArrayLength = analyser.frequencyBinCount;\nvar dataArray = new Uint8Array(dataArrayLength);\n
    6. Get output data
      analyser.getByteTimeDomainData(dataArray);\n
      • Retrieve output data
        for(var i= 0; i < dataArrayLength; i++) {\nvar data = dataArray[i];\n}\n
    "},{"location":"awaitloader/","title":"Await loader","text":""},{"location":"awaitloader/#introduction","title":"Introduction","text":"

    Await custom task in preload stage.

    • Author: Rex
    • Custom File of loader
    "},{"location":"awaitloader/#live-demos","title":"Live demos","text":"
    • Wait 1000ms
    "},{"location":"awaitloader/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"awaitloader/#install-plugin","title":"Install plugin","text":""},{"location":"awaitloader/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      var sceneConfig = {\n// ....\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'rexawaitloaderplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/    rexawaitloaderplugin.min.js',\nstart: true\n}]\n}\n};\nclass MyScene extends Phaser.Scene {\nconstructor() {\nsuper(sceneConfig)\n}\n// ....\n\npreload() {\n// rexawaitloaderplugin will be installed before preload(), but not added to loader yet\n// Call addToScene(scene) to add this await loader to loader of this scene\nthis.plugins.get('rexawaitloaderplugin').addToScene(this);\n\nthis.load.rexAwait(function(successCallback, failureCallback) { // successCallback()\n});\n}\n}\n
    "},{"location":"awaitloader/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AwaitLoaderPlugin from 'phaser3-rex-plugins/plugins/awaitloader-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAwaitLoader',\nplugin: AwaitLoaderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In preload stage
      scene.load.rexAwait(function(successCallback, failureCallback) { // successCallback()\n});\n
    "},{"location":"awaitloader/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Awaitloader from 'phaser3-rex-plugins/plugins/awaitloader.js';\n
    • Start loading task
      Awaitloader.call(scene.load, function(successCallback, failureCallback) {\n// successCallback();\n}, scope)\n
    "},{"location":"awaitloader/#start-loading-task","title":"Start loading task","text":"

    In preload stage:

    scene.load.rexAwait(function(successCallback, failureCallback) {\n// successCallback();\n}, scope);\n

    or

    var callback = function(successCallback, failureCallback) {\n// successCallback();\n};\nscene.load.rexAwait(key, {\ncallback: callback,\n// scope: scope\n});\n
    1. This plugin runs callback to start custom task.
    2. Calls successCallback when custom task completed, or failureCallback if error.
    "},{"location":"awaytime/","title":"Away time","text":""},{"location":"awaytime/#introduction","title":"Introduction","text":"

    Get time from previous closing application to now.

    • Author: Rex
    • Standalone object
    "},{"location":"awaytime/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"awaytime/#install-plugin","title":"Install plugin","text":""},{"location":"awaytime/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexawaytimeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexawaytimeplugin.min.js', true);\n
    • Get away-time
      var awayTime = scene.plugins.get('rexawaytimeplugin').awayTime;\n
    "},{"location":"awaytime/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AwayTimePlugin from 'phaser3-rex-plugins/plugins/awaytime-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAwayTime',\nplugin: AwayTimePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Get away-time
      var awayTime = scene.plugins.get('rexAwayTime').awayTime;\n
    "},{"location":"awaytime/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import AwayTime from 'phaser3-rex-plugins/plugins/awaytime.js';\n
    • Get away-time
      var awayTime = (new AwayTime()).awayTime;\n
    "},{"location":"awaytime/#default-away-timer","title":"Default away-timer","text":""},{"location":"awaytime/#get-away-time","title":"Get away-time","text":"
    var awayTime = scene.plugins.get('rexAwayTime').awayTime;\n// var awayTime = scene.plugins.get('rexAwayTime').setKey(key).setPeriod(time).awayTime;\n
    • awayTime : Time in millisecond.
    • key : Save curent time-stamp in key of localstorage. Default value is 'away'.
    • time : Period of saving current time-stamp. Default value is 1000.

    Note

    This action also starts saving current time-stamp periodically into localstorage.

    "},{"location":"awaytime/#set-key","title":"Set key","text":"
    scene.plugins.get('rexAwayTime').setKey(key);\n
    • key : Save curent time-stamp in key of localstorage
    "},{"location":"awaytime/#set-period","title":"Set period","text":"
    scene.plugins.get('rexAwayTime').setPeriod(time);\n
    • time : Period of saving current time-stamp.
    "},{"location":"awaytime/#add-away-timer-object","title":"Add away timer object","text":"
    var awayTimer = scene.plugins.get('rexAwayTime').add({\nkey: 'away',\nperiod: 1000\n})\n
    "},{"location":"awaytime/#get-away-time_1","title":"Get away-time","text":"
    var awayTime = awayTimer.awayTime;\n

    Will also start timer.

    "},{"location":"awaytime/#stop-timer","title":"Stop timer","text":"
    awayTimer.stop();\n
    "},{"location":"base64/","title":"Base64","text":""},{"location":"base64/#introduction","title":"Introduction","text":"

    Decode a base64 string to an array buffer, or create a base64 string from an array buffer, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"base64/#usage","title":"Usage","text":""},{"location":"base64/#base64-array-buffer","title":"Base64 -> Array buffer","text":"
    var arrayBuffer = Phaser.Utils.Base64.Base64ToArrayBuffer(base64);\n
    "},{"location":"base64/#array-buffer-base64","title":"Array buffer -> Base64","text":"
    var base64 = Phaser.Utils.Base64.ArrayBufferToBase64(arrayBuffer, mediaType);\n
    • mediaType : An optional media type, i.e. audio/ogg or image/jpeg
    "},{"location":"bbcodetext/","title":"BBCode Text","text":""},{"location":"bbcodetext/#introduction","title":"Introduction","text":"

    Drawing text with BBCode protocol.

    • Author: Rex
    • Game object
    "},{"location":"bbcodetext/#live-demos","title":"Live demos","text":"
    • BBCode text
    • Hit area of words
    • Align
    • Escape
    • Page, typing
    • Wrap
      • Mix wrap
    • Font family
    • Measure margin of text
    • Generate texture
    • Image height
    • RTL
    "},{"location":"bbcodetext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bbcodetext/#install-plugin","title":"Install plugin","text":""},{"location":"bbcodetext/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbbcodetextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbbcodetextplugin.min.js', true);\n
    • Add text object
      var txt = scene.add.rexBBCodeText(x, y, content, config);\n
    "},{"location":"bbcodetext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BBCodeTextPlugin from 'phaser3-rex-plugins/plugins/bbcodetext-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBBCodeTextPlugin',\nplugin: BBCodeTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text object
      var txt = scene.add.rexBBCodeText(x, y, content, config);\n
    "},{"location":"bbcodetext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BBCodeText from 'phaser3-rex-plugins/plugins/bbcodetext.js';\n
    • Add text object
      var txt = new BBCodeText(scene, x, y, content, config);\nscene.add.existing(txt);\n
    "},{"location":"bbcodetext/#bbcode","title":"BBCode","text":"
    • Bold : [b]text[/b]
    • Weight : [weight=900]text[/weight]
      • Valid when text does not have bold tag.
    • Italic : [i]text[/i]
    • Color :
      • [color=red]text[/color]
      • [color=#FF0000]text[/color]
      • [color=rgb(255,0,0)]text[/color]
      • [color=rgba(255,0,0,1)]text[/color]
    • Size : [size=18]text[/size]
    • Family : [family=papyrus]text[/family]
    • Stroke : [stroke]text[/stroke]
      • Stroke with color setting : [stroke=red]text[/stroke]
    • Shadow : [shadow]text[/shadow]
      • Shadow with color setting : [shadow=red]text[/shadow]
    • Underline : [u]text[/u]
      • Underline with color setting : [u=red]text[/u]
    • Strikethrough : [s]text[/s]
      • Strikethrough with color setting : [s=red]text[/s]
    • Background color :
      • [bgcolor=red]text[/bgcolor]
      • [bgcolor=#FF0000]text[/bgcolor]
      • [bgcolor=rgb(255,0,0)]text[/bgcolor]
      • [bgcolor=rgba(255,0,0,1)]text[/bgcolor]
    • Superscript, subscript : [y=-12]text[y]
    • Image : [img=imgKey]
    • Hit area of words : [area=key]text[/area]
    • Url link : [url=http...]text[/url]
      • Click this area to open web page on a new tab (window.open(url, '_blank'))
      • Will register hit area with key url:http...
    • Line alignment :
      • [align=left]text[/align],
      • [align=center]text[/align],
      • [align=right]text[/align]
    • Escape : Tags between [esc] ... [/esc] or [raw] ... [/raw] will be treated as content.
      • [esc][color=yellow]Text[/color][/esc]
      • [esc][raw]Text[/raw][/esc]
      • [raw][esc]Text[/esc][/raw]
      • [raw][b]Text[/b][/raw]
    • Do nothing, just a marker :
      • [id=0][color=red]Text[/id]TextText[/color]

    Note

    Can set delimiter [] to another custom value in style of constructor.

    "},{"location":"bbcodetext/#add-text-object","title":"Add text object","text":"
    var txt = scene.add.rexBBCodeText(x, y, '[b]h[/b]ello');\n// var txt = scene.add.rexBBCodeText(x, y, '[b]h[/b]ello', { fontFamily: 'Arial', fontSize: 64, color: '#00ff00' });\n

    Default style

    {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,  // null, css string, or number\nbackgroundColor2: null,  // null, css string, or number\nbackgroundHorizontalGradient: true,\nbackgroundStrokeColor: null,  // null, css string, or number\nbackgroundStrokeLineWidth: 2,\n\nbackgroundCornerRadius: 0,  // 0   : no round corner, \n// > 0 : convex round corner\n// < 0 : concave round corner\n\nbackgroundCornerIteration: null,    color: '#fff',  // null, css string, or number\nstroke: '#fff',  // null, css string, or number\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',  // css string, or number\nblur: 0,\nstroke: false,\nfill: false\n},\nunderline: {\ncolor: '#000',  // css string, or number\nthickness: 0,\noffset: 0\n},\nstrikethrough: {\ncolor: '#000',  // css string, or number\nthickness: 0,\noffset: 0\n},\n// align: 'left',  // Equal to halign\nhalign: 'left', // 'left'|'center'|'right'\nvalign: 'top',  // 'top'|'center'|'bottom'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\ntestString: '|M\u00c9qgy',\n\nwrap: {\nmode: 'none',     // 0|'none'|1|'word'|2|'char'|'character'|3|'mix'\nwidth: null\n},\n// wordWrap: { width: 0 },   // Compatible with Text game object\n\n// rtl: false,\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n\n// images: {\n//     imgKey: {y: -8}\n// },\n\n// delimiters: '[]',\n\n// sharedPool: true,\n\n// urlTagCursorStyle: 'pointer',\n// interactive: false\n}\n

    or

    var txt = scene.add.rexBBCodeText({\nx: 0,\ny: 0,\ntext: '',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',\nbackgroundColor: '#ff00ff',\n// ...\n},\n})\n

    or

    var txt = scene.make.rexBBCodeText({\nx: 0,\ny: 0,\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n//x: 32,    // 32px padding on the left/right\n//y: 16     // 16px padding on the top/bottom\n},\ntext: 'Text\\nGame Object\\nCreated from config',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',\nbackgroundColor: '#ff00ff',\n// ...\n},\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    • Alignment
      • halign, or align : Horizontal alignment.
        • 'left', 'center', 'right'
      • valign : Vertical alignment.
        • 'top', 'center', 'bottom'
    • images : See Image
    • delimiters : Delimiters of tags, default value is [].
      • Don't use () as delimiters, which is preserved for color value.
    • sharedPool :
      • true : Use shared resouce pools during game. Default behavior.
      • false : Use local resource pools, will be free when game object destroying.
    • urlTagCursorStyle : Cursor style when cursor moving over a url tag. Default value is 'pointer'.
    • interactive :
      • true : Invoke txt.setInteractive() for hit-area tag, or url tag.
      • false : Do nothing. Default behavior.
    "},{"location":"bbcodetext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends BBCodeText {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, '[b]h[/b]ello');\n
    "},{"location":"bbcodetext/#wrap","title":"Wrap","text":"
    • Wrap by word or character.
      var txt = scene.make.rexBBCodeText({\nx: 400,\ny: 100,\ntext: 'The sky above the port was the color of television, tuned to a dead channel.',\norigin: { x: 0.5, y: 0.5 },\nstyle: {\nfont: 'bold 25px Arial',\nfill: 'white',\nwrap: {\nmode: 'none',    // 0|'none'|1|'word'|2|'char'|'character'|3|'mix'\nwidth: 0\n}\n}\n});\n
      • wrap.mode :
        • 0, or 'none' : No wrapping, default behavior.
        • 1, or 'word' : Word wrapping.
        • 2, or 'char', or 'character' : Character wrapping.
        • 3, or 'mix' : Word wrapping for ASCII word, Character wrapping for other (unicode) word.
      • wrap.width : Maximun wrapping width of a line.
        • Wrap-fit : Set wrapping width to fixedWidth - padding.left - padding.right if fixedWidth > 0
    • Wrap mode
      • Get
        var mode = txt.style.wrapMode;\n
      • Set
        txt.setWrapMode(mode);\n
        • 0, or 'none' : No wrapping.
        • 1, or 'word' : Word wrapping.
        • 2, or 'char', or 'character' : Character wrapping.
        • 3, or 'mix' : Word wrapping for ASCII word, Character wrapping for other (unicode) word.
    • Wrap width
      • Get
        var width = txt.style.wrapWidth;\n
      • Set
        txt.setWrapWidth(width);\n// txt.setWordWrapWidth(width);\n
        • width : Maximun wrapping width of a line.
          • Wrap-fit : Set wrapping width to fixedWidth - padding.left - padding.right if fixedWidth > 0
    "},{"location":"bbcodetext/#content","title":"Content","text":"
    • Get source text
      var curContent = txt.text;\n
    • Get plain text
      var plainText = txt.getPlainText();\n
      var plainText = txt.getPlainText(content);\n
    • Get sub-string
      var text = txt.getText(start, end);\n
    • Get wrapped lines
      var linesArray = txt.getWrappedText();\n
      var linesArray = txt.getWrappedText(content);\n
    • Set
      txt.setText('[b]h[/b]ello');\n// txt.text = '[b]h[/b]ello';\n
    • Append
      txt.appendText(text);\n// txt.text += '\\n' + text;\n
      or
      txt.appendText(text, false);\n// txt.text += text;\n
    "},{"location":"bbcodetext/#set-style","title":"Set style","text":"
    txt.setStyle(style);\ntxt.setFont(font);  // font: {fontFamily, fontSize, fontStyle}\ntxt.setFontFamily(family);\ntxt.setFontSize(size);\ntxt.setFontStyle(style);\n
    "},{"location":"bbcodetext/#color","title":"Color","text":"
    • Text color
      • Get
        var color = txt.style.color;\n
      • Set
        txt.setColor(color);\n
        or
        txt.setFill(color);\n
        • color : null, css string, or number.
    • Stroke color, thickness
      • Get
        var color = txt.style.stroke;\nvar thickness = txt.style.strokeThickness;\n
      • Set
        txt.setStroke(color, thickness);\n
        • color : null, css string, or number.
      • Clear
        txt.setStroke();\n
    • Underline color, thickness
      • Get
        var color = txt.style.underlineColor;\nvar thickness = txt.style.underlineThickness;\nvar offset = txt.style.underlineOffset;\n
      • Set
        txt.setUnderline(color, thickness, ofset);\ntxt.setUnderlineColor(color);\ntxt.setUnderlineThinkness(thickness);\ntxt.setUnderlineOffset(ofset);\n
        • color : null, css string, or number.
    • Strikethrough color, thickness
      • Get
        var color = txt.style.strikethroughColor;\nvar thickness = txt.style.strikethroughThickness;\nvar offset = txt.style.strikethroughOffset;\n
      • Set
        txt.setStrikethrough(color, thickness, ofset);\ntxt.setStrikethroughColor(color);\ntxt.setStrikethroughThinkness(thickness);\ntxt.setStrikethroughOffset(ofset);\n
        • color : null, css string, or number.
    • Background
      • Color, or gradient color
        • Get
          var color = txt.style.backgroundColor;\nvar color2 = txt.style.backgroundColor2;\nvar isHorizontalGradient = txt.style.backgroundHorizontalGradient;\n
        • Set
          txt.setBackgroundColor(color);\n// txt.setBackgroundColor(color, color2, isHorizontalGradient);\n
          • color, color2 : null, css string, or number.
      • Stroke color
        • Get
          var color = txt.style.backgroundStrokeColor;\nvar lineWidth = txt.style.backgroundStrokeLineWidth;\n
        • Set
          txt.setBackgroundStrokeColor(color, lineWidth);\n
          • color : null, css string, or number.
      • Round rectangle
        • Get
          var radius = txt.style.backgroundCornerRadius;\nvar iteration = txt.style.backgroundCornerIteration;\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
        • Set
          txt.setBackgroundCornerRadius(radius);\n// txt.setBackgroundCornerRadius(radius, iteration);\n
          • iteration :
            • undefined : Round rectangle
            • 0 : Octagon
    • Shadow
      • Get
        var color = txt.style.shadowColor;\nvar offsetX = txt.style.shadowOffsetX;\nvar offsetY = txt.style.shadowOffsetY;\nvar blur = txt.style.shadowBlur;\nvar stroke = txt.style.shadowStroke;\nvar enabled = txt.style.shadowFill;\n
      • Set
        txt.setShadow(x, y, color, blur, shadowStroke, shadowFill);\ntxt.setShadowOffset(x, y);\ntxt.setShadowColor(color);\ntxt.setShadowBlur(blur);\ntxt.setShadowStroke(enabled);\ntxt.setShadowFill(enabled);\n
        • color : null, css string, or number.
    "},{"location":"bbcodetext/#align","title":"Align","text":"
    • Horizontal align
      • Get
        var align = txt.style.halign;\n
        • align : 'left', 'center', 'right'
      • Set
        txt.setHAlign(align);    
        or
        txt.setAlign(align);    
        • align : 'left', 'center', 'right'
    • Vertical align
      • Get
        var align = txt.style.valign;\n
        • align : 'top', 'center', 'bottom'
      • Set
        txt.setVAlign(align);    
        • align : 'top', 'center', 'bottom'
    "},{"location":"bbcodetext/#image","title":"Image","text":"
    • Uses texture key as image key by default.
    • Add image render information
      txt.addImage(imgKey, {\nkey: textureKey,\nframe: frameName,\nwidth: undefined,\nheight: undefined,\ny: 0,\nleft: 0,\nright: 0,\noriginX: 0,\noriginY: 0,\ntintFill: false,\n});\n
      • imgKey : Image key used in text content, i.e. [img=imgKey].
      • key : Texture key.
      • frame : Frame name.
      • width : Render width, set undefined to use the cut width of frame.
      • height : Render height, set undefined to use the cut height of frame.
      • y : Extra offset y.
      • left : Left padding space.
      • Right : Right padding space.
      • originX : Offset x via frame width * originX
      • originY : Offset y via frame height * originY
      • tintFill :
        • false : Keep original color. Default behavior.
        • true : Change fill-color by color tag. [color=...][img=...].
    • Add some image render informations
      txt.addImage(data);\n
      • data : {imgKey, config}
    "},{"location":"bbcodetext/#hit-area-of-words","title":"Hit area of words","text":"

    Size of hit-area is word-width x line-height, or image-width x line-height.

    "},{"location":"bbcodetext/#hitting-events","title":"Hitting events","text":"
    • Pointer down
      txt.on('areadown', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areadown-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer click : pointer down then up, without pointer out
      txt.on('areaclick', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaclick-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer up
      txt.on('areaup', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaup-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer over
      txt.on('areaover', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaover-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer out
      txt.on('areaout', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaout-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    "},{"location":"bbcodetext/#draw-hit-areas","title":"Draw hit-areas","text":"
    txt.drawAreaBounds(graphics, color);\n
    • graphics : Graphics game object
    • color : Default value is 0xffffff
    "},{"location":"bbcodetext/#line-spacing","title":"Line spacing","text":"

    This value is added to the height of the font when calculating the overall line height.

    • Get
      var lineSpacing = txt.style.lineSpacing;\n
    • Set
      txt.setLineSpacing(value);\n
    "},{"location":"bbcodetext/#padding","title":"Padding","text":"
    • Get
      var left = txt.padding.left;\nvar top = txt.padding.top;\nvar right = txt.padding.right;\nvar bottom = txt.padding.bottom;\n
    • Set
      txt.setPadding(left, top, right, bottom);\n// txt.setPadding(padding); // padding: {left, top, right, bottom}\n
    "},{"location":"bbcodetext/#max-lines","title":"Max lines","text":"
    • Get
      var maxLines = txt.style.maxLines;\n
    • Set
      txt.setMaxLines(max);\n
    "},{"location":"bbcodetext/#fixed-size","title":"Fixed size","text":"
    • Get
      var width = txt.style.fixedWidth;\nvar height = txt.style.fixedHeight;\n
    • Set
      txt.setFixedSize(width, height);\n
    "},{"location":"bbcodetext/#margin-of-text","title":"Margin of text","text":"
    var leftMargin = txt.measureTextMargins(testString).left;\n
    • testString : Measure left margin of this text.
    "},{"location":"bbcodetext/#shift-start-position-of-text","title":"Shift start position of text","text":"
    txt.setXOffset(value);\n
    "},{"location":"bbcodetext/#resolution","title":"Resolution","text":"
    • Get
      var resolution = txt.style.resolution;\n
    • Set
      txt.setResolution(resolution);\n
    "},{"location":"bbcodetext/#test-string","title":"Test string","text":"

    Set the test string to use when measuring the font.

    txt.setTestString(text);\n
    "},{"location":"bbcodetext/#save-texture","title":"Save texture","text":"
    txt.generateTexture(key);\n// txt.generateTexture(key, x, y, width, height);\n
    "},{"location":"bbcodetext/#delimiters","title":"Delimiters","text":"
    txt.setDelimiters(delimiters);  // '<>', or ['<', '>']\n

    or

    txt.setDelimiters(delimiterLeft, delimiterRight); // '<', '>'\n

    Warning

    Don't use () as delimiters, which is preserved for color value.

    "},{"location":"bbcodetext/#rtl","title":"RTL","text":"
    • Set rtl in style config when creating this text game object
    • Change rtl during runtime
      txt.setRTL(rtl).setText(newContent);\n
      • Invoke setRTL method before setting new content.
    "},{"location":"bbcodetext/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"bbcodetext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"bbcodetext/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"bitmaptext/","title":"Static bitmap text","text":""},{"location":"bitmaptext/#introduction","title":"Introduction","text":"

    Drawing text by texture, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"bitmaptext/#usage","title":"Usage","text":""},{"location":"bitmaptext/#load-bitmap-font","title":"Load bitmap font","text":"
    • Load bitmap font from texture and xml configuration
      scene.load.bitmapFont(key, textureURL, xmlURL);\n
      • Reference: load bitmap font
      • Loaded texture also can be used for Image, Sprite, or Arcade Image, Arcade Sprite
        scene.add.image(x, y, key, char);\n
    • Load retro bitmap font from texture and JSON configuration
      1. Load texture in preload stage
        scene.load.image(key, url);\n
        Reference: load image
      2. Add retro bitmap font
        var config = {\n// image\nimage: '',\noffset: {\nx: 0,\ny: 0\n},\n// characters\nwidth: 32,\nheight: 32,\nchars: '',\ncharsPerRow: 10,\n// spacing\nspacing: {\nx: 0,\ny: 0\n},\nlineSpacing: 0\n}\nscene.cache.bitmapFont.add(key, Phaser.GameObjects.RetroFont.Parse(scene, config));\n
        • Image :
          • image : The key of the image containing the font.
          • offset : If the font set doesn't start at the top left of the given image, specify the X/Y coordinate offset here.
        • Characters :
          • width : The width of each character in the font set.
          • height : The height of each character in the font set.
          • chars : The characters used in the font set, in display order.
            • Default characters set
          • charsPerRow : The number of characters per row in the font set. If not given charsPerRow will be the image width / characterWidth.
        • Spacing :
          • spacing : If the characters in the font set have horizontal/vertical spacing between them set the required amount here.
          • lineSpacing : The amount of vertical space to add to the line height of the font.
    "},{"location":"bitmaptext/#add-bitmap-text-object","title":"Add bitmap text object","text":"
    var txt = scene.add.bitmapText(x, y, key, text);\n// var txt = scene.add.bitmapText(x, y, key, text, size, align);\n
    • size : The size of the font
    • align : The alignment of the text in a multi-line BitmapText object.
      • 0 : Left aligned (default)
      • 1 : Middle aligned
      • 2 : Right aligned

    Add text from JSON

    var txt = scene.make.bitmapText({\nx: 0,\ny: 0,\ntext: 'Text\\nGame Object\\nCreated from config',\nfont: '',\nsize: false,\nalign: 0,\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"bitmaptext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends Phaser.GameObjects.BitmapText {\nconstructor(scene, x, y, key, text, size, align) {\nsuper(scene, x, y, key, text, size, align);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, key, text);\n
    "},{"location":"bitmaptext/#set-text","title":"Set text","text":"
    txt.setText('...');\n

    or

    txt.text = '...';\n
    "},{"location":"bitmaptext/#set-align","title":"Set align","text":"
    • Left aligned
      txt.setLeftAlign();\n
    • Middle aligned
      txt.setCenterAlign();\n
    • Right aligned
      txt.setRightAlign();\n

    or

    txt.align = align;\n
    • align :
      • 0 : Left aligned (default)
      • 1 : Middle aligned
      • 2 : Right aligned
    "},{"location":"bitmaptext/#set-letter-spacing","title":"Set letter spacing","text":"
    txt.setLetterSpacing(spacing);\n

    or

    txt.letterSpacing = spacing;\n

    Can be a positive value to increase the space, or negative to reduce it.

    "},{"location":"bitmaptext/#set-line-spacing","title":"Set line spacing","text":"
    txt.setLineSpacing(spacing);\n

    or

    txt.lineSpacing = spacing;\n

    Can be a positive value to increase the space, or negative to reduce it.

    "},{"location":"bitmaptext/#set-font-size","title":"Set font size","text":"
    txt.setFontSize(size);\n

    or

    txt.fontSize = size;\n
    "},{"location":"bitmaptext/#set-font","title":"Set font","text":"
    txt.setFont(key);\n// txt.setFont(key, size, align);\n
    "},{"location":"bitmaptext/#tint","title":"Tint","text":"

    See Tint.

    "},{"location":"bitmaptext/#color-of-characters","title":"Color of characters","text":"
    • By character
      txt.setCharacterTint(start, length, tintFill, color);\n// txt.setCharacterTint(start, length, tintFill, topLeft, topRight, bottomLeft, bottomRight);\n
      • start : Index starting character.
        • < 0 : Counts back from the end of the text.
      • length : Number of characters to tint.
        • -1 : All characters from start
      • tintFill :
        • true : Fill-based tint
        • false : Additive tint
      • color, or topLeft, topRight, bottomLeft, bottomRight : Color integer.
    • By word
      txt.setWordTint(word, count, tintFill, color);\n// txt.setWordTint(word, count, tintFill, topLeft, topRight, bottomLeft, bottomRight);\n
      • word : The word to search for.
        • A string
        • An index of the word in the words array.
      • count : Number of matching words to tint.
        • -1 : All matching words
      • tintFill :
        • true : Fill-based tint
        • false : Additive tint
      • color, or topLeft, topRight, bottomLeft, bottomRight : Color integer.
    "},{"location":"bitmaptext/#drop-shadow-effect","title":"Drop shadow effect","text":"
    txt.setDropShadow(x, y, color, alpha);\n

    or

    txt.dropShadowX = x;\ntxt.dropShadowY = y;\ntxt.dropShadowColor = color;\ntxt.dropShadowAlpha = alpha;\n
    • x, y : The horizontal/vertical offset of the drop shadow.
    • color : The color of the drop shadow.
    • alpha : The alpha of the drop shadow.

    Note

    WebGL only

    "},{"location":"bitmaptext/#wrap","title":"Wrap","text":"
    • Wrap
      txt.setMaxWidth(width);\n// txt.setMaxWidth(width, wordWrapCharCode);\n
      • width : Line width in pixels.
      • wordWrapCharCode : The character code to check for when word wrapping. Defaults to 32 (the space character)
    • Disable wrapping
      txt.setMaxWidth(0);\n
    "},{"location":"bitmaptext/#get-bounds","title":"Get bounds","text":"
    var width = txt.width;\nvar height = txt.height;\n

    or

    var bounds = txt.getTextBounds(round);\n// bounds = {\n//     local: {\n//         x: 0,\n//         y: 0,\n//         width: 0,\n//         height: 0\n//     },\n//     global: {\n//         x: 0,\n//         y: 0,\n//         width: 0,\n//         height: 0\n//     },\n//     lines: {\n//         shortest: 0,\n//         longest: 0,\n//         lengths: null,\n//         height: 0\n//     },\n//     wrappedText: '',\n//     words: [],\n//     characters: [],\n//     scaleX: 0,\n//     scaleY: 0\n// };\n
    • round : Set true to round the results to the nearest integer.
    • local : The BitmapText based on fontSize and 0x0 coords.
    • global : The BitmapText, taking into account scale and world position.
    • lines : The BitmapText line data.
    • wrappedText : Wrapped content joined with '\\n'.
    • characters : Information of each character.
      {\nchar, code, i, idx, x, y, w, h, t, b, r, line\n}\n
      • char : Character (string).
      • code: Character code (number)
      • i : Index of character
      • x , y : World position of this character
      • w, h : Width/height of this character
      • t, b : The top/bottom of the line this character is on.
      • r : The right-most point of this character, including xAdvance.
      • line : The line number the character appears on.
    • words : Information of each word.
      {\nword, i, x, y, w, h, cr\n\n}\n
      • word : Word string.
      • i : Index of start character
      • x, y : World position of start character
      • w , h : Width/height of word
      • cr : Is last word of current line
    • scaleX, scaleY : Scale of width and height.
    "},{"location":"bitmaptext/#get-information-of-character","title":"Get information of character","text":"
    var data = txt.getCharacterAt(x, y);\n// var data = txt.getCharacterAt(x, y, camera);\n
    • x, y : World position.
    • camera : The Camera which is being tested against.
    • data : Information of character at world position.
      {\nchar, code, i, x, y, w, h, t, b, r, line\n}\n
      • char : Character (string).
      • code: Character code (number)
      • i : Index of character
      • x , y : World position of this character
      • w, h : Width/height of this character
      • t, b : The top/bottom of the line this character is on.
      • r : The right-most point of this character, including xAdvance.
      • line : The line number the character appears on.
    "},{"location":"bitmaptext/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"bitmaptext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"bitmaptext/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"bitmaptext/#appendix","title":"Appendix","text":""},{"location":"bitmaptext/#default-characters-set-of-retro-font","title":"Default characters set of retro font","text":"
    • Phaser.GameObjects.RetroFont.TEXT_SET1 :
      ' !\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET2 :
      ' !\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET3 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '\n
    • Phaser.GameObjects.RetroFont.TEXT_SET4 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET5 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() \\'!?-*:0123456789'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET6 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.\\' '\n
    • Phaser.GameObjects.RetroFont.TEXT_SET7 :
      'AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-\\'39'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET8 :
      '0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET9 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,\\'\"?!'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET10 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET11 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()\\':;0123456789'\n
    "},{"location":"bitmapzone/","title":"Bitmap zone","text":""},{"location":"bitmapzone/#introduction","title":"Introduction","text":"

    Particles' emitter zone from canvas bitmap of text/canvas game object.

    • Author: Rex
    • Geometry object
    "},{"location":"bitmapzone/#live-demo","title":"Live demo","text":"
    • Particles
    "},{"location":"bitmapzone/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bitmapzone/#install-plugin","title":"Install plugin","text":""},{"location":"bitmapzone/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbitmapzoneplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbitmapzoneplugin.min.js', true);\n
    • Add bitmap-zone object
      var bitmapZone = scene.plugins.get('rexbitmapzoneplugin').add(gameObject, config);\n
    "},{"location":"bitmapzone/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BitmapZonePlugin from 'phaser3-rex-plugins/plugins/bitmapzone-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBitmapZone',\nplugin: BitmapZonePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add bitmap-zone object
      var bitmapZone = scene.plugins.get('rexBitmapZone').add(gameObject, config);\n
    "},{"location":"bitmapzone/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BitmapZone from 'phaser3-rex-plugins/plugins/bitmapzone.js';\n
    • Add bitmap-zone object
      var bitmapZone = new BitmapZone(gameObject, config);\n
    "},{"location":"bitmapzone/#create-shape","title":"Create shape","text":"
    var bitmapZone = scene.plugins.get('rexBitmapZone').add(gameObject);\n
    • gameObject :
      • Any kind of text object : Text object, bbcode text object, or tag text object.
      • Canvas object
    "},{"location":"bitmapzone/#emit-zone","title":"Emit zone","text":"
    var particles = scene.add.particles(key,\n[\n// emitter config\n{\n// blendMode:\n// scale:\n// speed:\n// garvityY:\nemitZone: {\ntype: 'random',\nsource: bitmapZone\n}\n}\n]);\n

    bitmapZone provides getRandomPoint method.

    "},{"location":"bitmapzone/#update-content","title":"Update content","text":"
    bitmapZone.setSource(gameObject);\n
    "},{"location":"blendmode/","title":"Blend mode","text":""},{"location":"blendmode/#introduction","title":"Introduction","text":"

    Constant value of blend modes.

    • Author: Richard Davey
    "},{"location":"blendmode/#usage","title":"Usage","text":""},{"location":"blendmode/#webgl-and-canvas","title":"WebGL and Canvas","text":"
    • 'NORMAL', or Phaser.BlendModes.NORMAL, or 0
      • Default setting and draws new shapes on top of the existing canvas content.
    • 'ADD', or Phaser.BlendModes.ADD, or 1
      • Where both shapes overlap the color is determined by adding color values.
    • 'MULTIPLY', or Phaser.BlendModes.MULTIPLY, or 2
      • The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result.
    • 'SCREEN', or Phaser.BlendModes.SCREEN, or 3
      • The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply)
    • 'ERASE', or Phaser.BlendModes.ERASE, or 17
      • Alpha erase blend mode. Only works when rendering to a framebuffer, like a Render Texture
    "},{"location":"blendmode/#canvas-only","title":"Canvas only","text":"
    • 'OVERLAY', or Phaser.BlendModes.OVERLAY, or 4
      • A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter.
    • 'DARKEN', or Phaser.BlendModes.DARKEN, or 5
      • Retains the darkest pixels of both layers.
    • 'LIGHTEN', or Phaser.BlendModes.LIGHTEN, or 6
      • Retains the lightest pixels of both layers.
    • 'COLOR_DODGE', or Phaser.BlendModes.COLOR_DODGE, or 7
      • Divides the bottom layer by the inverted top layer.
    • 'COLOR_BURN', or Phaser.BlendModes.COLOR_BURN, or 8
      • Divides the inverted bottom layer by the top layer, and then inverts the result.
    • 'HARD_LIGHT', or Phaser.BlendModes.HARD_LIGHT, or 9
      • A combination of multiply and screen like overlay, but with top and bottom layer swapped.
    • 'SOFT_LIGHT', or Phaser.BlendModes.SOFT_LIGHT, or 10
      • A softer version of hard-light. Pure black or white does not result in pure black or white.
    • 'DIFFERENCE', or Phaser.BlendModes.DIFFERENCE, or 11
      • Subtracts the bottom layer from the top layer or the other way round to always get a positive value.
    • 'EXCLUSION', or Phaser.BlendModes.EXCLUSION, or 12
      • Like difference, but with lower contrast.
    • 'HUE', or Phaser.BlendModes.HUE, or 13
      • Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.
    • 'SATURATION', or Phaser.BlendModes.SATURATION, or 14
      • Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.
    • 'COLOR', or Phaser.BlendModes.COLOR, or 15
      • Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.
    • 'LUMINOSITY', or Phaser.BlendModes.LUMINOSITY, or 16
      • Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.
    • 'SOURCE_IN', or Phaser.BlendModes.SOURCE_IN, or 18
      • The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent.
    • 'SOURCE_OUT', or Phaser.BlendModes.SOURCE_OUT, or 19
      • The new shape is drawn where it doesn't overlap the existing canvas content.
    • 'SOURCE_ATOP', or Phaser.BlendModes.SOURCE_ATOP, or 20
      • The new shape is only drawn where it overlaps the existing canvas content.
    • 'DESTINATION_OVER', or Phaser.BlendModes.DESTINATION_OVER, or 21
      • New shapes are drawn behind the existing canvas content.
    • 'DESTINATION_IN', or Phaser.BlendModes.DESTINATION_IN, or 22
      • The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent.
    • 'DESTINATION_OUT', or Phaser.BlendModes.DESTINATION_OUT, or 23
      • The existing content is kept where it doesn't overlap the new shape.
    • 'DESTINATION_ATOP', or Phaser.BlendModes.DESTINATION_ATOP, or 24
      • The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content.
    • 'LIGHTER', or Phaser.BlendModes.LIGHTER, or 25
      • Where both shapes overlap the color is determined by adding color values.
    • 'COPY', or Phaser.BlendModes.COPY, or 26
      • Only the new shape is shown.
    • 'XOR', or Phaser.BlendModes.XOR, or 27
      • Shapes are made transparent where both overlap and drawn normal everywhere else.

    Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these reasons try to be careful about the construction of your Scene and the frequency in which blend modes are used.

    "},{"location":"blitter/","title":"Blitter","text":""},{"location":"blitter/#introduction","title":"Introduction","text":"

    Display of static images, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"blitter/#usage","title":"Usage","text":""},{"location":"blitter/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"blitter/#add-blitter-container","title":"Add blitter container","text":"

    Add blitter container

    var blitter = scene.add.blitter(x, y, key);\n

    Add blitter container from JSON

    var blitter = scene.make.blitter({\nx: 0,\ny: 0,\nkey: '',\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"blitter/#custom-class","title":"Custom class","text":"
    • Define class
      class MyBlitter extends Phaser.GameObjects.Blitter {\nconstructor(scene, x, y, texture, frame) {\nsuper(scene, x, y, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var blitter = new MyBlitter(scene, x, y, key);\n
    "},{"location":"blitter/#add-bob-object","title":"Add bob object","text":"
    var bob = blitter.create(x, y);\n// var bob = blitter.create(x, y, frame, visible, index);\n
    • frame : The Frame the Bob will use. It must be part of the Texture the parent Blitter object is using.
    • visible : Should the created Bob render or not?
    • index : The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list.
    "},{"location":"blitter/#add-mutiple-bob-objects","title":"Add mutiple bob objects","text":"
    var bobs = blitter.createMultiple(quantity, frame, visible);\n
    • quantity : The quantity of Bob objects to create.
    "},{"location":"blitter/#add-bob-object-from-callback","title":"Add bob object from callback","text":"
    var bobs = blitter.createFromCallback(callback, quantity, frame, visible)\n// var callback = function(bob, i){};\n
    "},{"location":"blitter/#get-bob-objects","title":"Get bob objects","text":"
    var bobs = blitter.children.list;\n
    "},{"location":"blitter/#clear-all-bob-objects","title":"Clear all bob objects","text":"
    blitter.clear();\n
    "},{"location":"blitter/#bob-object","title":"Bob object","text":"

    A Bob has a position, alpha value and a frame from a texture that it uses to render with. You can also toggle the flipped and visible state of the Bob.

    "},{"location":"blitter/#position","title":"Position","text":"
    • Get
      var x = bob.x;\nvar y = bob.y;\n
    • Set
      bob.setPosition(x, y);\n// bob.x = 0;\n// bob.y = 0;\n
      or
      bob.reset(x, y);\n// bob.reset(x, y, frame);\n
    "},{"location":"blitter/#frame","title":"Frame","text":"
    • Get
      var frame = bob.frame;\n
      • frame : Frame object.
    • Set
      bob.setFrame(frame);\n
    "},{"location":"blitter/#flip","title":"Flip","text":"
    • Get
      var flipX = bob.flipX;\nvar flipY = bob.flipY;\n
    • Set
      bob.setFlip(boolX, boolY);\n// bob.setFlipX(boolean);\n// bob.setFlipY(boolean);\n// bob.flipX = flipX;\n// bob.flipY = flipY;\n
      or
      bob.resetFlip(); // bob.setFlip(false, false)\n
    "},{"location":"blitter/#visible","title":"Visible","text":"
    • Get
      var visible = bob.visible;\n
    • Set
      bob.setVisible(boolean);\n// bob.visible = v;\n
    "},{"location":"blitter/#alpha","title":"Alpha","text":"
    • Get
      var alpha = bob.alpha;\n
    • Set
      bob.setAlpha(v);\n// bob.aplha = v;\n
    "},{"location":"blitter/#tint","title":"Tint","text":"
    • Get
      var tint = bob.tint;\n
    • Set
      bob.setTint(tint);\n// bob.tint = tint;\n
      • tint : Tint value, between 0 and 0xffffff.
    "},{"location":"blitter/#destroy","title":"Destroy","text":"
    bob.destroy();\n
    "},{"location":"blitter/#data","title":"Data","text":"
    var data = bob.data;  // {}\n
    "},{"location":"blitter/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"blitter/#create-mask","title":"Create mask","text":"
    var mask = bob.createBitmapMask();\n

    See mask

    "},{"location":"blitter/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"board-bejeweled/","title":"Bejeweled","text":""},{"location":"board-bejeweled/#introduction","title":"Introduction","text":"

    Match3-like gameplay template.

    • Author: Rex
    • Template
    "},{"location":"board-bejeweled/#live-demos","title":"Live demos","text":"
    • Events
    • Custom input
    • Mask
    "},{"location":"board-bejeweled/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-bejeweled/#install-plugin","title":"Install plugin","text":""},{"location":"board-bejeweled/#load-minify-file","title":"Load minify file","text":"
    • Load rexBoard plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\nscene.load.script('rexbejeweled', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbejeweled.min.js');\n
    • Add bejeweled object
      var bejeweled = new rexbejeweled(scene, config);\n
    "},{"location":"board-bejeweled/#import-template","title":"Import template","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install rexBoard plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nimport Bejeweled from 'phaser3-rex-plugins/templates/bejeweled/Bejeweled.js';\n\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add bejeweled object
      var bejeweled = new Bejeweled(scene, config);\n
    "},{"location":"board-bejeweled/#create-bejeweled-object","title":"Create bejeweled object","text":"
    var bejeweled = new Bejeweled(scene, {\n// rexBoard: 'rexBoard',\n\nboard: {\ngrid: {\ngridType: 'quadGrid',\nx: 30,\ny: 30 - 600,\ncellWidth: 60,\ncellHeight: 60,\n},\nwidth: 10,\nheight: 20 // Prepared rows: upper 10 rows\n},\nmatch: {\n// wildcard: undefined\n// dirMask: undefined\n},\nchess: {\n// pick random symbol from array, or a callback to return symbol\nsymbols: [0, 1, 2, 3, 4, 5],\n// symbols: function(board, tileX, tileY, excluded) { return symbol; }\n\n// User-defined chess game object\ncreate: function (board) {\n// Create Game object (Shape, Image, or Sprite)\nvar scene = board.scene;\nvar gameObject = scene.add.sprite(0, 0, textureKey, frame);\n// Initial 'symbol' value\ngameObject.setData('symbol', undefined);\n// Add data changed event of 'symbol` key\ngameObject.data.events.on('changedata_symbol', function (gameObject, value, previousValue) {\n// Change the appearance of game object via new symbol value\ngameObject.setFrame(newFrame);\n});\nreturn gameObject;\n},\n\n// scope for callbacks\nscope: undefined,\n\n// moveTo behavior\nmoveTo: {\nspeed: 400\n},\n// tileZ: 1,\n},\n// mask: false,\n\nselect1Action: undefined,\nselect2Action: undefined,\nswapAction: undefined,\nundoSwapAction: undefined,\neliminatingAction: undefined,\nfallingAction: undefined,\n\n// input: true\n})\n

    Configurations

    • rexBoard : Key of 'rexBoard' plugin. Default is 'rexBoard'.
    • Board properties
      • board.width : Board width in tiles.
      • board.height : Board height in tiles.
      • board.grid.x, board.grid.y : World position of tile (0, 0)
      • board.grid.cellWidth, board.grid.cellHeight : The width/height of the cell, in pixels.
    • Chess properties
      • chess.symbols : An array of possible symbols, or a callback to return a symbol. See Generate symbol
      • chess.create, chess.scope : Callback of creating chess object.
      • chess.moveTo.speed : Constant moving speed of chess, in pixel per-second.
    • Custom actions
      • select1Action : Custom select first chess Action
      • select2Action : Custom select second chess Action
      • swapAction : Custon swap action
      • undoSwapAction : Custon undo-swap action
      • eliminatingAction : Custon eliminating action
      • fallingAction : Custon falling action
    • Touch input
      • input : Set true to register default touch input logic.
    • Mask
      • mask :
        • false : No mask. Default behavior.
        • true : Mask invisible upper rows.
          1. Create an internal layer
          2. Mask this internal layer.
    "},{"location":"board-bejeweled/#board-height","title":"Board height","text":"

    Board is separated into two parts: upper and bottom

    • Bottom : Visible N rows, to swap chess and run matching.
    • Upper : Invisible N rows, chess in these rows will move down, to fill bottom rows.

    For example, if amount of visible rows is 10, board.height should set to 20.

    "},{"location":"board-bejeweled/#generate-symbol","title":"Generate symbol","text":"

    Symbols are declared in property chess.symbols in a symbol array like [0, 1, 2, 3, 4, 5], or a callback to return a symbol. The callback also use chess.scope as the scope.

    function(board, tileX, tileY, excluded) {\nreturn symbol\n}\n
    • excluded : undefined or a symbol array. Don't return these symbols.
    "},{"location":"board-bejeweled/#create-chess-object","title":"Create chess object","text":"

    Return a game object from a callback.

    function(board) {\n// Create Game object (Image, Sprite, or Shape)\nvar scene = board.scene;\nvar gameObject = scene.add.sprite(0, 0, textureKey, frame);\n// Initial 'symbol' value\ngameObject.setData('symbol', undefined);\n// Add data changed event of 'symbol` key\ngameObject.data.events.on('changedata_symbol', function (gameObject, value, previousValue) {\n// Change the appearance of game object via new symbol value\ngameObject.setFrame(newFrame);\n});\nreturn gameObject;\n}\n

    Each chess has a symbol value stored in 'symbol' key in private data. Add data changed event of 'symbol' key to change the appearance of game object via new symbol value.

    "},{"location":"board-bejeweled/#states","title":"States","text":"
    graph TD\n\nStart((Start)) --> Select1Start[select1-start]\n\nsubgraph Select 1 states\n  Select1Start --> |Input| Select1[select1]\nend\n\nSelect1 --> select2Start[select2-start]\n\nsubgraph Select 2 states\n  select2Start --> |Input| select2[select2]\nend\n\nselect2Start --> Select1Start\nselect2 --> Swap[swap]\nSwap --> MatchStart[match-start]\n\nsubgraph Match states\n  MatchStart --> Match[match]\n  Match --> Eliminate[eliminate]\n  Match --> MatchEnd[match-end]\n  Eliminate --> Fall[fall]\n  Fall --> Fill[fill]\n  Fill --> Match\nend\n\nMatchEnd --> UndoSwap[undo-swap]\nUndoSwap --> Select1Start\nMatchEnd --> Select1Start
    "},{"location":"board-bejeweled/#select-first-chess","title":"Select first chess","text":"

    Fire 'select1' event

    bejeweled.on('select1', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-select-first-chess-action","title":"Custom Select first chess Action","text":"

    Default select action:

    function (chess, board, bejeweled) {\n// Do nothing\n}\n
    "},{"location":"board-bejeweled/#select-second-chess","title":"Select second chess","text":"

    Fire 'select2' event

    bejeweled.on('select2', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
      • Selected first chess :
        var chess = bejeweled.getSelectedChess1();\n
    "},{"location":"board-bejeweled/#custom-select-second-chess-action","title":"Custom Select second chess Action","text":"

    Default select action: The same as Select first chess Action

    "},{"location":"board-bejeweled/#swap-selected-chess","title":"Swap selected chess","text":"

    Fire 'swap' event

    bejeweled.on('swap', function(selectedChess1, selectedChess2, board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-swap-action","title":"Custom Swap Action","text":"

    Default swap action:

    function (chess1, chess2, board, bejeweled) {\nvar tileXYZ1 = board.chessToTileXYZ(chess1);\nvar tileXYZ2 = board.chessToTileXYZ(chess2);\nvar tileX1 = tileXYZ1.x,\ntileY1 = tileXYZ1.y,\ntileX2 = tileXYZ2.x,\ntileY2 = tileXYZ2.y,\ntileZ = tileXYZ1.z;\n\n// TileZ of chess1 and chess2 are the same, change tileZ of chess2 to a different value\nboard.moveChess(chess2, tileX2, tileY2, `#${tileZ}`, false);\n\n// Move chess1 to tileXYZ2, chess2 to tileXYZ1\nvar moveTo1 = bejeweled.getChessMoveTo(chess1);\nvar moveTo2 = bejeweled.getChessMoveTo(chess2);\nmoveTo1.moveTo(tileX2, tileY2);\nmoveTo2.moveTo(tileX1, tileY1);\n\n// Change tileZ of chess2 back\nboard.moveChess(chess2, tileX1, tileY1, tileZ, false);\n\nif (moveTo1.isRunning) {\nbejeweled.waitEvent(moveTo1, 'complete');\n}\nif (moveTo2.isRunning) {\nbejeweled.waitEvent(moveTo2, 'complete');\n}\n};\n
    • bejeweled.getChessMoveTo(chess) : Get moveTo behavior of a chess.
    • bejeweled.waitEvent(moveTo, 'complete') : Wait 'complete' event of this moveTo behavior.
    "},{"location":"board-bejeweled/#match-start","title":"Match start","text":"

    Fire 'match-start' event

    bejeweled.on('match-start', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#match-lines","title":"Match lines","text":"

    Fire 'match' event

    bejeweled.on('match', function(lines, board, bejeweled) {\n\n}, scope);\n
    • lines : An array of matched lines, each line is a built-in Set object.
      • Length of each line (lines[i].size) could be 5, 4, or 3.
      • lines[i].entries : An array of chess (Game Object) in a matched line.
      • Get cross chess of two lines via lineA.intersect(lineB).
      • All chess game objects in matched lines will be eliminated in next stage.
        • Add/remove chess game object in a line.
        • Add new line/remove a line in lines array to change the eliminated targets.
    • board : Board object.
      • Get tile position {x,y,z} of a chess game object via
        var tileXYZ = board.chessToTileXYZ(gameObject);\n//var tileXYZ = gameObject.rexChess.tileXYZ;\n
      • Get chess game object of a tile position {x,y,z} via
        var gameObject = board.tileXYZToChess(tileX, tileY, tileZ);\n
      • Get array of neighbor chess of a chess game object via
        var gameObjects = board.getNeighborChess(chess, null);\n
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#eliminating-chess","title":"Eliminating chess","text":"

    Fire 'eliminate' event

    bejeweled.on('eliminate', function(chessArray, board, bejeweled) {\n\n}, scope);\n
    • chessArray : An array of chess (Game Object) to be eliminated.
    • board : Board object
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-eliminating-action","title":"Custom Eliminating Action","text":"

    Default eliminating action:

    function (chessArray, board, bejeweled) {\nconst duration = 500; //ms\nfor (var i = 0, cnt = chessArray.length; i < cnt; i++) {\nvar fade = FadeOutDestroy(chessArray[i], duration);\nbejeweled.waitEvent(fade, 'complete');\n}\n}\n
    • bejeweled.waitEvent(fade, 'complete') : Wait 'complete' event of this fade-out-destroy behavior.
    "},{"location":"board-bejeweled/#falling-chess","title":"Falling chess","text":"

    Fire 'fall' event

    bejeweled.on('fall', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-falling-action","title":"Custom Falling Action","text":"

    Default falling action:

    function (board, bejeweled) {\nvar tileZ = bejeweled.chessTileZ,\nchess, moveTo;\n\nfor (var tileY = (board.height - 1); tileY >= 0; tileY--) { // bottom to top\nfor (var tileX = 0, cnt = board.width; tileX < cnt; tileX++) { // left to right\nchess = board.tileXYZToChess(tileX, tileY, tileZ);\nif (chess === null) {\ncontinue;\n}\nmoveTo = bejeweled.getChessMoveTo(chess);\ndo {\nmoveTo.moveToward(1);\n} while (moveTo.lastMoveResult)\nif (moveTo.isRunning) {\nbejeweled.waitEvent(moveTo, 'complete');\n}\n}\n}\n}\n
    • bejeweled.getChessMoveTo(chess) : Get moveTo behavior of a chess.
    • bejeweled.waitEvent(moveTo, 'complete') : Wait 'complete' event of this moveTo behavior.
    "},{"location":"board-bejeweled/#fill-chess","title":"Fill chess","text":"

    Fire 'fill' event

    bejeweled.on('fill', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#match-end","title":"Match end","text":"

    Fire 'match-end' event

    bejeweled.on('match-end', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#undo-swap-selected-chess","title":"Undo-swap selected chess","text":"

    Fire 'undo-swap' event

    bejeweled.on('undo-swap', function(selectedChess1, selectedChess2, board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-undo-swap-action","title":"Custom Undo-Swap Action","text":"

    Default undo-swap action : Equal to Swap action

    "},{"location":"board-bejeweled/#start-gameplay","title":"Start gameplay","text":"
    bejeweled.start();\n
    "},{"location":"board-bejeweled/#input-control","title":"Input control","text":""},{"location":"board-bejeweled/#default-input","title":"Default input","text":"
    1. Enable default input control
      var bejeweled = new Bejeweled(scene, {\n// ...\ninput: true\n});\n
    2. Enable/disable temporarily.
      • Enable
        bejeweled.setInputEnable();\n
      • Disable
        bejeweled.setInputEnable(false);\n
    "},{"location":"board-bejeweled/#custom-input","title":"Custom input","text":"
    1. Discard default input control
      var bejeweled = new Bejeweled(scene, {\n// ...\ninput: false\n});\n
    2. Add custom input logic like
      scene.input\n.on('pointerdown', function (pointer) {\nvar chess = bejeweled.worldXYToChess(pointer.worldX, pointer.worldY);\nif (chess) {\nbejeweled.selectChess1(chess);\n}\n}, scene)\n.on('pointermove', function (pointer) {\nif (!pointer.isDown) {\nreturn;\n}\nvar chess = bejeweled.worldXYToChess(pointer.worldX, pointer.worldY);\nif (chess && (chess !== this.bejeweled.getSelectedChess1())) {\nbejeweled.selectChess2(chess);\n}\n}, scene);\n
      • Invoke bejeweled.selectChess1(chess), and bejeweled.selectChess2(chess) under custom logic.

    Helper methods

    • Get chess via worldXY position
      var chess = bejeweled.worldXYToChess(worldX, worldY);\n
    • Get chess via tileXY position
      var chess = bejeweled.tileXYToChess(tileX, tileY);\n
    • Get neighbor chess via angle
      var chess2 = bejeweled.getNeighborChessAtAngle(chess1, angle);\n
      • chess1 : Chess object, or tileXY position {x, y}.
      • angle : Angle in radius.
    • Get neighbor chess via direction
      var chess2 = bejeweled.getNeighborChessAtDirection(chess1, direction);\n
      • chess1 : Chess object, or tileXY position {x, y}.
      • direction : Number, or string number.
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
    "},{"location":"board-bejeweled/#data","title":"Data","text":"
    • Get
      var value = bejeweled.getData(key);\nvar values = bejeweled.getData(keys); // keys: an array of keys\nvar value = bejeweled.data.values[key];\n
    • Set
      bejeweled.setData(key, value);\nbejeweled.setData(obj); // obj: {key0:value0, key1:value1, ...}\nbejeweled.data.values[key] = value;\nbejeweled.data.values[key] += inc;\n
    • Enable
      bejeweled.setDataEnabled();\n
    • Events :
      • Set data evant
        bejeweled.on('setdata', function(bejeweled, key, value){ /* ... */ });\n
      • Change data event
        bejeweled.on('changedata', function(bejeweled, key, value, previousValue){ /* ... */ });\n
        bejeweled.on('changedata-' + key, function(bejeweled, value, previousValue){ /* ... */ });\n

    See data manager

    Note

    Ensure data manager is created before binding any data-changed events.

    "},{"location":"board-bejeweled/#misc","title":"Misc","text":"
    • Board instance
      var board = bejeweled.getBoard();\n
      • board : Board instance.
    • Match instance
      var match = bejeweled.getMatch();\n
      • match : Match instance.
    "},{"location":"board-chessdata/","title":"Chess data","text":""},{"location":"board-chessdata/#introduction","title":"Introduction","text":"

    Properties of chess, chess behavior of Board system.

    • Author: Rex
    • Behavior of chess
    "},{"location":"board-chessdata/#usage","title":"Usage","text":""},{"location":"board-chessdata/#add-chess-data-object","title":"Add chess data object","text":"

    Chess data will be added to game object via gameObject.rexChess once adding this game object to board, or attach any chess behavior.

    "},{"location":"board-chessdata/#get-chess-data","title":"Get chess data","text":"
    var chessData = gameObject.rexChess;\n
    "},{"location":"board-chessdata/#set-tile-z","title":"Set tile Z","text":"
    gameObject.rexChess.setTileZ(tileZ);\n

    (tileX, tileY) won't be changed.

    "},{"location":"board-chessdata/#get-tile-position","title":"Get tile position","text":"
    var tileXYZ = gameObject.rexChess.tileXYZ;\n
    • tileXYZ : Tile position {x,y,z}, return null if this chess is not added to any board.
    "},{"location":"board-chessdata/#get-board","title":"Get board","text":"
    var board = gameObject.rexChess.board;\n
    • board : Board object, or null if this chess is not added to any board.

    See also

    "},{"location":"board-chessdata/#blocker","title":"Blocker","text":"
    • Set
      gameObject.rexChess.setBlocker();\n
    • Disable
      gameObject.rexChess.setBlocker(false);\n
    • Get
      var blocker = gameObject.rexChess.blocker;\n
    "},{"location":"board-fieldofview/","title":"Field of view","text":""},{"location":"board-fieldofview/#introduction","title":"Introduction","text":"

    Visible testing, to find field of view, chess behavior of Board system.

    • Author: Rex
    • Behavior of chess
    "},{"location":"board-fieldofview/#live-demos","title":"Live demos","text":"
    • Field of view
    • Line of sigh
    • Filter visible chess
    • Pre-test callback
    "},{"location":"board-fieldofview/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-fieldofview/#install-plugin","title":"Install plugin","text":""},{"location":"board-fieldofview/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add field-of-view object
      var fieldOfView = scene.rexBoard.add.fieldOfView(chess, config);\n
    "},{"location":"board-fieldofview/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add field-of-view object
      var fieldOfView = scene.rexBoard.add.fieldOfView(chess, config);\n
    "},{"location":"board-fieldofview/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { FieldOfView } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add field-of-view object
      var fieldOfView = new FieldOfView(chess, config);\n
    "},{"location":"board-fieldofview/#create-instance","title":"Create instance","text":"
    var fieldOfView = scene.rexBoard.add.fieldOfView(chess, {\n// face: 0,\n// cone: undefined,\n// coneMode: 0,\n// perspective: false,\n\n// ** pre-test **\n// occupiedTest: false,\n// blockerTest: false,\n// preTestCallback: undefined,\n// preTestCallbackScope: undefined,\n\n// ** cost **\n// costCallback: undefined,\n// costCallbackScope: undefined,\n// cost: undefined,   // constant cost\n\n// debug: {\n//     graphics: undefined,\n//     visibleLineColor: 0x00ff00,\n//     invisibleLineColor: 0xff0000,\n//     log: false,\n// }\n})\n
    • face : Face of chess.
      • 0 ~ 3 : Quad grid.
      • 0 ~ 5 : Hexagon grid.
    • cone : View of cone. Tile position or chess which not in view of cone will be invisible.
      • undefined : Ignore this feature
    • coneMode : Unit of cone , in direction or angle.
      • 'direction', or 0 : Cone in directions. For example, visible directions are between (0 - 2/2) to (0 + 2/2) if set
        face : 0,\ncone : 2,\nconeMode: 0\n
      • 'angle', or 1 : Cone in angle. For example, visible angle is between (0 - 120/2) to (0 + 120/2) if set
        face : 0,\ncone : 120,\nconeMode: 1\n
    • perspective :
      • false : Test visible until blocked tiles. Default behavior.
      • true : Test visible until out-of-board. Will test cross any blocked (invisible) tile.
    • Pre-test : Test tiles on visible path.
      • occupiedTest : Set true to test if target tile position is occupied or not.
      • blockerTest : Set true to test blocker property.
      • preTestCallback, preTestCallbackScope : Custom pre-test function, return false to discard cost function.
        function(tileXYArray, visiblePoints, fieldOfView) {\n// return false;\n}\n
        • tileXYArray[0] is current tileXY position of chess.
    • Cost function of each tile on visible path
      • cost : A constant cost for each non-blocked tile
      • costCallback, costCallbackScope : Get cost via callback
        function(curTile, fieldOfView, tileXYArray) {\nreturn cost;\n}\n
        • Cost of blocker : fieldOfView.BLOCKER.
        • curTile : Currest testing tileXY.
        • tileXYArray : A read only tileXY array of sight path.
    • debug :
      • debug.graphics : A graphics object for showing debug messages.
      • debug.visibleLineColor : Color of visible line. Set undefined to not draw any line.
      • debug.invisibleLineColor : Color of invisible line. Set undefined to not draw any line.

    Note

    Blocker is visible, but tiles behind blocker are invisible.

    "},{"location":"board-fieldofview/#set-pre-test-function","title":"Set pre-test function","text":"
    fieldOfView.setPreTestFunction(callback, scope);\n
    • callback
      var callback = function(tileXYArray, visiblePoints, fieldOfView) {\nreturn false;\n}\n
      • tileXYArray[0] is current tileXY position of chess.
    "},{"location":"board-fieldofview/#set-cost-function","title":"Set cost function","text":"
    • Constant cost for each non-blocked tile
      fieldOfView.setCostFunction(cost);\n
    • Get cost via callback
      fieldOfView.setCostFunction(callback, scope);\n
      • callback
        var callback = function(curTile, fieldOfView, tileXYArray) {\nreturn cost;\n}\n
        • Cost of blocker : fieldOfView.BLOCKER
        • curTile : Currest testing tileXY.
        • tileXYArray : A read only tileXY array of sight path.
    "},{"location":"board-fieldofview/#is-tilexychess-visible","title":"Is tileXY/chess visible","text":"
    var isVisible = fieldOfView.isInLOS(chess);\n// var isVisible = fieldOfView.isInLOS(chess, visiblePoints);\n// var isVisible = fieldOfView.isInLOS(chess, visiblePoints, originTileXY);\n
    • chess : Chess object or tileXY
    • visiblePoints
      • fieldOfView.INFINITY (undefined) : Infinity visible points. Default value.
    • originTileXY : Put chess at this tileXY position for visible testing temporary.
      • undefined : Use current tileXY position for visible testing.
    "},{"location":"board-fieldofview/#get-tilexy-array-in-field-of-view","title":"Get tileXY array in field of view","text":"
    var tileXYArray = fieldOfView.findFOV();\n// var tileXYArray = fieldOfView.findFOV(visiblePoints);\n// var tileXYArray = fieldOfView.findFOV(visiblePoints, originTileXY);\n// var out = fieldOfView.findFOV(visiblePoints, out);\n// var out = fieldOfView.findFOV(visiblePoints, originTileXY, out);\n
    • visiblePoints
      • fieldOfView.INFINITY (undefined) : Infinity visible points. Default value.
    • out : Returned tileXY array.
    • originTileXY : Put chess at this tileXY position for visible testing temporary.
      • undefined : Use current tileXY position for visible testing.
    "},{"location":"board-fieldofview/#filter-visible-tilexy-array","title":"Filter visible tileXY array","text":"
    • Filter visible tileXY array
      var out = fieldOfView.LOS(chessArray);\n// var out = fieldOfView.LOS(chessArray, originTileXY);\n// var out = fieldOfView.LOS(chessArray, out);\n// var out = fieldOfView.LOS(chessArray, originTileXY, out);\n
      • chessArray : Array of chess object or tileXY
      • out : Array of visible chess object or tileXY
      • originTileXY : Put chess at this tileXY position for visible testing temporary.
        • undefined : Use current tileXY position for visible testing.
    • Filter visible tileXY array with visible points
      var out = fieldOfView.LOS(chessArray, visiblePoints);\n// var out = fieldOfView.LOS(chessArray, visiblePoints, originTileXY);\n// var out = fieldOfView.LOS(chessArray, visiblePoints, out);\n// var out = fieldOfView.LOS(chessArray, visiblePoints, originTileXY, out);\n
      • chessArray : Array of chess object or tileXY
      • out : Array of visible chess object or tileXY
      • originTileXY : Put chess at this tileXY position for visible testing temporary.
        • undefined : Use current tileXY position for visible testing.
    "},{"location":"board-fieldofview/#face","title":"Face","text":"

    Face direction

    • Get
      var face = fieldOfView.face;\n
    • Set
      fieldOfView.setFace(direction);\n
      or
      fieldOfView.face = direction;\n// fieldOfView.face ++;\n
    • face :
      • 0 ~ 3 : Quad grid.
      • 0 ~ 5 : Hexagon grid.
    "},{"location":"board-fieldofview/#debug","title":"Debug","text":"
    • Clear debug graphics
      fieldOfView.clearDebugGraphics();\n
    • Set color of lines
      fieldOfView.setDebugLineColor(visibleLineColor, invisibleLineColor);\n
      • visibleLineColor, invisibleLineColor : Set undefined to not draw any line.
    "},{"location":"board-hexagongrid/","title":"Hexagon","text":""},{"location":"board-hexagongrid/#introduction","title":"Introduction","text":"

    Hexagon grid object of Board system.

    • Author: Rex
    • Grid object of board
    "},{"location":"board-hexagongrid/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-hexagongrid/#create-instance","title":"Create instance","text":"
    var grid = scene.rexBoard.add.hexagonGrid({\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\n// size: undefined,\nstaggeraxis: 1,\nstaggerindex: 1\n});\n

    or

    // import { HexagonGrid } from 'phaser3-rex-plugins/plugins/board-components.js';\nvar grid = new HexagonGrid(config);\n
    • x, y : World position of origin tile (i.e. tileX = 0, tileY = 0)
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • size : Distance between center to each corner. Get cellWidth and cellHeight from size if this parameter is not undefined.
    • staggeraxis
      • 0, or y
      • 1, or x
    • staggerindex
      • 0, or even
      • 1, or odd
    "},{"location":"board-hexagongrid/#world-position-of-tile-0-0","title":"World position of tile (0, 0)","text":"
    • Get
      var worldX = grid.x;\nvar worldY = grid.y;\n
    • Set
      grid.setOriginPosition(worldX, worldY);\n
      or
      grid.x = worldX;\ngrid.y = worldY;\n
    "},{"location":"board-hexagongrid/#cell-size","title":"Cell size","text":"
    • Get
      var width = grid.width;\nvar height = grid.height;\n
    • Set
      grid.setCellSize(width, height);\n
      or
      grid.width = width;\ngrid.height = height;\n
      or
      grid.setCellRadius(size);\n
      • size : Distance between center to each corner.
    "},{"location":"board-hexagongrid/#grid-type","title":"Grid type","text":"
    • Get
      var staggeraxis = grid.staggeraxis;\nvar staggerindex = grid.staggerindex;\n
    • Set
      grid.setType(staggeraxis, staggerindex);\n
      • staggeraxis
        • 0, or y
        • 1, or x
      • staggerindex
        • 0, or even
        • 1, or odd
    "},{"location":"board-hexagongrid/#get-world-position","title":"Get world position","text":"
    var worldXY = grid.getWorldXY(tileX, tileY);  // worldXY: {x, y}\n// var out = grid.getWorldXY(tileX, tileY, out);\n
    "},{"location":"board-hexagongrid/#get-tile-position","title":"Get tile position","text":"
    var tileXY = grid.getTileXY(worldX, worldY);  // tileXY: {x, y}\n// var out = grid.getTileXY(worldX, worldY, out);\n
    "},{"location":"board-hexagongrid/#directions","title":"Directions","text":"
    • staggeraxis = 0/y
      • 0 : Down-right
      • 1 : Down
      • 2 : Down-left
      • 3 : Up-left
      • 4 : Up
      • 5 : Up-right
    • staggeraxis = 1/x
      • 0 : Right
      • 1 : Down-right
      • 2 : Down-left
      • 3 : Left
      • 4 : Up-left
      • 5 : Up-right
    "},{"location":"board-hexagonmap/","title":"Hexagon map","text":""},{"location":"board-hexagonmap/#introduction","title":"Introduction","text":"

    Create tile positions in hexagon/triangle/parallelogram geometry in hexagon grid.

    • Author: Rex
    • Help method of board
    "},{"location":"board-hexagonmap/#live-demos","title":"Live demos","text":"
    • Hexagon
    "},{"location":"board-hexagonmap/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-hexagonmap/#install-plugin","title":"Install plugin","text":""},{"location":"board-hexagonmap/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Create tile positions
      var tileXYArray = scene.rexBoard.add.hexagonMap.hexagon(board, radius);\nvar tileXYArray = scene.rexBoard.add.hexagonMap.parallelogram(board, type, width, height);\nvar tileXYArray = scene.rexBoard.add.hexagonMap.triangle(board, type, height);\n
    "},{"location":"board-hexagonmap/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create tile positions
      var tileXYArray = scene.rexBoard.add.hexagonMap.hexagon(board, radius);\nvar tileXYArray = scene.rexBoard.add.hexagonMap.parallelogram(board, type, width, height);\nvar tileXYArray = scene.rexBoard.add.hexagonMap.triangle(board, type, height);\n
    "},{"location":"board-hexagonmap/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { HexagonMap } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Create tile positions
      var tileXYArray = HexagonMap.hexagon(board, radius);\nvar tileXYArray = HexagonMap.parallelogram(board, type, width, height);\nvar tileXYArray = HexagonMap.triangle(board, type, height);\n
    "},{"location":"board-hexagonmap/#create-tile-positions","title":"Create tile positions","text":""},{"location":"board-hexagonmap/#hexagon","title":"Hexagon","text":"
    var tileXYArray = scene.rexBoard.hexagonMap.hexagon(board, radius);\n// var out = scene.rexBoard.hexagonMap.hexagon(board, radius, out);\n
    • tileXYArray : An array of tile position {x, y}.
    • board : Board object.
    • radius : Radius in tile count.
    staggeraxis y x"},{"location":"board-hexagonmap/#parallelogram","title":"Parallelogram","text":"
    var tileXYArray = scene.rexBoard.hexagonMap.parallelogram(board, type, width, height);\n// var out = scene.rexBoard.hexagonMap.parallelogram(board, type, width, height, out);\n
    • tileXYArray : An array of tile position {x, y}.
    • board : Board object.
    • width, height : Size of parallelogram
    type\\staggeraxis y x 0 1 2"},{"location":"board-hexagonmap/#triangle","title":"Triangle","text":"
    var tileXYArray = scene.rexBoard.hexagonMap.triangle(board, type, height);\n// var out = scene.rexBoard.hexagonMap.triangle(board, type, height, out);\n
    • tileXYArray : An array of tile position {x, y}.
    • board : Board object.
    • height : Size of Triangle
    type\\staggeraxis y x 0 1"},{"location":"board-hexagonmap/#retrieve-tile-positions","title":"Retrieve tile positions","text":"
    1. Offset all of tile positions to (0, 0), and set board size to fit these tile positions.
      var tileXYArray = board.fit(tileXYArray);\n
    2. Retrieve tile positions
      var tileXY;\nfor(var i = 0, cnt = tileXYArray.length; i < cnt; i++) {\ntileXY = tileXYArray[i];\n// ...\n}\n
    "},{"location":"board-image/","title":"Image","text":""},{"location":"board-image/#introduction","title":"Introduction","text":"

    Image chess object.

    • Author: Rex
    • Chess Game object of Board system
    "},{"location":"board-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-image/#install-plugin","title":"Install plugin","text":""},{"location":"board-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add chess object
      var chess = scene.rexBoard.add.image(board, tileX, tileY, tileZ, key, frame);\n
    "},{"location":"board-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add chess object
      var chess = scene.rexBoard.add.image(board, tileX, tileY, tileZ, key, frame);\n
    "},{"location":"board-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Image } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add chess object
      var chess = new Image(board, tileX, tileY, tileZ, key, frame);\nscene.add.existing(chess);\n
    "},{"location":"board-image/#add-chess-object","title":"Add chess object","text":"
    • Create chess object and add to board
      var chess = scene.rexBoard.add.image(board, tileX, tileY, tileZ, key, frame);\n
      • board : Board object
      • tileX, tileY, tileZ : Tile position
      • key, frame : Frame of this image chess object
    • Create chess object but not add to board
      var chess = scene.rexBoard.add.image(board, x, y, undefined, key, frame, false);\n
      • board : Board object
      • x, y : World position
      • key, frame : Frame of this image chess object
    "},{"location":"board-image/#other-properties","title":"Other properties","text":"

    See Image game object, game object

    "},{"location":"board-match/","title":"Match","text":""},{"location":"board-match/#introduction","title":"Introduction","text":"

    Get matched chess in lines, or neighbors grouping.

    • Author: Rex
    • Application of Board system
    "},{"location":"board-match/#live-demos","title":"Live demos","text":"
    • Match line
    • Match neighbors
    "},{"location":"board-match/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-match/#install-plugin","title":"Install plugin","text":""},{"location":"board-match/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add match object
      var match = scene.rexBoard.add.match(config);\n
    "},{"location":"board-match/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add match object
      var match = scene.rexBoard.add.match(config);\n
    "},{"location":"board-match/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Match } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add match object
      var match = new Match(config);\n
    "},{"location":"board-match/#add-match-object","title":"Add match object","text":"
    var match = scene.rexBoard.add.match({\nboard: board,\n// wildcard: undefined\n// dirMask: undefined\n});\n
    • board : A board object
    • wildcard : A string or a number
    • dirMask : Enable/Disable matching at directions, all directions are enbale by default.
      • Quad grid, 4 directions
        {\n0: true,  // set false to disable left/right matching\n1: true   // set false to disable up/down matching\n}\n
      • Quad grid, 8 directions
        {\n0: true,  // set false to disable left/right matching\n1: true,  // set false to disable up/down matching\n4: true,  // set false to disable left-down/right-up matching\n5: true   // set false to disable right-down/left-up matching\n}\n
      • Hexagon grid
        {\n0: true,\n1: true,\n3: true\n}\n
    "},{"location":"board-match/#custom-class","title":"Custom class","text":"
    • Define class
      class MyMatch extends RexPlugins.Board.Match {\nconstructor(config) {\nsuper(config);\n// ...\n}\n// ...\n}\n
    • Create instance
      var match = new MyMatch(config);\n
    "},{"location":"board-match/#set-board","title":"Set board","text":"

    Board object could be assigned later.

    match.setBoard(board);\n
    "},{"location":"board-match/#update-symbols","title":"Update symbols","text":"

    Each tile position (tileX, tileY) has a symbol.

    "},{"location":"board-match/#update-all-symbols-in-board","title":"Update all symbols in board","text":"
    match.refreshSymbols(function(tileXY, board) {\n// var chess = board.tileXYZToChess(tileXY.x, tileXY.y, 0);\n// if (chess == null) { return null; }\nreturn symbol;\n}, scope);\n
    • tileXY : Tile position {x, y}
    • board : Board object
    • symbol : A string or a number
      • null : No symbol
    "},{"location":"board-match/#updata-a-symbol","title":"Updata a symbol","text":"
    match.setSymbol(tileX, tileY, symbol);\n
    "},{"location":"board-match/#get-symbol","title":"Get symbol","text":"
    var symbol = match.getSymbol(tileX, tileY);\n
    "},{"location":"board-match/#for-each-symbol-cahce","title":"For each symbol cahce","text":"
    match.forEach(function(tileXY, symbol, board) {\n// return true; // Break for each loop\n}, scope)\n
    • tileXY : Tile position {x, y}
    • symbol : A string or a number
      • null : No symbol
    • board : Board object
    "},{"location":"board-match/#wildcard-symbol","title":"Wildcard symbol","text":"
    • Set
      match.setWildcard(symbol);\n
      or
      match.wildcard = symbol;\n
    • Get
      var wildcard = match.wildcard;\n
    "},{"location":"board-match/#directions-mask","title":"Directions mask","text":"

    Enable/Disable matching at directions, all directions are enbale by default.

    match.setDirMask(dir, value);\n
    • dir :
      • Quad grid, 4 directions : 0, 1
      • Quad grid, 8 directions : 0, 1, 4, 5
      • Hexagon grid : 0, 1, 2
    • value : true or false
    "},{"location":"board-match/#line-grouping","title":"Line grouping","text":""},{"location":"board-match/#match-n","title":"Match-N","text":"
    match.match(n, function (result, board) {\n// var chess = board.tileXYArrayToChess(result.tileXY, 0);\n// GroupCall(chess, function (chess) { chess.setScale(0.8); });\n\n// return true; // Break for each loop\n}, scope);\n
    • n : A number, to get matched chess with n equal symbols
    • result : A group of chess
      {\ntileXY: [],\ndirection: 0\npattern: symbol\n}\n
      • tileXY : An array of tile positions {x, y}
      • direction : Direction of this chess group
        • 0, 1, for quad grid with 4 directions
        • 0, 1, 4, 5, for quad grid with 8 directions
        • 0, 1, 2, for hexagon grid
      • pattern : Matched symbol
    • board : Board object
    "},{"location":"board-match/#any-match-n","title":"Any match-N","text":"
    var hasAnyMatchN = match.anyMatch(n);\n
    "},{"location":"board-match/#match-pattern","title":"Match pattern","text":"
    match.match(pattern, function (result, board) {\n// var chess = board.tileXYArrayToChess(result.tileXY, 0);\n// GroupCall(chess, function (chess) { chess.setScale(0.8); });\n}, scope);\n
    • pattern : A list of symbols
    "},{"location":"board-match/#any-match-pattern","title":"Any match pattern","text":"
    var hasAnyMatchN = match.anyMatch(pattern);\n
    "},{"location":"board-match/#neighbors-grouping","title":"Neighbors grouping","text":"
    • Group by neighbors with the same symbol
      tileXYArray = match.group(startTileX, startTileY);\n// out = match.group(startTileX, startTileY, out);\n
      • startTileX, startTileY : Tile position of grouping, to group neighbors with the same symbol. Can't start from null, undefined or wildcard symbol.
    "},{"location":"board-miniboard/","title":"Mini board","text":""},{"location":"board-miniboard/#introduction","title":"Introduction","text":"

    Chess Container, to rotate/mirror/drag chess together.

    • Author: Rex
    • Container Game object of chess group
    "},{"location":"board-miniboard/#live-demos","title":"Live demos","text":"
    • Group 4
    • Drag & drop, mirror, rotate
    "},{"location":"board-miniboard/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-miniboard/#install-plugin","title":"Install plugin","text":""},{"location":"board-miniboard/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add container
      var miniBoard = scene.rexBoard.add.miniBoard(x, y, config);\n
    "},{"location":"board-miniboard/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add container
      var miniBoard = scene.rexBoard.add.miniBoard(x, y, config);\n
    "},{"location":"board-miniboard/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { MiniBoard } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add match object
      var miniBoard = new MiniBoard(scene, x, y, config);\n
    "},{"location":"board-miniboard/#add-container","title":"Add Container","text":"
    var miniBoard = scene.rexBoard.add.miniBoard(x, y, {\ngrid: grid,\ndraggable: undefined,\n});\n
    • grid : Create board object first, then get grid object via board.grid.
      • gridType :
        • 'quadGrid' : Quad grid
        • 'hexagonGrid' : hexagon grid
    • draggable : Set true to enable dragging events
    "},{"location":"board-miniboard/#add-chess","title":"Add chess","text":"
    miniBoard.addChess(gameObject, tileX, tileY, tileZ);\n
    • chess : A game object.
    • tileX , tileY , tileZ : Tile position.
      • tileX , tileY : Number.
      • tileZ : Number or string.

    Chess and tile position

    • Any chess has a (tileX, tileY, tileZ) index
    • Any (tileX, tileY, tileZ) index contains only 1 chess.
    • (tileX, tileY) could have more then 1 chess with different tileZ index.
    • tileZ is not equal to depth.

    These world properties of chess will be changed with container.

    • Position/Angle/Scale
    • Visible
    • Alpha
    • Scroll factor
    • Mask
    "},{"location":"board-miniboard/#remove-chess","title":"Remove chess","text":"
    • Remove chess object from board
      miniBoard.removeChess(chess, null, null, null, destroy);\n
      • chess : A game object
      • destroy : Set true to desrtoy chess object.
    • Remove chess at (tileX, tileY, tileZ) from board
      miniBoard.removeChess(null, tileX, tileY, tileZ, destroy);\n
      • tileX, tileY, tileZ : Tile position
      • destroy : Set true to desrtoy chess object.
    • Remove all chess
      miniBoard.removeAllChess(destroy);\n
      • destroy : Set true to desrtoy chess object.
    "},{"location":"board-miniboard/#set-origin","title":"Set origin","text":"
    • Set origin tileXY by offset tileXY of all chess.
      miniBoard.setOrigin(origin);\n// miniBoard.setOrigin(originX, originY);\n
      • originX, originY: 0~1.
        • 0 : Left/top.
        • 0.5 : Center.
        • 1 : Right/bottom.
    • Set origin tileXY to center by offset tileXY of all chess.
      miniBoard.setOrigin();\n// miniBoard.setOrigin('center');\n
    • Set origin tileXY to top-left.
      miniBoard.setOrigin('top-left');\n
    "},{"location":"board-miniboard/#main-board","title":"Main board","text":"

    Put chess to a main-board (Board object) with the same tile position in mini-board, or pull chess out from main-board.

    "},{"location":"board-miniboard/#put-on-main-board","title":"Put on main-board","text":"
    miniBoard.putOnMainBoard(mainBoard, tileX, tileY);\n// miniBoard.putOnMainBoard(mainBoard, tileX, tileY, align);\n
    • mainBoard : Board object.
    • tileX, tileY : Tile position to put on.
    • align : Set true to align world position of each chess Game object to grid of main-board. Default is true.

    or

    miniBoard.putOnMainBoard(mainBoard);\n

    To put this mini-board to nearest grid of main-board.

    "},{"location":"board-miniboard/#pull-out-from-main-board","title":"Pull out from main-board","text":"
    miniBoard.pullOutFromMainBoard();\n

    Remove all chess from main-board.

    "},{"location":"board-miniboard/#put-back-to-previous-main-board","title":"Put back to previous main-board","text":"
    miniBoard.putBack();\n

    Previous main-board and tile position will be remembered for putting back.

    "},{"location":"board-miniboard/#is-overlapping-to-main-board","title":"Is overlapping to main-board","text":"

    Return true if any chess is overlapping to main-board.

    miniBoard.isOverlapping(mainBoard);\n

    or

    miniBoard.isOverlapping(mainBoard, tileZ);\n
    "},{"location":"board-miniboard/#align-world-position-to-grid-of-main-board","title":"Align world position to grid of main-board","text":"
    miniBoard.alignToMainBoard(mainBoard, tileX, tileY);\n
    • mainBoard : Board object
    • tileX, tileY : Tile position on main-board

    or

    miniBoard.alignToMainBoard(mainBoard);\n

    to align this mini-board to nearest grid of main-board.

    "},{"location":"board-miniboard/#get-current-main-board","title":"Get current main-board","text":"
    var board = miniBoard.mainBoard;\n
    • board : Board object

    Return null if this mini-board is not at any main-board.

    "},{"location":"board-miniboard/#rotate","title":"Rotate","text":""},{"location":"board-miniboard/#can-rotate","title":"Can rotate","text":"
    miniBoard.canRotate(n);\n
    • n : Rotate to direction current direction + n

    or

    miniBoard.canRotateTo(direction);\n
    • direction : Rotate to direction
      • 0 ~ 3 : Quad grid.
      • 0 ~ 5 : Hexagon grid.

    Always return true if this mini-board is not on a main-board.

    "},{"location":"board-miniboard/#rotate_1","title":"Rotate","text":"
    miniBoard.rotate(n);\n
    • n : Rotate direction to current direction + n

    or

    miniBoard.rotateTo(direction);\n
    • direction : Rotate to direction
      • 0 ~ 3 : Quad grid.
      • 0 ~ 5 : Hexagon grid.

    Return true if this rotating request is accepted.

    var isSuccess = miniBoard.lastTransferResult;\n
    "},{"location":"board-miniboard/#mirror","title":"Mirror","text":""},{"location":"board-miniboard/#can-mirror","title":"Can mirror","text":"
    miniBoard.canMirror(mode);\n
    • mode :
      • 0, or 'x' : Set tileX to -tileX
      • 1, or 'y' : Set tileY to -tileY
      • 3, or 'x&y' : Set tileX to -tileX, and tileY to -tileY

    Always return true if this mini-board is not on a main-board.

    "},{"location":"board-miniboard/#mirror_1","title":"Mirror","text":"
    miniBoard.mirror(mode);\n
    • mode :
      • 0, or 'x' : Set tileX to -tileX
      • 1, or 'y' : Set tileY to -tileY
      • 3, or 'x&y' : Set tileX to -tileX, and tileY to -tileY

    Return true if this mirroring request is accepted.

    var isSuccess = miniBoard.lastTransferResult;\n
    "},{"location":"board-miniboard/#touch-events","title":"Touch events","text":""},{"location":"board-miniboard/#set-interactive","title":"Set interactive","text":"
    • Enable
      miniBoard.setInteractive();\n
    • Disable
      miniBoard.setInteractive(false);\n
    "},{"location":"board-miniboard/#set-drag-able","title":"Set drag-able","text":"
    • Enable
      miniBoard.setDragEnable();\n
    • Disable
      miniBoard.setDragEnable(false);\n
    "},{"location":"board-miniboard/#touch-event","title":"Touch event","text":""},{"location":"board-miniboard/#pointer-down","title":"Pointer down","text":"
    • Pointer down at any chess
      miniBoard.on('pointerdown', function(pointer, miniBoard) {\n})\n
    • Pointer down at a chess
      miniBoard.on('gameobjectdown', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('miniboard.pointerdown', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board-miniboard/#pointer-up","title":"Pointer up","text":"
    • Pointer up
      miniBoard.on('pointerup', function(pointer, miniBoard) {\n})\n
    • Pointer up at a chess
      miniBoard.on('gameobjectup', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('miniboard.pointerup', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board-miniboard/#pointer-move","title":"Pointer move","text":"
    • Pointer move
      miniBoard.on('pointermove', function(pointer, miniBoard) {\n})\n
    • Pointer move to another chess
      miniBoard.on('gameobjectmove', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('miniboard.pointermove', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board-miniboard/#drag-events","title":"Drag events","text":"
    • Drag-start
      miniBoard.on('dragstart', function(pointer, dragX, dragY){\n/*\n    miniBoard.pullOutFromMainBoard();\n    */\n}, scope);\n
      Pull out from main-board for dragging.
    • Dragging
      miniBoard.on('drag', function(pointer, dragX, dragY){\n/*\n    miniBoard.setPosition(dragX, dragY);\n    if (miniBoard.isOverlapping(mainBoard)) {\n        miniBoard.alignToMainBoard(mainBoard);\n    }\n    */\n}, scope);\n
      Set world position of mini-board via (dragX, dragY), align to nearest grid of main-board if overlapping with that main-board.
    • Drag-end
      miniBoard.on('dragend', function(pointer, dragX, dragY){\n/*\n    miniBoard.putOnMainBoard(mainBoard);\n    if (miniBoard.mainBoard) {\n    }\n    */\n}, scope);\n
      Put chess on main-board at nearest grid.
    "},{"location":"board-monopoly/","title":"Monopoly","text":""},{"location":"board-monopoly/#introduction","title":"Introduction","text":"

    Move through path tiles, used in monopoly-like application, chess behavior of Board system.

    • Author: Rex
    • Behavior of chess
    "},{"location":"board-monopoly/#live-demos","title":"Live demos","text":"
    • Monopoly
    "},{"location":"board-monopoly/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-monopoly/#install-plugin","title":"Install plugin","text":""},{"location":"board-monopoly/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add monopoly behavior
      var monopoly = scene.rexBoard.add.monopoly(chess, config);\n
    "},{"location":"board-monopoly/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add monopoly behavior
      var monopoly = scene.rexBoard.add.monopoly(chess, config);\n
    "},{"location":"board-monopoly/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Monopoly } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add monopoly behavior
      var board = new Monopoly(chess, config);\n
    "},{"location":"board-monopoly/#create-instance","title":"Create instance","text":"
    var monopoly = scene.rexBoard.add.monopoly(chess, {\nface: 0,\n\n// ** cost **\n// pathTileZ: 0,\n// cost: 1,   // constant cost\n// costCallback: undefined,\n// costCallbackScope: undefined\n})\n
    • face : Moving direction.
      • 0 ~ 3 : Quad grid in 4 directions mode.
      • 0 ~ 7 : Quad grid in 8 directions mode.
      • 0 ~ 5 : Hexagon grid.
    • Cost function
      • pathTileZ : TileZ of path tiles.
      • cost : A constant cost for each non-blocked tile
      • costCallback, costCallbackScope : Get cost via callback
        function(curTileXY, preTileXY, monopoly) {\nreturn cost;\n}\n
    "},{"location":"board-monopoly/#cost-function","title":"Cost function","text":"
    var callback = function(curTileXY, preTileXY, monopoly) {\nreturn cost;\n}\n
    • cost : Number cost.
    • curTileXY, preTileXY : TileXY position {x, y}. Cost of moving from preTileXY to curTileXY.
    • monopoly : Path finder object.
      • monopoly.board : Board object
      • monopoly.gameObject : Chess game object.
      • monopoly.STOP, or -1 : Cost of stop. Return this value means chess will stop at curTileXY.
      • monopoly.BLOCKER, or null : Cost of blocker. Return this value means that chess can not move to curTileXY.
    "},{"location":"board-monopoly/#set-cost-function","title":"Set cost function","text":"
    • Constant cost for each non-blocked tile
      monopoly.setCostFunction(cost);\n
    • Get cost via callback
      monopoly.setCostFunction(callback, scope);\n
    "},{"location":"board-monopoly/#set-face-direction","title":"Set face direction","text":"
    monopoly.setFace(direction);\n
    • direction :
      • 0 ~ 3 : Quad grid in 4 directions mode.
      • 0 ~ 7 : Quad grid in 8 directions mode.
      • 0 ~ 5 : Hexagon grid.

    Moving direction

    Get path toward this face direction.

    "},{"location":"board-monopoly/#get-path","title":"Get path","text":"
    var tileXYArray = monopoly.getPath(movingPoints);\n// var out = monopoly.getPath(movingPoints, out);\n
    • tileXYArray : Moving path in an array of tile positions {x,y}
      • Uses moveTo behavior to move chess along path.
    "},{"location":"board-moveto/","title":"Move to","text":""},{"location":"board-moveto/#introduction","title":"Introduction","text":"

    Move chess towards target position with a steady speed, chess behavior of Board system.

    • Author: Rex
    • Behavior of chess
    "},{"location":"board-moveto/#live-demos","title":"Live demos","text":"
    • Push
    • Follow chess
    "},{"location":"board-moveto/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-moveto/#install-plugin","title":"Install plugin","text":""},{"location":"board-moveto/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add move-to behavior
      var moveTo = scene.rexBoard.add.moveTo(chess, config);\n
    "},{"location":"board-moveto/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add move-to behavior
      var moveTo = scene.rexBoard.add.moveTo(chess, config);\n
    "},{"location":"board-moveto/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { MoveTo } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add move-to behavior
      var moveTo = new MoveTo(chess, config);\n
    "},{"location":"board-moveto/#create-instance","title":"Create instance","text":"
    var moveTo = scene.rexBoard.add.moveTo(chess, {\n// speed: 400,\n\n// rotateToTarget: false,\n\n// occupiedTest: false,\n// blockerTest: false,\n// moveableTest: undefined,\n// moveableTestScope: undefined,\n\n// sneak: false,\n})\n
    • speed : moving speed, pixels in second.
    • rotateToTarget : Set true to change angle towards path.
    • occupiedTest : Set true to test if target tile position is occupied or not, in moveable testing.
    • blockerTest : Set true to test blocker property in moveable testing.
    • moveableTest, moveableTestScope : Custom moveable test callback
      function(fromTileXYZ, toTileXYZ, direction, board) {\nreturn true;\n}\n
      • fromTileXYZ, toTileXYZ : Move chess from tileXYZ {x, y, z}, to tileXYZ {x, y, z}
      • direction :
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
      • board : Board object.
    • sneak : Set true to allow changing tileZ when target tile position is occupied. Changing back when target tile position is not occupied.
      • occupiedTest will be ignored when sneak is true.
    "},{"location":"board-moveto/#move-to-destination-tile","title":"Move to destination tile","text":"
    moveTo.moveTo(tileX, tileY);\n// moveTo.moveTo(tileXY);\n
    • tileXY : Tile position {x,y}
    "},{"location":"board-moveto/#move-to-neighbor-tile","title":"Move to neighbor tile","text":"
    moveTo.moveToward(direction);\n
    • direction :
      • 0 ~ 3 : Quad grid in 4 directions mode.
      • 0 ~ 7 : Quad grid in 8 directions mode.
      • 0 ~ 5 : Hexagon grid.
    "},{"location":"board-moveto/#move-to-random-neighbor-tile","title":"Move to random neighbor tile","text":"
    moveTo.moveToRandomNeighbor();\n
    "},{"location":"board-moveto/#move-away-or-move-closer","title":"Move away or move closer","text":"
    • Move away from a tile position
      moveTo.moveAway(tileX, tileY);\n
      or
      moveTo.moveAway(tileXY);\n
      • tileXY : Tile position {x,y}
    • Move closer to a tile position
      moveTo.moveCloser(tileX, tileY);\n
      or
      moveTo.moveCloser(tileXY);\n
      • tileXY : Tile position {x,y}
    "},{"location":"board-moveto/#can-move-to-tile","title":"Can move to tile","text":"
    var canMoveTo = moveTo.canMoveTo(tileX, tileY);\n

    Return true if chess can move to (tileX, tileY)

    "},{"location":"board-moveto/#last-move-result","title":"Last move result","text":"
    var lastMoveResult = moveTo.lastMoveResult;\n

    Return true if chess is moved by moveTo.moveTo(), moveTo.moveToward(), or moveTo.moveToRandomNeighbor()

    "},{"location":"board-moveto/#destination","title":"Destination","text":"
    var destinationTileX = moveTo.destinationTileX;\nvar destinationTileY = moveTo.destinationTileY;\nvar destinationDirection = moveTo.destinationDirection;\n
    "},{"location":"board-moveto/#pause-resume-stop-moving","title":"Pause, Resume, stop moving","text":"
    moveTo.pause();\nmoveTo.resume();\nmoveTo.stop();\n
    "},{"location":"board-moveto/#enable","title":"Enable","text":"
    • Enable/resume (default)
      moveTo.setEnable();\n
      or
      moveTo.enable = true;\n
    • Disable/pause
      moveTo.setEnable(false);\n
      or
      moveTo.enable = false;\n
    "},{"location":"board-moveto/#set-speed","title":"Set speed","text":"
    moveTo.setSpeed(speed);\n// moveTo.speed = speed;\n
    "},{"location":"board-moveto/#set-rotate-to-target","title":"Set rotate-to-target","text":"
    moveTo.setRotateToTarget(rotateToTarget);\n
    • rotateToTarget : Set true to change angle towards target
    "},{"location":"board-moveto/#events","title":"Events","text":"
    • Try to move on an occupied tile position
      moveTo.on('occupy', function(occupiedChess, gameObject, moveTo){\n// Move away occupiedChess\n});\n
    • On reached target
      moveTo.on('complete', function(gameObject, moveTo){});\n// moveTo.once('complete', function(gameObject, moveTo){});\n
    "},{"location":"board-moveto/#status","title":"Status","text":"
    • Is moving
      var isRunning = moveTo.isRunning;\n
    "},{"location":"board-overview/","title":"Overview","text":""},{"location":"board-overview/#install-plugin","title":"Install plugin","text":""},{"location":"board-overview/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add board object
      var board = scene.rexBoard.add.board(config);\n
    "},{"location":"board-overview/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add board object
      var board = scene.rexBoard.add.board(config);\n
    "},{"location":"board-overview/#using-typescript-declaration-file","title":"Using typescript declaration file","text":"
    import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\n\nclass Game extends Phaser.Scene {\nrexBoard: BoardPlugin;  // Declare scene property 'rexBoard' as BoardPlugin type\n\ncreate() {\nvar board = this.rexBoard.add.board({\n// ...\n})\n}\n}\n\nvar game = new Phaser.Game({\nscene: Game,\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n});\n
    • 'phaser3-rex-plugins/plugins/board-plugin' : Factories of board components.
    • 'phaser3-rex-plugins/plugins/board-components' : Class of board components.
      import { Board } from 'phaser3-rex-plugins/plugins/board-components';\n

    See this example

    "},{"location":"board-overview/#list-of-board-plugins","title":"List of board plugins","text":""},{"location":"board-overview/#board","title":"Board","text":"
    • Board
    • Grids
      • Quad grid
      • Hexagon grid
    • Chess
    "},{"location":"board-overview/#chess-game-object","title":"Chess game object","text":"
    • Shape game object
    • Image game object
    • Sprite game object
    • Tile texture
    "},{"location":"board-overview/#behaviors","title":"Behaviors","text":"
    • Move to
    "},{"location":"board-overview/#applications","title":"Applications","text":"
    • Path finder
    • Monopoly
    • Field of view
    • Match
    • Hexagon map
    "},{"location":"board-overview/#mini-board","title":"Mini-board","text":"
    • Mini-board
    "},{"location":"board-overview/#templates","title":"Templates","text":"
    • Bejeweled
    "},{"location":"board-pathfinder/","title":"Path finder","text":""},{"location":"board-pathfinder/#introduction","title":"Introduction","text":"

    Find moveable area or moving path, chess behavior of Board system.

    • Author: Rex
    • Application of Board system, or behavior of chess
    "},{"location":"board-pathfinder/#live-demos","title":"Live demos","text":"
    • Find area, get path
    • Draw path
    • Energy drain
    • Turning cost
    • Move from high to low
    • Chinese checkers
    "},{"location":"board-pathfinder/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-pathfinder/#install-plugin","title":"Install plugin","text":""},{"location":"board-pathfinder/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add path-finder
      var pathFinder = scene.rexBoard.add.pathFinder(config);\n
    "},{"location":"board-pathfinder/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add path-finder
      var pathFinder = scene.rexBoard.add.pathFinder(config);\n
    "},{"location":"board-pathfinder/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PathFinder } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add path-finder
      var pathFinder = new PathFinder(config);\n
    "},{"location":"board-pathfinder/#create-instance","title":"Create instance","text":"
    var pathFinder = scene.rexBoard.add.pathFinder({\n// occupiedTest: false,\n// blockerTest: false,\n\n// ** cost **\n// cost: 1,   // constant cost\n// costCallback: undefined,\n// costCallbackScope: undefined,\n// cacheCost: true,\n\n// pathMode: 10,  // A*\n// weight: 10,   // weight for A* searching mode\n// shuffleNeighbors: false,\n})\n
    • occupiedTest : Set true to test if target tile position is occupied or not, in cost function.
    • blockerTest : Set true to test blocker property in cost function.
    • Cost function
      • cost : A constant cost for each non-blocked tile
      • costCallback, costCallbackScope : Get cost via callback
        function(curTile, preTile, pathFinder) {\nreturn cost;\n}\n
        • Board : pathFinder.board
        • Chess game object : pathFinder.gameObject
        • Cost of blocker : pathFinder.BLOCKER
    • pathMode
      • Shortest path
        • 'random', or 0
        • 'diagonal', or 1
        • 'straight', or 2
        • 'line', or 3
      • A* path
        • 'A*', or 10
        • 'A*-random', or 11
        • 'A*-line', or 12
    • weight : Weight parameter for A* searching mode.
    • cacheCost : Set false to get cost every time. It is useful when cost is a function of (current tile, previous tile).
    • shuffleNeighbors : Shuffle neighbors.
    "},{"location":"board-pathfinder/#create-behavior","title":"Create behavior","text":"
    var pathFinder = scene.rexBoard.add.pathFinder(chess, config);\n
    "},{"location":"board-pathfinder/#set-chess","title":"Set chess","text":"
    pathFinder.setChess(chess);\n

    Note

    Don't use this method if pathFinder is a behavior of Chess

    "},{"location":"board-pathfinder/#cost-function","title":"Cost function","text":"
    var callback = function(curTileXY, preTileXY, pathFinder) {\nreturn cost;\n}\n
    • cost : Number cost.
    • curTileXY, preTileXY : TileXY position {x, y}. Cost of moving from preTileXY to curTileXY.
      • preTileXY.pathCost : Path cost of preTilexY.
      • preTileXY.preNodes : Previous tiles of preTileXY.
    • pathFinder : Path finder object.
      • pathFinder.board : Board object
      • pathFinder.gameObject : Chess game object.
      • pathFinder.BLOCKER : Cost of blocker. Return this value means that chess can not move to curTileXY.
    "},{"location":"board-pathfinder/#set-cost-function","title":"Set cost function","text":"
    • Constant cost for each non-blocked tile
      pathFinder.setCostFunction(cost);\n
    • Get cost via callback
      pathFinder.setCostFunction(callback, scope);\n
    "},{"location":"board-pathfinder/#set-path-mode","title":"Set path mode","text":"
    pathFinder.setPathMode(pathMode)\n
    • pathMode
      • Shortest path
        • 'random', or 0
        • 'diagonal', or 1
        • 'straight', or 2
        • 'line', or 3
      • A* path
        • 'A*', or 10
        • 'A*-random', or 11
        • 'A*-line', or 12
    "},{"location":"board-pathfinder/#find-moveable-area","title":"Find moveable area","text":"
    var tileXYArray = pathFinder.findArea(movingPoints);\n// var out = pathFinder.findArea(movingPoints, out);\n
    • movingPoints
      • pathFinder.INFINITY (undefined) : Infinity moving points. Default value.
    • tileXYArray : An array of moveable tile positions {x,y,pathCost}
    "},{"location":"board-pathfinder/#get-shortest-path-to-a-moveable-tile","title":"Get shortest path to a moveable tile","text":"
    var tileXYArray = pathFinder.getPath(endTileXY);\n
    • endTileXY : Tile position of moveable area in last result of pathFinder.findArea()
    • tileXYArray : Moving path in an array of tile positions {x,y,pathCost}
      • Uses moveTo behavior to move chess along path.

    Path mode

    • Path info of each tile is calculated during pathFinder.findArea()
    "},{"location":"board-pathfinder/#find-moving-path","title":"Find moving path","text":"
    var tileXYArray = pathFinder.findPath(endTileXY);\n// var tileXYArray = pathFinder.findPath(endTileXY, movingPoints, isClosest, out);\n
    • endTileXY : Tile position
    • tileXYArray : Moving path in an array of tile positions {x,y,pathCost}
      • Uses moveTo behavior to move chess along path.
    • movingPoints
      • pathFinder.INFINITY (undefined) : Infinity moving points. Default value.
    • isClosest : Set true to get closest path.

    Path mode

    • Set pathMode to A* ('A*', 'A*-random', or 'A*-line') to speed up calculating.
    "},{"location":"board-pathfinder/#cost-of-tile","title":"Cost of tile","text":"

    During or after finding moveable area...

    • Get cost of path from chess to tile
      var pathCost = pathFinder.tileXYToCost(tileX, tileY, true);\n
    • Get cost of tile
      var tileCost = pathFinder.tileXYToCost(tileX, tileY, false);\n
    "},{"location":"board-quadgrid/","title":"Quad","text":""},{"location":"board-quadgrid/#introduction","title":"Introduction","text":"

    Quad grid object of Board system.

    • Author: Rex
    • Grid object of board
    "},{"location":"board-quadgrid/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-quadgrid/#create-instance","title":"Create instance","text":"
    var grid = scene.rexBoard.add.quadGrid({\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\ntype: 0,\n// dir: 4\n});\n

    or

    // import { QuadGrid } from 'phaser3-rex-plugins/plugins/board-components.js';\nvar grid = new QuadGrid(config);\n
    • x, y : World position of tile (0, 0)
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • type
      • 0, or orthogonal
      • 1, or isometric
    • dir :
      • 4 or '4dir' : Left/Down/Right/Up
      • 8 or '8dir' : Left/Down/Right/Up/Left-down/Down-right/Right-up/Up-left
    "},{"location":"board-quadgrid/#world-position-of-tile-0-0","title":"World position of tile (0, 0)","text":"
    • Get
      var worldX = grid.x;\nvar worldY = grid.y;\n
    • Set
      grid.setOriginPosition(worldX, worldY);\n
      or
      grid.x = worldX;\ngrid.y = worldY;\n
    "},{"location":"board-quadgrid/#cell-size","title":"Cell size","text":"
    • Get
      var width = grid.width;\nvar height = grid.height;\n
    • Set
      grid.setCellSize(width, height);\n
      or
      grid.width = width;\ngrid.height = height;\n
    "},{"location":"board-quadgrid/#grid-type","title":"Grid type","text":"
    • Get
      var mode = grid.mode;\n
    • Set
      grid.setType(mode);\n
      • mode
        • 0, or orthogonal
        • 1, or isometric
    "},{"location":"board-quadgrid/#get-world-position","title":"Get world position","text":"
    var worldXY = grid.getWorldXY(tileX, tileY);  // worldXY: {x, y}\n// var out = grid.getWorldXY(tileX, tileY, out);\n
    "},{"location":"board-quadgrid/#get-tile-position","title":"Get tile position","text":"
    var tileXY = grid.getTileXY(worldX, worldY);  // tileXY: {x, y}\n// var out = grid.getTileXY(worldX, worldY, out);\n
    "},{"location":"board-quadgrid/#directions","title":"Directions","text":"
    • 0 : Right
    • 1 : Down
    • 2 : Left
    • 3 : Up
    • 4 : Right-down
    • 5 : Left-down
    • 6 : Left-up
    • 7 : Right-up
    6|3|7\n-+-+-\n2|A|0\n-+-+-\n5|1|4\n
    "},{"location":"board-shape/","title":"Shape","text":""},{"location":"board-shape/#introduction","title":"Introduction","text":"

    Grid (polygon) shape chess object.

    • Author: Rex
    • Chess Game object of Board system
    "},{"location":"board-shape/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-shape/#install-plugin","title":"Install plugin","text":""},{"location":"board-shape/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add chess object
      var chess = scene.rexBoard.add.shape(board, tileX, tileY, tileZ, fillColor);\n
    "},{"location":"board-shape/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add chess object
      var chess = scene.rexBoard.add.shape(board, tileX, tileY, tileZ, fillColor);\n
    "},{"location":"board-shape/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Shape } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add chess object
      var chess = new Shape(board, tileX, tileY, tileZ, fillColor);\nscene.add.existing(chess);\n
    "},{"location":"board-shape/#add-chess-object","title":"Add chess object","text":"
    • Create chess object and add to board
      var chess = scene.rexBoard.add.shape(board, tileX, tileY, tileZ, fillColor, fillAlpha);\n
      • board : Board object
      • tileX, tileY, tileZ : Tile position
      • fillColor, fillAlpha : Color of this shape chess object
    • Create chess object but not add to board
      var chess = scene.rexBoard.add.shape(board, x, y, undefined, fillColor, fillAlpha, false);\n
      • board : Board object
      • x, y : World position
      • fillColor, fillAlpha : Color of this shape chess object
    "},{"location":"board-shape/#set-color","title":"Set color","text":"
    • Fill color
      chess.setFillStyle(color, alpha)\n
    • Stroke color
      chess.setStrokeStyle(lineWidth, color, alpha)\n

    No tint methods

    Uses shape.setFillStyle(color, alpha) to change color.

    "},{"location":"board-shape/#other-properties","title":"Other properties","text":"

    See polygon shape game object, game object

    "},{"location":"board-sprite/","title":"Sprite","text":""},{"location":"board-sprite/#introduction","title":"Introduction","text":"

    Sprite chess object.

    • Author: Rex
    • Chess Game object of Board system
    "},{"location":"board-sprite/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-sprite/#install-plugin","title":"Install plugin","text":""},{"location":"board-sprite/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add chess object
      var chess = scene.rexBoard.add.sprite(board, tileX, tileY, tileZ, key, frame);\n
    "},{"location":"board-sprite/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add chess object
      var chess = scene.rexBoard.add.sprite(board, tileX, tileY, tileZ, key, frame);\n
    "},{"location":"board-sprite/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Sprite } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add chess object
      var chess = new Sprite(board, tileX, tileY, tileZ, key, frame);\nscene.add.existing(chess);\n
    "},{"location":"board-sprite/#add-chess-object","title":"Add chess object","text":"
    • Create chess object and add to board
      var chess = scene.rexBoard.add.sprite(board, tileX, tileY, tileZ, key, frame);\n
      • board : Board object
      • tileX, tileY, tileZ : Tile position
      • key, frame : Frame of this sprite chess object
    • Create chess object but not add to board
      var chess = scene.rexBoard.add.sprite(board, x, y, undefined, key, frame, false);\n
      • board : Board object
      • x, y : World position
      • key, frame : Frame of this sprite chess object
    "},{"location":"board-sprite/#other-properties","title":"Other properties","text":"

    See Sprite game object, game object

    "},{"location":"board-texture/","title":"Tile texture","text":""},{"location":"board-texture/#introduction","title":"Introduction","text":"

    Create canvas-texture of tile.

    • Author: Rex
    • Help method of board
    "},{"location":"board-texture/#live-demos","title":"Live demos","text":"
    • Tile texture
    "},{"location":"board-texture/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-texture/#install-plugin","title":"Install plugin","text":""},{"location":"board-texture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Create tile texture
      scene.rexBoard.createTileTexture(board, key, fillStyle, strokeStyle, lineWidth);\n
    "},{"location":"board-texture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create tile texture
      scene.rexBoard.createTileTexture(board, key, fillStyle, strokeStyle, lineWidth);\n
    "},{"location":"board-texture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { CreateTileTexture } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Create tile texture
      CreateTileTexture(board, key, fillStyle, strokeStyle, lineWidth);\n
    "},{"location":"board-texture/#create-tile-texture","title":"Create tile texture","text":""},{"location":"board-texture/#hexagon","title":"Hexagon","text":"
    CreateTileTexture(board, key, fillStyle, strokeStyle, lineWidth);\n// CreateTileTexture(board, key, fillStyle, strokeStyle, lineWidth, overlapGrid, lineJoin);\n
    • board : Board object.
    • fillStyle : Fill color of tile texture.
      • undefined : Don't fill tile texture.
    • strokeStyle, lineWidth : Stroke color, stroke line width of tile texture.
      • undefined : Don't stroke tile texture.
    • overlapGrid :
      • true : Overlap grid. i.e. Grid width = lineWidth. Default behavior.
      • false : Don't overlap grid. i.e. Grid width = 2 * lineWidth.
    • lineJoin : Join style of stroke lines. 'round', 'bevel' and 'miter'. Default is 'miter'.
    "},{"location":"board-tilemap/","title":"Tilemap","text":""},{"location":"board-tilemap/#introduction","title":"Introduction","text":"

    Create board from tilemap

    • Author: Rex
    • Help method of board
    "},{"location":"board-tilemap/#live-demos","title":"Live demos","text":"
    • Create board from tilemap
    "},{"location":"board-tilemap/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-tilemap/#install-plugin","title":"Install plugin","text":""},{"location":"board-tilemap/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Create board from tilemap
      var board = scene.rexBoard.createBoardFromTilemap(tilemap, layers);\n
    "},{"location":"board-tilemap/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create board from tilemap
      var board = scene.rexBoard.createBoardFromTilemap(tilemap, layers);\n
    "},{"location":"board-tilemap/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { CreateBoardFromTilemap } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Create board from tilemap
      var board = CreateBoardFromTilemap(tilemap, layers);\n
    "},{"location":"board-tilemap/#create-board-from-tilemap","title":"Create board from tilemap","text":"
    var board = CreateBoardFromTilemap(tilemap, layers);\n
    • tilemap : Tilemap object
    • layers : Add tiles of layers into board, tileZ will be name of layer (layer.name)
      • undefined : Add tiles of all layers.
      • Array of TilemapLayer game object, or a TilemapLayer game object
      • Array of layers' name, or a name of layer.
    • board : Board object.
    "},{"location":"board/","title":"Board","text":""},{"location":"board/#introduction","title":"Introduction","text":"

    Core object of Board system.

    • Author: Rex
    • Member of scene
    "},{"location":"board/#live-demos","title":"Live demos","text":"
    • Touch events
    • Get tileXY at direction
    • Line to tileXY array
    • Triangle to tileXY array
    • Ellipse to tileXY array
    • Bounds
    "},{"location":"board/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board/#install-plugin","title":"Install plugin","text":""},{"location":"board/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add board object
      var board = scene.rexBoard.add.board(config);\n
    "},{"location":"board/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add board object
      var board = scene.rexBoard.add.board(config);\n
    "},{"location":"board/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Board, HexagonGrid, QuadGrid } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add board object
      var board = new Board(scene, {\ngrid: QuadGrid(gridConfig),  // or HexagonGrid(gridConfig)\n// ...\n});\n
    "},{"location":"board/#add-board-object","title":"Add board object","text":"
    • Quad board
      var board = scene.rexBoard.add.board({\ngrid: {\ngridType: 'quadGrid',\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\ntype: 'orthogonal'  // 'orthogonal'|'isometric'\n},\n// width: 0,\n// height: 0,\n// wrap: false,\n// infinity: false,\n});\n
    • Hexagon board
      var board = scene.rexBoard.add.board({\ngrid: {\ngridType: 'hexagonGrid',\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\nstaggeraxis: 'x',   // 'x'|'y'\nstaggerindex: 'odd' // 'odd'|'even'\n},\n// width: 0,\n// height: 0,\n// wrap: false,\n// infinity: false,\n});\n

    Configuration

    • grid :
      • gridType :
        • 'quadGrid' : Quad grid
        • 'hexagonGrid' : hexagon grid
    • width : Board width in tiles
    • height : Board height in tiles
    • wrap : Set true to wrap board bounds. Default value is false.
    • infinity : Infinity board size if set to true. Default value is false.
    "},{"location":"board/#custom-class","title":"Custom class","text":"
    • Define class
      class MyBoard extends RexPlugins.Board.Board {\nconstructor(scene) {\nsuper(scene, {\ngrid: {\ngridType: 'quadGrid',\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\ntype: 'orthogonal'  // 'orthogonal'|'isometric'\n},\nwidth: 0,\nheight: 0\n});\n// ...\n}\n// ...\n}\n
    • Create instance
      var board = new MyBoard(scene);\n
    "},{"location":"board/#board-size","title":"Board size","text":"
    • Width : Board width in tiles
      • Get
        var width = board.width;\n
      • Set
        board.setBoardWidth(width);\n
    • Height : Board height in tiles
      • Get
        var height = board.height;\n
      • Set
        board.setBoardHeight(height);\n
    "},{"location":"board/#add-chess","title":"Add chess","text":"
    board.addChess(chess, tileX, tileY, tileZ, align);\n
    • chess : A game object.
    • tileX , tileY , tileZ : Tile position.
      • tileX , tileY : Number.
      • tileZ : Number or string.
    • align : Set true to align (i.e. set position) chess to grid (tileX, tileY). Default is true.

    Chess and tile position

    • Any chess has a (tileX, tileY, tileZ) index
    • Any (tileX, tileY, tileZ) index contains only 1 chess.
    • (tileX, tileY) could have more then 1 chess with different tileZ index.
    • tileZ is not equal to depth.
    "},{"location":"board/#kick-out-event","title":"Kick-out event","text":"

    Board will fire kickout event when adding chess to an occupied grid.

    board.on('kickout', function(chessToAdd, occupiedChess, tileXYZ){\n})\n

    chessToAdd kicks out occupiedChess at tile position tileXYZ({x,y,z}).

    "},{"location":"board/#remove-chess","title":"Remove chess","text":"
    • Remove chess object from board
      board.removeChess(chess, null, null, null, destroy);\n
      • chess : A game object
      • destroy : Set true to desrtoy chess object.
    • Remove chess at (tileX, tileY, tileZ) from board
      board.removeChess(null, tileX, tileY, tileZ, destroy);\n
      • tileX, tileY, tileZ : Tile position
      • destroy : Set true to desrtoy chess object.
    • Remove all chess
      board.removeAllChess(destroy);\n
      • destroy : Set true to desrtoy chess object.
    "},{"location":"board/#move-chess","title":"Move chess","text":"
    board.moveChess(chess, toTileX, toTileY, toTileZ, align);\n
    • chess : A game object
    • toTileX, toTileY, toTileZ : Target tile position
    • align : Set true to align (i.e. set position) chess to grid (tileX, tileY). Default is true.

    Do nothing if chess is not at this board.

    "},{"location":"board/#set-tilez-of-chess","title":"Set tileZ of chess","text":"
    board.setChessTileZ(chess, toTileZ, align);\n
    • chess : A game object
    • toTileZ : Target tileZ
    • align : Set true to align (i.e. set position) chess to grid (tileX, tileY). Default is false.
    "},{"location":"board/#swap-chess","title":"Swap chess","text":"
    board.swapChess(chessA, chessB, align);\n
    • chessA, chessB : Game objects
    • align : Set true to align (i.e. set position) chess to grid (tileX, tileY).
    "},{"location":"board/#chess-tile-position","title":"Chess -> tile position","text":"
    var tileXYZ = board.chessToTileXYZ(chess);\n
    • chess : A game object
    • tileXYZ : {x,y,z} or null if chess is not added to board.
    "},{"location":"board/#tile-position-chess","title":"Tile position -> chess","text":"
    • Get chess at (tileX, tileY, tileZ)
      var chess = board.tileXYZToChess(tileX, tileY, tileZ);\n
      • chess : A game object
    • Get chess at (tileX, tileY)
      var out = board.tileXYToChessArray(tileX, tileY);\n// var out = board.tileXYToChessArray(tileX, tileY, out);\n
      • out : An array of chess
    • Get chess at tileZ
      var out = board.tileZToChessArray(tileZ);\n// var out = board.tileZToChessArray(tileZ, out);\n
      • out : An array of chess
    • Get chess from array of (tileX, tileY)
      var out = board.tileXYArrayToChessArray(tileXYArray);\n// var out = board.tileXYArrayToChessArray(tileXYArray, out);\n
      or
      var out = board.tileXYArrayToChessArray(tileXYArray, tileZ);\n// var out = board.tileXYArrayToChessArray(tileXYArray, tileZ, out);\n
      • tileXYArray : An array of tileXY {x, y}
      • out : An array of chess
    "},{"location":"board/#world-position-chess","title":"World position -> chess","text":"
    • Get chess at (worldX, worldY)
      var out = board.worldXYToChessArray(worldX, worldY);\n// var out = board.worldXYToChessArray(worldX, worldY, out);\n
      • out : An array of chess
    • Get chess at (worldX, worldY), tileZ
      var chess = board.worldXYToChess(worldX, worldY, tileZ);\n
      • chess : A game object
    • Get chess at (worldX, worldY)
      var chess = board.worldXYToChess(worldX, worldY);\n
      • chess : A game object at a tileZ.
    "},{"location":"board/#contains","title":"Contains","text":"
    • Is (tileX, tileY) inside board?
      var isTileInBoard = board.contains(tileX, tileY);\n
    • Does (tileX, tileY, tileZ) have chess?
      var isTileInBoard = board.contains(tileX, tileY, tileZ);\n
    • Is chess inside board?
      var isChessInBoard = board.exists(chess);\n
      • chess : A game object
    "},{"location":"board/#for-each-tile","title":"For each tile","text":"
    board.forEachTileXY(function(tileXY, board) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n}, scope);\n

    Iteration order :

    board.forEachTileXY(function(tileXY, board) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n\n// return isBreak;\n}, scope, order);\n
    • order :
      • 0, or 'x+' : Increasing x, increasing y.
      • 1, or 'x-' : Decreasing x, increasing y.
      • 2, or 'y+' : Increasing y, increasing x.
      • 3, or 'y-' : Decreasing y, increasing x.

    Or using for-loop

    for (var tileY = 0; tileY < board.height; tileY++) {\nfor (var tileX = 0; tileX < board.width; tileX++) {\n// ...\n}\n}\n
    • board.width , board.height : Board width/height in tiles.
    "},{"location":"board/#for-each-tile-in-viewport-of-a-camera","title":"For each tile in viewport of a camera","text":"
    board.forEachCullTileXY(function(tileXY, board) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n}, scope);\n
    board.forEachCullTileXY(function(tileXY, board) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n}, scope, {\ncamera: board.scene.cameras.main,\npaddingX: 1,\npaddingY: 1,\norder: 0,\n});\n
    • camera : Camera of scene. Default value is the main camera.
    • paddingX , paddingY : Padding space of camera's viewport
    • order :
      • 0, or 'x+' : Increasing x, increasing y.
      • 1, or 'x-' : Decreasing x, increasing y.
      • 2, or 'y+' : Increasing y, increasing x.
      • 3, or 'y-' : Decreasing y, increasing x.
    "},{"location":"board/#tile-position-world-position","title":"Tile position -> world position","text":"
    var worldXY = board.tileXYToWorldXY(tileX, tileY);  // worldXY: {x, y}\n// var out = board.tileXYToWorldXY(tileX, tileY, out);\n
    "},{"location":"board/#world-position-tile-position","title":"World position -> tile position","text":"
    var tileXY = board.worldXYToTileXY(worldX, worldY);  // tileXY: {x, y}\n// var out = board.worldXYToTileXY(worldX, worldY, out);\n
    "},{"location":"board/#world-position-grid-world-position","title":"World position -> Grid world position","text":"
    var gridWorldXY = board.worldXYSnapToGrid(worldX, worldY);\n// var out = board.worldXYSnapToGrid(worldX, worldY, out);\n
    "},{"location":"board/#grid-distance","title":"Grid distance","text":"
    var distance = board.getDistance(tileA, tileB);\n
    • tileA, tileB : Chess object, or tileXY {x, y}.
    "},{"location":"board/#ring-tile-position","title":"Ring -> tile position","text":"
    • Get array of tile position around a ring.
      var out = board.ringToTileXYArray(centerTileXY, radius);\n// var out = board.ringToTileXYArray(centerTileXY, radius, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
      • radius : Radius of the ring.
    • Get array of tile position within a filled ring. centerTileXY will be included.
      var out = board.filledRingToTileXYArray(centerTileXY, radius);\nvar out = board.filledRingToTileXYArray(centerTileXY, radius, nearToFar);\n// var out = board.filledRingToTileXYArray(centerTileXY, radius, out);\n// var out = board.filledRingToTileXYArray(centerTileXY, radius, nearToFar, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
      • radius : Radius of the ring.
      • nearToFar : From near ring to far ring. Default value is true.
    "},{"location":"board/#ring-chess","title":"Ring -> chess","text":"
    • Get array of chess around a ring.
      var out = board.ringToChessArray(centerTileXY, radius, tileZ);\n// var out = board.ringToChessArray(centerTileXY, radius, tileZ, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
    • Get array of chess within a filled ring. Chess at centerTileXY will be included.
      var out = board.filledRingToTileXYArray(centerTileXY, radius, tileZ);\nvar out = board.filledRingToTileXYArray(centerTileXY, radius, tileZ, nearToFar);\n// var out = board.filledRingToTileXYArray(centerTileXY, radius, tileZ, out);\n// var out = board.filledRingToTileXYArray(centerTileXY, radius, tileZ, nearToFar, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
    "},{"location":"board/#shape-tile-position","title":"Shape -> tile position","text":""},{"location":"board/#line-tile-position","title":"Line -> tile position","text":"

    Get array of tile position along a line defined via (startWorldX, startWorldY) to (endWorldX, endWorldY)

    var out = board.lineToTileXYArray(startWorldX, startWorldY, endWorldX, endWorldY);\n// var out = board.lineToTileXYArray(startWorldX, startWorldY, endWorldX, endWorldY, out);\n
    • startWorldX, startWorldY, endWorldX, endWorldY : Start and end pointer of a line
    • out : An array of tile position

    or

    var out = board.lineToTileXYArray(line);\n// var out = board.lineToTileXYArray(line, out);\n
    • line : Line object
    "},{"location":"board/#circle-tile-position","title":"Circle -> tile position","text":"

    Get array of tile position inside a circle shape

    var out = board.circleToTileXYArray(circle);\n// var out = board.circleToTileXYArray(circle, out);\n// var out = board.circleToTileXYArray(circle, testMode, out);\n
    • circle : Circle shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#rectangle-tile-position","title":"Rectangle -> tile position","text":"

    Get array of tile position inside a rectangle shape

    var out = board.rectangleToTileXYArray(rectangle);\n// var out = board.rectangleToTileXYArray(rectangle, out);\n// var out = board.rectangleToTileXYArray(rectangle, testMode, out);\n
    • rectangle : Rectangle shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#ellipse-tile-position","title":"Ellipse -> tile position","text":"

    Get array of tile position inside a ellipse shape

    var out = board.ellipseToTileXYArray(ellipse);\n// var out = board.ellipseToTileXYArray(ellipse, out);\n// var out = board.ellipseToTileXYArray(ellipse, testMode, out);\n
    • ellipse : Ellipse shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#triangle-tile-position","title":"Triangle -> tile position","text":"

    Get array of tile position inside a triangle shape

    var out = board.triangleToTileXYArray(triangle);\n// var out = board.triangleToTileXYArray(triangle, out);\n// var out = board.triangleToTileXYArray(triangle, testMode, out);\n
    • triangle : Triangle shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#polygon-tile-position","title":"Polygon -> tile position","text":"

    Get array of tile position inside a polygon shape

    var out = board.polygonToTileXYArray(polygon);\n// var out = board.polygonToTileXYArray(polygon, out);\n// var out = board.polygonToTileXYArray(polygon, testMode, out);\n
    • polygon : Polygon shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#angle-between-world-position-of-2-tiles","title":"Angle between world position of 2 tiles","text":"
    var radian = board.angleBetween(tileA, tileB);\n
    • tileA, tileB : Chess object, or tileXY {x, y} of ring center.
    • radian : Angle between world position of 2 tiles, in radian.
    "},{"location":"board/#is-angle-in-cone","title":"Is angle in cone","text":"
    var isInCone = board.isAngleInCone(chessA, chessB, face, cone);\n
    • chessA, chessB : Chess object, or tileXY {x, y}.
    • face, cone : Range of compared angle is between face - (cone/2) to face + (cone/2). Angle in radian.
    "},{"location":"board/#direction-between-2-tiles","title":"Direction between 2 tiles","text":"
    var direction = board.directionBetween(chessA, chessB);\n
    • chessA, chessB : A chess object, or tile position {x,y}.
    • direction : Integer number.
      • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7.
      • Hexagon grid : 0, 1, 2, 3, 4, 5.
    var direction = board.directionBetween(chessA, chessB, false);\n
    • direction : Integer number, or float number.
      • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7, or float number between 0~1, 1~2, 2~3, 3~4, 4~5, 5~6, 6~7.
      • Hexagon grid : 0, 1, 2, 3, 4, 5, or float number between 0~1, 1~2, 2~3, 3~4, 4~5, 5~6.
    "},{"location":"board/#is-direction-in-cone","title":"Is direction in cone","text":"
    var isInCone = board.isDirectionInCone(chessA, chessB, face, cone);\n
    • chessA, chessB : Chess object, or tileXY {x, y}.
    • face, cone : Range of compared direction is between face - (cone/2) to face + (cone/2). Integer number, or float number.
      • Quad grid : 0, 1, 2, 3, or float number between 0~1, 1~2, 2~3, 3~4.
      • Hexagon grid : 0, 1, 2, 3, 4, 5, or float number between 0~1, 1~2, 2~3, 3~4, 4~5, 5~6.
    "},{"location":"board/#opposite-direction","title":"Opposite direction","text":"
    var direction = board.getOppositeDirection(tileX, tileY, direction);\n

    or

    var direction = board.getOppositeDirection(tileXY, direction);\n
    • tileXY : Chess object, or tileXY {x, y}.
    "},{"location":"board/#angle-snap-to-direction","title":"Angle snap to direction","text":"
    var direction = board.angleSnapToDirection(tileXY, angle);\n
    • tileXY : Chess object, or tileXY {x, y}, or undefined.
    • angle : Angle in radius.
    • direction : Integer number.
      • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7.
      • Hexagon grid : 0, 1, 2, 3, 4, 5.
    "},{"location":"board/#align-world-position-to-grid","title":"Align world position to grid","text":"
    • Align one chess object
      board.gridAlign(chess);\n
    • Align all chess
      board.gridAlign();\n
    "},{"location":"board/#is-overlapping-with-world-position","title":"Is overlapping with world position","text":"
    var isOverlapping = board.isOverlappingPoint(worldX, worldY);\n

    or

    var isOverlapping = board.isOverlappingPoint(worldX, worldY, tileZ);\n
    "},{"location":"board/#neighbors","title":"Neighbors","text":""},{"location":"board/#neighbor-tile-position","title":"Neighbor tile position","text":"
    • Get neighbor tile position at 1 direction
      var neighborTileXY = board.getNeighborTileXY(srcTileXY, direction);\n// var out = board.getNeighborTileXY(srcTileXY, direction, out);\n
      • srcTileXY : Chess object, or tileXY {x, y} of source.
      • direction : Number, or string number.
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
      • neighborTileXY : Tile position {x, y} of neighbor. Retrun null if no neighbor there (i.e. source chess is at the edge of board.)
    • Get neighbor tile position at directions
      var neighborTileXY = board.getNeighborTileXY(srcTileXY, directions);\n// var out = board.getNeighborTileXY(srcTileXY, directions, out);\n
      • directions
        • Array of numbers, [0, 2, 4].
        • String number concatenated via ,, '0,2,4'.
      • out : Tile position array of all neighbors
    • Get neighbor tile position at all directions
      var out = board.getNeighborTileXY(srcTileXY, null);\n// var out = board.getNeighborTileXY(srcTileXY, null, out);\n
      • out : Tile position array of all neighbors
    • Get direction between 2 tile positions
      var direction = board.getNeighborTileDirection(srcTile, neighborTileXY);\n
      • srcTile, neighborTileXY : Chess object, or tileXY {x, y}.
      • direction : Retu1rn null if these 2 tile positions are not neighbors.
    • Get neighbor tile position at angle
      var neighborTileXY = board.getNeighborTileXYAtAngle(srcTileXY, angle);\n// var out = board.getNeighborTileXYAtAngle(srcTileXY, angle, out);\n
      • srcTileXY : Tile position {x, y} of source.
      • angle : Angle in radius.
      • neighborTileXY : Tile position {x, y} of neighbor. Retrun null if no neighbor there (i.e. source chess is at the edge of board.)
    "},{"location":"board/#neighbor-chess","title":"Neighbor chess","text":"
    • Get neighbor chess at 1 direction
      var neighborChess = board.getNeighborChess(chess, direction); // neighborTileZ = tileZ of chess\n// var neighborChess = board.getNeighborChess(chess, direction, neighborTileZ);\n
      • chess : A chess object, or tile position {x, y, z}.
      • direction : Number, or string number.
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
      • neighborChess : A chess object.
    • Get neighbor chess at directions
      var out = board.getNeighborChess(chess, directions); // neighborTileZ = tileZ of chess\n// var out = board.getNeighborChess(chess, directions, neighborTileZ);\n
      • chess : A chess object, or tile position {x,y,z}.
      • directions
        • Array of numbers, [0, 2, 4].
        • String number concatenated via ,, '0,2,4'.
      • out : Chess array of neighbors.
    • Get neighbor chess at all directions
      var out = board.getNeighborChess(chess, null); // neighborTileZ = tileZ of chess\n// var out = board.getNeighborChess(chess, null, neighborTileZ);\n
      • chess : A chess object, or tile position {x, y, z}.
      • out : Chess array of all neighbors.
    • Get direction between 2 chess
      var direction = board.getNeighborChessDirection(chess, neighborChess);\n
      • direction : Return null if these 2 chess are not neighbors.
    • Are 2 chess neighbors?
      var areNeighbor = board.areNeighbors(tileA, tileB);\n
    • tileA, tileB : A chess object, or tile position {x, y}.
    • areNeighbor : Return true if chessA and chessB are neighbors.
    "},{"location":"board/#map-neighbor-tile-position","title":"Map neighbor tile position","text":"
    var newArray = board.mapNeighbors(chess, function(neighborTileXY, index, neighborTileXYArray){\nreturn {};\n}, scope);\n

    or

    var newArray = board.mapNeighbors(chess, distance, function(neighborTileXY, index, neighborTileXYArray){\nreturn {};\n}, scope);\n
    • chess : A chess object, or tile position {x,y,z}.
    • neighborTileXY : Neighbor tile position {x,y,direction}
    "},{"location":"board/#tile-at-direction","title":"Tile at direction","text":"
    • Get tile position at 1 direction
      var out = board.getTileXYAtDirection(srcTileXY, direction, distance);\n// var out = board.getTileXYAtDirection(srcTileXY, direction, distance, out);\n
      • srcTileXY : A chess object, or tile position {x, y} of source.
      • direction : Number, or string number.
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
      • distance : A JSON, number, or number array.
        • JSON : Range of distances. {end: 3} is equal to [1,2,3].
          {\nstart: 1,\nend: 1,\nstep: 1\n}\n
          • start : Start distance. Default value is 1.
          • end : End distance. Default value is 1.
          • step : Step. Default value is 1.
        • Number, 3.
        • Array of numbers, [2, 3, 5] : Array of distances.
      • out :
        • A single tile position, if distance is a number.
        • Tile position {x, y} array, if distance is a JSON or a number array.
    • Get tile positions at directions
      var neighborTileXY = board.getTileXYAtDirection(srcTileXY, directions, distance);\n// var out = board.getTileXYAtDirection(srcTileXY, directions, distance, out);\n
      • directions
        • Array of numbers, [0, 2, 4].
        • String number concatenated via ,, '0,2,4'.
      • out : Tile position {x, y} array.
    • Get tile positions at all directions
      var out = board.getTileXYAtDirection(srcTileXY, null, distance);\n// var out = board.getTileXYAtDirection(srcTileXY, null, distance, out);\n
      • out : Tile position {x, y} array.
    "},{"location":"board/#empty-tile-position","title":"Empty tile position","text":"
    • Is tile empty? (TileXY is inside board, and TileXYZ has no chess)
      var isEmpty = board.isEmptyTileXYZ(tileX, tileY, tileZ);\n
    • Get a random tile position which does not have any chess
      var tileXY = board.getRandomEmptyTileXY(tileZ);\n// var out = board.getRandomEmptyTileXY(tileZ, out);\n
      • tileXY : Tile position {x, y},
        • null : All positions are occupied.
    • Get an array of tile position which does not have any chess
      var tileXYArray = board.getEmptyTileXYArray(tileZ);\n// var out = board.getEmptyTileXYArray(tileZ, out);\n
      • tileXYArray : An array of tile position
    • Get a random tile position of neighbor which does not have any chess
      var tileXY = board.getRandomEmptyTileXYInRange(centerTileXY, radius, tileZ);\n// var out = board.getRandomEmptyTileXYInRange(centerTileXY, radius, tileZ, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
      • radius : Radius of the ring.
      • tileXY : Tile position {x, y},
        • null : All positions are occupied.
    • Get an array of tile position of neighbors which does not have any chess
      var tileXYArray = board.getEmptyTileXYArrayInRange(centerTileXY, radius, tileZ);\n// var out = board.getEmptyTileXYArrayInRange(centerTileXY, radius, tileZ, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
      • radius : Radius of the ring.
      • tileXYArray : An array of tile position
    "},{"location":"board/#get-all-chess","title":"Get all chess","text":"
    var chessArray = board.getAllChess();\n
    "},{"location":"board/#fit","title":"Fit","text":"
    var out = board.fit(tileXYArray);\n
    • tileXYArray : An array of tile position {x,y}.

    Offset all of tile positions to (0, 0), and set board size to fit these tile positions.

    "},{"location":"board/#blocker","title":"Blocker","text":"
    • Set blocker property : See chess data
    • Has blocker at tile position (tileX, tileY, tileZ)
      var hasBlocker = board.hasBlocker(tileX, tileY, tileZ);\n// var hasBlocker = board.hasBlocker(chess);  // chess or tileXYZ\n
    • Any chess at (tileX, tileY) has blocker property
      var hasBlocker = board.hasBlocker(tileX, tileY);\n// var hasBlocker = board.hasBlocker(chess);  // chess or tileXY\n
    "},{"location":"board/#touch-events","title":"Touch events","text":""},{"location":"board/#set-interactive","title":"Set interactive","text":"
    • Enable
      board.setInteractive();\n// board.setInteractive({ useTouchZone: false });\n
      • useTouchZone :
        • true : Detect touch input by input event of a full-screen zone game object. Default behavior.
        • false : Detect touch input by input event of scene.
    • Disable
      board.setInteractive(false);\n
    "},{"location":"board/#touch-zone","title":"Touch Zone","text":"
    • Get
      var touchZone = board.getTouchZone();\n// var touchZone = board.touchZone;\n
      • Return null if useTouchZone is false.
    • Set depth
      touchZone.setDepth(depth);\n
      or
      scene.children.bringToTop(touchZone);\nscene.children.sendToBack(touchZone);\nscene.children.moveUp(touchZone);\nscene.children.moveDown(touchZone);\nscene.children.moveUp(touchZone);\nscene.children.moveTo(touchZone, index);\nscene.children.moveAbove(touchZone, child); // Move touchZone above child\nscene.children.moveBelow(touchZone, child); // Move touchZone below child\nscene.children.swap(touchZone, child);\n
    "},{"location":"board/#pointer-down","title":"Pointer down","text":"
    • Pointer down at any tile
      board.on('tiledown', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • pointer : Touch pointer
      • tileXY : {x, y}
    • Pointer down at chess
      board.on('gameobjectdown', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointerdown', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#pointer-up","title":"Pointer up","text":"
    • Pointer up at any tile
      board.on('tileup', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • tileXY : {x, y}
    • Pointer up at chess
      board.on('gameobjectup', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointerup', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#pointer-move","title":"Pointer move","text":"
    • Pointer move to another tile
      board.on('tilemove', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • tileXY : {x, y}
      • Only triggered when tileXY is changed.
    • Pointer move to another chess
      board.on('gameobjectmove', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointermove', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#pointer-over","title":"Pointer over","text":"
    • Pointer over to another tile
      board.on('tileover', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • tileXY : {x, y}
      • Only triggered when tileXY is changed.
    • Pointer over to another chess
      board.on('gameobjectover', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointerover', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#pointer-out","title":"Pointer out","text":"
    • Pointer out tile
      board.on('tileout', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • tileXY : {x, y}
      • Only triggered when tileXY is changed.
    • Pointer out chess
      board.on('gameobjectout', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointerout', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at pointer-out (tileX, tileY)
    "},{"location":"board/#tap","title":"Tap","text":"
    • Tap at any tile
      board.on('tiletap', function(tap, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n// var tapsCount = tap.tapsCount;\n});\n
      • tap : Tap behavior.
        • tap.tapsCount : Taps count.
      • tileXY : {x, y}
    • N-taps at any tile
      board.on('tile' + tapsCount + 'tap' , function(tap, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • 'tile' + tapsCount + 'tap' : 'tile1tap', 'tile2tap', 'tile3tap', etc ...
      • tap : Tap behavior.
      • tileXY : {x, y}
    • Tap at chess
      board.on('gameobjecttap', function(tap, gameObject) {\n// var tapsCount = tap.tapsCount;\n})\n
      or
      gameObject.on('board.tap', function(tap) {\n// var tapsCount = tap.tapsCount;\n})\n
      • tap : Tap behavior.
        • tap.tapsCount : Taps count.
      • gameObject : Game object at touched (tileX, tileY)
    • N-taps at chess
      board.on('gameobject' + tapsCount + 'tap' , function(tap, gameObject) {\n})\n
      or
      gameObject.on('board.' + tapsCount + 'tap', function(tap) {\n})\n
      • 'gameobject' + tapsCount + 'tap' : 'gameobject1tap', 'gameobject2tap', 'gameobject3tap', etc ...
      • 'board.' + tapsCount + 'tap' : 'board.1tap', 'board.2tap', 'board.3tap', etc ...
      • tap : Tap behavior.
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#press","title":"Press","text":"
    • Press-start at any tile
      board.on('tilepressstart', function(press, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • press : Press behavior.
      • tileXY : {x, y}
    • Press-end at any tile
      board.on('tilepressend', function(press, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • press : Press behavior.
      • tileXY : {x, y}
    • Press-star at chess
      board.on('gameobjectpressstart', function(press, gameObject) {\n})\n
      or
      gameObject.on('board.pressstart', function(press) {\n})\n
      • press : Press behavior.
      • gameObject : Game object at touched (tileX, tileY)
    • Press-end at chess
      board.on('gameobjectpressend', function(press, gameObject) {\n})\n
      or
      gameObject.on('board.pressend', function(press) {\n})\n
      • press : Press behavior.
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#swipe","title":"Swipe","text":"
    • Swipe at any tile
      board.on('tileswipe', function(swipe, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n// var direction = swipe.direction;\n});\n
      • swipe : Swipe behavior.
        • swipe.direction : Integer number.
          • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7.
          • Hexagon grid : 0, 1, 2, 3, 4, 5.
      • tileXY : {x, y}
    • Swipe at chess
      board.on('gameobjectswipe', function(swipe, gameObject) {\n// var direction = swipe.direction;\n})\n
      or
      gameObject.on('board.swipe', function(swipe) {\n// var direction = swipe.direction;\n})\n
      • swipe : Swipe behavior.
        • swipe.direction : Integer number.
          • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7.
          • Hexagon grid : 0, 1, 2, 3, 4, 5.
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#grid-points","title":"Grid points","text":"
    • Get an array of grid points at tile position (tileX, tileY).
      var points = board.getGridPoints(tileX, tileY);\n// var out = board.getGridPoints(tileX, tileY, out);\n// var points = board.getGridPoints(chess, out);  // chess or tileXY\n
      • points :\u3000Array of world position {x, y}.
    • Draw grid polygon on graphics object
      graphics.strokePoints(points, true);\n
    "},{"location":"board/#bounds","title":"Bounds","text":""},{"location":"board/#board-bounds","title":"Board bounds","text":"
    • Get a rectangle of all tiles
      var rectangle = board.getBoardBounds();\n// var out = board.getGridBounds(out);\n
      • rectangle : Rectangle object.
    • Draw rectangle on graphics object
      graphics.strokeRectShape(rectangle);\n
    "},{"location":"board/#grid-bounds","title":"Grid bounds","text":"
    • Get a rectangle of a tile
      var rectangle = board.getGridBounds(tileX, tileY);\n// var out = board.getGridBounds(tileX, tileY, out);\n// var rectangle = board.getGridBounds(chess, out);  // chess or tileXY\n
      • rectangle : Rectangle object.
    • Draw rectangle on graphics object
      graphics.strokeRectShape(rectangle);\n
    "},{"location":"board/#get-board","title":"Get Board","text":"
    • Static method

      var board = Board.GetBoard(chess);\n

      • GetBoard is a static method of Board class.
    • Member method

      var board = board.chessToBoard(chess);\n

    • Board property
      • Chess
        var board = chess.rexChess.board;\n
      • Miniboard
        var board = miniboard.mainBoard;\n
    "},{"location":"board/#other-properties","title":"Other properties","text":"
    • Scene
      var scene = board.scene;\n
    • Grid object
      • Get
        var grid = board.grid;\n
        • grid : Quad grid, or hexagon grid.
      • Set
        board.setGrid(grid);\n
        • grid : Quad grid, or hexagon grid.
    "},{"location":"bounds/","title":"Bounds","text":""},{"location":"bounds/#introduction","title":"Introduction","text":"

    Clamp or wrap position of game object inside target bounds.

    • Author: Rex
    • Behavior of game object
    "},{"location":"bounds/#live-demos","title":"Live demos","text":"
    • Drag inside bounds
    • Target bounds
    • Wrap bounds
    "},{"location":"bounds/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bounds/#install-plugin","title":"Install plugin","text":""},{"location":"bounds/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexboundsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboundsplugin.min.js', true);\n
    • Add bounds behavior
      var bounds = scene.plugins.get('rexboundsplugin').add(gameObject, config);\n
    "},{"location":"bounds/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoundsPlugin from 'phaser3-rex-plugins/plugins/bounds-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBounds',\nplugin: BoundsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add bounds behavior
      var bounds = scene.plugins.get('rexBounds').add(gameObject, config);\n
    "},{"location":"bounds/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Bounds from 'phaser3-rex-plugins/plugins/bounds.js';\n
    • Add bounds behavior
      var bounds = new Bounds(gameObject, config);\n
    "},{"location":"bounds/#create-instance","title":"Create instance","text":"
    var bounds = scene.plugins.get('rexBounds').add(gameObject, {\n// target: undefined,\n// bounds: undefined,\n// enable: true,\n\n// boundsHitMode: 'clamp',  // 'clamp', or 'wrap'\n// boundsHitMode: {\n//     left: 'clamp',\n//     right: 'clamp',\n//     top: 'clamp',\n//     bottom: 'clamp' \n// },\n\n// alignMode: 0\n});\n
    • target :
      • A game object : Update target bounds from this game object in each tick.
      • undefined, null, or false : Set target bounds in bounds parameter. Default behavior.
    • bounds : Target bounds used when target is not a game object.
      • A rectangle object
      • An object :
        {\nwidth: 0, height: 0,\nx: 0, y: 0,\ncenterX: 0, centerY: 0,            }\n
        • width, height : Size of target bounds.
        • x, y, or centerX, centerY : Position of target bounds.
    • enable :
      • true : Clamp or wrap game object's position when game object overlap left/right/top/bottom bounds.
      • false : Don't clamp or wrap game object's position at any bound
      • An objecct : Set true to clamp or wrap game object's position at a bound
        {\nleft: true,\nright: true,\ntop: true,\nbottom: true\n}\n
    • boundsHitMode : Position mode when game object overlap bounds
      • 0, or 'clamp' : Clamp game object's position when game object overlap left/right/top/bottom bounds.
      • 1, or 'wrap' : Wrap game object's position when game object overlap left/right/top/bottom bounds.
      • An objecct : Set 0/'clamp', or 1/'wrap' to clamp or wrap game object's position at a bound
        {\nleft: 0,   // 0,'clamp',1,'wrap'\nright: 0,  // 0,'clamp',1,'wrap'\ntop: 0,    // 0,'clamp',1,'wrap'\nbottom: 0  // 0,'clamp',1,'wrap'\n}\n
    • alignMode :
      • 0, or 'bounds' : Align bounds of game object to target bound. Default behavior if boundsHitMode are all set to clamp mode.
      • 1, or 'origin' : Set position of game object to target bound. Default behavior if boundsHitMode has wrap mode.
    "},{"location":"bounds/#target-game-object","title":"Target game object","text":"
    • Set
      bounds.setBoundsTarget(gameObject);\n// bounds.boundsTarget = gameObject;\n
    • Clear
      bounds.setBoundsTarget();\n// bounds.boundsTarget = undefined;\n
    • Get
      var gameObject = bounds.boundsTarget;\n
    "},{"location":"bounds/#target-bounds","title":"Target bounds","text":"
    • Set
      bounds.setBounds(bounds);\n
      • bounds : Target bounds used when target is not a game object.
        • A rectangle
        • An object :
          {\nwidth: 0, height: 0,\nx: 0, y: 0,\ncenterX: 0, centerY: 0,            }\n
          • width, height : Size of target bounds.
          • x, y, or centerX, centerY : Position of target bounds.
    • Get
      var rect = bounds.bounds;\n
      • rect : A rectangle object
    "},{"location":"bounds/#enable","title":"Enable","text":"
    • Set
      • Enable all bounds
        bounds.setEnable();\n//  bounds.setEnable(true);\n
      • Disable all bounds
        bounds.setEnable(false);\n
      • Enable bounds via object
        bounds.setEnable({\nleft: true,\nright: true,\ntop: true,\nbottom: true\n});\n
    • Get
      var enable = bounds.enable;\n
      • true : Has any enabled bounds
      • false : All bounds are disabled.
    • Get enabled of a bound
      var enableLeftBound = bounds.boundsEnable.left;\nvar enableRightBound = bounds.boundsEnable.right;\nvar enableTopBound = bounds.boundsEnable.top;\nvar enableBottomBound = bounds.boundsEnable.bottom;\n
    "},{"location":"bounds/#bound-hit-mode","title":"Bound hit mode","text":"
    • Set
      bounds.setBoundsHitMode(mode);\n
      • 0, or 'clamp' : Clamp game object's position when game object overlap left/right/top/bottom bounds.
      • 1, or 'wrap' : Wrap game object's position when game object overlap left/right/top/bottom bounds.
      • An objecct : Set 0/'clamp', or 1/'wrap' to clamp or wrap game object's position at a bound
        {\nleft: 0,   // 0,'clamp',1,'wrap'\nright: 0,  // 0,'clamp',1,'wrap'\ntop: 0,    // 0,'clamp',1,'wrap'\nbottom: 0  // 0,'clamp',1,'wrap'\n}\n
    • Get
      var leftBoundHitMode = bounds.boundsHitMode.left;\nvar rightBoundHitMode = bounds.boundsHitMode.right;\nvar topBoundHitMode = bounds.boundsHitMode.top;\nvar bottomBoundHitMode = bounds.boundsHitMode.bottom;\n
    "},{"location":"bounds/#align-mond","title":"Align mond","text":"
    • Set
      bounds.setAlignMode(mode);\n
      • 0, or 'bounds' : Align bounds of game object to target bound.
      • 1, or 'origin' : Set position of game object to target bound.
    • Get
      var alignMode = bounds.alignMode;\n
      • 0 : Align bounds of game object to target bound.
      • 1 : Set position of game object to target bound.
    "},{"location":"bounds/#hit-result","title":"Hit result","text":"
    • Game object is hitting any bound
      var isHitAny = bounds.isHitAny;\n
    • Game object is hitting a bound
      var isHitLeft = this.isHitLeft;\nvar isHitRight = this.isHitRight;\nvar isHitTop = this.isHitTop;\nvar isHitBottom = this.isHitBottom;\n
    "},{"location":"bounds/#event","title":"Event","text":"
    • On hit any bound
      bounds.on('hitany', function(gameObject, bounds) {\n\n})\n
    • On hit left bound
      bounds.on('hitleft', function(gameObject, bounds) {\n\n})\n
    • On hit right bound
      bounds.on('hitright', function(gameObject, bounds) {\n\n})\n
    • On hit top bound
      bounds.on('hittop', function(gameObject, bounds) {\n\n})\n
    • On hit bottom bound
      bounds.on('hitbottom', function(gameObject, bounds) {\n\n})\n
    "},{"location":"bracketparser/","title":"Bracket parser","text":""},{"location":"bracketparser/#introduction","title":"Introduction","text":"

    A lite-weight delimiter parser.

    • Author: Rex
    • Object
    "},{"location":"bracketparser/#live-demoes","title":"Live demoes","text":"
    • Basic
    • Markup text
    "},{"location":"bracketparser/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bracketparser/#install-plugin","title":"Install plugin","text":""},{"location":"bracketparser/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbracketparserplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbracketparserplugin.min.js', true);\n
    • Add parser object
      var parser = scene.plugins.get('rexbracketparserplugin').add(config);\n
    "},{"location":"bracketparser/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BracketParserPlugin from 'phaser3-rex-plugins/plugins/bracketparser-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBracketParser',\nplugin: BracketParserPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add parser object
      var parser = scene.plugins.get('rexBracketParser').add(config);\n
    "},{"location":"bracketparser/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BracketParser from 'phaser3-rex-plugins/plugins/bracketparser.js';\n
    • Add parser object
      var parser = new BracketParser(config);\n
    "},{"location":"bracketparser/#create-instance","title":"Create instance","text":"
    var parser = scene.plugins.get('rexBracketParser').add({\n// delimiters: '<>', // or ['<', '>']\n// valueConvert: true,\n// translateTagNameCallback: undefined,\n});\n
    • delimiters: String of left-delimiter and right-delimiter.
      • A single string with 2 characters. Default value is '<>'.
      • A array with 2 strings
    • valueConvert : A callback to convert values.
      • true : Use defaule value converter. Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string.
      • false, or null : Bypass string value.
      • Function object:
        function(s) {\nreturn s;\n}\n
    • translateTagNameCallback : Callback to translate tag-name
      • undefined : Use original tag-name. Default behavior.
      • A function, return new tag name.
        function(tagName) {\nreturn newTagName;\n}\n
    "},{"location":"bracketparser/#tag-and-content","title":"Tag and content","text":"

    Assume that left-delimiter and right-delimiter is '<>'

    • Start-tag : '<TAG>'
      • Start-tag with a single value : '<TAG=value>'
        • value : If valueConvert is true,
          • Number
          • Boolean
          • null
          • String
      • Start-tag with array values, separated via ',' : '<TAG=value0,value1,value2>'
    • End-tag : '<\\TAG>'
    • Content : Any string outside of tag-start, or tag-end.
    "},{"location":"bracketparser/#start-parsing","title":"Start parsing","text":"
    parser.start(text);\n

    These events will be emitted under this method.

    "},{"location":"bracketparser/#pause","title":"Pause","text":"
    • Pause
      parser.pause();\n
    • Pause until event
      parser.pauseUntilEvent(eventEmitter, eventName);\n
      • Will invoke
        eventEmitter.once(eventName, function() {\nparser.next();\n})\n

    Invoke this method during tag-start,tag-end, or content events to suspend parsing.

    "},{"location":"bracketparser/#resume","title":"Resume","text":"
    parser.next();\n
    "},{"location":"bracketparser/#skip-any-tag-startany-tag-end-event","title":"Skip any-tag-start/any-tag-end event","text":"
    parser.skipEvent();\n

    When getting a tag-start, or a tag-end event, parser will emitts

    • Start-tag : '+TAG', then '+'
    • End-tag : '-TAG', then '-'

    Invoke this medthod under '+TAG', or '-TAG' event to skip '+', or '-' event.

    "},{"location":"bracketparser/#status","title":"Status","text":"
    • Is parsing
      var isRunning = parser.isRunning;\n
      • true : Has remainder characters
      • false : After parsing last character
    • Is paused
      var isPaused = parser.isPaused;\n
    "},{"location":"bracketparser/#events","title":"Events","text":""},{"location":"bracketparser/#tagscontent","title":"Tags/Content","text":"
    • Get a specific tag-start
      • Start-tag with a single value : '<TAG=value>'
        parser.on('+' + TagName, function(value){ /* ... */ });\n
      • Start-tag with array values, separated via ',' : '<TAG=value0,value1,value2>'
        parser.on('+' + TagName, function(value0, value1, value2){ /* ... */ });\n
    • Get any-tag-start
      • Start-tag with a single value : '<TAG=value>'
        parser.on('+', function(tagName, value){ /* ... */ });\n
      • Start-tag with array values, separated via ',' : '<TAG=value0,value1,value2>'
        parser.on('+', function(tagName, value0, value1, value2){ /* ... */ });\n
    • Get a specific tag-end
      parser.on('-' + TagName, function(){ /* ... */ });\n
    • Get a content
      parser.on('content', function(content){ /* ... */ });\n
      • Previous tag-start : parser.lastTagStart
    • Get any-tag-end
      parser.on('-', function(tagName){ /* ... */ });\n
      • Previous tag-start : parser.lastTagStart
      • Previous Content : parser.lastContent
    "},{"location":"bracketparser/#control-flow","title":"Control flow","text":"
    • Parsing start
      parser.on('start', function(){ /* ... */ });\n
    • Parsing end
      parser.on('complete', function(){ /* ... */ });\n
    • On pause
      parser.on('pause', function(){ /* ... */ });\n
    • On resume
      parser.on('resume', function(){ /* ... */ });\n
    "},{"location":"bracketparser2/","title":"Bracket parser 2","text":""},{"location":"bracketparser2/#introduction","title":"Introduction","text":"

    A lite-weight delimiter parser.

    • Author: Rex
    • Object
    "},{"location":"bracketparser2/#live-demoes","title":"Live demoes","text":"
    • Basic
    "},{"location":"bracketparser2/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bracketparser2/#install-plugin","title":"Install plugin","text":""},{"location":"bracketparser2/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbracketparser2plugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbracketparser2plugin.min.js', true);\n
    • Add parser object
      var parser = scene.plugins.get('rexbracketparser2plugin').add(config);\n
    "},{"location":"bracketparser2/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BracketParserPlugin from 'phaser3-rex-plugins/plugins/bracketparser2-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBracketParser',\nplugin: BracketParserPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add parser object
      var parser = scene.plugins.get('rexBracketParser').add(config);\n
    "},{"location":"bracketparser2/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BracketParser from 'phaser3-rex-plugins/plugins/bracketparser2.js';\n
    • Add parser object
      var parser = new BracketParser(config);\n
    "},{"location":"bracketparser2/#create-instance","title":"Create instance","text":"
    var parser = scene.plugins.get('rexBracketParser').add({\n// delimiters: '<>', // or ['<', '>']\n// valueConvert: true,\n// translateTagNameCallback: undefined,\n});\n
    • delimiters: String of left-delimiter and right-delimiter.
      • A single string with 2 characters. Default value is '<>'.
      • A array with 2 strings
    • valueConvert : A callback to convert values.
      • true : Use defaule value converter. Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string.
      • false, or null : Bypass string value.
      • Function object:
        function(s) {\nreturn s;\n}\n
    • translateTagNameCallback : Callback to translate tag-name
      • undefined : Use original tag-name. Default behavior.
      • A function, return new tag name.
        function(tagName) {\nreturn newTagName;\n}\n
    "},{"location":"bracketparser2/#tag-and-content","title":"Tag and content","text":"

    Assume that left-delimiter and right-delimiter is '<>'

    • Start-tag : <TAG>
    • Start-tag with payload :
      <TAG param0=value0 param1=value1>\n
      or
      <\n    TAG\n    param0=value0 \n    param1=value1\n>\n
      • payload will be {param0:value0, param1:value1}
      • value : If valueConvert is true,
        • String with '...', or \"...\"
        • JSON array with [...]
        • JSON object with {...}
        • Number
        • Boolean
        • null
        • String
    • End-tag : <\\TAG>
    • End-tag with payload
      <\\TAG param0=value0 param1=value1>\n
      or
      <\n    \\TAG\n    param0=value0 \n    param1=value1\n>\n
      • payload will be {param0:value0, param1:value1}
      • value : If valueConvert is true,
        • String with '...', or \"...\"
        • JSON array with [...]
        • JSON object with {...}
        • Number
        • Boolean
        • null
        • String
    • Content : Any string outside of tag-start, or tag-end.
    "},{"location":"bracketparser2/#start-parsing","title":"Start parsing","text":"
    parser.start(text);\n

    These events will be emitted under this method.

    "},{"location":"bracketparser2/#pause","title":"Pause","text":"
    • Pause
      parser.pause();\n
    • Pause until event
      parser.pauseUntilEvent(eventEmitter, eventName);\n
      • Will invoke
        eventEmitter.once(eventName, function() {\nparser.next();\n})\n

    Invoke this method during tag-start,tag-end, or content events to suspend parsing.

    "},{"location":"bracketparser2/#resume","title":"Resume","text":"
    parser.next();\n
    "},{"location":"bracketparser2/#skip-any-tag-startany-tag-end-event","title":"Skip any-tag-start/any-tag-end event","text":"
    parser.skipEvent();\n

    When getting a tag-start, or a tag-end event, parser will emitts

    • Start-tag : '+TAG', then '+'
    • End-tag : '-TAG', then '-'

    Invoke this medthod under '+TAG', or '-TAG' event to skip '+', or '-' event.

    "},{"location":"bracketparser2/#status","title":"Status","text":"
    • Is parsing
      var isRunning = parser.isRunning;\n
      • true : Has remainder characters
      • false : After parsing last character
    • Is paused
      var isPaused = parser.isPaused;\n
    "},{"location":"bracketparser2/#events","title":"Events","text":""},{"location":"bracketparser2/#tagscontent","title":"Tags/Content","text":"
    • Get a specific tag-start
      • Start-tag with payload : '<TAG param0=value0 param1=value1>'
        parser.on('+' + TagName, function(payload){ /* ... */ });\n
        • payload : {param0:value0, param1:value1, ...}
    • Get any-tag-start
      • Start-tag with payload : '<TAG param0=value0 param1=value1>'
        parser.on('+', function(tagName, payload){ /* ... */ });\n
        • payload : {param0:value0, param1:value1, ...}
    • Get a specific tag-end
      • End-tag with payload : '<\\TAG param0=value0 param1=value1>'
        parser.on('-' + TagName, function(payload){ /* ... */ });\n
        • payload : {param0:value0, param1:value1, ...}
    • Get a content
      parser.on('content', function(content){ /* ... */ });\n
      • Previous tag-start : parser.lastTagStart
        {\nname: '',\npayload: {}\n}\n
    • Get any-tag-end
      • End-tag with payload : '<TAG param0=value0 param1=value1>'
        parser.on('-', function(tagName, payload){ /* ... */ });\n
        • payload : {param0:value0, param1:value1, ...}
      • Previous tag-start : parser.lastTagStart
        {\nname: '',\npayload: {}\n}\n
      • Previous Content : parser.lastContent
    "},{"location":"bracketparser2/#control-flow","title":"Control flow","text":"
    • Parsing start
      parser.on('start', function(){ /* ... */ });\n
    • Parsing end
      parser.on('complete', function(){ /* ... */ });\n
    • On pause
      parser.on('pause', function(){ /* ... */ });\n
    • On resume
      parser.on('resume', function(){ /* ... */ });\n
    "},{"location":"bracketparser2/#compare-with-bracket-parser","title":"Compare with bracket-parser","text":"

    Tag format in

    • bracket-parser:
      <TAG=value0,value1>\n
      • Carried parameters is an array, more compactly.
    • bracket-parser2:
      <TAG param0=value0 param1=value1>\n
      or
      <\n  TAG \n    param0=value0 \n    param1=value1\n>\n
      • Carried parameters is a dictionary, more clearly.
    "},{"location":"buffdata/","title":"Buff data","text":""},{"location":"buffdata/#introduction","title":"Introduction","text":"

    Data manager with buffs, extends from built-in data manager.

    • Author: Rex
    • Member of scene
    "},{"location":"buffdata/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"buffdata/#install-plugin","title":"Install plugin","text":""},{"location":"buffdata/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbuffdataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbuffdataplugin.min.js', true);\n
    • Add buff data manager object
      var data = scene.plugins.get('rexbuffdataplugin').add(parent);\n
    "},{"location":"buffdata/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BuffDataPlugin from 'phaser3-rex-plugins/plugins/buffdata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBuffData',\nplugin: BuffDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add buff data manager object
      var data = scene.plugins.get('rexBuffData').add(parent);\n
    "},{"location":"buffdata/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BuffData from 'phaser3-rex-plugins/plugins/buffdata.js';\n
    • Add buff data manager object
      var data = new BuffData(parent);\n
    "},{"location":"buffdata/#create-instance","title":"Create instance","text":"
    var data = scene.plugins.get('rexBuffData').add(parent);\n// var data = scene.plugins.get('rexBuffData').add(parent, eventEmitter);\n
    • data : Buff data manager
    • parent : The object (a scene, or a game object) that this DataManager belongs to.
    • eventEmitter : The DataManager's event emitter.
    "},{"location":"buffdata/#extend-existing-data-manager","title":"Extend existing data manager","text":"
    var data = scene.plugins.get('rexBuffData').extend(data);\n
    • data : Existing data manager
    "},{"location":"buffdata/#buff","title":"Buff","text":"

    A value is composed of baseValue, and some buffs, clamped by min, max values.

    • Base value

      • Set
        data.setBaseValue(key, value);\n
      • Remove
        data.removeBaseValue(key);\n
      • Get
        var baseValue = data.getBaseValue(key);\n
    • Buffs, each value can have many buffs, or no buff.

      • Add/set a buff
        data.setBuff(key, buffKey, value);\n
        • value :
          • A number
          • A string for percentage like '10%', which means that (baseValue * percentage)
      • Remove a buff of a key
        data.removeBuff(key, buffKey);\n
      • Remove all buffs of a key
        data.removeBuff(key);\n
      • Get a buff value
        var buffValue = data.getBuffValue(key, buffKey);\n
    • Min, max bounds, optional.
      • Set
        data.setMin(key, min);\n
        data.setMax(key, max);\n
        data.setBounds(key, min, max);\n
        • min, max : Clamp buffed result value between min and max value. Set undefined to ignore it.
      • Get
        var min = data.getMinBound(key);\nvar max = data.getMaxBound(key);\n
    • Buffed result
      • Get
        var result = data.get(key);\n
      • Events
    "},{"location":"buildarcadeobject/","title":"Build arcade object","text":""},{"location":"buildarcadeobject/#introduction","title":"Introduction","text":"

    Create arcade body, and inject arcade object methods.

    • Author: Rex
    • Arcade behavior of game object
    "},{"location":"buildarcadeobject/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"buildarcadeobject/#install-plugin","title":"Install plugin","text":""},{"location":"buildarcadeobject/#load-minify-file","title":"Load minify file","text":"
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbuildarcadeobjectplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbuildarcadeobjectplugin.min.js', true);\n
    • Inject arcade object methods
      var gameObject = scene.plugins.get('rexbuildarcadeobjectplugin').build(gameObject);\n
    "},{"location":"buildarcadeobject/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine and install plugin in configuration of game
      import BuildArcadeObjectPlugin from 'phaser3-rex-plugins/plugins/buildarcadeobject-plugin.js';\nvar config = {\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBuildArcadeObject',\nplugin: BuildArcadeObjectPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Inject arcade object methods
      var gameObject = scene.plugins.get('rexBuildArcadeObject').build(gameObject);\n
    "},{"location":"buildarcadeobject/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Import class
      import BuildArcadeObject from 'phaser3-rex-plugins/plugins/buildarcadeobject.js';\n
    • Inject arcade object methods
      var gameObject = BuildArcadeObject(gameObject);\n
    "},{"location":"buildarcadeobject/#inject-arcade-object-methods","title":"Inject arcade object methods","text":"
    • Inject arcade method to game object
      scene.plugins.get('rexBuildArcadeObject').injectMethods(gameObject);\n// scene.physics.add.existing(gameObject);        // Dynamic arcade body\n// scene.physics.add.existing(gameObject, true);  // Static arcade body\n
    • Inject arcade method to game object class
      scene.plugins.get('rexBuildArcadeObject').injectMethods(GameObjectClass.prototype);\n
    • Inject arcade method to root of all game object class
      scene.plugins.get('rexBuildArcadeObject').injectMethodsToRootClass();\n
    • Create dynamic arcade body
      var gameObject = scene.plugins.get('rexBuildArcadeObject').build(gameObject);\n// var gameObjects = scene.plugins.get('rexBuildArcadeObject').build(gameObjects);\n
    • Create static arcade body
      var gameObject = scene.plugins.get('rexBuildArcadeObject').build(gameObject, true);\n// var gameObjects = scene.plugins.get('rexBuildArcadeObject').build(gameObjects, true);\n
    "},{"location":"bullet/","title":"Bullet","text":""},{"location":"bullet/#introduction","title":"Introduction","text":"

    Move game object toward current angle of game object, with a constant speed.

    • Author: Rex
    • Arcade behavior of game object
    "},{"location":"bullet/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bullet/#install-plugin","title":"Install plugin","text":""},{"location":"bullet/#load-minify-file","title":"Load minify file","text":"
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbulletplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbulletplugin.min.js', true);\n
    • Add bullet behavior
      var bullet = scene.plugins.get('rexbulletplugin').add(gameObject, config);\n
    "},{"location":"bullet/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine and install plugin in configuration of game
      import BulletPlugin from 'phaser3-rex-plugins/plugins/bullet-plugin.js';\nvar config = {\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBullet',\nplugin: BulletPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add bullet behavior
      var bullet = scene.plugins.get('rexBullet').add(gameObject, config);\n
    "},{"location":"bullet/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Import class
      import Bullet from 'phaser3-rex-plugins/plugins/bullet.js';\n
    • Add bullet behavior
      var bullet = new Bullet(gameObject, config);\n
    "},{"location":"bullet/#create-instance","title":"Create instance","text":"
    var bullet = scene.plugins.get('rexBullet').add(gameObject, {\nspeed: 200,\n// wrap: false,\n// padding: 0,\n// enable: true,\n\n// angle: undefined,\n// rotation: undefined\n});\n
    • speed : moving speed, pixels in second.
    • Wrap
      • wrap : Set true to enable wrap mode. Default value is false.
      • padding
    • enable : set false to disable moving.
    • angle, rotation :
      • undefined : Use angle of game object as angle of bullet. Default value.
      • A number : Angle of bullet, in degrees or radians.
    "},{"location":"bullet/#speed","title":"Speed","text":"
    • Set
      bullet.setSpeed(speed);\n// bullet.speed = speed;\n
    • Get
      var speed = bullet.speed;\n
    "},{"location":"bullet/#set-wrap-mode","title":"Set wrap mode","text":"
    bullet.setWrapMode(wrap, padding);\n
    • wrap : Set true to enable wrap mode.
    "},{"location":"bullet/#angle","title":"Angle","text":"
    • Set angle
      bullet.setAngle(degrees);\n// bullet.angle = degrees;\n
      or
      bullet.setRotation(radians);\n// bullet.rotation  = radians;\n
    • Use angle of game object
      bullet.setAngle();\n// bullet.setRotation();\n
    "},{"location":"button/","title":"Click/Button","text":""},{"location":"button/#introduction","title":"Introduction","text":"

    Fires 'click' event when touch releasd after pressed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"button/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"button/#install-plugin","title":"Install plugin","text":""},{"location":"button/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbuttonplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbuttonplugin.min.js', true);\n
    • Add button behavior
      var button = scene.plugins.get('rexbuttonplugin').add(gameObject, config);\n
    "},{"location":"button/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ButtonPlugin from 'phaser3-rex-plugins/plugins/button-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexButton',\nplugin: ButtonPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add button behavior
      var button = scene.plugins.get('rexButtonn').add(gameObject, config);\n
    "},{"location":"button/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Button from 'phaser3-rex-plugins/plugins/button.js';\n
    • Add button behavior
      var button = new Button(gameObject, config);\n
    "},{"location":"button/#create-instance","title":"Create instance","text":"
    var button = scene.plugins.get('rexButton').add(gameObject, {\n// enable: true,\n// mode: 1,              // 0|'press'|1|'release'\n// clickInterval: 100    // ms\n// threshold: undefined\n});\n
    • enable : Clickable.
    • mode :
      • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
      • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
    • clickInterval : Interval between 2 'click' events, in ms.
    • threshold : Cancel clicking detecting when dragging distance is larger then this threshold.
      • undefined : Ignore this feature. Default behavior.
    "},{"location":"button/#events","title":"Events","text":"
    • Click
      button.on('click', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Enable
      button.on('enable', function (button, gameObject) {\n// ...\n}, scope);\n
    • Disable
      button.on('disable', function (button, gameObject) {\n// ...\n}, scope);\n
    • Pointer over
      button.on('over', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
    • Pointer out
      button.on('out', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
    • Pointer down
      button.on('down', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
    • Pointer up
      button.on('up', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
    "},{"location":"button/#enable","title":"Enable","text":"
    • Get
      var enabled = button.enable;  // enabled: true, or false\n
    • Set
      button.setEnable(enabled);  // enabled: true, or false\n// button.enable = enabled;\n
    • Toggle
      button.toggleEnable();\n
    "},{"location":"button/#set-mode","title":"Set mode","text":"
    button.setMode(mode);\n
    • mode :
      • 'press', or 0 : Fire 'click' event when touch pressed.
      • 'release', or 1 : Fire 'click' event when touch released after pressed.
    "},{"location":"button/#set-click-interval","title":"Set click interval","text":"
    button.setClickInterval(interval);  // interval in ms\n
    "},{"location":"button/#set-dragging-threshold","title":"Set dragging threshold","text":"
    button.setDragThreshold(distance);  // distance in pixels\n
    "},{"location":"camera-controller/","title":"Controller","text":""},{"location":"camera-controller/#introduction","title":"Introduction","text":"

    Scroll/zoom camera.

    • Author: Richard Davey
    "},{"location":"camera-controller/#usage","title":"Usage","text":""},{"location":"camera-controller/#setup","title":"Setup","text":"
    1. Create controllor
      // var cursors = scene.input.keyboard.createCursorKeys();\nvar controls = new Phaser.Cameras.Controls.SmoothedKeyControl({\ncamera: camera,\n\nleft: cursors.left,    // { isDown, isUp }\nright: cursors.right,  // { isDown, isUp }\nup: cursors.up,        // { isDown, isUp }\ndown: cursors.down,    // { isDown, isUp }\nzoomIn: null,          // { isDown, isUp }\nzoomOut: null,         // { isDown, isUp }\n\nzoomSpeed: 0.01,\nminZoom: 0.001,\nmaxZoom: 1000,\n\nacceleration: null,\n// acceleration: {\n//    x: 0,\n//    y: 0\n// }\n\ndrag: null,\n// drag: {\n//    x: 0,\n//    y: 0\n// }\n\nmaxSpeed: null\n// maxSpeed: {\n//    x: 0,\n//    y: 0\n// }\n});\n
      or
      var controls = new Phaser.Cameras.Controls.FixedKeyControl(config);\n
    2. Update
      scene.update = function (time, delta) {\ncontrols.update(delta);\n}\n
    "},{"location":"camera-controller/#other-methods","title":"Other methods","text":"
    • Start
      controls.start();\n
    • Stop
      controls.stop();\n
    • Set camera
      controls.setCamera(camera);\n
    "},{"location":"camera-effects/","title":"Effects","text":""},{"location":"camera-effects/#introduction","title":"Introduction","text":"

    Effects of camera.

    • Author: Richard Davey
    "},{"location":"camera-effects/#usage","title":"Usage","text":""},{"location":"camera-effects/#fade","title":"Fade","text":"
    • Fades the Camera in, from the given color over the duration specified.
      camera.fadeIn(duration);   // duration in ms\n// camera.fadeIn(duration, red, green, blue, callback, context);\n// red/green/blue: the value to fade the red/green/blue channel from. A value between 0 and 255.\n
      • callback , context : It will be invoked every frame for the duration of the effect.
        function(camera, progress) {}\n
    • Fades the Camera out, to the given color over the duration specified.
      camera.fadeOut(duration);   // duration in ms\n// camera.fadeOut(duration, red, green, blue, callback, context);\n
      • callback , context : It will be invoked every frame for the duration of the effect.
        function(camera, progress) {}\n
    • Fades the Camera, from the given color to transparent over the duration specified.
      camera.fadeFrom(duration);   // duration in ms\n// camera.fadeFrom(duration, red, green, blue, force, callback, context);\n
      • force : Force the effect to start immediately, even if already running.
      • callback , context : It will be invoked every frame for the duration of the effect.
        function(camera, progress) {}\n
    • Fades the Camera, from transparent to the given color over the duration specified.
      camera.fade(duration);   // duration in ms\n// camera.fade(duration, red, green, blue, force, callback, context);\n
      • force : Force the effect to start immediately, even if already running.
      • callback , context : It will be invoked every frame for the duration of the effect.
        function(camera, progress) {}\n
    "},{"location":"camera-effects/#events","title":"Events","text":"
    camera.on('camerafadeincomplete', camera, fade);\n
    camera.on('camerafadeoutcomplete', camera, fade);\n
    "},{"location":"camera-effects/#flash","title":"Flash","text":"
    camera.flash(duration);   // duration in ms\n// camera.flash(duration, red, green, blue, force, callback, context);\n
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress) {}\n
    "},{"location":"camera-effects/#events_1","title":"Events","text":"
    camera.on('cameraflashstart', camera, flash, duration, red, green, blue);\n
    camera.on('cameraflashcomplete', camera, flash);\n
    "},{"location":"camera-effects/#shake","title":"Shake","text":"
    camera.shake(duration);   // duration in ms\n// camera.shake(duration, intensity, force, callback, context);  // callback: invoked when completed\n
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress) {}\n
    "},{"location":"camera-effects/#events_2","title":"Events","text":"
    camera.on('camerashakestart', camera, shake, duration, intensity);\n
    camera.on('camerashakecomplete', camera, shake);\n
    "},{"location":"camera-effects/#pan","title":"Pan","text":"
    camera.pan(x, y, duration);   // duration in ms\n// camera.pan(x, y, duration, ease, force, callback, context);\n
    • x, y : The destination x/y coordinate to scroll the center of the Camera viewport to.
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress, x, y) {}\n
    "},{"location":"camera-effects/#events_3","title":"Events","text":"
    camera.on('camerapanstart', camera, pan, duration, x, y);\n
    camera.on('camerapancomplete', camera, pan);\n
    "},{"location":"camera-effects/#zoom","title":"Zoom","text":"
    camera.zoomTo(zoomValue, duration);   // duration in ms\n// camera.zoomTo(zoomValue, duration, ease, force, callback, context);\n
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress, zoomValue) {}\n
    "},{"location":"camera-effects/#events_4","title":"Events","text":"
    camera.on('camerazoomstart', camera, zoom, duration, zoomValue);\n
    camera.on('camerazoomcomplete', camera, zoom);\n
    "},{"location":"camera-effects/#rotate-to","title":"Rotate to","text":"
    camera.rotateTo(radians, shortestPath, duration);   // duration in ms\n// camera.rotateTo(radians, shortestPath, duration, ease, force, callback, context);\n
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress, angle) {}\n
    "},{"location":"camera-effects/#events_5","title":"Events","text":"
    camera.on('camerarotatestart', camera, rotateTo, duration, angle);\n
    camera.on('camerarotatecomplete', camera, rorotateTotate);\n
    "},{"location":"camera-effects/#mask","title":"Mask","text":"
    • Add mask
      camera.setMask(mask);\n
    • Clear mask
      camera.clearMask();\n

    More detail about mask

    "},{"location":"camera-shader-effect/","title":"Shader effect","text":""},{"location":"camera-shader-effect/#introduction","title":"Introduction","text":"

    Shader effect of camera.

    • Author: Richard Davey
    "},{"location":"camera-shader-effect/#usage","title":"Usage","text":""},{"location":"camera-shader-effect/#register-post-fx-pipeline","title":"Register post-fx pipeline","text":"
    • Register post-fx pipeline in game config
      import PostFxClass from 'path';\nvar config = {\n// ...\npipeline: [PostFxClass]\n// ...\n};\nvar game = new Phaser.Game(config);\n

    Some post-fx pipelines:

    • Barrel: Barrel post processing filter.
    • Color replace: Replace color post processing filter.
    • Cross-stitching: Cross-stitching post processing filter.
    • CRT: CRT post processing filter.
    • Dissolve: Dissolve transition post processing filter.
    • Fish eye: Fish-eye post processing filter.
    • Glow-filter: Glow post processing filter.
    • Glow-filter: Glow post processing filter, ported from pixi.
    • Gray-scale: Gray scale post processing filter.
    • Hsl-adjust: Adjust color in HSL domain, post processing filter.
    • Horri-fi: 6-in-1 post processing filter.
    • Inverse: Inverse color post processing filter.
    • Kawase-blur: Kawase-blur post processing filter.
    • Pixelation: Pixelation post processing filter.
    • Toonify: Draw outlines and quantize color in HSV domain, post processing filter.
    • Shockwave: Shockwave post processing filter.
    • Split: Split image into 4 parts.
    • Swirl: Swirl post processing filter.
    • Warp: Warp post processing filter.
    "},{"location":"camera-shader-effect/#add-post-fx-pipeline","title":"Add post-fx pipeline","text":"
    camera.setPostPipeline(PostFxClass);\n
    • PostFxClass : Class of post-fx pipeline.
    "},{"location":"camera-shader-effect/#remove-post-fx-pipeline","title":"Remove post-fx pipeline","text":"
    • Remove a kind of post-fx pipeline
      camera.removePostPipeline(PostFxClass);\n
    • Remove all post-fx pipelines
      camera.resetPipeline(true);\n
      or
      camera.postPipelines = [];\ncamera.hasPostPipeline = false;\n
    "},{"location":"camera-shader-effect/#get-post-fx-pipeline","title":"Get post-fx pipeline","text":"
    var pipelineInstance = camera.getPostPipeline(PostFxClass);\n
    • pipelineInstance :
      • A pipeline instance
      • An array of pipeline instances
    "},{"location":"camera-shader-effect/#add-effect-properties","title":"Add effect properties","text":"

    See Add effect properties behavior

    "},{"location":"camera/","title":"Camera","text":""},{"location":"camera/#introduction","title":"Introduction","text":"

    Camera to display game objects, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"camera/#usage","title":"Usage","text":""},{"location":"camera/#get-camera","title":"Get camera","text":"

    Each scene has one or more cameras.

    • Main camera
      var camera = scene.cameras.main;\n
    • Get camera by name
      var camera = scene.cameras.getCamera(name);\n
    • Add new camera
      var camera = scene.cameras.add();\n// var camera = scene.cameras.add(x, y, width, height);\n
    • Add new camera with name
      var camera = scene.cameras.add(undefined, undefined, undefined, undefined, false, name);\n// var camera = scene.cameras.add(x, y, width, height, makeMain, name);\n
    • Add existed camera
      scene.cameras.addExisting(camera);\n
    "},{"location":"camera/#create-cameras-from-json","title":"Create cameras from JSON","text":"
    scene.cameras.fromJSON(config);\n// scene.cameras.fromJSON(configArray);\n
    • config :
      {\nname: '',\nx: 0,\ny: 0,\nwidth: scene.sys.scale.width,\nheight: scene.sys.scale.height,\nzoom: 1,\nrotation: 0,\nscrollX: 0,\nscrollY: 0,\nroundPixels: false,\nvisible: true,\nbackgroundColor: false,\nbounds: null, // {x, y, width, height}\n}\n
    "},{"location":"camera/#remove-camera","title":"Remove camera","text":"
    scene.cameras.remove(camera);\n
    "},{"location":"camera/#destroy-camera","title":"Destroy camera","text":"
    camera.destroy();\n
    "},{"location":"camera/#view-port","title":"View port","text":"
    • Set
      camera.setViewport(top, left, width, height);\n
      or
      camera.setPosition(top, left);\n// camera.x = top;\n// camera.y = left;\n
      camera.setSize(width, height);\n// camera.width = width;\n// camera.height = height;\n
    • Get
      • Position
        • Top-left
          var top = camera.x;\nvar left = camera.y;\n
        • Center, relative to the top-left of the game canvas.
          var x = camera.centerX;\nvar y = camera.centerY;\n
      • Width & height
        var width = camera.width;\nvar height = camera.height;\n
        var displayWidth = camera.displayWidth;\nvar displayHeight = camera.displayHeight;\n
    "},{"location":"camera/#zoom","title":"Zoom","text":"
    • Set
      camera.setZoom(zoomValue);  // The minimum it can be is 0.001.\ncamera.zoom = zoomValue;\n
    • Get
      var zoomValue = camera.zoom;\n
    "},{"location":"camera/#rotation","title":"Rotation","text":"
    • Set
      camera.setAngle(angle);  // angle in degree\ncamera.setRotation(angle);  // angle in radians\ncamera.rotation = angle; // angle in radians\n
    • Get
      var angle = camera.rotation;  // angle in radians\n
    "},{"location":"camera/#origin","title":"Origin","text":"
    • Set
      camera.setOrigin(x, y);\n// camera.originX = 0.5;\n// camera.originY = 0.5;\n
    • Get
      var originX = camera.originX\nvar originY = camera.originY\n
    "},{"location":"camera/#visible","title":"Visible","text":"

    A visible camera will render and perform input tests. An invisible camera will not render anything and will skip input tests.

    camera.setVisible(value);\n// camera.visible = value\n
    var visible = camera.visible;\n
    "},{"location":"camera/#alpha","title":"Alpha","text":"
    camera.setAlpha(value);\n// camera.alpha = value;\n
    var alpha = camera.alpha;\n
    "},{"location":"camera/#scroll","title":"Scroll","text":"
    camera.setScroll(x, y)\n
    camera.scrollX = scrollX;\ncamera.scrollY = scrollY;\n
    camera.centerToBounds();\n
    camera.centerOn(x, y);  // centered on the given coordinates\n
    camera.centerOnX(x);\ncamera.centerOnY(y);\n
    camera.centerToSize();\n
    "},{"location":"camera/#follow-game-object","title":"Follow game object","text":"
    • Start following
      camera.startFollow(gameObject);\n// camera.startFollow(gameObject, roundPx, lerpX, lerpY, offsetX, offsetY);  // \n
      • roundPx : set true to round the camera position to integers
      • lerpX, lerpY : A value between 0 and 1.
        • 1 : Camera will instantly snap to the target coordinates.
        • 0.1 : Camera will more slowly track the target, giving a smooth transition.
      • offsetX, offsetY : The horizontal/vertical offset from the camera follow target.x position.
    • Stop following
      camera.stopFollow();\n
    • Set follow offset
      camera.setFollowOffset(x, y);\n
    • Set lerp
      camera.setLerp(x, y);\n
      • 1 : Camera will instantly snap to the target coordinates.
      • 0.1 : Camera will more slowly track the target, giving a smooth transition.
    • Deadzone
      camera.setDeadzone(width, height);\n
      If the target moves outside of this area, the camera will begin scrolling in order to follow it.
      • Boundaries
        var left = camera.deadzone.left;\nvar right = camera.deadzone.right;\nvar top = camera.deadzone.top;\nvar bootom = camera.deadzone.bottom;\n
      • Clear deadzone
        camera.setDeadzone();\n
    "},{"location":"camera/#events","title":"Events","text":"
    • Follower Update
      camera.on('followupdate', function(camera, gameObject){ })\n
    "},{"location":"camera/#scroll-factor","title":"Scroll factor","text":"

    See Scroll factor in game object.

    "},{"location":"camera/#bounds","title":"Bounds","text":"
    • Set
      camera.setBounds(x, y, width, height)\n
    • Get
      var bounds = camera.getBounds();  // bounds: a rectangle object\n// var out = camera.getBounds(out);\n
    "},{"location":"camera/#world-coordinates","title":"World coordinates","text":"
    • World view, a rectangle object
      var worldView = camera.worldView;\nvar x = worldView.x;\nvar y = worldView.y;\nvar width = worldView.width;  // displayWidth\nvar height = worldView.height; // displayHeight\nvar left = worldView.left;  // x\nvar right = worldView.right;  // x + width\nvar top = worldView.top;  // y\nvar bottom = worldView.bottom;  // y + height\nvar centerX = worldView.centerX;\nvar centerY = worldView.centerY;\nvar isInside = worldView.contains(x, y);\nvar randPoint = worldView.getRandomPoint(point); // point: {x, y}\n
    • Middle point
      var x = camera.midPoint.x;\nvar y = camera.midPoint.y;\n
    • Get world position
      var out = camera.getWorldPoint(x, y);\n// var out = camera.getWorldPoint(x, y, out);\n
      • x , y : Position of camera.
      • out : World position {x, y}
    "},{"location":"camera/#set-background-color","title":"Set background color","text":"
    camera.setBackgroundColor(color);\n
    "},{"location":"camera/#ignore-game-object","title":"Ignore game object","text":"

    Ignored game objects won't show at that camera.

    camera.ignore(gameObject);\n
    • gameObject :
      • A game object
      • An array of game objects
      • A group
    "},{"location":"camera/#get-cameras-below-pointer","title":"Get cameras below pointer","text":"
    var cameras = scene.cameras.getCamerasBelowPointer(pointer);\n
    • cameras : An array of cameras.
    • pointer : {x, y}
    "},{"location":"camera/#pause-resume","title":"Pause, resume","text":"
    • Pause
      camera.renderToTexture = false; // Pause\n
    • Resume
      camera.renderToTexture = true; // Resume\n
    "},{"location":"camera/#clear","title":"Clear","text":"
    camera.clearRenderToTexture();\n
    "},{"location":"camera/#children","title":"Children","text":""},{"location":"camera/#visible-children","title":"Visible children","text":"
    • Filter visible children
      var visible = scene.cameras.getVisibleChildren(children, camera);\n
    • Get all visible children
      var visible = scene.cameras.getVisibleChildren(scene.sys.displayList.list, camera);\n

    See also: gameObject.willRender(camera)

    "},{"location":"camera/#render-children","title":"Render children","text":"
    var children = camera.renderList;\n

    Read only.

    "},{"location":"canvas-circularprogress/","title":"Circular progres","text":""},{"location":"canvas-circularprogress/#introduction","title":"Introduction","text":"

    Circular progress bar on canvas.

    • Author: Rex
    • Game object
    "},{"location":"canvas-circularprogress/#live-demos","title":"Live demos","text":"
    • Circular-progress
    "},{"location":"canvas-circularprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas-circularprogress/#install-plugin","title":"Install plugin","text":""},{"location":"canvas-circularprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcircularprogresscanvasplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcircularprogresscanvasplugin.min.js', true);\n
    • Add circular-progress object
      var circularProgress = scene.add.rexCircularProgressCanvas(x, y, radius, color, value, config);\n
    "},{"location":"canvas-circularprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CircularProgressCanvasPlugin from 'phaser3-rex-plugins/plugins/circularprogresscanvas-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircularProgressCanvasPlugin',\nplugin: CircularProgressCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add circular-progress object
      var circularProgress = scene.add.rexCircularProgressCanvas(x, y, radius, color, value, config);\n
    "},{"location":"canvas-circularprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CircularProgressCanvas from 'phaser3-rex-plugins/plugins/circularprogresscanvas.js';\n
    • Add circular-progress object
      var circularProgress = new CircularProgressCanvas(scene, x, y, radius, color, value, config);\nscene.add.existing(image);\n
    "},{"location":"canvas-circularprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircularProgressCanvasPlugin',\nplugin: CircularProgressCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"canvas-circularprogress/#create-instance","title":"Create instance","text":"
    var circularProgress = scene.add.rexCircularProgressCanvas(x, y, radius, barColor, value, {\nbarColor2: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nendAngle: Phaser.Math.DegToRad(270+360),\nanticlockwise: false,\n\ntextColor: undefined,\ntextStrokeColor: undefined,\ntextStrokeThickness: undefined,\n// textFont: ,\ntextSize: '16px',\ntextFamily: 'Courier',\ntextStyle: '',\ntextFormatCallback: undefined,\ntextFormatCallbackScope: undefined,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n

    or

    var circularProgress = scene.add.rexCircularProgressCanvas({\nx: 0,\ny: 0,\nradius: 1,\n\nbarColor: undefined,\nbarColor2: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nendAngle: Phaser.Math.DegToRad(270+360),\nanticlockwise: false,\n\ntextColor: undefined,\ntextStrokeColor: undefined,\ntextStrokeThickness: undefined,\n// textFont: ,\ntextSize: '16px',\ntextFamily: 'Courier',\ntextStyle: '',\ntextFormatCallback: undefined,\ntextFormatCallbackScope: undefined,\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n
    • x, y : Position of this object.
    • radius : Radius of this circle. Size will be (radius*2, radius*2).
    • barColor, barColor2 : Fill color of circular bar, in number or css string value. Assign gradient start color by barColor2.
    • trackColor : Color of circular track, in number or css string value.
    • centerColor : Color of center circle, in number or css string value.
    • thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
    • startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
    • endAngle : End angle of circular bar, in radians. Default value is 270+360 degrees.
    • anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
    • textColor : Color of display text. Default is undefined.
    • textStrokeColor, textStrokeThickness : Stroke color, stroke line width of display text. Default is undefined.
    • textSize, textFamily, textStyle : Size, family, style of display text.
    • textFormatCallback, textFormatCallbackScope : Formating callback of display text. ex:
      function(value) {\nreturn Math.floor(value * 100).toString();\n}\n
      Default value is undefined.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, circularProgress) {\n}\n

    Add circular-progress from JSON

    var circularProgress = scene.make.rexCircularProgressCanvas({\nx: 0,\ny: 0,\nradius: 1,\n\nbarColor: undefined,\nbarColor2: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nendAngle: Phaser.Math.DegToRad(270+360),\nanticlockwise: false,\n\ntextColor: undefined,\ntextStrokeColor: undefined,\ntextStrokeThickness: undefined,\ntextSize: '16px',\ntextFamily: 'Courier',\ntextStyle: '',\ntextFormatCallback: undefined,\ntextFormatCallbackScope: undefined,\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n\nadd: true\n});\n
    "},{"location":"canvas-circularprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCircularProgressCanvas extends CircularProgressCanvas {\nconstructor(scene, x, y, radius, barColor, value, config) {\nsuper(scene, x, y, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var circularProgress = new MyCircularProgressCanvas(scene, x, y, radius, color, value, config);\n
    "},{"location":"canvas-circularprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = circularProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = circularProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = circularProgress.value; // value: 0 ~ 1\n
    • Set value
      circularProgress.setValue(value, min, max); // value: min ~ max\n
      or
      circularProgress.setValue(value); // value: 0 ~ 1\n
      or
      circularProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      circularProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      circularProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      circularProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"canvas-circularprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      circularProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      circularProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      circularProgress.stopEaseValue();\n
    • Set ease duration
      circularProgress.setEaseValueDuration(duration);\n
    • Set ease function
      circularProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"canvas-circularprogress/#radius","title":"Radius","text":"
    • Get
      var radius = circularProgress.radius;\n
    • Set
      circularProgress.setRadius(radius);\n// circularProgress.radius = radius;\n
      • Also resize this game object to (radius*2, radius*2)
    "},{"location":"canvas-circularprogress/#circular-track","title":"Circular track","text":"
    • Color
      • Get
        var trackColor = circularProgress.trackColor;\n
      • Set
        circularProgress.setTrackColor(trackColor);\n// circularProgress.trackColor = trackColor;\n
    • Thickness : radius*thickness
      circularProgress.setThickness(thickness);\n
      • thickness : 0~1.
    "},{"location":"canvas-circularprogress/#circular-bar","title":"Circular bar","text":"
    • Color
      • Get
        var barColor = circularProgress.barColor;\n
      • Set
        circularProgress.setBarColor(color);\n// circularProgress.barColor = color;\n
    • Color2
      • Get
        var barColor2 = circularProgress.barColor2;\n
      • Set
        circularProgress.setBarColor2(color);\n// circularProgress.barColor2 = color;\n
    • Thickness : radius*thickness
      circularProgress.setThickness(thickness);\n
      • thickness : 0~1.
    • Start angle
      • Get
        var startAngle = circularProgress.startAngle;\n
      • Set
        circularProgress.setStartAngle(startAngle);\ncircularProgress.startAngle = startAngle;\n
        • startAngle : Start angle of circular bar, in radians.
    • End angle
      • Get
        var endAngle = circularProgress.endAngle;\n
      • Set
        circularProgress.setEndAngle(endAngle);\ncircularProgress.endAngle = endAngle;\n
        • endAngle : End angle of circular bar, in radians.
    • Anticlockwise
      • Get
        var anticlockwise = circularProgress.anticlockwise;\n
      • Set
        circularProgress.setAnticlockwise(anticlockwise);\n// circularProgress.anticlockwise = anticlockwise;\n
    "},{"location":"canvas-circularprogress/#center-circle","title":"Center circle","text":"
    • Color
      • Get
        var centerColor = circularProgress.centerColor;\n
      • Set
        circularProgress.setCenterColor(centerColor);\n// circularProgress.centerColor = centerColor;\n
    "},{"location":"canvas-circularprogress/#display-text","title":"Display text","text":"
    • Fill color
      circularProgress.setTextColor(color);\n
    • Stroke color
      circularProgress.setTextStrokeColor(color, thickness);\n
    • Font
      circularProgress.setTextFont(fontSize, fontFamily, fontStyle);\n
    • Format callback
      circularProgress.setTextFormatCallback(callback, scope);\n
      • callback :
        function(value) {\nreturn Math.floor(value * 100).toString(); }\n
    "},{"location":"canvas-circularprogress/#events","title":"Events","text":"
    • On value changed
      circularProgress.on('valuechange', function(newValue, oldValue, circularProgress){\n//\n}, scope);\n
    "},{"location":"canvas-circularprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"canvas-circularprogress/#create-mask","title":"Create mask","text":"
    var mask = circularProgress.createBitmapMask();\n

    See mask

    "},{"location":"canvas-circularprogress/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"canvas-circularprogress/#compare-with-circular-progress-shape","title":"Compare with Circular-progress shape","text":"
    • Circular-progress canvas creates a canvas then draw on that canvas, circular progress shape draw on GRAPHICS pipeline like Shape or Graphics game object.
    • Circular-progress canvas can draw text directly, circular progress shape can't draw any text.
    "},{"location":"canvas-data/","title":"Canvas image data","text":""},{"location":"canvas-data/#introduction","title":"Introduction","text":"

    Get image data from texture, or text object.

    • Author: Rex
    • Method only
    "},{"location":"canvas-data/#live-demos","title":"Live demos","text":"
    • Text to bit-map
    • Texture to color-map
    "},{"location":"canvas-data/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas-data/#install-plugin","title":"Install plugin","text":""},{"location":"canvas-data/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcanvasdataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcanvasdataplugin.min.js', true);\n
    • Add canvas-data object
      var canvasData = scene.plugins.get('rexcanvasdataplugin').canvasObjectToBitmap(gameObject);\nvar canvasData = scene.plugins.get('rexcanvasdataplugin').textureTColorMap(textureKey, frameName);\n
    "},{"location":"canvas-data/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CanvasDataPlugin from 'phaser3-rex-plugins/plugins/canvasdata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCanvasData',\nplugin: CanvasDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add canvas-data object
      var canvasData = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(gameObject);\nvar canvasData = scene.plugins.get('rexCanvasData').textureTColorMap(textureKey, frameName);\n
    "},{"location":"canvas-data/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CanvasData from 'phaser3-rex-plugins/plugins/canvasdata.js';\n
    • Add canvas-data object
      var canvasdata = CanvasData.canvasObjectToBitmap(gameObject);\nvar canvasdata = CanvasData.textureTColorMap(textureKey, frameName);\n
    "},{"location":"canvas-data/#textcanvas-object-bitmap","title":"Text/canvas object -> Bitmap","text":"
    var canvasData = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(gameObject);\n// var out = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(gameObject, out);\n
    • gameObject :
      • Any kind of text object : Text object, bbcode text object, or tag text object.
      • Canvas object
    • For each pixel data
      canvasData.forEach(function(value, x, y, canvasData){\n\n}, scope);\n
      • value : true, or false
    "},{"location":"canvas-data/#texture-color-map","title":"Texture -> Color map","text":"
    • Texture -> Color map
      var canvasData = scene.plugins.get('rexCanvasData').textureTColorMap(textureKey, frameName);\n// var out = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(textureKey, frameName, out);\n
    • Texture of game object -> Color map
      var canvasData = scene.plugins.get('rexCanvasData').textureTColorMap(gameObject);\n// var out = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(gameObject, out);\n
    • For each pixel data
      canvasData.forEach(function(value, x, y, canvasData){\n\n}, scope);\n
      • value : Color32 integer = color integer + (alpha << 24)
        • Get color integer (0 ~ 0xffffff)
          var color = value & 0xffffff;\n
          or
          var color = canvasData.color32ToColorInt(value);\n
        • Get alpha (0 ~ 0xff)
          var alpha = value >>> 24;\n
          var alpha = canvasData.color32ToAlpha(value);\n
    "},{"location":"canvas-data/#canvas-data","title":"Canvas data","text":""},{"location":"canvas-data/#for-each-pixel","title":"For each pixel","text":"
    • For each pixel data
      canvasData.forEach(callback, scope);\n
      • callback : Callback for each pixel
        function(value, x, y, canvasData) {\n\n}\n
    • For each non zero pixel data
      canvasData.forEachNonZero(callback, scope);\n
    "},{"location":"canvas-data/#get-pixel-data","title":"Get pixel data","text":"
    var data = canvasData.get(x, y);\n
    • data :
      • true, or false in result of canvasObjectToBitmap method
      • Color32 in result of textureTColorMap method
    "},{"location":"canvas-data/#size","title":"Size","text":"
    var width = canvasData.width;\nvar height = canvasData.height;\n
    "},{"location":"canvas-lineprogress/","title":"Line progres","text":""},{"location":"canvas-lineprogress/#introduction","title":"Introduction","text":"

    Horizontal line progress bar filled with gradient color on canvas.

    • Author: Rex
    • Game object
    "},{"location":"canvas-lineprogress/#live-demos","title":"Live demos","text":"
    • Line-progress
    "},{"location":"canvas-lineprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas-lineprogress/#install-plugin","title":"Install plugin","text":""},{"location":"canvas-lineprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlineprogresscanvasplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlineprogresscanvasplugin.min.js', true);\n
    • Add line-progress object
      var lineProgress = scene.add.rexLineProgressCanvas(x, y, width, height, barColor, value, config);\n
    "},{"location":"canvas-lineprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LineProgressCanvasPlugin from 'phaser3-rex-plugins/plugins/lineprogresscanvas-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLineProgressCanvasPlugin',\nplugin: LineProgressCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add line-progress object
      var lineProgress = scene.add.rexLineProgressCanvas(x, y, width, height, barColor, value, config);\n
    "},{"location":"canvas-lineprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LineProgressCanvas from 'phaser3-rex-plugins/plugins/lineprogresscanvas.js';\n
    • Add line-progress object
      var lineProgress = new LineProgressCanvas(scene, x, y, width, height, barColor, value, config);\nscene.add.existing(image);\n
    "},{"location":"canvas-lineprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLineProgressCanvasPlugin',\nplugin: LineProgressCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"canvas-lineprogress/#create-instance","title":"Create instance","text":"
    var lineProgress = scene.add.rexLineProgressCanvas(x, y, width, height, barColor, value, {    barColor2: undefined,\nisHorizontalGradient: true,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n});\n

    or

    var lineProgress = scene.add.rexLineProgressCanvas({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\nbarColor: undefined,\nbarColor2: undefined,\nisHorizontalGradient: true,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • barColor, barColor2, isHorizontalGradient : Fill color of line bar, in number or css string value. Assign gradient start color by barColor2.
    • trackColor : Fill color of line track, in number or css string value.
    • trackStrokeColor : Stroke color of track, in number or css string value.
    • trackStrokeThickness : Stroke line width of track.
    • skewX : Horizontal skew of track and bar.
    • rtl :
      • false : Bar starts from left side. Default behavior.
      • true : Bar starts from right side.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, lineProgress) {\n}\n

    Add line-progress from JSON

    var lineProgress = scene.make.rexLineProgressCanvas({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\nbarColor: undefined,\nbarColor2: undefined,\nisHorizontalGradient: true,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n\nadd: true\n});\n
    "},{"location":"canvas-lineprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLineProgressCanvas extends LineProgressCanvas {\nconstructor(scene, x, y, width, height, barColor, value, config) {\nsuper(scene, x, y, width, height, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var lineProgress = new MyLineProgressCanvas(scene, x, y, width, height, barColor, value, config);\n
    "},{"location":"canvas-lineprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = lineProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = lineProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = lineProgress.value; // value: 0 ~ 1\n
    • Set value
      lineProgress.setValue(value, min, max); // value: min ~ max\n
      or
      lineProgress.setValue(value); // value: 0 ~ 1\n
      or
      lineProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      lineProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      lineProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      lineProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"canvas-lineprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      lineProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      lineProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      lineProgress.stopEaseValue();\n
    • Set ease duration
      lineProgress.setEaseValueDuration(duration);\n
    • Set ease function
      lineProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"canvas-lineprogress/#line-track","title":"Line track","text":"
    • Color
      • Get
        var trackColor = lineProgress.trackColor;\n
      • Set
        lineProgress.setTrackColor(trackColor);\n// lineProgress.trackColor = trackColor;\n
    • Stroke
      • Get
        var trackStrokeColor = lineProgress.trackStrokeColor;\nvar trackStrokeThickness = lineProgress.trackStrokeThickness;\n
      • Set
        lineProgress.setTrackColor(color);\nlineProgress.setTrackStroke(lineWidth, color);\n
    "},{"location":"canvas-lineprogress/#line-bar","title":"Line bar","text":"
    • Color
      • Get
        var barColor = lineProgress.barColor;\nvar barColor2 = lineProgress.barColor2;\n
      • Set
        lineProgress.setBarColor(barColor, barColor2);\n// lineProgress.barColor = barColor;\n// lineProgress.barColor2 = barColor2;\n
    "},{"location":"canvas-lineprogress/#horizontal-skew","title":"Horizontal skew","text":"
    • Get
      var skewX = lineProgress.skewX;\n
    • Set
      lineProgress.setSkewX(skewX);\n// lineProgress.skewX = skewX;\n
    "},{"location":"canvas-lineprogress/#right-to-left","title":"Right-to-left","text":"
    • Get
      var rtl = lineProgress.rtl;\n
    • Set
      lineProgress.setRTL(rtl);\n// lineProgress.rtl = rtl;\n
    "},{"location":"canvas-lineprogress/#events","title":"Events","text":"
    • On value changed
      lineProgress.on('valuechange', function(newValue, oldValue, lineProgress){\n//\n}, scope);\n
    "},{"location":"canvas-lineprogress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = lineProgress.alpha;\n
    • Set
      lineProgress.setAlpha(alpha);\n// lineProgress.alpha = alpha;\n
    "},{"location":"canvas-lineprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"canvas-lineprogress/#create-mask","title":"Create mask","text":"
    var mask = lineProgress.createBitmapMask();\n

    See mask

    "},{"location":"canvas-lineprogress/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"canvas-lineprogress/#compare-with-line-progress-shape","title":"Compare with Line-progress shape","text":"
    • Line-progress canvas creates a canvas then draw on that canvas, line progress shape draw on GRAPHICS pipeline like Shape or Graphics game object.
    • Line-progress canvas can fill gradient color, line progress shape only can fill 1 color.
    "},{"location":"canvas-roundrectangle/","title":"Round rectangle","text":""},{"location":"canvas-roundrectangle/#introduction","title":"Introduction","text":"

    Round rectangle on canvas.

    • Author: Rex
    • Game object
    "},{"location":"canvas-roundrectangle/#live-demos","title":"Live demos","text":"
    • Round rectangle
    "},{"location":"canvas-roundrectangle/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas-roundrectangle/#install-plugin","title":"Install plugin","text":""},{"location":"canvas-roundrectangle/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexroundrectanglecanvasplugin', 'https://raw.githubusercontent.com/rexrainbow/    phaser3-rex-notes/master/dist/rexroundrectanglecanvasplugin.min.js', true);\n
    • Add shape object
      var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    "},{"location":"canvas-roundrectangle/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RoundRectanglePlugin from 'phaser3-rex-plugins/plugins/roundrectanglecanvas-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRoundRectangleCanvasPlugin',\nplugin: RoundRectangleCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shape object
      var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    "},{"location":"canvas-roundrectangle/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RoundRectangleCanvas from 'phaser3-rex-plugins/plugins/roundrectanglecanvas.js';\n
    • Add shape object
      var rect = new RoundRectangleCanvas(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\nscene.add.existing(rect);\n
    "},{"location":"canvas-roundrectangle/#create-shape-object","title":"Create shape object","text":"
    var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    • width, height : Size of rectangle.
      • undefined : Set ot undefined to draw a circle.
    • radius : Radius of four corners.
      • 0, or undefined : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
        • Radius and iteration
          {\nradius: radius,\niteration: 0\n}\n
          or
          {\nradius: {x: radiusX, y: radiusY},\niteration: 0\n}\n
          or
          {\nradius: {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n},\niteration: 0\n}\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
          • iteration : Number of interpolation points in each round corner. Default value is 4.
            • 0 : Draw a straight line instead of arc.
    • fillStyle : Fill color in number or css string value, or a callback
      • Number, or css string value : Color value
      • Callback :
        function(canvas, context) {\n// Radial gradient\nvar grd = context.createRadialGradient(x0, y0, r0, x1, y1, r1);\ngrd.addColorStop(0, color0);\ngrd.addColorStop(1, color1);\nreturn grd;\n}\n
    • strokeStyle : Stroke color in number or css string value.
    • lineWidth : Stroke line width.
    • fillColor2 : Gradient color in number or css string value.
    • isHorizontalGradient :
      • true : Horizontal gradient.
      • false : Vertical gradient.

    Note

    If radius >= 0, draw convex corner, else draw concave corner

    "},{"location":"canvas-roundrectangle/#deform","title":"Deform","text":"
    • Rectangle, set radius of 4 corners to 0.
      var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, 0, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    • Circle, set width and height to 2*radius.
      var rect = scene.add.rexRoundRectangleCanvas(x, y, (2*radius), (2*radius), radius, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    • Ellipse, set width and height to 2*radiusX, 2*radiusY.
      var rect = scene.add.rexRoundRectangleCanvas(x, y, (2*radiusX), (2*radiusX), {x: radiusX, y: radiusY}, fillColor, fillAlpha);\n
    • Rhombus, set width and height to 2*radius, and assign iteration to 0
      var rect = scene.add.rexRoundRectangleCanvas(x, y, (2*radius), (2*radius), {\nradius: radius,\niteration: 0\n}, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    • Octagon, assign iteration to 0
      var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, {\nradius: radius,\niteration: 0\n}, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    "},{"location":"canvas-roundrectangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRoundRectangleCanvas extends RexPlugins.GameObjects.RoundRectangleCanvas {\nconstructor(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient) {\nsuper(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rect = new MyRoundRectangleCanvas(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    "},{"location":"canvas-roundrectangle/#color","title":"Color","text":"
    • Fill color
      • Get
        var fillStyle = rect.fillStyle;\nvar fillColor2 = rect.fillColor2;\nvar isHorizontalGradient = rect.isHorizontalGradient;\n
      • Set
        rect.setFillStyle(fillStyle);\n// rect.setFillStyle(fillStyle, fillColor2, isHorizontalGradient);\n
        • fillStyle : Fill color in number or css string value, or a callback
          • Number, or css string value : Color value
          • Callback :
            function(canvas, context) {\n// Radial gradient\nvar grd = context.createRadialGradient(x0, y0, r0, x1, y1, r1);\ngrd.addColorStop(0, color0);\ngrd.addColorStop(1, color1);\nreturn grd;\n}\n
      • Clear
        rect.setFillStyle();\n
    • Stroke color
      • Get
        var strokeStyle = rect.strokeStyle;\nvar lineWidth = rect.lineWidth;\n
      • Set
        rect.setStrokeStyle(strokeStyle, lineWidth);\n
      • Clear
        rect.setStrokeStyle();\n
    "},{"location":"canvas-roundrectangle/#size","title":"Size","text":"
    • Get
      var width = rect.width;\nvar height = rect.height;\n
    • Set
      rect.setSize(width, height);\n
      or
      rect.width = width;\nrect.height = height;\n
    "},{"location":"canvas-roundrectangle/#radius","title":"Radius","text":"
    • Set
      rect.setRadius(value);\n
      or
      rect.radius = radius;\n
      • radius :
        • Number : 4 corners with the same radius.
          • 0 : No round corner
          • > 0 : Convex round corner
          • < 0 : Concave round corner
        • JSON
          • 4 corners with the same radius X/Y
            {\nx: radiusX,\ny: radiusY\n}\n
          • Eeach radius of corner
            {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
            or
            {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
    "},{"location":"canvas-roundrectangle/#iteration","title":"Iteration","text":"
    • Get
      var iteration = rect.iteration;\n
    • Set
      rect.setIteration(value);\n
      or
      rect.iteration = value;\n

    Number of interpolation points in each round corner. Default value is 4.

    • 0 : Draw a straight line instead of arc.
    "},{"location":"canvas-roundrectangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"canvas-roundrectangle/#create-mask","title":"Create mask","text":"
    var mask = rect.createBitmapMask();\n

    See mask

    "},{"location":"canvas-roundrectangle/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"canvas-roundrectangle/#compare-with-shape-roundrectangle","title":"Compare with Shape-Roundrectangle","text":"
    • Gradient
      • Canvas-RoundRectangle can fill with gradient color.
      • Shape-Roundrectangle can't fill gradient color.
    • Drawing method
      • Canvas-RoundRectangle draw shape on canvas, then map this canvas to frame buffer.
      • Shape-Roundrectangle draw shape on frame buffer directly without drawing to canvas first.
    "},{"location":"canvas-texture/","title":"Canvas texture","text":""},{"location":"canvas-texture/#introduction","title":"Introduction","text":"

    Canvas Canvas Texture stored in texture cache, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"canvas-texture/#usage","title":"Usage","text":""},{"location":"canvas-texture/#create-canvas-texture","title":"Create canvas texture","text":"
    var texture = scene.textures.createCanvas(key, width, height);\n
    "},{"location":"canvas-texture/#get-canvas-element","title":"Get canvas element","text":"
    var canvas = texture.getCanvas();\nvar context = texture.getContext();\n

    Canvas api

    "},{"location":"canvas-texture/#draw-frame","title":"Draw frame","text":"
    texture.drawFrame(key, frame, x, y);\n// texture.drawFrame(key, frame, x, y, update);\n
    • update : Update the internal ImageData buffer and arrays. Default value is true.
    "},{"location":"canvas-texture/#draw-image","title":"Draw image","text":"
    texture.draw(x, y, source);\n// texture.draw(x, y, source, update);\n
    • source : The HTML Image element, or HTML Canvas element to draw to this canvas.
    • update : Update the internal ImageData buffer and arrays. Default value is true.
    "},{"location":"canvas-texture/#clear","title":"Clear","text":"
    texture.clear();\n
    texture.clear(x, y, width, height);\n// // texture.clear(x, y, width, height, update);\n
    • update : Update the internal ImageData buffer and arrays. Default value is true.
    "},{"location":"canvas-texture/#refresh-texture","title":"Refresh texture","text":"
    texture.refresh();\n
    "},{"location":"canvas-texture/#color","title":"Color","text":"
    • Set
      texture.setPixel(x, y, red, green, blue);\n// texture.setPixel(x, y, red, green, blue, alpha);\n
    • Get
      var color = texture.getPixel(x, y);\n// var color = texture.getPixel(x, y, color);\n
      var colors = texture.getPixels(x, y, width, height);\n
      • colors : [{x, y, color, alpha}, ...]
    "},{"location":"canvas-texture/#image-data","title":"Image data","text":"
    • Set
      texture.putData(imageData, x, y);\n
    • Get
      var imageData = texture.getData(x, y, width, height);\n
    "},{"location":"canvas-texture/#add-frame","title":"Add frame","text":"
    texture.add(name, sourceIndex, x, y, width, height);\n
    • name : The name of this Frame. The name is unique within the Texture.
    • sourceIndex : The index of the TextureSource that this Frame is a part of.
    • x : The x coordinate of the top-left of this Frame.
    • y : The y coordinate of the top-left of this Frame.
    • width : The width of this Frame.
    • height : The height of this Frame.
    "},{"location":"canvas/","title":"Canvas","text":""},{"location":"canvas/#introduction","title":"Introduction","text":"

    Drawing on canvas.

    • Author: Rex
    • Game object
    "},{"location":"canvas/#live-demos","title":"Live demos","text":"
    • Kaleidoscope
    • chartjs
    • Resolution
    "},{"location":"canvas/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas/#install-plugin","title":"Install plugin","text":""},{"location":"canvas/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcanvasplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcanvasplugin.min.js', true);\n
    • Add canvas object
      var canvas = scene.add.rexCanvas(x, y, width, height);\n
    "},{"location":"canvas/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CanvasPlugin from 'phaser3-rex-plugins/plugins/canvas-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCanvasPlugin',\nplugin: CanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add canvas object
      var canvas = scene.add.rexCanvas(x, y, width, height);\n
    "},{"location":"canvas/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Canvas from 'phaser3-rex-plugins/plugins/canvas.js';\n
    • Add canvas object
      var canvas = new Canvas(scene, x, y, width, height);\nscene.add.existing(canvas);\n
    "},{"location":"canvas/#create-instance","title":"Create instance","text":"
    var canvas = scene.add.rexCanvas(x, y, width, height);\n// var canvas = scene.add.rexCanvas(x, y, width, height, resolution);\n

    Add canvas from JSON

    var canvas = scene.make.rexCanvas({\nx: 0,\ny: 0,\nwidth: 256,\nheight: 256,\n// resolution: 1,\n\n// origin: {x: 0.5, y: 0.5},\n// fill: null,\n\nadd: true\n});\n
    • resolution : The resolution the content is rendered to its internal canvas at. Default value is 1.
    "},{"location":"canvas/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCanvas extends Canvas {\nconstructor(scene, x, y, width, height, resolution) {\nsuper(scene, x, y, width, height, resolution);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var canvas = new MyCanvas(scene, x, y, width, height, resolution);\n
    "},{"location":"canvas/#clear-or-fill-canvas","title":"Clear or fill canvas","text":"
    • Clear
      canvas.clear();\n
    • Fill color
      canvas.fill(color);\n
    "},{"location":"canvas/#update-canvas","title":"Update canvas","text":"
    1. Get canvas elemet
      var canvasElem = canvas.getCanvas();\nvar context = canvas.getContext();\n
      or
      var canvaesElem = canvas.canvas;\nvar context = canvas.context;\n
    2. Draw on context
    "},{"location":"canvas/#update-display-texture","title":"Update display texture","text":"
    • Update texture when rendering
      canvas.needRedraw();\n
      or
      canvas.dirty = true;\n
    • Update texture now
      canvas.updateTexture();\n
      or update canvas and texture
      canvas.updateTexture(function(canvasElem, context) { });\n// canvas.updateTexture(callback, scope);\n
    "},{"location":"canvas/#load-or-save-texture","title":"Load or save texture","text":"
    • Save canvas to texuture
      canvas.generateTexture(key);\n// canvas.generateTexture(key, x, y, width, height);\n
    • Copy canvas from texture
      canvas.loadTexture(key, frame);\n
    "},{"location":"canvas/#paste-frame","title":"Paste frame","text":"
    canvas.drawFrame(key, frame);\n// canvas.drawFrame(key, frame, dx, dy, dWidth, dHeight);\n// canvas.drawFrame(key, frame, dx, dy, dWidth, dHeight, sxOffset, syOffset, sWidth, sHeight);\n
    • dx, dy : Top-left position in this canvas. Default value is 0, 0.
    • dWidth, dHeight : The size to draw the image in this canvas. Default value is origin size of frame.
    • sxOffset, syOffset : Offset position of source frame. Default value is 0, 0
    • sWidth, sHeight : The size of the sub-rectangle of the source frame to draw into this canvas. Default value is origin size of frame.
    "},{"location":"canvas/#data-url","title":"Data URL","text":"
    • Load image from URL
      canvas.loadFromURL(url);\n// canvas.loadFromURL(url, callback);\n
      or
      canvas.loadFromURLPromise(url)\n.then(function() {\n\n})\n
      • url : Image url/uri(base64 string)
      • callback : Load complete callback.
    • Get data URL of image
      var dataURL = canvas.getDataURL();\n// var dataURL = canvas.getDataURL(type, encoderOptions);\n
      • dataURL : A base64 string.
      • type : A DOMString indicating the image format. The default format type is image/png.
      • encoderOptions : A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp.
    "},{"location":"canvas/#file","title":"File","text":"
    • Load image from File object
      canvas.loadFromFile(file);\n// canvas.loadFromFile(file, callback);\n
      or
      canvas.loadFromFilePromise(file)\n.then(function() {\n\n})\n
      • file : File object
      • callback : Load complete callback.
    "},{"location":"canvas/#pixel-color","title":"Pixel color","text":"
    • Get color
      var color = canvas.getPixel(x, y);\n
      • color : Color object
        • color.red, color.green, color.blue, color.alpha
    • Set color
      canvas.setPixel(x, y, r, g, b);\n// canvas.setPixel(x, y, r, g, b, a);\n
      or
      canvas.setPixel(x, y, color);\n
      • r, g, b, a : Integer number between 0 ~ 255.
      • color : Color object
    "},{"location":"canvas/#size","title":"Size","text":"
    canvas.setCanvasSize(width, height);\n

    or

    canvas.setSize(width, height);\n

    or

    canvas.resize(width, height);\n
    "},{"location":"canvas/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"canvas/#create-mask","title":"Create mask","text":"
    var mask = canvas.createBitmapMask();\n

    See mask

    "},{"location":"canvas/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"canvas/#compare-with-graphics-object","title":"Compare with Graphics object","text":"
    • Drawing method
      • This canvas object draws stuff on canvas in WEBGL or CANVAS render mode.
      • Graphics object draws stuff on webgl render pipeline in WEBGL render mode.
    • Size
      • This canvas object has size (width, height) and origin.
      • Graphics object does not have size and origin.
    "},{"location":"canvasinput/","title":"Canvas input","text":""},{"location":"canvasinput/#introduction","title":"Introduction","text":"

    An invisible Input DOM element to receive character input and display on DynamicText.

    Inspirited from CanvasInput.

    • Author: Rex
    • Game object
    "},{"location":"canvasinput/#live-demos","title":"Live demos","text":"
    • Simple
    • Text input
    • Number input
    • With rexui-Label
    • Text area
    "},{"location":"canvasinput/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvasinput/#install-plugin","title":"Install plugin","text":""},{"location":"canvasinput/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcanvasinputplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcanvasinputplugin.min.js', true);\n
    • Add canvas-input object
      var txt = scene.add.rexCanvasInput(x, y, width, height, config);\n
    "},{"location":"canvasinput/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CanvasInputPlugin from 'phaser3-rex-plugins/plugins/canvasinput-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCanvasInputPlugin',\nplugin: CanvasInputPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add canvas-input object
      var txt = scene.add.rexCanvasInput(x, y, width, height, config);\n
    "},{"location":"canvasinput/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CanvasInput from 'phaser3-rex-plugins/plugins/canvasinput.js';\n
    • Add canvas-input object
      var txt = new CanvasInput(textGameObject, x, y, width, height, config);\nscene.add.existing(txt);\n
    "},{"location":"canvasinput/#create-instance","title":"Create instance","text":"
    var txt = scene.add.rexCanvasInput({\n// Parameters of DynamicText\nx: 0, y: 0,\nwidth: undefined, height: undefined,\nresolution: 1,\n\n// padding: 0,  // {left: 0, right: 0, top: 0, bottom: 0}\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n\n// Style when focus\n// 'focus.color': ...\n// 'focus.color2': ...\n// 'focus.stroke': ...\n},\nfocusStyle: undefined,\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0,\n\n// Style when cursor move on\n// 'cursor.color': ...\n// 'cursor.backgroundColor': ...\n// 'cursor.xxx': ...\n},\ncursorStyle: undefined,\n\nchildrenInteractive: false,\n\ntext: '',\n\nwrap: {\nlineHeight: undefined,\nuseDefaultLineHeight: true,\nmaxLines: 1,\nwrapWidth: undefined,\nletterSpacing: 0,\nwrapMode: 'char',  // 1|'word'|2|'char'|'character'|3|'mix', for single line text input\nhAlign: 0, // 0|'left'|1|'center'|2|'right'|3|'justify'|'justify-left'|4|'justify-center'|5| justify-right'\nvAlign: 'center',  // For single line text input        \n},\n\ntextArea: false,\n\n// Parameters of hidden-text-editor   \n// inputType: 'text',  // 'text'|'password'|'textarea'|...                \n\n// readOnly: false,\n// maxLength: undefined,\n// minLength: undefined,\n// selectAll: false,\n\n// enterClose: true,\n\n// Callbacks\n// onOpen: function (textObject, hiddenInputText) {\n// },\n\n// onClose: function (textObject, hiddenInputText) {\n// },\n\n// onUpdate: function (text, textObject, hiddenInputText) {\n//     return text;\n// },   \n\n// onAddChar: function(child, index, canvasInput) {\n//    child.modifyStyle({...})\n// },\n\n// onCursorOut: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// onCursorIn: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// parseTextCallback: function(text) {\n//     return text;\n// }.\n\n});\n
    • textArea :
      • false : Single line text input. Default behavior.
      • true : Multiple lines text input.
    • Parameters of DynamicText...
      • wrap : Some default value in wrap are changed
        • wrap.useDefaultLineHeight : Default value is true
        • wrap.maxLines : Default value is 1
        • wrap.vAlign : Default value is 'center'
    • Parameters of hidden-text-editor
      • inputType : Type of element
        • 'text', 'password', 'textarea', ...
      • enterClose : Set true to close input text when enter-key was pressed. Default value is true.
      • readOnly :
        • true : un-editable.
        • false : Editable. Defaule behavior.
      • maxLength, minLength : Maximun or minimun of input characters
      • selectAll : Set to true to select all characters when focusing.
    • Callbacks
      • onOpen : Callback invoked when focus on this hidden input text.
        function (textObject) {\n// textObject.setInputText(txt);\n}\n
      • onClose : Callback invoked when blur.
        function (textObject) {            }\n
      • onUpdate :
        • A callback invoked in each tick of editing.
          function (text, textObject) {\n// return text;\n}\n
          • Can return a new string for text game object displaying.
        • 'number' : Only output number string.
      • onAddChar : Callback invoked when adding new character child
        function(child, index, canvasInput) {\nchild.modifyStyle({...})\n}\n
        • child : character child
      • onCursorOut : Callback invoked when cursor move out of a character child
        function(child, index, canvasInput) {\nchild.modifyStyle({...})\n}\n
        • child : character child
      • onCursorIn : Callback invoked when cursor move on a character child
        function(child, index, canvasInput) {\nchild.modifyStyle({...})\n}\n
        • child : character child
      • parseTextCallback : Callback of parsing text (txt.text) to value (txt.value)
        • undefined : Bypass text to value. Default behavior.
        • A function object
          function(text) {\nreturn text;\n}\n
    • focusStyle : Will apply this style to background when focusing.
      • undefined : Ignore this behavior.
      • A plain object
        {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n}\n
      • Or add these style settings in background parameter, with prefix 'focus.'.
    • cursorStyle : Will apply this style when cursor move on a character child.
      • undefined : Ignore this behavior.
      • A plain object
        {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0\n}\n
      • Or add these style settings in style parameter, with prefix 'cursor.'.
    "},{"location":"canvasinput/#number-input","title":"Number input","text":"
    txt.setNumberInput();\n
    "},{"location":"canvasinput/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCanvasInput extends CanvasInput {\nconstructor(textGameObject, x, y, width, height, config)) {\nsuper(textGameObject, x, y, width, height, config)) {\n// ...            \n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyCanvasInput(textGameObject, config);\n
    "},{"location":"canvasinput/#open-editor","title":"Open editor","text":"
    txt.open();\n

    or

    txt.open(onCloseCallback);\n
    • onCloseCallback : Callback invoked when closing text-editor
    "},{"location":"canvasinput/#close-editor","title":"Close editor","text":"
    txt.close();\n
    "},{"location":"canvasinput/#is-opened","title":"Is opened","text":"
    var isOpened = txt.isOpened;\n
    "},{"location":"canvasinput/#text","title":"Text","text":"
    • Display text on dynamic text game object
      • Get
        var text = txt.text;\n
        or
        var text = txt.displayText;\n
      • Set
        txt.setText(text);\n
        or
        txt.setDisplayText(text);\n
    • Input text on hidden text edit behavior
      • Get
        var text = txt.inputText;\n
      • Set
        var text = txt.setInputText(text);\n
    "},{"location":"canvasinput/#value","title":"Value","text":"
    • Get. Parse text to value.
      var value = txt.getValue();\n// var value = txt.value;\n
      • Set parseTextCallback
        txt.setParseTextCallback(callback);\n
        • callback :
          • undefined : Bypass text to value. Default behavior.
          • A function object
            function(text) {\nreturn text;\n}\n
    • Set. Conver any type of value to string.
      txt.setValue(value);\n// txt.value = value;\n
    "},{"location":"canvasinput/#read-only","title":"Read only","text":"
    • Enable read only
      txt.setReadOnly();\n// txt.setReadOnly(true);\n
      or
      txt.readOnly = true;\n
    • Disable read only
      txt.setReadOnly(false);\n
      or
      txt.readOnly = false;\n
    • Get read only
      var readOnlyEanble = txt.readOnly;\n
    "},{"location":"canvasinput/#size","title":"Size","text":"
    • Resize canvas size
      txt.setCanvasSize(width, height)\n
    • Reisze text wrapping size and canvas size.
      txt.setSize(width, height);\n
      or
      txt.setFixedSize(width, height);\n
    • Resize to minimun size to show all visible characters.
      txt.setToMinSize();\n
    "},{"location":"canvasinput/#events","title":"Events","text":"
    • On text change
      txt.on('textchange', function(text, txt){\n})\n
    • On character child adding
      txt.on('addchar', function(child, index, canvasInput) {\nchild.modifyStyle({...})\n})\n
      • child : character child
    • On cursor moving out of a character child
      txt.on('cursorout', function(child, index, canvasInput) {\nchild.modifyStyle({...})\n})\n
      • child : character child
    • On cursor moving on a character child
      txt.on('cursorin', function(child, index, canvasInput) {\nchild.modifyStyle({...})\n})\n
      • child : character child
    • On open text-editor
      txt.on('open', function() {\n\n})\n
    • On close text-editor
      txt.on('close', function() {\n\n})\n
    • Close editor by ENTER key down
      txt.on('keydown-ENTER', function(){\n})\n
    • Not a number input
      txt.on('nan', function(text){\n\n})\n
    "},{"location":"canvasinput/#select-text","title":"Select text","text":"

    This feature does not support.

    "},{"location":"canvasinput/#bypass-key-input","title":"Bypass key input","text":"

    Registered keyboard events might capture key input.

    var keyObj = scene.input.keyboard.addKey('W', enableCapture, emitOnRepeat);\n

    Set enableCapture to false to bypass key input to this input-text game objecct.

    "},{"location":"canvasinput/#other-properties","title":"Other properties","text":"

    See Dynamic text game object game object

    "},{"location":"canvasinput/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"canvasinput/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"capitalizes-first/","title":"Capitalizes first","text":""},{"location":"capitalizes-first/#introduction","title":"Introduction","text":"

    Capitalizes the first letter of a string, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"capitalizes-first/#usage","title":"Usage","text":"
    var result = Phaser.Utils.String.UppercaseFirst(str);\n
    "},{"location":"charactercache/","title":"Character cache","text":""},{"location":"charactercache/#introduction","title":"Introduction","text":"

    Generate bitmapfont from text game object, or bbcode text game object.

    • Author: Rex
    • Member of scene
    "},{"location":"charactercache/#live-demos","title":"Live demos","text":"
    • Set text
    • Textbox
    "},{"location":"charactercache/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"charactercache/#install-plugin","title":"Install plugin","text":""},{"location":"charactercache/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcharactercacheplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcharactercacheplugin.min.js', true);\n
    • Add character-cache object
      var characterCache = scene.plugins.get('rexcharactercacheplugin').add(config);\n
    "},{"location":"charactercache/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CharacterCachePlugin from 'phaser3-rex-plugins/plugins/charactercache-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCharacterCache',\nplugin: CharacterCachePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add character-cache object
      var characterCache = scene.plugins.get('rexCharacterCache').add(config);\n
    "},{"location":"charactercache/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CharacterCache from 'phaser3-rex-plugins/plugins/charactercache.js';\n
    • Add character-cache object
      var characterCache = new CharacterCache(game, config);\n
      or
      var characterCache = new CharacterCache(scene, config);\n
    "},{"location":"charactercache/#create-instance","title":"Create instance","text":"
    var characterCache = scene.plugins.get('rexCharacterCache').add({\nkey: '',  cellWidth: 32,\ncellHeight: 32,\nmaxCharacterCount: 4096,\nfreqMode: true,\n\nstyle: textStyle,\n// textObject: textGameOject,\n\n\ncontent: '',\n});\n
    • key : Texture key in texture manager
    • cellWidth, cellHeight : Maximum frame size.
    • maxCharacterCount : Maximun character count.
      • Width of texture = Math.ceil(Math.sqrt(maxCharacterCount)) * cellWidth
      • Height of texture = Math.ceil(Math.sqrt(maxCharacterCount)) * cellHeight
    • freqMode :
      • true : Swap out un-unsed and low-frequence character.
      • false : Swap out any un-unsed character.
    • style : Style of Text game object. Create a text game object by this style setting on systemScene if textObject parameter is not given.
    • textObject : Text game object, or bbcode text game object for drawing character.
    • content : Load these characters into cache.
    "},{"location":"charactercache/#create-bitmaptext","title":"Create BitmapText","text":"

    Create BitmapText/Dynamci BitmapText game object using this character cache, add this game object into scene's display list

    • BitmapText
      var txt = characterCache.addBitmapText(scene);    // var txt = characterCache.addBitmapText(scene, x, y, text, size, align);\n
    • Dynamci BitmapText
      var txt = characterCache.addDynamicBitmapText(scene);    // var txt = characterCache.addDynamicBitmapText(scene, x, y, text, size, align);\n
    "},{"location":"charactercache/#load-characters","title":"Load characters","text":"

    Load characters into bitmap font, replace unused characters if no free character space.

    characterCache.load(content);\n// characterCache.load(content, lock);\n
    • content : Characters in a string.
    • lock
      • true : Lock these characters, won't be replaced out later.
      • false : Don't lock these characters, can be replaced out later. Default behavior.

    Warning

    Console.warn messages if no unused character is found.

    "},{"location":"charactercache/#events","title":"Events","text":"
    • Add a character
      characterCache.on('add', function(character, textObject) {\n// Can change style of textObject here\n})\n
    • Swap out a character
      characterCache.on('remove', function(character, textObject) {\n})\n
    "},{"location":"charactercache/#override-bitmaptext","title":"Override bitmaptext","text":"

    Inject characterCache.load(text) into bitmapText.setText(text) method.

    characterCache.overrideBitmapText(bitmapText);\n// var bitmapText = characterCache.overrideBitmapText(bitmapText);\n

    Now setText method has lock parameter : bitmapText.setText(text, lock).

    Or user can override bitmapText.setText by extending Phaser.GameObjects.BitmapText class.

    "},{"location":"charactercache/#unlock-all-characters","title":"Unlock all characters","text":"
    characterCache.unlock();\n
    "},{"location":"charactercache/#get-all-cache-data","title":"Get all cache data","text":"
    var cacheData = characterCache.getAllData();\n
    • cacheData : Array of cache data
      {\ncharacter: string,\nfreq: number,\nalive: boolean,\nlock: boolean,\n}\n
    "},{"location":"charactercache/#destroy-instance","title":"Destroy instance","text":"
    characterCache.destroy();\n
    "},{"location":"charactercache/#properties","title":"Properties","text":"
    • characterCache.key : Font key.
    • characterCache.cellWidth, characterCache.cellHeight : Cell size.
    • characterCache.inCacheCount : Amount of characters in cache.
    "},{"location":"circlemaskimage/","title":"Circle mask image","text":""},{"location":"circlemaskimage/#introduction","title":"Introduction","text":"

    Load a texture, then apply a circle mask. Extended from canvas plugin.

    • Author: Rex
    • Game object
    "},{"location":"circlemaskimage/#live-demos","title":"Live demos","text":"
    • Circle-mask-image
    "},{"location":"circlemaskimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"circlemaskimage/#install-plugin","title":"Install plugin","text":""},{"location":"circlemaskimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcirclemaskimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcirclemaskimageplugin.min.js', true);\n
    • Add circle-mask-image object
      var image = scene.add.rexCircleMaskImage(x, y, key, frame, config);\n
    "},{"location":"circlemaskimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CircleMaskImagePlugin from 'phaser3-rex-plugins/plugins/circlemaskimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircleMaskImagePlugin',\nplugin: CircleMaskImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add circle-mask-image object
      var image = scene.add.rexCircleMaskImage(x, y, key, frame, config);\n
    "},{"location":"circlemaskimage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CircleMaskImage from 'phaser3-rex-plugins/plugins/circlemaskimage.js';\n
    • Add circle-mask-image object
      var image = new CircleMaskImage(scene, x, y, key, frame, config);\nscene.add.existing(image);\n
    "},{"location":"circlemaskimage/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircleMaskImagePlugin',\nplugin: CircleMaskImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"circlemaskimage/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexCircleMaskImage(x, y, key, frame, {\nmaskType: 0,\n// radius: undefined,\n\n// backgroundColor: undefined,\n\n// strokeColor: undefined,\n// strokeWidth: 0,\n});\n

    or

    var image = scene.add.rexCircleMaskImage(x, y, key, {\nmaskType: 0,\n// radius: undefined,\n\n// backgroundColor: undefined,\n\n// strokeColor: undefined,\n// strokeWidth: 0,\n});\n
    • maskType : Type of mask.
      • null : No mask.
      • 'circle', or 0 : Circle mask.
      • 'ellipse', or 1 : Ellipse mask.
      • 'roundRectangle', or 2 : Round rectangle mask.
    • radius : Radius of round rectangle mask.
      • 0 : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
    • backgroundColor : Fill background with color.
      • undefined, or null : No background filling. Default behavior.
    • strokeColor : Add stroke around masked image.
      • undefined, or null : No stroke line. Default behavior.
    • strokeWidth : Stroke line width.

    Add image from JSON

    var image = scene.make.rexCircleMaskImage({\nx: 0,\ny: 0,\nkey: key,\nframe: name,\nmaskType: 0,\n// radius: undefined\n// origin: {x: 0.5, y: 0.5},\n\n// backgroundColor: undefined,\n\n// strokeColor: undefined,\n// strokeWidth: 0,\n\nadd: true\n});\n
    "},{"location":"circlemaskimage/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImage extends CircleMaskImage {\nconstructor(scene, x, y, key, frame, config) {\nsuper(scene, x, y, key, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImage(scene, key, frame, config);\n
    "},{"location":"circlemaskimage/#set-texture","title":"Set texture","text":"
    image.setTexture(key, frame);\n// image.setTexture(key, frame, maskType);\n

    or

    image.setTexture(key, frame, {\nmaskType: 0,\n// radius: undefined\n});\n
    • maskType : Type of mask
      • null : No mask.
      • 0, or 'circle' : Circle mask. Default value.
      • 1, or 'ellipse' : Ellipse mask.
    • radius : Radius of round rectangle mask.
      • 0 : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
    "},{"location":"circlemaskimage/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"circlemaskimage/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"circlemaskimage/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"clamp/","title":"Clamp","text":""},{"location":"clamp/#introduction","title":"Introduction","text":"

    Force a value within the boundaries by clamping it to the range min, max, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"clamp/#usage","title":"Usage","text":"
    var result = Phaser.Math.Clamp(value, min, max);\n
    • value : The value to be clamped.
    "},{"location":"clickoutside/","title":"Click outside","text":""},{"location":"clickoutside/#introduction","title":"Introduction","text":"

    Fires 'clickoutside' event when pointer-down or pointer-up outside of game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"clickoutside/#live-demos","title":"Live demos","text":"
    • Click outside
    "},{"location":"clickoutside/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"clickoutside/#install-plugin","title":"Install plugin","text":""},{"location":"clickoutside/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexclickoutsideplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexclickoutsideplugin.min.js', true);\n
    • Add click-outside behavior
      var clickOutside = scene.plugins.get('rexclickoutsideplugin').add(gameObject, config);\n
    "},{"location":"clickoutside/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ClickOutsidePlugin from 'phaser3-rex-plugins/plugins/clickoutside-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexClickOutsiden',\nplugin: ClickOutsidePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add click-outside behavior
      var clickOutside = scene.plugins.get('rexClickOutsiden').add(gameObject, config);\n
    "},{"location":"clickoutside/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ClickOutside from 'phaser3-rex-plugins/plugins/clickoutside.js';\n
    • Add clickoutside behavior
      var clickOutside = new ClickOutside(gameObject, config);\n
    "},{"location":"clickoutside/#create-instance","title":"Create instance","text":"
    var clickOutside = scene.plugins.get('rexClickOutside').add(gameObject, {\n// enable: true,\n// mode: 1,              // 0|'press'|1|'release'\n// clickInterval: 100,   // ms\n// threshold: undefined\n});\n
    • enable : Clickable.
    • mode :
      • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
      • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
    • clickInterval : Interval between 2 'click' events, in ms.
    • threshold : Cancel clicking detecting when dragging distance is larger then this threshold.
      • undefined : Ignore this feature. Default behavior.
    "},{"location":"clickoutside/#events","title":"Events","text":"
    • Click-outside
      clickOutside.on('clickoutside', function (clickoutside, gameObject, pointer) {\n// ...\n}, scope);\n
    • Enable
      clickOutside.on('enable', function (clickoutside, gameObject) {\n// ...\n}, scope);\n
    • Disable
      clickOutside.on('disable', function (clickoutside, gameObject) {\n// ...\n}, scope);\n
    "},{"location":"clickoutside/#enable","title":"Enable","text":"
    • Get
      var enabled = clickOutside.enable;  // enabled: true, or false\n
    • Set
      clickOutside.setEnable(enabled);  // enabled: true, or false\n// clickOutside.enable = enabled;\n
    • Toggle
      clickOutside.toggleEnable();\n
    "},{"location":"clickoutside/#set-mode","title":"Set mode","text":"
    clickOutside.setMode(mode);\n
    • mode :
      • 'press', or 0 : Fire 'click' event when touch pressed.
      • 'release', or 1 : Fire 'click' event when touch released after pressed.
    "},{"location":"clickoutside/#set-click-interval","title":"Set click interval","text":"
    clickOutside.setClickInterval(interval);  // interval in ms\n
    "},{"location":"clickoutside/#set-dragging-threshold","title":"Set dragging threshold","text":"
    clickOutside.setDragThreshold(distance);  // distance in pixels\n
    "},{"location":"clock/","title":"Clock","text":""},{"location":"clock/#introduction","title":"Introduction","text":"

    A clock to count elapsed time.

    • Author: Rex
    • Member of scene
    "},{"location":"clock/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"clock/#install-plugin","title":"Install plugin","text":""},{"location":"clock/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexclockplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexclockplugin.min.js', true);\n
    • Add clock object
      var clock = scene.plugins.get('rexclockplugin').add(scene, config);\n
    "},{"location":"clock/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ClockPlugin from 'phaser3-rex-plugins/plugins/clock-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexClock',\nplugin: ClockPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add clock object
      var clock = scene.plugins.get('rexClock').add(scene, config);\n
    "},{"location":"clock/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Clock from 'phaser3-rex-plugins/plugins/clock.js';\n
    • Add clock object
      var clock = new Clock(scene, config);\n
    "},{"location":"clock/#create-instance","title":"Create instance","text":"
    var clock = scene.plugins.get('rexClock').add(scene, {\n// timeScale: 1\n});\n
    • timeScale : time-scale for counting elapsed time.
    "},{"location":"clock/#start-counting","title":"Start counting","text":"
    clock.start();\n// clock.start(startAt);  // start-at time in ms\n
    "},{"location":"clock/#force-ticking","title":"Force ticking","text":"
    clock.tick(0);\n// clock.tick(delta);\n
    "},{"location":"clock/#get-elapsed-time","title":"Get elapsed time","text":"
    var now = clock.now;  // Elapsed time in ms\n
    "},{"location":"clock/#pause-resume-stop-counting","title":"Pause, Resume, stop counting","text":"
    clock.pause();\nclock.resume();\nclock.stop();\n
    "},{"location":"clock/#seek-elapsed-time","title":"Seek elapsed time","text":"
    clock.seek(time);   // elapsed time in ms\n
    "},{"location":"clock/#state-of-counting","title":"State of counting","text":"
    var isRunning = clock.isRunning;\n
    "},{"location":"clock/#time-scale","title":"Time-scale","text":"
    • Get
      var timeScale = clock.timeScale;\n
    • Set
      clock.setTimeScale(timeScale);\n// clock.timeScale = timeScale;\n
    "},{"location":"clock/#events","title":"Events","text":"
    • On ticking
      clock.on('update', function(now, delta){ })\n
      • now : Elapsed time in ms.
      • delta : Delta time in ms.
    "},{"location":"color/","title":"Color","text":""},{"location":"color/#introduction","title":"Introduction","text":"

    Get color value, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"color/#usage","title":"Usage","text":""},{"location":"color/#get-color-integer","title":"Get color integer","text":"
    • Hex string, or color integer
      var color = Phaser.Display.Color.ValueToColor(input);\n
      • input : Hex string, or color integer
    • RGB to color
      var color = Phaser.Display.Color.GetColor(red, green, blue);\n
      • red, green, blue : 0 ~ 255
    • RGBA to color
      var color = Phaser.Display.Color.GetColor32(red, green, blue, alpha);\n
      • red, green, blue, alpha : 0 ~ 255
    • Hex string to color
      var color = Phaser.Display.Color.HexStringToColor(hex).color;\n
      • hex : #0033ff, #03f, 0x0033ff, or 0x03f
    • RGB string to color
      var color = Phaser.Display.Color.RGBStringToColor(rgb);\n
      • rgb : 'rgb(r,g,b)', or 'rgba(r,g,b,a)'
        • r, g, b : 0 ~ 255
        • a : 0 ~ 1
    • HSV to color
      var color = Phaser.Display.Color.HSVToRGB(h, s, v).color;\n
      • h, s, v : 0 ~ 1
    "},{"location":"color/#color-integer-to-rgb","title":"Color integer to RGB","text":"
    var rgb = Phaser.Display.Color.IntegerToRGB(color);\n
    • color : Color integer (0xAARRGGBB)
    • rgb : JSON object ({r, g, b, a})
    "},{"location":"color/#hsv-color-wheel","title":"HSV color wheel","text":"
    1. Create color array
      var colorArray = Phaser.Display.Color.HSVColorWheel(s, v);\n
    2. Get color
      var color = colorArray[i].color;  // i : 0 ~ 359\n
    "},{"location":"color/#color-object","title":"Color object","text":""},{"location":"color/#create-color-object","title":"Create color object","text":"
    • Create via r,g,b,a components
      var color = new Phaser.Display.Color(red, green, blue); // alpha = 255\n// var color = new Phaser.Display.Color(red, green, blue, alpha);\n
      • red, green, blue, alpha: 0 ~ 255
    • Create via color integer
      var color = Phaser.Display.Color.IntegerToColor(colorInteger);\n
      • colorInteger : Color integer (0xAARRGGBB)
    "},{"location":"color/#set-color","title":"Set color","text":"
    • Set color
      color.setTo(red, green, blue);  // alpha = 255\n// color.setTo(red, green, blue, alpha);\n
      • red, green, blue, alpha: 0 ~ 255
    • Set color in GL values
      color.setGLTo(red, green, blue);  // alpha = 1\n// color.setTo(red, green, blue, alpha);\n
      • red, green, blue, alpha: 0 ~ 1
    • Set color from color object
      color.setFromRGB(rgba);\n
      • rgba :
        {\nr: 0,\ng: 0,\nb: 0,\n// a: 0\n}\n
    • Set color from HSV
      color.setFromHSV(h, s, v);\n
    • Set to transparent ()
      color.transparent();\n
      • Set (red, green, blue) to 0
    • Set to gray color
      color.gray(value);\n
    • Set to a random color
      color.random();\n
      or
      color.random(min, max);\n
      • min : 0 ~ 255. Default value is 0.
      • max : 0 ~ 255. Default value is 255.
    • Set to random gray
      color.randomGray();\n
      or
      color.randomGray(min, max);\n
    • Set red/green/blue/alpha channel : 0 ~ 255
      color.red = value;\n// color.red += value;\ncolor.green = value;\n// color.green += value;\ncolor.blue = value;\n// color.blue += value;\ncolor.alpha = value;\n// color.alpha += value;\n
    • Set H/S/V channel : 0 ~ 1
      color.h = value;\n// color.h += value;\ncolor.s = value;\n// color.s += value;\ncolor.v = value;\n// color.v += value;\n
    • Set normalized red, green, blue, alpha : 0 ~ 1
      color.redGL = value;\n// color.redGL += value;\ncolor.greenGL = value;\n// color.greenGL += value;\ncolor.blueGL = value;\n// color.blueGL += value;\ncolor.alphaGL = value;\n// color.alphaGL += value;\n
    • Set brighten
      color.brighten(value);\n
      • value : Percentage, 0 ~ 100
    • Saturate : Increase the saturation (S) of this Color by the percentage amount given.
      color.saturate(value);\n
      • value : Percentage, 0 ~ 100
    • Desaturate : Decrease the saturation (S) of this Color by the percentage amount given.
      color.desaturate(value);\n
      • value : Percentage, 0 ~ 100
    • Lighten : Increase the lightness (V) of this Color by the percentage amount given.
      color.lighten(value);\n
      • value : Percentage, 0 ~ 100
    • Darken : Decrease the lightness (V) of this Color by the percentage amount given.
      color.darken(value);\n
      • value : Percentage, 0 ~ 100
    "},{"location":"color/#properties","title":"Properties","text":"
    • RGB Color, not including the alpha channel
      var c = color.color;\n
    • RGB Color, including the alpha channel.
      var c = color.color32;\n
    • RGB color string which can be used in CSS color values.
      var c = color.rgba;\n
    • Red, green, blue, alpha : 0 ~ 255
      var r = color.red;\nvar g = color.green;\nvar b = color.blue;\nvar a = color.alpha;\n
    • H, S, V : 0 ~ 1
      var h = color.h;\nvar s = color.s;\nvar v = color.v;\n
    • Normalized red, green, blue, alpha : 0 ~ 1
      var r = color.redGL;\nvar g = color.greenGL;\nvar b = color.blueGL;\nvar a = color.alphaGL;\n
    "},{"location":"color/#clone","title":"Clone","text":"
    var newColor = color.clone();\n
    "},{"location":"color/#to-hex-string","title":"To hex string","text":"
    var hexString = Phaser.Display.Color.RGBToString(color.r, color.g, color.b, color.a);\n// var hexString = Phaser.Display.Color.RGBToString(color.r, color.g, color.b, color.a, prefix);\n
    "},{"location":"color/#interpolation","title":"Interpolation","text":"

    Interpolate between 2 colors.

    var colorOut = Phaser.Display.Color.Interpolate.RGBWithRGB(r1, g1, b1, r2, g2, b2, length, index);\nvar colorOut = Phaser.Display.Color.Interpolate.ColorWithColor(color1, color2, length, index);\nvar colorOut = Phaser.Display.Color.Interpolate.ColorWithRGB(color, r, g, b, length, index);\n
    • length, index : t = index/length (0~1)
    "},{"location":"conditionstable/","title":"CSV Conditions table","text":""},{"location":"conditionstable/#introduction","title":"Introduction","text":"

    Check conditions to find passed tests listed in a csv table.

    • Author: Rex
    • Member of scene
    "},{"location":"conditionstable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"conditionstable/#install-plugin","title":"Install plugin","text":""},{"location":"conditionstable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexconditionstableplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexconditionstableplugin.min.js', true);\n
    • Add conditions-table object
      var conditionstable = scene.plugins.get('rexconditionstableplugin').add();\n
    "},{"location":"conditionstable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ConditionsTablePlugin from 'phaser3-rex-plugins/plugins/conditionstable-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexConditionsTable',\nplugin: ConditionsTablePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add conditions-table object
      var conditionstable = scene.plugins.get('rexConditionsTable').add();\n
    "},{"location":"conditionstable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ConditionsTable from 'phaser3-rex-plugins/plugins/conditionstable.js';\n
    • Add conditions-table object
      var conditionstable = new ConditionsTable();\n
    "},{"location":"conditionstable/#create-instance","title":"Create instance","text":"
    var table = scene.plugins.get('rexConditionsTable').add();\n
    "},{"location":"conditionstable/#load-table-from-csv-string","title":"Load table from csv string","text":"
    table.loadCSV(csvString, {\n// delimiter: ','\n});\n

    For exameple, csv string

    name A A B Test1 >= 10 <= 20 Test2 3
    ,A,A,B\nTest1,>= 10,<= 20,\nTest2,,,3\n

    means that:

    Test1: (A>=10) && (A<=20)\nTest2: (B==3)\n

    Equations will be evaled by new Function.

    "},{"location":"conditionstable/#test","title":"Test","text":""},{"location":"conditionstable/#get-test-results","title":"Get test results","text":"
    var results = table.getTestResults(context);\n
    • context : Inputs in Key-value pairs
    • results : {name: boolean}, use OR operation to combine result of tests with the same name.
    "},{"location":"conditionstable/#get-first-pass-test-name","title":"Get first pass test name","text":"
    var testName = table.anyPassTest(context);\n
    • context : Inputs in Key-value pairs
    "},{"location":"config-data/","title":"Configuration data","text":""},{"location":"config-data/#introduction","title":"Introduction","text":"

    Get parameters from configuration object.

    • Author: Richard Davey
    "},{"location":"config-data/#usage","title":"Usage","text":""},{"location":"config-data/#quick-start","title":"Quick start","text":"
    const GetValue = Phaser.Utils.Objects.GetValue;\nvar myMethod = function(config) {\nvar x = GetValue(config, 'x', 0);\nvar y = GetValue(config, 'y', 0);\nvar width = GetValue(config, 'width', 0);\nvar height = GetValue(config, 'height', 0);\n// ...\n}\n
    "},{"location":"config-data/#get-value","title":"Get value","text":"
    • Retrieves a value from an object.
      var value = Phaser.Utils.Objects.GetValue(source, key, defaultValue);\n
      • source : Configuration object.
      • key : The name of the property to retrieve from the object. For example,
        • Property source.name, key = name
        • Property source.position.x, key = position.x
      • defaultValue : The value to return if the key isn't found in the source object.
    • Finds the key within the top level of the source object, or returns defaultValue.
      var value = Phaser.Utils.Objects.GetFastValue(source, key, defaultValue);\n
      • key : The key for the property on source. Must exist at the top level of the source object.
    • Retrieves a value from an object. Allows for more advanced selection options.
      var value = Phaser.Utils.Objects.GetAdvancedValue(source, key, defaultValue);\n
      • Implicit
        var source = {x: 4};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = 4\n
      • From function
        var source = {x: function(key){return 4;}};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = 4\n
        • Pass key to function's 1st parameter, and get return value as final result.
      • Randomly pick one element from the array
        var source = {x: [a, b, c]};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = random item from array [a, b, c]\n
      • Random integer between min and max
        var source = {x: randInt: [min, max]};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = random int min~max\n
      • Random float between min and max
        var source = {x: randFloat: [min, max]};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = random float min~max\n
    "},{"location":"config-data/#is-plain-object","title":"Is plain object","text":"
    var isPlainObject = Phaser.Utils.Objects.IsPlainObject(object);\n

    Plain object:

    • var obj = {};
    • var obj = new Object();
    "},{"location":"config-data/#merge-configuration","title":"Merge configuration","text":"
    var configOut = Phaser.Utils.Objects.Merge(configIn, defaultConfig);\n
    "},{"location":"container/","title":"Container","text":""},{"location":"container/#introduction","title":"Introduction","text":"

    Control the position and angle of children game objects, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"container/#usage","title":"Usage","text":""},{"location":"container/#container","title":"Container","text":""},{"location":"container/#add-container-object","title":"Add container object","text":"
    var container = scene.add.container(x, y);\n// var container = scene.add.container(x, y, children); // children: an array of game object\n
    "},{"location":"container/#custom-class","title":"Custom class","text":"
    • Define class
      class MyContainer extends Phaser.GameObjects.Container {\nconstructor(scene, x, y, children) {\nsuper(scene, x, y, children);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var container = new MyContainer(scene, x, y, children);\n
    "},{"location":"container/#destroy","title":"Destroy","text":"
    container.destroy();\n

    Also destroy all children game objects.

    "},{"location":"container/#set-properties","title":"Set properties","text":"

    Reference game object, to set position, angle, visible, alpha, etc...

    "},{"location":"container/#set-size","title":"Set size","text":"
    container.setSize(width, height);\n

    Default size is 0x0.

    "},{"location":"container/#set-scroll-factor","title":"Set scroll factor","text":"
    container.setScrollFactor(x, y);\n

    Apply this scrollFactor to all Container children.

    container.setScrollFactor(x, y, true);\n
    "},{"location":"container/#hit-area","title":"Hit area","text":"
    container.setInteractive(new Phaser.Geom.Circle(0, 0, radius), Phaser.Geom.Circle.Contains);\n// container.setInteractive(false); // disable\n

    Assign hit area with a circle shape.

    "},{"location":"container/#non-exclusive","title":"Non-exclusive","text":"
    container.setExclusive(false);\n

    Allows a game object added to container many times.

    "},{"location":"container/#children","title":"Children","text":""},{"location":"container/#add-child","title":"Add child","text":"
    container.add(child);  // child: a game object or an array of game objects\n
    container.addAt(child, index);\n
    "},{"location":"container/#exist","title":"Exist","text":"
    var hasChild = container.exists(child);\n
    "},{"location":"container/#get-child","title":"Get child","text":"
    var firstChild = container.first;\nvar nextChild = container.next;\nvar prevChild = container.previous;\nvar lastChild = container.last;\n
    var child = container.getByName(name);\n
    var child = container.getRandom(startIndex, length);\n
    var child = container.getFirst(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    var children = container.getAll(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    var amount = container.count(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    "},{"location":"container/#sort-children","title":"Sort children","text":"
    container.sort(property);\n
    container.sort(property, function(childA, childB){\nreturn 0; // 0, 1, -1\n});\n
    "},{"location":"container/#remove-child","title":"Remove child","text":"
    container.remove(child);\n// container.remove(child, true);  // remove child object and destroy it\n
    container.removeAt(index);\n// container.removeAt(index, true);  // remove child object and destroy it\n
    container.removeBetween(startIndex, endIndex);\n// container.removeBetween(startIndex, endIndex, true);  // remove children objects and destroy them\n
    container.removeAll();\n// container.removeAll(true);  // remove all children objects and destroy them\n

    Removing child from container without destroying will put back into scene's display list.

    "},{"location":"container/#order-of-child","title":"Order of child","text":"
    container.moveTo(child, index);\n
    container.bringToTop(child);\n
    container.sendToBack(child);\n
    container.moveUp(child);\n
    container.moveDown(child);\n
    container.moveAbove(child1, child2);  // Move child1 above child2\n
    container.moveBelow(child1, child2);  // Move child1 below child2\n
    container.swap(child1, child2);\n
    container.reverse();\n
    container.shuffle();\n
    "},{"location":"container/#replace-child","title":"Replace child","text":"
    container.replace(oldChild, newChild);\n// container.replace(oldChild, newChild, true);  // destroy oldChild\n
    "},{"location":"container/#set-properties_1","title":"Set properties","text":"
    container.setAll(property, value, startIndex, endIndex);\n
    "},{"location":"container/#for-each-child","title":"For each child","text":"
    • Iterate current children list
      container.iterate(callback);\n// container.iterate(callback, context);\n// container.iterate(callback, context, arg0, arg1, ...);\n
      • callback :
        function(child, arg0, arg1, ...) {\n\n}\n
    • Iterate a copy of current children list
      container.each(callback);\n// container.each(callback, context);\n// container.each(callback, context, arg0, arg1, ...);\n
      • callback :
        function(child, arg0, arg1, ...) {\n\n}\n
    "},{"location":"container/#get-world-position-rotation-scale","title":"Get world position, rotation, scale","text":"
    var matrix = child.getWorldTransformMatrix();\nvar x = matrix.tx;\nvar y = matrix.ty;\nvar rotation = matrix.rotation;\nvar scaleX = matrix.scaleX;\nvar scaleY = matrix.scaleY;\n
    "},{"location":"container/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"container/#create-mask","title":"Create mask","text":"
    var mask = container.createBitmapMask();\n

    See mask

    "},{"location":"container/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"container/#compare-with-group-object","title":"Compare with group object","text":"
    • Container and group objects are all have a children list.
    • Container has position, angle, alpha, visible, ...etc, but group does not have.
    • Container controls properties of children (position, angle, alpha, visible, ...etc), but group won't.
    • A game object could be added to many groups, but it only could be added to one container (exclusive mode).
    "},{"location":"containerlite-perspective/","title":"Perspective","text":""},{"location":"containerlite-perspective/#introduction","title":"Introduction","text":"

    Snapshot children of containerlite, to a perspective render texture.

    • Author: Rex
    • Behavior of containerlite
    "},{"location":"containerlite-perspective/#live-demos","title":"Live demos","text":"
    • Flip ui
    "},{"location":"containerlite-perspective/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"containerlite-perspective/#install-plugin","title":"Install plugin","text":""},{"location":"containerlite-perspective/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add perspective behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar perspective = scene.plugins.get('rexperspectiveimageplugin').addContainerPerspective(container, config);\n
    "},{"location":"containerlite-perspective/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add perspective behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar perspective = scene.plugins.get('rexPerspectiveImagePlugin').addContainerPerspective(container, config);\n
    "},{"location":"containerlite-perspective/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ContainerPerspective } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add perspective behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar perspective = new ContainerPerspective(container, config);\n
    "},{"location":"containerlite-perspective/#create-instance","title":"Create instance","text":"
    var perspective = scene.plugins.get('rexPerspectiveImagePlugin').addContainerPerspective(container, {\nuseParentBounds: false,\n// hideCCW: true,\n});\n
    • useParentBounds :
      • true : Use bounds of parent container
      • false : Union all visible children's bounds
    • hideCCW :
      • true : Hide backward facing Faces. Default behavior.
      • false : Show backward facing Faces
    "},{"location":"containerlite-perspective/#perspective-mode","title":"Perspective mode","text":""},{"location":"containerlite-perspective/#enter","title":"Enter","text":"
    perspective.enter();\n
    1. Snapshot current visible children into perspective render texture
    2. Set current visible children to invisible
    3. Set this perspective render texture to visible
    "},{"location":"containerlite-perspective/#exit","title":"Exit","text":"
    perspective.exit();\n
    1. Inverse visible of children and perspective render texture
    "},{"location":"containerlite-perspective/#is-in-perspective-mode","title":"Is in perspective mode","text":"
    var isInPerspectiveMode = perspective.perspectiveState;\n
    "},{"location":"containerlite-perspective/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleX = perspective.angleX; // Angle in degrees\nvar angleY = perspective.angleY; // Angle in degrees\nvar angleZ = perspective.angleZ; // Angle in degrees\n
      or
      var rotationX = perspective.rotationX; // Angle in radians\nvar rotationY = perspective.rotationY; // Angle in radians\nvar rotationZ = perspective.rotationZ; // Angle in radians\n
    • Set rotation angle
      perspective.angleX = angleX; // Angle in degrees\nperspective.angleY = angleY; // Angle in degrees\nperspective.angleZ = angleZ; // Angle in degrees\n
      or
      perspective.rotationX = rotationX; // Angle in radians\nperspective.rotationY = rotationY; // Angle in radians\nperspective.rotationZ = rotationZ; // Angle in radians\n
    "},{"location":"containerlite-perspective/#flip","title":"Flip","text":"
    scene.tweens.add({\ntargets: perspective,\nangleY: { start: 0, to: -180}\n})\n
    "},{"location":"containerlite-perspective/#other-properties","title":"Other properties","text":"

    See Perspective rendertexture game object.

    "},{"location":"containerlite-skew/","title":"Skew","text":""},{"location":"containerlite-skew/#introduction","title":"Introduction","text":"

    Snapshot children of containerlite, to a skew render texture.

    • Author: Rex
    • Behavior of containerlite
    "},{"location":"containerlite-skew/#live-demos","title":"Live demos","text":"
    • Skew ui
    "},{"location":"containerlite-skew/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"containerlite-skew/#install-plugin","title":"Install plugin","text":""},{"location":"containerlite-skew/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add skew behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar skew = scene.plugins.get('rexquadimageplugin').addContainerSkew(container, config);\n
    "},{"location":"containerlite-skew/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add skew behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar skew = scene.plugins.get('rexQuadImagePlugin').addContainerSkew(container, config);\n
    "},{"location":"containerlite-skew/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ContainerSkew } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add skew behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar skew = new ContainerSkew(container, config);\n
    "},{"location":"containerlite-skew/#create-instance","title":"Create instance","text":"
    var quad = scene.plugins.get('rexQuadImagePlugin').addContainerSkew(container, {\nuseParentBounds: false\n});\n
    • useParentBounds :
      • true : Use bounds of parent container
      • false : Union all visible children's bounds
    "},{"location":"containerlite-skew/#skew-mode","title":"Skew mode","text":""},{"location":"containerlite-skew/#enter","title":"Enter","text":"
    skew.enter();\n
    1. Snapshot current visible children into skew render texture
    2. Set current visible children to invisible
    3. Set this skew render texture to visible
    "},{"location":"containerlite-skew/#exit","title":"Exit","text":"
    skew.exit();\n
    1. Inverse visible of children and skew render texture
    "},{"location":"containerlite-skew/#is-in-skew-mode","title":"Is in skew mode","text":"
    var isInSkewMode = skew.skewState;\n
    "},{"location":"containerlite-skew/#skew","title":"Skew","text":"
    • Set
      image.setSkewX(skewXRad);\nimage.setSkewXDeg(skewXDeg);\n
      image.setSkewY(skewXRad);\nimage.setSkewYDeg(skewXDeg);\n
      image.setSkew(skewXRad, skewYRad);\nimage.setSkewDeg(skewXDeg, skewYDeg);\n
      image.skewX = skewXRad;\nimage.skewXDeg = skewXDeg;\n
      image.skewY = skewYRad;\nimage.skewYDeg = skewYDeg;\n
    • Get
      var skewXRad = image.skewX;\nvar skewXDeg = image.skewXDeg;\n
      var skewYRad = image.skewY;\nvar skewYDeg = image.skewYDeg;\n
    "},{"location":"containerlite-skew/#other-properties","title":"Other properties","text":"

    See Skew rendertexture game object.

    "},{"location":"containerlite/","title":"Container Lite","text":""},{"location":"containerlite/#introduction","title":"Introduction","text":"

    Control the position and angle of children game objects.

    It is inspired from Ziao/phaser3-interim-containers.

    • Author: Rex
    • Game object
    "},{"location":"containerlite/#live-demos","title":"Live demos","text":"
    • Rotate, alpha
    • Tween child
    • Create tween config
    • Mix timeline
    • Snapshot
    • Destroy:
      • Destroy containerLite
      • Destory scrollablePanel,
    • Add to p3-container
    "},{"location":"containerlite/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"containerlite/#install-plugin","title":"Install plugin","text":""},{"location":"containerlite/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcontainerliteplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcontainerliteplugin.min.js', true);\n
    • Add container object
      var container = scene.add.rexContainerLite(x, y);\n
    "},{"location":"containerlite/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ContainerLitePlugin from 'phaser3-rex-plugins/plugins/containerlite-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexContainerLitePlugin',\nplugin: ContainerLitePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add container object
      var container = scene.add.rexContainerLite(x, y);\n
    "},{"location":"containerlite/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ContainerLite from 'phaser3-rex-plugins/plugins/containerlite.js';\n
    • Add container object
      var container = new ContainerLite(scene, x, y);\nscene.add.existing(container);\n
    "},{"location":"containerlite/#add-container-object","title":"Add container object","text":"
    var container = scene.add.rexContainerLite(x, y);  // width = 1, height = 1\n// var container = scene.add.rexContainerLite(x, y, width, height);\n

    or

    var container = scene.add.rexContainerLite(x, y, children);  // width = 1, height = 1\n// var container = scene.add.rexContainerLite(x, y, width, height, children);\n

    Add container from JSON

    var container = scene.make.rexContainerLite({\nx: 0,\ny: 0,\nwidth: 1,\nheight: 1,\n\n// angle: 0,\n// alpha: 1,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n});\n
    "},{"location":"containerlite/#custom-class","title":"Custom class","text":"
    • Define class
      class MyContainer extends ContainerLite {\nconstructor(scene, x, y, width, height, children) {\nsuper(scene, x, y, width, height, children);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var container = new MyContainer(scene, x, y, width, height, children);\n
    "},{"location":"containerlite/#destroy","title":"Destroy","text":"
    container.destroy();\n

    Also destroy all children.

    "},{"location":"containerlite/#other-properties","title":"Other properties","text":"

    This container game object inherits from Zone.

    "},{"location":"containerlite/#add-child","title":"Add child","text":""},{"location":"containerlite/#pin","title":"Pin","text":"

    Add(pin) a game obejct to container

    container.add(child);  // child: a game object\n// container.pin(child);\n
    • child : A game object

    or

    container.pin(child, {\n// syncPosition: true,\n// syncRotation: true,\n// syncScale : true,\n// syncAlpha: true,\n// syncScrollFactor: true,\n// syncCameraFilter: true,\n// syncDisplayList: true\n});\n
    • child : A game object
    • syncPosition :
      • true : Sync position of child, default behavior.
      • false : Don't sync position of child.
    • syncRotation :
      • true : Sync angle of child, default behavior.
      • false : Don't sync angle of child.
    • syncScale :
      • true : Sync scale of child, default behavior.
      • false : Don't sync angle of child.
    • syncAlpha :
      • true : Sync alpha of child, default behavior.
      • false : Don't sync alpha of child.
    • syncScrollFactor :
      • true : Sync scrollFactor of child, default behavior.
      • false : Don't sync scrollFactor of child.
    • syncCameraFilter :
      • true : Sync cameraFilter of child, default behavior.
      • false : Don't sync cameraFilter of child.
    • syncDisplayList :
      • true : Put child into parent's displayList/Layer, default behavior.
        • Child has to belong to any displayList first.
      • false : Don't change child's displayList.

    Or add(pin) children

    container.addMultiple(children);\n// container.add(children);\n
    • children : An array of game objects

    These world properties of children will be changed with container.

    • Position/Angle/Scale
    • Visible
    • Alpha
    • Scroll factor
    • Mask

    Note

    • Position of child is the world position, i.e. position of child won't be changed when adding to container initially.
      • For example, container-lite is at (100, 100), and child is at (110, 110), then child will be placed at (110, 110) after adding to container-lite.
    • This behavior is different from official container, which using related position of child when adding to container.
      • For example, official container is at (100, 100), and child is at (10, 10), then child will be placed at (110, 110) after adding to official container.
    "},{"location":"containerlite/#add-local","title":"Add local","text":"
    container.addLocal(child);\n

    or

    container.addLocalMultiple(children);\n

    or

    container.pinLocal(child, {\n// syncPosition: true,\n// syncRotation: true,\n// syncScale : true,\n// syncAlpha: true,\n});\n

    Add child to container with related properties, like official container. For example, container-lite is at (100, 100), and child is at (10, 10), then child will be placed at (110, 110) after adding to container-lite.

    "},{"location":"containerlite/#remove-child","title":"Remove child","text":"
    • Remove(unpin) a child
      container.remove(child);\n// container.remove(child, destroyChild);\n
      or
      container.unpin(child);\n// container.unpin(child, destroyChild);\n
      • child : Game object
      • destroyChild : Set true to destroy child. Default is false.
    • Remove all children
      container.clear();\n// container.clear(destroyChild);\n
    "},{"location":"containerlite/#get-child","title":"Get child","text":"
    • Get first child by name
      var gameObject = container.getByName(name);\n// var gameObject = container.getByName(name, recursive);\n
      • gameObject : A child, or null if not found.
      • recursive : Set true to search all children recursively.
    • Get a random child
      var gameObject = container.getRandom();\n// var gameObject = container.getRandom(startIndex, length);\n
    • Get children in this container-lite
      • Internal children array
        var gameObjects = container.getChildren();\n
      • Copy of children array
        var gameObjects = container.getChildren([]);\n// var gameObjects = container.getChildren(out);\n
    • Get all children under this container-lite recursively
      var gameObjects = container.getAllChildren();\n
      • Put container itself and all children into Layer
        layer.add(container.getAllChildren([container]));\n
      • Draw on render texture
        rt.draw(container.getAllChildren());\n
      • Ignored in camera
        camera.ignore(container.getAllChildren());\n
    "},{"location":"containerlite/#traversal","title":"Traversal","text":"
    • Depth-First Search
      container.dfs(function(current) {\n// return true;  // Discard children traveraling\n})\n
      • Return true to discard children traveraling
    • Breadth-First Search
      container.bfs(function(current) {\n// return true;  // Discard children traveraling\n})\n
      • Return true to discard children traveraling
    "},{"location":"containerlite/#exist","title":"Exist","text":"

    Return true if child is under this container-lite (nested).

    var hasChild = container.contains(child);\n
    "},{"location":"containerlite/#children","title":"Children","text":"
    var children = container.children;\n
    • children : Array of child game objects.
    "},{"location":"containerlite/#get-parent","title":"Get parent","text":"
    var parentContainer = scene.plugins.get('rexContainerLitePlugin').getParent(child);\n

    or

    var parentContainer = Container.GetParent(child); // Static method\n
    "},{"location":"containerlite/#set-properties-of-child","title":"Set properties of child","text":""},{"location":"containerlite/#position","title":"Position","text":"
    container.setChildPosition(child, x, y);\n
    "},{"location":"containerlite/#rotation","title":"Rotation","text":"
    container.setChildRotation(child, rotation);\n
    • rotation : Angle in radians.
    "},{"location":"containerlite/#scale","title":"Scale","text":"
    container.setChildScale(child, scaleX, scaleY);\n

    or

    container.setChildDisplaySize(child, width, height);\n
    "},{"location":"containerlite/#visible","title":"Visible","text":"
    container.setChildVisible(child, visible);\n
    "},{"location":"containerlite/#alpha","title":"Alpha","text":"
    container.setChildAlpha(child, alpha);\n
    "},{"location":"containerlite/#local-state-of-child","title":"Local state of child","text":"

    Get local state

    var localState = container.getLocalState(child);\n

    or

    var localState = child.rexContainer;\n
    • Properties of localState
      • x, y
      • rotation
      • scaleX, scaleY
      • visible
      • alpha
    "},{"location":"containerlite/#change-local-state-of-child","title":"Change local state of child","text":"
    • Local position
      container.setChildLocalPosition(child, x, y);\n
    • Local scale
      container.setChildLocalScale(child, scaleX, scaleY);\n
    • Local alpha
      container.setChildLocalAlpha(child, alpha);\n
    • Local visible
      container.setChildLocalVisible(child, visible);\n
    "},{"location":"containerlite/#reset-local-state-of-child","title":"Reset local state of child","text":"

    Reset local state of child according to current properties of children

    • Reset local state of all properties
      container.resetChildState(child);\n
    • Reset local state of position
      container.resetChildPositionState(child);\n
    • Reset local state of rotation
      container.resetChildRotationState(child);\n
    • Reset local state of scale
      container.resetChildScaleState(child);\n
    • Reset local state of alpha
      container.resetChildAlphaState(child);\n
    • Reset local state of visible
      container.resetChildVisibleState(child);\n
    • Reset local state of active
      container.resetChildActiveState(child);\n
    "},{"location":"containerlite/#tween-local-state","title":"Tween local state","text":"
    var tweenObj = container.tweenChild({\ntargets: child,\n// x: '+=100',\n// y: '+=100',\n// repeat: -1,\n// yoyo: true\n})\n
    • targets : A game object, or an array of game object.
      • A containerLite child, can tween its local state.

    Paramters of configuration is the same as tween task.

    Supported properties :

    • x, y,
    • angle, rotation
    • scaleX, scaleY, displayWidth, displayHeight
    • alpha
    "},{"location":"containerlite/#tween-local-state-of-a-containerlite-child","title":"Tween local state of a containerlite child","text":"
    var tweenObj = containerLiteChild.tweenSelf({    // x: '+=100',\n// y: '+=100',\n// repeat: -1,\n// yoyo: true\n})\n

    Equal to

    containerLiteChild.tweenChild({\ntargets: containerLiteChild,\n// x: '+=100',\n// y: '+=100',\n// repeat: -1,\n// yoyo: true\n})\n
    "},{"location":"containerlite/#create-tween-config","title":"Create tween config","text":"
    var tweenConfig = container.createTweenChildConfig({\ntargets: child,\n// x: '+=100',\n// y: '+=100',\n// repeat: -1,\n// yoyo: true\n});\nscene.tweens.add(tweenConfig);\n
    • Input of targets is/are game object(s), will be replaced by local state of game object(S)
    • Wrap onUpdate callback, to update properties of child according to local state.
    "},{"location":"containerlite/#depth","title":"Depth","text":"
    • Get depth of container
      var depth = container.depth;\n
    • Set depth of container
      container.setDepth(value, true);\n// container.depth = depth;\n
    • Set depth of container and all children
      container.setDepth(value);\n
    • Bring this container and its children to top
      container.bringMeToTop();\n// container.bringToTop();\n
    • Send this container and its children to back
      container.sendMeToBack();\n// container.sendToBack();\n
    • Swap depth with another container
      containerA.swapDepth(containerB);\n
    • Increase of container and all children
      container.incDepth(value);\n
    • Move game object below this container and all children
      container.moveMyDepthBelow(gameObject);\n// container.moveDepthBelow(gameObject);\n
    • Move game object above this container and all children
      container.moveMyDepthAbove(gameObject);\n// container.moveDepthAbove(gameObject);\n
    • Bring a child of container to top of this container
      container.bringChildToTop(gameObject);\n
    • Send a child of container to bottom of this container
      container.sendChildToBack(gameObject);\n
    "},{"location":"containerlite/#render-layer","title":"Render layer","text":"

    A containerLite can have a layer. Current children and new children will draw on this layer, instead of display list of scene.

    • Enable layer. Do nothing if layer is existed.
      container.enableLayer();\n
    • Get layer game object. Will enable layer if layer is not existed.
      var layer = container.getLayer();\n
    • Get layer game object, without enable layer.
      var layer = container.privateRenderLayer;\n
    • Has layer game object
      var hasLayer = container.hasLayer();\n
    "},{"location":"containerlite/#mask","title":"Mask","text":"
    • Assign mask object to children
      container.setMask(mask);  // container.mask = mask;\n
    • Remove mask object of children
      container.clearMask();\n
    • Remove mask object of children, and destroy mask object
      container.clearMask(true);\n
    "},{"location":"containerlite/#shader-effects","title":"Shader effects","text":"

    Apply post-fx pipeline on layer of containerLite.

    "},{"location":"containerlite/#snapshot","title":"Snapshot","text":"
    • Draw all visible children on a render-texture.
      var renderTexture = container.snapshot({\nrenderTexture: undefined,\npadding: 0\n});\n
      • renderTexture : Draw on this render-texture
        • undefined : Create a new render-texture
      • padding :
        • 0 : No extra padding space. Default value.
        • A number : Add extra padding space around this render-texture.
    • Draw all visible children on a dynamic-texture
      container.snapshot({\npadding: 0,\nsaveTexture: textureKey\n});\n
      • saveTexture : Save render result to texture manager.
    "},{"location":"containerlite/#draw-bounds","title":"Draw bounds","text":"
    • Draw bounds of shown game object on a graphics game object
      container.drawBounds(graphics);\n// container.drawBounds(graphics, color);\n
      or
      container.drawBounds(graphics, {\n// color: 0xffffff,\n// lineWidth: 1,\n// padding: 0,\n// drawContainer: true,\n// children: undefined,\n});\n
      • graphics : Graphics game object
      • color : Default value is 0xffffff.
      • lineWidth : Default value is 1.
      • padding : Extra space around bounds. Default value is 0.
      • drawContainer :
        • true : Draw all children game objects included containerLite. Default behavior.
        • false : Draw all children game objects excluded containerLite
      • children :
        • Array of game objects : Only draw bounds of these children
        • undefined : Draw bounds of all children
    "},{"location":"containerlite/#scroll-factor","title":"Scroll factor","text":"
    • Set scroll factor to children
      container.setScrollFactor(x, y);\n
    "},{"location":"containerlite/#change-origin","title":"Change origin","text":"
    container.changeOrigin(originX, originY);\n

    This method also will reset all local state of children.

    "},{"location":"containerlite/#add-to-container","title":"Add to container","text":"
    • Add to built-in container
      containerLite.addToContainer(p3Container);\n
      or
      p3Container.add(containerLite);\n
      • p3Container : Container game object.
    • Add to Layer
      container.addToLayer(layer);\n
      • layer : Layer game object.
    "},{"location":"containerlite/#remove-from-container","title":"Remove from container","text":"
    • Remove from built-in container
      containerLite.removeFromContainer(p3Container);\n
      or
      p3Container.remove(containerLite);\n
      • p3Container : Container game object.
    • Remove from Layer
      container.removeFromLayer(layer);\n
      • layer : Layer game object.
    "},{"location":"containerlite/#other-properties_1","title":"Other properties","text":"

    See game object

    "},{"location":"containerlite/#compare-with-official-container","title":"Compare with Official Container","text":"
    • Position/anlge/scale of a child object :
      • Container : Local position/anlge/scale, responding to parent container, not a world position/anlge/scale.
      • Container-Lite : World position/anlge/scale.
    • Updating period
      • Container : Re-calculate position/anlge/scale of each child every render.
      • Container-Lite: Re-calculate position/anlge/scale of each child when parent container changes position/anlge/scale.
    • Mask
      • Container : It has mask property, and it could become a mask object.
      • Container-Lite : It has mask property, but it could not become a mask object.
    • DOM game object
      • Container : Only 1 level parent container will affect DOM game object. Therefore position of DOM game object in nested container might be incorrect.
      • Container-Lite : DOM game object can work with nested Container-Lite.
    "},{"location":"create-number-array/","title":"Number array","text":""},{"location":"create-number-array/#introduction","title":"Introduction","text":"

    Create an array representing the range of numbers, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"create-number-array/#usage","title":"Usage","text":""},{"location":"create-number-array/#create-number-array","title":"Create number array","text":"

    Create an array representing the range of numbers (usually integers), between, and inclusive of, the given start and end arguments.

    var arr = Phaser.Utils.Array.NumberArray(start, end);\n

    For example,

    var arr = Phaser.Utils.Array.NumberArray(2, 4);\n// arr = [2, 3, 4]\n

    "},{"location":"create-number-array/#create-number-array-with-step","title":"Create number array with step","text":"

    Create an array of numbers (positive and/or negative) progressing from start up to but not including end by advancing by step.

    var arr = Phaser.Utils.Array.NumberArray(start, end, step);\n

    For example,

    var arr = Phaser.Utils.Array.NumberArrayStep(0, 20, 5);\n// arr =  [0, 5, 10, 15]\n

    "},{"location":"create-number-array/#create-prefix-number-suffix-string-array","title":"Create prefix-number-suffix string array","text":"
    var arr = Phaser.Utils.Array.NumberArray(start, end, prefix, suffix);\n

    For example,

    var arr = Phaser.Utils.Array.NumberArray(5, 7, 'HD-', '.png');\n// arr = ['HD-5.png', 'HD-6.png', 'HD-7.png']\n

    "},{"location":"csvscenario/","title":"CSV scenario","text":""},{"location":"csvscenario/#introduction","title":"Introduction","text":"

    Run script in csv format. Csv could be edited by excel or google document.

    • Author: Rex
    • Member of scene
    "},{"location":"csvscenario/#live-demos","title":"Live demos","text":"
    • CSV-scenario
    • With TextPlayer
    "},{"location":"csvscenario/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"csvscenario/#install-plugin","title":"Install plugin","text":""},{"location":"csvscenario/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcsvscenarioplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcsvscenarioplugin.min.js', true);\n
    • Add csv-scenario object
      var scenario = scene.plugins.get('rexcsvscenarioplugin').add(scene);\n
    "},{"location":"csvscenario/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CsvScenarioPlugin from 'phaser3-rex-plugins/plugins/csvscenario-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCsvScenario',\nplugin: CsvScenarioPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add csv-scenario object
      var scenario = scene.plugins.get('rexCsvScenario').add(scene);\n
    "},{"location":"csvscenario/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CsvScenario from 'phaser3-rex-plugins/plugins/csvscenario.js';\n
    • Add csv-scenario object
      var scenario = new CsvScenario(scene);\n
    "},{"location":"csvscenario/#create-instance","title":"Create instance","text":"
    var scenario = scene.plugins.get('rexCSVScenario').add(scene, {\n// timeUnit: 0,        // 'ms'|0|'s'|'sec'|1\n// prefix: /^#([a-zA-Z]+)/\n// argsConvert: true,\n// argsConvertScope: undefined,\n// delimiter: ','\n// translateCommandNameCallback: undefined,\n});\n
    • csvString : Commands in csv-string.
    • scope : Running commands via methods in this scope object.
      • Get scope : var scope = scenario.scope
    • timeUnit: time-unit of dt, for delay-execution
      • 'ms', or 0 : dt in millisecond
      • 's', 'sec', or 1 : dt in second
    • prefix: regex of picking control instructions
    • argsConvert: A callback to convert parameters of run-custom-function
      • true : Use defaule value converter. Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string.
      • Function object:
        function(s) {\nreturn s;\n}\n
    • argsConvertScope: scope of argsConvert
    • delimiter : Delimiter of CSV string.
    • translateCommandNameCallback : Callback to translate custom command name
      • undefined : Use original custom command name. Default behavior.
      • A function, return new custom command name.
        function(commandName) {\nreturn newCommandName;\n}\n
    "},{"location":"csvscenario/#load-csv-script","title":"Load csv script","text":"
    scenario.load(csvString, scope, {\n// timeUnit: 0,        // 'ms'|0|'s'|'sec'|1\n// prefix: /^#([a-zA-Z]+)/\n// argsConvert: true,\n// argsConvertScope: undefined,\n// delimiter: ',',\n// translateCommandNameCallback: undefined,\n})\n
    • csvString : Commands in csv-string.
    • scope : Running commands via methods in this scope object.
      • Get scope : var scope = scenario.scope
    • timeUnit: time-unit of dt, for delay-execution
      • 'ms', or 0 : dt in millisecond
      • 's', 'sec', or 1 : dt in second
    • prefix: regex of picking control instructions
    • argsConvert: A callback to convert parameters of run-custom-function
      • true : Use defaule value converter. Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string.
      • Function object:
        function(s) {\nreturn s;\n}\n
    • argsConvertScope: scope of argsConvert
    • delimiter : Delimiter of CSV string.
    "},{"location":"csvscenario/#append-csv-script","title":"Append csv script","text":"
    scenario.append(csvString);\n
    "},{"location":"csvscenario/#start-running-instructions","title":"Start running instructions","text":"

    scenario.start({\n// label: '',\n// offset: 0\n})\n
    scenario.play({\n// label: '',\n// offset: 0\n})\n

    • label : Go to the label and execute. '' label is starting from 1st instruction
    • offset : Offset time

    or

    scenario.playPromise({\n// label: '',\n// offset: 0\n})\n.then(function(){\n// On complete\n})\n
    "},{"location":"csvscenario/#events","title":"Events","text":"
    • Complete
      scenario.on('complete', function(scope, scenario){ });\n
    • Wait event
      scenario.on('wait.' + eventName, function(scenario){ });\n
      scenario.on('wait', function(eventName, scenario){ });\n
    • Label has changed
      scenario.on('labelchange', function(lastLabel, prevLabel, scope, scenario){ });\n
    • Dump execution log
      scenario.on('log', function(msg, scope, scenario){ });\n
    • Notify error
      scenario.on('error', function(msg, scope, scenario){ });\n
    "},{"location":"csvscenario/#types-of-instructions","title":"Types of instructions","text":"

    Each row in csv table is an instruction.

    "},{"location":"csvscenario/#run-custom-function","title":"Run custom function","text":"

    Run custom function of scope, which passed from scenario.load(...)

    Format:

    -,fnName,param0,param1,...\n
    • 1st column of instruction: -
    • Parameters will be converted to number, boolean, null, or string by default.
    • Method name of last custom command :
      var methodName = scenario.lastCustomCommandName;\n
    • An error event will be fired if fnName is invalid in scope.
    "},{"location":"csvscenario/#delay-execution","title":"Delay execution","text":"

    Run custom function after a delay.

    Format:

    time,fnName,param0,param1,...\n
    • 1st column of instruction: a number
    • time-unit of delay is set from scenario.load(...)
    • Parameters will be converted to number, boolean, null, or string by default.
    "},{"location":"csvscenario/#wait-then-execution","title":"Wait then execution","text":"

    Run custom function until scenario.continue(eventName)

    Format:

    eventName,fnName,param0,param1,...\n
    • 1st column of instruction: not a number, not a string start from #
    • Execution will be hang until scenario.continue(eventName) is called
    • Parameters will be converted to number, boolean, null, or string by default.
    "},{"location":"csvscenario/#skip-waiting","title":"Skip waiting","text":"
    scenario.continue(true);\n
    "},{"location":"csvscenario/#task","title":"Task","text":"

    Sample code

    Scenario will be paused if custom function return an event emitter, resumed when that evnt emitter fires complete event.

    See also: Sequence

    "},{"location":"csvscenario/#label","title":"Label","text":"

    Sample code

    A label for #GOTO or #IF instructions.

    Format:

    #LABEL,label\n
    • 1st column of instruction: #LABEL, case insensitive.
    • Label '' is reserved, don't use '' for label name.

    Example: A label named 'AA'

    #LABEL,AA\n
    • Last label :
      var label = scenario.lastLabel;\n
    • Previous label :
      var previousLabel = scenario.previousLabel;\n
    "},{"location":"csvscenario/#exit","title":"Exit","text":"

    Exit current execution.

    Format:

    #EXIT\n
    • 1st column of instruction: #EXIT, case insensitive.
    "},{"location":"csvscenario/#goto","title":"Goto","text":"

    Sample code

    Go to label and execute.

    Format:

    #GOTO,label\n
    • 1st column of instruction: #GOTO, case insensitive.
    • An error event will be fired if label is not found.

    Example: Goto label 'AA'

    #GOTO,AA\n
    "},{"location":"csvscenario/#if-goto","title":"If-goto","text":"

    Sample code

    Go to trueLabel if condition is true, otherwise go to falseLabel.

    Format:

    #IF,condition,trueLabel,falseLabel\n
    • 1st column of instruction: #IF, case insensitive.
    • conditon: boolean equation
      • this is the scope passed from scenario.load(...)
    • trueLabel/falseLabel: go to this label if condition is true/false
      • run next instruction if label is ''
      • An error event will be fired if label is not found.

    Example: Goto label 'AA' if (this.coin > 100), else run next instruction

    #IF,this.coin > 100,AA\n
    "},{"location":"csvscenario/#wait","title":"Wait","text":"

    Run next instruction after a delay time, or scenario.continue(eventName).

    Format:

    #WAIT,time\n
    #WAIT,eventName\n
    • 1st column of instruction: #WAIT, case insensitive.
    • 2nd colume of instruction:
      • a number: a delay time
        • time-unit of delay is set from scenario.load(...)
      • a string: an event name for scenario.continue(eventName)

    Example:

    • Wait 1 time-unit
      #WAIT,1\n
    • Wait until 'click'
      #WAIT,click\n
      scenario.continue('click');\n
    "},{"location":"csvscenario/#pause","title":"Pause","text":"
    scenario.pause();\n
    "},{"location":"csvscenario/#resume","title":"Resume","text":"
    scenario.resume();\n
    "},{"location":"csvscenario/#time-scale","title":"Time-scale","text":"
    • Get
      var timeScale = scenario.timeScale;\n
    • Set
      scenario.setTimeScale(timeScale);\n// scenario.timeScale = timeScale;\n
    "},{"location":"csvscenario/#clear","title":"Clear","text":"

    Stop running and clear instructions.

    scenario.clear();\n
    "},{"location":"csvscenario/#states","title":"States","text":"
    • Is running
      var isRunning = scenario.isRunning;\n
    • Is paused
      var isPaused = scenario.isPaused;\n
    "},{"location":"csvtoarray/","title":"CSV to array","text":""},{"location":"csvtoarray/#introduction","title":"Introduction","text":"

    Generate array from csv string.

    • Reference: Papa Parse
    • Method only
    "},{"location":"csvtoarray/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"csvtoarray/#import-class","title":"Import class","text":"
    import rexCSVToArray from './plugins/csvtoarray.js';\n
    "},{"location":"csvtoarray/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CSVToArrayPlugin from 'phaser3-rex-plugins/plugins/csvtoarray-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCSVToArray',\nplugin: CSVToArrayPlugin,\nstart: true\n}\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Convert csv
      var arr = scene.plugins.get('rexCSVToArray').convert(csvString, config);\n
    "},{"location":"csvtoarray/#convert-csv","title":"Convert csv","text":"
    var arr = scene.plugins.get('rexCSVToArray').convert(csvString, {\n// delimiter: ',',\n// convert: true\n});\n

    Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string, if convert is true.

    "},{"location":"csvtohashtable/","title":"CSV to hash table","text":""},{"location":"csvtohashtable/#introduction","title":"Introduction","text":"

    Hash table indexed by (col-key, row-key) from csv string.

    • Author: Rex
    • Member of scene
    "},{"location":"csvtohashtable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"csvtohashtable/#install-plugin","title":"Install plugin","text":""},{"location":"csvtohashtable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcsvtohashtableplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcsvtohashtableplugin.min.js', true);\n
    • Add hash-table object
      var table = scene.plugins.get('rexcsvtohashtableplugin').add();\n
    "},{"location":"csvtohashtable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CsvToHashTablePlugin from 'phaser3-rex-plugins/plugins/csvtohashtable-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCsvToHashTable',\nplugin: CsvToHashTablePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add hash-table object
      var table = scene.plugins.get('rexCsvToHashTable').add();\n
    "},{"location":"csvtohashtable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CsvToHashTable from 'phaser3-rex-plugins/plugins/csvtohashtable.js';\n
    • Add hash-table object
      var table = new CsvToHashTable();\n
    "},{"location":"csvtohashtable/#create-instance","title":"Create instance","text":"
    var table = scene.plugins.get('rexCsvToHashTable').add();\n
    "},{"location":"csvtohashtable/#append-rows-from-csv-string","title":"Append rows from csv string","text":"
    table.loadCSV(csvString, {\n// delimiter: ',',\n// convert: true\n// convertScope: undefined\n});\n

    For exameple, csv string

    name hp mp Rex 100 20 Alice 300 40
    name,hp,mp\nRex,100,20\nAlice,300,40\n

    will be converted to

    {\n\"Alice\": {\n\"name\": \"Alice\",\n\"hp\": 300,\n\"mp\": 40\n},\n\"Rex\": {\n\"name\": \"Rex\",\n\"hp\": 100,\n\"mp\": 20\n}\n}\n

    Then get value by

    var value = table.get('Rex', 'hp');\n
    "},{"location":"csvtohashtable/#convert-value-type","title":"Convert value type","text":"

    Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string, if convert is true, or assign your convert function by convert and convertScope when loading table (table.loadCSV(...)).

    var convertCallback = function(table, rowKey, colKey, value) {\n// value = ...\nreturn value;\n};\n

    Or uses these metheds to convert columns or rows.

    • convert values in column
      table.convertCol(colKey);  // colKey: a colKey, or an array of colKeys\n// table.convertCol(colKey, convertCallback, convertCallbackScope);\n
    • convert values in row
      table.convertRow(rowKey);  // rowKey: a rowKey, or an array of rowKeys\n// table.convertRow(rowKey, convertCallback, convertCallbackScope);\n
    "},{"location":"csvtohashtable/#get-value","title":"Get value","text":"
    var val = table.get(rowKey, colKey);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#set-value","title":"Set value","text":"
    table.set(rowKey, colKey, value);\n
    table.add(rowKey, colKey, value);\n// equal to table.set(rowKey, colKey, table.get(rowKey, colKey) + value);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#has-columnrow-key","title":"Has column/row key","text":"
    var hasRow = table.hasRowKey(rowKey);\n
    var hasCol = table.hasColKey(colKey);\n
    var hasCell = table.hasKey(rowKey, colKey);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#value-in-column-or-row","title":"Value in column or row","text":"
    var existed = table.isValueInRol(rowKey, value);\n
    var existed = table.isValueInCol(colKey, value);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#create-table","title":"Create table","text":""},{"location":"csvtohashtable/#clear-table","title":"Clear table","text":"
    table.clear();\n
    "},{"location":"csvtohashtable/#append-a-column","title":"Append a column","text":"
    table.appendCol(colKey, initValue);\n// table.appendCol(colKey, callback, scope);  // get initValue from callback\n

    Callback

    var callback = function (table, rowKey, colKey) { // value = ...\nreturn value;\n};\n
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#append-a-row","title":"Append a row","text":"
    table.appendRow(rowKey, initValue);\n// table.appendRow(rowKey, callback, scope);  // get initValue from callback\n

    Callback

    var callback = function (table, rowKey, colKey) { // value = ...\nreturn value;\n};\n
    • rowKey : Row key string, or row index number.
    "},{"location":"csvtohashtable/#remove-a-column","title":"Remove a column","text":"
    table.removeCol(colKey);\n
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#remove-a-row","title":"Remove a row","text":"
    table.removeRol(rowKey);\n
    • rowKey : Row key string, or row index number.
    "},{"location":"csvtohashtable/#sort-column-or-row","title":"Sort column or row","text":"
    table.sortCol(colKey, mode);\n// table.sortCol(callback, scope);  // sort columns by callback\n
    table.sortRow(rowKey, mode);\n// table.sortRow(callback, scope);  // sort rows by callback\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.

    Mode:

    • 'ascending', or 0
    • 'descending', or 1
    • 'logical ascending', or 2
    • 'logical descending', or 3

    Sorting callback

    var callback = function(rowKeyA, rowKeyB) {\nreturn result; // 1, -1, or 0\n};\n
    "},{"location":"csvtohashtable/#retrieve-columns-or-rows","title":"Retrieve columns or rows","text":"
    table.eachCol(rowKey, callback, scope);\n
    table.eachRow(colKey, callback, scope);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.

    Callback

    var callback = function(table, rowKey, colKey, value) {\n// ...\n};\n
    "},{"location":"csvtohashtable/#json","title":"JSON","text":"
    • Table to json
      var jsonData = table.toJSON();\n
    • Reset table by JSON
      table.resetFromJSON(jsonData);\n
    "},{"location":"cursor/","title":"Cursor","text":""},{"location":"cursor/#introduction","title":"Introduction","text":"

    Custom cursor, built-in feature of phaser.

    • Author: Richard Davey
    "},{"location":"cursor/#usage","title":"Usage","text":"

    References:

    • Cursor
    • Using URL values for the cursor property
    "},{"location":"cursor/#set-default-cursor","title":"Set default cursor","text":"
    scene.input.setDefaultCursor(CSSString);\n// CSSString: 'url(assets/input/cursors/sword.cur), pointer'\n
    "},{"location":"cursor/#set-cursor-of-a-game-object","title":"Set cursor of a Game Object","text":"

    Change cursor image when cursor is over that Game Object.

    gameObject.setInteractive({\ncursor: CSSString\n});\n// CSSString: 'url(assets/input/cursors/sword.cur), pointer'\n

    Set cursor image directly after gameObject.setInteractive().

    gameObject.input.cursor = CSSString;\n// CSSString: 'url(assets/input/cursors/sword.cur), pointer'\n

    Use pointer (hand cursor).

    gameObject.setInteractive({\nuseHandCursor: true\n});\n
    "},{"location":"cursor/#change-current-cursor","title":"Change current cursor","text":"
    scene.input.canvas.style.cursor = cursor;\n
    • cursor : CSSString

    or

    scene.input.setCursor(gameObject.input);\n
    "},{"location":"cursor/#reset-to-default-cursor","title":"Reset to default cursor","text":"
    scene.input.resetCursor(null, true);\n
    "},{"location":"cursoratbounds/","title":"Cursor at bounds","text":""},{"location":"cursoratbounds/#introduction","title":"Introduction","text":"

    Map cursor-at-(left/right/top/botttom-)bound to (left/right/up/down) cursor key state.

    • Author: Rex
    • Member of scene
    "},{"location":"cursoratbounds/#live-demos","title":"Live demos","text":"
    • Custom bounds
    • Camera scrolling
    "},{"location":"cursoratbounds/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"cursoratbounds/#install-plugin","title":"Install plugin","text":""},{"location":"cursoratbounds/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcursoratboundsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcursoratboundsplugin.min.js', true);\n
    • Add cursor-at-bound object
      var cursorAtBound = scene.plugins.get('rexcursoratboundsplugin').add(scene, config);\n
    "},{"location":"cursoratbounds/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CursorAtBoundsPlugin from 'phaser3-rex-plugins/plugins/cursoratboundss-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCursorAtBounds',\nplugin: CursorAtBoundsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add cursor-at-bound object
      var cursorAtBound = scene.plugins.get('rexCursorAtBounds').add(scene, config);\n
    "},{"location":"cursoratbounds/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CursorAtBounds from 'phaser3-rex-plugins/plugins/cursoratboundss.js';\n
    • Add cursor-at-bound object
      var cursorAtBound = new CursorAtBounds(scene, config);\n
    "},{"location":"cursoratbounds/#create-instance","title":"Create instance","text":"
    var cursorAtBound = scene.plugins.get('rexCursorAtBounds').add(scene, {\n// enable: true,\n// bounds: undefined,\n// sensitiveDistance: 20,\n// pointerOutGameRelease: true,\n// pointerOutBoundsRelease: false,\n});\n
    • bounds : A rectangle object for detecting the position of cursor.
      • undefined : Current viewport. Will update bounds when window resizing.
    • sensitiveDistance : A sensitive distance in pixels.
    • pointerOutGameRelease :
      • true : All cursor keys are released when pointer is out of game window. Default behavior.
      • false : Don't change status of cursor keys when pointer is out of game window.
    • pointerOutBoundsRelease
      • true : All cursor keys are released when pointer is out of bounds.
      • false : Continue cursor key detection when pointer is out of bounds. Default behavior.

    Map position of cursor to state of cursor key

    • left cursor key is pressed :
      • Position x is between left bound and left bound + sensitive distance
      • Position x at left side of left bound, if pointerOutBoundsRelease is false
    • Right cursor key is pressed :
      • Position x is between right bound and right bound - sensitive distance
      • Position x at right side of right bound, if pointerOutBoundsRelease is false
    • Up cursor key is pressed :
      • Position y is between top bound and top bound + sensitive distance
      • Position y at up side of top bound, if pointerOutBoundsRelease is false
    • Down cursor key is pressed :
      • Position y is between bottom bound and bottom bound - sensitive distance
      • Position y at down side of bottom bound, if pointerOutBoundsRelease is false
    "},{"location":"cursoratbounds/#state-of-cursor-keys","title":"State of cursor keys","text":"
    var cursorKeys = cursorAtBound.createCursorKeys();\n\nvar leftKeyDown = cursorKeys.left.isDown;\nvar rightKeyDown = cursorKeys.right.isDown;\nvar upKeyDown = cursorKeys.up.isDown;\nvar downKeyDown = cursorKeys.down.isDown;\n

    Or

    var leftKeyDown = cursorAtBound.left;\nvar rightKeyDown = cursorAtBound.right;\nvar upKeyDown = cursorAtBound.up;\nvar downKeyDown = cursorAtBound.down;\nvar noKeyDown = cursorAtBound.noKey;\n
    "},{"location":"cursoratbounds/#destroy","title":"Destroy","text":"
    cursorAtBound.destroy();\n
    "},{"location":"cursoratbounds/#enable","title":"Enable","text":"
    • Get
      var enable = joystick.enable;\n
    • Set
      joystick.setEnable(enable);  // enable: true, or false\n//joystick.enable = enable;\n
    • Toggle
      joystick.toggleEnable();\n
    "},{"location":"cursoratbounds/#bounds","title":"Bounds","text":"
    • Get
      var bounds = cursorAtBound.bounds;\n
      • bounds : A rectangle object
    • Set
      cursorAtBound.setBounds(bounds);\n
      or
      cursorAtBound.bounds = bounds;;\n
      • bounds : A rectangle object
    "},{"location":"cursoratbounds/#sensitive-distance","title":"Sensitive distance","text":"
    • Get
      var distance = cursorAtBound.sensitiveDistance;\n
    • Set
      cursorAtBound.setSensitiveDistance(distance);\n
      or
      cursorAtBound.sensitiveDistance = distance;\n
    "},{"location":"curve-spiral/","title":"Spiral curve","text":""},{"location":"curve-spiral/#introduction","title":"Introduction","text":"

    Spiral curve.

    • Author: Rex
    • Curve object
    "},{"location":"curve-spiral/#live-demos","title":"Live demos","text":"
    • Spiral curve
    • Particles along spiral curve
    "},{"location":"curve-spiral/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"curve-spiral/#install-plugin","title":"Install plugin","text":""},{"location":"curve-spiral/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexspiralcurveplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexspiralcurveplugin.min.js', true);\n
    • Add spiral curve object
      var spiral = scene.plugins.get('rexspiralcurveplugin').add(config);\n
    "},{"location":"curve-spiral/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SpiralCurvePlugin from 'phaser3-rex-plugins/plugins/spiralcurve-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSpiralCurve',\nplugin: SpiralCurvePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add spiral curve object
      var spiral = scene.plugins.get('rexSpiralCurve').add(config);\n
    "},{"location":"curve-spiral/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import SpiralCurve from 'phaser3-rex-plugins/plugins/spiralcurve.js';\n
    • Add spiral curve object
      var spiral = new SpiralCurve(config);\n
    "},{"location":"curve-spiral/#create-shape","title":"Create shape","text":"
    • All properties
      var spiral = scene.plugins.get('rexSpiralCurve').add({\n// Origin point\n// Ease origin point\n// startX:0, endX: 0, easeX: 'Linear',\n// startY:0, endY: 0, easeY: 'Linear',\n// Fixed point\n// x, y,\n\n// x-radius\n// startXRadius: 0, endXRadius, easeXRadius: 'Linear',\n// y-radius\n// startYRadius: 0, endYRadius, easeYRadius: 'Linear',\n// start-end radius\n// startRadius, endRadiux\n\n// angle\n// startAngle: 0, endAngle: 360, easeAngle: 'Linear',\n\n// rotation: 0\n});\n
      • Origin point
        • startX, endX, easeX, startY, endY, easeY : Ease origin point.
          • easeX, easeY : Ease equation, default value is 'Linear'.
        • x, y : Fixed origin point, i.e. start point is equal to end point.
      • Radius
        • startXRadius, endXRadius, easeXRadius : Ease x-radius.
          • easeXRadius : Ease equation, default value is 'Linear'.
        • startYRadius, endYRadius, easeYRadius : Ease y-radius.
          • easeYRadius : Ease equation, default value is 'Linear'.
        • startRadius, endRadiux :
          • Set startXRadius, and startYRadius to startRadius.
          • Set endXRadius, and endYRadius to endRadius.
      • Angle
        • startAngle, endAngle, easeAngle : Ease angle, in degrees.
          • easeAngle : Ease equation, default value is 'Linear'.
      • rotation : Rotate curve.
    • Simple spiral curve
      var spiral = scene.plugins.get('rexSpiralCurve').add(x, y, startRadius, endRadius, startAngle, endAngle, rotation);\n
      • x : Set startX, endX to x, and easeX to 'Linear'.
      • y : Set startY, endY to y, and easeY to 'Linear'.
      • startRadius : Set startXRadius, startYRadius to startRadius
      • endRadius : Set endXRadius, endYRadius to endRadius, and easeXRadius, easeYRadius to Linear.
      • Set easeAngle to 'Linear'
    "},{"location":"curve-spiral/#properties","title":"Properties","text":"
    • Origin point
      • Get
        var startX = spiral.startX;\nvar startY = spiral.startY;\nvar endX = spiral.endX;\nvar endY = spiral.endY;\n
        or
        var startPoint = spiral.p0; // {x, y}\nvar endPoint = spiral.p1; // {x, y}\n
      • Set
        spiral.setStartX(x);\nspiral.setStartY(y);\nspiral.setEndX(x);\nspiral.setEndY(y);\n
        or
        spiral.startX = x;\nspiral.startY = y;\nspiral.endX = x;\nspiral.endY = y;\n
    • Radius
      • Get
        var startXRadius = spiral.startXRadius;\nvar startYRadius = spiral.startYRadius;\nvar endXRadius = spiral.endXRadius;\nvar endYRadius = spiral.endYRadius;\n
      • Set
        spiral.setStartXRadius(startXRadius);\nspiral.setStartYRadius(startYRadius);\nspiral.setEndXRadius(endXRadius);\nspiral.setEndYRadius(endYRadius);\n
        or
        spiral.startXRadius = startXRadius;\nspiral.startYRadius = startYRadius;\nspiral.endXRadius = endXRadius;\nspiral.endYRadius = endYRadius;\n
    • Angle, in degrees.
      • Get
        var startAnlge = spiral.startAngle;\nvar endAnlge = spiral.endAngle;\n
      • Set
        spiral.setStartAngle(startAnlge);\nspiral.setEndAngle(endAnlge);\n
        spiral.startAngle = startAnlge;\nspiral.endAngle = endAnlge;\n
    "},{"location":"curve-spiral/#other-methods","title":"Other methods","text":"

    See path

    "},{"location":"cutjigsawimage/","title":"Cut Jigsaw Image","text":""},{"location":"cutjigsawimage/#introduction","title":"Introduction","text":"

    Cut image into pieces for jigsaw application.

    • Author: Rex
    • Method only
    "},{"location":"cutjigsawimage/#live-demos","title":"Live demos","text":"
    • Create pieces
    • Custom piece shape
    • Drag drop with pixelPerfect
    "},{"location":"cutjigsawimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"cutjigsawimage/#install-plugin","title":"Install plugin","text":""},{"location":"cutjigsawimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcutjigsawimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcutjigsawimageplugin.min.js', true);\n
    • Cut image into pieces
      var pieces = scene.plugins.get('rexcutjigsawimageplugin').gridCut(gameObject, config);\n
    "},{"location":"cutjigsawimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CutJigsawImagePlugin from 'phaser3-rex-plugins/plugins/cutjigsawimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCutJigsawImage',\nplugin: CutJigsawImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Cut image into pieces
      var pieces = scene.plugins.get('rexCutJigsawImage').gridCut(gameObjects, config);\n
    "},{"location":"cutjigsawimage/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import CutJigsawImage from 'phaser3-rex-plugins/plugins/cutjigsawimage.js';\n
    • Cut image into pieces
      var images = CutJigsawImage(gameObjects, config);\n
    "},{"location":"cutjigsawimage/#create-pieces","title":"Create pieces","text":"
    var pieces = scene.plugins.get('rexCutJigsawImage').gridCut(gameObject, {\npiecesKey: ,\ncolumns: , rows: ,\nedgeWidth: , edgeHeight: ,\nuseDynamicTexture: true,\n\n// drawShapeCallback: undefined,\n// edges: undefined,    \n\n// createImageCallback: undefined,\n// ImageClass: Phaser.GameObjects.Image,\n\n// originX: 0.5,\n// originY: 0.5,\n// add: true,\n// align: true,\n// objectPool: undefined\n});\n
    • gameObjects : Target game object which has a texture, ex Image, RenderTexture.
    • piecesKey : Store frame of each piece in this dynamic texture.
      • undefined : Use 'gameObjects.texture.key' + '_pieces' as texture key.
    • columns, rows : Cut texture in columns x rows grids
    • edgeWidth, edgeHeight : Padding around piece.
    • useDynamicTexture : Generate frame of pieces on dynamic texture or canvas texture.
      • true : Generate frame of pieces on dynamic texture. Default value.
      • false : Generate frame of pieces on canvas texture.
    • drawShapeCallback : Callback of creating piece shape
      • undefined : Use default piece shape.
      • A function object
        function(graphics, width, height, edgeWidth, edgeHeight, edgeMode) {\n}\n
        • graphics : Graphics game object, or canvas.
          • Draw piece shape on a Graphics game object, if useDynamicTexture is set to true
          • Draw piece shape on canvas, if useDynamicTexture is set to false
        • width, height : Frame size of this piece
        • edgeWidth, edgeHeigh : Padding around piece.
        • edgeMode :
          {\nleft: 0,   // 0|1|2\nright: 0,  // 0|1|2\ntop: 0,    // 0|1|2\nbottom: 0  // 0|1|2\n}\n
          • left, right, top, bottom
            • 0 : Flat edge
            • 1 : Convex edge
            • 2 : Concave edge
    • edges : edgeMode in a 2d array for each piece
      • undefined : Create random edges for each piece.
    • createImageCallback : Custom callback to return an image game object, optional.
      function(scene, texture, frame) {\nreturn gameObject;\n}\n
      • texture : A texture object.
      • frame : Frame name.
    • ImageClass : Create image game object from this class. Default value is built-in Image class. Used when createImageCallback is undefined.
    • originX, originY : Origin of created image game objects
    • add :
      • true : Add these created image game objects to scene. Default value.
      • false : Don't add created image game objects to scene.
    • align :
      • true : Align position of created image game objects to target game object (gameObjects). Default value when add is set to true.
      • false : Don't set position of created image game objects. Default value when add is set to false.
    • objectPool : An array of image game objects, will reuse image game objects from this pool. Optional.
    • pieces : Return piece game objects.
      • Size of any piece game object (frame size) :
        • width : (gameObjects.width / columns) + (2 * edgeWidth)
        • height : (gameObjects.height / rows) + (2 * edgeHeigh)
      • Frame name of a piece game object : columnIndex + ',' + rowIndex
    "},{"location":"datamanager/","title":"Built-in data","text":""},{"location":"datamanager/#introduction","title":"Introduction","text":"

    Store data in key-value pairs, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"datamanager/#usage","title":"Usage","text":""},{"location":"datamanager/#write","title":"Write","text":""},{"location":"datamanager/#set-value","title":"Set value","text":"
    • Set value
      parent.data.set(key, value);\n
      or
      parent.data.values[key] = value;\n
      • key : Key string.
    • Increase number value. If the key doesn't already exist in the Data Manager then it is increased from 0.
      parent.data.inc(key, data);\n
      or
      parent.data.values[key] += value;\n
      • data : The value to increase.
    • Toggle boolean value. If the key doesn't already exist in the Data Manager then it is toggled from false.
      parent.data.toggle(key);\n
      or
      parent.data.values[key] = !parent.data.values[key];\n
    "},{"location":"datamanager/#set-values","title":"Set values","text":"
    parent.data.set(data);    // data: {key:value, ...}\n
    "},{"location":"datamanager/#merge-values","title":"Merge values","text":"
    parent.data.merge(data);  // data: {key:value, ...}\nparent.data.merge(data, false);  // won't overwrite existed keys\n
    "},{"location":"datamanager/#events","title":"Events","text":"

    Fires setdata event when a value is first set.

    parent.data.events.on('setdata', function(parent, key, value){ /* ... */ });\n

    Fires changedata, and changedata- + key events when a value is set that already exists.

    parent.data.events.on('changedata', function(parent, key, value, previousValue){ /* ... */ });\n
    parent.data.events.on('changedata-' + key, function(parent, value, previousValue){ /* ... */ });\n
    "},{"location":"datamanager/#read","title":"Read","text":""},{"location":"datamanager/#get-value","title":"Get value","text":"

    var value = parent.data.get(key);\n
    or
    var value = parent.data.values[key];\n

    "},{"location":"datamanager/#get-values","title":"Get values","text":"
    var values = parent.data.get(keys); // values: [value, value, ...], keys: [key, key, ...]\n
    "},{"location":"datamanager/#get-all-values","title":"Get all values","text":"
    var allValues = parent.data.getAll();  // return a copy of data\n
    "},{"location":"datamanager/#query","title":"Query","text":"

    Using string.match() to pick matched keys.

    var result = parent.data.query(rgExp);\n
    "},{"location":"datamanager/#remove","title":"Remove","text":""},{"location":"datamanager/#remove-key","title":"Remove key","text":"
    parent.data.remove(key);\n
    "},{"location":"datamanager/#remove-keys","title":"Remove keys","text":"
    parent.data.remove(keys);  // keys: [key, key, ...]\n
    "},{"location":"datamanager/#pop-key","title":"Pop key","text":"
    var value = parent.data.pop(key);\n

    Get and remove that key.

    "},{"location":"datamanager/#delet-all-keys","title":"Delet all keys","text":"

    Delete all data in this Data Manager and unfreeze it.

    parent.data.reset();\n
    "},{"location":"datamanager/#events_1","title":"Events","text":"

    Fires removedata event when a key is removed.

    parent.data.events.on('removedata', function(parent, key, value){ /* ... */ });\n
    "},{"location":"datamanager/#freeze","title":"Freeze","text":"
    var isFrozen = parent.data.freeze;\nparent.data.freeze = true;\n

    No changes can be written to it.

    "},{"location":"datamanager/#has-key","title":"Has key","text":"
    var hasKey = parent.data.has(key);\n
    "},{"location":"datamanager/#for-each-key","title":"For each key","text":"
    parent.data.each(function(parent, key, value){\n/* ... */\n}, scope);\n
    "},{"location":"datamanager/#count-of-data","title":"Count of data","text":"
    var cnt = parent.data.count;\n
    "},{"location":"datamanager/#reset","title":"Reset","text":"

    Reset status and clear all keys.

    parent.data.reset()\n
    "},{"location":"date/","title":"Date","text":""},{"location":"date/#introduction","title":"Introduction","text":"

    Get current date or unix-timestamp.

    • Author: Built-in javascript function
    "},{"location":"date/#usage","title":"Usage","text":"

    Reference

    "},{"location":"date/#create-instance","title":"Create instance","text":"
    var d = new Date();\nvar d = new Date(timestamp);\nvar d = new Date(dateString);\nvar d = new Date(year, month, day, hours, minutes, seconds, milliseconds);\n
    "},{"location":"date/#get-date","title":"Get date","text":"
    var year = d.getFullYear();    // returns the year\nvar month = d.getMonth();      // returns the month (0-11)\nvar date = d.getDate();        // returns the day of the month (1-31)\nvar day = d.getDay();          // returns the day of the week\nvar hour = d.getHours();       // returns the hour (0-23)\nvar min = d.getMinutes();      // returns the minutes (0-59)\nvar sec = d.getSeconds();      // returns the seconds (0-59)\nvar ms = d.getMilliseconds();  // returns the milliseconds (0-999)\n
    "},{"location":"date/#get-unix-timestamp","title":"Get unix-timestamp","text":"
    var timestamp = d.getTime();;   // unix-timestamp in milliseconds\n

    or

    var timestamp = Date.now();;    // unix-timestamp in milliseconds\n
    "},{"location":"date/#to-string","title":"To string","text":"
    var s = d.toLocaleString();   // locale conventions\nvar iso = d.toISOString();    // ISO standard\n
    "},{"location":"device/","title":"Device","text":""},{"location":"device/#introduction","title":"Introduction","text":"

    Get information of device, built-in properties of phaser.

    • Author: Richard Davey
    "},{"location":"device/#usage","title":"Usage","text":""},{"location":"device/#os","title":"OS","text":"
    • Platform
      scene.sys.game.device.os.android      // Is running on android?\nscene.sys.game.device.os.chromeOS     // Is running on chromeOS?\nscene.sys.game.device.os.cordova      // Is the game running under Apache Cordova?\nscene.sys.game.device.os.crosswalk    // Is the game running under the Intel Crosswalk XDK?\nscene.sys.game.device.os.desktop      // Is running on a desktop?\nscene.sys.game.device.os.ejecta       // Is the game running under Ejecta?\nscene.sys.game.device.os.electron     // Is the game running under GitHub Electron?\nscene.sys.game.device.os.iOS          // Is running on iOS?\nscene.sys.game.device.os.iPad         // Is running on iPad?\nscene.sys.game.device.os.iPhone       // Is running on iPhone?\nscene.sys.game.device.os.kindle       // Is running on an Amazon Kindle?\nscene.sys.game.device.os.linux        // Is running on linux?\nscene.sys.game.device.os.macOS        // Is running on macOS?\nscene.sys.game.device.os.node         // Is the game running under Node.js?\nscene.sys.game.device.os.nodeWebkit   // Is the game running under Node-/Webkit?\nscene.sys.game.device.os.webApp       // Set to true if running as a WebApp, i.e. within a WebView\nscene.sys.game.device.os.windows      // Is running on windows?\nscene.sys.game.device.os.windowsPhone // Is running on a Windows Phone?\n
    • Major version number of ios
      var version = scene.sys.game.device.os.iOSVersion;\n
    • Pixel-ratio of the host device
      var pixelRatio = scene.sys.game.device.os.pixelRatio;\n
    "},{"location":"device/#browser","title":"Browser","text":"
    • Platform
      scene.sys.game.device.browser.chrome       // Is running in Chrome?\nscene.sys.game.device.browser.edge         // Is running in Microsoft Edge browser?\nscene.sys.game.device.browser.firefox      // Is running in Firefox?\nscene.sys.game.device.browser.ie           // Is running in Internet Explorer 11 or less (not Edge)?\nscene.sys.game.device.browser.mobileSafari // Is running in Mobile Safari?\nscene.sys.game.device.browser.opera        // Is running in Opera?\nscene.sys.game.device.browser.safari       // Is running in Safari?\nscene.sys.game.device.browser.silk         // Is running in the Silk browser (as used on the Amazon Kindle)?\nscene.sys.game.device.browser.trident       // Is running a Trident version of Internet Explorer (IE11+)?\n
    • Version
      var version = scene.sys.game.device.browser.chromeVersion;\nvar version = scene.sys.game.device.browser.firefoxVersion;\nvar version = scene.sys.game.device.browser.ieVersion;\nvar version = scene.sys.game.device.browser.safariVersion;\nvar version = scene.sys.game.device.browser.tridentVersion;\n
    "},{"location":"device/#audio","title":"Audio","text":"
    var flac = scene.sys.game.device.audio.flac;\nvar aac = scene.sys.game.device.audio.aac;\nvar dolby = scene.sys.game.device.audio.dolby;\nvar m4a = scene.sys.game.device.audio.m4a;\nvar mp3 = scene.sys.game.device.audio.mp3;\nvar ogg = scene.sys.game.device.audio.ogg;\nvar opus = scene.sys.game.device.audio.opus;\nvar wav = scene.sys.game.device.audio.wav;\nvar webm = scene.sys.game.device.audio.webm;\nvar webAudio = scene.sys.game.device.audio.webAudio;\nvar audioData = scene.sys.game.device.audio.audioData;\n
    "},{"location":"device/#video","title":"Video","text":"
    var h264Video = scene.sys.game.device.video.h264;  // Can this device play h264 mp4 video files?\nvar hlsVideo = scene.sys.game.device.video.hls;    // Can this device play hls video files?\nvar mp4Video = scene.sys.game.device.video.mp4;    // Can this device play h264 mp4 video files?\nvar m4vVideo = scene.sys.game.device.video.m4v;    // Can this device play m4v (typically mp4) video files?\nvar oggVideo = scene.sys.game.device.video.ogg;    // Can this device play ogg video files?\nvar vp9Video = scene.sys.game.device.video.vp9;    // Can this device play vp9 video files?\nvar webmVideo = scene.sys.game.device.video.webm;  // Can this device play webm video files?\n
    "},{"location":"dialog-quest/","title":"Dialog-quest","text":""},{"location":"dialog-quest/#introduction","title":"Introduction","text":"

    Flow control of question manager with a dialog.

    • Author: Rex
    • Template
    "},{"location":"dialog-quest/#live-demos","title":"Live demos","text":"
    • Branch
    • Shuffle
    "},{"location":"dialog-quest/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"dialog-quest/#install-plugin","title":"Install plugin","text":""},{"location":"dialog-quest/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');    scene.load.script('rexdialogquest', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdialogquest.min.js');\n
    • Add dialog and quest object
      var dialog = scene.rexUI.add.dialog(config); var quest = new rexdialogquest({\ndialog: dialog,\n// ...\n});\n
    "},{"location":"dialog-quest/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nimport DialogQuest from 'phaser3-rex-plugins/templates/dialog-quest/DialogQuest.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dialog and quest object
      var dialog = scene.rexUI.add.dialog(config); var quest = new DialogQuest({\ndialog: dialog,\n// ...\n});\n
    "},{"location":"dialog-quest/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Dialog } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\nimport DialogQuest from 'phaser3-rex-plugins/templates/dialog-quest/DialogQuest.js';\n
    • Add dialog object
      var dialog = new Dialog(scene, config);\nscene.add.existing(dialog);\nvar quest = new DialogQuest({\ndialog: dialog,\n// ...\n});\n
    "},{"location":"dialog-quest/#create-dialog-quest-object","title":"Create dialog-quest object","text":"
    var quest = new DialogQuest({\ndialog: dialog,\n\nquestions: undefined,\n// format: undefined,\n// delimiter: ',',\n// types: {\n//     question: 'q',\n//     option: '',\n// },\n// convert: true,\n\nquest: true,\n// quest: {\n//     shuffleQuestions: false,\n//     shuffleOptions: false,\n// }\n});\n
    • dialog : A dialog game object.
      • UI plugin does not included in this template, install it before creating a dialog game object.
      • Reuse/update dialog game object for each question.
      • The number of choice buttons should be equal or larger than the maximun number of options.
    • Other parameters : See quest
    "},{"location":"dialog-quest/#flow-chart","title":"Flow chart","text":"
    graph TB\n\nStart[\"quest.start()\"] --> EventUpdateChoice[\"quest.emit('update-choice', choice, option, quest)<br>----<br>Update each choice button via question.option[i]\"]\n\nEventUpdateChoice --> EventUpdateDialog[\"quest.emit('update-dialog', dialog, question, quest)<br>----<br>Update dialog, action button via question\"]\n\nEventUpdateDialog --> EventClickChoice[\"quest.emit('click-choice', choice, dialog, quest)<br>----<br>Click any choice button\"]\n\nEventClickChoice --> EventClickAction[\"quest.emit('click-action', action, dialog, quest)<br>----<br>Click any action button\"]\n\nEventClickAction --> IsLast{\"quest.isLast()\"}\nEventClickChoice --> IsLast\n\nIsLast --> |No| Next[\"quest.next()\"]\nIsLast --> |Yes| Complete(\"Complete\")\n\nNext --> EventUpdateChoice
    "},{"location":"dialog-quest/#events","title":"Events","text":"
    • Update dialog events
      • Update each choice button via question.option[i]
        quest.on('update-choice', function(choice, option, quest){\n}, scope);\n
        • choice : Choice button game object.
          • Unused choice button game object will be hideen.
        • option : Option object.
        • quest : Quest object.
      • Update dialog, action buttos via question
        quest.on('update-dialog', function(dialog, question, quest){\n}, scope);\n
        • dialog : Dialog game object.
          • Call dialog.layout() if needs.
        • question : Question object.
        • quest : Quest object.
    • Button clicking events
      • Click choice button
        quest.on('click-choice', function(choice, dialog, quest) {\n\n}, scope);\n
        • choice : Clicked choice button game object.
        • dialog : Dialog game object.
        • quest : Quest object.
      • Click choice button
        quest.on('click-action', function(action, dialog, quest) {\n\n}, scope);\n
        • choice : Clicked action button game object.
        • dialog : Dialog game object.
        • quest : Quest object.
    "},{"location":"dialog-quest/#quest-methods","title":"Quest methods","text":"
    • Start quest
      quest.start();\n
    • Next quest
      quest.next();\n
      or
      quest.next(key);\n
    • Is last question
      var isLast = quest.isLast();\n
    • Remove all questions
      quest.removeAll();\n
    • Add questions
      quest.add(questions, config);\n
      • questions : An array of question objects, or a csv string. See questions section in Create question manager instance section.
      • config :
        • delimiter : Delimiter of csv string. Default value is ','
        • types : Define value of row type.
          • types.question : Define value of question row. Default value is q.
          • types.option : Define value of option row. Default value is '' (empty string).
        • convert : Convert string values to other types.
          • Default type converting : Convert string to number, boolean, null, or string
            • '0', '1', ... (number string) -> number
            • 'true', or 'false' -> true or false
            • '' (empty string) -> null
            • Others : string.
          • Set false to ignore types converting, i.e. all values are string.
          • A custom type converting function :
            function(stringValue, key) {\n// return value;\n}\n
    "},{"location":"dialog-quest/#private-data-methods","title":"Private data methods","text":"
    • Get data
      var value = quest.getData(key, defaultValue);\n
    • Get all data
      var data = quest.getData();\n
    • Set value
      quest.setData(key, value);\n
    • Increase value
      quest.incData(key, inc, defaultValue);\n
    • Multiple value
      quest.mulData(key, mul, defaultValue);\n
    • Clear all data
      quest.clearData();\n
    "},{"location":"distance/","title":"Distance","text":""},{"location":"distance/#introduction","title":"Introduction","text":"

    Get distance, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"distance/#usage","title":"Usage","text":""},{"location":"distance/#distance","title":"Distance","text":"
    • Get distance between 2 points
      var d = Phaser.Math.Distance.Between(x1, y1, x2, y2);\n
      or
      var d = Phaser.Math.Distance.BetweenPoints(a, b); // a, b: {x, y}\n
    • Get squared distance
      var d = Phaser.Math.Distance.BetweenPointsSquared(a, b); // a, b: {x, y}\n
    • Get Chebyshev distance (the maximum of the horizontal and vertical distances)
      var d = Phaser.Math.Distance.Chebyshev(x1, y1, x2, y2);\n
    • Get snake distance(i.e. rectilinear distance, Manhattan distance, the sum of the horizontal and vertical distance)
      var d = Phaser.Math.Distance.Snake(x1, y1, x2, y2);\n
    • Get power distance (the sum of the horizontal power distance and vertical power distance)
      var d = Phaser.Math.Distance.Power(x1, y1, x2, y2);\n
    "},{"location":"distance/#speed","title":"Speed","text":"
    • Get speed
      var d = Phaser.Math.GetSpeed(distance, time);\n
      • distance : The distance to travel in pixels.
      • time : The time, in ms, to cover the distance in.
    "},{"location":"domelement/","title":"DOM element","text":""},{"location":"domelement/#introduction","title":"Introduction","text":"

    Carry DOM element, built-in game object of phaser.

    Limitations

    Dom elements appear above or below your game canvas. You cannot blend them into the display list, meaning you cannot have a DOM Element, then a Sprite, then another DOM Element behind it.

    • Author: Richard Davey
    "},{"location":"domelement/#usage","title":"Usage","text":""},{"location":"domelement/#configuration","title":"Configuration","text":"
    • Set parent to divId
    • Set dom.createContainer to true.
    var config = {\n// ...\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n}\nvar game = new Phaser.Game(config);\n
    "},{"location":"domelement/#add-dom-element-object","title":"Add DOM element object","text":""},{"location":"domelement/#add-html-string","title":"Add html string","text":"
    1. Load html string in preload stage
      scene.load.html(key, url);\n
      Reference: load html
    2. Add DOM element object with html string from cache
      var domElement = scene.add.dom(x, y).createFromCache(key);  // elementType = 'div'\n// var domElement = scene.add.dom(x, y).createFromCache(key, elementType);\n
      • Add DOM element object with html string
        var domElement = scene.add.dom(x, y).createFromHTML(htmlString);  // elementType = 'div'\n// var domElement = scene.add.dom(x, y).createFromHTML(htmlString, elementType);\n
        • `elementType : The tag name of the element into which all of the html will be inserted. Defaults to a plain div tag.
    "},{"location":"domelement/#create-element","title":"Create element","text":"
    scene.add.dom(x, y).createElement(tagName);\n// scene.add.dom(x, y).createElement(tagName, style, innerText);\n
    • tagName : A string that specifies the type of element to be created. For example, 'div'
    • style : Either a DOMString that holds the CSS styles to be applied to the created element, or an object the styles will be readyfrom. Optional.
    • innerText : A DOMString that holds the text that will be set as the innerText of the created element. Optional.
    "},{"location":"domelement/#add-existing-dom","title":"Add existing DOM","text":"
    1. Create DOM element
      var el = document.createElement('div');\n// el.style = '...';\n// el.innerText = '...';\n
    2. Add to scene
      var domElement = scene.add.dom(x, y, el);\n// var domElement = scene.add.dom(x, y, el, style, innerText);\n
    "},{"location":"domelement/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDOMElement extends Phaser.GameObjects.DOMElement {\nconstructor(scene, x, y, element, style, innerText) {\nsuper(scene, x, y, element, style, innerText);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var domElement = new MyDOMElement(scene, x, y, element);\n
    "},{"location":"domelement/#event-of-dom-element","title":"Event of DOM element","text":"
    • Add listener
      domElement.addListener(eventName);\n
      • eventName : Event name
        • Single string. ex. 'click'
        • Event name joined with ' '
    • Add event handler
      var callback = function(event) {\n// event.target.name\n};\ndomElement.on(eventName, callback, scope);\n// domElement.once(eventName, callback, scope);\n
      Reference: event emitter
    • Remove listener
      domElement.removeListener(eventName);\n
      • eventName : Event name
        • Single string. ex. 'click'
        • Event name joined with ' '
    "},{"location":"domelement/#get-child","title":"Get child","text":"
    • Get child by name
      var child = domElement.getChildByName(name)\n
    • Get child by id
      var child = domElement.getChildByID(id)\n
    • Get child by property
      var child = domElement.getChildByProperty(property, value)\n
    "},{"location":"domelement/#set-inner-html-string","title":"Set inner html string","text":"
    scene.setHTML(html);\n

    or

    scene.setText(html);\n
    "},{"location":"domelement/#dom-element","title":"DOM Element","text":"

    Each DOM element object has 1 DOM element.

    • Set
      domElement.setElement(el);\n// domElement.setElement(el, style, innerText);\n
    • Get
      var el = domElement.node;\n
    "},{"location":"domelement/#depth","title":"Depth","text":"
    domElement.setDepth(value);\n
    "},{"location":"domelement/#set-size","title":"Set size","text":"
    var style = domElement.node.style;\nstyle.width = width + 'px';\nstyle.height = height + 'px';\ndomElement.updateSize();\n
    "},{"location":"domelement/#skew","title":"Skew","text":"
    domElement.setSkew(x, y);\n

    or

    domElement.skewX = x;\ndomElement.skewY = y;\n
    "},{"location":"domelement/#rotate-3d","title":"Rotate 3d","text":"

    The rotate3d() CSS function defines a transformation that rotates an element around a fixed axis in 3D space, without deforming it.

    domElement.rotate3d.set(x, y, z, a);\n

    or

    domElement.rotate3d.x = x;\ndomElement.rotate3d.y = y;\ndomElement.rotate3d.z = z;\ndomElement.rotate3d.w = a;\n

    Reference

    "},{"location":"domelement/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"
    1. DOM game object always put above game canvas, i.e. DOM game object will render above any other kind of game object.
    2. DOM game object will receive touch event even if it is not the first touched game object.
    3. P3's 'pointerdown', 'pointerup' events will be fired above/under DOM game object.
    4. P3's 'pointermove' event won't be fired above/under DOM game object, except
      • Setting DOM game object to be invisilbe.
      • Assign input.mouse.target parameter of game config.
    5. DOM game object only can be displayed by main camera. i.e. dom game object can't add to other camera.
    "},{"location":"domelement/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"drag/","title":"Drag","text":""},{"location":"drag/#introduction","title":"Introduction","text":"

    Drag game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"drag/#live-demos","title":"Live demos","text":"
    • Try dragging
    "},{"location":"drag/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"drag/#install-plugin","title":"Install plugin","text":""},{"location":"drag/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdragplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdragplugin.min.js', true);\n
    • Add drag behavior
      var drag = scene.plugins.get('rexdragplugin').add(gameObject, config);\n
    "},{"location":"drag/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DragPlugin from 'phaser3-rex-plugins/plugins/drag-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDrag',\nplugin: DragPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add drag behavior
      var drag = scene.plugins.get('rexDrag').add(gameObject, config);\n
    "},{"location":"drag/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Drag from 'phaser3-rex-plugins/plugins/drag.js';\n
    • Add drag behavior
      var drag = new Drag(gameObject, config);\n
    "},{"location":"drag/#create-instance","title":"Create instance","text":"
    var drag = scene.plugins.get('rexDrag').add(gameObject, {\n// enable: true,\n// axis: 0,      //0|'both'|'h&v'|1|'horizontal'|'h'|2|'vertical'|'v'\n// rotation: Phaser.Math.DegToRad(45)  // axis rotation in rad\n});\n
    • enable : Set false to disable input events.
    • axis :
      • 'both','h&v', 'x&y', or 0 : Dragging on all directions.
      • 'horizontal','h', 'x', or 1 : Dragging on horizontal/x axis.
      • 'vertical','v', 'y', or 2 : Dragging on vertical/y axis.
    • rotation : Axis rotation in rad, available in horizontal or vertical axis mode.
    "},{"location":"drag/#events","title":"Events","text":"

    Built-in dragging events

    gameObject.on('dragstart', function(pointer, dragX, dragY){ /*...*/ });\ngameObject.on('drag', function(pointer, dragX, dragY){ /*...*/ });\ngameObject.on('dragend', function(pointer, dragX, dragY, dropped){ /*...*/ });\n
    "},{"location":"drag/#enable","title":"Enable","text":"
    • Get
      var enable = drag.enable;  // enable: true, or false\n
    • Set
      drag.setEnable(enable);  // enable: true, or false\n// drag.enable = enable;\n
    • Toggle
      drag.toggleEnable();\n
    "},{"location":"drag/#get-dragging-state","title":"Get dragging state","text":"
    var isDragging = drag.isDragging;\n
    "},{"location":"drag/#set-rotation-of-axis","title":"Set rotation of axis","text":"
    drag.setAxisRotation(rad);\n// drag.axisRotation = rad;\n
    "},{"location":"drag/#set-axis-mode","title":"Set axis mode","text":"
    drag.setAxisMode(axis);\n
    • axis :
      • 'both','h&v', 'x&y', or 0 : Dragging on all directions.
      • 'horizontal','h', 'x', or 1 : Dragging on horizontal/x axis.
      • 'vertical','v', 'y', or 2 : Dragging on vertical/y axis.
    "},{"location":"drag/#try-drag","title":"Try drag","text":"

    Game object will be dragged if there is any point above it.

    drag.drag();\n
    "},{"location":"drag/#drop","title":"Drop","text":"

    Game object will be dropped(dragend) manually.

    drag.dragend();\n
    "},{"location":"dragrotate/","title":"Drag rotate","text":""},{"location":"dragrotate/#introduction","title":"Introduction","text":"

    Get dragging angle around a specific point.

    • Author: Rex
    • Member of scene
    "},{"location":"dragrotate/#live-demos","title":"Live demos","text":"
    • Spin-button
    • Origin game object
    "},{"location":"dragrotate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"dragrotate/#install-plugin","title":"Install plugin","text":""},{"location":"dragrotate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdragrotateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdragrotateplugin.min.js', true);\n
    • Add drag-rotate input
      var dragRotate = scene.plugins.get('rexdragrotateplugin').add(scene, config);\n
    "},{"location":"dragrotate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DragRotatePlugin from 'phaser3-rex-plugins/plugins/dragrotate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDragRotate',\nplugin: DragRotatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add drag-rotate input
      var dragRotate = scene.plugins.get('rexDragRotate').add(scene, config);\n
    "},{"location":"dragrotate/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import DragRotate from 'phaser3-rex-plugins/plugins/dragrotate.js';\n
    • Add drag-rotate input
      var dragRotate = new DragRotate(scene, config);\n
    "},{"location":"dragrotate/#create-instance","title":"Create instance","text":"
    var dragRotate = scene.plugins.get('rexDragRotate').add(scene, {\norigin: undefined,\nx: 0,\ny: 0,\n\nmaxRadius: undefined\nminRadius: 0,\n\n// enable: true,\n});\n
    • origin : Use game object's position as origin point.
      • undefined : Use fixed origin position.
    • x, y : Fixed orgin point, in world position.
    • maxRadius, minRadius : Dragging is valid when distance between touch pointer and origin position is larger then minRadius and less then maxRadius.
    • enable : Set false to disable input events.
    "},{"location":"dragrotate/#enable","title":"Enable","text":"
    • Get
      var enable = dragRotate.enable;  // enable: true, or false\n
    • Set
      dragRotate.setEnable(enable);  // enable: true, or false\n// dragRotate.enable = enable;\n
    • Toggle
      dragRotate.toggleEnable();\n
    "},{"location":"dragrotate/#origin-point","title":"Origin point","text":"
    • Use game object's position as origin point.
      dragRotate.setOrigin(gameObject);\n
    • Fixed orgin point
      • Get
        var x = dragRotate.x;\nvar y = dragRotate.y;\n
      • Set
        dragRotate.setOrigin(x, y);\n
        or
        dragRotate.setOrigin(pointer); // pointer: {x, y}\n

    Note

    Parameter (x,y) is world position, not camera position.

    "},{"location":"dragrotate/#radius","title":"Radius","text":"
    • Get
      var maxRadius = dragRotate.maxRadius;\nvar minRadius = dragRotate.minRadius;\n
    • Set
      dragRotate.setRadius(maxRadius, minRadius);\n
    "},{"location":"dragrotate/#get-dragging-state","title":"Get dragging state","text":"
    var state = dragRotate.state;\n
    • 0 : No touch pointer
    • 1 : Catch touch pointer
      • Fire 'dragstart' event when catching touch pointers.
      • Fire 'drag' event when any catched touch pointer moved.
      • Fire 'dragend' event when releasing catched touch pointer.
    "},{"location":"dragrotate/#is-drag","title":"Is drag","text":"
    var isDrag = dragRotate.isDrag;\n

    Return true if (dragRotate.state === 1) and catched touch pointer just moved.

    "},{"location":"dragrotate/#drag-cancel","title":"Drag cancel","text":"
    dragRotate.dragCancel();\n
    "},{"location":"dragrotate/#events","title":"Events","text":""},{"location":"dragrotate/#on-dragging","title":"On dragging","text":"
    • On dragging
      dragRotate.on('drag', function(dragRotate) {\n// gameObject.rotation += dragRotate.deltaRotation;\n}, scope);\n
      • dragRotate.deltaRotation : Dragging angle around origin position, in radians.
        • Add to gameObject.rotation to spin target game object.
          gameObject.rotation += dragRotate.deltaRotation;\n
      • dragRotate.deltaAngle : Dragging angle around origin position, in degrees.
        • Add to gameObject.angle to spin target game object.
          gameObject.angle += dragRotate.deltAangle;\n
      • dragRotate.cw : Return true if dragging is dragrotate-wise.
      • dragRotate.ccw : Return true if dragging is counter-dragrotate-wise.
    "},{"location":"dragrotate/#on-drag-start-on-drag-end","title":"On drag start, on drag end","text":"
    • On drag touch pointer start, fired when catching touch pointer.
      dragRotate.on('dragstart', function(dragRotate) {\n\n}, scope);\n
    • On drag touch pointer end, fired when releasing the catched touch pointer.
      dragRotate.on('dragend', function(dragRotate) {\n\n}, scope);\n
    "},{"location":"dragrotate/#catched-touch-pointer","title":"Catched touch pointer","text":"
    • Pointer, available when state is 1
      var pointer = dragRotate.pointer;\n
      • World position of pointer
        var x = pointer.worldX;\nvar y = pointer.worldY;\n
    "},{"location":"dropdown/","title":"Drop down","text":""},{"location":"dropdown/#introduction","title":"Introduction","text":"

    Drop down game object below another target game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"dropdown/#live-demos","title":"Live demos","text":"
    • Drop-down
    "},{"location":"dropdown/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"dropdown/#install-plugin","title":"Install plugin","text":""},{"location":"dropdown/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdropdownplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdropdownplugin.min.js', true);\n
    • Add drop-down behavior
      var dropDown = scene.plugins.get('rexdropdownplugin').add(gameObject, config);\n
    "},{"location":"dropdown/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add drop-down behavior
      var dropDown = scene.plugins.get('rexDropDown').add(gameObject, config);\n
    "},{"location":"dropdown/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import DropDownBehavior from 'phaser3-rex-plugins/plugins/dropdown.js';\n
    • Add drop-down behavior
      var dropDown = new DropDownBehavior(gameObject, config);\n
    "},{"location":"dropdown/#create-instance","title":"Create instance","text":"
    var dropDown = scene.plugins.get('rexDropDown').add(gameObject, {        // expandDirection: 0,\n// alignTargetX: \n// alignTargetY: \n// alignOffsetX: \n// alignOffsetY: \n// bounds:\n\n// When to close dropdown dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n\n// duration: {\n//     in: 200,\n//     out: 200\n// }\n\n// transitIn: undefined,\n// transitOut: undefined,\n\n// destroy: true\n});\n
    • expandDirection : Expand direction
      • 0, 'down' : Expand game object down. i.e. game object will put below target game object. Defatut behavior.
      • 1, 'up' : Expand game object up. i.e. game object will put above target game object.
    • alignTargetX : Align left side game object to left side of target game object
    • alignTargetY : Required parameter
      • Align top side game object to bottom side of target game object, if expandDirection is 0('down').
      • Align bottom side game object to top side of target game object, if expandDirection is 1('up').
    • alignOffsetX, alignOffsetY : Extra position offset. Default value ares 0, 0.
    • bounds : Put game object below target game object if bottom of game object is inside bounds (Rectangle)
      • undefined : Use viewport as bounds
      • Rectangle
    • touchOutsideClose : Set to true to close dropdown dialog when clicking out side of gameObject.
      • Default value is false. Will be set to false if anyTouchClose is set to true.
    • anyTouchClose : Set to true to close dropdown dialog when any clicking.
      • Default value is false.
    • duration : Duration of transition-in, hold, trantion-out.
      • duration.in : Duration of transition-in (open dialog).
        • 0 : No transition, open dialog immediately.
      • duration.out : Duration of transition-out (close dialog).
        • 0 : No transition, close dialog immediately.
    • transitIn : Tween behavior of opening dialog. Default behavior is scale up the height of game object.
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • transitOut : Tween behavior of closing dialog. Default behavior is scale down the height of game
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • destroy
      • true : Destroy dialog when closing completed. Default behavior.
      • fasle : Don't destroy dialog.
    "},{"location":"dropdown/#close","title":"Close","text":"
    dropDown.requestClose();\n// dropDown.requestClose();\n
    "},{"location":"dropdown/#events","title":"Events","text":"
    • On opened dialog
      dropDown.on('open', function(gameObject, dropdown) {\n})\n
    • On closed dialog
      dropDown.on('close', function(closeEventData) {\n})\n
    "},{"location":"dynamic-texture/","title":"Dynamic texture","text":""},{"location":"dynamic-texture/#introduction","title":"Introduction","text":"

    Canvas Dynamic Texture stored in texture cache, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"dynamic-texture/#usage","title":"Usage","text":""},{"location":"dynamic-texture/#create-dynamic-texture","title":"Create dynamic texture","text":"
    var texture = scene.textures.addDynamicTexture(key, width, height);\n

    Disable texture.isSpriteTexture if this texture is not a base texture for Sprite Game Objects.

    texture.setIsSpriteTexture(false);\n// texture.isSpriteTexture = false;\n
    "},{"location":"dynamic-texture/#set-size","title":"Set size","text":"
    texture.setSize(width, height);\n
    "},{"location":"dynamic-texture/#fill-color","title":"Fill color","text":"
    texture.fill(rgb);\n// texture.fill(rgb, alpha, x, y, width, height);\n
    • rgb : The number color to fill this Dynamic Texture with.
    • alpha : The alpha value used by the fill. Default value is 1.
    • x, y, width, height : The area of the fill rectangle. Default behavior is filling whole size.
    "},{"location":"dynamic-texture/#clear","title":"Clear","text":"
    texture.clear();\n
    texture.clear(x, y, width, height);\n
    "},{"location":"dynamic-texture/#draw-game-object","title":"Draw game object","text":"
    texture.draw(entries);\n// texture.draw(entries,x, y);\n// texture.draw(entries, x, y, alpha, tint);\n
    • entries :
      • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
      • Tilemap Layers.
      • A Group. The contents of which will be iterated and drawn in turn.
      • A Container. The contents of which will be iterated fully, and drawn in turn.
      • A Scene Display List. Pass in Scene.children to draw the whole list.
      • Another Dynamic Texture, or a Render Texture.
      • A Texture Frame instance.
      • A string. This is used to look-up the texture from the Texture Manager.
    • x, y : The x/y position to draw the Frame at, or the offset applied to the object.
      • If the object is a Group, Container or Display List, the coordinates are added to the positions of the children.
      • For all other types of object, the coordinates are exact.
    • alpha, tint : Only used by Texture Frames.
      • Game Objects use their own alpha and tint values when being drawn.
    "},{"location":"dynamic-texture/#erase","title":"Erase","text":"
    texture.erase(entries);\n// texture.erase(entries, x, y);\n
    • entries :
      • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
      • Tilemap Layers.
      • A Group. The contents of which will be iterated and drawn in turn.
      • A Container. The contents of which will be iterated fully, and drawn in turn.
      • A Scene Display List. Pass in Scene.children to draw the whole list.
      • Another Dynamic Texture, or a Render Texture.
      • A Texture Frame instance.
      • A string. This is used to look-up the texture from the Texture Manager.
    • x, y : The x/y position to draw the Frame at, or the offset applied to the object.
      • If the object is a Group, Container or Display List, the coordinates are added to the positions of the children.
      • For all other types of object, the coordinates are exact.
    "},{"location":"dynamic-texture/#draw-frame","title":"Draw frame","text":"
    texture.stamp(key, frame, x, y, {\nalpha: 1,\ntint: 0xffffff,\nangle: 0,\nrotation: 0,\nscale: 1,\nscaleX: 1,\nscaleY: 1,\noriginX: 0.5,\noriginY: 0.5,\nblendMode: 0,\nerase: false,\nskipBatch: false\n})\n

    or

    texture.drawFrame(key, frame, x, y);\n// texture.drawFrame(key, frame, x, y, alpha, tint);\n
    • x, y : Top-left position
    "},{"location":"dynamic-texture/#draw-repeat-frames","title":"Draw repeat frames","text":"
    • Repeat frames full of size
      texture.repeat(key, frame);\n
    • Repeat in an area
      texture.repeat(key, frame, x, y, width, height);\n// texture.repeat(key, frame, x, y, width, height, alpha, tint, skipBatch);\n
    "},{"location":"dynamic-texture/#add-frame","title":"Add frame","text":"
    texture.add(name, sourceIndex, x, y, width, height);\n
    • name : The name of this Frame. The name is unique within the Texture.
    • sourceIndex : The index of the TextureSource that this Frame is a part of.
    • x : The x coordinate of the top-left of this Frame.
    • y : The y coordinate of the top-left of this Frame.
    • width : The width of this Frame.
    • height : The height of this Frame.
    "},{"location":"dynamic-texture/#batch-draw","title":"Batch draw","text":"
    1. Begin
      texture.beginDraw();\n
    2. Draw
      • Draw game object
        texture.batchDraw(entries, x, y, alpha, tint);\n
        • entries :
          • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
          • Tilemap Layers.
          • A Group. The contents of which will be iterated and drawn in turn.
          • A Container. The contents of which will be iterated fully, and drawn in turn.
          • A Scene Display List. Pass in Scene.children to draw the whole list.
          • Another Dynamic Texture, or a Render Texture.
          • A Texture Frame instance.
          • A string. This is used to look-up the texture from the Texture Manager.
      • Draw frame
        texture.batchDrawFrame(key, frame, x, y, alpha, tint);\n
      • Draw image
        texture.stamp(key, frame, x, y, {\n// ...\nskipBatch: true\n})\n
      • Draw repeat images
        texture.repeat(key, frame, x, y, width, height, alpha, tint, true);\n
    3. End
      texture.endDraw();\n
    "},{"location":"dynamic-texture/#internal-camera","title":"Internal camera","text":"

    Internal camera texture.camera

    • Scroll (offset)
      texture.camera.setScroll(x, y);\n
    • Zoom (scale)
      texture.camera.setZoom(zoom);\n
    • Rotate
      texture.camera.setAngle(angle);  // angle in degrees\n
    "},{"location":"dynamic-texture/#snapshot","title":"Snapshot","text":""},{"location":"dynamic-texture/#snapshot-area","title":"Snapshot area","text":"
    texture.snapshot(callback);\n// texture.snapshot(callback, type, encoderOptions);\n

    or

    texture.snapshotArea(x, y, width, height, callback, type, encoderOptions);\n
    • callback : The Function to invoke after the snapshot image is created.
      function(imageElement) {\n}\n
      • imageElement : HTMLImageElement.
    • type : The format of the image to create, usually 'image/png' or 'image/jpeg'. Default value is 'image/png'.
    • encoderOptions : The image quality, between 0 and 1. Used for image formats with lossy compression, such as 'image/jpeg'. Default value is 0.92.
    • x, y, width, height : Snapshot area.
    "},{"location":"dynamic-texture/#get-color-of-a-pixel","title":"Get color of a pixel","text":"
    texture.snapshotPixel(x, y, callback);\n
    • x, y : The x/y coordinate of the pixel to get.
    • callback : The Function to invoke after the snapshot image is created.
      function(color) {        }\n
      • color : Color object.
    "},{"location":"dynamicbitmaptext/","title":"Dynamic bitmap text","text":""},{"location":"dynamicbitmaptext/#introduction","title":"Introduction","text":"

    Drawing text by texture with a callback for each character triggered at every tick, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"dynamicbitmaptext/#usage","title":"Usage","text":""},{"location":"dynamicbitmaptext/#load-bitmap-font","title":"Load bitmap font","text":"

    Reference: load bitmap font

    "},{"location":"dynamicbitmaptext/#add-bitmap-text-object","title":"Add bitmap text object","text":"
    var txt = scene.add.dynamicBitmapText(x, y, key, text);\n// var txt = scene.add.dynamicBitmapText(x, y, key, text, size, align);\n
    • size : The size of the font
    • align : The alignment of the text in a multi-line BitmapText object.
      • 0 : Left aligned (default)
      • 1 : Middle aligned
      • 2 : Right aligned

    Add text from JSON

    var txt = scene.make.dynamicBitmapText({\nx: 0,\ny: 0,\ntext: 'Text\\nGame Object\\nCreated from config',\nfont: '',\nsize: false,\nalign: 0,\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"dynamicbitmaptext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends Phaser.GameObjects.DynamicBitmapText {\nconstructor(scene, x, y, key, text, size, align) {\nsuper(scene, x, y, key, text, size, align);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, key, text);\n
    "},{"location":"dynamicbitmaptext/#set-callback","title":"Set callback","text":"
    var callback = function(data) {\n// input\n// data.index, data.charCode\n// data.x, data.y, data.scale, data.rotation\n// data.data\n// data.tint.topLeft, data.tint.topRight, data.tint.bottomLeft, data.tint.bottomRight    \n\n// modify input `data` then return it\n// ...\n// offset: data.y += 2\n// set tint: data.color = tint\nreturn data;\n}\ntxt.setDisplayCallback(callback);\n
    "},{"location":"dynamicbitmaptext/#set-text","title":"Set text","text":"
    txt.setText('...');\n

    or

    txt.text = '...';\n
    "},{"location":"dynamicbitmaptext/#crop","title":"Crop","text":"
    • Set size
      txt.setSize(width, height);\n
      or
      txt.cropWidth = width;\ntxt.cropHeight = height;\n
    • Set offset
      txt.setScrollX(scrollX);\ntxt.setScrollY(scrollY);\n
      or
      this.scrollX = scrollX;\nthis.scrollY = scrollY;\n
    "},{"location":"dynamicbitmaptext/#other-properties","title":"Other properties","text":"

    See bitmap text, game object

    "},{"location":"dynamicbitmaptext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"dynamicbitmaptext/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"dynamictext/","title":"Dynamic text","text":""},{"location":"dynamictext/#introduction","title":"Introduction","text":"

    Control position, angle of each character drawn on a canvas.

    • Author: Rex
    • Game object
    "},{"location":"dynamictext/#live-demos","title":"Live demos","text":"
    • Wrap
      • Wrap modes
      • Horizontal alignment modes
    • Page typing
    • Align, rotation, drawBelowCallback
    • Vertical wrap
    • Character's world position
    • Child input event
    "},{"location":"dynamictext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"dynamictext/#install-plugin","title":"Install plugin","text":""},{"location":"dynamictext/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdynamictextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdynamictextplugin.min.js', true);\n
    • Add dynamic-text object
      var txt = scene.add.rexDynamicText(x, y, width, height, config);\n
    "},{"location":"dynamictext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DynamicTextPlugin from 'phaser3-rex-plugins/plugins/dynamictext-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDynamicTextPlugin',\nplugin: DynamicTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dynamic-text object
      var txt = scene.add.rexDynamicText(x, y, width, height, config);\n
    "},{"location":"dynamictext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import DynamicText from 'phaser3-rex-plugins/plugins/dynamictext.js';\n
    • Add dynamic-text object
      var txt = new DynamicText(scene, x, y, width, height, config);\nscene.add.existing(txt);\n
    "},{"location":"dynamictext/#create-instance","title":"Create instance","text":"
    var txt = scene.add.rexDynamicText({\nx: 0, y: 0,\nwidth: undefined, height: undefined,\nresolution: 1,\n\npadding: 0,  // {left: 0, right: 0, top: 0, bottom: 0}\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\n\nchildrenInteractive: false,\n\ntext: '',\n\nwrap: undefined,\n\ntestString: '|M\u00c9qgy',\n});\n
    • x, y : Position of this dynamic-text game object.
    • width : Fixed width.
      • A number : Width of this dynamic-text game object.
        • Wrap-width is width - padding.left - padding.right.
      • undefined : Width of this dynamic-text game object will be set after invoked runWordWrap method.
    • height : Fixed height.
      • A number : Height of this dynamic-text game object.
      • undefined : Height of this dynamic-text game object will be set after invoked runWordWrap method.
    • resolution : The resolution the content is rendered to its internal canvas at. Default value is 1.
    • padding : Padding of bounds.
      • A number
      • padding.left, padding.right, padding.top, padding.bottom
    • background : Properties of background round-rectangle.
      • background.color : Fill color, number or string.
        • null : No filling.
      • background.color2 : Gradient fill color, number or string.
        • null : No gradient filling.
      • background.horizontalGradient : Horizontal or vertical gradient filling.
        • true : Horizontal gradient filling.
        • false : Vertical gradient filling.
      • background.stroke : Stroke color, number or string.
        • null : No stroke.
      • background.strokeThickness : Line width of stroke.
      • background.cornerRadius : Corner-radius of round rectangle.
      • background.cornerIteration : Iteration of corner-radius.
        • null : Draw corner-radius via arc directly.
        • A number : Draw corner-radius via lines
    • innerBounds : Properties of inner-bounds.
      • innerBounds.color : Fill color, number or string.
        • null : No filling.
      • innerBounds.color2 : Gradient fill color, number or string.
        • null : No gradient filling.
      • innerBounds.horizontalGradient : Horizontal or vertical gradient filling.
        • true : Horizontal gradient filling.
        • false : Vertical gradient filling.
      • innerBounds.stroke : Stroke color, number or string.
        • null : No stroke.
      • innerBounds.strokeThickness : Line width of stroke.
    • style : Initial text-style.
      • style.bold : Bold
      • style.italic : Italic
      • style.fontSize : Font size, number or string.
      • style.fontFamily : Font family
      • style.color : Fill color, number or string.
      • style.stroke : Stroke color, number or string.
      • style.strokeThickness : Line width of stroke.
      • style.shadowColor : Shadow color, number or string.
        • null : No shadow.
      • style.shadowOffsetX : OffsetX of shadow.
      • style.shadowOffsetY : OffsetY of shadow.
      • style.shadowBlur : Blur of shadow.
      • style.backgroundColor : Background color of a character.
      • style.backgroundHeight, style.backgroundBottomY : Background position and height of a character.
        • undefined, or null : Use height of character as background height. Default behavior.
      • style.offsetX : OffsetX.
      • style.offsetY : OffsetY.
      • style.align : Override default line-alignment setting.
        • 0, 'left', 'top' : Align remainder lines to left/top.
        • 1, 'center' : Align remainder lines to center.
        • 2, 'right', 'bottom' : Align remainder lines to right/bottom.
        • undefined : Use default line-alignment setting.
    • childrenInteractive :
      • true : Fire input events ('child.pointerdown', 'child.pointerup', 'child.pointerover', 'child.pointerout') of any child after text.setInteractive().
      • false : Won't fire any input events of child. Default behavior.
    • text : Content of text.
    • wrap : Default configuration Horizontal/Vertical wrapping.
    • testString : Test string to get text ascent and text height with default text style.

    or

    var txt = scene.add.rexDynamicText(x, y, width, height, config);\n

    or

    var txt = scene.add.rexDynamicText(x, y, config);\n

    Add dynamictext from JSON

    var txt = scene.make.rexDynamicText({\nx: 0,\ny: 0,\n\n// origin: {x: 0.5, y: 0.5},\n// fill: null,\n\nadd: true\n});\n
    "},{"location":"dynamictext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDynamicText extends DynamicText {\nconstructor(scene, x, y, width, height, config)) {\nsuper(scene, x, y, width, height, config));\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyDynamicText(scene, x, y, config);\n
    "},{"location":"dynamictext/#clear-content","title":"Clear content","text":"
    txt.clearContent();\n
    "},{"location":"dynamictext/#text","title":"Text","text":""},{"location":"dynamictext/#append-text","title":"Append text","text":"
    txt.appendText(text);\n

    or

    txt.appendText(text, {\n// bold: false,\n// italic: false,\n// fontSize: '16px',\n// fontFamily: 'Courier',\n// color: '#fff',\n// stroke: '#fff',\n// strokeThickness: 0,\n// shadowColor: null,\n// shadowOffsetX: 0,\n// shadowOffsetY: 0,\n// shadowBlur: 0,\n// backgroundColor: null,\n// backgroundHeight: undefined,\n// backgroundBottomY: undefined,\n// offsetY: 0,\n// offsetY: 0,\n// align: undefined\n}\n);\n

    To overwrite some properties of text-style.

    Each character will be placed at position (0,0), without rotation. Uses word-wrap method to rearrange position of characters.

    "},{"location":"dynamictext/#set-text","title":"Set text","text":"
    txt.setText(text);\n

    or

    txt.setText(text, {\n// bold: false,\n// italic: false,\n// fontSize: '16px',\n// fontFamily: 'Courier',\n// color: '#fff',\n// stroke: '#fff',\n// strokeThickness: 0,\n// shadowColor: null,\n// shadowOffsetX: 0,\n// shadowOffsetY: 0,\n// shadowBlur: 0,\n// backgroundColor: null,\n// backgroundHeight: undefined,\n// backgroundBottomY: undefined,\n// offsetY: 0,\n// offsetY: 0,\n// align: undefined\n}\n);\n
    "},{"location":"dynamictext/#insert-text","title":"Insert text","text":"

    txt.insertText(index, text);\n
    or

    txt.insertText(index, text, {\n// bold: false,\n// italic: false,\n// fontSize: '16px',\n// fontFamily: 'Courier',\n// color: '#fff',\n// stroke: '#fff',\n// strokeThickness: 0,\n// shadowColor: null,\n// shadowOffsetX: 0,\n// shadowOffsetY: 0,\n// shadowBlur: 0,\n// backgroundColor: null,\n// backgroundHeight: undefined,\n// backgroundBottomY: undefined,\n// offsetY: 0,\n// offsetY: 0,\n// align: undefined\n}\n);\n
    "},{"location":"dynamictext/#remove-text","title":"Remove text","text":"
    txt.removeText(index);\n
    "},{"location":"dynamictext/#get-text","title":"Get text","text":"
    • Get active characters
      var text = txt.text;\n
      or
      var text = txt.getText();\n
    • Get all characters
      var text = txt.getText(false);\n
    "},{"location":"dynamictext/#image","title":"Image","text":""},{"location":"dynamictext/#append-image","title":"Append image","text":"
    txt.appendImage(key, frame, {\n// width: ,\n// height: ,\n// scaleX: ,\n// scaleY: ,\n// color: ,\n})\n
    • width : Scaled-width. Aspect-ratio will be kept if no height, or scaleY is set.
    • height : Scaled-height. Aspect-ratio will be kept if no width, or scaleX is set.
    • color : Tint-fill color. Default is undefined.
    "},{"location":"dynamictext/#background","title":"Background","text":"
    • Fill style
      txt.setBackgroundColor(color);\n// txt.setBackgroundColor(color, color2, isHorizontalGradient);\n
    • Stroke style
      txt.setBackgroundStroke(color, lineWidth);\n
    • Corner radius
      txt.setBackgroundCornerRadius(radius);\n// txt.setBackgroundCornerRadius(radius, iteration)\n
    "},{"location":"dynamictext/#inner-bounds","title":"Inner bounds","text":"
    • Fill style
      txt.setInnerBoundsColor(color);\n// txt.setInnerBoundsColor(color, color2, isHorizontalGradient);\n
    • Stroke style
      txt.setInnerBoundsStroke(color, lineWidth);\n
    "},{"location":"dynamictext/#wrap","title":"Wrap","text":"

    Control characters :

    • '\\n' : New line
    • '\\f' : Page break
    "},{"location":"dynamictext/#horizontal-wrap","title":"Horizontal wrap","text":"
    var result = txt.runWordWrap({\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n},\nascent: undefined,\nlineHeight: undefined,\nuseDefaultTextHeight: false,\nmaxLines: undefined,\nwrapWidth: undefined,\nwrapMode: 'word',  // 1|'word'|2|'char'|'character'|3|'mix'\nletterSpacing: 0,\nhAlign: 0,\nvAlign: 0,\n\n\n});\n
    • padding :
      • padding.top, padding.bottom, padding.left, padding.right : Extra space around lines.
    • ascent, lineHeight : Height of first line and remainder lines
      • ascent will set to lineHeight if ascent is undefined but lineHeight is not undefined (backward compatible)
      • Get ascent, lineHeight from default text style and test string, if ascent, lineHeight are both undefined
    • useDefaultTextHeight : If parameter lineHeight is not given,
      • false : Set line height to (total line height / maxLines), if parameter maxLines is larger than 0. Default behavior.
      • true : Set line height to default text height.
    • maxLines : Lines number of this page.
      • 0 : Wrapping whole content.
      • undefined : It will be set if lineHeight and height is given
    • wrapWidth : Width of wrapping. Use inner width if this parameter is undefined.
    • wrapMode :
      • No wrapping if wrapWidth, or inner width is not given.
      • 1, or 'word' : Word wrapping. Default behavior.
      • 2, or 'char', or 'character' : Character wrapping.
      • 3, or 'mix' : Word wrapping for ASCII word, Character wrapping for other (unicode) word.
    • letterSpacing : Space between each character.
    • hAlign : Horizontal alignment.
      • 0, or 'left' : Align to left bound.
      • 1, or 'center' : Align to center.
      • 2, or 'right' : Align to right bound.
      • 3, 'justify', 'justify-left' : If remainder space is less or equal than 25%, then justify children. Else align children to left/top side.
      • 4, 'justify-right' : If remainder space is less or equal than 25%, then justify children. Else align children to right/bottom side.
      • 5, 'justify-cneter' : If remainder space is less or equal than 25%, then justify children. Else align children to center.
    • vAlign : Vertical alignment.
      • 0, or 'top' : Align to top bound.
      • 1, or 'center' : Align to center.
      • 2, or 'bottom' : Align to bottom bound.
    "},{"location":"dynamictext/#align","title":"Align","text":"
    • Set vertical align mode
      txt.setVAlign(vAlign);\n
      • vAlign : Vertical alignment.
        • 0, or 'top' : Align to top bound.
        • 1, or 'center' : Align to center.
        • 2, or 'bottom' : Align to bottom bound.
    • Set horizontal align mode
      txt.setHAlign(hAlign);\n
      • hAlign : Horizontal alignment.
        • 0, or 'left' : Align to left bound.
        • 1, or 'center' : Align to center.
        • 2, or 'right' : Align to right bound.
    "},{"location":"dynamictext/#test-string","title":"Test string","text":"
    txt.setTestString(text);\n
    "},{"location":"dynamictext/#vertical-wrap","title":"Vertical wrap","text":"
    var result = txt.runVerticalWrap({\npadding: {\ntop: 0,\nleft: 0,\nright: 0,\nbottom: 0\n},\nlineWidth: undefined,\nmaxLines: undefined,\nfixedChildHeight: undefined,\ncharPerLine: undefined,\nwrapHeight: undefined,\nletterSpacing: 0,\nrtl: true,\nhAlign: 0,\nvAlign: 0,\n});\n
    • padding :
      • padding.top, padding.bottom, padding.left, padding.right : Extra space around lines.
    • lineWidth : Line width.
      • undefined : It will be set if maxLines and fixedWidth is given.
    • maxLines : Lines number of this page.
      • 0 : Wrapping whole content.
      • undefined : It will be set if lineWidth and fixedWidth is given.
    • fixedChildHeight : Each character has the same fixed height.
      • undefined : Get fixedChildHeight according to charPerLine parameter. Or use height of each character if fixedChildHeight and charPerLine parameters are undefined.
    • charPerLine : Amount of characters in each line, to get fixedChildHeight.
    • wrapHeight : Height of wrapping
    • letterSpacing : Space between each character.
    • rtl :
      • true : Place lines from right to left.
      • false : Place lines from left to right.
    • hAlign : Horizontal alignment.
      • 0, or 'left' : Align to left bound. Default value if rtl is set to false.
      • 1, or 'center' : Align to center.
      • 2, or 'right' : Align to right bound. Default value if rtl is set to true.
    • vAlign : Vertical alignment.
      • 0, or 'top' : Align to top bound.
      • 1, or 'center' : Align to center.
      • 2, or 'bottom' : Align to bottom bound.
    "},{"location":"dynamictext/#result","title":"Result","text":"
    {\nchildren: [],\nlines: [],\nisLastPage: false\n}\n
    • children : Character/Image data in this page.
    • lines : Array of line data. A line data contains
      {\nchildren: [],\nwidth: 0,     // Horizontal-wrapping\nheight: 0,    // Vertical-wrapping.        \n}\n
      • children : Character/Image data in this line.
      • width : Width of this line, in result of horizontal-wrapping.
      • height : Height of this line, in result of vertical-wrapping.
    • isLastPage :
      • false : Run txt.runWordWrap(result)/txt.runVerticalWrap(result) to get next page of word-wrapping result.
      • true : No remainder of characters.
    "},{"location":"dynamictext/#wrap-next-page","title":"Wrap next page","text":"
    var result = txt.runWordWrap(prevResult);\n
    • prevResult : Result of previous word-wraping.
    • result : Current result of word-wraping.
    "},{"location":"dynamictext/#default-configuration-of-wrapping","title":"Default configuration of wrapping","text":"
    txt.setWrapConfig(config);\n
    • config : Default configuration Horizontal/Vertical wrapping.
    "},{"location":"dynamictext/#scroll-content","title":"Scroll content","text":"

    Scroll content by setting textOX, textOY members

    • Set
      txt.setTextOXY(x, y).updateTexture();    // txt.setTextOX(x).updateTexture();\n// txt.setTextOY(x).updateTexture(); \n
      or
      txt.addTextOXY(incX, incY).updateTexture(); // txt.addTextOX(incX).updateTexture(); \n// txt.addTextOY(incY).updateTexture(); \n
      or
      txt.textOX = x;\ntxt.textOY = y;\ntxt.updateTexture();\n
    • Get
      var ox = txt.textOX;\nvar oy = txt.textOY;\n
    "},{"location":"dynamictext/#child","title":"Child","text":""},{"location":"dynamictext/#general-properties","title":"General properties","text":"
    • Visible :
      • Get
        var visible = child.visible;\n
      • Set
        child.setVisible();\n// child.visible = true;\n
        or
        child.setVisible(false);  // Set to invisible\n// child.visible = false;\n
    • Alpha
      • Get
        var alpha = child.alpha;\n
      • Set
        child.setAlpha(alpha);\n// child.alpha = alpha;\n
    • Position :
      • Get
        var x = child.x;\nvar y = child.y;\n
      • Set
        child.setPosition(x, y);\n// child.x = x;\n// child.y = y;\n
    • Angle :
      • Get
        var degrees = child.angle;\n// var radians = child.rotation;\n
      • Set
        child.setAngle(degrees);\nchild.setRotation(radians);\n// child.angle = degrees;\n// child.rotation = radians;\n
    • Scale
      • Get
        var scaleX = child.scaleX;\nvar scaleY = child.scaleY;\n
      • Set
        child.setScale(scaleX, scaleY);\n// child.scaleX = scaleX;\n// child.scaleY = scaleY;\n
    • Draw callbacks
      • Set
        child.setDrawBelowCallback(callback);\nchild.setDrawAboveCallback(callback);\n
        • callback :
          function(child) {\nvar text = child.text;                var context = child.context;\n// ...\n}\n
    • World position
      var worldXY = child.getWorldPosition();\n// out = child.getWorldPosition(out);\n
      or
      var worldXY = txt.getCharWorldPosition(char);\n// out = txt.getCharWorldPosition(char, out);\n
    "},{"location":"dynamictext/#character","title":"Character","text":""},{"location":"dynamictext/#text-style","title":"Text-style","text":"
    • Get
      var bold = char.style.bold;\nvar italic = char.style.italic;\nvar fontSize = char.style.fontSize;\nvar fontFamily = char.style.fontFamily;\nvar color = char.style.color;\nvar stroke = char.style.stroke;\nvar strokeThickness = char.style.strokeThickness;\nvar shaodwColor = char.style.shadowColor;\nvar shadowBlur = char.style.shadowBlur;\nvar shadowOffsetX = char.style.shadowOffsetX;\nvar shadowOffsetY = char.style.shadowOffsetY;\nvar backgroundColor = char.style.backgroundColor;\nvar backgroundHeight = char.style.backgroundHeight;\nvar backgroundBottomY = char.style.backgroundBottomY;\nvar xOffset = char.style.x;\nvar yOffset = char.style.y;\n
    • Set
      char.modifyStyle({\n// bold: false,\n// italic: false,\n// fontSize: '16px',\n// fontFamily: 'Courier',\n// color: '#fff',\n// stroke: '#fff',\n// strokeThickness: 0,\n// shaodwColor: null,\n// shadowBlur: 0,\n// shadowOffsetX: 0,\n// shadowOffsetY: 0,\n// backgroundColor: null,\n// backgroundHeight: undefined,\n// backgroundBottomY: undefined,\n// offsetX: 0,\n// offsetY: 0\n})\n
      or
      char.setBold();\n// char.setBold(false);\n
      char.setItalic();\n// char.setItalic(false);\n
      char.setFontSize(fontSize); // number, string\n
      char.setFontFamily(fontFamily);\n
      char.setColor(color); // number, string\n// char.setColor(); // No filling color\n
      char.setStrokeStyle(color, thickness);\n// char.setStrokeStyle();  // No stroke\n
      char.setShadowColor(color);\n// char.setShadowColor();  // No shadow\n
      char.setShadowOffset(offsetX, offsetY);\n
      char.setShadowBlur(blur);\n
      char.setBackgroundColor(color);\n// char.setBackgroundColor();  // No shadow\n
      char.setOffsetX(offsetX);\nchar.setOffsetY(offsetY);\n
    "},{"location":"dynamictext/#image_1","title":"Image","text":"
    • Size
      • Get
        var width = image.width;\nvar height = image.height;\n
      • Set
        image.setWidth(width);\n// image.setWidth(width, true);  // Resize and keep aspect- ratio\nimage.setHeight(height);\n// image.setHeight(height, true);  // Resize and keep aspect- ratio\n
    "},{"location":"dynamictext/#for-each-child","title":"For each child","text":"
    • Any child
      • For each active child
        txt.forEachChild(function(child, childIndex){\n}, scope)\n
      • For each character child
        txt.forEachChild(function(child, childIndex){\n}, scope, false);\n
    • Renderable child
      • For each active renderable child
        txt.forEachRenderableChild(function(child, charIndex){\n}, scope)\n
      • For each renderable child
        txt.forEachRenderableChild(function(child, charIndex){\n}, scope, false);\n
    • Character child
      • For each active character child
        txt.forEachCharChild(function(child, charIndex){\n}, scope)\n
      • For each character child
        txt.forEachCharChild(function(child, charIndex){\n}, scope, false);\n
    "},{"location":"dynamictext/#get-children","title":"Get children","text":"
    • Get all children
      var children = txt.getChildren();\n
    • Get last appended children
      var children = txt.getLastAppendedChildren();\n
    • Get active children, after wrapping
      var children = txt.getActiveChildren();\n
    "},{"location":"dynamictext/#get-character-children","title":"Get character children","text":"
    • Get active character children
      var children = txt.getCharChildren();\n
    • Get all character children
      var children = txt.getCharChildren(false);\n
    • Get character child by character index
      var child = txt.getCharChild(charIndex);\n
    "},{"location":"dynamictext/#move-child","title":"Move child","text":"
    • Move child to fist
      txt.moveChildToFist(child);\n
    • Move child to last
      txt.moveChildToLast(child);\n
    • Move child up
      txt.movechildUp(child);\n
    • Move child to down
      txt.movechildDown(child);\n
    • Move child above another child
      txt.movechildAbove(child, baseChild);\n
    • Move child below another child
      txt.movechildBelow(child, baseChild);\n
    "},{"location":"dynamictext/#size","title":"Size","text":"
    • Resize canvas size
      txt.setCanvasSize(width, height)\n
    • Reisze text wrapping size and canvas size.
      txt.setSize(width, height);\n
      or
      txt.setFixedSize(width, height);\n
    • Resize to minimun size to show all visible characters.
      txt.setToMinSize();\n
    "},{"location":"dynamictext/#input-events-of-child","title":"Input events of child","text":"
    • Enable input events of child on config of constructor, or via method
      txt.setChildrenInteractiveEnable();\n
    • Pointer down/up on child
      txt.on('child.pointerdown', function(child, pointer, localX, localY, event) {        })\n
      txt.on('child.pointerup', function(child, pointer, localX, localY, event) {        })\n
      • child : Any Character or Image child
    • Pointer over/out on child
      txt.on('child.pointerover', function(child, pointer, localX, localY, event) {        })\n
      txt.on('child.pointerout', function(child, pointer, localX, localY, event) {        })\n
      • child : Any Character or Image child
    "},{"location":"dynamictext/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"dynamictext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"dynamictext/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"dynamictext/#compare-with-other-kinds-of-text-game-object","title":"Compare with other kinds of text game object","text":"
    • Built-in text:
      • Single color per game object.
      • Draw content line by line.
      • Best render performance.
    • BBCode text:
      • Multiple colors, multiple font size per gaem object.
      • Draw content segment by segment.
      • Slower than built-in text game object.
    • Dynamic text:
      • Multiple colors, multiple font size per gaem object.
      • Draw content character by character.
      • Slower than bbcode text game object.
    "},{"location":"ease-function/","title":"Ease","text":""},{"location":"ease-function/#introduction","title":"Introduction","text":"

    Ease functions, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"ease-function/#usage","title":"Usage","text":""},{"location":"ease-function/#ease-functions","title":"Ease functions","text":"
    • Linear : Phaser.Math.Easing.Linear
    • Quadratic, Power1
      • Quadratic ease-out : Phaser.Math.Easing.Quadratic.Out
      • Quadratic ease-in : Phaser.Math.Easing.Quadratic.In
      • Quadratic ease-in/out : Phaser.Math.Easing.Quadratic.InOut
    • Cubic, Power2
      • Cubic ease-out : Phaser.Math.Easing.Cubic.Out
      • Cubic ease-in : Phaser.Math.Easing.Cubic.In
      • Cubic ease-in/out : Phaser.Math.Easing.Cubic.InOut
    • Quartic, Power3
      • Quartic ease-out : Phaser.Math.Easing.Quartic.Out
      • Quartic ease-in : Phaser.Math.Easing.Quartic.In
      • Quartic ease-in/out : Phaser.Math.Easing.Quartic.InOut
    • Quintic, Power4
      • Quintic ease-out : Phaser.Math.Easing.Quintic.Out
      • Quintic ease-in : Phaser.Math.Easing.Quintic.In
      • Quintic ease-in/out : Phaser.Math.Easing.Quintic.InOut
    • Sinusoidal
      • Sinusoidal ease-out : Phaser.Math.Easing.Sine.Out
      • Sinusoidal ease-in : Phaser.Math.Easing.Sine.In
      • Sinusoidal ease-in/out : Phaser.Math.Easing.Sine.InOut
    • Exponential
      • Exponential ease-out : Phaser.Math.Easing.Expo.Out
      • Exponential ease-in : Phaser.Math.Easing.Expo.In
      • Exponential ease-in/out : Phaser.Math.Easing.Expo.InOut
    • Circular
      • Circular ease-out : Phaser.Math.Easing.Circular.Out
      • Circular ease-in : Phaser.Math.Easing.Circular.In
      • Circular ease-in/out : Phaser.Math.Easing.Circular.InOut
    • Elastic
      • Elastic ease-out : Phaser.Math.Easing.Elastic.Out
      • Elastic ease-in : Phaser.Math.Easing.Elastic.In
      • Elastic ease-in/out : Phaser.Math.Easing.Elastic.InOut
    • Bounce
      • Bounce ease-out : Phaser.Math.Easing.Bounce.Out
      • Bounce ease-in : Phaser.Math.Easing.Bounce.In
      • Bounce ease-in/out : Phaser.Math.Easing.Bounce.InOut
    • Back
      • Back ease-out : Phaser.Math.Easing.Back.Out
      • Back ease-in : Phaser.Math.Easing.Back.In
      • Back ease-in/out : Phaser.Math.Easing.Back.InOut
    • Stepped : Phaser.Math.Easing.Stepped(v, step)
    "},{"location":"ease-function/#get-ease-function-via-string","title":"Get ease function via string","text":"
    var easeFunction = Phaser.Tweens.Builders.GetEaseFunction(ease);\n// var easeFunction = Phaser.Tweens.Builders.GetEaseFunction(ease, easeParams);\n
    • ease :
      • A string :
        • Power0 : Linear
        • Power1 : Quadratic.Out
        • Power2 : Cubic.Out
        • Power3 : Quartic.Out
        • Power4 : Quintic.Out
        • Linear
        • Quad : Quadratic.Out
        • Cubic : Cubic.Out
        • Quart : Quartic.Out
        • Quint : Quintic.Out
        • Sine : Sine.Out
        • Expo : Expo.Out
        • Circ : Circular.Out
        • Elastic : Elastic.Out
        • Back : Back.Out
        • Bounce : Bounce.Out
        • Stepped
        • Quad.easeIn
        • Cubic.easeIn
        • Quart.easeIn
        • Quint.easeIn
        • Sine.easeIn
        • Expo.easeIn
        • Circ.easeIn
        • Back.easeIn
        • Bounce.easeIn
        • Quad.easeOut
        • Cubic.easeOut
        • Quart.easeOut
        • Quint.easeOut
        • Sine.easeOut
        • Expo.easeOut
        • Circ.easeOut
        • Back.easeOut
        • Bounce.easeOut
        • Quad.easeInOut
        • Cubic.easeInOut
        • Quart.easeInOut
        • Quint.easeInOut
        • Sine.easeInOut
        • Expo.easeInOut
        • Circ.easeInOut
        • Back.easeInOut
        • Bounce.easeInOut
      • A custom function
        function(v) {\nreturn v;\n}\n
        function(v, param0, param1, ...) {\nreturn v;\n}\n
        • v : 0 ~ 1
    "},{"location":"ease-function/#get-result","title":"Get result","text":"
    var result = easeFunction(t);\n
    • t : 0 ~ 1
    "},{"location":"easedata/","title":"Ease-data","text":""},{"location":"easedata/#introduction","title":"Introduction","text":"

    Easing data value of game object's data-manager.

    • Author: Rex
    • Method only
    "},{"location":"easedata/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"easedata/#install-plugin","title":"Install plugin","text":""},{"location":"easedata/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeasedataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeasedataplugin.min.js', true);\n
    • Add ease-data behavior
      var easedata = scene.plugins.get('rexeasedataplugin').add(gameObject);\n
    "},{"location":"easedata/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import EaseDataPlugin from 'phaser3-rex-plugins/plugins/easedata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEaseData',\nplugin: EaseDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add ease-data behavior
      var easedata = scene.plugins.get('rexEaseData').add(gameObject);\n
    "},{"location":"easedata/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import { EaseData } from 'phaser3-rex-plugins/plugins/easedata.js';\n
    • EaseData-out-destroy
      var easedata = new EaseData(gameObject);\n
    "},{"location":"easedata/#create-instance","title":"Create instance","text":"
    var easedata = scene.plugins.get('rexEaseData').add(gameObject);\n
    "},{"location":"easedata/#ease-data","title":"Ease data","text":"
    • Start
      easedata.easeTo(key, value, duration);\n// easedata.easeTo(key, value, duration, ease);\n
      or
      easedata.easeTo({\nkey:key,\nvalue:value,\nduration:1000,\nease:'Linear'\n});\n
      or
      easedata.easeTo({\nkey:key,\nvalue:value,\nspeed: 10,    // value changing rate, per second\nease:'Linear'\n});\n
    • Stop
      easedata.stopEase(key);           // Set to end value\n// easedata.stopEase(key, false); // Stop at current value\n
      or
      easedata.stopAll();           // Set to end value\n// easedata.stopAll(false);   // Stop at current value\n
    "},{"location":"easedata/#events","title":"Events","text":"
    • Easing complete
      easedata.on('complete-' + key, function(gameObject, easedata){\n\n}, scope);\n
      easedata.on('complete', function(key, gameObject, easedata){\n\n}, scope);\n
    "},{"location":"easemove/","title":"Ease-move","text":""},{"location":"easemove/#introduction","title":"Introduction","text":"

    Ease-move game object.

    • Author: Rex
    • Method only
    "},{"location":"easemove/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"easemove/#install-plugin","title":"Install plugin","text":""},{"location":"easemove/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeasemoveplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeasemoveplugin.min.js', true);\n
    • Ease-move to/from
      var easemove = scene.plugins.get('rexeasemoveplugin').moveTo(gameObject, duration, x, y, ease);\nvar easemove = scene.plugins.get('rexeasemoveplugin').moveFrom(gameObject, duration, x, y, ease);\n
    "},{"location":"easemove/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import EaseMovePlugin from 'phaser3-rex-plugins/plugins/easemove-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEaseMove',\nplugin: EaseMovePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Ease-move to/from
      var easemove = scene.plugins.get('rexEaseMove').moveTo(gameObject, duration, x, y, ease);\nvar easemove = scene.plugins.get('rexEaseMove').moveFrom(gameObject, duration, x, y, ease);\n
    "},{"location":"easemove/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import { EaseMoveTo, EaseMoveFrom } from 'phaser3-rex-plugins/plugins/easemove.js';\n
    • EaseMove-out-destroy
      var easemove = EaseMoveTo(gameObject, duration, x, y, ease);\nvar easemove = EaseMoveFrom(gameObject, duration, x, y, ease);\n
    "},{"location":"easemove/#move-to","title":"Move to","text":"
    var easemove = scene.plugins.get('rexEaseMove').moveTo(gameObject, duration, x, y);\n// var easemove = scene.plugins.get('rexEaseMove').moveTo(gameObject, duration, x, y, ease);\n// easemove = scene.plugins.get('rexEaseMove').moveTo(gameObject, duration, x, y, ease, easemove);\n
    • x, y : End position.
      • Number : End position x/y.
      • String(+=300) : Related position of current position x/y.
      • undefined : Don't move along x/y axis.
    • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • easemove : Ease-move behavior.
    "},{"location":"easemove/#move-from","title":"Move from","text":"
    var easemove = scene.plugins.get('rexEaseMove').moveFrom(gameObject, duration, x, y);\n// var easemove = scene.plugins.get('rexEaseMove').moveFrom(gameObject, duration, x, y, ease);\n// easemove = scene.plugins.get('rexEaseMove').moveFrom(gameObject, duration, x, y, ease, easemove);\n
    • x, y : Start position.
      • Number : Start position x/y.
      • String(-=300) : Related position of current position x/y.
      • undefined : Don't move along x/y axis.
    • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • easemove : Ease-move behavior.
    "},{"location":"easemove/#events","title":"Events","text":"

    See Events of tween task

    • Move completes or is stopped.
      easemove.on('complete', function(gameObject, easemove){\n\n}, scope);\n
    "},{"location":"easemove/#inject-methods","title":"Inject methods","text":"
    • Inject methods into game object
      scene.plugins.get('rexEaseMove').injectMethods(gameObject);\n
    • Inject methods into class of game object
      scene.plugins.get('rexEaseMove').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexEaseMove').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into class of game object
      scene.plugins.get('rexEaseMove').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexEaseMove').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into root class of game object
      scene.plugins.get('rexEaseMove').injectMethodsToRootClass(e);\n// scene.plugins.get('rexEaseMove').injectMethods(Phaser.GameObjects.GameObject.prototype);\n
    "},{"location":"easemove/#injected-methods","title":"Injected methods","text":"
    • Move from
      gameObject.moveFrom(duration, x, y);\n// gameObject.moveFrom(duration, x, y, ease);\n// gameObject.moveFrom({x, y, duration, ease});\n// gameObject.moveFrom({x, y, speed, ease});\n
      or
      gameObject\n.moveFromPromise(duration, x, y, ease)\n// .moveFromPromise({x, y, duration, ease})\n// .moveFromPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
      • x, y : Start position.
        • Number : Start position x/y.
        • String(+=300) : Related position of current position x/y.
        • undefined : Current position x/y.
      • speed : Get duration according to speed and distance between current gameObject position to {x, y}
      • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • Move-from destroy
      gameObject.moveFromDestroy(duration, x, y);\n// gameObject.moveFrom(duration, x, y, ease);\n// gameObject.moveFrom({x, y, duration, ease});\n// gameObject.moveFrom({x, y, speed, ease});\n
      or
      gameObject\n.moveFromDestroyPromise(duration, x, y, ease)\n// .moveFromDestroyPromise({x, y, duration, ease})\n// .moveFromDestroyPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
    • Move to
      gameObject.moveTo(duration, x, y);\n// gameObject.moveTo(duration, x, y, ease);\n// gameObject.moveTo({x, y, duration, ease});\n// gameObject.moveTo({x, y, speed, ease});\n
      or
      gameObject\n.moveToPromise(duration, x, y, ease)\n// .moveToPromise({x, y, duration, ease})\n// .moveToPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
      • x, y : End position.
        • Number : End position x/y.
        • String(+=300) : Related position of current position x/y.
        • undefined : Current position x/y.
      • speed : Get duration according to speed and distance between current gameObject position to {x, y}
      • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • Move-to destroy
      gameObject.moveToDestroy(duration, x, y);\n// gameObject.moveTo(duration, x, y, ease);\n// gameObject.moveTo({x, y, duration, ease});\n// gameObject.moveTo({x, y, speed, ease});\n
      or
      gameObject\n.moveToDestroyPromise(duration, x, y, ease)\n// .moveToDestroyPromise({x, y, duration, ease})\n// .moveToDestroyPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
    • Move-stop
      gameObject.moveStop();\n// gameObject.moveStop(true);  // Set to end position\n
    • Events
      • Move-from complete
        gameObject.on('movefrom.complete', function(gameObject) { });\n
      • Move-to complete
        gameObject.on('moveto.complete', function(gameObject) { });\n
    "},{"location":"effect-properties/","title":"Effect properties","text":""},{"location":"effect-properties/#introduction","title":"Introduction","text":"

    Attach properties to a game object or camera, to add/remove/control builtin preFX or postFX effects.

    • Author: Rex
    • Method only
    • Pre-fx, and Post-fx shader effects

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"effect-properties/#live-demos","title":"Live demos","text":"
    • Color effects
    • Reveal
    • Interactive
    • Camera
    "},{"location":"effect-properties/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"effect-properties/#install-plugin","title":"Install plugin","text":""},{"location":"effect-properties/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeffectpropertiesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeffectpropertiesplugin.min.js', true);\n
    • Attach properties to a game object/camera.
      scene.plugins.get('rexeffectpropertiesplugin').add(gameObject);\n
      scene.plugins.get('rexeffectpropertiesplugin').add(camera);\n
    "},{"location":"effect-properties/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import EffectPropertiesPlugin from 'phaser3-rex-plugins/plugins/effectproperties-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEffectProperties',\nplugin: EffectPropertiesPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Attach properties to a game object/camera.
      scene.plugins.get('rexEffectProperties').add(gameObject);\n
      scene.plugins.get('rexEffectProperties').add(camera);\n
    "},{"location":"effect-properties/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import AddEffectPropertiesProperties from 'phaser3-rex-plugins/plugins/effectproperties.js';\n
    • Attach properties to a game object/camera.
      AddEffectPropertiesProperties(gameObject);\n
      AddEffectPropertiesProperties(camera);\n
    "},{"location":"effect-properties/#attach-properties","title":"Attach properties","text":"

    Supported effects are barrel, blackWhite, bloom, blur, bokeh, brightness, brown, circle, contrast, desaturate, desaturateLuminance, displacement, glow, gradient, grayscale, hue, kodachrome, lsd, negative, pixelate, polaroid, reveal, saturate, sepia, shadow, shiftToBGR, shine, technicolor, tiltShift, vignette, vintagePinhole, wipe.

    • Attatch properties of all effects to a game object/camera.
      scene.plugins.get('rexEffectProperties').add(gameObject);\n
      scene.plugins.get('rexEffectProperties').add(camera);\n
    • Attatch properties of some preFX/postFX effects to a game object/camera.
      scene.plugins.get('rexEffectProperties').add(gameObject, {\nbarrel: true,\nblackWhite: true,\nbloom: true,\nblur: true,\nbokeh: true,\nbrightness: true,\nbrown: true,\ncircle: true,\ncontrast: true,\ndesaturate: true,\ndesaturateLuminance: true,\ndisplacement: true,\nglow: true,\ngradient: true,\ngrayscale: true,\nhue: true,\nkodachrome: true,\nlsd: true,\nnegative: true,\npixelate: true,\npolaroid: true,\nreveal: true,\nsaturate: true,\nsepia: true,\nshadow: true,\nshiftToBGR: true,\nshine: true,\ntechnicolor: true,\ntiltShift: true,\nvignette: true,\nvintagePinhole: true,\nwipe: true,\n});\n
      or
      scene.plugins.get('rexEffectProperties').add(gameObject, [\n'barrel', 'blackWhite', 'bloom', 'blur', 'bokeh', 'brightness', 'brown',\n'circle', 'contrast',\n'desaturate', 'desaturateLuminance', 'displacement',\n'glow', 'gradient', 'grayscale',\n'hue',\n'kodachrome',\n'lsd',\n'negative',\n'pixelate', 'polaroid',\n'reveal',\n'saturate', 'sepia', 'shadow', 'shiftToBGR', 'shine',\n'technicolor', 'tiltShift',\n'vignette', 'vintagePinhole',\n'wipe'\n]);\n
      or
      scene.plugins.get('rexEffectProperties').add(gameObject, effectName);\n
      • A plain object with effect names.
      • A list of effect name string.
      • A effect name string.
    "},{"location":"effect-properties/#effect-properties","title":"Effect properties","text":"

    Will try to create preFX effect if gameObject has preFX, otherwise, try to create postFX effect.

    "},{"location":"effect-properties/#barrel","title":"Barrel","text":"
    • barrel :
      • A number : Enable this effect and set intensity of barrel (1: origin).
      • null : Remove this effect
    "},{"location":"effect-properties/#blackwhite","title":"BlackWhite","text":"
    • blackWhite :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#bloom","title":"Bloom","text":"
    • bloomColor :
      • A number : Enable this effect and set color of bloom (0xffffff).
      • null : Remove this effect
    • bloomOffsetX, bloomOffsetY, bloomBlurStrength, bloomStrength, bloomSteps :
      • A number
    "},{"location":"effect-properties/#blur","title":"Blur","text":"
    • blurColor :
      • A number : Enable this effect and set color of blur (0xffffff).
      • null : Remove this effect
    • blurQuality, blurX, blurY, blurStrength, blurSteps :
      • A number
    "},{"location":"effect-properties/#bokeh","title":"Bokeh","text":"
    • bokehRadius :
      • A number : Enable this effect and set radius of bokeh (0~1).
      • null : Remove this effect
    • bokehAmount, bokehContrast :
      • A number
    "},{"location":"effect-properties/#brightness","title":"Brightness","text":"
    • brightness :
      • A number : Enable this effect and set brightness (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#brown","title":"Brown","text":"
    • brown :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#circle","title":"Circle","text":"
    • circleColor :
      • A number : Enable this effect and set color of circle (0xffffff).
      • null : Remove this effect
    • circleThickness, circleBackgroundColor, circleBackgroundAlpha, circleScale, circleFeather :
      • A number
    "},{"location":"effect-properties/#contrast","title":"Contrast","text":"
    • contrast :
      • A number : Enable this effect and set contrast (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#desaturate","title":"Desaturate","text":"
    • desaturate :
      • A number : Enable this effect and set desaturate (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#desaturateluminance","title":"DesaturateLuminance","text":"
    • desaturateLuminance :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#displacement","title":"Displacement","text":"
    • displacementKey :
      • A string : Enable this effect and set displacement reference texture.
      • null : Remove this effect
    • displacementX, displacementY :
      • A number
    "},{"location":"effect-properties/#glow","title":"Glow","text":"
    • glowColor :
      • A number : Enable this effect and set color of glow (0xffffff).
      • null : Remove this effect
    • glowOuterStrength, glowInnerStrength :
      • A number
    "},{"location":"effect-properties/#gradient","title":"Gradient","text":"
    • gradientColor :
      • [number, number] : Enable this effect and set gradient color1 and gradient color2 (0xffffff).
      • null : Remove this effect
    • gradientAlpha, gradientFromX, gradientFromY, gradientToX, gradientToY, gradientSize :
      • A number
    "},{"location":"effect-properties/#grayscale","title":"Grayscale","text":"
    • grayscale :
      • A number : Enable this effect and set intensity of grayscale (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#hue","title":"Hue","text":"
    • hue :
      • A number : Enable this effect and set hue rotation, in degrees.
      • null : Remove this effect
    "},{"location":"effect-properties/#kodachrome","title":"Kodachrome","text":"
    • kodachrome :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#lsd","title":"Lsd","text":"
    • lsd :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#negative","title":"Negative","text":"
    • negative :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#pixelate","title":"Pixelate","text":"
    • pixelate :
      • A number : Enable this effect and set size of pixelate, in pixels.
      • null : Remove this effect
    "},{"location":"effect-properties/#polaroid","title":"Polaroid","text":"
    • polaroid :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#reveal","title":"Reveal","text":"
    • revealLeft, revealRight, revealUp, or revealDown :
      • A number : Enable this effect with specific reveal direction and set progress (0~1).
      • null : Remove this effect
    • revealWidth :
      • A number
    "},{"location":"effect-properties/#saturate","title":"Saturate","text":"
    • saturate :
      • A number : Enable this effect and set saturate (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#sepia","title":"Sepia","text":"
    • sepia :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#shadow","title":"Shadow","text":"
    • shadowColor :
      • A number : Enable this effect and set color of shadow (0xffffff).
      • null : Remove this effect
    • shadowX, shadowY, shadowDecay, shadowPower, shadowSamples, shadowIntensity :
      • A number
    "},{"location":"effect-properties/#shifttobgr","title":"ShiftToBGR","text":"
    • shiftToBGR :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#shine","title":"Shine","text":"
    • shineSpeed :
      • A number : Enable this effect and set speed of shine, in seconds.
      • null : Remove this effect
    • shineLineWidth, shineGradient :
      • A number
    "},{"location":"effect-properties/#technicolor","title":"Technicolor","text":"
    • technicolor :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#tiltshift","title":"TiltShift","text":"
    • tiltShiftRadius :
      • A number : Enable this effect and set radius of tiltShift (0~1).
      • null : Remove this effect
    • tiltShiftAmount, tiltShiftContrast, tiltShiftBlurX, tiltShiftBlurY, tiltShiftStrength :
      • A number
    "},{"location":"effect-properties/#vignette","title":"Vignette","text":"
    • vignetteRadius :
      • A number : Enable this effect and set radius of vignette (0~1).
      • null : Remove this effect
    • vignetteX, vignetteY, vignetteStrength :
      • A number
    "},{"location":"effect-properties/#vintagepinhole","title":"VintagePinhole","text":"
    • vintagePinhole :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#wipe","title":"Wipe","text":"
    • wipeLeft, wipeRight, wipeUp, or wipeDown :
      • A number : Enable this effect with specific wipe direction and set progress (0~1).
      • null : Remove this effect
    • wipeWidth :
      • A number
    "},{"location":"effect-properties/#clear-all-effects","title":"Clear all effects","text":"
    gameObject.clearAllEffects();\n
    "},{"location":"effectlayer-outline/","title":"Effectlayer outline","text":""},{"location":"effectlayer-outline/#introduction","title":"Introduction","text":"

    Draw outline of target game objects.

    • Author: Rex
    • Game object
    "},{"location":"effectlayer-outline/#live-demos","title":"Live demos","text":"
    • Outline
    "},{"location":"effectlayer-outline/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"effectlayer-outline/#install-plugin","title":"Install plugin","text":""},{"location":"effectlayer-outline/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexoutlineeffectlayerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexoutlineeffectlayerplugin.min.js', true);\n
    • Add outline effect layer object
      var effectLayer = scene.add.rexOutlineEffectLayer(config);\n
    "},{"location":"effectlayer-outline/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import OutlineEffectLayerPlugin from 'phaser3-rex-plugins/plugins/outlineeffectlayer-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexOutlineEffectLayerPlugin',\nplugin: OutlineEffectLayerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add outline effect layer object
      var effectLayer = scene.add.rexOutlineEffectLayer(config);\n
    "},{"location":"effectlayer-outline/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import OutlineEffectLayer from 'phaser3-rex-plugins/plugins/outlineeffectlayer.js';\n
    • Add outline effect layer object
      var effectLayer = new OutlineEffectLayer(scene, config);\nscene.add.existing(effectLayer);\n
    "},{"location":"effectlayer-outline/#create-instance","title":"Create instance","text":"
    var effectLayer = scene.add.rexOutlineEffectLayer({\n// knockout: false,\n// thickness: 3,\n// outlineColor: 0x000000\n});\n
    • knockout :
      • true : Draw outline only.
      • false : Draw source texture and outline both.
    • thickness : Thickness of outline.
    • outlineColor : Color of outline.
    "},{"location":"effectlayer-outline/#custom-class","title":"Custom class","text":"
    • Define class
      class MyOutlineEffectLayer extends OutlineEffectLayer {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var effectLayer = new MyOutlineEffectLayer(scene, config);\n
    "},{"location":"effectlayer-outline/#thickness","title":"Thickness","text":"
    • Get
      var thickness = effectLayer.thickness;\n
    • Set
      effectLayer.thickness = thickness;\n// effectLayer.thickness += value;\n
      or
      effectLayer.setThickness(value);\n
    "},{"location":"effectlayer-outline/#outline-color","title":"Outline color","text":"
    • Get
      var color = effectLayer.outlineColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      effectLayer.setOutlineColor(value);\n
      effectLayer.outlineColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"effectlayer-outline/#target-game-objects","title":"Target game objects","text":"

    Draw outline of added target game objects.

    • Add
      effectLayer.add(gameObject);\n
    • Remove
      effectLayer.remove(gameObject);\n
    • Clear
      effectLayer.clear();\n
    • Contains
      var hasGameObject = effectLayer.contains(gameObject);\n
    "},{"location":"effectlayer-outline/#limitation","title":"Limitation","text":"
    • Can't support if camera.zoom is less then 1

    • Can't support if camera.startFollow(gameObject), i.e. please scroll camera before target game objects draw on effect layer game object.

    "},{"location":"eightdirection/","title":"8 direction","text":""},{"location":"eightdirection/#introduction","title":"Introduction","text":"

    Move game object by cursor keys, with a constant speed.

    • Author: Rex
    • Arcade behavior of game object
    "},{"location":"eightdirection/#live-demos","title":"Live demos","text":"
    • Virtual-joyStick + Eight-direction
    "},{"location":"eightdirection/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"eightdirection/#install-plugin","title":"Install plugin","text":""},{"location":"eightdirection/#load-minify-file","title":"Load minify file","text":"
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeightdirectionplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeightdirectionplugin.min.js', true);\n
    • Add eight-direction behavior
      var eightDirection = scene.plugins.get('rexeightdirectionplugin').add(gameObject, config);\n
    "},{"location":"eightdirection/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine and install plugin in configuration of game
      import EightDirectionPlugin from 'phaser3-rex-plugins/plugins/eightdirection-plugin.js';\nvar config = {\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEightDirection',\nplugin: EightDirectionPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add eight-direction behavior
      var eightDirection = scene.plugins.get('rexEightDirection').add(gameObject, config);\n
    "},{"location":"eightdirection/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Import class
      import EightDirection from 'phaser3-rex-plugins/plugins/eightdirection.js';\n
    • Add eight-direction behavior
      var eightDirection = new EightDirection(gameObject, config);\n
    "},{"location":"eightdirection/#create-instance","title":"Create instance","text":"
    var eightDirection = scene.plugins.get('rexEightDirection').add(gameObject, {\nspeed: 200,\n// dir: '8dir',     // 0|'up&down'|1|'left&right'|2|'4dir'|3|'8dir'\n// rotateToDirection: false,\n// wrap: false,\n// padding: 0,\n// enable: true,\n// cursorKeys: scene.input.keyboard.createCursorKeys()\n});\n
    • speed : moving speed, pixels in second.
    • dir :
      • 'up&down', or 0 :Aaccept up or down cursor keys only.
      • 'left&right', or 1 : Aaccept left or right cursor keys only.
      • '4dir', or 2 : Aaccept up, down, left or right cursor keys.
      • '8dir', or 3 : Aaccept up, up-left, up-right, down, down-left, down-right, left, or right cursor keys.
    • rotateToDirection : Set true to change angle towards moving direction.
    • Wrap
      • wrap : Set true to enable wrap mode. Default value is false.
      • padding
    • enable : set false to disable moving.
    • cursorKeys : CursorKey object, using keyboard's cursorKeys by default.
    "},{"location":"eightdirection/#set-speed","title":"Set speed","text":"
    eightDirection.setSpeed(speed);\n// eightDirection.speed = speed;\n
    "},{"location":"eightdirection/#set-rotate-to-direction","title":"Set rotate-to-direction","text":"
    eightDirection.setRotateToDirection(rotateToDirection);\n
    • rotateToDirection : Set true to change angle towards moving direction
    "},{"location":"eightdirection/#set-direction-mode","title":"Set direction mode","text":"
    eightDirection.setDirMode(dir);\n
    • dir :
      • 'up&down', or 0 :Aaccept up or down cursor keys only.
      • 'left&right', or 1 : Aaccept left or right cursor keys only.
      • '4dir', or 2 : Aaccept up, down, left or right cursor keys.
      • '8dir', or 3 : Aaccept up, up-left, up-right, down, down-left, down-right, left, or right cursor keys.
    "},{"location":"eightdirection/#set-wrap-mode","title":"Set wrap mode","text":"
    ship.setWrapMode(wrap, padding);\n
    • wrap : Set true to enable wrap mode.
    "},{"location":"eventemitter3/","title":"Event emitter","text":""},{"location":"eventemitter3/#introduction","title":"Introduction","text":"

    Event emitter.

    "},{"location":"eventemitter3/#usage","title":"Usage","text":""},{"location":"eventemitter3/#get-event-emitter","title":"Get event emitter","text":"
    • Scene:
      var ee = scene.events;\n
    • Game object:
      var ee = gameObject;\n
    "},{"location":"eventemitter3/#attach-listener","title":"Attach listener","text":"
    ee.on(eventName, callback, scope);\nee.once(eventName, callback, scope);  // only fire listeners one time\n

    Alias

    ee.addListener(eventName, callback, scope);\nee.addListener(eventName, callback, scope, true);  // only fire listeners one time\n
    "},{"location":"eventemitter3/#fire-event","title":"Fire event","text":"
    ee.emit(eventName, parameter0, ...);\n
    "},{"location":"eventemitter3/#remove-listeners","title":"Remove listeners","text":"
    • Remove a linstener
      ee.off(eventName, callback, scope);\nee.off(eventName, callback, scope, true);   // only remove one-time listeners\n
      or
      ee.removeListener(eventName, callback, scope); ee.removeListener(eventName, callback, scope, true);  // only remove one-time listeners\n
    • Remove listeners of an event
      ee.off(eventName);\n
      or
      ee.removeListener(eventName); 
    • Remove listeners of all events
      ee.removeAllListeners();\n
    "},{"location":"eventemitter3/#get-listeners-count","title":"Get listeners count","text":"
    var count = ee.listenerCount(eventName);\n//var noListener = (ee.listenerCount(eventName) === 0);\n
    "},{"location":"eventemitter3/#get-listeners","title":"Get listeners","text":"
    var listeners = ee.listeners(eventName);\n
    "},{"location":"eventemitter3/#get-event-names","title":"Get event names","text":"
    var names = ee.eventNames();\n
    "},{"location":"eventemitter3/#listener","title":"Listener","text":"
    {\nfn: callback,\ncontext: scope,\nonce: once\n}\n
    "},{"location":"eventemitter3/#custom-event-emitter-class","title":"Custom event emitter class","text":"
    class MyEventEmitter extends Phaser.Events.EventEmitter {\n// construct() {\n//     super();\n// }\n\n// destroy() {\n//     super.destroy();\n// }\n}\n
    "},{"location":"eventpromise/","title":"Event promise","text":""},{"location":"eventpromise/#introduction","title":"Introduction","text":"

    Return a promise of an event.

    • Author: Rex
    • Method only
    "},{"location":"eventpromise/#live-demos","title":"Live demos","text":"
    • Wait complete
    "},{"location":"eventpromise/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"eventpromise/#install-plugin","title":"Install plugin","text":""},{"location":"eventpromise/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeventpromiseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeventpromiseplugin.min.js', true);\n
    • Get event promise
      var promoise = scene.plugins.get('rexeventpromiseplugin').waitEvent(eventEmitter, eventName);\n// var promoise = scene.plugins.get('rexeventpromiseplugin').waitComplete(eventEmitter);\n
    "},{"location":"eventpromise/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import EventPromisePlugin from 'phaser3-rex-plugins/plugins/eventpromise-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEventPromise',\nplugin: EventPromisePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Get event promise
      var promoise = scene.plugins.get('rexEventPromise').waitEvent(eventEmitter, eventName);\n// var promoise = scene.plugins.get('rexEventPromise').waitComplete(eventEmitter);\n
    "},{"location":"eventpromise/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { WaitEvent, WaitComplete } from 'phaser3-rex-plugins/plugins/eventpromise.js';\n
    • Get event promise
      var promoise = WaitEvent(eventEmitter, eventName);\n// var promoise = WaitComplete(eventEmitter);\n
    "},{"location":"eventpromise/#get-event-promise","title":"Get event promise","text":"
    var promoise = scene.plugins.get('rexEventPromise').waitEvent(eventEmitter, eventName)\n.then(function() {\n\n})\n
    • eventEmitter : Any kind of event emitter. for example, game object, or tween task, or scene event
    "},{"location":"eventpromise/#get-complete-event-promise","title":"Get complete event promise","text":"
    var promoise = scene.plugins.get('rexEventPromise').waitComplete(eventEmitter)\n.then(function() {\n\n})\n
    • eventEmitter : Event emitter which will fire 'complete' event, for example, tween task.
    "},{"location":"expression-parser/","title":"Expression parser","text":""},{"location":"expression-parser/#introduction","title":"Introduction","text":"

    Parse expression string into function. Parser is generated from jison

    • Author: Rex
    • Member of scene
    "},{"location":"expression-parser/#live-demos","title":"Live demos","text":"
    • Dot-notation
    • Custom method
    • Proxy as context
    "},{"location":"expression-parser/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"expression-parser/#install-plugin","title":"Install plugin","text":""},{"location":"expression-parser/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexexpressionparserplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexexpressionparserplugin.min.js', true);\n
    • Add parser
      var parser = scene.plugins.get('rexexpressionparserplugin').add();\n
    • Or, parse expression to function object.
      var f = scene.plugins.get('rexexpressionparserplugin').compile(expressionString);\n// var value = f(context);\n
    "},{"location":"expression-parser/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ExpressionParserPlugin from 'phaser3-rex-plugins/plugins/expressionparser-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexExpressionParserPlugin',\nplugin: ExpressionParserPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add parser
      var parser = scene.plugins.get('rexExpressionParserPlugin').add();\n
    • Or, parse expression to function object.
      var f = scene.plugins.get('rexExpressionParserPlugin').compile(expressionString);\n// var value = f(context);\n
    "},{"location":"expression-parser/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ExpressionParser from 'phaser3-rex-plugins/plugins/expressionparser.js';\n
    • Add parser
      var parser = new ExpressionParser();\n
    "},{"location":"expression-parser/#create-instance","title":"Create instance","text":"
    var parser = scene.plugins.get('rexExpressionParserPlugin').add();\n
    "},{"location":"expression-parser/#execute","title":"Execute","text":""},{"location":"expression-parser/#compile-then-execute","title":"Compile then execute","text":"
    1. Compile expression string into function
      var f = parser.compile(expressionString);\n
      or
      var f = scene.plugins.get('rexExpressionParserPlugin').compile(expressionString);\n
      • expressionString :
        • Number : 1, 1.5, 0xf.
        • Variable : a, $a, _a, a.$b._c_, a['b'].c
        • Arithmetic : +, -, *, \\, %, (, ), ex : '(a + b.c) * 3 + (2 % 3)'.
        • Boolean : >, <, >=, <=, ==, !=, &&, ||, ex '(a > 10) && (a < 30) || (b.c > c)'.
        • Condition : (cond)? v0:v1, ex'(a > b.c)? a:b.c'.
        • Custom method : randomInt(a, b.c).
        • String concat : 'Hello ' + name.
    2. Invoke function
      var value = f(context);\n
      • f : Function object from compiled result.
      • context : Varables used in expression.
        {\na: 10,  // Number\nb: {c: 10},  // Objet with number property\nc: 20,\nrandomInt(a, b) {  // Custom method\nreturn Math.floor(Math.random()*(b-a)+a);\n}\n}\n
    "},{"location":"expression-parser/#execute-directly","title":"Execute directly","text":"
    var value = parser.exec(expressionString, context);\n

    or

    var value = parser.exec(f, context);\n
    "},{"location":"expression-parser/#custom-method","title":"Custom method","text":"
    • Add method into parser instance
      var parser = scene.plugins.get('rexExpressionParserPlugin').add();\nparser.randomInt = function(a, b) {\nreturn Math.floor(Math.random()*(b-a)+a); }\n// var value = parser.exec('randomInt(a, b)', {a:10, b:20});\n
    • Declare method into class of parser
      class MyParser extends ExpressionParser {\nrandomInt(a, b) {\nreturn Math.floor(Math.random()*(b-a)+a); }\n}\nvar parser = new MyParser();\n// var value = parser.exec('randomInt(a, b)', {a:10, b:20});\n
    • Add method into context
      var context = {\na: 10,\nb: 20,\nrandomInt(a, b) {  // Custom method\nreturn Math.floor(Math.random()*(b-a)+a);\n}\n}\nvar value = parser.exec('randomInt(a, b)', context);\n
    "},{"location":"expression-parser/#proxy-as-context","title":"Proxy as context","text":"

    Proxy with has and get handlers could be a context.

    For example, proxy scene data :

    var context = new Proxy({}, {\nhas(target, key) {\nreturn scene.data.has(key);\n},\nget(target, prop) {\nreturn scene.data.get(prop);\n}\n})\n

    or

    var context = scene.plugins.get('rexExpressionParserPlugin').createProxyContext({\nhas(target, key) {\n// return boolean\n},\nget(target, prop) {\n// return any;\n}\n})\n
    "},{"location":"fadeoutdestroy/","title":"Fade out destroy","text":""},{"location":"fadeoutdestroy/#introduction","title":"Introduction","text":"

    Fade out game object then destroy it.

    • Author: Rex
    • Method only
    "},{"location":"fadeoutdestroy/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"fadeoutdestroy/#install-plugin","title":"Install plugin","text":""},{"location":"fadeoutdestroy/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfadeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfadeplugin.min.js', true);\n
    • Fade-out-destroy
      var fade = scene.plugins.get('rexfadeplugin').fadeOutDestroy(gameObject, duration);\n
    "},{"location":"fadeoutdestroy/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FadePlugin from 'phaser3-rex-plugins/plugins/fade-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFade',\nplugin: FadePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Fade-out-destroy
      var fade = scene.plugins.get('rexFade').fadeOutDestroy(gameObject, duration);\n
    "},{"location":"fadeoutdestroy/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import FadeOutDestroy from 'phaser3-rex-plugins/plugins/fade-out-destroy.js';\n
    • Fade-out-destroy
      var fade = FadeOutDestroy(gameObject, duration);\n
    "},{"location":"fadeoutdestroy/#fade-out-destroy","title":"Fade-out-destroy","text":"
    var fade = scene.plugins.get('rexFade').fadeOutDestroy(gameObject, duration);\n
    "},{"location":"fadeoutdestroy/#events","title":"Events","text":"

    See Events of tween task

    • Scale completes or is stopped.
      fade.on('complete', function(gameObject, fade){\n\n}, scope);\n
    "},{"location":"fadeoutdestroy/#inject-methods","title":"Inject methods","text":"
    • Inject methods into game object
      scene.plugins.get('rexFade').injectMethods(gameObject);\n
    • Inject methods into class of game object
      scene.plugins.get('rexFade').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexFade').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into class of game object
      scene.plugins.get('rexFade').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexFade').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into root class of game object
      scene.plugins.get('rexFade').injectMethodsToRootClass(e);\n// scene.plugins.get('rexFade').injectMethods(Phaser.GameObjects.GameObject.prototype);\n
    "},{"location":"fadeoutdestroy/#injected-methods","title":"Injected methods","text":"
    • Fade-in
      gameObject.fadeIn(duration);\n
      or
      gameObject.fadeIn(duration, endAlpha);\n
      or
      gameObject.fadeIn(duration, {start:0, end:1});\n
      or
      gameObject.fadeInPromise(duration, endAlpha)\n.then(function(){\n// ...\n})\n
      or
      gameObject.fadeInPromise(duration, {start:0, end:1})\n.then(function(){\n// ...\n})\n
    • Fade-out destroy
      gameObject.fadeOutDestroy(duration);\n
      or
      gameObject.fadeOutDestroyPromise(duration)\n.then(function(){\n// ...\n})\n
    • Fade-out without destroy
      gameObject.fadeOut(duration);\n
      or
      gameObject.fadeOutPromise(duration)\n.then(function(){\n// ...\n})\n
    • Events
      • Fade-in complete
        gameObject.on('fadein.complete', function(gameObject) { });\n
      • Fade-out, fade-out destroy complete
        gameObject.on('fadeout.complete', function(gameObject) { });\n
    "},{"location":"fadevolume/","title":"Volume fading","text":""},{"location":"fadevolume/#introduction","title":"Introduction","text":"

    Fade-in/fade-out volume of sound.

    • Author: Rex
    • Method only
    "},{"location":"fadevolume/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"fadevolume/#install-plugin","title":"Install plugin","text":""},{"location":"fadevolume/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexsoundfadeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexsoundfadeplugin.min.js', true);\n
    • Sound fade-in/fade-out
      var sound = scene.plugins.get('rexsoundfadeplugin').fadeIn(sound, duration);\nvar sound = scene.plugins.get('rexsoundfadeplugin').fadeOut(sound, duration);\n
    "},{"location":"fadevolume/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SoundFadePlugin from 'phaser3-rex-plugins/plugins/soundfade-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSoundFade',\nplugin: SoundFadePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Sound fade-in/fade-out
      var sound = scene.plugins.get('rexSoundFade').fadeIn(sound, duration);\nvar sound = scene.plugins.get('rexSoundFade').fadeOut(sound, duration);\n
    "},{"location":"fadevolume/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import SoundFade from 'phaser3-rex-plugins/plugins/soundfade.js';\n
    • Sound fade-in/fade-out
      var sound = SoundFade.fadeIn(sound, duration);\nvar sound = SoundFade.fadeOut(sound, duration);\n
    "},{"location":"fadevolume/#fade-in","title":"Fade in","text":"
    • Play and fade in voluem.
      var sound = scene.plugins.get('rexSoundFade').fadeIn(sound, duration);\n// var sound = scene.plugins.get('rexSoundFade').fadeIn(sound, duration, endVolume, startVolume);\n
      • sound : Sound instance, or a key of audio cache.
    "},{"location":"fadevolume/#fade-out","title":"Fade out","text":"
    • Fade out volume then destroy it
      scene.plugins.get('rexSoundFade').fadeOut(sound, duration);\n
      • sound : Sound instance.
    • Fade out volume then stop it
      scene.plugins.get('rexSoundFade').fadeOut(sound, duration, false);\n
      • sound : Sound instance.
    "},{"location":"filechooser/","title":"File chooser","text":""},{"location":"filechooser/#introduction","title":"Introduction","text":"

    Create a transparent file chooser button (<input type=\"file\">).

    • Author: Rex
    • DOM Game object
    "},{"location":"filechooser/#live-demos","title":"Live demos","text":"
    • File chooser button
    • Open file chooser dialog
    "},{"location":"filechooser/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"filechooser/#install-plugin","title":"Install plugin","text":""},{"location":"filechooser/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfilechooserplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfilechooserplugin.min.js', true);\n
    • Add file chooser object
      var fileChooser = scene.add.rexFileChooser(config);\n
    "},{"location":"filechooser/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FileChooserPlugin from 'phaser3-rex-plugins/plugins/filechooser-plugin.js';\nvar config = {    parent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFileChooser',\nplugin: FileChooserPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add file chooser object
      var fileChooser = scene.add.rexFileChooser(config);\n
    "},{"location":"filechooser/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { FileChooser } from 'phaser3-rex-plugins/plugins/filechooser.js';\n
    • Add file chooser object
      var fileChooser = new FileChooser(config);\nscene.add.existing(fileChooser);\n
    "},{"location":"filechooser/#add-file-chooser-object","title":"Add file chooser object","text":"
    var fileChooser = scene.add.rexFileChooser({\naccept: '',\nmultiple: false\n});\n// var fileChooser = scene.add.rexFileChooser(x, y, width, height, config);\n
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    • multiple : Set true to select multiple files.
    "},{"location":"filechooser/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFlieChooser extends FileChooser {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var fileChooser = new MyFlieChooser(scene, x, y, width, height, config);\n
    "},{"location":"filechooser/#sync","title":"Sync","text":"

    Sync position, size and origin to another game object.

    fileChooser.syncTo(gameObject);\n
    "},{"location":"filechooser/#selected-files","title":"Selected files","text":"
    var files = fileChooser.files;\n
    • files : Array of file object.
    "},{"location":"filechooser/#set-accept-filter","title":"Set accept filter","text":"
    fileChooser.setAccept(accept);\n
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    "},{"location":"filechooser/#multiple-files","title":"Multiple files","text":"
    • Enable
      fileChooser.setMultiple();\n
    • Disable
      fileChooser.setMultiple(false);\n
    "},{"location":"filechooser/#events","title":"Events","text":"
    • Selected file(s) changed
      fileChooser.on('change', function(fileChooser) {\nvar files = fileChooser.files;\nif (files.length === 0) { // No selected file\nreturn;\n}\n\nvar file = files[0];\nvar url = URL.createObjectURL(file);\n// ...\n})\n
    "},{"location":"filechooser/#load-file-to-cache","title":"Load file to cache","text":"
    fileChooser.loadFile(file, loaderType, key);\n// fileChooser.loadFile(file, loaderType, key, cahceType);\n

    or

    fileChooser.loadFilePromise(file, loaderType, key, cahceType)\n.then(function(content) {\n\n})\n
    • file : File object, see Events
    • loaderType : image, text, binary, ... See Loader
    • key : Unique string key.
    • cahceType :
      • undefined : Use default value.
    • content : Content of file.
    "},{"location":"filechooser/#create-object-url","title":"Create object URL","text":"
    • Create object url
      var objectURL = URL.createObjectURL(file);\n
    • Release object url
      URL.revokeObjectURL(objectURL);\n
    "},{"location":"filechooser/#open-file-chooser","title":"Open file chooser","text":"

    Failure

    This method won't work at ios.

    Note

    Open a file chooser dialog under any touch event. i.e. User can't open file chooser dialog directly.

    scene.plugins.get('rexFileChooser').open({\n// accept: '',\n// multiple: false,\n// closeDelay: 200\n})\n.then(function(result) {\n// var files = result.files;\n})\n
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    • multiple : Set true to select multiple files.
    • closeDelay : Add a small delay to detect dialog canceled after game focus.
      • File chooser dialog dose not have cancel event.
    • files : Array of selected files.
      • Each file object (files[i]) has properties
        • file.name : File name with file extension.
        • file.type : File type. (ex. 'image/jpeg')
        • file.size : File size in bytes.
        • file.lastModified : Timestamp of last-modified time.
        • file.lastModifiedDate : Date object of last-modified time. Equal to new Data(lastModified).
        • Get object url :
          var objectURL = URL.createObjectURL(file);\n
      • Length files is 0 : User cancels file chooser dialog.
    "},{"location":"filechooser/#enable-clicking-open","title":"Enable clicking-open","text":"
    • Enable
      fileChooser.setOpenEnable();\n// fileChooser.setOpenEnable(true);\n
    • Disable
      fileChooser.setOpenEnable(false)\n
    "},{"location":"filechooser/#other-properties","title":"Other properties","text":"

    See dom game object, game object

    "},{"location":"filechooser/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"filedropzone/","title":"File drop zone","text":""},{"location":"filedropzone/#introduction","title":"Introduction","text":"

    Create a div element for dropping file(s).

    • Author: Rex
    • DOM Game object
    "},{"location":"filedropzone/#live-demos","title":"Live demos","text":"
    • Drop text file
    • Drop image file
    • Interactve with other game objects
    "},{"location":"filedropzone/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"filedropzone/#install-plugin","title":"Install plugin","text":""},{"location":"filedropzone/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfiledropzoneplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfiledropzoneplugin.min.js', true);\n
    • Add file-drop-zone object
      var fileDropZone = scene.add.rexFileDropZone(config);\n
    "},{"location":"filedropzone/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FileDropZonePlugin from 'phaser3-rex-plugins/plugins/filedropzone-plugin.js';\nvar config = {    parent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n}, // ...\nplugins: {\nglobal: [{\nkey: 'rexFileDropZone',\nplugin: FileDropZonePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add file-drop-zone object
      var fileDropZone = scene.add.rexFileDropZone(config);\n
    "},{"location":"filedropzone/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { FileDropZone } from 'phaser3-rex-plugins/plugins/filedropzone.js';\n
    • Add file-drop-zone object
      var fileDropZone = new FileDropZone(config);\nscene.add.existing(fileDropZone);\n
    "},{"location":"filedropzone/#add-file-drop-zone-object","title":"Add file-drop-zone object","text":"
    var fileDropZone = scene.add.rexFileDropZone({\n// style: { },\n\n// dropEnable: true,\n// filters: { filterType: (file, files) => boolean }\n});\n// var fileDropZone = scene.add.rexFileDropZone(x, y, width, height, config);\n
    • style : CSS style of div element.
    • dropEnable :
      • true : Fire drop events when dropping files. Default behavior.
      • false : Won't fire drop events.
    • filters : Filter methods, optional. For example, image files filter, will fire 'drop.image' event
      {\nimage: function(file, files) { return file.name.match(/\\.(jpg|jpeg|png|gif)$/i)\n}\n}\n
    "},{"location":"filedropzone/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFileDropZone extends FileDropZone {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var fileDropZone = new MyFileDropZone(scene, x, y, width, height, config);\n
    "},{"location":"filedropzone/#sync","title":"Sync","text":"

    Sync position, size and origin to another game object.

    fileDropZone.syncTo(gameObject);\n
    "},{"location":"filedropzone/#dropped-files","title":"Dropped files","text":"
    var files = fileDropZone.files;\n
    • files : Array of file object.
    "},{"location":"filedropzone/#events","title":"Events","text":"
    • Drop files
      fileDropZone.on('drop', function(fileDropZone) {\nvar files = fileDropZone.files;\n})\n
    • Drop filtered files
      fileDropZone.on('drop.' + filterType, function(files) {\n})\n
    • Drag-enter/drag-leave/drag-over file(s)
      fileDropZone.on('dragenter', function(fileDropZone) {\n})\n
      fileDropZone.on('dragleave', function(fileDropZone) {\n})\n
      fileDropZone.on('dragover', function(fileDropZone) {\n})\n

    Warning

    Game objects under this file drop zone can't receive touch input events.

    "},{"location":"filedropzone/#enable-drop-events","title":"Enable drop events","text":"
    • Enable
      fileDropZone.setDropEnable();\n// fileDropZone.setDropEnable(true);\n
    • Disable
      fileDropZone.setDropEnable(false);\n
    • Toggle
      fileDropZone.toggleDropEnable();\n
    "},{"location":"filedropzone/#load-file-to-cache","title":"Load file to cache","text":"
    fileDropZone.loadFile(file, loaderType, key);\n// fileDropZone.loadFile(file, loaderType, key, cahceType, onComplete);\n

    or

    fileDropZone.loadFilePromise(file, loaderType, key, cahceType)\n.then(function(content) {\n\n})\n
    • file : File object, see Events
    • loaderType : image, text, binary, ... See Loader
    • key : Unique string key.
    • cahceType :
      • undefined : Use default value.
    • onComplete : Callback invoked when file loaded to cache.
    • content : Content of file.
    "},{"location":"filedropzone/#create-object-url","title":"Create object URL","text":"
    • Create object url
      var objectURL = URL.createObjectURL(file);\n
    • Release object url
      URL.revokeObjectURL(objectURL);\n
    "},{"location":"filedropzone/#other-properties","title":"Other properties","text":"

    See dom game object, game object

    "},{"location":"filedropzone/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"firebase-auth/","title":"Authentication","text":""},{"location":"firebase-auth/#introduction","title":"Introduction","text":"

    It supports authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook and Twitter, and more.

    • Author: Firebase
    "},{"location":"firebase-auth/#usage","title":"Usage","text":"

    Official document

    Sample code

    "},{"location":"firebase-auth/#setup","title":"Setup","text":"
    1. Import firestore
      import firebase from 'firebase/app';\nimport 'firebase/auth';\n
      Firebase has been included in package.json.
    2. Initialize
      var firebaseApp = firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n});\n
    "},{"location":"firebase-auth/#on-sign-insign-out","title":"On sign-in/sign-out","text":"
    firebaseApp.auth().onAuthStateChanged(function (user) {\nif (user) {\n// User is signed in.\nvar displayName = user.displayName;\nvar email = user.email;\nvar emailVerified = user.emailVerified;\nvar photoURL = user.photoURL;\nvar isAnonymous = user.isAnonymous;\nvar uid = user.uid;\nvar providerData = user.providerData;\n// ...\n} else {\n// User is signed out.\n// ...\n}\n});\n
    "},{"location":"firebase-auth/#sign-in-with-facebook","title":"Sign-in with facebook","text":"
    var provider = new firebase.auth.FacebookAuthProvider();\nfirebaseApp.auth().signInWithPopup(provider).then(function (result) {\n// This gives you a Facebook Access Token. You can use it to access the Facebook API.\nvar token = result.credential.accessToken;\n// The signed-in user info.\nvar user = result.user;\n// ...\n}).catch(function (error) {\n// Handle Errors here.\nvar errorCode = error.code;\nvar errorMessage = error.message;\n// The email of the user's account used.\nvar email = error.email;\n// The firebase.auth.AuthCredential type that was used.\nvar credential = error.credential;\n// ...\n});\n
    "},{"location":"firebase-auth/#sign-in-with-google","title":"Sign-in with Google","text":"
    var provider = new firebase.auth.GoogleAuthProvider();\nfirebaseApp.auth().signInWithPopup(provider).then(function (result) {\n// This gives you a Google Access Token. You can use it to access the Google API.\nvar token = result.credential.accessToken;\n// The signed-in user info.\nvar user = result.user;\n// ...\nconsole.log(user);\n}).catch(function (error) {\n// Handle Errors here.\nvar errorCode = error.code;\nvar errorMessage = error.message;\n// The email of the user's account used.\nvar email = error.email;\n// The firebase.auth.AuthCredential type that was used.\nvar credential = error.credential;\n// ...\n});\n
    "},{"location":"firebase-auth/#sign-in-with-password","title":"Sign-in with password","text":"
    • Create new user
      firebaseApp.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {\n// Handle Errors here.\nvar errorCode = error.code;\nvar errorMessage = error.message;\n});\n
    • Sign-in
      firebase.auth().signInWithEmailAndPassword(email, password).catch(function (error) {\n// Handle Errors here.\nvar errorCode = error.code;\nvar errorMessage = error.message;\n});\n
    "},{"location":"firebase-auth/#sign-out","title":"Sign-out","text":"
    firebaseApp.auth().signOut();\n
    "},{"location":"firebase-auth/#current-sign-in-user","title":"Current sign-in user","text":"
    var user = firebaseApp.auth().currentUser;\nif (user != null) {\nvar name = user.displayName;\nvar email = user.email;\nvar photoUrl = user.photoURL;\nvar emailVerified = user.emailVerified;\nvar uid = user.uid;\n}\n
    "},{"location":"firebase-auth/#update-email","title":"Update email","text":"
    user.updateEmail('...').then(function() {\n// Update successful.\n}).catch(function(error) {\n// An error happened.\n});\n
    "},{"location":"firebase-auth/#update-profile","title":"Update profile","text":"
    user.updateProfile({\ndisplayName: '...',\nphotoURL: '...'\n}).then(function() {\n// Update successful.\n}).catch(function(error) {\n// An error happened.\n});\n
    "},{"location":"firebase-auth/#send-a-verification-email","title":"Send a verification email","text":"
    user.sendEmailVerification().then(function() {\n// Email sent.\n}).catch(function(error) {\n// An error happened.\n});\n
    "},{"location":"firebase-broadcast/","title":"Broadcast","text":""},{"location":"firebase-broadcast/#introduction","title":"Introduction","text":"

    Broadcast real-time messages, using firebase-database.

    • Author: Rex
    "},{"location":"firebase-broadcast/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-broadcast/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-broadcast/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add messager object
      var messager = scene.plugins.get('rexfirebaseplugin').add.broadcast(config);\n
    "},{"location":"firebase-broadcast/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add messager object
      var messager = scene.plugins.get('rexFirebase').add.broadcast(config);\n
    "},{"location":"firebase-broadcast/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { Broadcast } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add messager object
      var messager = new Broadcast(config);\n
    "},{"location":"firebase-broadcast/#create-instance","title":"Create instance","text":"
    var messager = scene.plugins.get('rexFirebase').add.broadcast({\nroot: '',\n// senderID: '',\n// senderName: '',\n// receiverID: '',\n// history: 0\n});\n
    • root : Path of this messager.
    • senderID : ID of sender.
    • senderName : Name of sender.
    • receiverID : ID of receiver/channel.
    • history : Stored received (history) messages in client side.
      • 0, or false : No history message stored.
      • -1, or true : Infinity history message stored. i.e. store all messages from starting updating.
      • A number larger then 0 : Length of stored history message.
    "},{"location":"firebase-broadcast/#send-message","title":"Send message","text":"
    1. Set sender in config, or setSender method.
      messager.setSender(userID, userName);\n
      or
      messager.setSender({\nuserID: userID,\nuserName: userName\n});\n
      • userID : User ID of sender.
      • userName : Display name of sender.
    2. Set receiver in config, or setReceiver method.
      messager.setReceiver(receiverID);\n
      • receiverID : ID of receiver/channel.
    3. Send message to receiverID.
      messager.send(message)\n// .then(function() { })\n// .catch(function() { })\n
      • message : A string message, or a JSON data.
    "},{"location":"firebase-broadcast/#receive-messages","title":"Receive messages","text":"
    1. Register receive event
      messager.on('receive', function(data){\n// var senderID = data.senderID;\n// var senderName = data.senderName;\n// var message = data.message;\n})\n
    2. Set receiver in config, or setReceiver method
      messager.setReceiver(receiverID);\n
      • receiverID : ID of receiver/channel.
    3. Start receiving
      messager.startReceiving();\n
    4. Stop receive
      messager.stopReceiving();\n

    Only receive messages after invoking startReceiving method. Previous messages won't be got anymore.

    "},{"location":"firebase-broadcast/#received-messages","title":"Received messages","text":"

    Received messages will be saved in client side.

    • Get received (history) messages.
      var messages = messager.getHistory();\n
    • Clear history messages.
      messager.clearHistory();\n
    "},{"location":"firebase-files/","title":"Files","text":""},{"location":"firebase-files/#introduction","title":"Introduction","text":"

    Save JSON data, using firebase-firestore.

    Each owner has several files, each file contains header and content indexed by fileID.

    • Author: Rex
    "},{"location":"firebase-files/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-files/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-files/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add file-manager object
      var fileManager = scene.plugins.get('rexfirebaseplugin').add.files(config);\n
    "},{"location":"firebase-files/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add file-manager object
      var fileManager = scene.plugins.get('rexFirebase').add.files(config);\n
    "},{"location":"firebase-files/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { Files } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add file-manager object
      var fileManager = new Files(config);\n
    "},{"location":"firebase-files/#create-instance","title":"Create instance","text":"
    var fileManager = scene.plugins.get('rexFirebase').add.files({\nroot: ''\n});\n
    • root : Collection name of these files.
    "},{"location":"firebase-files/#save-file","title":"Save file","text":"
    1. Set file owner.
      fileManager.setOwner(userID);\n
      or
      fileManager.setOwner({\nuserID: userID\n});\n
      • userID : User ID of file owner.
    2. Save header and content data.
      • Overwrite
        fileManager.save(fileID, header, content);\n
        • fileID : Unique ID of this file.
        • header : Header data for indexing, a JSON object.
          • Reserve keys : userID, fileID, type, contentDocID. (i.e. don't use these keys)
        • content : Content/body, a JSON object.
          • Reserve keys : userID, fileID, type. (i.e. don't use these keys)
      • Update
        fileManager.save(fileID, header, content, true);\n
    "},{"location":"firebase-files/#load-headers","title":"Load headers","text":"
    1. Set file owner.
      fileManager.setOwner(userID);\n
    2. Load all headers of this file owner.
      fileManager.loadHeaders()\n.then(function(result) { // var headers = result.headers;\n// var userID = result.userID;\n})\n.catch(function(result) {\n// var error = result.error;\n// var userID = result.userID;\n})\n
      • headers : Get header by headers[fileID], each header contains
        • header.fileID : Unique ID of this file.
        • header.userID : User ID of file owner.
    "},{"location":"firebase-files/#load-file","title":"Load file","text":"
    1. Set file owner.
      fileManager.setOwner(userID);\n
    2. Load file.
      fileManager.load(fileID)\n.then(function(result) { // var header = result.header;\n// var content = result.content;\n// var fileID = result.fileID;\n// var userID = result.userID;\n})\n.catch(function(result) {\n// var error = result.error;\n// var fileID = result.fileID;\n// var userID = result.userID;\n})\n
      • header, content : Header/content of this file.
      • fileID : Unique ID of this file.
      • userID : User ID of file owner.
    "},{"location":"firebase-firestore/","title":"Firestore","text":""},{"location":"firebase-firestore/#introduction","title":"Introduction","text":"

    Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud Platform.

    • Author: Firebase
    "},{"location":"firebase-firestore/#usage","title":"Usage","text":"

    Official document

    Sample code

    "},{"location":"firebase-firestore/#setup","title":"Setup","text":"
    1. Import firestore
      import firebase from 'firebase/app';\nimport 'firebase/firestore';\n
      Firebase has been included in package.json.
    2. Initialize
      var firebaseApp = firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n});\nvar db = firebaseApp.firestore();\ndb.settings({\ntimestampsInSnapshots: true\n})\n
    "},{"location":"firebase-firestore/#references","title":"References","text":"
    • Reference of collection
      var collectionRef = db.collection(collectionName);\n
    • Reference of document
      var docRef = db.collection(collectionName).doc(docName);\n
    "},{"location":"firebase-firestore/#save","title":"Save","text":"
    • Add document
      db.collection(collectionName).add(doc)      // doc: { ... }\n.then(function(doc) { /* ... */ })\n.catch(function(error) { /* ... */ });\n
      Maximum size for a document : 1 MiB (1,048,576 bytes)
    • Set document
      db.collection(collectionName).doc(docName).set(keyValues)  // keyValues: { ... }\n.then(function(doc) { /* ... */ })\n.catch(function(error) { /* ... */ });\n
      Overwrite document
    • Update data
      db.collection(collectionName).doc(docName).update(keyValues)  // keyValues: { ... }\n.then(function(doc) { /* ... */ })\n.catch(function(error) { /* ... */ });\n
    • Batched writes
      // Get a new write batch\nvar batch = db.batch();\n\nbatch.set(db.collection(collectionName).doc(docName), keyValues);\nbatch.update(db.collection(collectionName).doc(docName), keyValues);\nbatch.delete(db.collection(collectionName).doc(docName));\n// ...\n\n// Commit the batch\nbatch.commit()\n.then(function() { /* ... */ })\n.catch(function(error) { /* ... */ });\n
      Maximum document writting in a commit : 500
    • Delete a document
      db.collection(collectionName).doc(docName).delete()\n.then(function() { /* ... */ })\n.catch(function(error) { /* ... */ });\n
    • Delete a field
      db.collection(collectionName).doc(docName).update({\nkey: firebase.firestore.FieldValue.delete()\n})\n.then(function() { /* ... */ })\n.catch(function(error) { /* ... */ });\n
    • Transaction
      var docRef = db.collection(collectionName).doc(docName);\ndb.runTransaction(function(transaction) {\n// read-modify-write\n// This code may get re-run multiple times if there are conflicts.\nreturn transaction.get(docRef).then(function(doc) {\n// doc.exists\ntransaction.update(docRef, keyValues);\n});\n})\n.then(function() {\n//console.log(\"Transaction successfully committed!\");\n})\n.catch(function(error) {\n//console.log(\"Transaction failed: \", error);\n});\n

    Limitation: Writes and transactions section

    "},{"location":"firebase-firestore/#server-timestamp","title":"Server timestamp","text":"
    firebase.firestore.FieldValue.serverTimestamp()\n
    "},{"location":"firebase-firestore/#load","title":"Load","text":"
    • Get a document
      db.collection(collectionName).doc(docName).get()\n.then(function(doc) { /* ... */ })\n.catch(function(error) { /* ... */ });\n
      • doc
        • doc.id
        • doc.data()
    • Get all documents
      db.collection(collectionName).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
      • querySnapshot
        • querySnapshot.docs
        • querySnapshot.forEach(callback, thisArg)
        • querySnapshot.empty
        • querySnapshot.size
    • Simple queries
      db.collection(collectionName).where(key, op, value).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
      • op : '>', '==', '<', '>=', '<='
        • != : where(key,'>', value).where(key, '<', value)
    • Compound queries
      db.collection(collectionName).where(key0, op0, value0).where(key1, op1, value1).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
      • Range filters (<, <=, >, >=) on only one field
    "},{"location":"firebase-firestore/#paginate","title":"Paginate","text":"
    • Order, limit
      db.collection(collectionName).orderBy(key).limit(count)\n
      • Descending order : orderBy(key, 'desc')
      • Order by multiple fields : orderBy(key0).orderBy(key1)
    • Query, order, limit
      db.collection(collectionName).where(key, op, value).orderBy(key).limit(count)\n
      • Key of first order must be equal to range comparison (<, <=, >, >=)
    • Page
      1. Start at
        db.collection(collectionName).orderBy(key).startAt(value).limit(count).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
        • endAt(value)
      2. Next page
        var lastDoc = querySnapshot.docs[querySnapshot.docs.length - 1];\ndb.collection(collectionName).orderBy(key).startAfter(lastDoc).limit(count).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
        • endBefore(lastDoc)
    "},{"location":"firebase-firestore/#get-realtime-updates","title":"Get realtime updates","text":"
    • Get updates of a document
      var unsubscribe = db.collection(collectionName).doc(docName)\n.onSnapshot(function(doc) { /* ... */ });\n
    • Get updates of documents
      var unsubscribe = db.collection(collectionName).where(key, op, value)\n.onSnapshot(function(querySnapshot) { /* ... */ });\n
      • Changes
        var changes = querySnapshot.docChanges();  // [change]\n
        • Change
          • change.type : 'added', 'modified', 'removed'
          • change.newIndex
          • change.oldIndex
    • Detach a listener
      unsubscribe();\n
    • Events for metadata changes
      var unsubscribe = db.collection(collectionName).doc(docName)\n.onSnapshot({\nincludeMetadataChanges: true    // Listen for document metadata changes\n},\nfunction(doc) { /* ... */ } );\n
    "},{"location":"firebase-firestore/#indexing","title":"Indexing","text":"

    Reference

    "},{"location":"firebase-idalias/","title":"ID-alias","text":""},{"location":"firebase-idalias/#introduction","title":"Introduction","text":"

    Map an unique ID to another unique ID (alias), using firebase-firestore.

    Each owner has several files, each file contains header and content indexed by fileID.

    • Author: Rex
    "},{"location":"firebase-idalias/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-idalias/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-idalias/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add id-alias object
      var idAlias = scene.plugins.get('rexfirebaseplugin').add.idAlias(config);\n
    "},{"location":"firebase-idalias/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add id-alias object
      var idAlias = scene.plugins.get('rexFirebase').add.idAlias(config);\n
    "},{"location":"firebase-idalias/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { IdAlias } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add id-alias object
      var idAlias = new IdAlias(config);\n
    "},{"location":"firebase-idalias/#create-instance","title":"Create instance","text":"
    var idAlias = scene.plugins.get('rexFirebase').add.idAlias({\nroot: ''\n});\n
    • root : Collection name of this id-alias.
    "},{"location":"firebase-idalias/#random-alias","title":"Random alias","text":"

    Get alias of an id, or register an alias from a random word.

    idAlias.getRandomAlias(id, {\ndigits: 10,\ncandidates: '0123456789',\nretry: 1000\n})\n.then(function(result) { // var alias = result.alias;\n// var id = result.id;\n})\n.catch(function(error) { })\n
    • id : An unique ID.
    • digits : String length of alias.
    • candidates : Candidate characters.
    • retry : Max retry count.
    "},{"location":"firebase-idalias/#specific-alias","title":"Specific alias","text":"
    • Add a specific alias
      idAlias.add(id, alias)\n.then(function(result) { // var alias = result.alias;\n// var id = result.id;\n})\n.catch(function(error) { })\n
      • id : An unique ID.
      • alias : Another unique ID.
    • Get ID from alias
      idAlias.getId(alias)\n.then(function(result) { // var alias = result.alias;\n// var id = result.id; // Return undefined if alias is not existed.\n})\n.catch(function(error) { })\n
    • Get alias from ID
      idAlias.getAlias(id)\n.then(function(result) { // var alias = result.alias; // Return undefined if id is not existed.\n// var id = result.id;\n})\n.catch(function(error) { })\n
    "},{"location":"firebase-itemtable/","title":"Item table","text":""},{"location":"firebase-itemtable/#introduction","title":"Introduction","text":"

    1d/2d/3d table, using firebase-database.

    • Author: Rex
    "},{"location":"firebase-itemtable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-itemtable/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-itemtable/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add table object
      var table = scene.plugins.get('rexfirebaseplugin').add.itemTable(config);\n
    "},{"location":"firebase-itemtable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add table object
      var table = scene.plugins.get('rexFirebase').add.itemTable(config);\n
    "},{"location":"firebase-itemtable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { ItemTable } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add table object
      var table = new ItemTable(config);\n
    "},{"location":"firebase-itemtable/#create-instance","title":"Create instance","text":"
    var table = scene.plugins.get('rexFirebase').add.itemTable({\nroot: '',\ntype: 3\n});\n
    • root : Path of this item table.
    • type : Table type.
      • 1, or '1d' : 1d table, indexing by (key0)
      • 2, or '2d' : 2d table, indexing by (key0, key1)
      • 3, or '3d' : 3d table, indexing by (key0, key1, key2)
    "},{"location":"firebase-itemtable/#write","title":"Write","text":"
    • Set data
      table.setData(key0, value)\n// table.setData(key0, key1, value)\n// table.setData(key0, key1, key2, value)\n.then(function() { })\n.catch(function() { })\n
      • key0, key1, key2 : Any string.
      • value : Number, string, or JSON data.
    • Increase value
      table.incValue(key0, value)\n// table.incValue(key0, key1, value)\n// table.incValue(key0, key1, key2, value)\n.then(function() { })\n.catch(function() { })    
      • key0, key1, key2 : Any string.
      • value : Number.
    • Remove key
      table.removeData(key0)\n// table.removeData(key0, key1)\n// table.inremoveDatacValue(key0, key1, key2)\n.then(function() { })\n.catch(function() { })    
      • key0, key1, key2 : Any string.
    • Batch writing specific values at key pathes
      table.updateData({\n`${key0}` : value0,\n`${key0}/${key1}` : value1,\n`${key0}/${key1}/${key2}` : value2,\n...\n})\n.then(function() { })\n.catch(function() { })    
    • Transaction, write new value according to latest value
      table.transaction(key0, callback)\n// table.transaction(key0, key1, callback)\n// table.transaction(key0, key1, key2, callback)\n.then(function() { })\n.catch(function() { })    
      • key0, key1, key2 : Any string.
      • callback : Write new value according to latest value.
        function(preValue) { return newValue; }\n
    • Remove key when current user disconnect
      table.removeDataOnDisconnect(key0)\n// table.removeDataOnDisconnect(key0, key1)\n// table.removeDataOnDisconnect(key0, key1, key2)\n.then(function() { })\n.catch(function() { })        
    • Set value when current user disconnect
      table.setDataOnDisconnect(key0, value)\n// table.setDataOnDisconnect(key0, key1, value)\n// table.setDataOnDisconnect(key0, key1, key2, value)\n.then(function() { })\n.catch(function() { })        
    "},{"location":"firebase-itemtable/#read","title":"Read","text":"
    • Start updating
      table.startUpdate();\n
      • Trigger 'init' event when all data read back.
      • table.initialFlag : Return true when all data read back.
    • Stop updating
      table.stopUpdate();\n
    • Read data stored in client
      var data = table.getData(key0);\n// var data = table.getData(key0, key1);\n// var data = table.getData(key0, key1, key2);\n
      • data : Number, string, or JSON data.
    • Read all data stored in client
      var data = table.getData();\n
      • data : JSON data.
    • Clone data stored in client
      var data = table.cloneData(key0);\n// var data = table.cloneData(key0, key1);\n// var data = table.cloneData(key0, key1, key2);    \n
    • Clone all data stored in client
      var data = table.cloneData();\n
    "},{"location":"firebase-itemtable/#events","title":"Events","text":"
    • Initialize, read all data back after start updating
      table.on('init', function(data) { })\n
      • data : Table data.
      • table.initialFlag will be set to true.
    • Any value updated
      table.on('update', function(data) { })\n
      • data : Table data.
    "},{"location":"firebase-itemtable/#1d-table","title":"1d table","text":"

    1d table, indexing by (key0)

    • On add key0
      table.on('addkey0', function(key0, value) {  });\n
    • On remove key0
      table.on('removekey0', function(key0) {  });\n
    • On change key0
      table.on('changekey0', function(key0, value) {  });\n
    "},{"location":"firebase-itemtable/#2d-table","title":"2d table","text":"

    2d table, indexing by (key0, key1)

    • On add key0
      table.on('addkey0', function(key0, value) {  });\n
    • On remove key0
      table.on('removekey0', function(key0) {  });\n
    • On add key1
      table.on('addkey1', function(key0, key1, value) {  });\n
    • On remove key1
      table.on('removekey1', function(key0, key1) {  });\n
    • On change key1
      table.on('changekey1', function(key0, key1, value) {  });\n
    "},{"location":"firebase-itemtable/#3d-table","title":"3d table","text":"

    3d table, indexing by (key0, key1, key2)

    • On add key0
      table.on('addkey0', function(key0, value) {  });\n
    • On remove key0
      table.on('removekey0', function(key0) {  });\n
    • On add key1
      table.on('addkey1', function(key0, key1, value) {  });\n
    • On remove key1
      table.on('removekey1', function(key0, key1) {  });\n
    • On add key2
      table.on('addkey2', function(key0, key1, key2, value) {  });\n
    • On remove key2
      table.on('removekey2', function(key0, key1, key2) {  });\n
    • On change key2
      table.on('changekey2', function(key0, key1, key2, value) {  });\n
    "},{"location":"firebase-leaderboard/","title":"Leaderboard","text":""},{"location":"firebase-leaderboard/#introduction","title":"Introduction","text":"

    Descending sort scores, using firebase-firestore.

    • Author: Rex
    "},{"location":"firebase-leaderboard/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-leaderboard/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-leaderboard/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add leader-board object
      var leaderBoard = scene.plugins.get('rexfirebaseplugin').add.leaderBoard(config);\n
    "},{"location":"firebase-leaderboard/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add leader-board object
      var leaderBoard = scene.plugins.get('rexFirebase').add.leaderBoard(config);\n
    "},{"location":"firebase-leaderboard/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { LeaderBoard } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add leader-board object
      var leaderBoard = new LeaderBoard(config);\n
    "},{"location":"firebase-leaderboard/#create-instance","title":"Create instance","text":"
    var leaderBoard = scene.plugins.get('rexFirebase').add.leaderBoard({\nroot: '',\n// timeFilters: false,\n// timeFilterType: 'year',\n// pageItemCount: 100,\n// userID: '',\n// userName: '',\n// boardID: undefined,\n// tag: undefined\n});\n
    • root : Collection name of this leaderboard.
    • timeFilters : Time filter of day/week/month/year.
      • false : Don't use any time filter.
      • true : Enable all time filters.
      • JSON object, enable some time filters.
        {\nday: true,\nweek: true,\nmonth: true,\nyear: true,\nall: true\n}\n
    • timeFilterType : Type of time filter.
      • 'day', or 'd' : Filter scores by current day.
      • 'week', or 'w' : Filter scores by current week.
      • 'month', 'm' : Filter scores by current month.
      • 'year', 'y' : Filter scores by current year. Default value.
      • 'all', 'a' : No time filter to track all scores.
    • pageItemCount : Item count of a page, default value is 100
    • userID : ID of user.
    • userName : Name of user.
    • boardID : Board ID, optional.
    • tag : Custom tag, optional.

    Time filter enabled

    Add indexes if time filter is enabled. - tagD(ascending), scoreD(descending), boardID(ascending), tag(ascending) - tagW(ascending), scoreW(descending), boardID(ascending), tag(ascending) - tagM(ascending), scoreM(descending), boardID(ascending), tag(ascending) - tagY(ascending), scoreY(descending), boardID(ascending), tag(ascending) - tagA(ascending), scoreA(descending), boardID(ascending), tag(ascending)

    "},{"location":"firebase-leaderboard/#post-score","title":"Post score","text":"
    1. Set user.
      leaderBoard.setUser(userID, userName);\n
      or
      leaderBoard.setUser({\nuserID: userID,\nuserName: userName\n});\n
      • userID : User ID.
      • userName : Display name of user, optional.
    2. Set board property, optional.
      • Board ID
        leaderBoard.setBoardID(boardID);\n
      • Custom tag
        leaderBoard.setTag(tag);\n
    3. Post score
      leaderBoard.post(score)\n// leaderBoard.post(score, extraData)\n// leaderBoard.post(score, extraData, timestamp)\n.then(function(record) { })\n.catch(function(error) { })\n
      • score : A number, scores will be sorted descend.
      • extraData : Extra data in JSON format.
      • timestamp : Timestamp of posting.
        • undefined : Current time.
        • A number : For debug usage.
    "},{"location":"firebase-leaderboard/#get-my-score","title":"Get my score","text":"
    leaderBoard.getScore()\n// leaderBoard.getScore(userID)\n.then(function(score) { })\n.catch(function(error) { })\n
    • userID : User ID, optional.
      • undefined : Current user ID.
    • score : Score object.
      • Time filter enabled : {userID, scoreD, scoreW, scoreM, scoreY, tagD, tagW, tagM, tagY, tagA}
        • scoreD, scoreW, scoreM, scoreY, scoreA : Score of day/week/month/year/all-time.
        • tagD, tagW, tagM, tagY, tagA : Time tag of day/week/month/year/all-time.
      • Time filter disabled : {userID, score}
    "},{"location":"firebase-leaderboard/#get-my-rank","title":"Get my rank","text":"
    leaderBoard.getRank()\n// leaderBoard.getRank(userID)\n.then(function(rank) { })\n.catch(function(error) { })\n
    • userID : User ID, optional.
      • undefined : Current user ID.
    • rank : Rank object. {userID, rank}
    "},{"location":"firebase-leaderboard/#get-scores","title":"Get scores","text":"
    1. Set board property, optional.
      • Board ID
        leaderBoard.setBoardID(boardID);\n
      • Custom tag
        leaderBoard.setTag(tag);\n
    2. Set time filter, optional.
      leaderBoard.setTimeFilterType(type);\n
      • type :
        • 'day', or 'd' : Filter scores by current day.
        • 'week', or 'w' : Filter scores by current week.
        • 'month', 'm' : Filter scores by current month.
        • 'year', 'y' : Filter scores by current year.
        • 'all', 'a' : No time filter to track all scores.
    3. Load scores page by page.
      • Load first page.
        leaderBoard.loadFirstPage()\n.then(function(scores) { })\n.catch(function(error) { })\n
        • scores : An array of score object. Each score object is {userID, userName, socre}
      • Load next page.
        leaderBoard.loadNextPage()\n.then(function(scores) { })\n.catch(function(error) { })\n
        • scores : An array of score object. Each score object is {userID, userName, socre}
      • Load previous page.
        leaderBoard.loadPreviousPage()\n.then(function(scores) { })\n.catch(function(error) { })\n
        • scores : An array of score object. Each score object is {userID, userName, socre}
      • Reload current page.
        leaderBoard.loadCurrentPage()\n.then(function(scores) { })\n.catch(function(error) { })\n
        • scores : An array of score object. Each score object is {userID, userName, socre}
    "},{"location":"firebase-leaderboard/#page-index","title":"Page index","text":"
    • Current page index
      var pageIndex = leaderBoard.pageIndex;\n
    • Is first page
      var isFirstPage = leaderBoard.isFirstPage;\n
    • Is last page
      var isLastPage = leaderBoard.isLastPage;\n
    "},{"location":"firebase-leaderboard/#delete","title":"Delete","text":"
    • Delete user
      leaderBoard.deleteUserScore(userID)\n.then(function(){ })\n.catch(function(){ })\n
    • Delete board
      leaderBoard.deleteBoard(boardID, tag)\n.then(function(){ })\n.catch(function(){ })\n
    "},{"location":"firebase-messages/","title":"Messages","text":""},{"location":"firebase-messages/#introduction","title":"Introduction","text":"

    Store messages in firebase-firestore.

    • Author: Rex
    "},{"location":"firebase-messages/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-messages/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-messages/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add leader-board object
      var messages = scene.plugins.get('rexfirebaseplugin').add.messages(config);\n
    "},{"location":"firebase-messages/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add leader-board object
      var messages = scene.plugins.get('rexFirebase').add.messages(config);\n
    "},{"location":"firebase-messages/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { Messages } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add leader-board object
      var messages = new Messages(config);\n
    "},{"location":"firebase-messages/#create-instance","title":"Create instance","text":"
    var messages = scene.plugins.get('rexFirebase').add.messages({\nroot: '',\n// pageItemCount: 100,\n\n// senderID: '',\n// senderName: '',\n// receiverID: undefined,\n});\n
    • root : Collection name of this messages.
    • pageItemCount : Item count of a page, default value is 100
    • senderID : ID of sender.
    • senderName : Name of sender, optional.
    • receiverID : ID of receiver, optional.
    "},{"location":"firebase-messages/#send-message","title":"Send message","text":"
    1. Set sender.
      messages.setSender(userID, userName);\n
      or
      messages.setSender({\nuserID: userID,\nuserName: userName\n});\n
      • userID : User ID.
      • userName : Display name of user, optional.
    2. Set receiver, optional.
      messages.setReceiver(userID);\n
      • userID : User ID.
    3. Send message
      messages.send(message)    .then(function() { })\n.catch(function(error) { })\n
      • message : String, number, or JSON object.
    "},{"location":"firebase-messages/#receive-messages","title":"Receive messages","text":"
    1. Set receiverID, optional.
      messages.setReceiver(userID)\n
      • userID : User ID.
    2. Load previous messages, optional.
      messages.loadPreviousMessages()\n.then(function(messageObjs) { })\n.catch(function(error) { })    
      • messageObjs : Array of Received message objects
        • messageObj.senderID, messageObj.senderName : Sernder ID and name.
        • messageObj.receiverID : Receiver ID, optional.
        • messageObj.message : Sent message, a string, number, or JSON object.
        • messageObj.timestamp : Server-timestamp.
    3. Add 'receiver' event.
      messages.on('receive', function(messageObj) {\n// var senderID = messageObj.senderID;\n// var senderName = messageObj.senderName;\n// var receiverID = messageObj.receiverID;\n// var message = messageObj.message;\n// var timestamp = messageObj.timestamp;\n})\n
      • messageObj : Received message object.
    4. Start receiving
      messages.startReceiving();\n
    5. Stop receiving
      messages.stopReceiving();\n

    Received messages will be stored in messages.cacheMessages

    "},{"location":"firebase-onlineuserlist/","title":"Online user list","text":""},{"location":"firebase-onlineuserlist/#introduction","title":"Introduction","text":"

    Online user list, using firebase-database.

    • Author: Rex
    "},{"location":"firebase-onlineuserlist/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-onlineuserlist/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-onlineuserlist/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add online-user-list object
      var userList = scene.plugins.get('rexfirebaseplugin').add.onlineUserList(config);\n
    "},{"location":"firebase-onlineuserlist/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add online-user-list object
      var userList = scene.plugins.get('rexFirebase').add.onlineUserList(config);\n
    "},{"location":"firebase-onlineuserlist/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { OnlineUserList } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add online-user-list object
      var userList = new OnlineUserList(config);\n
    "},{"location":"firebase-onlineuserlist/#create-instance","title":"Create instance","text":"
    var userList = scene.plugins.get('rexFirebase').add.onlineUserList({\nroot: '',\n// maxUsers: 0,\n\n// userID: '',\n// userName: '',\n});\n
    • root : Path of this online user list.
    • maxUsers: Maximum users in this list. Set to 0 to have infinity users.
    • userID : ID of user.
    • userName : Name of user.
    "},{"location":"firebase-onlineuserlist/#join","title":"Join","text":"
    1. Set userID and user name.
      userList.setUser(userID, userName);\n
      or
      userList.setUser({\nuserID: userID,\nuserName: userName\n});\n
      • userID : User ID.
      • userName : Display name.
    2. Join list.
      userList.join()\n// .then(function() { })\n// .catch(function() { })\n
    "},{"location":"firebase-onlineuserlist/#leave","title":"Leave","text":"
    userList.leave()\n// .then(function() { })\n// .catch(function() { })\n
    "},{"location":"firebase-onlineuserlist/#kick-user","title":"Kick user","text":"
    userList.leave(userID)\n// .then(function() { })\n// .catch(function() { })\n
    "},{"location":"firebase-onlineuserlist/#change-user-name","title":"Change user name","text":"
    userList.changeUserName(newUserName)\n// .then(function() { })\n// .catch(function() { })\n
    "},{"location":"firebase-onlineuserlist/#user-list","title":"User list","text":"
    • Get users in user list
      var users = userList.getUsers();\n
      • users : Array of user {userID, userName}
    • Is first user in user list?
      var isFirstUser = userList.isFirstUser(userID);\n// var isFirstUser = userList.isFirstUser();  // Current user is first user\n
    • User list is full
      var isFull = userList.isFull();\n
    • Maximun users setting value
      var maxUsers = userList.maxUsers;\n
    • Current user is in list
      var isInList = userList.isInList;\n
    "},{"location":"firebase-onlineuserlist/#events","title":"Events","text":"
    • Any user join
      userList.on('join', user);\n
      • user : {userID, userName}
    • Any user leave
      userList.on('leave', user);\n
      • user : {userID, userName}
    • User list updated, includes user join, user leave, and user name changed
      userList.on('update', users);\n
      • users : Array of user {userID, userName}
    • User name is changed
      userList.on('changename', userID, userName, prevUserName);\n
    "},{"location":"firebase-overview/","title":"Overview","text":""},{"location":"firebase-overview/#introduction","title":"Introduction","text":"
    • Home page
    • Available libraries
    "},{"location":"firebase-overview/#usage","title":"Usage","text":""},{"location":"firebase-overview/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-overview/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>        \n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Get firebase plugin
      var rexFireBase = scene.plugins.get('rexfirebaseplugin');\n
    "},{"location":"firebase-overview/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Get firebase plugin
      var rexFireBase = scene.plugins.get('rexFirebase');\n
    "},{"location":"firebase-singleroom/","title":"Single room","text":""},{"location":"firebase-singleroom/#introduction","title":"Introduction","text":"

    Chat room, using firebase-database.

    • Author: Rex
    "},{"location":"firebase-singleroom/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-singleroom/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-singleroom/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add single-room object
      var room = scene.plugins.get('rexfirebaseplugin').add.singleRoom(config);\n
    "},{"location":"firebase-singleroom/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add single-room object
      var room = scene.plugins.get('rexFirebase').add.singleRoom(config);\n
    "},{"location":"firebase-singleroom/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { SingleRoom } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add single-room object
      var room = new SingleRoom(config);\n
    "},{"location":"firebase-singleroom/#create-instance","title":"Create instance","text":"
    var room = scene.plugins.get('rexFirebase').add.singleRoom({\nroot: '',\n// maxUsers: 0,\n// userID: '',\n// userName: '',\n// broadcast: true,\n// tables: undefined,\n\n});\n
    • root : Path of this room.
    • maxUsers: Maximum users in this list. Set to 0 to have infinity users.
    • userID : ID of user.
    • userName : Name of user.
    • broadcast : Broadcast chat messages.
      • true : Enable broadcasting, without storing received (history) messages. Default behavior.
      • false : Disable broadcasting.
      • A JSON object :
        {\nhistory: 0\n}\n
        • history : Stored received (history) messages in client side.
          • 0, or false : No history message stored.
          • -1, or true : Infinity history message stored. i.e. store all messages from starting updating.
          • A number larger then 0 : Length of stored history message.
    • tables : Configuration of tables.
      • undefined : No table.
      • Array of table-config JSON object for each table.
        [\n{\nkey: tableKey,\ntype: '1d'\n},\n{\n...\n}\n]\n
        • key : Unique name of this table.
        • type : Table type.
          • 1, or '1d' : 1d table, indexing by (key0)
          • 2, or '2d' : 2d table, indexing by (key0, key1)
          • 3, or '3d' : 3d table, indexing by (key0, key1, key2)
    "},{"location":"firebase-singleroom/#current-user-infomation","title":"Current user infomation","text":"
    • User name
      • Get
        var userName = room.userInfo.userName;\n
      • Set
        room.changeUserName(newUserName);\n
    • User ID
      • Get
        var userID = room.userInfo.userID;\n
    "},{"location":"firebase-singleroom/#join-room","title":"Join room","text":"
    1. Set userID and user name.
      room.setUser(userID, userName);\n
      • userID : User ID.
      • userName : Display name.
    2. Join room.
      room.joinRoom();\n
    "},{"location":"firebase-singleroom/#leave-room","title":"Leave room","text":"
    room.leaveRoom();\n
    "},{"location":"firebase-singleroom/#kick-user","title":"Kick user","text":"
    room.kickUser(userID);\n
    "},{"location":"firebase-singleroom/#user-list","title":"User list","text":"
    • Get users in room(user list)
      var users = room.getUsers();\n
      • users : Array of user {userID, userName}
    • Is first user in room(user list)?
      var isFirstUser = room.isFirstUser(userID);\n// var isFirstUser = room.isFirstUser();  // Current user is first user\n
    • Room(user list) is full
      var isFull = room.isFull();\n
    • Maximun users setting value
      var maxUsers = room.maxUsers;\n
    • Current user is in room(user list)
      var isInRoom = room.isInRoom();\n
    "},{"location":"firebase-singleroom/#send-message","title":"Send message","text":"
    room.broadcast.send(message);\n
    • message : A string message, or a JSON data.
    "},{"location":"firebase-singleroom/#receive-messages","title":"Receive messages","text":"
    1. Register receive event
      room.on('broadcast.receive', function(data){\n// var senderID = data.senderID;\n// var senderName = data.senderName;\n// var message = data.message;\n})\n

    Only receive messages after joined room. Previous messages won't be got anymore.

    "},{"location":"firebase-singleroom/#received-messages","title":"Received messages","text":"

    Received messages will be saved in client side.

    • Get received (history) messages.
      var messages = room.broadcast.getHistory();\n
    • Clear history messages.
      room.broadcast.clearHistory();\n
    "},{"location":"firebase-singleroom/#tables","title":"Tables","text":"
    • Get table
      var table = room.getTable(key);\n
      • key : Unique name of this table.
    "},{"location":"firebase-singleroom/#write","title":"Write","text":"

    See here

    "},{"location":"firebase-singleroom/#read","title":"Read","text":"

    See here

    "},{"location":"firebase-singleroom/#events","title":"Events","text":""},{"location":"firebase-singleroom/#user-list-events","title":"User list events","text":"
    • Any user join
      room.on('userlist.join', user);\n
      • user : {userID, userName}
    • Any user leave
      room.on('userlist.leave', user);\n
      • user : {userID, userName}
    • User list updated, includes user join, user leave, and user name changed
      room.on('userlist.update', users);\n
      • users : Array of user {userID, userName}
    • User name is changed
      room.on('userlist.changename', userID, userName, prevUserName);\n
    "},{"location":"firebase-singleroom/#broadcast-events","title":"Broadcast events","text":"
    • Receive message
      room.on('broadcast.receive', function(data){\n// var senderID = data.senderID;\n// var senderName = data.senderName;\n// var message = data.message;\n})\n
    "},{"location":"firebase-singleroom/#table-events","title":"Table events","text":"

    Event names of each table indexed by key

    • init : tables.${key}.init
    • update : tables.${key}.update
    • addkey0 : tables.${key}.addkey0
    • removekey0 : tables.${key}.removekey0
    • changekey0 : tables.${key}.changekey0
    • addkey1 : tables.${key}.addkey1
    • removekey1 : tables.${key}.removekey1
    • changekey1 : tables.${key}.changekey1
    • addkey2 : tables.${key}.addkey2
    • removekey2 : tables.${key}.removekey2
    • changekey2 : tables.${key}.changekey2
    "},{"location":"firebase-storage/","title":"Storage","text":""},{"location":"firebase-storage/#introduction","title":"Introduction","text":"

    It supports authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook and Twitter, and more.

    • Author: Firebase
    "},{"location":"firebase-storage/#usage","title":"Usage","text":"

    Official document

    Sample code

    "},{"location":"firebase-storage/#setup","title":"Setup","text":"
    1. Import firestore
      import firebase from 'firebase/app';\nimport 'firebase/storage';\n
      Firebase has been included in package.json.
    2. Initialize
      var firebaseApp = firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n});\nvar storageRef = firebaseApp.storage().ref();\n
    "},{"location":"firebase-storage/#upload-string","title":"Upload string","text":"
    • Upload string
      var fileRef = storageRef.child('path/to/filename');\nvar uploadTask = fileRef.putString(content)\n.then(function (snapshot) {})\n.catch(function (error) {});\n
    • Upload base64 formatted string
      var fileRef = storageRef.child('path/to/filename');\nvar uploadTask = fileRef.putString(content, 'base64')\n.then(function (snapshot) {})\n.catch(function (error) {});\n
    • Upload base64url formatted string
      var fileRef = storageRef.child('path/to/filename');\nvar uploadTask = fileRef.putString(content, 'base64url')\n.then(function (snapshot) {})\n.catch(function (error) {});\n
    • Upload data URL string
      var fileRef = storageRef.child('path/to/filename');\nvar uploadTask = fileRef.putString(content, 'data_url')\n.then(function (snapshot) {})\n.catch(function (error) {});\n
    "},{"location":"firebase-storage/#upload-image","title":"Upload image","text":"
    1. Get image from image texture
      var image = scene.textures.get(key).getSourceImage();\n
    2. Copy image to canvas
      var canvas = CanvasPool.create(scene, image.width, image.height);\nvar ctx = canvas.getContext('2d');\nctx.drawImage(image, 0, 0, image.width, image.height);\n
    3. Get blob from canvas, then upload this blob.
      var uploadTask;\ncanvasToBlob(canvas)\n.then(function(blob) {\nvar metadata = {\ncontentType: 'image/jpeg',\n};        var fileRef = storageRef.child('path/to/filename');\nuploadTask = fileRef.put(blob, metadata);\nreturn uploadTask;\n})\n.then(function (snapshot) {})\n.catch(function (error) {});\n
      Reference: canvasToBlob
    4. Free canvas
      CanvasPool.remove(canvas);\n
    "},{"location":"firebase-storage/#upload-task","title":"Upload task","text":"
    • Pause task
      uploadTask.pause();\n
    • Resume task
      uploadTask.resume();\n
    • Cancel task
      uploadTask.cancel();\n
    • Monitor progress
      uploadTask.on('state_changed', function(snapshot){\n// Observe state change events such as progress, pause, and resume\nvar progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\nswitch (snapshot.state) {\ncase firebase.storage.TaskState.PAUSED: // or 'paused'\nconsole.log('Upload is paused');\nbreak;\ncase firebase.storage.TaskState.RUNNING: // or 'running'\nconsole.log('Upload is running');\nbreak;\n}\n},\nfunction(error) {\n// Handle unsuccessful uploads\n// https://firebase.google.com/docs/storage/web/handle-errors\nswitch (error.code) {\ncase 'storage/unauthorized':\n// User doesn't have permission to access the object\nbreak;\ncase 'storage/canceled':\n// User canceled the upload\nbreak;\ncase 'storage/unknown':\n// Unknown error occurred, inspect error.serverResponse\nbreak;\n}\n},\nfunction() {\n// Handle successful uploads on complete\n// Get download url\nuploadTask.snapshot.ref.getDownloadURL()\n.then(function(url) {\nconsole.log('File available at', url);\n})\n.catch(function (error) {});\n}\n);\n
    "},{"location":"firebase-storage/#download-file","title":"Download file","text":"
    1. Get download url
      var fileRef = storageRef.child('path/to/filename');\nfileRef.getDownloadURL()\n.then(function(url) {})\n.catch(function (error) {});\n
    2. Download file by loader
    "},{"location":"firebase-storage/#delete-file","title":"Delete file","text":"
    var fileRef = storageRef.child('path/to/filename');\nfileRef.delete()\n.then(function() {})\n.catch(function(error) {});\n
    "},{"location":"flash/","title":"Flash","text":""},{"location":"flash/#introduction","title":"Introduction","text":"

    Flashing (set invisible then visible) game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"flash/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"flash/#install-plugin","title":"Install plugin","text":""},{"location":"flash/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexflashplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexflashplugin.min.js', true);\n
    • Add flash behavior
      var flash = scene.plugins.get('rexflashplugin').add(gameObject, config);\n
    "},{"location":"flash/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FlashPlugin from 'phaser3-rex-plugins/plugins/flash-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFlash',\nplugin: FlashPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add flash behavior
      var flash = scene.plugins.get('rexFlash').add(gameObject, config);\n
    "},{"location":"flash/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Flash from 'phaser3-rex-plugins/plugins/flash.js';\n
    • Add flash behavior
      var flash = new Flash(gameObject, config);\n
    "},{"location":"flash/#create-instance","title":"Create instance","text":"
    var flash = scene.plugins.get('rexFlash').add(gameObject, {\n// duration: 500,\n// repeat: 2\n});\n
    • duration : Duration of invisible(50%) and visible(50%), in millisecond.
    • repeat : The number of times the flashing will repeat itself (a value of 1 means the flash will play twice, as it repeated once)
    "},{"location":"flash/#start-flashing","title":"Start flashing","text":"
    flash.flash();\n// flash.flash(duration, repeat);\n

    or

    flash.flash({\nduration: 500,\nrepeat: 2\n});\n
    "},{"location":"flash/#stop-flashing","title":"Stop flashing","text":"
    flash.stop();\n
    "},{"location":"flash/#enable","title":"Enable","text":"
    • Enable/resume (default)
      flash.setEnable();\n
      or
      flash.enable = true;\n
    • Disable/pause
      flash.setEnable(false);\n
      or
      flash.enable = false;\n
    "},{"location":"flash/#set-duration","title":"Set duration","text":"
    flash.setDuration(duration);\n// flash.duration = duration;\n
    "},{"location":"flash/#set-repeat","title":"Set repeat","text":"
    flash.setRepeat(repeat);\n// flash.repeat = repeat;\n
    "},{"location":"flash/#events","title":"Events","text":"
    • On reached target
      flash.on('complete', function(flash, gameObject){});\n
    "},{"location":"flash/#status","title":"Status","text":"
    • Is flashing
      var isRunning = flash.isRunning;\n
    "},{"location":"flip/","title":"Flip","text":""},{"location":"flip/#introduction","title":"Introduction","text":"

    Flipping game object to another face by scaling width/height.

    • Author: Rex
    • Behavior of game object
    "},{"location":"flip/#live-demos","title":"Live demos","text":"
    • Flip image
    • Flip ui
    "},{"location":"flip/#usage","title":"Usage","text":"

    Sample code, Sample code-2

    "},{"location":"flip/#install-plugin","title":"Install plugin","text":""},{"location":"flip/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexflipplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexflipplugin.min.js', true);\n
    • Add flip behavior
      var flip = scene.plugins.get('rexflipplugin').add(gameObject, config);\n
    "},{"location":"flip/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FlipPlugin from 'phaser3-rex-plugins/plugins/flip-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFlip',\nplugin: FlipPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add flip behavior
      var flip = scene.plugins.get('rexFlip').add(gameObject, config);\n
    "},{"location":"flip/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Flip from 'phaser3-rex-plugins/plugins/flip.js';\n
    • Add flip behavior
      var flip = new Flip(gameObject, config);\n
    "},{"location":"flip/#create-instance","title":"Create instance","text":"
    var flip = scene.plugins.get('rexFlip').add(gameObject, {\nface: 'back',\nfront: { key, frame }, // key, or callback\nback: { key, frame },  // key, or callback\n\n// orientation: 0, // 0|'x'|1|'y'\n// duration: 500,\n// delay: 0,\n// ease: 'Sine',\n});\n
    • face : Initial face.
      • 0, 'front' : Front face.
      • 1, 'back' : Back face.
    • front, back : Texture of front/back face.
      • undefined : Use current texture key, or frame name
      • key : A string for texture key.
      • {key, frame}, or {frame} : A texture key and frame name
      • callback : Configure game object via callback.
        function(gameObject) {\n}\n
    • orientation : Flipping orientation.
      • 0, 'x', or 'horizontal' : Horizontal flipping.
      • 1, 'y', or 'vertical' : Vertical flipping.
    • duration : Duration of flipping, in millisecond.
    • delay : Initial delay
    • ease Ease function. Default value is 'Sine'.
    "},{"location":"flip/#start-flipping","title":"Start flipping","text":"
    flip.flip();\n// flip.flip(duration);\n
    "},{"location":"flip/#stop-flipping","title":"Stop flipping","text":"
    flip.stop();\n
    "},{"location":"flip/#set-duration","title":"Set duration","text":"
    flip.setDuration(duration);\n// flip.duration = duration;\n
    "},{"location":"flip/#set-ease","title":"Set ease","text":"
    flip.setEase(ease);\n// flip.ease = ease;\n
    "},{"location":"flip/#faces","title":"Faces","text":""},{"location":"flip/#current-face","title":"Current face","text":"
    • Get
      var face = flip.face;\n
      • 0 : Front face
      • 1 : Back face
    • Set
      flip.setFace(face);\n// flip.face = face;\n
      • 0, 'front' : Front face.
      • 1, 'back' : Back face.
    • Toggle face
      flip.toggleFace();\n
    "},{"location":"flip/#set-texture-of-face","title":"Set texture of face","text":"
    • Front face
      flip.setFrontFace(key, frame);\n
      or
      flip.setFrontFace(callback);\n
      • callback :
        function(gameObject) {\n// ...\n}\n
    • Back face
      flip.setBackFace(key, frame);\n
      or
      flip.setBackFace(callback);\n
      • callback :
        function(gameObject) {\n// ...\n}\n
    "},{"location":"flip/#events","title":"Events","text":"
    • On flipping complete
      flip.on('complete', function(gameObject, flip){\n// ...\n});\n
    "},{"location":"flip/#status","title":"Status","text":"
    • Is flipping
      var isRunning = flip.isRunning;\n
    "},{"location":"format/","title":"Format","text":""},{"location":"format/#introduction","title":"Introduction","text":"

    Format string with variables, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"format/#usage","title":"Usage","text":"

    Replace %x from an array. x starts from 1.

    // const Format = Phaser.Utils.String.Format;\nvar template = 'hello, %1';\nvar view = ['rex'];\nvar result = Format(template, view);\n
    "},{"location":"framemanager/","title":"Frame manager","text":""},{"location":"framemanager/#introduction","title":"Introduction","text":"

    Draw frames on canvas texture, or dynamic texture.

    • Author: Rex
    • Member of scene
    "},{"location":"framemanager/#live-demos","title":"Live demos","text":"
    • Paste text
    "},{"location":"framemanager/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"framemanager/#install-plugin","title":"Install plugin","text":""},{"location":"framemanager/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexframemanagerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexframemanagerplugin.min.js', true);\n
    • Add frame-manager object
      var frameManager = scene.plugins.get('rexframemanagerplugin').add(scene, config);\n
    "},{"location":"framemanager/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FrameManagerPlugin from 'phaser3-rex-plugins/plugins/framemanager-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFrameManager',\nplugin: FrameManagerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add frame-manager object
      var frameManager = scene.plugins.get('rexFrameManager').add(scene, config);\n
    "},{"location":"framemanager/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import FrameManager from 'phaser3-rex-plugins/plugins/framemanager.js';\n
    • Add frame-manager object
      var frameManager = new FrameManager(scene, config);\n
    "},{"location":"framemanager/#create-instance","title":"Create instance","text":"
    var frameManager = scene.plugins.get('rexFrameManager').add(scene, {\nkey: '',\nwidth: 4096,\nheight: 4096,\ncellWidth: 64,\ncellHeight: 64,\ncellPadding: 0,\ncolumns: undefined,\nrows: undefined,\nfillColor: undefined,\nuseDynamicTexture: false,\n});\n
    • key : Texture key in texture manager
    • width, height : Size of canvas.
      • Calculate width/height by columns/rows and cellWidth/cellHeight, if columns, rows parameters are given.
    • columns, rows :
      • undefined : Calculate columns/rows by width/height and cellWidth/cellHeight.
    • cellWidth, cellHeight : Maximum frame size.
    • cellPadding : Extra space around frame. Default value is 0.
      • Total cell width will be cellWidth + (cellPadding * 2)
      • Total cell height will be cellHeight + (cellPadding * 2)
    • fillColor : Fill an initial color, in css color string (for canvas-texture), or number (for dynamic-texture)
      • undefined : Don't fill color.
    • useDynamicTexture
      • false : Use canvas-texture. Default behavior.
      • true : Use dynamic-texture.

    or

    var frameManager = scene.plugins.get('rexFrameManager').add(scene, key, width, height, cellWidth, cellHeight, fillColor, useDynamicTexture);\n

    Steps of generating bitmapfont :

    1. Add frames :
      frameManager.paste(frameName, gameObject);\n
    2. Update texture
      frameManager.updateTexture();\n
    3. Export frame data to bitmapfont
      frameManager.addToBitmapFont();\n
    "},{"location":"framemanager/#add-frame","title":"Add frame","text":""},{"location":"framemanager/#from-game-object","title":"From game object","text":"

    After rendering content on text, bbcode text, canvas

    frameManager.paste(frameName, gameObject);\n
    • frameName : Frame name.
    • gameObject :
      • Canvas-texture mode :
        • Game objects which has canvas, for example, text, bbcode text, or canvas.
      • Dynamic-texture mode :
        • Any render-able game object except :
          • Graphics can't paste directly, because that Graphics game object does not have size.
            • Draw Graphics to RenderTexture, then paste this RenderTexture to frameMamager.
    "},{"location":"framemanager/#custom-drawing","title":"Custom drawing","text":"

    frameManager.draw(frameName, callback, scope)\n
    - frameName : Frame name. - callback : - Canvas-texture mode :
    function(canvas, context, frameSize) {\n// The maximum frame size\nvar cellWidth = frameSize.width;\nvar cellHeight = frameSize.height;\n\n// Draw content in area of (0, 0) - (cellWidth, cellHeight)\n\n// Update frame size\n// frameSize.width = ...\n// frameSize.height = ...\n}\n
    - Dynamic-texture mode :
    function(texture, frameSize) {\n// The maximum frame size\nvar cellWidth = frameSize.width;\nvar cellHeight = frameSize.height;\n\n// Draw content in area of (0, 0) - (cellWidth, cellHeight)\n\n// Update frame size\n// frameSize.width = ...\n// frameSize.height = ...\n}\n

    "},{"location":"framemanager/#empty-frame","title":"Empty frame","text":"
    frameManager.addEmptyFrame(frameName);\n// frameManager.addEmptyFrame(frameName, width, height);\n
    • frameName : Frame name.
    • width : Frame width, default value is cellWidth
    • height : Frame height, default value is cellHeight
    "},{"location":"framemanager/#update-texture","title":"Update texture","text":"

    Update texture after adding frames, for Canvas-texture mode.

    frameManager.updateTexture();\n

    Do nothing in Dynamic-texture mode.

    "},{"location":"framemanager/#remove-frame","title":"Remove frame","text":"
    • Remove a frame
      frameManager.remove(frameName);\n
      • frameName : Frame name.
    • Remove all frames
      frameManager.clear();\n

    Remove frame data but won't clear texture image.

    "},{"location":"framemanager/#export-to-bitmapfont","title":"Export to bitmapfont","text":"
    frameManager.addToBitmapFont();\n
    "},{"location":"framemanager/#destroy-instance","title":"Destroy instance","text":"
    frameManager.destroy();\n
    "},{"location":"fsm/","title":"FSM","text":""},{"location":"fsm/#introduction","title":"Introduction","text":"

    Finite state machine.

    • Author: Rex
    • Object
    "},{"location":"fsm/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"fsm/#install-plugin","title":"Install plugin","text":""},{"location":"fsm/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfsmplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfsmplugin.min.js', true);\n
    • Add FSM object
      var states = scene.plugins.get('rexfsmplugin').add(config);\n
    "},{"location":"fsm/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FSMPlugin from 'phaser3-rex-plugins/plugins/fsm-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFSM',\nplugin: FSMPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add FSM object
      var states = scene.plugins.get('rexFSM').add(config);\n
    "},{"location":"fsm/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import FSM from 'phaser3-rex-plugins/plugins/fsm.js';\n
    • Add FSM object
      var states = new FSM(config);\n
    "},{"location":"fsm/#create-instance","title":"Create instance","text":""},{"location":"fsm/#create-by-config","title":"Create by config","text":"
    var states = scene.plugins.get('rexFSM').add({\nstart: 'A',   // default: undefined\nstates: {\nA: {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},                 // this: this fsm instance\nexit: function() {},                  // this: this fsm instance\nupdate: function(time, delta) {},     // this: this fsm instance\npreupdate: function(time, delta) {},  // this: this fsm instance\npostupdate: function(time, delta) {}, // this: this fsm instance\n},\n// ...\n},\ninit: function() {},   // this: this fsm instance\nextend: {\ni: 0,        // Add member `i` into this fsm instance\nname: 'abc'\n// ...\n},\nenable: true,\nscene: undefined,\neventEmitter: undefined\n});\n
    • start: Initial state.
    • states: Define states.
      • stateName
        • next: String of next state, or a callback to get next state.
        • enter: Callback when enter state.
          function() {\n// this : this fsm instance\n}\n
        • exit: Callback when exit state. javascript function() { // this : this fsm instance }
        • update, preupdate, postupdate : Callback invoked by scene's 'update', 'preupdate', 'postupdate' events.
          function(time, delta) {\n// this : this fsm instance\n}\n
    • init: Initial callback when creating instance.
      function() {\n// this : this fsm instance\n}\n
    • extend: Inject key-value pairs into this fsm instance.
    • enable: Set false to block any state changing.
    • scene : Scene object for startUpdate, startPreUpdate, startPostUpdate method. Optional.
    • eventEmitter
      • undefined : Create a private event emitter, default value.
      • false : Don't add any event emitter, i.e. no event will be fired.
      • Event emitter object : Fire event through this event emitter.
    "},{"location":"fsm/#inheritance","title":"Inheritance","text":"
    1. Create new class
      class State extends FSM {\nconstructor() {\nsuper();\n}\n\nnext_A() { return 'B' }\n\nenter_A() { }\n\nexit_A() { }\n\nupdate_A(time, delta) { }\npreupdate_A(time, delta) { }\npostupdate_A(time, delta) { }\n}\n
      Members: - next_ + stateName : Callback to get next state. - enter_ + stateName : Callback when enter state. - exit_ + stateName : Callback when exit state. - update_ + stateName, preupdate_ + stateName, postupdate_ + stateName : Callback invoked by scene's 'update', 'preupdate', 'postupdate' events.
    2. Create instance
      var states = new State();\n
    "},{"location":"fsm/#read-state","title":"Read state","text":"
    • Current state
      var curState = states.state;\n
    • Previous state
      var preState = states.prevState;\n
    "},{"location":"fsm/#start-at-state","title":"Start at state","text":"
    states.start(newState);\n

    Note

    Set new state without triggering any state-changing callbacks or events.

    "},{"location":"fsm/#next-state","title":"Next state","text":"
    graph TB\n\nnext[\"states.next()\"] --> next_A[\"states.next_A()<br>return 'B'\"]\n\nnext_A --> eventStateChange[\"states.emit('statechange', states)<br>states.prevState -> states.state\"]\n\nsubgraph State changing\n\neventStateChange --> exit_A[\"states.exit_A()\"]\nexit_A --> eventExitA[\"states.emit('exit_A', states)\"]\n\neventExitA --> enter_B[\"states.enter_B()\"]\nenter_B --> eventEnterB[\"states.emit('enter_B', states)\"]\n\nsubgraph Exit\nexit_A\neventExitA\nend\n\nsubgraph Enter\nenter_B\neventEnterB\nend\n\nend\n\ngoto[\"states.goto('B')\"] --> eventStateChange\n\nsubgraph Request\n\nsubgraph Next\nnext\nnext_A\nend\n\nsubgraph Goto\ngoto\nend\n\nend
    "},{"location":"fsm/#request","title":"Request","text":"
    • Get next state by callback
      states.next();    // nextState = states.next_A()    \n
    • Goto state
      states.goto(nextState);\n// states.state = nextState;\n
    "},{"location":"fsm/#state-changing","title":"State-changing","text":"

    These callbacks or events will be triggered if state is changing.

    For example, state is changing from 'A' to 'B'.

    1. event statechange
      states.on('statechange', function(states) {\nconsole.log( states.prevState + '->' + states.state );\n});\n
    2. callback states.exit_A
    3. event exit_A
      states.on('exit_A', function(states) {\n/*...*/\n});\n
    4. callback states.enter_B
    5. event enter_B
      states.on('enter_B', function(states) {\n/*...*/\n});\n
    "},{"location":"fsm/#enable","title":"Enable","text":"
    states.setEnable();\n// states.setEnable(false); // disable\n

    or

    states.toggleEnable();\n

    states.next() and states.goto() will be ignored if disabled.

    "},{"location":"fsm/#update","title":"Update","text":"
    • Start
      states.startUpdate();\nstates.startPreUpdate();\nstates.startPostUpdate();\n// Assume that `scene` is assigned in config of constructor\n
      or
      states.startUpdate(scene);\nstates.startPreUpdate(scene);\nstates.startPostUpdate(scene);\n
      • scene : Scene object
    • Stop
      states.stopUpdate();\nstates.stopPreUpdate();\nstates.stopPostUpdate();\n
    "},{"location":"fsm/#add-new-state","title":"Add new state","text":"

    states.addState(name, {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {},\nupdate: function(time, delta) {},\npreupdate: function(time, delta) {},\npostupdate: function(time, delta) {},\n})\n
    states.addState({\nname: 'A',\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {},\nupdate: function(time, delta) {},\npreupdate: function(time, delta) {},\npostupdate: function(time, delta) {},\n})\n

    or

    states.addStates({\n'A' : {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {},\nupdate: function(time, delta) {},\npreupdate: function(time, delta) {},\npostupdate: function(time, delta) {},\n},\n// ...\n})\n
    states.addStates([\n{\nname: 'A',\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {},\nupdate: function(time, delta) {},\npreupdate: function(time, delta) {},\npostupdate: function(time, delta) {},\n},\n// ...\n]);\n

    "},{"location":"fullscreen/","title":"Full screen","text":""},{"location":"fullscreen/#introduction","title":"Introduction","text":"

    Enable or disable full screen mode, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"fullscreen/#usage","title":"Usage","text":""},{"location":"fullscreen/#enabledisable","title":"Enable/disable","text":"

    Under any input event (touch or keyboard)

    gameObject.setInteractive().on('pointerdown', function() {\nif (scene.scale.isFullscreen) {\nscene.scale.stopFullscreen();\n// On stop fulll screen\n} else {\nscene.scale.startFullscreen();\n// On start fulll screen\n}\n});\n

    Fire one of these events

    • 'fullscreenunsupported' : Tried to enter fullscreen mode, but it is unsupported by the browser.
    • 'enterfullscreen' : Entered fullscreen mode successfully.
    • 'fullscreenfailed' : Tried to enter fullscreen mode but failed.
    "},{"location":"fullscreen/#toggle","title":"Toggle","text":"

    Under any input event (touch or keyboard)

    gameObject.setInteractive().on('pointerdown', function() {\nscene.scale.toggleFullscreen();\nif (scene.scale.isFullscreen) {\n// On start fulll screen\n} else {\n// On stop fulll screen\n}\n});\n
    • Fire 'fullscreenunsupported' or 'enterfullscreen' event.
    "},{"location":"fullscreen/#state","title":"State","text":"
    • Is in full screen mode
      var isFullScreen = scene.scale.isFullscreen;\n
    • Support full screen
      var supported = Phaser.Device.Fullscreen.available;\n
    "},{"location":"fullscreen/#events","title":"Events","text":"
    • Full screen mode unsupported
      scene.scale.on('fullscreenunsupported', function() {});\n
    • Enter full screen mode
      scene.scale.on('enterfullscreen', function() {});\n
    "},{"location":"fullscreen/#with-dom-game-object","title":"With DOM game object","text":"

    Set gameConfig.fullscreenTarget to parent id.

    var config = {\nparent: parentDivID,\nfullscreenTarget: parentDivID\n};\n\nvar game = new Phaser.Game(config);\n
    "},{"location":"fuzzy/","title":"Fuzzy","text":""},{"location":"fuzzy/#introduction","title":"Introduction","text":"

    A wrap of fuzzy logic (MIT license).

    • Author of wrap : Rex , Core API : Michael Herzog
    • Member of scene, or game object
    "},{"location":"fuzzy/#live-demos","title":"Live demos","text":"
    • Fuzzy
    "},{"location":"fuzzy/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"fuzzy/#install-plugin","title":"Install plugin","text":""},{"location":"fuzzy/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfuzzyplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfuzzyplugin.min.js', true);\n
    • Add fuzzy module object
      var fuzzyModule = scene.plugins.get('rexfuzzyplugin').add(config);\n
    "},{"location":"fuzzy/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GashaponPlugin from 'phaser3-rex-plugins/plugins/fuzzy-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGashapon',\nplugin: GashaponPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add fuzzy module object
      var fuzzyModule = scene.plugins.get('rexFuzzy').add(config);\n
    "},{"location":"fuzzy/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BuildFuzzyModule from 'phaser3-rex-plugins/plugins/fuzzy.js';\n
    • Add fuzzy module object
      var fuzzyModule = BuildFuzzyModule(config);\n
    "},{"location":"fuzzy/#create-instance","title":"Create instance","text":"
    var fuzzyModule = scene.plugins.get('rexFuzzy').add(`\n// Declare fuzzy sets\nFuzzySetName : left, middle, right, setType\nFuzzySetName : left, middle, right\nFuzzySetName : left, right\n\n// Declare rules\nFuzzySetNameA => FuzzySetNameT\nFuzzySetNameA and FuzzySetNameB => FuzzySetNameT\nFuzzySetNameA or FuzzySetNameB => FuzzySetNameT\nFuzzySetNameA or (FuzzySetNameA and FuzzySetNameB) => FuzzySetNameT\n\n// More comment lines...\n`);\n
    • config can be a multiple lines string, or a plain object
      • A multiple lines string contains
        • FuzzySetName : left, middle, right, setType : A line with ':', declare a fuzzy set.
          • FuzzySetName : Fuzzy set name in one of these format
            • Variable name with postfix '+', or '-'. For example, HP-, HP, HP+, HP--, HP++, the variable name is HP.
            • variableName.setName. For example, DIST.near, DIST.middle, DIST.far, the variable name is DIST.
              • Variable name and set name are composed of number(0-9) or English characters (A-Za-z).
          • left, middle, right : Left, middle, right point of fuzzy set, in numbers.
            • left, right : Two numbers for left and right point, middle point is the average of (left + right).
          • setType :
            • Can be one of these string, or none.
              • Left part : leftShoulder, leftSCurve.
                • Default value is leftShoulder for first fuzzy set of a variable.
              • Right part : rightShoulder, rightSCurve.
                • Default value is rightShoulder for last fuzzy set of a variable.
              • Middle parts : triangular, singleton, normal.
                • Default value is triangular for other fuzzy sets of a variable.
        • FuzzySetNameA and FuzzySetNameB => FuzzySetNameT : A line with '=>', declare a fuzzy rule.
        • // ... : Comment lines
      • A plain object
        {\nvariables: {\nVariableName: [\n{\nname: leftSetName, setType: undefined,\nparameters: [left, middle, right]\n},\n{\nname: middleSetName, setType: undefined,\nparameters: [left, middle, right]\n},\n{\nname: rightSetName, setType: undefined,\nparameters: [left, middle, right]\n},\n],\n// ....\n},\n\nrules: [\n'FuzzySetNameA => FuzzySetNameT',\n'FuzzySetNameA and FuzzySetNameB => FuzzySetNameT',\n'FuzzySetNameA or FuzzySetNameB => FuzzySetNameT',\n// ...\n]\n\n}\n
    "},{"location":"fuzzy/#set-input","title":"Set input","text":"
    fuzzyModule.fuzzify(variableName, value);\n
    • variableName : An antecedent variable name string.
    • value : A number.

    or

    fuzzyModule.fuzzify({\nvarName: value,\n});\n
    "},{"location":"fuzzy/#get-result","title":"Get result","text":"
    var result = fuzzyModule.defuzzify(variableName);\n
    • variableName : A consequence variable name string.

    or

    var result = fuzzyModule.defuzzify([varName0, varName1, ...]);\n
    • result : {varName0: value0, varName1, value1, ...}

    or

    var result = fuzzyModule.defuzzify();\n
    • result : {varName0: value0, varName1, value1, ...}
      • Grab variable names from all consequence of rules.
    "},{"location":"game/","title":"Game","text":""},{"location":"game/#boot","title":"Boot","text":"
    var config = {\ntype: Phaser.AUTO,\nparent: null,\nwidth: 1024,\nheight: 768,\nscale: {\nmode: Phaser.Scale.FIT,\nautoCenter: Phaser.Scale.CENTER_BOTH\n},\n\nscene: null\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"game/#configuration","title":"Configuration","text":"

    Reference

    {\ntype: Phaser.AUTO,\nparent: 'phaser-example',\nwidth: 800,\nheight: 600,\nscale: {\nmode: Phaser.Scale.FIT,\nautoCenter: Phaser.Scale.CENTER_BOTH\n},\ndom: {\ncreateContainer: false,\n},\nscene: null,\nbackgroundColor: 0x333333\n}\n

    or

    {\ntype: Phaser.AUTO,\nparent: null,\nwidth: 800,\nheight: 600,\n\nscale: {\nmode: Phaser.Scale.NONE,\nautoCenter: Phaser.Scale.NO_CENTER,\nresizeInterval: 500,\n// width:\n// height:\n// zoom:\n// parent:\nexpandParent: true.\n// min: {width: 0, height: 0},\n// max: {width: 0, height: 0},\n// snap: {width: 0, height: 0},\n// autoRound: false,\nfullscreenTarget: null,\n},\n\nautoRound: false,\ncanvas: null,\ncanvasStyle: null,\n\nscene: null,\n\ncallbacks: {\npreBoot: NOOP,\npostBoot: NOOP\n},\n\nseed: [ (Date.now() * Math.random()).toString() ],\n\ntitle: '',\nurl: 'https://phaser.io',\nversion: '',\n\nautoFocus: true,\ninput: {\nkeyboard: {\ntarget: window\n},\nmouse: {\ntarget: null,\ncapture: true\n},\nactivePointers: 1,\ntouch: {\ntarget: null,\ncapture: true\n},\nsmoothFactor: 0,\ngamepad: false,\nwindowEvents: true,\n},\ndisableContextMenu: false,\n\nbackgroundColor: 0,\n\nrender: {\nantialias: true,\nantialiasGL: true,\ndesynchronized: false,\npixelArt: false,\nroundPixels: false,\ntransparent: false,\nclearBeforeRender: true,\npreserveDrawingBuffer: false,\npremultipliedAlpha: true,\nfailIfMajorPerformanceCaveat: false,\npowerPreference: 'default', // 'high-performance', 'low-power' or 'default'\nbatchSize: 4096,\nmaxLights: 10,\nmaxTextures: -1,\nmipmapFilter: 'LINEAR', // 'NEAREST', 'LINEAR', 'NEAREST_MIPMAP_NEAREST', 'LINEAR_MIPMAP_NEAREST', 'NEAREST_MIPMAP_LINEAR', 'LINEAR_MIPMAP_LINEAR'\nautoMobilePipeline: true,\ndefaultPipeline: 'MultiPipeline',\npipeline:[]\n},\ndisablePreFX: false,\ndisablePostFX: false,\n\nphysics: {\ndefault: false,  // 'arcade', or 'matter'\narcade: {...},   // See arcade-world#Configuration\nmatter: {...},   // See matterjs-world#Configuration\n},\n\nloader:{\nbaseURL: '',\npath: '',\nmaxParallelDownloads: 4,\ncrossOrigin: undefined,\nresponseType: '',\nasync: true,\nuser: '',\npassword: '',\ntimeout: 0,\nmaxRetries: 2,\nwithCredentials: false,\nimageLoadType: 'XHR',    // 'HTMLImageElement' \nlocalScheme: [ 'file://', 'capacitor://' ]\n},\n\nimages: {\ndefault: 'data:image/png;base64....',\nmissing: 'data:image/png;base64....',\nwhite: 'data:image/png;base64....',\n},\n\naudio: {\ndisableWebAudio: false,\ncontext:\nnoAudio: false,\n},\n\ndom: {\ncreateContainer: false,\nbehindCanvas: false,\npointerEvents: 'none'\n},\n\nplugins: {\nglobal: [\n//{key, plugin, start}\n],\nscene: [\n// ...\n]\n},\n\npipeline: { key:PipelineClass },\n\nfps: {\nmin: 10,\ntarget: 60,\nlimit: 0,\nforceSetTimeOut: false,\ndeltaHistory: 10,\npanicMax: 120,\nsmoothStep: true,\n},\n\nbanner: {\nhidePhaser: false,\ntext: '#ffffff',\nbackground: [\n'#ff0000',\n'#ffff00',\n'#00ff00',\n'#00ffff',\n'#000000'\n]\n},\n// banner: false,\n\nstableSort: -1\n}\n
    "},{"location":"game/#destroy","title":"Destroy","text":"
    game.destroy();\n// game.destroy(removeCanvas, noReturn);\n
    • removeCanvas : Set to true if you would like the parent canvas element removed from the DOM, or false to leave it in place.
    • noReturn : If true all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this.
    "},{"location":"game/#global-members","title":"Global members","text":""},{"location":"game/#scene-manager","title":"Scene manager","text":"

    Global scene manager in game.scene, or scene.scene in each scene.

    "},{"location":"game/#global-data","title":"Global data","text":"

    Instance of data manager in game.registry, or scene.registry in each scene.

    • Get
      var value = scene.registry.get(key);\n// var value = game.registry.get(key);\n
    • Set
      scene.registry.set(key, value);\n// game.registry.set(key, value);\n
    • Event
      • Set data event
        scene.registry.events.on('setdata', function(parent, key, value){ /* ... */ });\n// game.registry.events.on('setdata', function(parent, key, value){ /* ... */ })\n
      • Change data event
        scene.registry.events.on('changedata', function(parent, key, value, previousValue){ /* ... */ });\n// game.registry.events.on('changedata', function(parent, key, value, previousValue){ /* ... */ })\n
        scene.registry.events.on('changedata-' + key, function(parent, value, previousValue){ /* ... */ });\n// game.registry.events.on('changedata-' + key, function(parent, value, previousValue){ /* ... */ });\n
    "},{"location":"game/#game-time","title":"Game time","text":"
    • The time that the current game step started at.
      var time = game.getTime();\n// var time = scene.game.getTime();\n
    • The current game frame.
      var frameCount = game.getFrame();\n// var frameCount = scene.game.getFrame();\n
    • The delta time, since the last game step. This is a clamped and smoothed average value.
      var delta = game.loop.delta;\n// var delta = scene.game.loop.delta;\n
    "},{"location":"game/#game-config","title":"Game config","text":"
    var config = game.config;\n// var config = scene.game.config;\n
    "},{"location":"game/#window-size","title":"Window size","text":"
    • Width
      var width = game.config.width;\n// var width = scene.game.config.width;\n
    • Height
      var height = game.config.height;\n// var height = scene.game.config.height;\n
    "},{"location":"game/#pause-resume","title":"Pause / Resume","text":"
    • Pause the entire game and emit a PAUSE event.
      game.pause();\n
    • Resume the entire game and emit a RESUME event.
      game.resume();\n
    • Get pause duration
      var time = game.pauseDuration;\n
    • Is paused
      var isPaused = game.isPaused;\n
    "},{"location":"game/#events","title":"Events","text":"
    • Pause(window is invisible)/Resume(window is visible)
      game.events.on('pause', function() {});\n
      game.events.on('resume', function() {});\n
    • Destroy event, triggered by game.destroy()
      game.events.on('destroy', function() {})\n
    • On window focused/blurred
      game.events.on('focus', function() {})\n
      game.events.on('blur', function(){ })\n
    "},{"location":"gameobject/","title":"Game object","text":""},{"location":"gameobject/#introduction","title":"Introduction","text":"

    Base class of all game object in phaser.

    • Author: Richard Davey
    "},{"location":"gameobject/#usage","title":"Usage","text":""},{"location":"gameobject/#destroy","title":"Destroy","text":"
    • Destroy game object
      gameObject.destroy();\n
    • Game object will be destroyed automatically when scene destroyed, if it is in display list, or update list.
    • Event
      gameObject.once('destroy', function(gameObject, fromScene) {\n\n}, scope);\n
      • fromScene : true if game object is destroyed during scene is shutdown. When scene is shutdown, all game objects will be destroyed.
    "},{"location":"gameobject/#position","title":"Position","text":"
    • Get
      var x = gameObject.x;\nvar y = gameObject.y;\n
    • Set
      gameObject.x = 0;\ngameObject.y = 0;\ngameObject.setPosition(x,y);\ngameObject.setX(x);\ngameObject.setY(y);\n
      • Set random
        gameObject.setRandomPosition(x, y, width, height);\n// gameObject.setRandomPosition(); // x=0, y=0, width=game.width, height=game.height\n
    "},{"location":"gameobject/#local-point","title":"Local point","text":"

    Transfer world point to local point

    var point = gameObject.getLocalPoint(x, y);  // point : {x, y}\n// var out = gameObject.getLocalPoint(x, y, out);\n
    or
    var out = gameObject.getLocalPoint(x, y, out, camera);\n

    "},{"location":"gameobject/#angle","title":"Angle","text":"
    • Get
      var angle = gameObject.angle;\nvar radians = gameObject.rotation;  // angle in radians\n
    • Set
      gameObject.angle = degrees;\ngameObject.rotation = radians;\ngameObject.setAngle(degrees);\ngameObject.setRotation(radians);\n
    "},{"location":"gameobject/#visible","title":"Visible","text":"
    • Get
      var visible = gameObject.visible; // visible: true/false\n
    • Set
      gameObject.visible = visible;\ngameObject.setVisible(visible);\n
    "},{"location":"gameobject/#alpha","title":"Alpha","text":"
    • Get
      var alpha = gameObject.alpha;  // 0~1\n
    • Set
      gameObject.setAlpha(alpha);\n// gameObject.alpha = alpha;\n
      or
      gameObject.setAlpha(topLeft, topRight, bottomLeft, bottomRight);\n// gameObject.alphaTopLeft = alpha;\n// gameObject.alphaTopRight = alpha;\n// gameObject.alphaBottomLeft = alpha;\n// gameObject.alphaBottomRight = alpha;\n
    • Clear (set to 1)
      gameObject.clearAlpha();\n
    "},{"location":"gameobject/#flipx-flipy","title":"FlipX, FlipY","text":"
    • Get
      var flip = gameObject.flipX;  // flip: true/false\nvar flip = gameObject.flipY;  // flip: true/false\n
    • Set
      gameObject.flipX = flip;\ngameObject.flipY = flip;\ngameObject.setFlipX(flip);\ngameObject.setFlipY(flip);\ngameObject.setFlip(flipX, flipY);\ngameObject.toggleFlipX();\ngameObject.toggleFlipY();\ngameObject.resetFlip();  // equal to gameObject.setFlip(false, false);\n
    "},{"location":"gameobject/#order-of-rendering","title":"Order of rendering","text":""},{"location":"gameobject/#depth-z-index","title":"Depth (z-index)","text":"

    The depth starts from zero (the default value) and increases from that point. A game object with a higher depth value will always render in front of one with a lower value.

    • Get
      var depth = gameObject.depth;\n
    • Set
      gameObject.depth = value;\ngameObject.setDepth(value);\n
    "},{"location":"gameobject/#display-list","title":"Display list","text":"
    • Get displayList
      var displayList = gameObject.getDisplayList();\n
    • Move the game Object to the top of the display list
      gameObject.setToTop()\n
      var displayList = gameObject.getDisplayList();\ndisplayList.bringToTop(child);\n
    • Move the game Object to the bottom of the display list
      gameObject.setToBack()\n
      var displayList = gameObject.getDisplayList();\ndisplayList.sendToBack(child);\n
    • Move the Game Object to appear above a given Game Object
      gameObject.setAbove(givenGameObject)\n
      var displayList = gameObject.getDisplayList();\ndisplayList.moveAbove(gameObject, givenGameObject);\n
    • Move the Game Object to appear below a given Game Object
      gameObject.setBelow(givenGameObject)\n
      var displayList = gameObject.getDisplayList();\ndisplayList.moveBelow(gameObject, givenGameObject);\n
    • Move the game object by index
      var displayList = gameObject.getDisplayList();\ndisplayList.moveTo(gameObject, index);\n
    • Swap two game objects
      var displayList = gameObject.getDisplayList();\ndisplayList.swap(gameObject, givenGameObject);\n
    • Move up or down
      var displayList = gameObject.getDisplayList();\ndisplayList.moveUp(gameObject);\ndisplayList.moveDown(gameObject);\n
    "},{"location":"gameobject/#layer-game-object","title":"Layer game object","text":"

    Place game object into Layer game object

    "},{"location":"gameobject/#scroll-factor","title":"Scroll factor","text":"
    • Get
      var scrollFactorX = gameObject.scrollFactorX;\nvar scrollFactorY = gameObject.scrollFactorY;\n
    • Set
      gameObject.setScrollFactor(scrollFactor);\ngameObject.setScrollFactor(scrollFactorX, scrollFactorY);\n

    Scroll factor: 0~1

    • 0= fixed to camera
    • 0.25= quarter the speed of the camera
    • 0.5= half the speed of the camera
    "},{"location":"gameobject/#bounds","title":"Bounds","text":"
    var output = gameObject.getTopLeft(output);     // output: {x, y}\nvar output = gameObject.getTopCenter(output);     // output: {x, y}\nvar output = gameObject.getTopRight(output);    // output: {x, y}\nvar output = gameObject.getLeftCenter(output);    // output: {x, y}\nvar output = gameObject.getRightCenter(output);    // output: {x, y}\nvar output = gameObject.getBottomLeft(output);  // output: {x, y}\nvar output = gameObject.getBottomCenter(output);     // output: {x, y}\nvar output = gameObject.getBottomRight(output); // output: {x, y}\nvar output = gameObject.getCenter(output);      // output: {x, y}\nvar output = gameObject.getBounds(output);      // output: {x, y, width, height}\n
    "},{"location":"gameobject/#origin","title":"Origin","text":"
    • Get
      var originX = gameObject.originX;\nvar originY = gameObject.originY;\n
    • Set
      gameObject.setOrigin(x, y);\n// gameObject.setOrigin(x); // y = x\n
      • Set to top-left
        gameObject.setOrigin(0);\n
      • Set to center
        gameObject.setOrigin(0.5);\n
      • Set to bottom-right
        gameObject.setOrigin(1);\n
    "},{"location":"gameobject/#tint","title":"Tint","text":"
    • Get
      var color = gameObject.tintTopLeft;     // color: 0xRRGGBB\nvar color = gameObject.tintTopRight;\nvar color = gameObject.tintBottomLeft;\nvar color = gameObject.tintBottomRight;\nvar isTinted = gameObject.isTinted;\n
    • Set
      gameObject.tint = color;\ngameObject.setTint(color);  // multiply color value\ngameObject.setTint(colorTopLeft, colorTopRight, colorBottomLeft, colorBottomRight);\ngameObject.setTintFill(color);  // replace color value\ngameObject.setTintFill(colorTopLeft, colorTopRight, colorBottomLeft, colorBottomRight);    gameObject.clearTint();     // equal to `gameObject.setTint(0xffffff)`\n

    Note

    gameObject.tint is a write-only property

    "},{"location":"gameobject/#blend-mode","title":"Blend mode","text":"
    • Get
      var blendMode = gameObject.blendMode;\n
    • Set
      gameObject.blendMode = blendMode;\ngameObject.setBlendMode(blendMode);\n
      • blendMode : Blend mode
    "},{"location":"gameobject/#mask","title":"Mask","text":"

    See Mask.

    "},{"location":"gameobject/#built-in-shader-effects","title":"Built-in shader effects","text":"

    See built-in shader effects

    "},{"location":"gameobject/#post-fx-pipeline","title":"Post-fx pipeline","text":""},{"location":"gameobject/#register-post-fx-pipeline","title":"Register post-fx pipeline","text":"
    • Register post-fx pipeline in game config
      import PostFxClass from 'path';\nvar config = {\n// ...\npipeline: [PostFxClass]\n// ...\n};\nvar game = new Phaser.Game(config);\n

    Some post-fx pipelines:

    • Barrel: Barrel post processing filter.
    • Color replace: Replace color post processing filter.
    • Cross-stitching: Cross-stitching post processing filter.
    • Dissolve: Dissolve transition post processing filter.
    • Fish eye: Fish-eye post processing filter.
    • Glow-filter: Glow post processing filter.
    • Glow-filter: Glow post processing filter, ported from pixi.
    • Gray-scale: Gray scale post processing filter.
    • Hsl-adjust: Adjust color in HSL domain, post processing filter.
    • Horri-fi: 6-in-1 post processing filter.
    • Inverse: Inverse color post processing filter.
    • Kawase-blur: Kawase-blur post processing filter.
    • Pixelation: Pixelation post processing filter.
    • Toonify: Draw outlines and quantize color in HSV domain, post processing filter.
    • Shockwave: Shockwave post processing filter.
    • Split: Split image into 4 parts.
    • Swirl: Swirl post processing filter.
    • Warp: Warp post processing filter.
    "},{"location":"gameobject/#add-post-fx-pipeline","title":"Add post-fx pipeline","text":"
    gameObject.setPostPipeline(PostFxClass);\n
    • PostFxClass : Class of post-fx pipeline.
    "},{"location":"gameobject/#remove-post-fx-pipeline","title":"Remove post-fx pipeline","text":"
    • Remove a post-fx pipeline
      gameObject.removePostPipeline(PostFxClass);\n
    • Remove all post-fx pipelines
      gameObject.resetPipeline(true);\n
      or
      gameObject.postPipelines = [];\ngameObject.hasPostPipeline = false;\n
    "},{"location":"gameobject/#get-post-fx-pipeline","title":"Get post-fx pipeline","text":"
    var pipelineInstance = gameObject.getPostPipeline(PostFxClass);\n
    "},{"location":"gameobject/#size","title":"Size","text":"
    • Native (un-scaled) size
      • Get
        var width = gameObject.width;\nvar height = gameObject.height;\n
      • Set
        gameObject.setSize(width, height);\n
        or
        gameObject.width = width;\ngameObject.height = height;\n
    • Display size
      • Get
        var displayWidth = gameObject.displayWidth;\nvar displayHeight = gameObject.displayHeight;\n
      • Set
        gameObject.setDisplaySize(displayWidth, displayHeight);\n
        or
        gameObject.displayWidth = displayWidth;\ngameObject.displayHeight = displayHeight;\n
    • Scale
      • Get
        var scaleX = gameObject.scaleX;\nvar scaleY = gameObject.scaleY;\n
        or
        var scale = gameObject.scale;  // Return (scaleX + scaleY)/2\n
      • Set
        gameObject.setScale(scaleX, scaleY);\n
        or
        gameObject.scaleX = scaleX;\ngameObject.scaleY = scaleY;\n
        or
        gameObject.scale = scale;  // Set scaleX, scaleY to scale\n
    "},{"location":"gameobject/#click","title":"Click","text":"
    gameObject.setInteractive().on('pointerdown', function(pointer, localX, localY, event){\n// ...\n});\n

    See touch event

    "},{"location":"gameobject/#state","title":"State","text":"
    • Get
      var state = gameObject.state;\n
    • Set
      gameObject.setState(state);\n
    "},{"location":"gameobject/#data","title":"Data","text":"
    • Get
      var value = gameObject.getData(key);\nvar values = gameObject.getData(keys); // keys: an array of keys\nvar value = gameObject.data.values[key];\n
    • Set
      gameObject.setData(key, value);\ngameObject.incData(key, value);    gameObject.setData(obj); // obj: {key0:value0, key1:value1, ...}\ngameObject.data.values[key] = value;\ngameObject.data.values[key] += inc;\n
      or
      gameObject.toggleData(key);\n
    • Enable
      gameObject.setDataEnabled();\n
    • Events :
      • Set data evant
        gameObject.on('setdata', function(gameObject, key, value){ /* ... */ });\n
      • Change data event
        gameObject.on('changedata', function(gameObject, key, value, previousValue){ /* ... */ });\n
        gameObject.on('changedata-' + key, function(gameObject, value, previousValue){ /* ... */ });\n

    See data manager

    Note

    Ensure data manager is created before binding any data-changed events.

    "},{"location":"gameobject/#texture","title":"Texture","text":"
    • Set texture via key string
      gameObject.setTexture(key);\n// gameObject.setTexture(key, frame);\n// gameObject.setTexture(key, frame, updateSize, updateOrigin);\n
    • Set texture via texture object
      gameObject.setTexture(texture);\n// gameObject.setTexture(texture, frame);\n
      • texture : Texture object, or canvas texture object
    • Set frame
      gameObject.setFrame(frame);\n// gameObject.setFrame(frame, updateSize, updateOrigin);\n
      • frame :\u3000The name or index of the frame within the Texture.
      • updateSize : Should this call adjust the size of the Game Object?
      • updateOrigin : Should this call adjust the origin of the Game Object?
    • Set frame by frame object
      gameObject.setFrame(frameObject);\n// gameObject.setFrame(frameObject, updateSize, updateOrigin);\n
    • Applies a crop to a texture
      gameObject.setCrop(x, y, width, height);\n
      The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left.
      • Reset crop
        gameObject.setCrop();\n// gameObject.isCropped = false;\n
    • Get texture, frame.
      var texture = gameObject.texture;\nvar frame = gameObject.frame;\n
    • Get texture key, frame name.
      var textureKey = gameObject.texture.key;\nvar frameName = gameObject.frame.name;\n
    "},{"location":"gameobject/#name","title":"Name","text":"
    • Get
      var name = gameObject.name;\n
    • Set
      gameObject.setName(name);\ngameObject.name = name;\n
    "},{"location":"gameobject/#will-render","title":"Will render","text":"
    • Test render flag and camera filter.
      var willRennder = gameObject.willRender(camera);\n
    • Test render flag only
      var willRender = (gameObject.renderFlags === Phaser.GameObjects.GameObject.RENDER_MASK);\n
      • Phaser.GameObjects.GameObject.RENDER_MASK : 15 (Visible, Alpha, Transform and Texture)
    "},{"location":"gameobject/#add-to-scenecontainer","title":"Add to scene/container","text":""},{"location":"gameobject/#add","title":"Add","text":"

    Trigger 'addedtoscene' event, which invoke gameObject.addedToScene()

    • Register 'addedtoscene' event
      gameObject.on('addedtoscene', function(gameObject, scene){});\n
    • Or, override addedToScene method
      class MyClass extends BaseClass {\n// ...\naddedtoscene() {\nsuper.addedtoscene();\n// ...\n}\n}\n
    "},{"location":"gameobject/#remove","title":"Remove","text":"

    Trigger 'removedfromscene' event, which invoke gameObject.removedFromScene()

    • Register 'removedfromscene' event
      gameObject.on('removedfromscene', function(gameObject, scene){});\n
    • Or, override removedFromScene method
      class MyClass extends BaseClass {\n// ...\nremovedFromScene() {\nsuper.removedFromScene();\n// ...\n}\n}\n
    "},{"location":"gameobject/#custom-class","title":"Custom class","text":"
    • Define class
      class MyClass extends BaseClass {\nconstructor(scene, x, y) {\nsuper(scene, x, y);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     if (super.preUpdate) {\n//         super.preUpdate(time, delta);\n//     }\n// }\n\n// destroy(fromScene) {\n//     //  This Game Object has already been destroyed\n//     if (!this.scene) {\n//         return;\n//     }\n//     super.destroy(fromScene);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
          • Some kinds of game object like Sprite, Dom-element has preUpdate method already.
    • Create instance
      var image = new MyClass(scene, x, y, key);\n
    "},{"location":"gamepad/","title":"Gamepad","text":""},{"location":"gamepad/#introduction","title":"Introduction","text":"

    Gamepad's state of buttons, or axis.

    • Author: Richard Davey
    "},{"location":"gamepad/#usage","title":"Usage","text":""},{"location":"gamepad/#enable-gamepad-manager","title":"Enable gamepad manager","text":"
    var config = {\n// ...\ninput: {\ngamepad: true\n},\n// ...\n}\nvar game = new Phaser.Game(config);\n
    "},{"location":"gamepad/#get-gamepad","title":"Get gamepad","text":"
    • Get all currently connected Gamepads.
      var gamepads = scene.input.gamepad.getAll();\n
    • Get gamepad by index
      var gamepad = scene.input.gamepad.getPad(0);\n// var gamepad = scene.input.gamepad.getPad(index);\n
    • Get gamepad when button-down.
      scene.input.gamepad.once('down', function (gamepad, button, value) {\n}\n
      • gamepad : A reference to the Gamepad on which the button was released. See Properties of gamepad
      • button : A reference to the Button which was released.
      • value : The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons.
    "},{"location":"gamepad/#events","title":"Events","text":"
    • Button down
      scene.input.gamepad.on('down', function (gamepad, button, value) {\n})\n
      or
      gamepad.on('down', function(buttonIndex, value, button) {\n})\n
    • Button up
      scene.input.gamepad.on('up', function (gamepad, button, value) {\n}\n
      or
      gamepad.on('up', function(buttonIndex, value, button) {\n})\n
    • Gamepad connected
      scene.input.gamepad.on('connected', function (gamepad, event) {\n}\n
    • Gamepad disconnected
      scene.input.gamepad.on('disconnected', function (gamepad, event) {\n}\n
    "},{"location":"gamepad/#gamepad","title":"Gamepad","text":""},{"location":"gamepad/#buttons","title":"Buttons","text":"
    • Cursor buttons
      var isLeftDown = gamepad.left;\nvar isRightftDown = gamepad.right;\nvar isUpDown = gamepad.up;\nvar isDownDown = gamepad.down;\n
    • Right buttons cluster
      var isADown = gamepad.A;  // Dual Shock controller: X button\nvar isYDown = gamepad.Y;  // Dual Shock controller: Triangle button\nvar isXDown = gamepad.X;  // Dual Shock controller: Square button.\nvar isBDown = gamepad.B;  // Dual Shock controller: Circle button\n
    • Shoulder buttons
      var isL1Down = gamepad.L1; // XBox controller: LB button\nvar isL2Down = gamepad.L2; // XBox controller: LT button\nvar isR1Down = gamepad.R1; // XBox controller: RB button\nvar isR2Down = gamepad.R2; // XBox controller: RT button\n
    "},{"location":"gamepad/#axis-sticks","title":"Axis sticks","text":"
    • Left sticks, right sticks
      var leftStick = gamepad.leftStick;\nvar rightStick = gamepad.rightStick;\n
      • leftStick, rightStick : Read only vector2.
        • Angle : leftStick.angle()
        • Length : leftStick.length()
        • x, y : leftStick.x , leftStick.y
    "},{"location":"gamepad/#properties","title":"Properties","text":"
    • gamepad.index : An integer that is unique for each Gamepad currently connected to the system. This can be used to distinguish multiple controllers. Note that disconnecting a device and then connecting a new device may reuse the previous index.
    • gamepad.id : A string containing some information about the controller.
    • gamepad.buttons : An array of Gamepad Button objects, corresponding to the different buttons available on the Gamepad.
    • gamepad.axes : An array of Gamepad Axis objects, corresponding to the different axes available on the Gamepad, if any.
    "},{"location":"gashapon/","title":"Gashapon","text":""},{"location":"gashapon/#introduction","title":"Introduction","text":"

    Pick random item from box.

    • Author: Rex
    • Member of scene, or game object
    "},{"location":"gashapon/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gashapon/#install-plugin","title":"Install plugin","text":""},{"location":"gashapon/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgashaponplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgashaponplugin.min.js', true);\n
    • Add gashapon object
      var gashapon = scene.plugins.get('rexgashaponplugin').add(config);\n
    "},{"location":"gashapon/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GashaponPlugin from 'phaser3-rex-plugins/plugins/gashapon-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGashapon',\nplugin: GashaponPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add gashapon object
      var gashapon = scene.plugins.get('rexGashapon').add(config);\n
    "},{"location":"gashapon/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Gashapon from 'phaser3-rex-plugins/plugins/gashapon.js';\n
    • Add gashapon object
      var gashapon = new Gashapon(config);\n
    "},{"location":"gashapon/#create-instance","title":"Create instance","text":"
    var gashapon = scene.plugins.get('rexGashapon').add({\nmode: 'shuffle',  // 0|'shuffle'|1|'random\nitems: {  // name:count\na:1, b:2, c:3 },\nreload: true,     // true|false\nrnd: undefined,\n});\n
    • mode :
      • 'shuffle', or 0 : pick item from box without put it back.
      • 'random', or 1 : pick item from box then put it back.
    • reload : set true to reload items when box is empty for shuffle mode.
    • items : initial items { name:count } in box.
    • rnd : Use random data generator to generate result.
      • undefined : Use Math.random() to generate result.
      • Phaser.Math.RND : Use pre-defined random data generator.
    "},{"location":"gashapon/#pick-item","title":"Pick item","text":"
    • Pick a random item
      var item = gashapon.next();\n
      • return null if pick nothing
    • Pick specific item
      var item = gashapon.next(name);\n
      • return null if pick nothing
    • Last picked item
      var item = gashapon.result;\n
    "},{"location":"gashapon/#set-item","title":"Set item","text":"
    • Set item
      gashapon.setItem(name, count);\n
    • Add item
      gashapon.addItem(name, count);\n
    • Put item back
      gashapon.putItemBack(name, count);\n
    "},{"location":"gashapon/#remove-item","title":"Remove item","text":"
    • Remove item
      gashapon.removeItem(name);\n
    • Remove all items
      gashapon.removeAllItems();\n
    "},{"location":"gashapon/#current-status","title":"Current status","text":"
    • Get current status
      var status = gashapon.toJSON();\n
    • Clone object
      var state = gashapon.toJSON();\nvar gashapon2 = new Gashapon(state);\n
    • Overwrite current status
      var status = gashapon.toJSON();\n// gashapon.next()...\ngashapon.resetFromJSON(status);\n
    "},{"location":"gashapon/#get-items","title":"Get items","text":"
    • Get initial items
      var items = gashapon.getItems();\n
    • Get remainder items
      var items = gashapon.getRemain();\n
    • Get initial item count
      var count = gashapon.getItemCount(name);\n
    • Get remainder item count
      var count = gashapon.getRemainCount(name);\n
    • For each initial item
      gashapon.forEachItem(function(name, count) {\n\n}, scope);\n
    • For each remainder item
      gashapon.forEachRemain(function(name, count) {\n\n}, scope);\n
    "},{"location":"gashapon/#set-random-generator","title":"Set random generator","text":"
    gashapon.setRND(rnd);\n
    • rnd : Use random data generator to generate result.
      • undefined, or null : Use Math.random() to generate result.
      • Phaser.Math.RND : Use pre-defined random data generator.
    "},{"location":"geom-circle/","title":"Circle","text":""},{"location":"geom-circle/#introduction","title":"Introduction","text":"

    Circle shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-circle/#usage","title":"Usage","text":""},{"location":"geom-circle/#create-shape","title":"Create shape","text":"
    var circle = new Phaser.Geom.Circle(x, y, radius);\n
    "},{"location":"geom-circle/#clone-shape","title":"Clone shape","text":"
    var circle1 = Phaser.Geom.Circle.Clone(circle0);\n
    "},{"location":"geom-circle/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillCircleShape(circle);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeCircleShape(circle);\n

    Note

    Negative radius will be treated as positive radius. i.e. Math.abs(radius)

    "},{"location":"geom-circle/#set-properties","title":"Set properties","text":"
    • All properties
      circle.setTo(x, y, radius);\n
      or
      Phaser.Geom.Circle.CopyFrom(source, dest);\n
    • Position
      circle.setPosition(x, y);\n
      or
      circle.x = 0;\ncircle.y = 0;\n
      or
      circle.left = 0;       // circle.x\ncircle.top = 0;        // circle.y\n// circle.right = 0;   // circle.x\n// circle.bottom = 0;  // circle.y\n
      or
      Phaser.Geom.Circle.Offset(circle, dx, dy); // circle.x += dx, circle.y += dy\n
      or
      Phaser.Geom.Circle.OffsetPoint(circle, point); // circle.x += point.x, circle.y += point.y\n
    • Radius
      circle.radius = radius;\n
      or
      circle.diameter = diameter;  // diameter = 2 * radius\n
    "},{"location":"geom-circle/#get-properties","title":"Get properties","text":"
    • Position
      var x = circle.x;\nvar y = circle.y;\nvar top = circle.top;\nvar left = circle.left;\nvar right = circle.right;\nvar bottom = circle.bottom;\n
    • Radius
      var radius = circle.radius;\n// var diameter = circle.diameter;\n
    • Bound
      var bound = Phaser.Geom.Circle.GetBounds(circle);\n// var bound = Phaser.Geom.Circle.GetBounds(circle, bound);  // push bound\n
      • bound : A Rectangle shape object
    • Area
      var area = Phaser.Geom.Circle.Area(circle);\n
    • Circumference
      var circumference = Phaser.Geom.Circle.Circumference(circle);\n
    • Type:
      var type = circle.type; // 0\n
    "},{"location":"geom-circle/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = circle.getPoint(t);  // t : 0 ~ 1 (angle/360)\n// var point = circle.getPoint(t, point);  // modify point\n
      or
      var point = Phaser.Geom.Circle.CircumferencePoint(circle, angle);  // angle in degrees\n// var point = Phaser.Geom.Circle.CircumferencePoint(circle, angle, point);  // modify point\n
    • Get a random point inside shape
      var point = circle.getRandomPoint();\n// var point = circle.getRandomPoint(point);  // modify point\n
    • Get points around shape's edge
      var points = circle.getPoints(quantity);\n// var points = circle.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = circle.getPoints(false, step);\n// var points = circle.getPoints(false, step, points);  // push points\n
      • points : an array of point
    • Point is inside shape
      var isInside = circle.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Circle.ContainsPoint(circle, point);\n
    • Rectangle is inside shape
      var isInside = Phaser.Geom.Circle.ContainsRect(circle, rect);  // rect : 4 points\n
    "},{"location":"geom-circle/#empty","title":"Empty","text":"
    • Set empty
      circle.setEmpty();     // circle.radius = 0\n
    • Is empty
      var isEmpty = circle.isEmpty();   // circle.radius <= 0\n
    "},{"location":"geom-circle/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Circle.Equals(circle0, circle1);\n

    Position and radius are equal.

    "},{"location":"geom-circle/#intersection","title":"Intersection","text":""},{"location":"geom-circle/#circle-to-circle","title":"Circle to circle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.CircleToCircle(circleA, circleB);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetCircleToCircle(circleA, circleB);\n// var out = Phaser.Geom.Intersects.GetCircleToCircle(circleA, circleB, out);\n
    "},{"location":"geom-circle/#circle-to-rectangle","title":"Circle to rectangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.CircleToRectangle(circle, rect);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetCircleToRectangle(circle, rect);\n// var out = Phaser.Geom.Intersects.GetCircleToRectangle(circle, rect, out);\n
    "},{"location":"geom-circle/#circle-to-triangle","title":"Circle to triangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToCircle(triangle, circle);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToCircle(triangle, circle);\n// var out = Phaser.Geom.Intersects.GetTriangleToCircle(triangle, circle, out);\n
    "},{"location":"geom-circle/#circle-to-line","title":"Circle to line","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.LineToCircle(line, circle);\n// var result = Phaser.Geom.Intersects.LineToCircle(line, circle, nearest);\n
      • nearest : Nearest point on line.
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetLineToCircle(line, circle);\n// var out = Phaser.Geom.Intersects.GetLineToCircle(line, circle, out);\n
    "},{"location":"geom-ellipse/","title":"Ellipse","text":""},{"location":"geom-ellipse/#introduction","title":"Introduction","text":"

    Ellipse shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-ellipse/#usage","title":"Usage","text":""},{"location":"geom-ellipse/#create-shape","title":"Create shape","text":"
    var ellipse = new Phaser.Geom.Ellipse(x, y, width, height);\n
    "},{"location":"geom-ellipse/#clone-shape","title":"Clone shape","text":"
    var ellipse1 = Phaser.Geom.Ellipse.Clone(ellipse0);\n
    "},{"location":"geom-ellipse/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillEllipseShape(ellipse);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeEllipseShape(ellipse);\n

    Note

    Negative width, height will be treated as positive width, height. i.e. Math.abs(width), Math.abs(height)

    "},{"location":"geom-ellipse/#set-properties","title":"Set properties","text":"
    • All properties
      ellipse.setTo(x, y, width, height);\n
      or
      Phaser.Geom.Ellipse.CopyFrom(source, dest);\n
    • Position
      ellipse.setPosition(x, y);\n
      or
      ellipse.x = 0;\nellipse.y = 0;\n
      or
      ellipse.left = 0;       // ellipse.x\nellipse.top = 0;        // ellipse.y\n// ellipse.right = 0;   // ellipse.x\n// ellipse.bottom = 0;  // ellipse.y\n
      or
      Phaser.Geom.Ellipse.Offset(ellipse, dx, dy); // ellipse.x += dx, ellipse.y += dy\n
      or
      Phaser.Geom.Ellipse.OffsetPoint(ellipse, point); // ellipse.x += point.x, ellipse.y += point.y\n
    • Width, height
      ellipse.width = width;\nellipse.height = height;\n
    "},{"location":"geom-ellipse/#get-properties","title":"Get properties","text":"
    • Position
      var x = ellipse.x;\nvar y = ellipse.y;\nvar top = ellipse.top;\nvar left = ellipse.left;\nvar right = ellipse.right;\nvar bottom = ellipse.bottom;\n
    • Width, height
      var width = ellipse.width;\nvar height = ellipse.height;\n
    • Bound
      var bound = Phaser.Geom.Ellipse.GetBounds(ellipse);\n// var bound = Phaser.Geom.Ellipse.GetBounds(ellipse, bound);  // push bound\n
      • bound : A Rectangle shape object
    • Area
      var area = Phaser.Geom.Ellipse.Area(ellipse);\n
    • Circumference
      var circumference = Phaser.Geom.Ellipse.Circumference(ellipse);\n
    • Type:
      var type = ellipse.type; // 1\n
    "},{"location":"geom-ellipse/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = ellipse.getPoint(t);  // t : 0 ~ 1 (angle/360)\n// var point = ellipse.getPoint(t, point);  // modify point\n
      or
      var point = Phaser.Geom.Ellipse.CircumferencePoint(ellipse, angle);  // angle in degrees\n// var point = Phaser.Geom.Ellipse.CircumferencePoint(ellipse, angle, point);  // modify point\n
    • Get a random point inside shape
      var point = ellipse.getRandomPoint();\n// var point = ellipse.getRandomPoint(point);  // modify point\n
    • Get points around shape's edge
      var points = ellipse.getPoints(quantity);\n// var points = ellipse.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = ellipse.getPoints(false, step);\n// var points = ellipse.getPoints(false, step, points);  // push points\n
      • points : an array of point
    • Point is inside shape
      var isInside = ellipse.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Ellipse.ContainsPoint(ellipse, point);\n
    • Rectangle is inside shape
      var isInside = Phaser.Geom.Ellipse.ContainsRect(ellipse, rect);  // rect : 4 points\n
    "},{"location":"geom-ellipse/#empty","title":"Empty","text":"
    • Set empty
      ellipse.setEmpty();     // ellipse.width = 0, ellipse.height = 0\n
    • Is empty
      var isEmpty = ellipse.isEmpty();   // ellipse.width <= 0 || ellipse.height <= 0\n
    "},{"location":"geom-ellipse/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Ellipse.Equals(ellipse0, ellipse1);\n

    Position and width, height are equal.

    "},{"location":"geom-hexagon/","title":"Hexagon","text":""},{"location":"geom-hexagon/#introduction","title":"Introduction","text":"

    Hexagon shape and methods, extends from Polygon geometry object.

    • Author: Rex
    • Geometry object
    "},{"location":"geom-hexagon/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"geom-hexagon/#install-plugin","title":"Install plugin","text":""},{"location":"geom-hexagon/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexhexagonplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexhexagonplugin.min.js', true);\n
    • Add hexagon geometry object
      var hexagon = scene.plugins.get('rexhexagonplugin').add(x, y, size, orientationType);\n
    "},{"location":"geom-hexagon/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import HexagonPlugin from 'phaser3-rex-plugins/plugins/hexagon-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexHexagon',\nplugin: HexagonPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add hexagon geometry object
      var hexagon = scene.plugins.get('rexHexagon').add(x, y, size, orientationType);\n
    "},{"location":"geom-hexagon/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Hexagon from 'phaser3-rex-plugins/plugins/hexagon.js';\n
    • Add hexagon geometry object
      var hexagon = new Hexagon(x, y, size, orientationType);\n
    "},{"location":"geom-hexagon/#create-shape","title":"Create shape","text":"

    var hexagon = scene.plugins.get('rexHexagon').add(x, y, size, orientationType);\n
    or
    var hexagon = scene.plugins.get('rexHexagon').add({\nx: 0,\ny: 0,\nsize: 20,\norientationType: 0     // 0|'flat'|'vertical'|1|'pointy'|'horizontal'\n});\n
    or
    var hexagon = new Phaser.Geom.rexHexagon(x, y, size, orientationType);\n

    • x : Center X.
    • y : Center Y.
    • size : Distance between center to each corner.
    • orientationType : See here
      • 0, 'flat', or 'y'
      • 1, 'pointy' or ,'x'
    "},{"location":"geom-hexagon/#draw-on-graphics","title":"Draw on graphics","text":"

    See Polygon shape.

    "},{"location":"geom-hexagon/#set-properties","title":"Set properties","text":"
    • All properties
      hexagon.setTo(x, y, size, orientationType);\n
    • Position
      hexagon.setPosition(x, y);\n
      or
      hexagon.x = 0;\nhexagon.y = 0;\n
      or
      hexagon.centerX = 0;  // equal to hexagon.x\nhexagon.centerY = 0;  // equal to hexagon.y\n
      or
      hexagon.left = 0;       // hexagon.x\nhexagon.top = 0;        // hexagon.y\nhexagon.right = 0;      // hexagon.x\nhexagon.bottom = 0;     // hexagon.y\n
    • Size
      hexagon.setSize(size);\n
      or
      hexagon.size = size;\n
    • Orientation type
      hexagon.setType(orientationType);\n
      or
      hexagon.orientationType = orientationType;\n
      • orientationType : See here
        • 0, 'flat', or 'y'
        • 1, 'pointy' or ,'x'
    "},{"location":"geom-hexagon/#get-properties","title":"Get properties","text":"

    See Polygon shape.

    • Position
      • Center
        var centerX = hexagon.centerX;\nvar centerY = hexagon.centerY;\n
        or
        var centerX = hexagon.x;\nvar centerY = hexagon.y;\n
      • Bound
        var top = hexagon.top;\nvar left = hexagon.left;\nvar right = hexagon.right;\nvar bottom = hexagon.bottom;\n
    • Width
      var width = hexagon.width;\n
    • Height
      var width = hexagon.height;\n
    • Lines around hexagon
      var edge01 = hexagon.getLineA();\nvar edge12 = hexagon.getLineB();\nvar edge23 = hexagon.getLineC();\nvar edge34 = hexagon.getLineD();\nvar edge45 = hexagon.getLineE();\nvar edge50 = hexagon.getLineF();\n// var out = hexagon.getLineF(out);\n
      or
      var edge = hexagon.getEdge(edgeIdx);\n// var out = hexagon.getEdge(edgeIdx, out);\n
    "},{"location":"geom-hexagon/#points-shape","title":"Point(s) & shape","text":"

    See Polygon shape.

    "},{"location":"geom-line/","title":"Line","text":""},{"location":"geom-line/#introduction","title":"Introduction","text":"

    Line shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-line/#usage","title":"Usage","text":""},{"location":"geom-line/#create-shape","title":"Create shape","text":"
    var line = new Phaser.Geom.Line(x1, y1, x2, y2);\n
    "},{"location":"geom-line/#clone-shape","title":"Clone shape","text":"
    var line1 = Phaser.Geom.Line.Clone(line0);\n
    "},{"location":"geom-line/#draw-on-graphics","title":"Draw on graphics","text":"
    // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeLineShape(line);\n
    "},{"location":"geom-line/#set-properties","title":"Set properties","text":"
    • All properties
      line.setTo(x1, y1, x2, y2);\n
      or
      Phaser.Geom.Line.CopyFrom(source, dest);\n
    • Position
      line.x1 = 0;\nline.y1 = 0;\nline.x2 = 0;\nline.y2 = 0;\n
      or
      line.left = 0;    // min(x1, x2)\nline.top = 0;     // min(y1, y2)\nline.right = 0;   // max(x1, x2)\nline.bottom = 0;  // max(y1, y2)\n
      • Offset start, end
        var line = Phaser.Geom.Line.Offset(line, dx, dy); // line.x1 += dx, line.y1 += dy, line.x2 += dx, line.y2 += dy\n
      • Set center position
        var line = Phaser.Geom.Line.CenterOn(line, x, y);\n
    • Start point, angle, length
      var line = Phaser.Geom.Line.SetToAngle(line, x, y, angle, length);\n
      • line : The line to set
      • x , y : start point
      • angle : The angle of the line in radians
        var rad = Phaser.Math.DegToRad(deg);\n
      • length :\u3000The length of the line
    • Rotate
      • Rotate around midpoint
        var line = Phaser.Geom.Line.Rotate(line, angle)\n
        • line : The line to set
        • angle : The angle of the line in radians
          var rad = Phaser.Math.DegToRad(deg);\n
      • Rotate around point
        var line = Phaser.Geom.Line.RotateAroundPoint(line, point, angle);\n
        or
        var line = Phaser.Geom.Line.RotateAroundXY(line, x, y, angle);\n
        • line : The line to set
        • angle : The angle of the line in radians
          var rad = Phaser.Math.DegToRad(deg);\n
    • Extend
      var line = Phaser.Geom.Line.Extend(line, left, right);\n
    "},{"location":"geom-line/#get-properties","title":"Get properties","text":"
    • Position
      var x1 = line.x1;\nvar y1 = line.y1;\nvar x2 = line.x2;\nvar y2 = line.y2;\nvar top = line.top;       // min(x1, x2)\nvar left = line.left;     // min(y1, y2)\nvar right = line.right;   // max(x1, x2)\nvar bottom = line.bottom; // max(y1, y2)\n
      • Start point
        var start = line.getPointA();  // start: {x, y}\nvar start = line.getPointA(start);  // push start\n
      • End point
        var end = line.getPointB();  // end: {x, y}\nvar end = line.getPointB(end);  // push end\n
      • Middle point
        var middle = Phaser.Geom.Line.GetMidPoint(line);  // middle: {x, y}\n// var middle = Phaser.Geom.Line.GetMidPoint(line, middle);\n
    • Length
      var length = Phaser.Geom.Line.Length(line);\n
      • Width : Abs(x1 - x2)
        var width = Phaser.Geom.Line.Width(line);\n
      • Height : Abs(y1 - y2)
        var width = Phaser.Geom.Line.Height(line);\n
    • Slope
      • Slope : (y2 - y1) / (x2 - x1)
        var slope = Phaser.Geom.Line.Slope(line);\n
      • Perpendicular slope : -((x2 - x1) / (y2 - y1))
        var perpSlope = Phaser.Geom.Line.PerpSlope(line);\n
    • Angle
      • Angle
        var angle = Phaser.Geom.Line.Angle(line);\n
        • angle : The angle of the line in radians
          var deg = Phaser.Math.RadToDeg(rad);  // deg : -180 ~ 180\n
      • Normal angle (angle - 90 degrees)
        • Normal angle
          var normalAngle = Phaser.Geom.Line.NormalAngle(line);\n
        • Normal vector
          var normal = Phaser.Geom.Line.GetNormal(line);  // normal: {x, y}\n// var normal = Phaser.Geom.Line.GetNormal(line, normal);  // push normal\n
          or
          var normalX = Phaser.Geom.Line.NormalX(line);\nvar normalY = Phaser.Geom.Line.NormalY(line);\n
      • Reflect angle
        var reflectAngle = Phaser.Geom.Line.ReflectAngle(aimLine, reflectingLine);\n
    • Type:
      var type = line.type; // 2\n
    "},{"location":"geom-line/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = line.getPoint(t);  // t : 0 ~ 1. 0=start, 0.5=middle, 1=end\n// var point = line.getPoint(t, point);  // modify point\n
    • Get a random point inside shape
      var point = line.getRandomPoint();\n// var point = line.getRandomPoint(point);  // modify point\n
    • Get points around shape's edge
      var points = line.getPoints(quantity);\n// var points = line.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = line.getPoints(false, step);\n// var points = line.getPoints(false, step, points);  // push points\n
      • points : an array of point
    • Get points using Bresenham's line algorithm
      var points = Phaser.Geom.Line.BresenhamPoints(line, step);\n// var points = Phaser.Geom.Line.BresenhamPoints(line, step, points);  // push points\n
    • Get points using easing function
      var points = Phaser.Geom.Line.GetEasedPoints(line, ease, quantity);\n// var points = Phaser.Geom.Line.GetEasedPoints(line, ease, quantity, collinearThreshold, easeParams);\n
      • ease : String of ease function, or a custom function (function (t) { return value}).
      • quantity : The number of points to return.
      • collinearThreshold : Each point is spaced out at least this distance apart. This helps reduce clustering in noisey eases.
      • easeParams : Array of ease parameters to go with the ease.
    • Get the nearest point on a line perpendicular to the given point.
      var point = Phaser.Geom.Line.GetNearestPoint(line, pointIn);\n// var point = Phaser.Geom.Line.GetNearestPoint(line, pointIn, point);\n
    • Get the shortest distance from a Line to the given Point.
      var distance = Phaser.Geom.Line.GetShortestDistance(line, point);\n
    "},{"location":"geom-line/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Line.Equals(line0, line1);\n

    x1, y2, x2, y2 are equal.

    "},{"location":"geom-line/#intersection","title":"Intersection","text":""},{"location":"geom-line/#line-to-circle","title":"Line to circle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.LineToCircle(line, circle);\n// var result = Phaser.Geom.Intersects.LineToCircle(line, circle, nearest);\n
      • nearest : Nearest point on line.
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetLineToCircle(line, circle);\n// var out = Phaser.Geom.Intersects.GetLineToCircle(line, circle, out);\n
    "},{"location":"geom-line/#line-to-rectangle","title":"Line to rectangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.LineToRectangle(line, rect);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetLineToRectangle(line, rect);\n// var out = Phaser.Geom.Intersects.GetLineToRectangle(line, rect, out);\n
    "},{"location":"geom-line/#line-to-triangle","title":"Line to triangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToLine(triangle, line);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToLine(triangle, line);\n// var out = Phaser.Geom.Intersects.GetTriangleToLine(triangle, line, out);\n
    "},{"location":"geom-line/#line-to-line","title":"Line to line","text":"
    • Is intersection
      var isIntersection = Phaser.Geom.Intersects.LineToLine(line1, line2);\n
      • isIntersection : Return true if line1 and line2 are intersectioned
    • Get intersection point
      var isIntersection = Phaser.Geom.Intersects.LineToLine(line1, line2, out);\n
      • isIntersection : Return true if line1 and line2 are intersectioned
      • out : intersected point
    "},{"location":"geom-point/","title":"Point","text":""},{"location":"geom-point/#introduction","title":"Introduction","text":"

    Warning

    The Geom.Point class and all related functions will be removed. All functionality for this can be found in the existing Vector2 math classes. All Geometry classes that currently create and return Point objects will be updated to return Vector2 objects instead.

    Point shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-point/#usage","title":"Usage","text":""},{"location":"geom-point/#create-shape","title":"Create shape","text":"
    var point = new Phaser.Geom.Point(x, y);\n
    "},{"location":"geom-point/#clone-shape","title":"Clone shape","text":"
    var point1 = Phaser.Geom.Point.Clone(point0);\n
    "},{"location":"geom-point/#draw-on-graphics","title":"Draw on graphics","text":"
    // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillPointShape(point, size);\n
    "},{"location":"geom-point/#set-properties","title":"Set properties","text":"
    • All properties
      point.setTo(x, y);\n
      or
      Phaser.Geom.Point.CopyFrom(source, dest);\n
    • Position
      point.x = 0;\npoint.y = 0;\n
    • Round
      • Ceil : Apply Math.ceil() to each coordinate of the given Point
        var point = Phaser.Geom.Point.Ceil(point)\n
      • Floor : Apply Math.floor() to each coordinate of the given Point.
        var point = Phaser.Geom.Point.Floor(point)\n
    "},{"location":"geom-point/#symmetry","title":"Symmetry","text":"
    • Invert : x = y, y = x
      var point = Phaser.Geom.Point.Invert(point);\n
    • Negative : x = -x, y = -y
      var out = Phaser.Geom.Point.Negative(point);\n// var out = Phaser.Geom.Point.Negative(point, out);  // modify out\n
    "},{"location":"geom-point/#get-properties","title":"Get properties","text":"
    • Position
      var x = point.x;\nvar y = point.y;\n
    • Type:
      var type = point.type; // 3\n
    "},{"location":"geom-point/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Point.Equals(point0, point1);\n

    x, y are equal.

    "},{"location":"geom-point/#points","title":"Points","text":"
    • Centroid : center-point over some points
      var out = Phaser.Geom.Point.GetCentroid(points);\n// var out = Phaser.Geom.Point.GetCentroid(points, out);  // modify out\n
    • Calculates the Axis Aligned Bounding Box (or aabb) from an array of points (rectangle)
      var rect = Phaser.Geom.Point.GetRectangleFromPoints(points);\n// var rect = Phaser.Geom.Point.GetRectangleFromPoints(points, rect);  // modify rect\n
    • Interpolate
      var out = Phaser.Geom.Point.Interpolate(pointA, pointB, t);  // out : point\n// var out = Phaser.Geom.Point.Interpolate(pointA, pointB, t, out);  // modify out\n
    "},{"location":"geom-point/#intersection","title":"Intersection","text":"
    • Point to line
      var result = Phaser.Geom.Intersects.PointToLine(point, line);\n// var result = Phaser.Geom.Intersects.PointToLine(point, line, lineThickness);\n
      var result = Phaser.Geom.Intersects.PointToLineSegment(point, line);\n
    "},{"location":"geom-point/#point-as-vector","title":"Point as Vector","text":"

    Vector starting at (0,0)

    • Magnitude : sqrt( (x * x) + (y * y) )
      var magnitude = Phaser.Geom.Point.GetMagnitude(point);\n
      or
      var magnitudeSq = Phaser.Geom.Point.GetMagnitudeSq(point);\n
    • Project
      var out = Phaser.Geom.Point.Project(from, to);\n// var out = Phaser.Geom.Point.Project(from, to, out);  // modify out\n
      or
      var out = Phaser.Geom.Point.ProjectUnit(from, to);  // vector `from` and `to` are unit vector (length = 1)\n// var out = Phaser.Geom.Point.ProjectUnit(from, to, out);  // modify out\n
    "},{"location":"geom-polygon/","title":"Polygon","text":""},{"location":"geom-polygon/#introduction","title":"Introduction","text":"

    Polygon shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-polygon/#usage","title":"Usage","text":""},{"location":"geom-polygon/#create-shape","title":"Create shape","text":"
    var polygon = new Phaser.Geom.Polygon(points);\n
    • points :
      • An array of number : [x0, y0, x1, y1, ...]
      • An array of points : [{x:x0, y:y0}, {x:x1, y:y1}, ...]
      • A string : 'x0 y0 x1 y1 ...'
    "},{"location":"geom-polygon/#clone-shape","title":"Clone shape","text":"
    var polygon1 = Phaser.Geom.Polygon.Clone(polygon0);\n
    "},{"location":"geom-polygon/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillPoints(polygon.points, true);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokePoints(polygon.points, true);\n
    "},{"location":"geom-polygon/#set-properties","title":"Set properties","text":"
    polygon.setTo(points);\n// points = [x0, y0, x1, y1, x2, y2, ...] , or [{x,y}, {x,y}, {x,y}, ...]\n
    "},{"location":"geom-polygon/#get-properties","title":"Get properties","text":"
    • Points
      var points = polygon.points;    // array of points {x,y}\n
    • Area
      var area = polygon.area;\n
    • Number array
      var out = Phaser.Geom.Polygon.GetNumberArray(polygon);\n// var out = Phaser.Geom.Polygon.GetNumberArray(polygon, out);  // modify out\n
      • arr : [x0, y0, x1, y1, x2, y2, ...]
    • AABB (A minimum rectangle to cover this polygon)
      var out = Phaser.Geom.Polygon.GetAABB(polygon);\n// var out = Phaser.Geom.Polygon.GetAABB(polygon, out);\n
      • out : A rectangle object
    • Type:
      var type = polygon.type; // 4\n
    "},{"location":"geom-polygon/#points-shape","title":"Point(s) & shape","text":"
    • Point is inside shape
      var isInside = polygon.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Polygon.ContainsPoint(polygon, point);\n
    • Translate : Shift points.
      Phaser.Geom.Polygon.Translate(polygon, x, y);\n
    • Reverse the order of points.
      var polygon = Phaser.Geom.Polygon.Reverse(polygon);\n
    • Smooth : Takes a Polygon object and applies Chaikin's smoothing algorithm on its points.
      Phaser.Geom.Polygon.Smooth(polygon)\n
    • Simplify : Simplifies the points by running them through a combination of Douglas-Peucker and Radial Distance algorithms. Simplification dramatically reduces the number of points in a polygon while retaining its shape, giving a huge performance boost when processing it and also reducing visual noise.
      var polygon = Phaser.Geom.Polygon.Simplify(polygon);\n// var polygon = Phaser.Geom.Polygon.Simplify(polygon, tolerance, highestQuality);\n
    "},{"location":"geom-polygon/#vector-to-polygon","title":"Vector to polygon","text":"
    • Get closest point of intersection between a vector and an array of polygons
      var result = Phaser.Geom.Intersects.GetLineToPolygon(line, polygons);\n// var out = Phaser.Geom.Intersects.GetLineToPolygon(line, polygons, isRay, out);\n
      • line : Vector of line object
      • polygons : A single polygon, or array of polygons
      • isRay : Is line a ray or a line segment?
      • out :
        • out.x, out.y : Intersection point
        • out.z : Closest intersection distance
        • out.w : Index of the polygon
    • Projects rays out from the given point to each line segment of the polygons.
      var out = Phaser.Geom.Intersects.GetRaysFromPointToPolygon(x, y, polygons);\n
      • x, y : The point to project the rays from.
      • polygons : A single polygon, or array of polygons
      • out : An array containing all intersections
        • out[i].x, out[i].y : Intersection point
        • out[i].z : Angle of intersection
        • out[i].w : Index of the polygon
    "},{"location":"geom-rectangle/","title":"Rectangle","text":""},{"location":"geom-rectangle/#introduction","title":"Introduction","text":"

    Rectangle shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-rectangle/#usage","title":"Usage","text":""},{"location":"geom-rectangle/#create-shape","title":"Create shape","text":"
    var rect = new Phaser.Geom.Rectangle(x, y, width, height);\n
    "},{"location":"geom-rectangle/#create-from-points","title":"Create from points","text":"

    All of the given points are on or within its bounds.

    var rect = Phaser.Geom.Rectangle.FromPoints(points);\n// var rect = Phaser.Geom.Rectangle.FromPoints(points, rect);  // push rect\n
    • points : an array with 4 points. [x, y], or {x:0, y:0}

    or

    var rect = Phaser.Geom.Rectangle.FromXY(x1, y1, x2, y2);\n// var rect = Phaser.Geom.Rectangle.FromXY(x1, y1, x2, y2, rect);  // push rect\n
    "},{"location":"geom-rectangle/#clone-shape","title":"Clone shape","text":"
    var rect1 = Phaser.Geom.Rectangle.Clone(rect0);\n
    "},{"location":"geom-rectangle/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillRectShape(rect);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeRectShape(rect);\n

    Note

    x with positive/negative width is left/right bound y with positive/negative height is top/bottom bound

    "},{"location":"geom-rectangle/#set-properties","title":"Set properties","text":"
    • All properties
      rect.setTo(x, y, width, height);\n
      or
      Phaser.Geom.Rectangle.CopyFrom(source, dest);\n
    • Position
      rect.setPosition(x, y);\n
      or
      rect.x = 0;\nrect.y = 0;\n
      or
      rect.left = 0;       // rect.x, rect.width\nrect.top = 0;        // rect.y, rect.height\n// rect.right = 0;   // rect.x, rect.width\n// rect.bottom = 0;  // rect.y, rect.height\nrect.centerX = 0;    // rect.x\nrect.centerY = 0;    // rect.y\n
      or
      Phaser.Geom.Rectangle.Offset(rect, dx, dy); // rect.x += dx, rect.y += dy\n
      or
      Phaser.Geom.Rectangle.OffsetPoint(rect, point); // rect.x += point.x, rect.y += point.y\n
      or
      Phaser.Geom.Rectangle.CenterOn(rect, x, y);  // rect.x = x - (rect.width / 2), rect.y = y - (rect.height / 2)\n
    • Size
      rect.setSize(width, height);\n// rect.setSize(width);   // height = width\n
      or
      rect.width = 0;\nrect.height = 0;\n
      • Scale
        Phaser.Geom.Rectangle.Scale(rect, x, y); // rect.width *= x, rect.height *= y;\n// Phaser.Geom.Rectangle.Scale(rect, x);   // y = x\n
      • Extend size to include points
        Phaser.Geom.Rectangle.MergePoints(rect, points);\n
        • points : an array of points. [x, y], or {x:0, y:0}
      • Extend size to include another rectangle
        Phaser.Geom.Rectangle.MergeRect(target, source);\n
    • Inflate
      Phaser.Geom.Rectangle.Inflate(rect, x, y);\n
      1. change size to width += x*2, height += y*2
      2. center on previous position
    • Fits the target rectangle into the source rectangle
      Phaser.Geom.Rectangle.FitInside(target, source);\n
      Preserves aspect ratio, scales and centers the target rectangle to the source rectangle
    • Fits the target rectangle around the source rectangle
      Phaser.Geom.Rectangle.FitOutside(target, source);\n
      Preserves aspect ratio, scales and centers the target rectangle to the source rectangle
    • Ceil
      Phaser.Geom.Rectangle.Ceil(rect);  // ceil x, y\n
      Phaser.Geom.Rectangle.CeilAll(rect);  // ceil x, y, width, height\n
    • Floor
      Phaser.Geom.Rectangle.Floor(rect);  // floor x, y\n
      Phaser.Geom.Rectangle.FloorAll(rect);  // floor x, y, width, height\n
    "},{"location":"geom-rectangle/#get-properties","title":"Get properties","text":"
    • Position
      var x = rect.x;\nvar y = rect.y;\n
      • Bound
        var top = rect.top;\nvar left = rect.left;\nvar right = rect.right;\nvar bottom = rect.bottom;\n
        or
        var points = Phaser.Geom.Rectangle.Decompose(rect);\n// var points = Phaser.Geom.Rectangle.Decompose(rect, points); // push result points\n
        • points : top-left, top-right, bottom-right, bottom-left
      • Center
        var centerX = rect.centerX;\nvar centerY = rect.centerY;\n
        or
        var point = Phaser.Geom.Rectangle.GetCenter(rect);\n// var point = Phaser.Geom.Rectangle.GetCenter(rect, point);\n
    • Size
      var width = rect.width;\nvar height = rect.height;\n
      or
      var point = Phaser.Geom.Rectangle.GetSize(rect); // {x: rect.width, y: rect.height}\n
    • Area
      var area = Phaser.Geom.Rectangle.Area(rect);\n
    • Perimeter
      var perimeter = Phaser.Geom.Rectangle.Perimeter(rect);  // 2 * (rect.width + rect.height)\n
    • Aspect ratio
      var aspectRatio = Phaser.Geom.Rectangle.GetAspectRatio(rect);  // rect.width / rect.height\n
    • Lines around rectangle
      var topLine = rect.getLineA();  // top line of this rectangle\nvar rightLine = rect.getLineB();  // right line of this rectangle\nvar bottomLine = rect.getLineC();  // bottom line of this rectangle\nvar leftLine = rect.getLineD();  // left line of this rectangle\n// var out = rect.getLineA(out);  // top line of this rectangle\n
    • Type:
      var type = rect.type; // 5\n
    "},{"location":"geom-rectangle/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = rect.getPoint(t);  // t : 0 ~ 1 (0= top-left, 0.5= bottom-right, 1= top-left)\n// var point = rect.getPoint(t, point);  // modify point\n
      or
      var point = Phaser.Geom.Rectangle.PerimeterPoint(rect, angle);  // angle in degrees\n// var point = Phaser.Geom.Rectangle.PerimeterPoint(rect, angle, point);  // push point\n
    • Get points around shape's edge
      var points = rect.getPoints(quantity);\n// var points = rect.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = rect.getPoints(false, step);\n// var points = rect.getPoints(false, step, points);  // push points\n
      • step : width of each step, in pixels. quantity = Perimeter(rectangle) / step;
      • points : an array of point
    • Point is inside shape
      var isInside = rect.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Rectangle.ContainsPoint(rect, point);\n
    • Get a random point inside shape
      var point = rect.getRandomPoint();\n// var point = rect.getRandomPoint(point);  // modify point\n
    • Get a random point outside shape
      var point = Phaser.Geom.Rectangle.RandomOutside(outer, inner);\n// var point = Phaser.Geom.Rectangle.RandomOutside(outer, inner, point); // modify point\n
    • Rectangle is inside shape
      var isInside = Phaser.Geom.Rectangle.ContainsRect(rectA, rectB);  // rectB is inside rectA\n
    "},{"location":"geom-rectangle/#rectangles","title":"Rectangles","text":"
    • Is overlapping
      var isOverlapping = Phaser.Geom.Rectangle.Overlaps(rectA, rectB);\n
    • Get intersection rectangle
      var rect = Phaser.Geom.Rectangle.Intersection(rectA, rectB);\nvar rect = Phaser.Geom.Rectangle.Intersection(rectA, rectB, rect);  // push rect\n
    • Get union rectangle
      var rect = Phaser.Geom.Rectangle.Union(rectA, rectB);\nvar rect = Phaser.Geom.Rectangle.Union(rectA, rectB, rect);  // push rect\n
    "},{"location":"geom-rectangle/#empty","title":"Empty","text":"
    • Set empty
      rect.setEmpty();     // rect.x = 0, rect.y = 0, rect.width = 0, rect.height = 0\n
    • Is empty
      var isEmpty = rect.isEmpty();   // rect.radius <= 0;\n
    "},{"location":"geom-rectangle/#equal","title":"Equal","text":"
    • Position, width, and height are the same
      var isEqual = Phaser.Geom.Rectangle.Equals(rect0, rect1);\n
    • Width and height are the same
      var isEqual = Phaser.Geom.Rectangle.SameDimensions(rect0, rect1);\n
    "},{"location":"geom-rectangle/#intersection","title":"Intersection","text":""},{"location":"geom-rectangle/#rectangle-to-circle","title":"Rectangle to circle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.CircleToRectangle(circle, rect);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetCircleToRectangle(circle, rect);\n// var out = Phaser.Geom.Intersects.GetCircleToRectangle(circle, rect, out);\n
    "},{"location":"geom-rectangle/#rectangle-to-rectangle","title":"Rectangle to rectangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.RectangleToRectangle(rectA, rectB);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetRectangleToRectangle(rectA, rectB);\n// var out = Phaser.Geom.Intersects.GetRectangleToRectangle(rectA, rectB, out);\n
    "},{"location":"geom-rectangle/#rectangle-to-triangle","title":"Rectangle to triangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.RectangleToTriangle(rect, triangle);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetRectangleToTriangle(rect, triangle);\n// var out = Phaser.Geom.Intersects.GetRectangleToTriangle(rect, triangle, out);\n
    "},{"location":"geom-rectangle/#rectangle-to-line","title":"Rectangle to line","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.LineToRectangle(line, rect);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetLineToRectangle(line, rect);\n// var out = Phaser.Geom.Intersects.GetLineToRectangle(line, rect, out);\n
    "},{"location":"geom-rhombus/","title":"Rhombus","text":""},{"location":"geom-rhombus/#introduction","title":"Introduction","text":"

    Rhombus shape and methods, extends from Polygon geometry object.

    • Author: Rex
    • Geometry object
    "},{"location":"geom-rhombus/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"geom-rhombus/#install-plugin","title":"Install plugin","text":""},{"location":"geom-rhombus/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrhombusplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrhombusplugin.min.js', true);\n
    • Add rhombus geometry object
      var rhombus = scene.plugins.get('rexrhombusplugin').add(x, y, width, height);\n
    "},{"location":"geom-rhombus/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RhombusPlugin from 'phaser3-rex-plugins/plugins/rhombus-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRhombus',\nplugin: RhombusPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add rhombus geometry object
      var rhombus = scene.plugins.get('rexRhombus').add(x, y, width, height);\n
    "},{"location":"geom-rhombus/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Rhombus from 'phaser3-rex-plugins/plugins/rhombus.js';\n
    • Add rhombus geometry object
      var rhombus = new Rhombus(x, y, width, height);\n
    "},{"location":"geom-rhombus/#create-shape","title":"Create shape","text":"

    var rhombus = scene.plugins.get('rexRhombus').add(x, y, width, height);\n
    or
    var rhombus = scene.plugins.get('rexRhombus').add({\nx: 0,\ny: 0,\nwidth: 40,\nheight: 20\n});\n
    or
    var rhombus = new rexRhombus(x, y, width, height);\n// var rhombus = new Phaser.Geom.rexRhombus(x, y, width, height);\n

    • x : Top X.
    • y : Left Y.
    "},{"location":"geom-rhombus/#draw-on-graphics","title":"Draw on graphics","text":"

    See Polygon shape.

    "},{"location":"geom-rhombus/#set-properties","title":"Set properties","text":"
    • All properties
      rhombus.setTo(x, y, width, height);\n
    • Position
      rhombus.setPosition(x, y);\n
      or
      rhombus.x = 0;\nrhombus.y = 0;\n
      or
      rhombus.left = 0;       // rhombus.x\nrhombus.top = 0;        // rhombus.y\nrhombus.right = 0;      // rhombus.x\nrhombus.bottom = 0;     // rhombus.y\n
    • Size
      rhombus.setSize(width, height);\n
      or
      rhombus.width = width;\nrhombus.height = height;\n
    "},{"location":"geom-rhombus/#get-properties","title":"Get properties","text":"

    See Polygon shape.

    • Position
      • Center
        var centerX = rhombus.centerX;\nvar centerY = rhombus.centerY;\n
      • Bound
        var top = rhombus.top;\nvar left = rhombus.left;\nvar right = rhombus.right;\nvar bottom = rhombus.bottom;\n
    • Width
      var width = rhombus.width;\n
    • Height
      var width = rhombus.height;\n
    • Lines around rhombus
      var edge01 = rhombus.getLineA();\nvar edge12 = rhombus.getLineB();\nvar edge23 = rhombus.getLineC();\nvar edge34 = rhombus.getLineD();\n
      or
      var edge = rhombus.getEdge(edgeIdx);\n// var out = rhombus.getEdge(edgeIdx, out);\n
    "},{"location":"geom-rhombus/#points-shape","title":"Point(s) & shape","text":"

    See Polygon shape.

    "},{"location":"geom-triangle/","title":"Triangle","text":""},{"location":"geom-triangle/#introduction","title":"Introduction","text":"

    Triangle shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-triangle/#usage","title":"Usage","text":""},{"location":"geom-triangle/#create-shape","title":"Create shape","text":"
    var triangle = new Phaser.Geom.Triangle(x1, y1, x2, y2, x3, y3);\n
    "},{"location":"geom-triangle/#clone-shape","title":"Clone shape","text":"
    var triangle1 = Phaser.Geom.Triangle.Clone(triangle0);\n
    "},{"location":"geom-triangle/#equilateral-triangle","title":"Equilateral triangle","text":"
    var triangle = Phaser.Geom.Triangle.BuildEquilateral(x1, y1, length);\n
    "},{"location":"geom-triangle/#right-triangle","title":"Right triangle","text":"
    var triangle = Phaser.Geom.Triangle.BuildRight(x1, y1, width, height);\n
    "},{"location":"geom-triangle/#polygon-to-triangles","title":"Polygon to triangles","text":"
    var out = Phaser.Geom.Triangle.BuildFromPolygon(data);\n// var out = Phaser.Geom.Triangle.BuildFromPolygon(data, holes, scaleX, scaleY);\n// out = Phaser.Geom.Triangle.BuildFromPolygon(data, holes, scaleX, scaleY, out);\n
    • data : A flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...]
    • out : Array of triangles
    "},{"location":"geom-triangle/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillTriangleShape(triangle);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeTriangleShape(triangle);\n
    "},{"location":"geom-triangle/#set-properties","title":"Set properties","text":"
    • All properties
      triangle.setTo(x1, y1, x2, y2, x3, y3);\n
      or
      Phaser.Geom.Triangle.CopyFrom(source, dest);\n
    • Position
      triangle.x1 = 0;\ntriangle.y1 = 0;\ntriangle.x2 = 0;\ntriangle.y2 = 0;\ntriangle.x3 = 0;\ntriangle.y3 = 0;\n
      or
      triangle.left = 0;       // triangle.x1, triangle.x2, triangle.x3\ntriangle.top = 0;        // triangle.y1, triangle.y2, triangle.y3\n// triangle.right = 0;   // triangle.x1, triangle.x2, triangle.x3\n// triangle.bottom = 0;  // triangle.y1, triangle.y2, triangle.y3\n
      or
      Phaser.Geom.Triangle.Offset(triangle, dx, dy); // triangle.x += dx, triangle.y += dy\n
      or
      Phaser.Geom.Triangle.CenterOn(triangle, x, y);\n
    • Rotate
      • Rotate around center (incenter)
        var triangle = Phaser.Geom.Triangle.Rotate(triangle, angle);\n
        • angle : Radian
      • Rotate around point
        var triangle = Phaser.Geom.Triangle.RotateAroundPoint(triangle, point, angle);\n
        • point : {x, y}
        • angle : Radian
      • Rotate around (x,y)
        var triangle = Phaser.Geom.Triangle.RotateAroundXY(triangle, x, y, angle);\n
        • angle : Radian
    "},{"location":"geom-triangle/#get-properties","title":"Get properties","text":"
    • Position
      var x1 = triangle.x1;\nvar y1 = triangle.y1;\nvar x2 = triangle.x2;\nvar y2 = triangle.y2;\nvar x3 = triangle.x3;\nvar y3 = triangle.y3;\nvar top = triangle.top;\nvar left = triangle.left;\nvar right = triangle.right;\nvar bottom = triangle.bottom;\n
      or
      var out = Phaser.Geom.Triangle.Decompose(triangle);  // out: [{x1,y1}, {x2,y2}, {x3,y3}]\n// var out = Phaser.Geom.Triangle.Decompose(triangle, out);\n
    • Perimeter
      var perimeter = Phaser.Geom.Triangle.Perimeter(triangle);\n
    • Area
      var area = Phaser.Geom.Triangle.Area(triangle);\n
    • Lines around triangle
      var line12 = rect.getLineA();     // line from (x1, y1) to (x2, y2)\nvar line23 = rect.getLineB();     // line from (x2, y2) to (x3, y3)\nvar line31 = rect.getLineC();     // line from (x3, y3) to (x1, y1)\n
    • Centroid
      var out = Phaser.Geom.Triangle.Centroid(triangle);  // out: {x,y}\n
    • Incenter
      var out = Phaser.Geom.Triangle.InCenter(triangle);  // out: {x,y}\n// var out = Phaser.Geom.Triangle.InCenter(triangle, out);\n
    • Circumcenter
      var out = Phaser.Geom.Triangle.CircumCenter(triangle);  // out: {x,y}\n// var out = Phaser.Geom.Triangle.CircumCenter(triangle, out);\n
    • Circumcircle
      var out = Phaser.Geom.Triangle.CircumCircle(triangle);  // out: a circle object\n// var out = Phaser.Geom.Triangle.CircumCircle(triangle, out);\n
    • Type:
      var type = triangle.type; // 6\n
    "},{"location":"geom-triangle/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = triangle.getPoint(t);  // t : 0 ~ 1 (angle/360)\n// var point = triangle.getPoint(t, point);  // modify point\n
    • Get a random point inside shape
      var point = triangle.getRandomPoint();\n// var point = triangle.getRandomPoint(point);  // modify point\n
    • Get points around shape's edge
      var points = triangle.getPoints(quantity);\n// var points = triangle.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = triangle.getPoints(false, step);\n// var points = triangle.getPoints(false, step, points);  // push points\n
      • points : an array of point
    • Point is inside shape
      var isInside = triangle.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Triangle.ContainsPoint(triangle, point);\n
      • Points inside shape
        var out = Phaser.Geom.Triangle.ContainsArray(triangle, points, returnFirst);\n// var out = Phaser.Geom.Triangle.ContainsArray(triangle, points, returnFirst, out);\n
        • out : Points inside triangle
        • returnFirst : True to get fist matched point
    "},{"location":"geom-triangle/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Triangle.Equals(triangle0, triangle1);\n

    Position and radius are equal.

    "},{"location":"geom-triangle/#intersection","title":"Intersection","text":""},{"location":"geom-triangle/#triangle-to-circle","title":"Triangle to circle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToCircle(triangle, circle);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToCircle(triangle, circle);\n// var out = Phaser.Geom.Intersects.GetTriangleToCircle(triangle, circle, out);\n
    "},{"location":"geom-triangle/#triangle-to-rectangle","title":"Triangle to rectangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.RectangleToTriangle(rect, triangle);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetRectangleToTriangle(rect, triangle);\n// var out = Phaser.Geom.Intersects.GetRectangleToTriangle(rect, triangle, out);\n
    "},{"location":"geom-triangle/#triangle-to-triangle","title":"Triangle to triangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToTriangle(triangleA, triangleB);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToTriangle(triangleA, triangleB);\n// var out = Phaser.Geom.Intersects.GetTriangleToTriangle(triangleA, triangleB, out);\n
    "},{"location":"geom-triangle/#triangle-to-line","title":"Triangle to line","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToLine(triangle, line);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToLine(triangle, line);\n// var out = Phaser.Geom.Intersects.GetTriangleToLine(triangle, line, out);\n
    "},{"location":"gesture-overview/","title":"Overview","text":""},{"location":"gesture-overview/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-overview/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Object factories : scene.rexGestures.add.xxx(config)
    "},{"location":"gesture-overview/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Object factories : scene.rexGestures.add.xxx(config)
    "},{"location":"gesture-overview/#list-of-gesture-plugins","title":"List of gesture plugins","text":""},{"location":"gesture-overview/#one-pointer-gesture","title":"One pointer gesture","text":"
    • Tap
    • Press
    • Swipe
    • Pan
    "},{"location":"gesture-overview/#two-pointers-gesture","title":"Two pointers gesture","text":"
    • Pinch
    • Rotate
    "},{"location":"gesture-pan/","title":"Pan","text":""},{"location":"gesture-pan/#introduction","title":"Introduction","text":"

    Get pan events of a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"gesture-pan/#live-demos","title":"Live demos","text":"
    • Camera scroll
    • Pan & rotate
    "},{"location":"gesture-pan/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-pan/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-pan/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add pan input
      var pan = scene.rexGestures.add.pan(config);\n// var pan = scene.rexGestures.add.pan(gameObject, config);\n
    "},{"location":"gesture-pan/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add pan input
      var pan = scene.rexGestures.add.pan(config);\n// var pan = scene.rexGestures.add.pan(gameObject, config);\n
    "},{"location":"gesture-pan/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Pan } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add pan input
      var pan = new Pan(scene, config);\n// var pan = new Pan(gameObject, config);\n
    "},{"location":"gesture-pan/#create-instance","title":"Create instance","text":"
    • Pan input
      var pan = scene.rexGestures.add.pan({\n// enable: true,\n// bounds: undefined,\n\n// threshold: 10,\n});\n
      • enable : Set false to disable input events.
      • bounds : Touch detecting area rectangle, if game obect is not given.
        • undefined : Ignore this feature, default behavior.
      • threshold : Minimal movement when pointer is down.
    • Pan behavior of game object
      var pan = scene.rexGestures.add.pan(gameObject, {\n// enable: true,\n\n// threshold: 10,\n});\n
    "},{"location":"gesture-pan/#enable","title":"Enable","text":"
    • Get
      var enable = pan.enable;  // enable: true, or false\n
    • Set
      pan.setEnable(enable);  // enable: true, or false\n// pan.enable = enable;\n
    • Toggle
      pan.toggleEnable();\n
    "},{"location":"gesture-pan/#events","title":"Events","text":""},{"location":"gesture-pan/#pan","title":"Pan","text":"
    pan.on('pan', function(pan, gameObject, lastPointer){\n}, scope);\n
    • pan.dx, pan.dy : Vector from previous pointer to current pointer.
    • pan.dWorldX, pan.dWorld : Vector from previous pointer to current pointer, in world position. i.e, including camera-zoom.
    • pan.worldX, pan.worldY : World position of current pointer.
    • pan.x, pan.y : Scene position of current pointer.
    • gameObject, pan.gameObject : Parent gameobject of this pan behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-pan/#pan-start","title":"Pan start","text":"
    pan.on('panstart', function(pan, gameObject, lastPointer){\n}, scope);\n
    • pan.startWorldX, pan.startWorldY : World position of pan-start pointer.
    • pan.startX, pan.startY : Scene position of pan-start pointer.
    • gameObject, pan.gameObject : Parent gameobject of this pan behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-pan/#pan-end","title":"Pan end","text":"
    pan.on('panend', function(pan, gameObject, lastPointer){\n}, scope);\n
    • pan.endWorldX, pan.endWorldY : World position of pan-end pointer.
    • pan.endX, pan.endY : Scene position of pan-end pointer.
    • gameObject, pan.gameObject : Parent gameobject of this pan behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-pan/#is-panned","title":"Is panned","text":"
    var isPanned = pan.isPanned;\n

    Return true if panned.

    "},{"location":"gesture-pan/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any pan event,

    pan.on('panend', function(pan){\nvar isPointerInsideGameObject = pan.isPointerInGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-pan/#other-properties","title":"Other properties","text":"
    • Drag threshold
      • Get
        var dragThreshold = pan.dragThreshold;\n
      • Set
        pan.setDragThreshold(dragThreshold);\n// pan.dragThreshold = dragThreshold;\n
    • Detect bounds
      • Get
        var bounds = pan.bounds;\n
      • Set
        pan.setDetectBounds(bounds);\n// pan.bounds = bounds;\n
    "},{"location":"gesture-pinch/","title":"Pinch","text":""},{"location":"gesture-pinch/#introduction","title":"Introduction","text":"

    Get scale factor from 2 dragging touch pointers.

    • Author: Rex
    • Member of scene
    "},{"location":"gesture-pinch/#live-demos","title":"Live demos","text":"

    Pinch-zoom

    "},{"location":"gesture-pinch/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-pinch/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-pinch/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add pinch input
      var pinch = scene.rexGestures.add.pinch(config);\n// var pinch = scene.rexGestures.add.pinch(gameObject, config);\n
    "},{"location":"gesture-pinch/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add pinch input
      var pinch = scene.rexGestures.add.pinch(config);\n// var pinch = scene.rexGestures.add.pinch(gameObject, config);\n
    "},{"location":"gesture-pinch/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Pinch } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add pinch input
      var pinch = new Pinch(scene, config);\n// var pinch = new Pinch(gameObject, config);\n
    "},{"location":"gesture-pinch/#create-instance","title":"Create instance","text":"
    • Pinch input
      var pinch = scene.rexGestures.add.pinch({\n// enable: true,\n// bounds: undefined,\n\n// threshold: 0,\n});\n
      • enable : Set false to disable input events.
      • bounds : A rectangle object or undefined (to use game window as rectangle object), for detecting the position of cursor.
      • threshold : Fire pinch events after dragging distances of catched pointers are larger than this threshold.
    • Pinch behavior of game object
      var pan = scene.rexGestures.add.pinch(gameObject, {\n// enable: true,\n// bounds: undefined,\n\n// threshold: 0,\n});\n
      • Start pinching when pointer-down on this game object.
    "},{"location":"gesture-pinch/#enable","title":"Enable","text":"
    • Get
      var enable = pinch.enable;  // enable: true, or false\n
    • Set
      pinch.setEnable(enable);  // enable: true, or false\n// pinch.enable = enable;\n
    • Toggle
      pinch.toggleEnable();\n
    "},{"location":"gesture-pinch/#events","title":"Events","text":""},{"location":"gesture-pinch/#on-dragging","title":"On dragging","text":"
    • On dragging 1st touch pointer, fired when 1st touch pointer is moving
      pinch.on('drag1', function(pinch) {\n// var drag1Vector = pinch.drag1Vector; // drag1Vector: {x, y}\n}, scope);\n
      • pinch.drag1Vector : Drag vector from prevoius touch position to current touch position of 1st catched touch pointer.
    • On dragging 2 touch pointers, fired when any catched touch pointer moved.
      pinch.on('pinch', function(pinch) {\n// var scaleFactor = pinch.scaleFactor;\n// gameObject.scaleX *= scaleFactor;\n// gameObject.scaleY *= scaleFactor;\n}, scope);\n
      • pinch.scaleFactor : Rate of distance change between 2 catched touch pointers.
    "},{"location":"gesture-pinch/#on-drag-start-on-drag-end","title":"On drag start, on drag end","text":"
    • On drag 1 touch pointer start, fired when catching 1st touch pointer.
      pinch.on('drag1start', function(pinch) {\n\n}, scope);\n
    • On drag 1 touch pointer end, fired when releasing the last one catched touch pointer.
      pinch.on('drag1end', function(pinch) {\n\n}, scope);\n
    • On drag 2 touch pointers start, fired when catching 2 touch pointers.
      pinch.on('pinchstart', function(pinch) {\n\n}, scope);\n
    • On drag 2 touch pointers end, fired when releasing any catched touch pointer.
      pinch.on('pinchend', function(pinch) {\n\n}, scope);\n
    "},{"location":"gesture-pinch/#scale-factor","title":"Scale factor","text":"
    var scaleFactor = pinch.scaleFactor;\n

    Rate of distance change between 2 catched touch pointers. (i.e current distance between 2 catched touch pointers / previous distance ).

    "},{"location":"gesture-pinch/#drag-vector-of-1st-touch-pointer","title":"Drag vector of 1st touch pointer","text":"
    var drag1Vector = pinch.drag1Vector; // {x, y}\n
    "},{"location":"gesture-pinch/#catched-touch-pointers","title":"Catched touch pointers","text":"
    • Pointer 0, available when state is 1
      var pointer0 = pinch.pointers[0];\n
      • Position of pointer
        var x = pointer0.x;\nvar y = pointer0.y;\nvar worldX = pointer0.worldX;\nvar worldY = pointer0.worldY;\n
    • Pointer 1, available when state is 2
      var pointer1 = pinch.pointers[1];\n
    "},{"location":"gesture-pinch/#is-pinched","title":"Is pinched","text":"
    var isPinched = pinch.isPinched;\n

    Return true if pinched.

    "},{"location":"gesture-pinch/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any pinch event,

    pinch.on('pinch', function(pinch) {\nvar isPointer0InsideGameObject = pinch.isPointer0InGameObject(anotherGameObject);\nvar isPointer1InsideGameObject = pinch.isPointer1InGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-pinch/#other-properties","title":"Other properties","text":"
    • Drag threshold
      • Get
        var dragThreshold = pinch.dragThreshold;\n
      • Set
        pinch.setDragThreshold(dragThreshold);\n// pinch.dragThreshold = dragThreshold;\n
    • Detect bounds
      • Get
        var bounds = pinch.bounds;\n
      • Set
        pinch.setDetectBounds(bounds);\n// pinch.bounds = bounds;\n
    "},{"location":"gesture-press/","title":"Press","text":""},{"location":"gesture-press/#introduction","title":"Introduction","text":"

    Get press events of a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"gesture-press/#live-demos","title":"Live demos","text":"
    • Press object
    "},{"location":"gesture-press/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-press/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-press/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add press input
      var press = scene.rexGestures.add.press(config);\n// var press = scene.rexGestures.add.press(gameObject, config);\n
    "},{"location":"gesture-press/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add press input
      var press = scene.rexGestures.add.press(config);\n// var press = scene.rexGestures.add.press(gameObject, config);\n
    "},{"location":"gesture-press/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Press } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add press input
      var press = new Press(scene, config);\n// var press = new Press(gameObject, config);\n
    "},{"location":"gesture-press/#create-instance","title":"Create instance","text":"
    • Press input
      var press = scene.rexGestures.add.press({\n// enable: true,\n// bounds: undefined,\n\n// time: 251,\n// threshold: 9,\n});\n
      • enable : Set false to disable input events.
      • bounds : Touch detecting area rectangle, if game obect is not given.
        • undefined : Ignore this feature, default behavior.
      • time : Minimal time of the pointer to be pressed.
      • threshold : Minimal movement when pointer is down.
    • Press behavior of game object
      var press = scene.rexGestures.add.press(gameObject, {\n// enable: true,\n\n// time: 251,\n// threshold: 9,\n});\n
    "},{"location":"gesture-press/#enable","title":"Enable","text":"
    • Get
      var enable = press.enable;  // enable: true, or false\n
    • Set
      press.setEnable(enable);  // enable: true, or false\n// press.enable = enable;\n
    • Toggle
      press.toggleEnable();\n
    "},{"location":"gesture-press/#events","title":"Events","text":""},{"location":"gesture-press/#pressing-start","title":"Pressing start","text":"
    press.on('pressstart', function(press, gameObject, lastPointer){\n}, scope);\n
    • press.gameObject : Parent gameobject of this press behavior.
    • press.worldX, press.worldY : World position of pressing start.
    • press.x, press.y : Scene position of pressing start.
    • gameObject, press.gameObject : Parent gameobject of this press behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-press/#pressing-end","title":"Pressing end","text":"
    press.on('pressend', function(press, gameObject, lastPointer){\n}, scope);\n
    "},{"location":"gesture-press/#is-pressed","title":"Is pressed","text":"
    var isPressed = press.isPressed;\n

    Return true if pressed.

    "},{"location":"gesture-press/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any press event,

    press.on('pressstart', function(press){\nvar isPointerInsideGameObject = press.isPointerInGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-press/#other-properties","title":"Other properties","text":"
    • Hold time
      • Get
        var holdTime = press.holdTime;\n
      • Set
        press.setHoldTime(holdTime);\n// press.holdTime = holdTime;\n
    • Drag threshold
      • Get
        var dragThreshold = press.dragThreshold;\n
      • Set
        press.setDragThreshold(dragThreshold);\n// press.dragThreshold = dragThreshold;\n
    • Detect bounds
      • Get
        var bounds = press.bounds;\n
      • Set
        press.setDetectBounds(bounds);\n// press.bounds = bounds;\n
    "},{"location":"gesture-rotate/","title":"Rotate","text":""},{"location":"gesture-rotate/#introduction","title":"Introduction","text":"

    Get spin angle from 2 dragging touch pointers.

    • Author: Rex
    • Member of scene
    "},{"location":"gesture-rotate/#live-demos","title":"Live demos","text":"
    • Rotate & rotate
    "},{"location":"gesture-rotate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-rotate/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-rotate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add rotate input
      var rotate = scene.rexGestures.add.rotate(config);\n// var rotate = scene.rexGestures.add.rotate(gameObject, config);\n
    "},{"location":"gesture-rotate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add rotate input
      var rotate = scene.rexGestures.add.rotate(config);\n// var rotate = scene.rexGestures.add.rotate(gameObject, config);\n
    "},{"location":"gesture-rotate/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Rotate } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add rotate input
      var rotate = new Rotate(scene, config);\n// var rotate = new Rotate(gameObject, config);\n
    "},{"location":"gesture-rotate/#create-instance","title":"Create instance","text":"
    • Rotate input
      var rotate = scene.rexGestures.add.rotate({\n// enable: true,\n// bounds: undefined,\n\n// threshold: 0,\n});\n
      • enable : Set false to disable input events.
      • bounds : A rectangle object or undefined (to use game window as rectangle object), for detecting the position of cursor.
      • threshold : Fire rotate events after dragging distances of catched pointers are larger than this threshold.
    • Rotate behavior of game object
      var rotate = scene.rexGestures.add.rotate(gameObject, {\n// enable: true,\n// bounds: undefined,\n\n// threshold: 0,\n});\n
      • Start rotation when pointer-down on this game object.
    "},{"location":"gesture-rotate/#enable","title":"Enable","text":"
    • Get
      var enable = rotate.enable;  // enable: true, or false\n
    • Set
      rotate.setEnable(enable);  // enable: true, or false\n// rotate.enable = enable;\n
    • Toggle
      rotate.toggleEnable();\n
    "},{"location":"gesture-rotate/#events","title":"Events","text":""},{"location":"gesture-rotate/#on-dragging","title":"On dragging","text":"
    • On dragging 1st touch pointer, fired when 1st touch pointer is moving
      rotate.on('drag1', function(rotate) {\n// var drag1Vector = rotate.drag1Vector; // drag1Vector: {x, y}\n}, scope);\n
      • rotate.drag1Vector : Drag vector from prevoius touch position to current touch position of 1st catched touch pointer.
    • On dragging 2 touch pointers, fired when any catched touch pointer moved.
      rotate.on('rotate', function(rotate) {\n// rotate.spinObject(gameObejects);\n// var angle = rotate.rotation;\n}, scope);\n
      • rotate.spinObject(gameObejects) : Drag and spin an array of game object, or a game object around current center of 2 dragging pointers.
      • rotate.rotation : Return spin angle of 2 dragging pointers, in radius.
    "},{"location":"gesture-rotate/#on-drag-start-on-drag-end","title":"On drag start, on drag end","text":"
    • On drag 1 touch pointer start, fired when catching 1st touch pointer.
      rotate.on('drag1start', function(rotate) {\n\n}, scope);\n
    • On drag 1 touch pointer end, fired when releasing the last one catched touch pointer.
      rotate.on('drag1end', function(rotate) {\n\n}, scope);\n
    • On drag 2 touch pointers start, fired when catching 2 touch pointers.
      rotate.on('rotatestart', function(rotate) {\n\n}, scope);\n
    • On drag 2 touch pointers end, fired when releasing any catched touch pointer.
      rotate.on('rotateend', function(rotate) {\n\n}, scope);\n
    "},{"location":"gesture-rotate/#spin-game-object","title":"Spin game object","text":"
    rotate.spinObject(gameObejects);\n

    Drag and spin game objects around current center of 2 dragging pointers. Uses this function under 'rotate' event.

    • gameObejects : An array of game object, or a game object.
    "},{"location":"gesture-rotate/#spin-angle","title":"Spin angle","text":"
    var angle = rotate.rotation;\n

    Spin angle of 2 dragging pointers, in radius.

    "},{"location":"gesture-rotate/#drag-vector-of-1st-touch-pointer","title":"Drag vector of 1st touch pointer","text":"
    var drag1Vector = rotate.drag1Vector; // {x, y}\n
    "},{"location":"gesture-rotate/#catched-touch-pointers","title":"Catched touch pointers","text":"
    • Pointer 0, available when state is 1
      var pointer0 = rotate.pointers[0];\n
      • Position of pointer
        var x = pointer0.x;\nvar y = pointer0.y;\nvar worldX = pointer0.worldX;\nvar worldY = pointer0.worldY;\n
    • Pointer 1, available when state is 2
      var pointer0 = rotate.pointers[1];\n
    "},{"location":"gesture-rotate/#is-rotated","title":"Is rotated","text":"
    var isRotated = rotate.isRotated;\n

    Return true if pinched.

    "},{"location":"gesture-rotate/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any rotate event,

    rotate.on('rotate', function(rotate) {\nvar isPointer0InsideGameObject = rotate.isPointer0InGameObject(anotherGameObject);\nvar isPointer1InsideGameObject = rotate.isPointer1InGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-rotate/#other-properties","title":"Other properties","text":"
    • Drag threshold
      • Get
        var dragThreshold = rotate.dragThreshold;\n
      • Set
        rotate.setDragThreshold(dragThreshold);\n// rotate.dragThreshold = dragThreshold;\n
    • Detect bounds
      • Get
        var bounds = rotate.bounds;\n
      • Set
        rotate.setDetectBounds(bounds);\n// rotate.bounds = bounds;\n
    "},{"location":"gesture-swipe/","title":"Swipe","text":""},{"location":"gesture-swipe/#introduction","title":"Introduction","text":"

    Get swipe events of a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"gesture-swipe/#live-demos","title":"Live demos","text":"
    • Swipe
    "},{"location":"gesture-swipe/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-swipe/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-swipe/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add swipe input
      var swipe = scene.rexGestures.add.swipe(config);\n// var swipe = scene.rexGestures.add.swipe(gameObject, config);\n
    "},{"location":"gesture-swipe/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add swipe input
      var swipe = scene.rexGestures.add.swipe(config);\n// var swipe = scene.rexGestures.add.swipe(gameObject, config);\n
    "},{"location":"gesture-swipe/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Swipe } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add swipe input
      var swipe = new Swipe(scene, config);\n// var swipe = new Swipe(gameObject, config);\n
    "},{"location":"gesture-swipe/#create-instance","title":"Create instance","text":"
    • Swipe input
      var swipe = scene.rexGestures.add.swipe({\n// enable: true,\n// bounds: undefined,\n\n// threshold: 10,\n// velocityThreshold: 1000,\n// dir: '8dir',\n});\n
      • enable : Set false to disable input events.
      • bounds : Touch detecting area rectangle, if game obect is not given.
        • undefined : Ignore this feature, default behavior.
      • time : Max time of the pointer to be down.
      • threshold : Minimal movement when pointer is down.
      • velocityThreshold : Minimal dragging speed.
      • dir :
        • 'up&down', or 0 : Get up or down state only.
        • 'left&right', or 1 : Get left or right state only.
        • '4dir', or 2 : Get up, down, left or right state.
        • '8dir', or 3 : Get up, up/left, up/right, down, down/left, down/right, left, or right state.
    • Swipe behavior of game object
      var swipe = scene.rexGestures.add.swipe(gameObject, {\n// enable: true,\n\n// threshold: 10,\n// velocityThreshold: 1000,\n// direction: '8dir',\n});\n
    "},{"location":"gesture-swipe/#enable","title":"Enable","text":"
    • Get
      var enable = swipe.enable;  // enable: true, or false\n
    • Set
      swipe.setEnable(enable);  // enable: true, or false\n// swipe.enable = enable;\n
    • Toggle
      swipe.toggleEnable();\n
    "},{"location":"gesture-swipe/#events","title":"Events","text":""},{"location":"gesture-swipe/#swipe","title":"Swipe","text":"
    swipe.on('swipe', function(swipe, gameObject, lastPointer){\n}, scope);\n
    • swipe.left, swipe.right, swipe.up, swipe.down : Swipe direction states.
    • swipe.worldX, swipe.worldY : World position of swiping start.
    • swipe.x, swipe.y : Scene position of swiping start.
    • swipe.dragVelocity : Velocity of dragging.
    • gameObject, swipe.gameObject : Parent gameobject of this pan behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-swipe/#is-swiped","title":"Is swiped","text":"
    var isSwiped = swipe.isSwiped;\n

    Return true if panning.

    "},{"location":"gesture-swipe/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any swipe event,

    swipe.on('swipe', function(swipe){\nvar isPointerInsideGameObject = swipe.isPointerInGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-swipe/#other-properties","title":"Other properties","text":"
    • Drag threshold
      • Get
        var dragThreshold = swipe.dragThreshold;\n
      • Set
        swipe.setDragThreshold(dragThreshold);\n// swipe.dragThreshold = dragThreshold;\n
    • Velocity threshold
      • Get
        var velocityThreshold = swipe.velocityThreshold;\n
      • Set
        swipe.setVelocityThreshold(velocityThreshold);\n// swipe.velocityThreshold = velocityThreshold;\n
    • Direction mode
      • Get
        var dirMode = swipe.dirMode;  // 0,1,2,3\n
      • Set
        swipe.setDirectionMode(dirMode);  // 0,1,2,3,'up&down','left&right','4dir','8dir'\n// swipe.dirMode = dirMode;  // 0,1,2,3\n
    • Detect bounds
      • Get
        var bounds = swipe.bounds;\n
      • Set
        swipe.setDetectBounds(bounds);\n// swipe.bounds = bounds;\n
    "},{"location":"gesture-tap/","title":"Tap","text":""},{"location":"gesture-tap/#introduction","title":"Introduction","text":"

    Get tap/multi-taps events of a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"gesture-tap/#live-demos","title":"Live demos","text":"
    • Tap object
    "},{"location":"gesture-tap/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-tap/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-tap/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add tap input
      var tap = scene.rexGestures.add.tap(config);\n// var tap = scene.rexGestures.add.tap(gameObject, config);\n
    "},{"location":"gesture-tap/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tap input
      var tap = scene.rexGestures.add.tap(config);\n// var tap = scene.rexGestures.add.tap(gameObject, config);\n
    "},{"location":"gesture-tap/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Tap } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add tap input
      var tap = new Tap(scene, config);\n// var tap = new Tap(gameObject, config);\n
    "},{"location":"gesture-tap/#create-instance","title":"Create instance","text":"
    • Tap input
      var tap = scene.rexGestures.add.tap({\n// enable: true,\n// bounds: undefined,\n\n// time: 250,\n// tapInterval: 200,\n// threshold: 9,\n// tapOffset: 10,\n\n// taps: undefined,\n// minTaps: undefined,\n// maxTaps: undefined,\n});\n
      • enable : Set false to disable input events.
      • bounds : Touch detecting area rectangle, if game obect is not given.
        • undefined : Ignore this feature, default behavior.
      • time : Max time of the pointer to be down.
      • tapInterval : Max time between the multi-tap taps.
      • threshold : Minimal movement when pointer is down.
      • tapOffset : A multi-tap can be a bit off the initial position.
      • taps : Fire tap event only when taps count reaches this value.
        • undefined : Fire tap event only when tapped end. i.e pointer-up time exceeds tapInterval.
      • minTaps : Fire tap event only when taps count is larger than this value.
        • undefined : Don't check taps count.
      • maxTaps : Fire tap event only when taps count is less than this value.
        • undefined : Don't check taps count.
    • Tap behavior of game object
      var tap = scene.rexGestures.add.tap(gameObject, {\n// enable: true,\n\n// time: 250,\n// tapInterval: 200,\n// threshold: 9,\n// tapOffset: 10,\n\n// taps: undefined,\n// minTaps: undefined,\n// maxTaps: undefined,\n});\n
    "},{"location":"gesture-tap/#enable","title":"Enable","text":"
    • Get
      var enable = tap.enable;  // enable: true, or false\n
    • Set
      tap.setEnable(enable);  // enable: true, or false\n// tap.enable = enable;\n
    • Toggle
      tap.toggleEnable();\n
    "},{"location":"gesture-tap/#events","title":"Events","text":""},{"location":"gesture-tap/#tap","title":"Tap","text":"
    tap.on('tap', function(tap, gameObject, lastPointer){\n}, scope);\n
    • tap.tapsCount : Taps count.
    • gameObject, tap.gameObject : Parent gameobject of this tap behavior.
    • tap.worldX, tap.worldY : World position of first tapping.
    • tap.x, tap.y : Scene position of first tapping.
    • lastPointer : Last touch pointer.
    tap.on(tapsCount + 'tap', function(tap, gameObject, lastPointer){\n}, scope);\n
    • tapsCount + 'tap' : 1tap, 2tap, 3tap, etc ...
    "},{"location":"gesture-tap/#tapping-start","title":"Tapping start","text":"

    Each pointer-down will increase taps count and fire tappingstart event.

    tap.on('tappingstart', function(tap, gameObject, lastPointer){\n}, scope);\n
    "},{"location":"gesture-tap/#is-tapped","title":"Is tapped","text":"
    var isTapped = tap.isTapped;\n

    Return true if tapped end.

    "},{"location":"gesture-tap/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any tap event,

    tap.on('tap', function(tap){\nvar isPointerInsideGameObject = tap.isPointerInGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-tap/#other-properties","title":"Other properties","text":"
    • Hold time
      • Get
        var holdTime = tap.holdTime;\n
      • Set
        tap.setHoldTime(holdTime);\n// tap.holdTime = holdTime;\n
    • Tap interval
      • Get
        var tapInterval = tap.tapInterval;\n
      • Set
        tap.setTapInterval(tapInterval);\n// tap.tapInterval = tapInterval;\n
    • Drag threshold
      • Get
        var dragThreshold = tap.dragThreshold;\n
      • Set
        tap.setDragThreshold(dragThreshold);\n// tap.dragThreshold = dragThreshold;\n
    • Tap offset
      • Get
        var tapOffset = tap.tapOffset;\n
      • Set
        tap.setTapOffset(tapOffset);\n// tap.tapOffset = tapOffset;\n
    • Max taps
      • Get
        var maxTaps = tap.maxTaps;\n
      • Set
        tap.setMaxTaps(maxTaps);\n// tap.maxTaps = maxTaps;\n
    • Min taps
      • Get
        var minTaps = tap.minTaps;\n
      • Set
        tap.setMinTaps(minTaps);\n// tap.minTaps = minTaps;\n
    • Taps
      taps.setTaps(taps);\n// taps.setTaps(minTaps, maxTaps);\n
    • Detect bounds
      • Get
        var bounds = taps.bounds;\n
      • Set
        taps.setDetectBounds(bounds);\n// taps.bounds = bounds;\n
    "},{"location":"graphics/","title":"Graphics","text":""},{"location":"graphics/#introduction","title":"Introduction","text":"

    Drawing on webgl or canvas, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"graphics/#usage","title":"Usage","text":""},{"location":"graphics/#add-graphics-object","title":"Add graphics object","text":"
    var graphics = scene.add.graphics();\n

    or

    var graphics = scene.add.graphics({\nx: 0,\ny: 0,\n\n// lineStyle: {\n//     width: 1,\n//     color: 0xffffff,\n//     alpha: 1\n// },\n// fillStyle: {\n//     color: 0xffffff,\n//     alpha: 1\n// },\n\nadd: true\n});\n
    "},{"location":"graphics/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGraphics extends Phaser.GameObjects.Graphics {\nconstructor(scene, options) {\nsuper(scene, options);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var graphics = new MyGraphics(scene, options);\n
    "},{"location":"graphics/#drawing-commands","title":"Drawing commands","text":""},{"location":"graphics/#set-style","title":"Set style","text":"
    • Set default line style and fill style
      graphics.setDefaultStyles({\nlineStyle: {\nwidth: 1,\ncolor: 0xffffff,\nalpha: 1\n},\nfillStyle: {\ncolor: 0xffffff,\nalpha: 1\n}\n});\n
    • Set line style
      graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\n
    • Set fill style
      • Fill color
        graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\n
      • Fill gradient color (WebGL only)
        graphics.fillGradientStyle(topLeft, topRight, bottomLeft, bottomRight, alpha);  // alpha= 1\n// graphics.fillGradientStyle(topLeft, topRight, bottomLeft, bottomRight, alphaTopLeft, alphaTopRight, alphaBottomLeft, alphaBottomRight);\n
        • topLeft : The tint being applied to the top-left of the Game Object.
        • topRight : The tint being applied to the top-right of the Game Object.
        • bottomLeft : The tint being applied to the bottom-left of the Game Object.
        • bottomRight : The tint being applied to the bottom-right of the Game Object.
        • alphaTopLeft : The top left alpha value.
        • alphaTopRight : The top right alpha value.
        • alphaBottomLeft : The bottom left alpha value.
        • alphaBottomRight : The bottom right alpha value.
    "},{"location":"graphics/#clear","title":"Clear","text":"
    graphics.clear();\n
    "},{"location":"graphics/#path","title":"Path","text":"
    graphics.beginPath();\ngraphics.closePath();\ngraphics.fillPath(); // = graphics.fill()\ngraphics.strokePath(); // = graphics.stroke()\n
    "},{"location":"graphics/#rectangle","title":"Rectangle","text":"
    graphics.fillRectShape(rect); // rect: {x, y, width, height}\ngraphics.fillRect(x, y, width, height);\ngraphics.strokeRectShape(rect);  // rect: {x, y, width, height}\ngraphics.strokeRect(x, y, width, height);\n
    "},{"location":"graphics/#rounded-rectangle","title":"Rounded rectangle","text":"
    graphics.fillRoundedRect(x, y, width, height, radius);\ngraphics.strokeRoundedRect(x, y, width, height, radius);\n
    • radius : number or an object {tl, tr, bl, br},
      • Positive value : Convex corner.
      • Negative value : Concave corner.
    "},{"location":"graphics/#triangle","title":"Triangle","text":"
    graphics.fillTriangleShape(triangle); // triangle: {x1, y1, x2, y2, x3, y3}\ngraphics.fillTriangle(x1, y1, x2, y2, x3, y3);\ngraphics.strokeTriangleShape(triangle); // triangle: {x1, y1, x2, y2, x3, y3}\ngraphics.strokeTriangle(x1, y1, x2, y2, x3, y3);\n
    "},{"location":"graphics/#point","title":"Point","text":"
    graphics.fillPointShape(point, size); // point: {x, y}\ngraphics.fillPoint(x, y, size);\n
    "},{"location":"graphics/#line","title":"Line","text":"
    graphics.strokeLineShape(line); // line: {x1, y1, x2, y2}\ngraphics.lineBetween(x1, y1, x2, y2);\ngraphics.lineTo(x, y);\ngraphics.moveTo(x, y);\n
    "},{"location":"graphics/#lines","title":"Lines","text":"
    graphics.strokePoints(points, closeShape, closePath, endIndex);  // points: [{x, y}, ...]\ngraphics.fillPoints(points, closeShape, closePath, endIndex);  // points: [{x, y}, ...]\n
    • points : Array of {x, y}
    • closeShape : When true, the shape is closed by joining the last point to the first point.
    • closePath : When true, the path is closed before being stroked.
    • endIndex : The index of points to stop drawing at. Defaults to points.length.
    "},{"location":"graphics/#circle","title":"Circle","text":"
    graphics.fillCircleShape(circle); // circle: {x, y, radius}\ngraphics.fillCircle(x, y, radius);\ngraphics.strokeCircleShape(circle);  // circle: {x, y, radius}\ngraphics.strokeCircle(x, y, radius);\n

    Draw or fill circle shape by points.

    "},{"location":"graphics/#ellipse","title":"Ellipse","text":"
    graphics.strokeEllipseShape(ellipse, smoothness);   // ellipse: Phaser.Geom.Ellipse\ngraphics.strokeEllipse(x, y, width, height, smoothness);\ngraphics.fillEllipseShape(ellipse, smoothness);    // ellipse: Phaser.Geom.Ellipse\ngraphics.fillEllipse(x, y, width, height, smoothness);\n

    Draw or fill ellipse shape by points.

    "},{"location":"graphics/#arc","title":"Arc","text":"
    graphics.arc(x, y, radius, startAngle, endAngle, anticlockwise);\ngraphics.arc(x, y, radius, startAngle, endAngle, anticlockwise, overshoot);\n

    Draw arc curve by points.

    "},{"location":"graphics/#pie-chart-slice","title":"Pie-chart slice","text":"
    graphics.slice(x, y, radius, startAngle, endAngle, anticlockwise);\ngraphics.slice(x, y, radius, startAngle, endAngle, anticlockwise, overshoot);\n

    Draw pie-chart slice shape by points.

    Fill this shape

    graphics.fillPath();\n
    "},{"location":"graphics/#clear-pattern","title":"Clear pattern","text":"
    graphics.setTexture();\n
    "},{"location":"graphics/#transfer","title":"Transfer","text":"
    graphics.save();\ngraphics.restore();\ngraphics.translateCanvas(x, y);\ngraphics.scaleCanvas(x, y);\ngraphics.rotateCanvas(radians);\n
    "},{"location":"graphics/#generate-texture","title":"Generate texture","text":"
    graphics.generateTexture(key, width, height);  // key: texture key\n
    "},{"location":"graphics/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"graphics/#create-mask","title":"Create mask","text":"
    var mask = graphics.createGeometryMask();\n

    See mask

    "},{"location":"graphics/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"gridalign/","title":"Quad/Hexagon grid align","text":""},{"location":"gridalign/#introduction","title":"Introduction","text":"

    Align objects on quadrilateral or hexagon grid.

    See also built-in grid-align.

    • Author: Rex
    • Methods
    "},{"location":"gridalign/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gridalign/#install-plugin","title":"Install plugin","text":""},{"location":"gridalign/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgridalignplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgridalignplugin.min.js', true);\n
    • Grid-align objects
      scene.plugins.get('rexgridalignplugin').quad(gameObjects, config);\nscene.plugins.get('rexgridalignplugin').hexagon(gameObjects, config);\n
    "},{"location":"gridalign/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GridAlignPlugin from 'phaser3-rex-plugins/plugins/gridalign-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGridAlign',\nplugin: GridAlignPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Grid-align objects
      scene.plugins.get('rexGridAlign').quad(gameObjects, config);\nscene.plugins.get('rexGridAlign').hexagon(gameObjects, config);\n
    "},{"location":"gridalign/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { QuadGridAlign, HexagonGridAlign } from 'phaser3-rex-plugins/plugins/gridalign.js';\n
    • Grid-align objects
      QuadGridAlign(gameObjects, config);\nHexagonGridAlign(gameObjects, config);\n
    "},{"location":"gridalign/#quadrilateral-grid","title":"Quadrilateral grid","text":"
    scene.plugins.get('rexGridAlign').quad(gameObjects, {\nwidth: -1,\nheight: -1,\ncellWidth: 1,\ncellHeight: 1,\ntype: 0,\nposition: Phaser.Display.Align.CENTER,\nx: 0,\ny: 0\n});\n
    • width : The width of the grid in items (not pixels). -1 means lay all items out horizontally, regardless of quantity.
    • height : The height of the grid in items (not pixels). -1 means lay all items out vertically, regardless of quantity.
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • type
      • 0, or orthogonal
      • 1, or isometric
    • position : The alignment position.
      • 0, or Phaser.Display.Align.TOP_LEFT
      • 1, or Phaser.Display.Align.TOP_CENTER
      • 2, or Phaser.Display.Align.TOP_RIGHT
      • 3, or Phaser.Display.Align.LEFT_TOP
      • 4, or Phaser.Display.Align.LEFT_CENTER
      • 5, or Phaser.Display.Align.LEFT_BOTTOM
      • 6, or Phaser.Display.Align.CENTER
      • 7, or Phaser.Display.Align.RIGHT_TOP
      • 8, or Phaser.Display.Align.RIGHT_CENTER
      • 9, or Phaser.Display.Align.RIGHT_BOTTOM
      • 10, or Phaser.Display.Align.BOTTOM_LEFT
      • 11, or Phaser.Display.Align.BOTTOM_CENTER
      • 12, or Phaser.Display.Align.BOTTOM_RIGHT
    • x, y : Position of first item.
    "},{"location":"gridalign/#hexagon-grid","title":"Hexagon grid","text":"
    scene.plugins.get('rexGridAlign').hexagon(gameObjects, {\nwidth: -1,\nheight: -1,\ncellWidth: 1,\ncellHeight: 1,\nstaggeraxis: 'x',\nstaggerindex: 'odd',\nposition: Phaser.Display.Align.CENTER,\nx: 0,\ny: 0\n});\n
    • width : The width of the grid in items (not pixels). -1 means lay all items out horizontally, regardless of quantity.
    • height : The height of the grid in items (not pixels). -1 means lay all items out vertically, regardless of quantity.
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • staggeraxis
      • 0, or y
      • 1, or x
    • staggerindex
      • 0, or even
      • 1, or odd
    • position : The alignment position.
      • 0, or Phaser.Display.Align.TOP_LEFT
      • 1, or Phaser.Display.Align.TOP_CENTER
      • 2, or Phaser.Display.Align.TOP_RIGHT
      • 3, or Phaser.Display.Align.LEFT_TOP
      • 4, or Phaser.Display.Align.LEFT_CENTER
      • 5, or Phaser.Display.Align.LEFT_BOTTOM
      • 6, or Phaser.Display.Align.CENTER
      • 7, or Phaser.Display.Align.RIGHT_TOP
      • 8, or Phaser.Display.Align.RIGHT_CENTER
      • 9, or Phaser.Display.Align.RIGHT_BOTTOM
      • 10, or Phaser.Display.Align.BOTTOM_LEFT
      • 11, or Phaser.Display.Align.BOTTOM_CENTER
      • 12, or Phaser.Display.Align.BOTTOM_RIGHT
    • x, y : Position of first item.
    "},{"location":"gridalign/#types-of-hexagon-grid","title":"Types of hexagon grid","text":"

    Reference

    • odd-r : staggeraxis = x, staggerindex = odd
    • even-r : staggeraxis = x, staggerindex = even
    • odd-q : staggeraxis = y, staggerindex = odd
    • even-q :staggeraxis = y, staggerindex = even
    "},{"location":"gridcutimage/","title":"Grid cut image","text":""},{"location":"gridcutimage/#introduction","title":"Introduction","text":"

    Grid cut image texture to frames, then create image game objects from these frames.

    • Author: Rex
    • Methods
    "},{"location":"gridcutimage/#live-demos","title":"Live demos","text":"
    • Cut image
    • Cut rendertexture
    "},{"location":"gridcutimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gridcutimage/#install-plugin","title":"Install plugin","text":""},{"location":"gridcutimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgridcutimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgridcutimageplugin.min.js', true);\n
    • Create images
      var images = scene.plugins.get('rexgridcutimageplugin').gridCut(gameObjects, columns, rows, config);\n
    "},{"location":"gridcutimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GridCutImagePlugin from 'phaser3-rex-plugins/plugins/gridcutimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGridCutImage',\nplugin: GridCutImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create images
      var images = scene.plugins.get('rexGridCutImage').gridCut(gameObjects, columns, rows, config);\n
    "},{"location":"gridcutimage/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import GridCutImage from 'phaser3-rex-plugins/plugins/gridcutimage.js';\n
    • Create images
      var images = GridCutImage(gameObjects, columns, rows, config);\n
    "},{"location":"gridcutimage/#grid-cut","title":"Grid cut","text":"
    var cellImages = scene.plugins.get('rexGridCutImage').gridCut(gameObjects, columns, rows, {\n// createImageCallback: undefined,\n// ImageClass: Phaser.GameObjects.Image,\n\n// originX: 0.5,\n// originY: 0.5,\n// add: true,\n// align: true,\n// objectPool: undefined\n})\n
    • gameObjects : Target game object which has a texture, ex Image, RenderTexture.
    • columns, rows : Cut texture in columns x rows grids
    • createImageCallback : Custom callback to return an image game object, optional.
      function(scene, texture, frame) {\nreturn gameObject;\n}\n
      • texture : A texture object.
      • frame : Frame name.
    • ImageClass : Create image game object from this class. Default value is built-in Image class. Used when createImageCallback is undefined.
    • originX, originY : Origin of created image game objects
    • add :
      • true : Add these created image game objects to scene. Default value.
      • false : Don't add created image game objects to scene.
    • align :
      • true : Align position of created image game objects to target game object (gameObjects). Default value when add is set to true.
      • false : Don't set position of created image game objects. Default value when add is set to false.
    • objectPool : An array of image game objects, will reuse image game objects from this pool. Optional.
    • cellImages : Return image game objects.
    "},{"location":"gridtable/","title":"Grid table","text":""},{"location":"gridtable/#introduction","title":"Introduction","text":"

    Viewer of grid table, to manipulate game object of each visible cell.

    • Author: Rex
    • Game object
    "},{"location":"gridtable/#live-demos","title":"Live demos","text":"
    • Grid table
    • Grid table & slider
    • Grid table & scroller
    • Grid table & slider & scroller
    • Horizontal scrolling
    • Varying cell height
    "},{"location":"gridtable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gridtable/#install-plugin","title":"Install plugin","text":""},{"location":"gridtable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgridtableplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgridtableplugin.min.js', true);\n
    • Add table object
      var table = scene.add.rexGridTable(x, y, width, height, config);\n
    "},{"location":"gridtable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GridTablePlugin from 'phaser3-rex-plugins/plugins/gridtable-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGridTablePlugin',\nplugin: GridTablePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add table object
      var table = scene.add.rexGridTable(x, y, width, height, config);\n
    "},{"location":"gridtable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import GridTable from 'phaser3-rex-plugins/plugins/gridtable.js';\n
    • Add table object
      var table = new GridTable(scene, x, y, width, height, config);\nscene.add.existing(table);\n
    "},{"location":"gridtable/#create-instance","title":"Create instance","text":"
    var table = scene.add.rexGridTable(x, y, width, height, {\nscrollMode: 0,        // 0|'v'|'vertical'|1|'h'|'horizontal'\ncellsCount: 0,\ncolumns: 1,\n// rows: 1,\ncellHeight: 30,\ncellWidth: 30,\n// fixedCellSize: false,\n\ncellVisibleCallback: null,\n// cellVisibleCallback: function (cell, cellContainer, table) {},\ncellVisibleCallbackScope: undefined,\nreuseCellContainer: false,\n\ncellInvisibleCallback: null,\n// cellInvisibleCallback: function(cell) {},\ncellInvisibleCallbackScope: undefined,\nclampTableOXY: true,\n\nmask: {\npadding: 0, // or {left, right, top, bottom}\n// updateMode: 0,\n// layer: undefined,\n},\n// enableLayer: false\n});\n
    • scrollMode :
      • 0, or 'v', or 'vertical' : Scroll table vertically.
      • 1, or 'h', or 'horizontal' : Scroll table horizontally.
    • cellsCount : Total cells count.
    • columns : Columns count of each row. Can be used in vertical or horizontal scroll mode.
    • rows : Rows count of each column. Can be used in horizontal scroll mode.
    • cellHeight : Default height of each cell.
      • Expand cell height to fit table height : set cellHeight to undefined, and scrollMode is 'horizontal'.
    • cellWidth : Width of each cell.
      • Expand cell width to fit table width : set cellWidth to undefined, and scrollMode is 'vertical'.
    • fixedCellSize : Assign columns according to cellWidth (if scrollMode is 0) or cellHeight (if scrollMode is 1) , when initialize and resizing. \u3000\u3000- false : Ignore this parameter. Default behavior.
      • true : Set columns according to cellWidth/cellHeight.
    • cellVisibleCallback , cellVisibleCallbackScope : Callback when cell begins visible.
      function (cell, cellContainer, table) {\nif (cellContainer === null) { // No reusable cell container, create a new one\nvar scene = cell.scene;\n// cellContainer = scene.add.container();\n}\n// Set child properties of cell container ...\ncell.setContainer(cellContainer); // Assign cell container\n}\n
    • reuseCellContainer : Set true to reuse cell container when cell is visible.
    • cellInvisibleCallback, cellInvisibleCallbackScope: Callback when cell begins invisible
      function (cell) {\n// var container = cell.popContainer();\n}\n
    • clampTableOXY : Set true to clamp tableOX, tableOY when out-of-bound,
      • Set false when dragging by scroller
    • mask : A rectangle mask of cells
      • mask.padding :
        • A number : Extra left/right/top/bottom padding spacing of this rectangle mask. Default value is 0.
        • A plain object {left, right, top, bottom}
      • mask.updateMode : When to update cells mask
        • 0, or update : Apply mask to cell container only when table.updateTable() is invoked. Default behavior.
        • 1, or everyTick : Apply mask to cell container every tick. Use this mode if game objects of cell are moved after table.updateTable() and still been masked.
      • mask.layer :
        • undefined, false, null : Disable this feature, default behavior
        • Layer game object : Draw children game object of panel on this layer game object, then apply mask on this layer game object.
      • false : No mask.
    • enableLayer :
      • false : Add cell game objects into scene's display list. Default behavior.
      • true : Add cell game objects into an internal layer game object. See also.

    Add grid table from JSON

    var table = scene.make.rexGridTable({\nx: 0,\ny: 0,\nwidth: 256,\nheight: 256,\n\n// cellsCount: 0,   // total cells count\n// ...\n// origin: {x: 0.5, y: 0.5},\n});\n
    "},{"location":"gridtable/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGridTable extends GridTable {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var table = new MyGridTable(scene, x, y, width, height, config);\n
    "},{"location":"gridtable/#cell-begins-visible","title":"Cell begins visible","text":"

    Add container of cell when it begins visible in event cellvisible.

    table.on('cellvisible', function(cell, cellContainer, table){\nif (cellContainer === null) { // No reusable cell container, create a new one\nvar scene = cell.scene;\n// cellContainer = scene.add.container();\n}\n// Set child properties of cell container ...\ncell.setContainer(cellContainer); // Assign cell container\n})\n

    It is equal to cellVisibleCallback in configuration.

    {\n// ...\ncellVisibleCallback: function(cell, cellContainer, table) {\ncell.setContainer(cellContainer); // Assign cell container\n},\n// ...\n}\n
    • cell
      • Scene object of grid table.
        var scene = cell.scene;\n
      • Index of cell.
        var index = cell.index;\n
      • Size of cell.
        var cellWidth = cell.width;\nvar cellHeight = cell.height;\n
        • Change size of cell :
          • Change cell height in scoll-vertical mode.
            cell.setHeight(newHeight);\n// cell.height = newHeight;\n
            or
            cell.setDeltaHeight(deltaHeight);\n// cell.deltaHeight = deltaHeight;\n
          • Reset cell height in scoll-vertical mode.
            cell.setDeltaHeight(0);\n// cell.deltaHeight = 0;\n
          • Change cell width in scroll-horizontal mode.
            cell.setWidth(newWidth);\n// cell.width = newWidth;\n
            or
            cell.setDeltaWidth(deltaWidth);\n// cell.deltaWidth = deltaWidth;\n
          • Reset cell height in scroll-horizontal mode.
            cell.setDeltaWidth(0);\n// cell.deltaWidth = 0;\n
      • Assign cell container. Set origin point of this cell container to (0,0).
        cell.setContainer(cellContainer);\n
      • Alignment of cellContainer :
        cell.setCellContainerAlign(align);\n
        • align :
          • undefined : Set position of cellContainer to left-top of cell space. Default behavior.
          • 'center', or Phaser.Display.Align.CENTER : Align game object at center of cell space.
          • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center of cell space.
          • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center of cell space.
          • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center of cell space.
          • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center of cell space.
    • cellContainer : Cell container picked from object pool for reusing. Set reuseCellContainer to true to enable this feature.
      • null : No cell container available.
      • Game object : Reusable cell container.
    • table : Grid table.

    Each cell only has one container gameObject, old container will be destroyed when assigning a new container.

    "},{"location":"gridtable/#cell-begins-invisible","title":"Cell begins invisible","text":"

    Container of an invisible cell will be destroyed automatically.

    To resue container gameObject

    • Set reuseCellContainer to true to put invisible cell container into object pool.
    • Or, pop that container by cell.popContainer() in event cellinvisible.
    table.on('cellinvisible', function(cell){\n// var container = cell.popContainer();\n})\n

    It is equal to cellInvisibleCallback in configuration.

    {\n// ...\ncellInvisibleCallback: function(cell) {\n// var container = cell.popContainer();\n},\n// ...\n}\n
    "},{"location":"gridtable/#scroll-table-content","title":"Scroll table content","text":"
    • Set
      table.setTableOY(oy).updateTable();\ntable.addTableOY(dy).updateTable();\n
      table.setTableOX(ox).updateTable();\ntable.addTableOX(dx).updateTable();\n
      table.setTableOXY(ox, oy).updateTable();\ntable.addTableOXY(dx, dy).updateTable();\n
      or
      table.tableOY = oy;  // include table.updateTable()\ntable.tableOX = ox;\n
      • These will trigger cellvisible, or cellinvisible events.
    • Get
      var tableOY = table.tableOY;\nvar tableOX = table.tableOX;\n

    Use case

    Scroll table by scroller behavior.

    "},{"location":"gridtable/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      table.setTableOYByPercentage(t).updateTable();  // t: 0~1\n
      or
      table.t = t;  // include table.updateTable()\n
    • Get
      var t = table.getTableOYPercentage();\n//var t = table.t;\n

    Use case

    Scroll table by slider behavior.

    "},{"location":"gridtable/#scroll-to-bottom","title":"Scroll to bottom","text":"
    table.scrollToBottom();\n
    "},{"location":"gridtable/#scroll-to-row","title":"Scroll to row","text":"
    • Scroll to next row
      table.scrollToNextRow();\n
    • Scroll to next n row
      table.scrollToNextRow(n);\n
    • Scroll to row
      table.scrollToRow(rowIndex);\n
    • Get current row index
      var rowIndex = table.startRowIndex;\n
    "},{"location":"gridtable/#refresh-table-content","title":"Refresh table content","text":"
    • Refresh all visible cells.
      table.updateTable(true);\n
    • Update a visible cell
      table.updateVisibleCell(cellIndex);\n
    "},{"location":"gridtable/#table-size-in-cells","title":"Table size in cells","text":"
    • Set table size
      table.setGridSize(colCount, rowCount).updateTable();\n
    "},{"location":"gridtable/#total-cells-count","title":"Total cells count","text":"
    • Get
      var count = table.cellsCount;\n
    • Set
      table.setCellsCount(count).updateTable();\n
    "},{"location":"gridtable/#columns-count","title":"Columns count","text":"
    • Get
      var columnCount = table.columnCount;\n
    • Set
      table.setColumnCount(count).updateTable(true);\n
    "},{"location":"gridtable/#table-size-in-pixels","title":"Table size in pixels","text":"
    • Table height in pixels
      var tableHeight = table.tableHeight;\n
    • Table width in pixels
      var tableWidth = table.tableWidth;\n
    "},{"location":"gridtable/#bounds-of-tableox-tableoy","title":"Bounds of tableOX, tableOY","text":"
    • Top bound of tableOY
      var topTableOY = table.topTableOY;  // 0\n
    • Bottom bound of tableOY
      var bottomTableOY = table.bottomTableOY; // A negative number\n
    • Left bound of tableOX
      var leftTableOX = table.leftTableOX;  // 0\n
    • Right bound of tableOX
      var rightTableOX = table.rightTableOX; // A negative number\n

    Use case

    Set bounds of scroller

    "},{"location":"gridtable/#resize-table","title":"Resize table","text":"
    table.resize(width, height);\n
    "},{"location":"gridtable/#cell","title":"Cell","text":""},{"location":"gridtable/#get-cell","title":"Get cell","text":"
    var cell = table.getCell(cellIndex);\n
    "},{"location":"gridtable/#get-cell-from-position","title":"Get cell from position","text":"
    var cellIndex = table.pointToCellIndex(x, y);\nvar cell = table.getCell(cellIndex);\n
    "},{"location":"gridtable/#cell-height","title":"Cell height","text":"
    • Get
      var height = cell.height;\n
    • Set cell height, only worked in scoll-vertical mode.
      cell.height = height;\n// cell.setHeight(height);\n
      or
      table.setCellHeight(cellIndex, cellHeight);\n
      • Refresh table after the cell size is changed.
        table.updateTable(true);\n
      • Emit 'cellheightchange' event.
        table.on('cellheightchange', function (cell, cellContainer, table) {\n});\n
    "},{"location":"gridtable/#cell-width","title":"Cell width","text":"
    • Get
      var width = cell.width;\n
    • Set cell width, only worked in scoll-horizontal mode.
      cell.width = width;\n// cell.setWidth(width);\n
      or
      table.setCellWidth(cellIndex, cellWidth);\n
      • Refresh table after the cell size is changed.
        table.updateTable(true);\n
      • Emit 'cellwidthchange' event.
        table.on('cellwidthchange', function (cell, cellContainer, table) {\n});\n
    "},{"location":"gridtable/#reset-size-of-all-cells","title":"Reset size of all cells","text":"
    table.resetAllCellsSize(width, height);\n
    "},{"location":"gridtable/#fore-each-visible-cell","title":"Fore each visible cell","text":"
    • For when you absolutely know this Set won't be modified during the iteration
      table.iterateVisibleCell(function(cell){\n// ...\n});\n
    • For when you know this Set will be modified during the iteration.
      table.eachVisibleCell(function(cell){\n// ...\n});\n
    "},{"location":"gridtable/#container","title":"Container","text":"
    • Get
      var container = cell.getContainer();\n
    • Pop (get and remove)
      var container = cell.popContainer();\n
    • Set
      cell.setContainer(container);\n
    • Remove
      cell.destroyContainer();\n
    "},{"location":"gridtable/#properties","title":"Properties","text":"
    var cellIndex = cell.index;\n
    "},{"location":"gridtable/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"group/","title":"Group","text":""},{"location":"group/#introduction","title":"Introduction","text":"

    Objects pool, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"group/#usage","title":"Usage","text":""},{"location":"group/#add-group-object","title":"Add group object","text":"
    var group = scene.add.group(config);\n// var group = scene.add.group(gameObjects, config);  // Add game objects into group\n
    • config
      {\nclassType: Phaser.GameObjects.Sprite,\ndefaultKey: null,\ndefaultFrame: null,\nactive: true,\nmaxSize: -1,\nrunChildUpdate: false,\ncreateCallback: null,\nremoveCallback: null,\ncreateMultipleCallback: null\n}\n
      • classType :
        • Sprite : Phaser.GameObjects.Sprite
        • Image : Phaser.GameObjects.Image
      • runChildUpdate : Set true to run gameObject.update() every tick.
      • createCallback : A function to be called when adding or creating group members.
        var callback = function(gameObject) {\n}\n
      • removeCallback : A function to be called when removing group members.
        var callback = function(gameObject) {\n}\n
      • createMultipleCallback : A function to be called when creating several group members at once.
        var callback = function(gameObjects) {\n}\n
    "},{"location":"group/#add-game-object","title":"Add game object","text":"
    group.add(gameObject);\n// group.add(gameObject, true);  // add this game object to display and update list of scene\n
    group.addMultiple(gameObjects);   // array of game objects\n// group.addMultiple(gameObjects, true);\n
    • Game object will only be added once.
    • Game object will be removed automatically when destroyed.
    "},{"location":"group/#remove-game-object","title":"Remove game object","text":"
    group.remove(gameObject);\n// group.remove(gameObject, true);  // also remove this game object from display and update list of scene\n

    Remove all game objects

    group.clear();\n// group.clear(removeFromScene, destroyChild);\n
    "},{"location":"group/#get-game-objects","title":"Get game objects","text":"
    • Get all game objects.
      var gameObjects = group.getChildren();  // array of game objects\n
    • Get all matching game objects
      var gameObjects = group.getMatching(property, value);\n// var gameObjects = group.getMatching(property, value, startIndex, endIndex);\n
    • Amount of game objects.
      var len = group.getLength();\n
    • Group is full. Maximun size is set in maxSize.
      var isFull = group.isFull();\n
    • Game object is in group.
      var isInGroup = group.contains(child);\n
    "},{"location":"group/#group-actions","title":"Group actions","text":""},{"location":"group/#property","title":"Property","text":"
    • Set property
      group.propertyValueSet(key, value);\n// group.propertyValueSet(key, value, step, index, direction);\n
      • direction :
        • 1 : From beginning to end
        • -1 : From end to beginning
    • Increase property
      group.propertyValueInc(key, value);\n// group.propertyValueInc(key, value, step, index, direction);\n
      • direction :
        • 1 : From beginning to end
        • -1 : From end to beginning
    "},{"location":"group/#position","title":"Position","text":"
    • Set Position
      group.setX(value);\n// group.setX(value, step);\ngroup.setX(value);\n// group.setY(value, step);\ngroup.setXY(x, y);\n// group.setXY(x, y, stepX, stepY);\n
    • Increase Position
      group.incX(value);\n// group.incX(value, step);\ngroup.incY(value);\n// group.incY(value, step);\ngroup.incXY(x, y);\n// group.incXY(x, y, stepX, stepY);\n
    • Shift position
      group.shiftPosition(x, y);\n// group.shiftPosition(x, y, direction);\n
      • direction :
        • 0 : First to last
        • 1 : Last to first
    "},{"location":"group/#angle","title":"Angle","text":"
    • Set angle
      group.angle(value);\n// group.angle(value, step);\n
      group.rotate(value);\n// group.rotate(value, step);\n
    • Rotate around
      group.rotateAround(point, angle);\n
      group.rotateAroundDistance(point, angle, distance);\n
    "},{"location":"group/#visible","title":"Visible","text":"
    • Set visible
      group.setVisible(value);\n// group.setVisible(value, index, direction);\n
      • index : An optional offset to start searching from within the items array.
      • direction : The direction to iterate through the array.
        • 1 : From beginning to end
        • -1 : From end to beginning
    • Toggle visible
      group.toggleVisible();\n
    "},{"location":"group/#alpha","title":"Alpha","text":"
    • Set alpha
      group.setAlpha(value);\n// group.setAlpha(value, step);\n
    "},{"location":"group/#tint","title":"Tint","text":"
    • Set tint
      group.setTint(value);\n// group.setTint(topLeft, topRight, bottomLeft, bottomRight);\n
    "},{"location":"group/#blend-mode","title":"Blend mode","text":"
    • Set blend mode
      group.setBlendMode(value);\n
    "},{"location":"group/#scale","title":"Scale","text":"
    • Set scale
      group.scaleX(value);\n// group.scaleX(value, step);\ngroup.scaleY(value);\n// group.scaleY(value, step);\ngroup.scaleXY(scaleX, scaleY);\n// group.scaleXY(scaleX, scaleY, stepX, stepY);\n
    "},{"location":"group/#origin","title":"Origin","text":"
    • Set origin
      group.setOrigin(originX, originY);\n// group.setOrigin(originX, originY, stepX, stepY);\n
    "},{"location":"group/#depth","title":"Depth","text":"
    • Set depth
      group.setDepth(value, step);\n
    "},{"location":"group/#animation","title":"Animation","text":"
    • Play animation
      group.playAnimation(key, startFrame);\n
    "},{"location":"group/#hit-area","title":"Hit area","text":"
    • Set hit-area
      group.setHitArea();\n// group.setHitArea(hitArea, hitAreaCallback);\n
    "},{"location":"group/#shuffle","title":"Shuffle","text":"
    • Shuffle array
      group.shuffle();\n
    "},{"location":"group/#activeinactive-game-objects","title":"Active/inactive game objects","text":"
    • Set inactive
      group.kill(gameObject);         // gameObject.setActive(false)\ngroup.killAndHide(gameObject);  // gameObject.setActive(false).setVisible(false)\n
    • Amount of active game objects
      var activeCount = group.countActive();\n
      or
      var activeCount = group.getTotalUsed();\n
    • Amount of active game objects
      var inactiveCount = group.countActive(false);\n
    • Amount of free (maxSize - activeCount) game objects
      var freeCount = group.getTotalFree();  // group.maxSize - group.getTotalUsed()\n
    • Get first active/inactive game object,
      • Return null if no game object picked.
        var gameObject = group.getFirst(active);  // active = true/false\nvar gameObject = group.getFirstAlive(); // Equal to group.getFirst(true, ...)\nvar gameObject = group.getFirstDead(); // Equal to group.getFirst(false, ...)\n
      • Create one if no game object picked.
        var gameObject = group.getFirst(active, true, x, y, key, frame, visible);  // active = true/false\nvar gameObject = group.getFirstAlive(true, x, y, key, frame, visible); // Equal to group.getFirst(true, ...)\nvar gameObject = group.getFirstDead(true, x, y, key, frame, visible); // Equal to group.getFirst(false, ...)\nvar gameObject = group.get(x, y, key, frame, visible); // Equal to group.getFirst(false, true, ...)\n
        • Use (x, y, key, frame) to create Image/Sprite game object.
          var newGameObject = new GameObjectClass(x, y, key, frame);\n
    "},{"location":"group/#create-game-objects","title":"Create game objects","text":"
    var gameObjects = group.createFromConfig(config);\nvar gameObjects = group.createMultiple(config);    // config in array\n
    • config
      {\nclassType: this.classType,\nkey: undefined,             // Required\nframe: null,\nvisible: true,\nactive: true,\nrepeat: 0,                  // Create (1 + repeat) game objects\ncreateCallback: undefined,  // Override this.createCallback if not undefined\n\n// Position\nsetXY: {\nx:0,\ny:0,\nstepX:0,\nstepY:0\n},\n// Actions.SetXY(gameObjects, x, y, stepX, stepY)\ngridAlign: false,\n// {\n//     width: -1,\n//     height: -1,\n//     cellWidth: 1,\n//     cellHeight: 1,\n//     position: Phaser.Display.Align.TOP_LEFT,\n//     x: 0,\n//     y: 0\n// }\n// Actions.GridAlign(gameObjects, gridAlign)\n\n// Angle\nsetRotation: {\nvalue: 0,\nstep:\n},\n// Actions.SetRotation(gameObjects, value, step)\n\n// Scale\nsetScale: {\nx:0,\ny:0,\nstepX:0,\nstepY:0\n},\n// Actions.SetScale(gameObjects, x, y, stepX, stepY)\n\n// Alpha\nsetAlpha: {\nvalue: 0,\nstep:\n},\n// Actions.SetAlpha(gameObjects, value, step)\n\nsetOrigin: {\nx:0,\ny:0,\nstepX:0, stepY:0\n},\n\n// Input\nhitArea: null,\nhitAreaCallback: null,\n// Actions.SetHitArea(gameObjects, hitArea, hitAreaCallback)\n}\n
      • classType :
        • Sprite: Phaser.GameObjects.Sprite
        • Image: Phaser.GameObjects.Image
    "},{"location":"group/#destroy","title":"Destroy","text":"
    • Destroy group only
      group.destroy();\n
    • Destroy group and children
      group.destroy(true);\n
    "},{"location":"groupactions/","title":"Group actions","text":""},{"location":"groupactions/#introduction","title":"Introduction","text":"

    Set properties of game objects, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"groupactions/#usage","title":"Usage","text":""},{"location":"groupactions/#call-function","title":"Call function","text":"
    Phaser.Actions.Call(gameObjects, function(gameObject) {\n\n}, scope);\n
    "},{"location":"groupactions/#set-any-property","title":"Set any property","text":"
    Phaser.Actions.PropertyValueSet(gameObjects, key, value, step, index, direction);\n
    • gameObjects : An array of game objects.
    • key : The property to be updated.
    • value : The amount to be added to the property.
    • step : This is added to the value amount, multiplied by the iteration counter.
    • index : An optional offset to start searching from within the items array.
    • direction :
      • 1 : from beginning to end.
      • -1: from end to beginning.
    Phaser.Actions.PropertyValueInc(gameObjects, key, value, step, index, direction);\n
    Phaser.Actions.SmootherStep(gameObjects, key, min, max, inc));\n
    Phaser.Actions.SmoothStep(gameObjects, key, min, max, inc));\n
    Phaser.Actions.Spread(gameObjects, key, min, max, inc));\n
    "},{"location":"groupactions/#position","title":"Position","text":"
    Phaser.Actions.SetX(gameObjects, value, step, index, direction);\n
    Phaser.Actions.IncX(gameObjects, value, step, index, direction);\n
    Phaser.Actions.SetY(gameObjects, value, step, index, direction);\n
    Phaser.Actions.IncY(gameObjects, value, step, index, direction);\n
    Phaser.Actions.SetXY(gameObjects, x, y, stepX, stepY, index, direction);\n
    Phaser.Actions.IncXY(gameObjects, x, y, stepX, stepY, index, direction);\n
    "},{"location":"groupactions/#shift-position","title":"Shift position","text":"

    Set the position of first game object to (x, y), others to the position of previous game object.

    Phaser.Actions.ShiftPosition(gameObjects, x, y, direction, output);\n
    "},{"location":"groupactions/#position-on-shape","title":"Position on shape","text":""},{"location":"groupactions/#grid-align","title":"Grid align","text":"
    Phaser.Actions.GridAlign(gameObjects, {\nwidth: -1,\nheight: -1,\ncellWidth: 1,\ncellHeight: 1,\nposition: Phaser.Display.Align.TOP_LEFT,\nx: 0,\ny: 0\n});\n
    • width : The width of the grid in items (not pixels). -1 means lay all items out horizontally, regardless of quantity.
    • height : The height of the grid in items (not pixels). -1 means lay all items out vertically, regardless of quantity.
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • position : The alignment position.
      • 0, or Phaser.Display.Align.TOP_LEFT
      • 1, or Phaser.Display.Align.TOP_CENTER
      • 2, or Phaser.Display.Align.TOP_RIGHT
      • 3, or Phaser.Display.Align.LEFT_TOP
      • 4, or Phaser.Display.Align.LEFT_CENTER
      • 5, or Phaser.Display.Align.LEFT_BOTTOM
      • 6, or Phaser.Display.Align.CENTER
      • 7, or Phaser.Display.Align.RIGHT_TOP
      • 8, or Phaser.Display.Align.RIGHT_CENTER
      • 9, or Phaser.Display.Align.RIGHT_BOTTOM
      • 10, or Phaser.Display.Align.BOTTOM_LEFT
      • 11, or Phaser.Display.Align.BOTTOM_CENTER
      • 12, or Phaser.Display.Align.BOTTOM_RIGHT
    • x, y : Position of first item.
    "},{"location":"groupactions/#line","title":"Line","text":"

    Line :

    var line = new Phaser.Geom.Line(x1, y1, x2, y2);\n
    Phaser.Actions.PlaceOnLine(gameObjects, line);\n// Phaser.Actions.PlaceOnLine(gameObjects, line, ease);\n
    • ease :
      • A string
      • A function object.
    Phaser.Actions.RandomLine(gameObjects, line);\n
    "},{"location":"groupactions/#circle","title":"Circle","text":"

    Circle :

    var circle = new Phaser.Geom.Circle(x, y, radius);\nPhaser.Actions.PlaceOnCircle(gameObjects, circle, startAngle, endAngle);\n
    Phaser.Actions.RandomCircle(gameObjects, circle);\n
    "},{"location":"groupactions/#ellipse","title":"Ellipse","text":"

    Ellipse :

    var ellipse = new Phaser.Geom.Ellipse(x, y, width, height);\nPhaser.Actions.PlaceOnEllipse(gameObjects, ellipse, startAngle, endAngle);\n
    "},{"location":"groupactions/#triangle","title":"Triangle","text":"

    Triangle :

    var triangle = new Phaser.Geom.Triangle(x1, y1, x2, y2, x3, y3);\nPhaser.Actions.PlaceOnTriangle(gameObjects, triangle, stepRate);\n
    Phaser.Actions.RandomTriangle(gameObjects, triangle);\n
    "},{"location":"groupactions/#rectangle","title":"Rectangle","text":"

    Rectangle :

    var rect = new Phaser.Geom.Rectangle(x, y, width, height);\nPhaser.Actions.PlaceOnRectangle(gameObjects, rect, shift;\n
    Phaser.Actions.RandomRectangle(gameObjects, rect);\n
    Phaser.Actions.WrapInRectangle(gameObjects, rect, padding);\n
    "},{"location":"groupactions/#angle","title":"Angle","text":"
    Phaser.Actions.Angle(gameObjects, value, step, index, direction);\n// value: angle in radians\n
    Phaser.Actions.Rotate(gameObjects, value, step, index, direction);\n// value: angle in degree\n
    Phaser.Actions.RotateAround(gameObjects, point, angle);\n// point: {x, y}, angle: angle in radians\n
    Phaser.Actions.RotateAroundDistance(gameObjects, point, angle, distance);\n// point: {x, y}, angle: angle in radians\n
    "},{"location":"groupactions/#visible","title":"Visible","text":"
    Phaser.Actions.SetVisible(gameObjects, value, index, direction);\n
    Phaser.Actions.ToggleVisible(gameObjects);\n
    "},{"location":"groupactions/#alpha","title":"Alpha","text":"
    Phaser.Actions.SetAlpha(gameObjects, value, step, index, direction);\n
    "},{"location":"groupactions/#tint","title":"Tint","text":"
    Phaser.Actions.setTint(gameObjects, value);\n//Phaser.Actions.setTint(gameObjects, topLeft, topRight, bottomLeft, bottomRight);\n
    "},{"location":"groupactions/#origin","title":"Origin","text":"
    Phaser.Actions.SetOrigin(gameObjects, originX, originY, stepX, stepY, index, direction);\n
    "},{"location":"groupactions/#scale","title":"Scale","text":"
    Phaser.Actions.ScaleX(gameObjects, value, step, index, direction);\n
    Phaser.Actions.ScaleY(gameObjects, value, step, index, direction);\n
    Phaser.Actions.ScaleXY(gameObjects, x, y, stepX, stepY, index, direction);\n
    "},{"location":"groupactions/#scroll-factor","title":"Scroll factor","text":"
    Phaser.Actions.SetScrollFactorX(gameObjects, value, step, index, direction);\n
    Phaser.Actions.SetScrollFactorY(gameObjects, value, step, index, direction);\n
    Phaser.Actions.SetScrollFactor(gameObjects, x, y, stepX, stepY, index, direction);\n
    "},{"location":"groupactions/#depth","title":"Depth","text":"
    Phaser.Actions.SetDepth(gameObjects, value, step, index, direction);\n
    "},{"location":"groupactions/#hit-area","title":"Hit area","text":"
    Phaser.Actions.SetHitArea(gameObjects, hitArea, hitAreaCallback);\n
    "},{"location":"groupactions/#blend-mode","title":"Blend mode","text":"
    Phaser.Actions.SetBlendMode(gameObjects, blendMode, index, direction);\n
    • blendMode : Blend mode
    "},{"location":"groupactions/#play-animation","title":"Play animation","text":"
    Phaser.Actions.PlayAnimation(gameObjects, key, ignoreIfPlaying);\n
    "},{"location":"groupactions/#shuffle","title":"Shuffle","text":"
    Phaser.Actions.Shuffle(gameObjects);\n
    "},{"location":"groupnavigator/","title":"Group navigator","text":""},{"location":"groupnavigator/#introduction","title":"Introduction","text":"

    Navigate between existing game objects, focus on next/previous/next-row/previous row game object.

    • Author: Rex
    • Member of scene
    "},{"location":"groupnavigator/#live-demos","title":"Live demos","text":"
    • 1D targets
    • 2D targets
    "},{"location":"groupnavigator/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"groupnavigator/#install-plugin","title":"Install plugin","text":""},{"location":"groupnavigator/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgroupnavigatorplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgroupnavigatorplugin.min.js', true);\n
    • Create navigator
      var navigator = scene.plugins.get('rexgroupnavigatorplugin').add(config);\n
    "},{"location":"groupnavigator/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GroupNavigatorPlugin from 'phaser3-rex-plugins/plugins/groupnavigator-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGroupNavigator',\nplugin: GroupNavigatorPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create navigator
      var navigator = scene.plugins.get('rexGroupNavigator').add(config);\n
    "},{"location":"groupnavigator/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import GroupNavigator from 'phaser3-rex-plugins/plugins/groupnavigator.js';\n
    • Create navigator
      var navigator = new GroupNavigator(config);\n
    "},{"location":"groupnavigator/#create-navigator","title":"Create navigator","text":"
    var navigator = scene.plugins.get('rexGroupNavigator').add({\n// enable: true,\n\ntargets: gameObjects,\n// columns: undefined,\n\n// getFocusEnableCallback(gameObject) { \n//     return focusEnable;\n// }\n// focusEnableDataKey: undefined,\n// focusEnableKey: undefined\n});\n
    • enable :
      • true : Can navigate between game objects. Default behavior.
      • false : Ignore navigation actions (navigator.next(), navigator.previous(), navigator.nextRow(), navigator.previousRow())
    • targe1ts :
      • 1D array of game objects for navigator.next(), or navigator.previous()
      • 2D array of game objects for navigator.next(), navigator.previous(), navigator.nextRow(), navigator.previousRow()
    • columns : A number : Convert 1D targets array to 2D array, each row has columns game objects.
      • undefined : Ignore this parameter. Default behavior.
    • Focus enable : Get focus enable of game object by one of these parameter.
      • getFocusEnableCallback : A callback to return focus enable of this game object.
        function(gameObject) {\nreturn focusEnable;\n}\n
      • focusEnableDataKey : Get focus enable from private data of this game object.
      • focusEnableKey : Get focus enable from property of this game object.
      • Focus enable is always true if none of these parameter is given. Default behavior.
    "},{"location":"groupnavigator/#enable","title":"Enable","text":"
    • Get
      var enable = navigator.enable;\n
    • Set
      navigator.setEnable(enable);\n
    "},{"location":"groupnavigator/#navigate","title":"Navigate","text":"
    • Focus on next/previous game object, for 1D and 2D array of targets
      navigator.next();\n
      navigator.previous();\n
      Will fire blur and focus events
    • Focus on next row/previous row game object, for 2D array of targets
      navigator.nextRow();\n
      navigator.previousRow();\n
      Will fire blur and focus events
    • Focus on first/last game object
      navigator.first();\n
      navigator.last();\n
      Will fire blur and focus events
    "},{"location":"groupnavigator/#current-focused-game-object","title":"Current focused game object","text":"
    • Get current focused game object
      var gameObject = navigator.getFocusedTarget();\n// var gameObject = navigator.focusedTarget;\n
    • Focus on game object. Do nothing if that game object is not focus-enable.
      navigator.focus(gameObject);\n
      Will fire blur and focus events.
    • Blur
      navigator.blur();\n
      Will fire blur event.
    "},{"location":"groupnavigator/#target-game-objects","title":"Target game objects","text":"
    • Get
      var gameObjects = navigator.targets;\n
      • gameObjects : 1D/2D array of game objects
    • Set
      navigator.setTargets(targets);\n// navigator.setTargets(targets, columns);\n
    • Modify
      navigator.targets.push(newGameObject);    
      Phaser.Utils.Array.AddAt(navigator.targets, newGameObject, index);\n
      Phaser.Utils.Array.Remove(navigator.targets, gameObject);\n
    "},{"location":"groupnavigator/#events","title":"Events","text":"
    • On focus
      navigator.on('focus', function(gameObject){\n\n})\n
    • On blur
      navigator.on('blur', function(gameObject){\n\n})\n
    "},{"location":"handlebars/","title":"Handlebars","text":""},{"location":"handlebars/#introduction","title":"Introduction","text":"

    Format string with variables, largely compatible with Mustache templates. Reference

    "},{"location":"handlebars/#usage","title":"Usage","text":"
    var template = 'hello, {{name}}';\nvar view = {\nname: 'rex'\n};\nvar result = Mustache.render(template, view);\n
    "},{"location":"handlebars/#pre-compile","title":"Pre-compile","text":"
    const template = Handlebars.compile(\"{{foo}}\");\ntemplate({}, {\n// allowProtoPropertiesByDefault: false,\n// allowProtoMethodsByDefault: false\n});\n
    "},{"location":"hiddeninputtext/","title":"Hidden edit","text":""},{"location":"hiddeninputtext/#introduction","title":"Introduction","text":"

    An invisible Input DOM element to receive character input and display on text, bbocodetext, or tagtext.

    Inspirited from CanvasInput.

    • Author: Rex
    • Behavior of text object
    "},{"location":"hiddeninputtext/#live-demos","title":"Live demos","text":"
    • With Text
    • With BBCodeText
    • With rexui-Label
    • With bitmaptext
    • Number input
    "},{"location":"hiddeninputtext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"hiddeninputtext/#install-plugin","title":"Install plugin","text":""},{"location":"hiddeninputtext/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexhiddeninputtextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexhiddeninputtextplugin.min.js', true);\n
    • Add text-edit behavior
      var hiddenInputText = scene.plugins.get('rexhiddeninputtextplugin').add(textGameObject, config);\n
    "},{"location":"hiddeninputtext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import HiddenInputTextPlugin from 'phaser3-rex-plugins/plugins/hiddeninputtext-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexHiddenInputTextPlugin',\nplugin: HiddenInputTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-edit behavior
      var hiddenInputText = scene.plugins.get('rexHiddenInputTextPlugin').add(textGameObject, config);\n
    "},{"location":"hiddeninputtext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import HiddenInputText from 'phaser3-rex-plugins/plugins/hiddeninputtext.js';\n
    • Add text-edit behavior
      var hiddenInputText = new HiddenInputText(textGameObject, config);\n
    "},{"location":"hiddeninputtext/#add-input-text-object","title":"Add input text object","text":"
    var hiddenInputText = scene.plugins.get('rexHiddenInputTextPlugin').add(textGameObject, {\n// inputType: 'text',    // 'text'|'password'|'textarea'|...\n// type: 'text',    // 'text'|'password'|'textarea'|...\n\ncursor: '|',\ncursorFlashDuration: 1000,\n\n// enterClose: true,\n\n// onOpen: function (textObject, hiddenInputText) {   // Or onFocus:\n// },\n// onClose: function (textObject, hiddenInputText) {  // Or onBlur:\n// },\n// onUpdate: function (text, textObject, hiddenInputText) {\n//     return text;\n// },\n});\n
    • textGameObject :
    • inputType, or type : Type of element
      • 'text', 'password', 'textarea', ...
    • cursor : Cursor character used in default update text callback.
      • null, or '' : Don't insert cursor character.
    • cursorFlashDuration : Display cursor character or a space string to create a flash cursor.
    • enterClose :
      • true : Close input text when enter-key was pressed. Default value is true if inputType is not 'textarea'.
      • false : If inputType is set to 'textarea', default value will be false.
    • onOpen, or onFocuse : Callback invoked when focus on this hidden input text.
      function (textObject, hiddenInputText) {\n}\n
    • onClose, or onBlur : Callback invoked when blur.
      function (textObject, hiddenInputText) {\n}\n
    • onUpdate :
      • A callback invoked in each tick of editing.
        function (text, textObject, hiddenInputText) {\n// return text;\n}\n
        • Can return a new string for text game object displaying.
      • 'number' : Only output number string.

    Note

    This hiddenInputText will be destroyed when textGameObject is destroyed.

    "},{"location":"hiddeninputtext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyHiddenText extends HiddenInputText {\nconstructor(textGameObject, config) {\nsuper(textGameObject, config) {\n// ...            \n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var hiddenInputText = new MyHiddenText(textGameObject, config);\n
    "},{"location":"hiddeninputtext/#cursor","title":"Cursor","text":"
    • Set
      hiddenInputText.setCursor(s);\n
    • Get
      var cursor = hiddenInputText.cursor;\n
    "},{"location":"hiddeninputtext/#open-editor","title":"Open editor","text":"
    hiddenInputText.open();\n
    "},{"location":"hiddeninputtext/#close-editor","title":"Close editor","text":"
    hiddenInputText.close();\n
    "},{"location":"hiddeninputtext/#is-opened","title":"Is opened","text":"
    var isOpened = hiddenInputText.isOpened;\n
    "},{"location":"hiddeninputtext/#select-text","title":"Select text","text":"

    This feature does not support.

    "},{"location":"hiddeninputtext/#bypass-key-input","title":"Bypass key input","text":"

    Registered keyboard events might capture key input.

    var keyObj = scene.input.keyboard.addKey('W', enableCapture, emitOnRepeat);\n

    Set enableCapture to false to bypass key input to this input-text game objecct.

    "},{"location":"hiddeninputtext/#event","title":"Event","text":"
    • On text change
      hiddenInputText.on('textchange', function(text, textGameObject){\n})\n
    • Not a number input
      hiddenInputText.on('nan', function(text){\n\n})\n
    • Close editor by ENTER key down
      hiddenInputText.on('keydown-ENTER', function(){\n})\n
    "},{"location":"i18next/","title":"i18next","text":""},{"location":"i18next/#introduction","title":"Introduction","text":"

    i18next is a very popular internationalization framework for browser or any other javascript environment.

    • Author: i18next
    • Application plugin : Text translation
    "},{"location":"i18next/#usage","title":"Usage","text":""},{"location":"i18next/#import-class","title":"Import class","text":"
    • Install i18next, i18next-http-backend from npm
      npm i i18next\nnpm i i18next-http-backend\n
    • Import i18next
      import i18next from 'i18next';\nimport Backend from 'i18next-http-backend';\n
    • Initialize
      i18next.use(Backend).init(config);\n
    • Translation
      var result = i18next.t(key);\n
    "},{"location":"i18next/#initialize","title":"Initialize","text":"
    i18next\n.use(Backend)\n.init({\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n})\n
    • lng : Language to use. Will fallback to 'dev'.
    • ns : String or array of namespaces to load. Default value is 'translation'.
    • debug : Logs info level to console output. Helps finding issues with loading not working. Default value is false.
    • resources : Resources to initialize with.
    • backend.loadPath : Path where resources get loaded from, or a function returning a path.
      function(lngs, namespaces) { return customPath; }\n
    • backend.parse : Parse data after it has been fetched. Optional.
      function(data) { return JSON.parse(data); }\n

    See also Configuration Options, and Backend Options

    "},{"location":"i18next/#change-language","title":"Change language","text":"
    i18next.changeLanguage(\"en\");\n

    Fire event 'languageChanged'.

    "},{"location":"i18next/#set-default-namespace","title":"Set default namespace","text":"
    i18next.setDefaultNamespace(namespace);\n
    "},{"location":"i18next/#translate","title":"Translate","text":"
    var result = i18next.t(key);\n// var result = i18next.t(key, interpolation);\n
    "},{"location":"i18next/#events","title":"Events","text":"
    • On language changed, triggered by i18next.changeLanguage(lng).
      i18next.on('languageChanged', function (lng) {\n});\n
    "},{"location":"image/","title":"Image","text":""},{"location":"image/#introduction","title":"Introduction","text":"

    Display of static images, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"image/#usage","title":"Usage","text":""},{"location":"image/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"image/#add-image-object","title":"Add image object","text":"
    var image = scene.add.image(x, y, key);\n// var image = scene.add.image(x, y, key, frame);\n

    Add image from JSON

    var image = scene.make.image({\nx: 0,\ny: 0,\nkey: '',\n// frame: '',\n\n// angle: 0,\n// alpha: 1,\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    • key, frame :
      • A string
      • An array of string to pick one element at random
    • x, y, scale.x, scale.y :
      • A number
      • A callback to get return value
        function() { return 0; }\n
      • Random integer between min and max
        { randInt: [min, max] }\n
      • Random float between min and max
        { randFloat: [min, max] }\n
    "},{"location":"image/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImage extends Phaser.GameObjects.Image {\nconstructor(scene, x, y, texture, frame) {\nsuper(scene, x, y, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImage(scene, x, y, key);\n
    "},{"location":"image/#texture","title":"Texture","text":"

    See game object - texture

    "},{"location":"image/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"image/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"imagebox/","title":"Image box","text":""},{"location":"imagebox/#introduction","title":"Introduction","text":"

    Keep aspect ratio of image game object when scale-down resizing. A containerLite game object with 1 image game object.

    • Author: Rex
    • Game object
    "},{"location":"imagebox/#live-demos","title":"Live demos","text":"
    • Resize
    "},{"location":"imagebox/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"imagebox/#install-plugin","title":"Install plugin","text":""},{"location":"imagebox/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('reximageboxplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/reximageboxplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexImageBox(x, y, texture, frame, config);\n
    "},{"location":"imagebox/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ImageBoxPlugin from 'phaser3-rex-plugins/plugins/imagebox-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexImageBoxPlugin',\nplugin: ImageBoxPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexImageBox(x, y, texture, frame, config);\n
    "},{"location":"imagebox/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ImageBox from 'phaser3-rex-plugins/plugins/imagebox.js';\n
    • Add image object
      var image = new ImageBox(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"imagebox/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexImageBox(x, y, texture, frame, {\n// scaleUp: false,\n// width: undefined,\n// height: undefined,\n\n// background: undefined,\n// image: undefined\n});\n
    • scaleUp : Scale up or keep original size of image when size of imageBox is larger.
      • true : Scale up image when size of imageBox is larger.
      • false : Keep original size of image size of imageBox is larger. Default behavior.
    • width, height : Resize this game object.
      • undefined : Use original size. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of imageBox.
    • image : Custom image game object instance.
      • undefined : Use built-in image game object. Default behavior.

    Add imagebox from JSON

    var image = scene.make.rexImageBox({\nx: 0,\ny: 0,\nkey: null,\nframe: null,\n\n// width: undefined,\n// height: undefined,\n\n// background: undefined,\n// image: undefined\n\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"imagebox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImageBox extends ImageBox {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImageBox(scene, x, y, texture, frame, config);\n
    "},{"location":"imagebox/#resize","title":"Resize","text":"
    image.resize(width, height);\n

    Note

    • If new size is bigger than original size, uses original size. (i.e won't scale up)
    • If new size is smaller than original size, scales down and keeps aspect ratio.
    "},{"location":"imagebox/#set-texture","title":"Set texture","text":"
    image.setTexture(key, frame);\n
    "},{"location":"imagebox/#current-texture","title":"Current texture","text":"
    var textureKey = image.texture.key;\nvar frameName = image.frame.name;\n
    "},{"location":"imagebox/#clear-texture","title":"Clear texture","text":"
    image.setTexture();\n

    Will set internal image game object to invisible.

    "},{"location":"imagebox/#scale-image","title":"Scale image","text":"
    image.scaleImage();\n

    image.resize(width, height), or image.setTexture(key, frame) will invoke this method internally.

    "},{"location":"imagebox/#internal-image-game-object","title":"Internal image game object","text":"
    var internalImageGO = image.image;\n
    "},{"location":"imagebox/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"imagebox/#create-mask","title":"Create mask","text":"

    Create mask from internal image game object (image.image).

    var mask = image.image.createBitmapMask();\n

    See mask

    "},{"location":"imagebox/#shader-effects","title":"Shader effects","text":"

    Internal image game object (image.image) support preFX and postFX effects

    "},{"location":"imageuriloader/","title":"Imageuriloader","text":"

    Note

    Phaser3.80 can load image by uri (base64 string) in preload stage.

    "},{"location":"imageuriloader/#introduction","title":"Introduction","text":"

    Load image by uri (base64 string) in preload stage.

    Built-in image loader dosen't support loading local image uri.

    • Author: Rex
    • Custom File of loader
    "},{"location":"imageuriloader/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"imageuriloader/#install-plugin","title":"Install plugin","text":""},{"location":"imageuriloader/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      var sceneConfig = {\n// ....\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'reximageuriloaderplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/reximageuriloaderplugin.min.js',\nstart: true\n}]\n}\n};\nclass MyScene extends Phaser.Scene {\nconstructor() {\nsuper(sceneConfig)\n}\n// ....\n\npreload() {\n// reximageuriloaderplugin will be installed before preload(), but not added to loader yet\n// Call addToScene(scene) to add this await loader to loader of this scene\nthis.plugins.get('reximageuriloaderplugin').addToScene(this);\n\nthis.load.rexImageURI(key, uri);\n}\n}\n
    "},{"location":"imageuriloader/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ImageURILoaderPlugin from 'phaser3-rex-plugins/plugins/imageuriloader-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexImageURILoader',\nplugin: ImageURILoaderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In preload stage
      scene.load.rexImageURI(key, uri);\n
    "},{"location":"imageuriloader/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ImageURILoader from 'phaser3-rex-plugins/plugins/imageuriloader.js';\n
    • Start loading task
      ImageURILoader.call(scene.load, key, uri);\n
    "},{"location":"imageuriloader/#load-image","title":"Load image","text":"

    In preload stage:

    this.load.rexImageURI(key, uri);\n
    • key : Texture key.
    • uri : URI, a base64 string.
    "},{"location":"imageuriloader/#load-sprite-sheet","title":"Load sprite sheet","text":"

    In preload stage:

    this.load.rexImageURI(key, uri, frameConfig);\n
    • key : Texture key.
    • uri : URI, a base64 string.
    • frameConfig :
      • frameWidth : The width of the frame in pixels.
      • frameHeight : The height of the frame in pixels. Uses the frameWidth value if not provided.
      • startFrame : The first frame to start parsing from.
      • endFrame : The frame to stop parsing at. If not provided it will calculate the value based on the image and frame dimensions.
      • margin : The margin in the image. This is the space around the edge of the frames.
      • spacing : The spacing between each frame in the image.
    "},{"location":"input-to-camera/","title":"Control by input","text":""},{"location":"input-to-camera/#introduction","title":"Introduction","text":"

    Control camera's scroll by pan/cursor-at-bounds(scroll), and zoom by pinch/mouse-wheel.

    • Author: Rex
    • Member of scene
    "},{"location":"input-to-camera/#live-demos","title":"Live demos","text":"
    • Camera controller
    "},{"location":"input-to-camera/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"input-to-camera/#install-plugin","title":"Install plugin","text":""},{"location":"input-to-camera/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcameracontrollerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcameracontrollerplugin.min.js', true);\n
    • Add camera-controller object
      var cameraController = scene.plugins.get('rexcameracontrollerplugin').add(scene, config);\n
    "},{"location":"input-to-camera/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CameraControllerPlugin from 'phaser3-rex-plugins/plugins/cameracontroller-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCameraController',\nplugin: CameraControllerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add camera-controller object
      var cameraController = scene.plugins.get('rexCameraController').add(scene, config);\n
    "},{"location":"input-to-camera/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CameraController from 'phaser3-rex-plugins/plugins/cameracontroller.js';\n
    • Add camera-controller object
      var cameraController = new CameraController(scene, config);\n
    "},{"location":"input-to-camera/#create-instance","title":"Create instance","text":"
    var cameraController = scene.plugins.get('rexCameraController').add(scene, {\n// camera: scene.cameras.main,\n// minZoom: undefined,\n// maxZoom: undefined,\n\n// panScroll: true,\n// panScrollEnable: true,\n\n// pinchZoom: true,\n// pinchZoomEnable: true,\n// pinchZoomMin: undefined,\n// pinchZoomMax: undefined,\n\n// inputTarget: undefined,\n\n// boundsScroll: true,\n// boundsScrollEnable: true,\n\n// mouseWheelZoom: truem\n// mouseWheelZoomEnable: true,\n// mouseWheelZoomStep: 0.01,\n// mouseWheelZoomMin: undefined,\n// mouseWheelZoomMax: undefined,\n\n// enable: true\n});\n
    • scene : Target scene.
    • camera :
      • undefined : Default camera of this scene.
      • A camera object : Control this camera object.
    • minZoom, maxZoom : Minumun/maximum camera zoom value for pinchZoom and mouseWheelZoom behaviors.
      • undefined : No max/min constraint. Default behavior.
    • Pan scroll:
      • panScroll : Set to false will discard pan-scroll controller. Default is true.
      • panScrollEnable : Set to true to enable pan-scroll behavior. Default value is true.
      • inputTarget :
        • undefined : Receive pan/pinch input by scene's input event. Default behavior.
        • A game object : Receive pan/pinch input only on this game object.
    • Pinch zoom:
      • pinchZoom : Set to false will discard pinch-zoom controller. Default is true.
      • pinchZoomEnable : Set to true to enable pinch-zoom behavior. Default value is true.
      • pinchZoomMin, pinchZoomMax : Minumun/maximum camera zoom value. Default value is minZoom, maxZoom.
      • inputTarget :
        • undefined : Receive pan/pinch input by scene's input event. Default behavior.
        • A game object : Receive pan/pinch input only on this game object.
    • cursor-at-bounds scroll :
      • boundsScroll : Set to false will discard cursor-at-bounds-scroller controller. Default is true.
      • boundsScrollEnable : Set to true to enable bounds-scroll behavior. Default value is true.
    • mouse-wheel zoom :
      • mouseWheelZoom : Set to false will discard mouse-wheel-zoom controller. Default is true.
      • mouseWheelZoomEnable : Set to true to enable mouse-wheel-zoom behavior. Default value is true.
      • mouseWheelZoomStep : Camera zoom incremental. Default value is 0.1.
      • mouseWheelZoomMin, mouseWheelZoomMax : Minumun/maximum camera zoom value. Default value is minZoom, maxZoom.
    • enable :
      • false : Disable all camera-controller temporary.
      • true : Restore all camera-controller's enable state to previous value. Default behavior.
    "},{"location":"input-to-camera/#set-target-camera","title":"Set target camera","text":"
    cameraController.setCamera(camera);\n
    "},{"location":"input-to-camera/#enable-controller-behavior","title":"Enable controller behavior","text":"
    • Pan-scroll
      cameraController.setPanScrollEnable(enable);\n// cameraController.panScrollEnable = enable;\n
    • Pinch-zoom
      cameraController.setPinchZoomEnable(enable);\n// cameraController.pinchZoomEnable = enable;\n
    • Bounds-scroll
      cameraController.setBoundsScrollEnable(enable);\n// cameraController.boundsScrollEnable = enable;\n
    • Wheel-zoom
      cameraController.setMouseWheelZoomEnable(enable);\n// cameraController.mouseWheelZoomEnable = enable;\n
    • Disable all behaviors
      cameraController.setEnable(false);\n// cameraController.enable = false;\n
    • Restore enable state of all behaviors
      cameraController.setEnable();\n// cameraController.enable = true;\n
    • Toggle enable state
      cameraController.toggleEnable();\n// cameraController.enable = !cameraController.enable;\n
    "},{"location":"input/","title":"Input","text":""},{"location":"input/#introduction","title":"Introduction","text":"

    Input system of each scene, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"input/#usage","title":"Usage","text":""},{"location":"input/#enabledisable","title":"Enable/disable","text":"
    scene.input.enabled = enabled; // enabled: true/false\n
    "},{"location":"inputtext/","title":"Input text","text":""},{"location":"inputtext/#introduction","title":"Introduction","text":"

    Input DOM element.

    • Author: Rex
    • DOM Game object
    "},{"location":"inputtext/#live-demos","title":"Live demos","text":"
    • Input text
    • Number input
    • In fullscreen
    "},{"location":"inputtext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"inputtext/#install-plugin","title":"Install plugin","text":""},{"location":"inputtext/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexinputtextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexinputtextplugin.min.js', true);\n
    • Add input-text object
      var inputText = scene.add.rexInputText(x, y, width, height, config);\n
    "},{"location":"inputtext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import InputTextPlugin from 'phaser3-rex-plugins/plugins/inputtext-plugin.js';\nvar config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexInputTextPlugin',\nplugin: InputTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add input-text object
      var inputText = scene.add.rexInputText(x, y, width, height, config);\n
    "},{"location":"inputtext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import InputText from 'phaser3-rex-plugins/plugins/inputtext.js';\n
    • Add input-text object
      var inputText = new InputText(scene, x, y, width, height, config);\nscene.add.existing(inputText);\n
    "},{"location":"inputtext/#add-input-text-object","title":"Add input text object","text":"
    var inputText = scene.add.rexInputText(x, y, width, height, config);\n// var inputText = scene.add.rexInputText(x, y, config);\n// var inputText = scene.add.rexInputText(config);\n

    Default configuration

    {\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\ntype: 'text',    // 'text'|'password'|'textarea'|'number'|'color'|...\n\n// Element properties\nid: undefined,\ntext: undefined,\nmaxLength: undefined,\nminLength: undefined,    placeholder: undefined,\ntooltip: undefined,\nreadOnly: false,\nspellCheck: false,\nautoComplete: 'off',\n\n// Style properties\nalign: undefined,\npaddingLeft: undefined,\npaddingRight: undefined,\npaddingTop: undefined,\npaddingBottom: undefined,\nfontFamily: undefined,\nfontSize: undefined,\ncolor: '#ffffff',\nborder: 0,\nbackgroundColor: 'transparent',\nborderColor: 'transparent',\nborderRadius: undefined,\noutline: 'none',\ndirection: 'ltr',\n\nselectAll: false\n}\n
    • x, y : Position
    • width, height : Size of element
    • type : Type of element
      • 'text', 'password', 'textarea', 'number', 'color', ...
    • Element properties
      • id : id element property.
      • text : value element property.
      • maxLength : maxLength element property.
      • minLength : minLength element property.
      • placeholder : placeholder element property.
      • tooltip : title element property.
      • readOnly : readonly element property.
      • spellCheck : spellcheck element property.
      • autoComplete : autocomplete element property.
    • Element style properties
      • align : text-align style property.
      • paddingLeft, paddingRight, paddingTop, paddingBottom : padding-left, padding-right, padding-top, padding-bottom style property.
      • fontFamily : font-family style property.
      • fontSize : font-size style property.
      • color : color style property.
      • backgroundColor : backgroundColor style property.
      • border, borderColor, borderRadius : border, borderColor, border-radius style property.
      • outline : outline style property.
      • direction : direction style property.
    • selectAll : Set true to select all text.
    "},{"location":"inputtext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends InputText {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var inputText = new MyText(scene, x, y, width, height, config);\n
    "},{"location":"inputtext/#text","title":"Text","text":"
    • Get
      var text = inputText.text;\n
    • Set
      inputText.setText(text);\n// inputText.text = text;\n
    • Scroll to bottom
      inputText.scrollToBottom();\n
    "},{"location":"inputtext/#style","title":"Style","text":"
    • Get
      var value = inputText.getStyle(key);\n
    • Set
      inputText.setStyle(key, value)\n
    "},{"location":"inputtext/#focus","title":"Focus","text":"
    • Focus
      inputText.setFocus();\n
    • Blur
      inputText.setBlur();\n
    • Is focused
      var isFocused = inputText.isFocused;\n
    "},{"location":"inputtext/#font-color","title":"Font color","text":"
    • Get
      var color = inputText.fontColor;\n// var color = inputText.node.style.color;\n
    • Set
      inputText.fontColor = color;  // CSS color string\n// inputText.node.style.color = color;\n
      or
      inputText.setFontColor(color);  // CSS color string\n
    "},{"location":"inputtext/#max-length","title":"Max length","text":"
    • Get
      var value = inputText.maxLength;\n
    • Set
      inputText.maxLength = value;\n
      or
      inputText.setMaxLength(value);\n
    "},{"location":"inputtext/#min-length","title":"Min length","text":"
    • Get
      var value = inputText.minLength;\n
    • Set
      inputText.minLength = value;\n
      or
      inputText.setMinLength(value);\n
    "},{"location":"inputtext/#placeholder","title":"Placeholder","text":"
    • Get
      var value = inputText.placeholder;\n
    • Set
      inputText.placeholder = value;\n
      or
      inputText.setPlaceholder(value);\n
    "},{"location":"inputtext/#tooltip","title":"Tooltip","text":"
    • Get
      var value = inputText.tooltip;\n
    • Set
      inputText.tooltip = value;\n
      or
      inputText.setTooltip(value);\n
    "},{"location":"inputtext/#readonly","title":"Readonly","text":"
    • Get
      var readOnly = inputText.readOnly;\n
    • Set
      inputText.readOnly = value;\n
      inputText.setReadOnly();\n// inputText.setReadOnly(value);\n
    "},{"location":"inputtext/#resize","title":"Resize","text":"
    inputText.resize(width, height);\n
    "},{"location":"inputtext/#select-text","title":"Select text","text":"
    • Select all text
      inputText.selectText();\n// inputText.selectAll();\n
    • Select sub-string
      inputText.selectText(selectionStart, selectionEnd);\n
    "},{"location":"inputtext/#cursor-position","title":"Cursor position","text":"
    • Get
      var cursorPosition = inputText.cursorPosition;\n
      • Equal to inputText.selectionStart.
    • Set
      inputText.setCursorPosition(cursorPosition);\ninputText.cursorPosition = cursorPosition;\n
      • Equal to inputText.setSelectionRange(cursorPosition, cursorPosition)
    "},{"location":"inputtext/#events","title":"Events","text":"
    • On text changed
      inputText.on('textchange', function(inputText, e){ }, scope);\n
    • On focus
      inputText.on('focus', function(inputText, e){ }, scope);\n
    • On blur
      inputText.on('blur', function(inputText, e){ }, scope);\n
    • On click, double click
      inputText.on('click', function(inputText, e){ }, scope);\n
      inputText.on('dblclick', function(inputText, e){ }, scope);\n
      • Touch/mouse events on input text object won't be propagated to game canvas.
    • On keydown, keyup
      inputText.on('keydown', function(inputText, e){ }, scope);\n
      inputText.on('keyup', function(inputText, e){ }, scope);\n
      • Keyboard events on input text object won't be propagated to game canvas.
    • On pointerdown, pointermove, pointerup
      inputText.on('pointerdown', function(inputText, e){ }, scope);\n
      inputText.on('pointermove', function(inputText, e){ }, scope);\n
      inputText.on('pointerup', function(inputText, e){ }, scope);\n
      • Mouse/touch events on input text object won't be propagated to game canvas.
    • On select
      inputText.on('select', function(inputText, e){ var selectedString = inputText.selectedText;\nvar selectionStart = inputText.selectionStart;\nvar selectionEnd = inputText.selectionEnd;\n}, scope);\n
    • On composition inpit
      inputText.on('compositionStart', function(inputText, e){ }, scope);\n
      inputText.on('compositionEnd', function(inputText, e){ }, scope);\n
      inputText.on('compositionUpdate', function(inputText, e){ }, scope);\n
    "},{"location":"inputtext/#bypass-key-input","title":"Bypass key input","text":"

    Registered keyboard events might capture key input.

    var keyObj = scene.input.keyboard.addKey('W', enableCapture, emitOnRepeat);\n

    Set enableCapture to false to bypass key input to this input-text game objecct.

    "},{"location":"inputtext/#other-properties","title":"Other properties","text":"

    See dom game object, game object

    "},{"location":"inputtext/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"inputtext/#close-editing","title":"Close editing","text":"
    • Close editing (set blur) when pointerdown outside
      scene.input.on('pointerdown', function () {\ninputText.setBlur();\n})\n
    • Close editing (set blur) when ENTER key press
      inputText.on('keydown', function (inputText, e) {\nif ((inputText.inputType !== 'textarea') && (e.key === 'Enter')) {\ninputText.setBlur();\n}\n})\n
      • inputType : 'text', 'textarea', ...
    "},{"location":"interception/","title":"Interception","text":""},{"location":"interception/#introduction","title":"Introduction","text":"

    Predict the intersection position of two game objects with constant moving speed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"interception/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"interception/#install-plugin","title":"Install plugin","text":""},{"location":"interception/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexinterceptionplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexinterceptionplugin.min.js', true);\n
    • Add interception behavior
      var interception = scene.plugins.get('rexinterceptionplugin').add(gameObject, config);\n
    "},{"location":"interception/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import InterceptionPlugin from 'phaser3-rex-plugins/plugins/interception-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexInterception',\nplugin: InterceptionPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add interception behavior
      var interception = scene.plugins.get('rexInterception').add(gameObject, config);\n
    "},{"location":"interception/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Interception from 'phaser3-rex-plugins/plugins/interception.js';\n
    • Add interception behavior
      var interception = new Interception(gameObject, config);\n
    "},{"location":"interception/#create-instance","title":"Create instance","text":"
    var interception = scene.plugins.get('rexInterception').add(gameObject, {\n// target: undefined,\n// enable: true\n});\n
    • target : Game object.
    • enable : Set true to enable predicting.
    "},{"location":"interception/#target","title":"Target","text":"
    • Set
      interception.setTarget(gameObject);\n
      or
      interception.target = gameObject;\n
    • Disalbe
      interception.setTarget(undefined);\n
      or
      interception.target = undefined;\n
    • Get
      var target = interception.target;\n
    "},{"location":"interception/#enable-predicting","title":"Enable predicting","text":"
    • Enable
      interception.setEnable();\n
    • Disable, uses target position as predicted position
      interception.setEnable(false);\n
    "},{"location":"interception/#predicted-result","title":"Predicted result","text":"
    • Predicted position
      var position = interception.predictedPosition; // {x, y}\n
    • Angle to predicted position
      var rotation = interception.predictedAngle; // Angle in radian\n
    "},{"location":"interpolation/","title":"Interpolation","text":""},{"location":"interpolation/#introduction","title":"Introduction","text":"

    Calculates interpolation value over t (0~1), built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"interpolation/#usage","title":"Usage","text":"
    • Linear interpolation (lerp) two values
      var result = Phaser.Math.Linear(p0, p1, t);\n
    • Linear interpolation (lerp) two Vectors
      var result = Phaser.Math.LinearXY(vector0, vector1, t);\n
      • vector0, vector1 : Phaser.Math.Vector2
    • Smooth interpolation
      var result = Phaser.Math.Interpolation.SmoothStep(t, min, max);\n
      • t : 0~1
    • Smoother interpolation
      var result = Phaser.Math.Interpolation.SmootherStep(t, min, max);\n
      • t : 0~1
    • Quadratic bezier interpolation
      var result = Phaser.Math.Interpolation.QuadraticBezier(t, p0, p1, p2);\n
      • t : 0~1
      • p0 : The start point.
      • p1 : The control point.
      • p2 : The end point.
    • Cubic bezier interpolation
      var result = Phaser.Math.Interpolation.CubicBezier(t, p0, p1, p2, p3);\n
      • t : 0~1
      • p0 : The start point.
      • p1 : The first control point.
      • p2 : The second control point.
      • p3 : The end point.
    "},{"location":"intouching/","title":"In touching","text":""},{"location":"intouching/#introduction","title":"Introduction","text":"

    Fires 'intouch' event every tick when pressing on a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"intouching/#live-demos","title":"Live demos","text":"
    • Cooldown
    • Is in touching
    "},{"location":"intouching/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"intouching/#install-plugin","title":"Install plugin","text":""},{"location":"intouching/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexintouchingplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexintouchingplugin.min.js', true);\n
    • Add intouching behavior
      var intouching = scene.plugins.get('rexintouchingplugin').add(gameObject, config);\n
    "},{"location":"intouching/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import InTouchingPlugin from 'phaser3-rex-plugins/plugins/intouching-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexInTouchingn',\nplugin: InTouchingPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add intouching behavior
      var intouching = scene.plugins.get('rexInTouchingn').add(gameObject, config);\n
    "},{"location":"intouching/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import InTouching from 'phaser3-rex-plugins/plugins/intouching.js';\n
    • Add intouching behavior
      var intouching = new InTouching(gameObject, config);\n
    "},{"location":"intouching/#create-instance","title":"Create instance","text":"
    var intouching = scene.plugins.get('rexInTouching').add(gameObject, {\n// enable: true,\n// cooldown: undefined\n});\n
    • enable : Can touch.
    • cooldown : Fire 'intouch' event every tick, or periodically.
      • undefined : Fire 'intouch' event every tick.
    "},{"location":"intouching/#events","title":"Events","text":"
    • In-touching
      intouching.on('intouch', function (intouching, gameObject, pointer) {\n// ...\n}, scope);\n
    • Touching-start
      intouching.on('touchstart', function (intouching, gameObject) {\n// ...\n}, scope);\n
    • Touching-end
      intouching.on('touchend', function (intouching, gameObject) {\n// ...\n}, scope);\n
    "},{"location":"intouching/#in-touching","title":"In touching","text":"
    var isInTouching = intouching.isInTouching;\n
    "},{"location":"intouching/#enable","title":"Enable","text":"
    • Get
      var enabled = intouching.enable;  // enabled: true, or false\n
    • Set
      intouching.setEnable(enabled);  // enabled: true, or false\n// intouching.enable = enabled;\n
    • Toggle
      intouching.toggleEnable();\n
    "},{"location":"intouching/#cooldown","title":"Cooldown","text":"
    • Get
      var cooldownTime = intouching.cooldownTime;\n
    • Set
      intouching.setCooldown(time);\n
      or
      intouching.cooldownTime = cooldownTime;\n
    "},{"location":"keyboardcombo/","title":"Combo events","text":""},{"location":"keyboardcombo/#introduction","title":"Introduction","text":"

    Combo-keys events.

    • Author: Richard Davey
    "},{"location":"keyboardcombo/#usage","title":"Usage","text":"
    1. Create combo
      var keyCombo = scene.input.keyboard.createCombo(keys, {\n// resetOnWrongKey: true,\n// maxKeyDelay: 0,\n// resetOnMatch: false,\n// deleteOnMatch: false,\n});\n
      • keys : Array of keyCodes
        • In strings. ex: ['up', 'up', 'down', 'down'], or ['UP', 'UP', 'DOWN', 'DOWN']
        • In key map. ex: [Phaser.Input.Keyboard.KeyCodes.UP, ... ]
        • In numbers. ex: [38, 38, 40, 40]
      • resetOnWrongKey : Set true to reset the combo when press the wrong key.
      • maxKeyDelay : The max delay in ms between each key press. Set 0 to disable this feature.
      • resetOnMatch : Set true to reset the combo when previously matched.
      • deleteOnMatch : Set true to delete this combo when matched.
    2. Listen combo matching event
      scene.input.keyboard.on('keycombomatch', function (keyCombo, keyboardEvent) { /* ... */ });\n
    "},{"location":"keyboardevents/","title":"Keyboard events","text":""},{"location":"keyboardevents/#introduction","title":"Introduction","text":"

    Built-in keyboard events of phaser.

    • Author: Richard Davey
    "},{"location":"keyboardevents/#usage","title":"Usage","text":""},{"location":"keyboardevents/#quick-start","title":"Quick start","text":"
    • Is key-down/is key-up
      var keyObject = scene.input.keyboard.addKey('W');  // Get key object\nvar isDown = keyObject.isDown;\nvar isUp = keyObject.isUp;\nvar shiftKey = keyObject.shiftKey;\n
    • Key is down after a duration
      var keyObject = scene.input.keyboard.addKey('W');  // Get key object\nvar isDown = scene.input.keyboard.checkDown(keyObject, duration);\n
    • On key-down/on key-up
      var keyObject = scene.input.keyboard.addKey('W');  // Get key object\nkeyObject.on('down', function(event) { /* ... */ });\nkeyObject.on('up', function(event) { /* ... */ });\n
      or
      scene.input.keyboard.on('keydown-' + 'W', function (event) { /* ... */ });\nscene.input.keyboard.on('keyup-' + 'W', function (event) { /* ... */ });\n
    • Any key-down/any key-up
      scene.input.keyboard.on('keydown', function (event) { /* ... */ });\nscene.input.keyboard.on('keyup', function (event) { /* ... */ });\n
      • event : KeyboardEvent
        • event.code : 'Key' + 'W'
    "},{"location":"keyboardevents/#key-object","title":"Key object","text":"
    • Get key object
      var keyObject = scene.input.keyboard.addKey('W');  // see `Key map` section\n// var keyObject = scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W);\n
      or
      var keyObject = scene.input.keyboard.addKey('W', enableCapture, emitOnRepeat);\n
      • enableCapture : Automatically call preventDefault on the native DOM browser event for the key codes being added.
      • emitOnRepeat : Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default).
    • Get key objects
      var keyObjects = scene.input.keyboard.addKeys('W,S,A,D');  // keyObjects.W, keyObjects.S, keyObjects.A, keyObjects.D\n// var keyObjects = scene.input.keyboard.addKeys('W,S,A,D', enableCapture, emitOnRepeat);\n
      or
      var keyObjects = scene.input.keyboard.addKeys({\nup: 'W',\ndown: 'S',\nleft: 'A',\nright: 'D'\n});  // keyObjects.up, keyObjects.down, keyObjects.left, keyObjects.right\n
    • Remove key object
      scene.input.keyboard.removeKey('W');\n// scene.input.keyboard.removeKey(Phaser.Input.Keyboard.KeyCodes.W);\n// scene.input.keyboard.removeKey(key, destroy, removeCapture);\n
      • destroy : Call Key.destroy on each removed Key object
      • removeCapture : Remove all key captures for Key objects owened by this plugin?
    • Remove all key objects
      scene.input.keyboard.removeAllKeys(true);\n// scene.input.keyboard.removeAllKeys(destroy, removeCapture);\n
      • destroy : Call Key.destroy on each removed Key object
      • removeCapture : Remove all key captures for Key objects owened by this plugin?
    • Key-down/key-up state
      var isDown = keyObject.isDown;\nvar isUp = keyObject.isUp;\n
    • Duration of key-down
      var duration = keyObject.getDuration(); // ms\n
    • Enable/disable
      keyObject.enabled = enabled; // Set false to disable key event\n
    "},{"location":"keyboardevents/#key-object-of-cursorkeys","title":"Key object of cursorkeys","text":"
    1. Get key state object
      var cursorKeys = scene.input.keyboard.createCursorKeys();\n
    2. Get key state
      var isUpDown = cursorKeys.up.isDown;\nvar isDownDown = cursorKeys.down.isDown;\nvar isLeftDown = cursorKeys.left.isDown;\nvar isRightDown = cursorKeys.right.isDown;\nvar isSpaceDown = cursorKeys.space.isDown;\nvar isShiftDown = cursorKeys.shift.isDown;\n
    "},{"location":"keyboardevents/#order-of-key-downkey-up-events","title":"Order of key-down/key-up events","text":"
    1. Key-down/key-up events of key object
      var keyObject = scene.input.keyboard.addKey('W');  // Get key object\nkeyObject.on('down', function(event) { /* ... */ });\nkeyObject.on('up', function(event) { /* ... */ });\n
      • event.stopImmediatePropagation() : Stop any further listeners from being invoked in the current Scene.
      • event.stopPropagation() : Stop it reaching any other Scene.
    2. On key-down/on key-up
      scene.input.keyboard.on('keydown-' + 'W', function (event) { /* ... */ });\nscene.input.keyboard.on('keyup-' + 'W', function (event) { /* ... */ });\n
      • event.stopImmediatePropagation() : Stop any further listeners from being invoked in the current Scene.
      • event.stopPropagation() : Stop it reaching any other Scene.
      • Invoke event.preventDefault() to stop event propagation to native DOM.
    3. Any key-down/on key-up
      scene.input.keyboard.on('keydown', function (event) { /* ... */ });\nscene.input.keyboard.on('keyup', function (event) { /* ... */ });\n
      • event.key : 'a'
      • event.keyCode : 65
      • event.code : 'KeyA'
      • event.stopImmediatePropagation() : Stop any further listeners from being invoked in the current Scene.
      • event.stopPropagation() : Stop it reaching any other Scene.
    "},{"location":"keyboardevents/#destroy-key-object","title":"Destroy key object","text":"
    keyObject.destroy();\n
    "},{"location":"keyboardevents/#key-map","title":"Key map","text":"
    • A ~ Z
    • F1 ~ F12
    • BACKSPACE
    • TAB
    • ENTER
    • SHIFT
    • CTRL. ALT
    • PAUSE
    • CAPS_LOCK
    • ESC
    • SPACE
    • PAGE_UP, PAGE_DOWN
    • END, HOME
    • LEFT, UP, RIGHT,DOWN
    • PRINT_SCREEN
    • INSERT, DELETE
    • ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE
    • NUMPAD_ZERO, NUMPAD_ONE, NUMPAD_TWO, NUMPAD_THREE, NUMPAD_FOUR, NUMPAD_FIVE, NUMPAD_SIX, NUMPAD_SEVEN, NUMPAD_EIGHT, NUMPAD_NINE, NUMPAD_ADD, NUMPAD_SUBTRACT
    • OPEN_BRACKET, CLOSED_BRACKET
    • SEMICOLON_FIREFOX, COLON, COMMA_FIREFOX_WINDOWS, COMMA_FIREFOX, BRACKET_RIGHT_FIREFOX, BRACKET_LEFT_FIREFOX
    "},{"location":"keyshub/","title":"Keys hub","text":""},{"location":"keyshub/#introduction","title":"Introduction","text":"

    Key object interface mapping from multiple source of key objects.

    • Author: Rex
    • Member of scene
    "},{"location":"keyshub/#live-demos","title":"Live demos","text":"
    • Multiple mode
    • Single mode
    • Define key
    "},{"location":"keyshub/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"keyshub/#install-plugin","title":"Install plugin","text":""},{"location":"keyshub/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexkeyshubplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexkeyshubplugin.min.js', true);\n
    • Add keys-hub object
      var keysHub = scene.plugins.get('rexkeyshubplugin').add(scene, config);\n
    "},{"location":"keyshub/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import KeysHubPlugin from 'phaser3-rex-plugins/plugins/keyshub-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexKeysHub',\nplugin: KeysHubPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add keys-hub object
      var keysHub = scene.plugins.get('rexKeysHub').add(scene, config);\n
    "},{"location":"keyshub/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import KeysHub from 'phaser3-rex-plugins/plugins/keyshub.js';\n
    • Add keys-hub object
      var keysHub = new KeysHub(scene, config);\n
    "},{"location":"keyshub/#create-instance","title":"Create instance","text":"
    var keysHub = scene.plugins.get('rexKeysHub').add(scene, {\n// singleMode: false,\n});\n
    • singleMode :
      • true : Unplug old key object then plug new key object.
      • false : Plug new key object without unplug previous key object. Default behavior.
    "},{"location":"keyshub/#destroy","title":"Destroy","text":"
    keysHub.destroy();\n
    "},{"location":"keyshub/#plug-key-object","title":"Plug key object","text":"
    • Plug a set of key objects
      keysHub.plugKeyObject({\nkeyCode0: keyObject0,\nkeyCode1: keyObject1,\n// ...\n});\n
      for example :
      var keyObjects = scene.input.keyboard.addKeys({\nup: 'W',\ndown: 'S',\nleft: 'A',\nright: 'D'\n});\nkeysHub.plugKeyObject(keyObjects);\n
      var keyObjects = scene.input.keyboard.createCursorKeys();\nkeysHub.plugKeyObject(keyObjects);\n
      or
      var keyObjects = joystick.createCursorKeys();\nkeysHub.plugKeyObject(keyObjects);\n
      • keyObjects : {keyCode : keyObject}
      • joystick : Virtual joystick
    • Plug a key object
      keysHub.plugKeyObject(keyObject, keyCode);\n
    "},{"location":"keyshub/#unplug-key-object","title":"Unplug key object","text":"
    • Unplug a set of key objects
      keysHubunplugKeyObjects(keyObjects);\n
      • keyObjects : {keyCode : keyObject}
    • Unplugin a key object
      keysHub.unplugKeyObject(keyObject);\n
    "},{"location":"keyshub/#key-object-interfacee","title":"Key object interfacee","text":"
    • Get key object
      var keyObject = keysHub.addKey('W');  // see `Key map` section\n// var keyObject = keysHub.addKey(Phaser.Input.Keyboard.KeyCodes.W);\n
      or
      var keyObject = keysHub.addKey('W');\n
    • Get key objects
      var keyObjects = keysHub.addKeys('W,S,A,D');  // keyObjects.W, keyObjects.S, keyObjects.A, keyObjects.D\n
      or
      var keyObjects = keysHub.addKeys({\nup: 'W',\ndown: 'S',\nleft: 'A',\nright: 'D'\n});  // keyObjects.up, keyObjects.down, keyObjects.left, keyObjects.right\n
    • Get curor key objects
      var cursorKeys = keysHub.createCursorKeys();\n
    "},{"location":"keyshub/#get-plugged-key-objects","title":"Get plugged key objects","text":"
    var keyObject = keysHub.getKeyObjects(key);\n
    • key : Key string, or keyCode number.
    • keyObject :
      • A key object if singleMode is set to true
      • A list of key objects if if singleMode is set to false
    "},{"location":"keyshub/#re-define-key-map","title":"Re-define key map","text":"

    Set singleMode to ture when creating keysHub instance.

    "},{"location":"keyshub/#start-definition-task","title":"Start definition task","text":"
    keysHub.defineKeyStart(key);  // key: key string\n
    • Fire 'definekey.start' event
    "},{"location":"keyshub/#listen-key-input","title":"Listen key input","text":"
    • From keyboard
      keysHub.listenFromKeyboard();\n
    "},{"location":"keyshub/#cancel-definition-task","title":"Cancel definition task","text":"
    keysHub.defineKeyCancel();\n
    • Fire 'definekey.complete' event.
    "},{"location":"keyshub/#complete-definition-task","title":"Complete definition task","text":"

    Complete when any key input

    • Fire 'definekey.complete' event.
    "},{"location":"keyshub/#events","title":"Events","text":"
    • On key object plug
      keysHub.on('plug', function(key, keyObject) {\n\n})\n
    • On key object unplug
      keysHub.on('unplug', function(key, keyObject) {\n\n})\n
    • On define-key start
      keysHub.on('definekey.start', function(key) {\n\n})\n
    • On define-key complete
      keysHub.on('definekey.complete', function(key, keyObject) {\n\n})\n
      • key :
        • A string : Plug new key object to that Key object interface.
        • undefined : Cancel define-key task.
      • keyObject :
        • A key object : New plugged key object.
        • undefined : Remove current plugged key.
    "},{"location":"layer/","title":"Layer","text":""},{"location":"layer/#introduction","title":"Introduction","text":"

    A local display list, built-in game object of phaser.

    Layers have no position or size

    Layers have no position or size within the Scene

    • Cannot enable a Layer for physics or input.
    • Cannot change the position, rotation or scale of a Layer.
    • No scroll factor, texture, tint, origin, crop or bounds.

    Layers cannot be added to Containers

    Containers can be added to Layers, but Layers cannot be added to Containers.

    • Author: Richard Davey
    "},{"location":"layer/#usage","title":"Usage","text":""},{"location":"layer/#add-layer","title":"Add layer","text":"
    var layer = scene.add.layer();\n// var layer = scene.add.layer(children);\n
    • children : Array of game objects added to this layer.
    "},{"location":"layer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLayer extends Phaser.GameObjects.Layer {\nconstructor(scene, children) {\nsuper(scene, children);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var layer = new MyLayer(scene, children);\n
    "},{"location":"layer/#add-child","title":"Add child","text":"
    • Add child
      layer.add(gameObject);\n// layer.add(gameObjects);\n
      • gameObject : A game object, or an array of game objects.
    • Add child at
      layer.addAt(gameObject, index);\n
    • Replace child
      layer.replace(oldGameObject, newGameObject);\n
    "},{"location":"layer/#remove-child","title":"Remove child","text":"
    • Remove child
      var removed = layer.remove(gameObject);\n
    • Remove child at
      var removed = layer.removeAt(index);\n
    • Remove children between indexes
      var removed = layer.removeBetween(startIndex, endIndex);\n
    • Remove all children
      layer.removeAll();\n

    Removed game object won't be added to display list of scene, use

    gameObject.addToDisplayList();\n

    to add it back to scene's display list.

    "},{"location":"layer/#get-child","title":"Get child","text":"
    • Get child at
      var gameObject = layer.getAt(index);\n
    • Get first child by name
      var gameObject = layer.getByName(name);\n
    • Get first child by property
      var gameObject = layer.getFirst(property, value);\n// var gameObject = layer.getFirst(property, value, startIndex, endIndex);\n
    • Get random child
      var gameObject = layer.getRandom();\n// var gameObject = layer.getRandom(startIndex, length);\n
    • Get all children
      var gameObjects = layer.getAll();\n
    • Get index of child
      var index = layer.getIndex(gameObject);\n
    • Get child count
      var count = layer.count(property, value);\n
    • Get total children count
      var count = layer.length;\n
    • Has child
      var hasChild = layer.exists(gameObject);\n
    "},{"location":"layer/#iterate","title":"Iterate","text":"
    • Get first child (set iterator index to 0)
      var gameObject = layer.first;\n
    • Get last child (set iterator index to last)
      var gameObject = layer.last;\n
    • Get next child (increase iterator index, until last)
      var gameObject = layer.next;\n
    • Get previous child (decrease iterator index, until 0)
      var gameObject = layer.previous;\n
    "},{"location":"layer/#move-child","title":"Move child","text":"
    • Swap
      layer.swap(gameObject1, gameObject2);\n
    • Move to
      layer.moveTo(gameObject, index);\n
    • Bring to top
      layer.bringToTop(gameObject);\n
    • Send to back
      layer.sendToBack(gameObject);\n
    • Move up
      layer.moveUp(gameObject);\n
    • Move down
      layer.moveDown(gameObject);\n
    • Move child1 above child2
      layer.moveAbove(child1, child2);\n
    • Move child1 below child2
      layer.moveBelow(child1, child2);\n
    • Sort
      layer.sort(property);\n
      or
      layer.sort('', function(gameObject1, gameObject2) { return 1; // 0, or -1\n});\n
    • Reverse
      layer.reverse();\n
    • Shuffle
      layer.shuffle();\n

    Note

    Children game objects also sort by depth.

    "},{"location":"layer/#for-each-child","title":"For each child","text":"
    layer.each(function(gameObject) {\n\n}, scope);\n
    "},{"location":"layer/#set-property","title":"Set property","text":"
    layer.setAll(property, value);\n// layer.setAll(property, value, startIndex, endIndex);\n
    "},{"location":"layer/#events","title":"Events","text":"
    • On add game object
      layer.events.on('addedtoscene', function(gameObject, scene) {\n\n})\n
    • On remove game object
      layer.events.on('removedfromscene', function(gameObject, scene) {\n\n})\n

    layer.events references to scene.events.

    "},{"location":"layer/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"layer/#create-mask","title":"Create mask","text":"
    var mask = layer.createBitmapMask();\n

    See mask

    "},{"location":"layer/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"layermanager/","title":"Layer manager","text":""},{"location":"layermanager/#introduction","title":"Introduction","text":"

    A dictionary to store Layer game objects. Each layer can have a dedicate camera.

    • Author: Rex
    • Container of game objects
    "},{"location":"layermanager/#relationship-diagram","title":"Relationship diagram","text":"

    Camera - layer - game object

    graph RL\n\n    subgraph Cameras\n      cameraBG[BG]\n      cameraGO[GO]\n      cameraUI[UI]\n    end\n\n    subgraph Layers\n      subgraph BG\n        layerBGBottom[BG-bottom]\n        layerBG[BG]\n        layerBGTop[BG-top]\n      end\n\n      subgraph GO\n        layerGOBottom[GO-bottom]\n        layerGO[GO]\n        layerGOTop[GO-top]\n      end\n\n      subgraph UI\n        layerUIBottom[UI-bottom]\n        layerUI[UI]\n        layerUITop[UI-top]\n      end\n    end\n\n    layerBGBottom --> cameraBG\n    layerBG --> cameraBG\n    layerBGTop --> cameraBG\n\n    layerGOBottom --> cameraGO\n    layerGO --> cameraGO\n    layerGOTop --> cameraGO\n\n    layerUIBottom --> cameraUI\n    layerUI --> cameraUI\n    layerUITop --> cameraUI\n\n    subgraph GameObjects\n      goBG0[\"Background\"] --> layerBG\n      goBG1[\"Background\"] --> layerBG\n\n      go0[GameObject] --> layerGO\n      go1[GameObject] --> layerGO\n      go2[GameObject] --> layerGO\n      go3[GameObject] --> layerGO\n\n      goUI0[Panel] --> layerUI\n      goUI1[Panel] --> layerUI\n      goSYSUI[System dialog] --> layerUITop\n    end
    "},{"location":"layermanager/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"layermanager/#install-plugin","title":"Install plugin","text":""},{"location":"layermanager/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlayermanagerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlayermanagerplugin.min.js', true);\n
    • Add layer manager
      var layerManager = scene.plugins.get('rexlayermanagerplugin').add(scene, config);\n
    "},{"location":"layermanager/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LayerManagerPlugin from 'phaser3-rex-plugins/plugins/layermanager-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLayerManager',\nplugin: LayerManagerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add layer manager
      var layerManager = scene.plugins.get('rexLayerManager').add(scene, config);\n
    "},{"location":"layermanager/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LayerManager from 'phaser3-rex-plugins/plugins/layermanager.js';\n
    • Add move-to behavior
      var layerManager = new LayerManager(scene, config);\n
    "},{"location":"layermanager/#create-instance","title":"Create instance","text":"
    var layerManager = scene.plugins.get('rexLayerManager').add(scene, {\n// layers: ['layer0', 'layer1', ...]\n// layers: [{name, cameraName, scrollFactor}, ...]\n\n// depth: undefined,\n// rootLayer: undefined,\n});\n

    or

    var layerManager = scene.plugins.get('rexLayerManager').add(scene, ['layer0', 'layer1', ...]\n// [{name, cameraName, scrollFactor}, ...]\n);\n
    • layers : Add some initial layers
      • A string array : Add layers by string name
      • A array of plain object { name, cameraName, scrollFactor }
        1. Add layer by string name
        2. Apply scroll factor to all children of this layer.
        3. Bind this layer to dedicate camera (indexed by cameraName), ignore other cameras Add a new camera if this target camera is not existing
    • depth : Set depth to each layer game object.
      • undefined : Keep default depth value (0)
    • rootLayer : Add all layer game objects created by this layer-manager into this root layer.
    "},{"location":"layermanager/#destroy","title":"Destroy","text":"
    layerManager.destroy()\n

    Also destroy all layers in this layer manager.

    "},{"location":"layermanager/#add-layer","title":"Add layer","text":"
    layerManager.add(name);\n// layerManager.add(name, depth);\n
    "},{"location":"layermanager/#add-game-object-to-layer","title":"Add game object to layer","text":"
    layerManager.addToLayer(name, gameObject);\n
    • name : Name of layer
    • gameObject : Any kind of game object, include containerLite and related game objects.

    Note

    Print a warn message if specific layer is not existed.

    "},{"location":"layermanager/#get-layer","title":"Get layer","text":"
    • Get layer by name
      var layer = layerManager.getLayer(name);\n
    • Get all layers in this layer manager
      var layers = layerManager.getLayers();\n// var out = layerManager.getLayers(out);\n
    "},{"location":"layermanager/#has-layer","title":"Has layer","text":"
    var hasLayer = layerManager.has(name);\n// var hasLayer = layerManager.exists(name);\n
    "},{"location":"layermanager/#clear-layer","title":"Clear layer","text":"
    • Destroy all children at layer
      layerManager.clearLayer(name);\n
    • Move all children from layer to scene's display list
      layerManager.clearLayer(name, false);\n
    "},{"location":"layermanager/#change-depth","title":"Change depth","text":"
    • Bring a layer (layerName) to top of displayList
      layerManager.bringLayerToTop(layerName);\n
    • Send a layer (layerName) to bottom of displayList
      layerManager.sendLayerToBack(layerName);\n
    • Move a layer (layerName) above another layer (baseLayerName)
      layerManager.moveLayerAbove(layerName, baseLayerName)\n
    • Move a layer (layerName) below another layer (baseLayerName)
      layerManager.moveLayerBelow(layerName, baseLayerName)\n
    "},{"location":"layermanager/#set-scroll-factor","title":"Set scroll factor","text":"
    layerManager.setScrollFactor(scrollFactor);\n// layerManager.setScrollFactor(scrollFactorX, scrollFactorY);\n

    Apply scroll factor to all children of this layer.

    "},{"location":"layermanager/#bind-camera","title":"Bind camera","text":"
    • Set camera
      layerManager.setCamera(layerName, cameraName);\n
      Bind this layer to dedicate camera (indexed by cameraName), ignore other cameras Add a new camera if this target camera is not existing
    • Get camera
      var camera = layerManager.getCamera(layerName);\n
    "},{"location":"levelcounter/","title":"Level counter","text":""},{"location":"levelcounter/#introduction","title":"Introduction","text":"

    Map level value from experience value, by callback or a number array.

    • Author: Rex
    • Object
    "},{"location":"levelcounter/#live-demos","title":"Live demos","text":"
    • Exp-bar
    "},{"location":"levelcounter/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"levelcounter/#install-plugin","title":"Install plugin","text":""},{"location":"levelcounter/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlevelcounterplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlevelcounterplugin.min.js', true);\n
    • Add level-counter object
      var levelCounter = scene.plugins.get('rexlevelcounterplugin').add(config);\n
    "},{"location":"levelcounter/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LevelCounterPlugin from 'phaser3-rex-plugins/plugins/levelcounter-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLevelCounter',\nplugin: LevelCounterPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add level-counter object
      var levelCounter = scene.plugins.get('rexLevelCounter').add(config);\n
    "},{"location":"levelcounter/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LevelCounter from 'phaser3-rex-plugins/plugins/levelcounter.js';\n
    • Add level-counter object
      var levelCounter = new LevelCounter(config);\n
    "},{"location":"levelcounter/#create-instance","title":"Create instance","text":"
    var levelCounter = scene.plugins.get('rexLevelCounter').add({\ntable: function(level) { return level * 100; },\n// table: [0, 100, 200, 300,],\n\n// maxLevel: -1,\n\n// exp: 0,\n});\n
    • table : Level table, return experience value from level value. Level value starts from 0.
      • A callback
        function(level) {\nreturn experience;\n}\n
      • A number array : Experience value of each level.
    • maxLevel :
      • undefined : Default value
        • No upper limit for callback level table.
        • (table.length - 1) for number array level table.
      • A number : Maximum level value
    • exp : Initial experience value. Default value is 0.
    "},{"location":"levelcounter/#accumulate-experience","title":"Accumulate experience","text":"
    • Accumulate experience
      levelCounter.gainExp(incExp);\n// levelCounter.exp += incExp;\n
      or
      levelCounter.gainExp(incExp, callback, scope);\n
      • Will fire 'levelup' event, or invoke callback many times.
        function(level, fromExp, toExp, levelStartExp, levelEndExp){        }\n
        • level : To next level
        • fromExp, toExp : Experience increment from fromExp to toExp.
        • levelStartExp, levelEndExp : Range of this level.
    • Reset experience value
      levelCounter.resetExp(exp);\n
      • Won't fire 'levelup' event.
    • Force level up
      levelCounter.setLevel(level);\n
      or
      levelCounter.setLevel(level, callback, scope);\n
      • Will fire 'levelup' event, or invoke callback many times.
        function(level, fromExp, toExp, levelStartExp, levelEndExp){        }\n
        • level : To next level
        • fromExp, toExp : Experience increment from fromExp to toExp.
        • levelStartExp, levelEndExp : Range of this level.
    "},{"location":"levelcounter/#level-and-experience","title":"Level and experience","text":"
    • Get current experience
      var exp = levelCounter.getExp();\n// var exp = levelCounter.exp;\n
    • Get current level
      var level = levelCounter.getLevel();\n// var level = levelCounter.level;\n
    • Get current required experience to next level
      var exp = levelCounter.requiredExp;\n
    • Get experience of level
      var exp = levelCounter.getExp(level);\n
    • Get level from experience
      var level = levelCounter.getLevel(exp);\n
    • Get required experience to level
      var exp = levelCounter.getRequiredExpToNextLevel(level);\n// var exp = levelCounter.getRequiredExpToNextLevel(level, exp);\n
    "},{"location":"levelcounter/#events","title":"Events","text":"
    • Level-up when accumulating experience
      levelCounter.on('levelup', function(level, fromExp, toExp, levelStartExp, levelEndExp){        }, scope);\n
      • level : To next level
      • fromExp, toExp : Experience increment from fromExp to toExp.
      • levelStartExp, levelEndExp : Range of this level.
    "},{"location":"lifetime/","title":"Life time","text":""},{"location":"lifetime/#introduction","title":"Introduction","text":"

    Destroy game object when time-out.

    • Author: Rex
    • Behavior of game object
    "},{"location":"lifetime/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"lifetime/#install-plugin","title":"Install plugin","text":""},{"location":"lifetime/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlifetimeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlifetimeplugin.min.js', true);\n
    • Add life-time behavior
      var lifeTime = scene.plugins.get('rexlifetimeplugin').add(gameObject, config);\n
    "},{"location":"lifetime/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LifeTimePlugin from 'phaser3-rex-plugins/plugins/lifetime-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLifeTime',\nplugin: LifeTimePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add life-time behavior
      var lifeTime = scene.plugins.get('rexLifeTime').add(gameObject, config);\n
    "},{"location":"lifetime/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LifeTime from 'phaser3-rex-plugins/plugins/lifetime.js';\n
    • Add life-time behavior
      var lifeTime = new LifeTime(gameObject, config);\n
    "},{"location":"lifetime/#create-instance","title":"Create instance","text":"
    var lifeTime = scene.plugins.get('rexLifeTime').add(gameObject, {\nlifeTime: 1000,\n// destroy: true,\n// start: true\n});\n
    • lifeTime : Life time in ms.
    • destroy : Set true to destroy game object when time-out.
    • start: Set true to starting counting now.
    "},{"location":"lifetime/#events","title":"Events","text":"
    • On time-out
      lifeTime.on('complete', function(gameObject, lifeTime){});\n// lifeTime.once('complete', function(gameObject, lifeTime){});\n
    "},{"location":"lifetime/#life-time","title":"Life-time","text":"
    • Set
      lifeTime.setLifeTime(time);\n
    • Add to
      lifeTime.addToLifeTime(time);\n
    • Get life-time
      var time = lifeTime.lifeTime;\n
    • Get remainder time
      var time = lifeTime.remainder;\n
    • Is alive
      var isAlive = lifeTime.isAlive;\n
    "},{"location":"lifetime/#startstoppauseresume","title":"Start/Stop/Pause/Resume","text":"
    • Start
      lifeTime.start();\n
    • Stop
      lifeTime.stop();\n
    • Pause
      lifeTime.pause();\n
    • Resume
      lifeTime.resume();\n
    "},{"location":"light/","title":"Light","text":""},{"location":"light/#introduction","title":"Introduction","text":"

    lighting system from normal map.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"light/#usage","title":"Usage","text":""},{"location":"light/#light-system","title":"Light system","text":""},{"location":"light/#enable","title":"Enable","text":"
    • Enable
      scene.lights.enable();\n
    • Disable
      scene.lights.disable();\n
      or
      scene.lights.active = false;\n
    "},{"location":"light/#ambient-color","title":"Ambient color","text":"
    scene.lights.setAmbientColor(color);\n
    • color : Integer color value.
    "},{"location":"light/#light","title":"Light","text":"
    • Add
      var light = scene.lights.addLight(x, y, radius);\n// var light = scene.lights.addLight(x, y, radius, color, intensity);\n
      • x, y : The horizontal/vertical position of the Light.
      • radius : The radius of the Light.
      • color : The integer RGB color of the light. Default is 0xffffff.
      • intensity : The intensity of the Light.
    • Remove
      scene.lights.removeLight(light);\n
    "},{"location":"light/#position","title":"Position","text":"
    • Set
      light.setPosition(x, y);\n
      or
      light.x = x;\nlight.y = y;\n
    • Get
      var x = light.x;\nvar y = light.y;\n
    "},{"location":"light/#color","title":"Color","text":"
    • Set
      • Red, green, blue
        light.color.set(red, green, blue);\n
        or
        light.color.r = red;\nlight.color.g = green;\nlight.color.b = blue;\n
      • Integer value
        light.setColor(colorInteger);\n
    • Get
      • Red, green, blue
        var red = light.color.r;\nvar green = light.color.g;\nvar blue = light.color.b;\n
    "},{"location":"light/#size","title":"Size","text":"
    • Set
      light.setRadius(radius);\n// light.radius = radius;\n
      or
      light.diameter = diameter;\n// light.width = diameter;\n// light.height = diameter;\n// light.displayWidth = diameter;\n// light.displayHeight = diameter;\n
    • Get
      var radius = light.radius;\n
      or
      var diameter = light.diameter;\n// var diameter = light.displayWidth;\n// var diameter = light.displayHeight;\n// var diameter = light.width;\n// var diameter = light.height;\n
    "},{"location":"light/#intensity","title":"Intensity","text":"
    • Set
      light.setIntensity(intensity);\n
      or
      light.intensity = intensity;\n
    • Get
      var intensity = light.intensity;\n
    "},{"location":"light/#game-object","title":"Game object","text":""},{"location":"light/#load-texture-with-normal-map","title":"Load texture with normal map","text":"
    scene.load.image(key, [url, normalMapUrl]);\n
    • url : Url of texture.
    • url : Url of texture.
    • normalMapUrl : Url of normal map.
    "},{"location":"light/#apply-light-pipeline","title":"Apply light pipeline","text":"
    gameObject.setPipeline('Light2D');\n
    "},{"location":"line/","title":"Line","text":""},{"location":"line/#introduction","title":"Introduction","text":"

    Draw a line with start/end/body textures, extended from RenderTexture game object.

    • Author: Rex
    • Game object
    "},{"location":"line/#live-demos","title":"Live demos","text":"
    • Line
    "},{"location":"line/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"line/#install-plugin","title":"Install plugin","text":""},{"location":"line/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlineplugin.min.js', true);\n
    • Add line object
      var line = scene.add.rexLine(config);\n
    "},{"location":"line/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LinePlugin from 'phaser3-rex-plugins/plugins/line-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLinePlugin',\nplugin: LinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add line object
      var line = scene.add.rexLine(config);\n
    "},{"location":"line/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Line from 'phaser3-rex-plugins/plugins/line.js';\n
    • Add line object
      var line = new Line(scene, config);\nscene.add.existing(line);\n
    "},{"location":"line/#create-instance","title":"Create instance","text":"
    var line = scene.add.rexLine({\nstart: {\nx: 0, y: 0,\nkey: undefined, frame: undefined, origin: 0.5,\n},\n// start: key,\n// start: undefined,\n\nend: {\nx: 0, y: 0,\nkey: undefined, frame: undefined, origin: 1,\n},\n// end: key,\n// end: undefined,\n\nbody: {\nkey: undefined, frame: undefined, extendMode: 1,\nwidth: undefined,\n},\n// body: key,\n});\n
    • start : Configuration of line-start. Or texture key of line-start.
      • start.x, start.y : Position of line-start.
      • start.key, start.frame : Texrure of line-start.
      • start.origin : Origin of line-start. Default is 0.5.
    • end : Configuration of line-end. Or texture key of line-end.
      • end.x, end.y : Position of line-end.
      • end.key, end.frame : Texrure of line-end.
      • end.origin : Origin of line-end. Default is 1.
    • body : Configuration of line-body. Or texture key of line-body.
      • body.key, body.frame : Texrure of line-body. Line-body will be drawn repeatedly.
      • body.extendMode : Extend mode of line-body.
        • 0, or 'scale' : Draw line-body with scaled image game object.
        • 1, or 'repeat' : Draw line-body with tile-sprute game object. (Default value)
      • body.width : Line width.
    "},{"location":"line/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLine extends Line {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var line = new MyLine(scene, config);\n
    "},{"location":"line/#position-of-line-startline-end","title":"Position of line-start/line-end","text":"
    • Line start
      • Get
        var x0 = line.x0;\nvar y0 = line.y0;\n
      • Set
        line.setLineStartPosition(x, y);\n
        or
        line.x0 = x;\nline.y0 = y;\n
    • Line end
      • Get
        var x1 = line.x1;\nvar y1 = line.y1;\n
      • Set
        line.setLineEndPosition(x, y);\n
        or
        line.x1 = x;\nline.y1 = y;\n
    "},{"location":"line/#set-textures","title":"Set textures","text":"
    • Line-start
      • Set line-start texture
        line.setLineStartTexture(key, frameName);\n
      • Set origin of line-start texture
        line.setLineStartOrigin(origin);\n
        • origin : 0~1. Default is 0, to align the left side of line-start texture with start position.
    • Line-end
      • Set line-end texture
        line.setLineEndTexture(key, frameName);\n
      • Set origin of line-end texture
        line.setLineEndOrigin(origin);\n
        • origin : 0~1. Default is 1, to align the right side of line-end texture with end position.
    • Line-body
      • Set line-body texture
        line.setLineBodyTexture(key, frameName);\n
      • Set line-body extend mode
        line.setLineBodyExtendMode(mode);\n
        • mode :
          • 0, or 'scale' : Draw line-body with scaled image game object.
          • 1, or 'repeat' : Draw line-body with tile-sprute game object.
      • Set line-body width
        line.setLineBodyWidth(width);\n
    "},{"location":"line/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"line/#create-mask","title":"Create mask","text":"
    var mask = line.createBitmapMask();\n

    See mask

    "},{"location":"line/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"list-inputtext/","title":"Input text","text":"

    Solutions of single or multiple line(s) input text.

    • Input text game object (Display: dom / Edit: dom) :
      • Demo
        • type or inputType :
          • 'text' : Single line input.
          • 'textarea' : Multiple line input.
    • Text game object with Text edit behavior (Display: text / Edit: dom) :
      • Demo
        • type :
          • 'text' : Single line input.
          • 'textarea' : Multiple line input.
    • Text game object with Hidden text edit behavior (Display: text / Edit: text, invisible dom) :
      • Demo
        • type or inputType :
          • 'text' : Single line input.
          • 'textarea' : Multiple line input.
    • Canvas input game object (Display: canvas-input / Edit: canvas-input, invisible dom) :
      • Single line input
      • Multiple line input, Text area input
        • textArea : Set true for multiple line input.
    "},{"location":"live2d/","title":"Live2d","text":""},{"location":"live2d/#introduction","title":"Introduction","text":"

    Display live2d model.

    • Author: Rex
    • Game object
    "},{"location":"live2d/#live-demos","title":"Live demos","text":"
    • Transform and hit area
    • Change model

    The example Live2D models, Haru and Hiyori, are redistributed under Live2D's Free Material License.

    "},{"location":"live2d/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"live2d/#install-plugin","title":"Install plugin","text":""},{"location":"live2d/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlive2dplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlive2dplugin.min.js', true);\n
    • Load live2d core script, in preload stage
      scene.load.rexLive2dCoreScript(coreScriptURL);\n
    • Load model assets, in preload stage
      scene.load.rexLive2d(key, modelSettingURL);\n
    • Add live2d object
      var live2dGameObject = scene.add.rexLive2d(x, y, key, config);\n
    "},{"location":"live2d/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import Live2dPlugin from 'phaser3-rex-plugins/plugins/live2d-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLive2dPlugin',\nplugin: Live2dPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Load live2d core script, in preload stage
      scene.load.rexLive2dCoreScript(coreScriptURL);\n
    • Load model assets, in preload stage
      scene.load.rexLive2d(key, modelSettingURL);\n
    • Add live2d object
      var live2dGameObject = scene.add.rexLive2d(x, y, key, config);\n
    "},{"location":"live2d/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import {\nLive2dCoreScriptFileCallback,\nLive2dFileCallback,\nLive2dGameObject\n} from 'phaser3-rex-plugins/plugins/live2d.js';\n
    • Load live2d core script, in preload stage
      Live2dCoreScriptFileCallback.call(scene.load, coreScriptURL);\n
    • Load model assets, in preload stage
      Live2dFileCallback.call(scene.load, key, modelSettingURL);\n
    • Add live2d object
      var live2dGameObject = new Live2dGameObject(scene, x, y, key, config);\nscene.add.existing(live2dGameObject);\n
    "},{"location":"live2d/#create-instance","title":"Create instance","text":"
    var live2dGameObject = scene.add.rexLive2d(x, y, key, {\n// autoPlayIdleMotion: motionGroupName\n});\n
    • autoPlayIdleMotion : Start motion when idle (i.e. all motions are finished).

    Add live2d from JSON

    var live2d = scene.make.rexLive2d({\nx: 0,\ny: 0,\nkey: 256,\n// autoPlayIdleMotion: motionGroupName,\n\nadd: true\n});\n
    "},{"location":"live2d/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLive2d extends Live2d {\nconstructor(scene, x, y, key, config) {\nsuper(scene, x, y, key, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var live2dGameObject = new MyLive2d(scene, x, y, key, config);\n
    "},{"location":"live2d/#change-model","title":"Change model","text":"
    live2dGameObject.setModel(key);\n

    or

    live2dGameObject.setModel(key, {\n// autoPlayIdleMotion: motionGroupName\n})\n
    "},{"location":"live2d/#expression","title":"Expression","text":"
    • Set expression
      live2dGameObject.setExpression(name);\n
    • Get expression names
      var names = live2dGameObject.getExpressionNames();\n
      • names : Array of expression names
    "},{"location":"live2d/#motion","title":"Motion","text":"
    • Start motion
      live2dGameObject.startMotion(group, no);\n// live2dGameObject.startMotion(group, no, priority);\n
      • group : Group name of motion
      • no : Number of motion in group
      • priority : Priority of this motion
        • 'idle', or 1
        • 'normal', or 2, default value
        • 'force' or 3
    • Start random motion
      live2dGameObject.startMotion(group);\n// live2dGameObject.startMotion(group, undefined, priority);\n
    • Stop all motions
      live2dGameObject.stopAllMotions();\n
    • Get motion names
      var names = live2dGameObject.getMotionNames();\n
    • Get motion names of a group
      var names = live2dGameObject.getMotionNames(group);\n
      • group : Group name of motion
    • Get motion group names
      var names = live2dGameObject.getMotionGroupNames();\n
    • Get current playing motion names
      var names = live2dGameObject.getPlayinigMotionNames();\n
    • Is any motion playing?
      var isPlaying = live2dGameObject.isAnyMotionPlaying();\n
    • Start motion when idle (i.e. all motions are finished)
      live2dGameObject.autoPlayIdleMotion(group);\n
      • group : Group name of motion
    • Set time-scale
      live2dGameObject.setTimeScale(timeScale);\n
      or
      live2dGameObject.timeScale = timeScale;\n
    "},{"location":"live2d/#look-at","title":"Look at","text":"
    • Look at
      live2dGameObject.lookAt(x, y, {\n// camera: scene.cameras.main,\n\n// eyeBallX: 1, eyeBallY: 1,\n// angleX: 30, angleY: 30, angleZ: 30,\n// bodyAngleX: 10\n})\n
      • x, y : Look at position.
      • camera : Default value is scene.cameras.main.
      • eyeBallX, eyeBallY : Weight of parameter ParamEyeBallX, ParamEyeBallY.
      • angleX, angleY, angleZ : Weight of parameter ParamAngleX, ParamAngleY, ParamAngleZ.
      • bodyAngleX : Weight of parameter ParamBodyAngleX.
    • Look forward
      live2dGameObject.lookForward();\n
    "},{"location":"live2d/#lip-sync","title":"Lip sync","text":"
    • Set lip sync value
      live2dGameObject.setLipSyncValue(value);\n
      or
      live2dGameObject.lipSyncValue = value;\n
    • Get lip sync value
      var value = live2dGameObject.lipSyncValue;\n
    "},{"location":"live2d/#hit-test","title":"Hit test","text":""},{"location":"live2d/#touch-events","title":"Touch events","text":"
    1. Set interactive
      live2dGameObject.setInteractive();\n
    2. Register touch events of hit area
      • On pointer down
        live2dGameObject.on('pointerdown-' + hitAreaName, function(pointer, localX, localY, event){\n\n}, scope);\n
        or
        live2dGameObject.on('pointerdown', function(pointer, localX, localY, event){\nvar hitTestResult = live2dGameObject.getHitTestResult(); // {hitAreaName: isHit}\n}, scope);\n
      • On pointer up
        live2dGameObject.on('pointerup-' + hitAreaName, function(pointer, localX, localY, event){\n\n}, scope);\n
        or
        live2dGameObject.on('pointerup', function(pointer, localX, localY, event){\nvar hitTestResult = live2dGameObject.getHitTestResult(); // {hitAreaName: isHit}\n}, scope);\n
      • On pointer move
        live2dGameObject.on('pointermove-' + hitAreaName, function(pointer, localX, localY, event){\n\n}, scope);\n
        or
        live2dGameObject.on('pointermove', function(pointer, localX, localY, event){\nvar hitTestResult = live2dGameObject.getHitTestResult(); // {hitAreaName: isHit}\n}, scope);\n
    "},{"location":"live2d/#is-hit","title":"Is hit","text":"
    var isHit = live2dGameObject.hitTest(hitAreaName, x, y);\n// var isHit = live2dGameObject.hitTest(hitAreaName, x, y, camera);\n
    "},{"location":"live2d/#parameter","title":"Parameter","text":"
    1. Register parameter
      live2dGameObject.registerParameter(name);\n
      • name : Register parameter id = Param + capitalize(name)
    2. Reset and add value
      live2dGameObject\n.resetParameterValue(name)\n.addParameterValue(name, value);\n
      or
      var parameters = live2dGameObject.getParameters();  // {name: value}\nparameters[name] = value;\n
    "},{"location":"live2d/#limitation","title":"Limitation","text":"
    • alpha, tint properties does not work
    • Can't apply any post-fx effect or blend mode.
    "},{"location":"loader/","title":"Loader","text":""},{"location":"loader/#introduction","title":"Introduction","text":"

    Load assets, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"loader/#usage","title":"Usage","text":""},{"location":"loader/#loading-in-preload-stage","title":"Loading in preload stage","text":"
    scene.load.image(key, url);\n// scene.load.image(config); // config: {key, url}\n

    Loader in preload stage will start loading automatically by scene.

    "},{"location":"loader/#loading-after-preload-stage","title":"Loading after preload stage","text":"
    scene.load.image(key, url);   // add task\n// scene.load.image(config); // config: {key, url}\nscene.load.once('complete', callback, scope);  // add callback of 'complete' event\nscene.load.start();                     // start loading\n
    "},{"location":"loader/#set-path","title":"Set path","text":"
    scene.load.setPath(path)\n
    "},{"location":"loader/#more-configurations","title":"More configurations","text":"

    More configurations in game config

    loader:{\nbaseURL: '',\npath: '',\nenableParallel: true,\nmaxParallelDownloads: 4,\ncrossOrigin: undefined,\nresponseType: '',\nasync: true,\nuser: '',\npassword: '',\ntimeout: 0,\nmaxRetries: 2,\nwithCredentials: false,\nimageLoadType: 'XHR',    // 'HTMLImageElement' \nlocalScheme: [ 'file://', 'capacitor://' ]\n},\n
    "},{"location":"loader/#events","title":"Events","text":"
    • Load file complete event
      scene.load.on('filecomplete', function(key, type, data) {}, scope);\n
      scene.load.on('filecomplete-' + type + '-' + key, function(key, type, data) {}, scope);\n
    • Add loading file event
      scene.load.on('addfile', function(key, type, file) {}, scope);\n
    • Start loading
      scene.load.once('start', function(){}, scope);\n
    • Loading progressing
      scene.load.on('progress', function(progress){}, scope);\n
      • progress value will increase when a file is loaded, and decrease when a new file loading request is added.
        var loader = scene.load;\nvar total = loader.totalToLoad;\nvar remainder = loader.list.size + loader.inflight.size;\nvar progress = 1 - (remainder / total);\n
    • Loading file progressing
      scene.load.on('fileprogress', function(file, progress){\n// var key = file.key;\n}, scope);\n
    • Loading a file object successful
      scene.load.once('load', function(fileObj){}, scope);\n
    • Loading a file object failed
      scene.load.once('loaderror', function(fileObj){}, scope);\n
    • All loading completed
      • Before releasing resources
        scene.load.once('postprocess', function(loader){}, scope);\n
      • After releasing resources
        scene.load.once('complete', function(loader){}, scope);\n
    • Scene's 'preupdate', 'update', 'postupdate', 'render' events will be triggered during preload stage.
    "},{"location":"loader/#status-of-loader","title":"Status of loader","text":"
    • Ready to start loading
      var isReady = scene.load.isReady();\n
    • Is loading
      var isLoading = scene.load.isLoading();\n
    "},{"location":"loader/#file-types","title":"File types","text":""},{"location":"loader/#image","title":"Image","text":"
    • Image
      scene.load.image(key, url);\n// scene.load.image(key, url, xhrSettings);\n
      • url : Url of texture, or base64 string of Uri.
    • Image and normal map
      scene.load.image(key, [url, normalMapUrl]);\n// scene.load.image(key, [url, normalMapUrl], xhrSettings);\n
      • url : Url of texture, or base64 string of Uri.
      • normalMapUrl : Url of normal map.
    • SVG
      scene.load.svg(key, url);\n// scene.load.svg(key, url, svgConfig);\n// scene.load.svg(key, url, svgConfig, xhrSettings);\n
      • svgConfig : {width, height}, or {scale}
    • Html texture
      scene.load.htmlTexture(key, url, width, height);\n// scene.load.htmlTexture(key, url, width, height, xhrSettings);\n

    Get data from texture cache

    var cache = scene.textures;\nvar data = cache.get(key);\n
    "},{"location":"loader/#sprite-sheet","title":"Sprite sheet","text":"
    scene.load.spritesheet(key, url, {\n// frameWidth: frameWidth,\n// frameHeight: frameHeight,\n// startFrame: startFrame,\n// endFrame: endFrame,\n// margin: margin,\n// spacing: spacing\n});\n// scene.load.spritesheet(key, url, frameConfig, xhrSettings);\n

    Get data from texture cache

    var cache = scene.textures;\nvar data = cache.get(key);\n
    "},{"location":"loader/#texture-atlas","title":"Texture atlas","text":"
    scene.load.atlas(key, textureURL, atlasURL);\n// scene.load.atlas(key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings);\n

    Get data from texture cache

    var cache = scene.textures;\nvar data = cache.get(key);\n

    On load complete

    scene.load.on('filecomplete-atlasjson-' + key, function(key, type, data) {}, scope);\n
    "},{"location":"loader/#multi-file-texture-atlas","title":"Multi file texture atlas","text":"
    scene.load.multiatlas(key, atlasURL);\n// scene.load.multiatlas(key, atlasURL, path, baseURL, atlasXhrSettings);\n
    • atlasURL : The absolute or relative URL to load the texture atlas json data file from.
    • path : Optional path to use when loading the textures defined in the atlas data.
    • baseURL : Optional Base URL to use when loading the textures defined in the atlas data.
    "},{"location":"loader/#unity-texture-atlas","title":"Unity texture atlas","text":"
    scene.load.unityAtlas(key, textureURL, atlasURL);\n// scene.load.unityAtlas(key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings);\n
    "},{"location":"loader/#animation","title":"Animation","text":"
    scene.load.animation(key, url);\n// scene.load.animation(key, url, dataKey, xhrSettings);\n

    Get data from json cache

    var cache = scene.json;\nvar data = cache.get(key);\n
    "},{"location":"loader/#audio","title":"Audio","text":"
    scene.load.audio(key, urls);\n// scene.load.audio(key, urls, {instances: 1}, xhrSettings);\n
    • urls : The absolute or relative URL to load the audio files from, or a blob, or a base64 string of Uri.
    • config.instances : Number of audio instances for HTML5Audio. Defaults to 1.

    Get data from cache

    var cache = scene.cache.audio;\nvar data = cache.get(key);\n
    "},{"location":"loader/#audio-sprite","title":"Audio sprite","text":"
    scene.load.audioSprite(key, jsonURL, audioURL, audioConfig);\n// scene.load.audioSprite(key, jsonURL, audioURL, audioConfig, audioXhrSettings, jsonXhrSettings);\n
    • jsonURL : The absolute or relative URL to load the json file from.
    • audioURL : The absolute or relative URL to load the audio file from.
    • audioConfig : An object containing an instances property for HTML5Audio. Defaults to 1.
    "},{"location":"loader/#video","title":"Video","text":"
    scene.load.video(key, url, noAudio);\n// scene.load.video(key, url, noAudio, xhrSettings);\n
    • url : The absolute or relative URL to load the video files from, or a blob.
    • loadEvent : The load event to listen for when not loading as a blob.
      • 'loadeddata' : Data for the current frame is available. Default value.
      • 'canplay' : The video is ready to start playing.
      • 'canplaythrough' : The video can be played all the way through, without stopping.
    • asBlob : Load the video as a data blob, or via the Video element? Default value is false.
    • noAudio : Does the video have an audio track? If not you can enable auto-playing on it.
    • false : Has audio track, default behavior.

    Get data from video cache

    var cache = scene.video;\nvar data = cache.get(key);\n
    "},{"location":"loader/#bitmap-font","title":"Bitmap font","text":"
    scene.load.bitmapFont(key, textureURL, fontDataURL);\n// scene.load.bitmapFont(key, textureURL, fontDataURL, textureXhrSettings, fontDataXhrSettings);\n
    • textureURL : The absolute or relative URL to load the font image file from.
    • fontDataURL : The absolute or relative URL to load the font xml data file from, which created by software such as
      • Angelcode Bitmap Font Generator
      • Littera
      • Glyph Designer

    Get data from cache

    var cache = scene.cache.bitmapFont;\nvar data = cache.get(key);\n
    "},{"location":"loader/#tile-map","title":"Tile map","text":"
    • JSON : Created using the Tiled Map Editor and selecting JSON as the export format
      scene.load.tilemapTiledJSON(key, url);\n// scene.load.tilemapTiledJSON(key, url, xhrSettings);\n
    • CSV : Created in a text editor, or a 3rd party app that exports as CSV.
      scene.load.tilemapCSV(key, url);\n// scene.load.tilemapCSV(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.tilemap;\nvar data = cache.get(key);\n
    "},{"location":"loader/#text","title":"Text","text":"
    scene.load.text(key, url);\n// scene.load.text(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.text;\nvar data = cache.get(key);\n
    "},{"location":"loader/#json","title":"JSON","text":"
    scene.load.json(key, url);\n// scene.load.json(key, url, dataKey, xhrSettings);\n
    • dataKey : When the JSON file loads only this property will be stored in the Cache.

    Get data from cache

    var cache = scene.cache.json;\nvar data = cache.get(key);\n
    "},{"location":"loader/#xml","title":"XML","text":"
    scene.load.xml(key, url);\n// scene.load.xml(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.xml;\nvar data = cache.get(key);\n
    "},{"location":"loader/#html","title":"HTML","text":"
    scene.load.html(key, url);\n// scene.load.html(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.html;\nvar data = cache.get(key);\n
    "},{"location":"loader/#css","title":"CSS","text":"
    scene.load.css(key, url);\n// scene.load.css(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.css;\nvar data = cache.get(key);\n
    "},{"location":"loader/#scene","title":"Scene","text":"
    scene.load.sceneFile(key, url);\n// scene.load.sceneFile(key, url, xhrSettings);\n

    The key matches the class name in the JavaScript file.

    "},{"location":"loader/#script","title":"Script","text":"
    scene.load.script(key, url);\n// scene.load.script(key, url, type, xhrSettings);\n
    • type :\u3000'script', or 'module'.
    "},{"location":"loader/#scripts","title":"Scripts","text":"
    scene.load.scripts(key, urlArray);\n// scene.load.scripts(key, urlArray, xhrSettings);\n

    Add scripts in the exact order of urlArray.

    "},{"location":"loader/#glsl","title":"GLSL","text":"
    scene.load.glsl(key, url);\n// scene.load.glsl(key, url, shaderType, xhrSettings);\n
    • shaderType : The type of shader.
      • 'fragment' : Fragment shader. Default value.
      • 'vertex' : Vertex shader.

    Get data from cache

    var cache = scene.cache.shader;\nvar data = cache.get(key);\n

    A glsl file can contain multiple shaders, all separated by a frontmatter block.

    ---\nname: type: ---\n\nvoid main(void)\n{\n}\n
    "},{"location":"loader/#binary","title":"Binary","text":"
    scene.load.binary(key, url, dataType);  // dataType: Uint8Array\n// scene.load.binary(key, url, dataType, xhrSettings);\n
    • dataType : Optional type to cast the binary file to once loaded.
      • Uint8Array, Uint8ClampedArray, Uint16Array Uint32Array
      • Int8Array, Int16Array, Int32Array
      • Float32Array, Float64Array
      • BigInt64Array, BigUint64Array

    Get data from cache

    var cache = scene.cache.binary;\nvar data = cache.get(key);\n
    "},{"location":"loader/#plugin","title":"Plugin","text":"
    scene.load.plugin(key, url, true); // start plugin when loaded\n// scene.load.plugin(key, url, true, undefined, xhrSettings);\n
    • url : File url or class instance.
    "},{"location":"loader/#scene-plugin","title":"Scene plugin","text":"
    scene.load.scenePlugin(key, url, systemKey, sceneKey);\n// scene.load.scenePlugin(key, url, systemKey, sceneKey, xhrSettings);\n
    • url : File url or class instance.
    "},{"location":"loader/#file-pack","title":"File pack","text":"

    Load files in JSON format.

    scene.load.pack(key, url);\n// scene.load.pack(key, url, dataKey, xhrSettings);\n

    or

    scene.load.pack(key, json);\n// scene.load.pack(key, json, dataKey);\n
    • dataKey : When the JSON file loads only this property will be stored in the Cache.

    JSON pack file:

    {\n'dataKey': {\n// \"prefix\": \"...\",          // optional, extend key by prefix\n// \"path\": \"...\",            // optional, extend url by path\n// \"defaultType\": \"image\",   // optional, default file type\n'files': [\n{\n'type': 'image',\n'key': '...',\n'url': '...'\n},\n{\n'type': 'image',\n'key': '...',\n'url': '...'\n}\n// ...\n]\n},\n\n'node0': {\n'node1': {\n'node2': {\n'files': [\n// ....\n]\n}\n}\n}\n// dataKey: 'node0.node1.node2'\n}\n

    File type:

    • audio
    • binary
    • glsl
    • html
    • htmlTexture
    • image
    • json
    • script
    • spritesheet
    • svg
    • text
    • tilemapCSV
    • tilemapJSON
    • xml

    Get pack json data from cache

    var cache = scene.cache.json;  // pack json is stored in json cache\nvar data = cache.get(key);\n

    Event name in 'filecomplete' event : 'filecomplete-packfile-' + key

    "},{"location":"loader/#remove-pack-assets","title":"Remove pack assets","text":"
    scene.load.removePack(key);\n// scene.load.removePack(key, dataKey);\n
    "},{"location":"loader/#replace","title":"Replace","text":"
    1. Remove key.
    2. Load file again.
    "},{"location":"loader/#cache","title":"Cache","text":""},{"location":"loader/#get-data","title":"Get data","text":"
    var cache = scene.cache.text;\nvar data = cache.get(key);\n
    "},{"location":"loader/#add-data","title":"Add data","text":"
    var cache = scene.cache.text;\nvar data = cache.add(key);\n
    "},{"location":"loader/#release-data","title":"Release data","text":"
    var cache = scene.cache.text;\ncache.remove(key);\n
    "},{"location":"loader/#data-in-cache","title":"Data in cache","text":"
    var cache = scene.cache.text;\nvar hasData = cache.exists(key);\n// var hasData = cache.has(key);\n
    "},{"location":"loader/#cache-events","title":"Cache events","text":"
    • Add any item
      cache.events.on('add', function(cache, key, item){\n\n})\n
    • Remove any item
      cache.events.on('remove', function(cache, key, item){\n\n})\n
    "},{"location":"loader/#xhr-settings-object","title":"XHR Settings Object","text":"

    Parameter xhrSettings

    {\nasync: true,\nuser: '',\npassword: '',\ntimeout: 0,\nheaders: undefined,\nheader: undefined,\nheaderValue: undefined,\nrequestedWith: undefined,\noverrideMimeType: undefined,\nwithCredentials: false\n}\n
    • user : Optional username for the XHR request.
    • password : Optional password for the XHR request.
    • timeout : Optional XHR timeout value.
    • headers, header, headerValue, requestedWith : This value is used to populate the XHR setRequestHeader
    • overrideMimeType : Provide a custom mime-type to use instead of the default.
    • withCredentials : Whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates. Setting withCredentials has no effect on same-site requests.
    "},{"location":"loading-animation-scene/","title":"Loading animation scene","text":""},{"location":"loading-animation-scene/#introduction","title":"Introduction","text":"

    Start loading animation scene, stop this scene when loading complete.

    • Author: Rex
    • Methods
    "},{"location":"loading-animation-scene/#live-demos","title":"Live demos","text":"

    Loading animation scene

    "},{"location":"loading-animation-scene/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"loading-animation-scene/#install-plugin","title":"Install plugin","text":""},{"location":"loading-animation-scene/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexloadinganimationsceneplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexloadinganimationsceneplugin.min.js', true);\n
    • In mainScene, start loading animation scene, or in animation scene, monitor loading status of mainScene.
      scene.plugins.get('rexloadinganimationsceneplugin').startScene(scene, animationSceneKey);\n
    • This plugin will also install AwaitLoader.
    "},{"location":"loading-animation-scene/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LoadingAnimationScenePlugin from 'phaser3-rex-plugins/plugins/loadinganimationscene-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLoadingAnimationScene',\nplugin: LoadingAnimationScenePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In mainScene, start loading animation scene, or in animation scene, monitor loading status of mainScene.
      scene.plugins.get('rexLoadingAnimationScene').startScene(config);\n
    • This plugin will also install AwaitLoader.
    "},{"location":"loading-animation-scene/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import StartLoadingAnimationScene from 'phaser3-rex-plugins/plugins/loadinganimationscene.js';\n
    • In mainScene, start loading animation scene, or in animation scene, monitor loading status of mainScene.
      StartLoadingAnimationScene(config);\n
    "},{"location":"loading-animation-scene/#start-loading-animation-scene","title":"Start loading animation scene","text":"

    In mainScene, start loading animation scene, or in animation scene, monitor loading status of mainScene.

    scene.plugins.get('rexLoadingAnimationScene').startScene({\nmainScene: animationScene:\n\nonLoadingComplete: undefined\nonLoadingProgress: undefined\n});\n
    • mainScene : Scene instaance of main scene.
    • animationScene : Scene instance or scene-key of animation scene.
      • This animation scene will be stopped wheen main scene's loading complete totally.
    • onLoadingComplete : Custom task invoked when loading complete.
      function(finishLoading, animationScene) {\n// finishLoading();\n}\n
      • Invoke finishLoading() method (later) to finish loading progress totally.
    • onLoadingProgress : Callback when loading progress is changing.
      function(progress, animationScene) {\n\n}\n
    "},{"location":"loadingprogress/","title":"Loading progress","text":""},{"location":"loadingprogress/#introduction","title":"Introduction","text":"

    Pop-up dialog for loading-progress, then scale-down this dialog.

    • Author: Rex
    • Behavior of game object
    "},{"location":"loadingprogress/#live-demos","title":"Live demos","text":"
    • Loading progress
    • Custom transit
    "},{"location":"loadingprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"loadingprogress/#install-plugin","title":"Install plugin","text":""},{"location":"loadingprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexloadingprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexloadingprogressplugin.min.js', true);\n
    • Add loading-progress behavior
      var loadingProgress = scene.plugins.get('rexloadingprogressplugin').add(gameObject, config);\n
    "},{"location":"loadingprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add loading-progress behavior
      var loadingProgress = scene.plugins.get('rexLoadingProgress').add(gameObject, config);\n
    "},{"location":"loadingprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LoadingProgress from 'phaser3-rex-plugins/plugins/loadingprogress.js';\n
    • Add loadingprogress behavior
      var loadingProgress = new LoadingProgressBehavoir(gameObject, config);\n
    "},{"location":"loadingprogress/#create-instance","title":"Create instance","text":"
    var loadingProgress = scene.plugins.get('rexLoadingProgress').add(gameObject, {\n// duration: {\n//     in: 200,\n//     out: 200\n// }\n\n// progress: function(gameObject, progress) {},\n// transitIn: function(gameObject, duration) {},\n// transitOut: function(gameObject, duration) {},\n});\n
    • gameObject : Game object for presenting loading-progress.
    • duration : Duration of transition-in, trantion-out.
      • duration.in : Duration of transition-in (open dialog).
        • 0 : No transition, open dialog immediately.-
      • duration.out : Duration of transition-out (close dialog). Game object will be destroyed after transiting out.
        • 0 : No transition, close dialog immediately.
    • progress : Callback of loading-progress
      function(gameObject, progress) {\n\n}\n
      • progress : Number between 0 to 1.
    • transitIn : Tween behavior of opening dialog.
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • transitOut : Tween behavior of closing dialog.
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    "},{"location":"loadingprogress/#events","title":"Events","text":"
    • On progress
      loadingProgress.on('progress', function(progress) {\n})\n
    • On opened dialog
      loadingProgress.on('open', function(gameObject, loadingProgress) {\n})\n
    • On closed dialog
      loadingProgress.on('close', function() {\n})\n
    "},{"location":"localforage-files/","title":"Files","text":""},{"location":"localforage-files/#introduction","title":"Introduction","text":"

    Save JSON data, using localforage.

    Each file contains header and content indexed by fileID.

    • Author: Rex
    • Member of scene
    "},{"location":"localforage-files/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"localforage-files/#install-plugin","title":"Install plugin","text":""},{"location":"localforage-files/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlocalforagefilesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlocalforagefilesplugin.min.js', true);\n
    • Add localforage-files object
      var fileManager = scene.plugins.get('rexlocalforagefilesplugin').add(config);\n
    "},{"location":"localforage-files/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FilesPlugin from 'phaser3-rex-plugins/plugins/localforagefiles-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFiles',\nplugin: FilesPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add localforage-files object
      var fileManager = scene.plugins.get('rexFiles').add(config);\n
    "},{"location":"localforage-files/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Files from 'phaser3-rex-plugins/plugins/localforagefiles.js';\n
    • Add localforage-files object
      var fileManager = new Files(config);\n
    "},{"location":"localforage-files/#create-instance","title":"Create instance","text":"
    var fileManager = scene.plugins.get('rexFiles').add.files({\n// name: 'files',\n// zip: true\n});\n
    • name : Storage name.
    • zip :
      • true : Save compressed stringify json data.
      • false : Save json data directly
    "},{"location":"localforage-files/#save-file","title":"Save file","text":"
    • Overwrite
      fileManager.save(fileID, header, content);\n
      • fileID : Unique ID of this file.
      • header : Header data for indexing, a JSON object.
        • Reserve keys : fileID.
      • content : Content/body, a JSON object.
        • Reserve keys : fileID.
    • Update
      fileManager.save(fileID, header, content, true);\n
    "},{"location":"localforage-files/#load-headers","title":"Load headers","text":"
    fileManager.loadHeaders()\n.then(function(result) { // var headers = result.headers;\n})\n.catch(function(result) {\n// var error = result.error;\n})\n
    • headers : Get header by headers[fileID], each header contains
      • header.fileID : Unique ID of this file.
    "},{"location":"localforage-files/#load-file","title":"Load file","text":"
    fileManager.load(fileID)\n.then(function(result) { // var header = result.header;\n// var content = result.content;\n// var fileID = result.fileID;\n})\n.catch(function(result) {\n// var error = result.error;\n// var fileID = result.fileID;\n})\n
    • header, content : Header/content of this file.
    • fileID : Unique ID of this file.
    • userID : User ID of file owner.
    "},{"location":"localforage/","title":"LocalForage","text":""},{"location":"localforage/#introduction","title":"Introduction","text":"

    Offline storage, improved.

    • Author: Mozilla
    "},{"location":"localforage/#usage","title":"Usage","text":"

    Official document

    Sample code

    By default, LocalForage selects backend drivers for the datastore in this order:

    1. IndexedDB
    2. WebSQL
    3. localStorage
    "},{"location":"localforage/#save-data","title":"Save data","text":"
    • Callback
      localforage.setItem(key, value, function(){ /* ... */ });\n
    • Promise
      localforage.setItem(key, value)\n.then(function(value){ /* ... */ })\n.catch(function(err){ /* ... */ });\n
    "},{"location":"localforage/#read-data","title":"Read data","text":"
    • Callback
      localforage.getItem(key, function(err, value){ /* ... */ });\n
    • Promise
      localforage.getItem(key)\n.then(function(value){ /* ... */ })\n.catch(function(err){ /* ... */ });\n
    "},{"location":"localforage/#remove-data","title":"Remove data","text":"
    • Callback
      localforage.removeItem(key, function(){ /* ... */ });\n
    • Promise
      localforage.removeItem(key)\n.then(function(value){ /* ... */ })\n.catch(function(err){ /* ... */ });\n
    "},{"location":"localstorage-data/","title":"Data manager","text":""},{"location":"localstorage-data/#introduction","title":"Introduction","text":"

    Sync data from data manager to local-storage.

    • Author: Rex
    • Member of scene

    Max Size

    5MB per app per browser.

    "},{"location":"localstorage-data/#live-demos","title":"Live demos","text":"
    • Extend game registry
    • New local storage data manager
    "},{"location":"localstorage-data/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"localstorage-data/#install-plugin","title":"Install plugin","text":""},{"location":"localstorage-data/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlocalstoragedataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlocalstoragedataplugin.min.js', true);\n
    • Extend existed data object (game.registry, or scene.data)
      var data = scene.plugins.get('rexlocalstoragedataplugin').extend(game.registry, config);\n// var data = scene.plugins.get('rexlocalstoragedataplugin').extend(scene.data, config);\n
    • New local storage data manager
      var data = scene.plugins.get('rexlocalstoragedataplugin').add(parent, config);\n
    "},{"location":"localstorage-data/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LocalStorageDataPlugin from 'phaser3-rex-plugins/plugins/localstoragedata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLocalStorageData',\nplugin: LocalStorageDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Extend existed data object (game.registry, or scene.data)
      var data = scene.plugins.get('rexLocalStorageData').extend(game.registry, config);\n// var data = scene.plugins.get('rexLocalStorageData').extend(scene.data, config);\n
    • New local storage data manager
      var data = scene.plugins.get('rexLocalStorageData').add(parent, config);\n
    "},{"location":"localstorage-data/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LocalStorageData from 'phaser3-rex-plugins/plugins/localstoragedata.js';\n
    • New local storage data manager
      var data = new LocalStorageData(parent, config);\n
    "},{"location":"localstorage-data/#create-instance","title":"Create instance","text":"
    var data = scene.plugins.get('rexLocalStorageData').add({\n// name: '',\n// load: true,\n// default: undefined,\n// reset: false\n});\n// var data = scene.plugins.get('rexLocalStorageData').add(parent, config);\n// var data = scene.plugins.get('rexRData').add(parent, eventEmitter, config);\n
    • name : Prefix of key in local storage.
    • load :
      • true : Load data from local storage. Default behavior.
      • false : Don't load data now.
    • default : Define valid keys and default values of loaded data.
      • undefined : Load all keys from local storage.
    • reset :
      • true : Reset all data to default values (default), clear keys which are not in defaultData.
    • parent : The object (a scene, or a game object) that this DataManager belongs to.
    • eventEmitter : The DataManager's event emitter.
    "},{"location":"localstorage-data/#load","title":"Load","text":"
    data.load(defaultData);\n// data.load(defaultData, reset);\n
    • defaultData : Define valid keys and default values of loaded data.
      • undefined : Load all keys from local storage. reset will be false in this case.
    • reset :
      • true : Reset all data to default values (defaultData), clear keys which are not in defaultData.

    Note

    Data loaded from local storage already, if load is true.

    "},{"location":"localstorage-data/#getsetremove-value","title":"Get/set/remove value","text":"

    See built-in data manager.

    "},{"location":"localstorage-data/#reserved-keys","title":"Reserved keys","text":"

    '__keys__' is used internally by this plugin.

    "},{"location":"localstorage-data/#get-default-value","title":"Get default value","text":"
    var value = data.getDefaultValue(key);\n
    "},{"location":"localstorage/","title":"LocalStorage","text":""},{"location":"localstorage/#introduction","title":"Introduction","text":"

    Store small data in key-value pairs locally within the user's browser.

    • Author: Built-in javascript function

    Max Size

    5MB per app per browser.

    "},{"location":"localstorage/#usage","title":"Usage","text":"

    Reference

    Sample code

    "},{"location":"localstorage/#save-data","title":"Save data","text":"
    localStorage.setItem(key, value);\n
    "},{"location":"localstorage/#read-data","title":"Read data","text":"
    var value = localStorage.getItem(key);\n

    Note

    The keys and the values are always strings. Objects, integer keys will be automatically converted to strings.

    "},{"location":"localstorage/#remove-data","title":"Remove data","text":"
    localStorage.removeItem(key);\n
    "},{"location":"lokijs/","title":"LokiJs","text":""},{"location":"lokijs/#introduction","title":"Introduction","text":"

    In-memory JavaScript Datastore with Persistence.

    • Reference
    • Document
    "},{"location":"lokijs/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"lokijs/#create-database","title":"Create database","text":"
    var db = new loki();\n// var db = new loki('loki.json', config);  // load database from file\n
    "},{"location":"lokijs/#create-collection","title":"Create collection","text":"
    var collection = db.addCollection(name);\n// var collection = db.addCollection(name, config);\n
    "},{"location":"lokijs/#get-collection","title":"Get collection","text":"
    var collection = db.getCollection(name);\n
    "},{"location":"lokijs/#insert-document","title":"Insert document","text":"
    var docInColl = collection.insert(doc);  // doc: an object\n

    Get Id

    var id = docInColl.$loki;\n
    "},{"location":"lokijs/#insert-documents","title":"Insert documents","text":"
    collection.insert(docArray);  // documents in array\n
    "},{"location":"lokijs/#query","title":"Query","text":""},{"location":"lokijs/#get-document-by-id","title":"Get document by id","text":"
    var doc = collection.get(id);  // id: `$loki`\n
    "},{"location":"lokijs/#get-doc-by-unique-index","title":"Get doc by unique index","text":"
    var doc = collection.by(key, value);\n
    "},{"location":"lokijs/#filter-documents","title":"Filter documents","text":"
    • $eq : filter for document(s) with property of (strict) equality
      var docArray = collection.find({key: value});\n// var docArray = collection.find({key: {'$eq': value});\n
    • $aeq : filter for document(s) with property of abstract (loose) equality
      var docArray = collection.find({key: {'$aeq': value}});\n
      For example
      var results = coll.find({age: {'$aeq': 20}});  // age == '20' or age == 20\n
    • $ne : filter for document(s) with property not equal to provided value
      var docArray = collection.find({key: {'$ne': value}});\n
    • $gt : filter for document(s) with property greater than provided value
      var docArray = collection.find({key: {'$gt': value}});\n
    • $gte : filter for document(s) with property greater or equal to provided value
      var docArray = collection.find({key: {'$gte': value}});\n
    • $lt : filter for document(s) with property less than provided value
      var docArray = collection.find({key: {'$lt': value}});\n
    • $lte : filter for document(s) with property less than or equal to provided value
      var docArray = collection.find({key: {'$lte': value}});\n
    • $between : filter for documents(s) with property between provided values
      var docArray = collection.find({key: {'$between': [value0, value1]}});\n
    • $in : filter for document(s) with property matching any of the provided array values
      var docArray = collection.find({key: {'$in': [value0, value1, ...]}});\n
      Your property should not be an array but your compare values should be.
    • $nin : filter for document(s) with property not matching any of the provided array values
      var docArray = collection.find({key: {'$nin': [value0, value1, ...]}});\n
    • $contains : filter for document(s) with property containing the provided value
      var docArray = collection.find({key: {'$contains': value}});\n
      Use this when your property contains an array but your compare value is not an array
    • $containsAny : filter for document(s) with property containing any of the provided values
      var docArray = collection.find({key: {'$containsAny': [value0, value1, ...]}});\n
    • $containsNone : filter for documents(s) with property containing none of the provided values
      var docArray = collection.find({key: {'$containsNone': [value0, value1, ...]}});\n
    • $regex : filter for document(s) with property matching provided regular expression
      var docArray = collection.find({key: {'$regex': pattern}});\n// var docArray = collection.find({key: {'$regex': [pattern, options]});\n
      For example
      var docArray = collection.find({key: { '$regex': 'din' }});\nvar docArray = collection.find({key: { '$regex': ['din', 'i'] }});\n
    • $dteq: filter for document(s) with date property equal to provided date value
      var docArray = collection.find({key: {'$dteq': new Date('1/1/2017')}});\n
    • $type : filter for documents which have a property of a specified type
      var docArray = collection.find({key: {'$type': value}}); // 'string', or 'number', ...\n
    • $size : filter for documents which have array property of specified size
      var docArray = collection.find({key: {'$size': value}});\n
      (does not work for strings)
    • $len : filter for documents which have string property of specified length
      var docArray = collection.find({key: {'$len': value}});\n
    • $or : filter for documents which meet any of the nested subexpressions
      var docArray = collection.find({'$or': [\n{key0: {'$lt': value0}},\n{key1: {'$gte': value1}},\n// ...\n]});\n
    "},{"location":"lokijs/#find-one-document","title":"Find one document","text":"
    var doc = collection.findOne({});\n
    "},{"location":"lokijs/#filter-by-function","title":"Filter by function","text":"
    var docArray = collection.where(function(doc){\n// ...\nreturn isPicked;  // true to pick this document\n})\n
    "},{"location":"lokijs/#sort","title":"Sort","text":"
    • Sort with a key
      var docArray = collection.chain().find({}).simplesort(key).data();  // ascending\n// var docArray = collection.chain().find({}).simplesort(key, {desc: true}).data();  // descending\n
    • Sort with mutiple keys
      var docArray = collection.chain().find({}).compoundsort([key0, key1]).data();  // key0, key1: ascending\n// var docArray = collection.chain().find({}).compoundsort([key0, [key1, true]]).data(); // key0: ascending, key1: descending\n
    • Sort with function
      var docArray = collection.chain().find({}).sort(\nfunction(doc1, doc2) {\nreturn result; // 0, 1, -1\n})\n.data();\n
      result:
      • 0: equal
      • 1: greater
      • -1: less
    "},{"location":"lokijs/#pagination","title":"Pagination","text":"

    Get documents from start to start+count-1.

    var docArray = collection.chain().find({}).offset(start).limit(count).data();\n
    "},{"location":"lokijs/#update","title":"Update","text":"

    Update each filtered documents.

    var docArray = collection.chain().find({}).update(\nfunction(doc) { //\nreturn doc;\n});\n
    "},{"location":"lokijs/#remove","title":"Remove","text":"

    Remove filtered documents.

    collection.chain().find({}).remove();\n
    "},{"location":"lokijs/#map","title":"Map","text":"

    Map document into a new anonymous collection, won't affect original collection.

    var docArray = collection.chain().find({}).map(\nfunction(doc) {\n// ...\nreturn doc\n})\n.data();\n
    "},{"location":"lokijs/#map-reduce","title":"Map-reduce","text":"
    1. Map document into a new anonymous collection
    2. Run reduceFn to get final result value from result set of step 1.
    var mapFn = function(doc) {\n// ...\nreturn doc\n};\nvar reduceFn = function(docArray) {\n// ...\nreturn result;\n}\nvar result = collection.chain().find({}).mapReduce(mapFn, reduceFn);\n
    "},{"location":"lokijs/#clone-result-set","title":"Clone result set","text":"
    var resultSet = collection.chain().find({});\nvar resultSetClone = resultSet.branch();\n\n// resultSetClone.find({}).data();\n
    "},{"location":"lokijs/#dynamic-view","title":"Dynamic view","text":"
    1. Create dynamic view
      var view = children.addDynamicView(name);\n
    2. Add filters
      • find
        view.applyFind({});\n
      • where
        view.applyWhere(function(doc) { return true; });\n
      • simple sort
        view.applySimpleSort(key);\n
      • sort by multiple keys
        view.applySortCriteria([key0, key1]);\n// view.applySortCriteria([key0, [key1, true]]);\n
      • sort function
        view.applySort(function(doc1, doc2) {\nreturn result; // 0, 1, -1\n});\n
        result:
        • 0: equal
        • 1: greater
        • -1: less
    3. Get result data
      var docArray = view.data();\n

    Add new filters

    var docArray = view.branchResultset().find({}).data();\n

    "},{"location":"lokijs/#speed-up-quering","title":"Speed-up quering","text":""},{"location":"lokijs/#custom-unique-index","title":"Custom unique index","text":"
    1. Define custom unique index
      var collection = db.addCollection(name, {\nunique: [key0]\n});\n
    2. Get document by custom unique index
      var doc = collection.by(key0, value);\n
    "},{"location":"lokijs/#binary-indices","title":"Binary indices","text":"
    1. Define binary index
      var collection = db.addCollection(name, {\nindices: [key0]\n});\n
      Or
      collection.ensureIndex(key);\n
    2. Get documents by normal filters
      var docArray = collection.find({key0: {'$gt': value}});\n
    "},{"location":"lokijs/#methods-of-collection","title":"Methods of collection","text":"
    • Average value of a property
      var avgValue = collection.avg(key);\n
    • Maximum value of a property
      var maxValue = collection.max(key);\n
    • Minimum value of a property
      var minValue = collection.min(key);\n
    • Median value of a property
      var medianValue = collection.median(key);\n
    • Amount of documents
      var amount = collection.count(query);  // {key: {'$gt': value}}\n
    "},{"location":"lokijs/#serialize-deserialize","title":"Serialize & Deserialize","text":"
    • Database as string
      var s = db.serialize();\n
    • Load database from string
      db.loadJSON(s);\n
    "},{"location":"luxon/","title":"Luxon","text":""},{"location":"luxon/#introduction","title":"Introduction","text":"

    Parse, validate, manipulate, and display dates and times. Reference

    "},{"location":"luxon/#usage","title":"Usage","text":"
    • Install
    • Getting started
      • Demo
      • A quick tour
      • API
    "},{"location":"luxon/#creating-a-datetime","title":"Creating a DateTime","text":"
    const dt = DateTime.local(2017, 5, 15, 8, 30);\n

    or

    var dt = DateTime.fromISO('2017-05-15');\n// var dt = DateTime.fromISO('2017-05-15T17:36');\n// var dt = DateTime.fromISO('2017-W33-4');\n// var dt = DateTime.fromISO('2017-W33-4T04:45:32.343');\n
    "},{"location":"luxon/#current-date-and-time","title":"Current date and time","text":"
    const now = DateTime.now();\n// const now = DateTime.local();\n
    "},{"location":"luxon/#json","title":"JSON","text":"
    • To JSON
      var json = dt.toObject();\n
    • From JSON
      var dt = DateTime.fromObject(json);\n// var dt = DateTime.fromObject({year: 2017, month: 5, day: 15, hour: 17, minute: 36});\n
    "},{"location":"luxon/#math","title":"Math","text":"
    var dt1 = dt0.plus({ hours: 3, minutes: 2 });\nvar dt1 = dt0.minus({ days: 7 });\nvar dt1 = dt0.startOf('day');\nvar dt1 = dt0.endOf('hour');\n
    "},{"location":"luxon/#difference","title":"Difference","text":"
    var i1 = DateTime.fromISO('1982-05-25T09:45'),\ni2 = DateTime.fromISO('1983-10-14T10:30');\ni2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\ni2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\ni2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\ni2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n
    "},{"location":"luxon/#durations","title":"Durations","text":"
    var dur = Duration.fromObject({ hours: 2, minutes: 7 });\n// dt.plus(dur);\n\ndur.as('seconds') //=> 7620\ndur.toObject()    //=> { hours: 2, minutes: 7 }\ndur.toISO()       //=> 'PT2H7M'\n
    "},{"location":"luxon/#parseformat","title":"Parse/Format","text":"
    • Parse
      var dt = DateTime.fromFormat('12-16-2017', 'MM-dd-yyyy');\n// var dt = DateTime.fromFormat('May 25, 1982', 'MMMM dd, yyyy');\n// var dt = DateTime.fromFormat('mai 25, 1982', 'MMMM dd, yyyy', { locale: 'fr' });\n
    • Format
      var s = dt.toFormat('MM-dd-yyyy');\n// var s = dt.toFormat('MMMM dd, yyyy')\n// var s = dt.setLocale('fr').toFormat('MMMM dd, yyyy')\n
    "},{"location":"luxon/#relative-time","title":"Relative time","text":"

    Returns a string representation of this date relative to today.

    var s = dt.toRelativeCalendar();\n
    var s = dt.toRelativeCalendar({\nbase: dt0,\nlocale: string,\nunit: string\n});\n
    • base : The DateTime to use as the basis to which this time is compared. Defaults to now.
    • locale : Override the locale of this DateTime.
    • unit : Use a specific unit; if omitted, the method will pick the unit. Use one of 'years', 'quarters', 'months', 'weeks', or 'days'
    "},{"location":"lzstring/","title":"LZ string","text":""},{"location":"lzstring/#introduction","title":"Introduction","text":"

    Compress string using LZ-based compression algorithm. Reference

    • Author: Rex
    • Member of scene
    "},{"location":"lzstring/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"lzstring/#install-plugin","title":"Install plugin","text":""},{"location":"lzstring/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlzstringplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlzstringplugin.min.js', true);\n
    • Add lz-string object
      var lzstring = scene.plugins.get('rexlzstringplugin').add(config);\n
    "},{"location":"lzstring/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LZStringPlugin from 'phaser3-rex-plugins/plugins/lzstring-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLZString',\nplugin: LZStringPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add lz-string object
      var lzstring = scene.plugins.get('rexLZString').add(config);\n
    "},{"location":"lzstring/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LZString from 'phaser3-rex-plugins/plugins/lzstring.js';\n
    • Add lz-string object
      var lzstring = new LZString(config);\n
    "},{"location":"lzstring/#create-instance","title":"Create instance","text":"
    var lzstring = scene.plugins.get('rexLZString').add({\n// encoding: 'none'     // 'none'|0, 'base64'|1, 'utf16'|2, 'uri'|3\n});\n
    • encoding :
      • 'none', or 0 : no encoding.
      • 'base64', or 1 : base64 encoding.
      • 'utf16', or 2 : UTF16 encoding.
      • 'uri', or 3 : URI encoding.
    "},{"location":"lzstring/#compression","title":"Compression","text":"
    var compressionResult = lzstring.compress(src);\n
    "},{"location":"lzstring/#decompression","title":"Decompression","text":"
    var decompressionResult = lzstring.decompress(compressionResult);\n
    "},{"location":"lzstring/#set-encoding","title":"Set encoding","text":"
    lzstring.setEncoding(m);  // 0|'none'|1|'base64'|2|'utf16'|3|'uri'\n
    "},{"location":"mainloop/","title":"Main loop","text":"
    1. game.events prestep event. Global Managers like Input and Sound update.
      1. trigger game.sound.update()
    2. game.events step event. User-land code and plugins
      • Register event
        scene.game.events.on('step', function(time, delta){\n//\n}, scope);\n
    3. Update the Scene Manager and all active Scenes
      1. scene.events preupdate event
        • Register event
          scene.events.on('preupdate', function(time, delta){\n//\n}, scope);\n
        • InputPlugin.preUpdate()
        • TweenManager.preUpdate() to arrange active targets
        • UpdateList.preUpdate(), to arrange game objects in UpdateList
      2. scene.events update event
        • Register event
          scene.events.on('update', function(time, delta){\n//\n}, scope);\n
        • TweenManager.update(), to run active tweens
        • UpdateList.update
          • gameObject.preUpdate
        • Update arcade world
      3. scene.update()
      4. scene.events postupdate event
        • Register event
          scene.events.on('postupdate', function(time, delta){\n//\n}, scope);\n
    4. game.events poststep event. Final event before rendering starts.
      • Register event
        scene.game.events.on('poststep', function(time, delta){\n//\n}, scope);\n
    5. game.renderer.preRender()
    6. game.events prerenderclear event
      • Register event
        scene.game.events.on('prerenderclear', function(){\n//\n}, scope);\n
    7. game.events prerender event
      • Register event
        scene.game.events.on('prerender', function(){\n//\n}, scope);\n
    8. SceneManager.render()
      1. Sort display list
      2. scene.events prerender event
        • Register event
          scene.events.on('prerender', function(renderer){\n//\n}, scope);\n
      3. Render cameras
      4. scene.events render event
        • Register event
          scene.events.on('render', function(renderer){\n//\n}, scope);\n
    9. game.renderer.postRender()
    10. game.events postrender event. Final event before the step repeats.
      • Register event
        scene.game.events.on('postrender', function(renderer, time, delta){\n//\n}, scope);\n

    Note

    Each scene is a standalone system.

    "},{"location":"mainloop/#flow-chart","title":"Flow chart","text":""},{"location":"mainloop/#game-loop","title":"Game loop","text":"
    graph TB\n\nsubgraph Render\nGameRenderPreRender[\"game.renderer.preRender()\"]\nGameEventPreRenderClear>\"game.events: prerenderclear\"]\nGameEventPreRender>\"game.events: prerender\"]\nSceneManagerRender[\"SceneManager.render()<br>...See 'Scene steps'...\"]\nGameRenderPostRender[\"game.renderer.postRender()\"]\nGameEventPostRender>\"game.events: postrender\"]\nend\n\nsubgraph Step\nGameEventPreStep>\"game.events: prestep<br><br>sound.update()\"]\nGameEventStep>\"game.events: step\"]\nSceneManagerUpdate[\"SceneManager.update()<br>...See 'Scene steps'...\"]\nGameEventPostStep>\"game.events: poststep\"]\nend\n\n\nGameEventPreStep --> GameEventStep\nGameEventStep --> SceneManagerUpdate\nSceneManagerUpdate --> GameEventPostStep\nGameEventPostStep --> GameRenderPreRender\nGameRenderPreRender --> GameEventPreRenderClear\nGameEventPreRenderClear --> GameEventPreRender\nGameEventPreRender --> SceneManagerRender\nSceneManagerRender --> GameRenderPostRender\nGameRenderPostRender --> GameEventPostRender\nGameEventPostRender --> GameEventPreStep
    "},{"location":"mainloop/#scene-steps","title":"Scene steps","text":"
    graph TB\n\nsubgraph Render\nSceneEventPreRender>\"scene.events: prerender\"]\nSceneCameraRender[\"scene.cameras.render()\"]\nSceneEventRender>\"scene.events: render\"]\nend\n\nsubgraph Update\nSceneEventPreUpdate>\"scene.events: preupdate<br><br>InputPlugin.preUpdate()<br>TweenManager.preUpdate()<br>UpdateList.preUpdate()\"]\nSceneEventUpdate>\"scene.events: update<br><br>TweenManager.update()<br>UpdateList.update()<br>gameObject.preUpdate()\"]\nSceneUpdate[\"scene.update()\"]\nSceneEventPostUpdate>\"scene.events: postupdate\"]\nend\n\n\nSceneEventPreUpdate --> SceneEventUpdate\nSceneEventUpdate --> SceneUpdate\nSceneUpdate --> SceneEventPostUpdate\n\nSceneEventPostUpdate -.-> SceneEventPreRender\nSceneEventPreRender --> SceneCameraRender\nSceneCameraRender --> SceneEventRender
    "},{"location":"mainloop/#rendering-order","title":"Rendering order","text":"
    • For each scene from bottom to top, in game
      • For each camera from bottom to top, in scene
        • For each game object from bottom to top in scene's displayList
          • Render this game object
            • Render children game objects, if game object is a container or a layer

    Note

    A game object can be seen by all cameras of this scene, therefore game object could be rendering more than one times.

    See also Ignore game object

    "},{"location":"markedeventsheet/","title":"Markdown event sheets","text":""},{"location":"markedeventsheet/#introduction","title":"Introduction","text":"

    Event sheets contains main condition(s) and actions, in simple markdown format (headings, code block).

    • Author: Rex
    • Member of scene
    "},{"location":"markedeventsheet/#live-demos","title":"Live demos","text":"
    • Command executor
    "},{"location":"markedeventsheet/#usage","title":"Usage","text":"
    • Sample code
    • Event sheets
    "},{"location":"markedeventsheet/#install-plugin","title":"Install plugin","text":""},{"location":"markedeventsheet/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmarkedeventsheetsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmarkedeventsheetsplugin.min.js', true);\n
    • Add event-sheet-manager object
      var eventSheetManager = scene.plugins.get('rexmarkedeventsheetsplugin').add(config);\n
    "},{"location":"markedeventsheet/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import MarkedEventSheetsPlugin from 'phaser3-rex-plugins/plugins/markedeventsheets-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexMarkedEventSheets',\nplugin: MarkedEventSheetsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add event-sheet-manager object
      var eventSheetManager = scene.plugins.get('rexMarkedEventSheets').add(config);\n
    "},{"location":"markedeventsheet/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import MarkedEventSheets from 'phaser3-rex-plugins/plugins/markedeventsheets.js';\n
    • Add event-sheet-manager object
      var eventSheetManager = new MarkedEventSheets(config);\n
    "},{"location":"markedeventsheet/#create-instance","title":"Create instance","text":"
    var eventSheetManager = scene.plugins.get('rexMarkedEventSheets').add({\ncommandExecutor: Object,\nparallel: false\n});\n
    • commandExecutor : Command executor of actions.
      • This plugin provides a built-in command executor.
    • parallel :
      • false : Test condition then execute event sheet one by one. Default behavior.
      • true : Test all condition of event sheets then execute event sheets one by one.
    "},{"location":"markedeventsheet/#add-event-sheet","title":"Add event sheet","text":"

    Each event sheet belong a group.

    eventSheetManager.addEventSheet(content, {\ncommentLineStart: '\\/\\/',\nlineBreak: '\\\\',\nparallel: undefined,\nactive: true,\nonce: false\n})\n

    or

    eventSheetManager.addEventSheet(content, groupName, {\ncommentLineStart: '\\/\\/',\nlineBreak: '\\\\',\nparallel: undefined,\nactive: true,\nonce: false\n})\n

    or

    eventSheetManager.addEventSheet(content, {\ngroupName: '_'\ncommentLineStart: '\\/\\/',\nlineBreak: '\\\\',\nparallel: undefined,\nactive: true,\nonce: false\n})\n
    • content : See structure of event sheet
    • commentLineStart : Content line start by this symobl (default value is //) will be ignored as a comment line.
    • lineBreak : Markdown will use \\ as line break. So the last character \\ will be discarded.
    • parallel :
      • undefined : Use default parallel property.
    • active :
      • true : Eval condition of this event sheet every round. Default behavior.
      • false : Skip this event sheet.
    • once :
      • true : Set active of this event sheet to false when exection of this event sheet is complete.
      • false : Do nothing when exection of this event sheet is complete. Default behavior.
    • groupName : Each event sheet belong a group. Ignore this parameter to use default group.
      • '_' : Default group name.
    "},{"location":"markedeventsheet/#remove-event-sheet","title":"Remove event sheet","text":"
    • Remove an event sheet in default group
      eventSheetManager.removeEventSheet(title);\n
    • Remove an event sheet in a specific group
      eventSheetManager.removeEventSheet(title, groupName);\n
    • Remove all event sheets in default group
      eventSheetManager.removeAllEventSheets();\n
    • Remove all event sheets in a specific group
      eventSheetManager.removeAllEventSheets(groupName);\n
    "},{"location":"markedeventsheet/#start-running","title":"Start running","text":"

    Starting command will be ignored if group is running.

    "},{"location":"markedeventsheet/#start-running-a-group-of-event-sheets","title":"Start running a group of event sheets","text":"
    • Start running default group
      eventSheetManager.startGroup();\n
    • Start running a specific group of event sheets
      eventSheetManager.startGroup(groupName);\n
    "},{"location":"markedeventsheet/#flow-chart","title":"Flow chart","text":"
    graph TD\n\n    startGroup{{\"startGroup()\"}}  ------>  eventstart>Fire event\\nstart]\n    eventstart --> foreacheventsheet((For each\\nevent sheet))\n    foreacheventsheet --> |Next| activate{activate}\n\n    subgraph Event sheet\n    activate --> |True| condition{\"Test\\n[condition]\"}\n    condition --> |True| enterevent>Fire event\\neventsheet.enter]\n    condition --> |False| eventcatch>Fire event\\neventsheet.catch] \n\n    subgraph Run\n    enterevent --> actions[Run\\nactions\\n...\\n...]\n    actions --> exitevent>Fire event\\neventsheet.exit]    \n    end\n\n    subgraph Catch\n    eventcatch --> catch[\"Run\\n[catch]\"]\n    end\n\n    end\n\n    exitevent --> foreacheventsheet\n    catch --> foreacheventsheet\n\n    activate --> |False| foreacheventsheet\n\n    foreacheventsheet --> eventcomplete>Fire event\\ncomplete]\n    eventcomplete --> endnode{{End}}
    "},{"location":"markedeventsheet/#start-running-a-event-sheet-in-a-group","title":"Start running a event sheet in a group","text":"
    • Start running default group
      eventSheetManager.start();\n
    • Start running an event sheet (indexed by title) without condition testing, in default group.
      eventSheetManager.start(title);\n
    • Start running an event sheet (indexed by title) without condition testing, in a specific group.
      eventSheetManager.start(title, groupName);\n
    • Start running an event sheet (indexed by title) with condition testing, in default group.
      eventSheetManager.start(title, false);\n
    • Start running an event sheet (indexed by title) with condition testing, in a specific group.
      eventSheetManager.start(title, groupName, false);\n
    "},{"location":"markedeventsheet/#start-running-a-group-by-event","title":"Start running a group by event","text":"
    eventSheetManager.startGroup(eventName, groupName);\n// eventSheetManager.startGroup(eventName, groupName, once);\n

    or

    eventSheetManager.startGroup({\neventName:\ngroupName:\nonce: false\n});\n
    "},{"location":"markedeventsheet/#round-counter","title":"Round counter","text":"

    Round counter is started from 0.

    • Increase round counter
      eventSheetManager.updateRoundCounter();\n// eventSheetManager.$roundCounter += 1;\n
    • Set round counter
      eventSheetManager.updateRoundCounter(value);\n// eventSheetManager.$roundCounter = value;\n
    • Get round counter
      var roundCounter = eventSheetManager.getRoundCounter();\n// var roundCounter = eventSheetManager.$roundCounter;\n
    "},{"location":"markedeventsheet/#active","title":"Active","text":"
    • Activate state of event sheet (indexed by title)
      eventSheetManager.setEventSheetActiveState(title);\n// eventSheetManager.setEventSheetActiveState(title, true);\n
    • Inactivate state of event sheet (indexed by title)
      eventSheetManager.setEventSheetActiveState(title, false);\n
    • Get active state of event sheet (indexed by title)
      var active = eventSheetManager.getEventSheetActiveState(title);\n

    Note

    Event sheet which has once property will set active property to false when exection of this event sheet is complete.

    "},{"location":"markedeventsheet/#stop-running","title":"Stop running","text":"

    Stop running a group of event sheet, also fires 'eventsheet.exit' event. And game objects with 'autoClear' will be destroyed.

    • Stop running default group
      eventSheetManager.stopGroup();\n
      or
      eventSheetManager.stop();\n
    • Stop running a specific group of event sheets
      eventSheetManager.stopGroup(groupName);\n
      or
      eventSheetManager.stop(groupName);\n
    "},{"location":"markedeventsheet/#local-memory","title":"Local memory","text":"

    Local memory is shared for all event sheets.

    • Set value
      eventSheetManager.setData(key, value);\n
      or
      eventSheetManager.setData(data);  // data : a plain json object\n
    • Toggle value
      eventSheetManager.toggleData(key, value);\n
    • Increase value
      eventSheetManager.incData(key, inc);\n
    • Get value
      var value = eventSheetManager.getData(key);\n
    • Has key
      var hasData = eventSheetManager.hasData(key);\n
    • Local memory as a dictionary
      var data = eventSheetManager.memory;\n
    "},{"location":"markedeventsheet/#custom-expression","title":"Custom expression","text":"
    eventSheetManager.addExpression(name, callback);\n
    • name : A string value
    • callback : A function object retuen a number
      function(a, b, c, ...) { return x; }\n

    For example :

    eventSheetManager.addExpression('randomInt', function (a, b) {\nreturn Math.floor(a + Math.random() * (b - a + 1));\n});\n

    Expression will store at local memory

    "},{"location":"markedeventsheet/#states","title":"States","text":"
    • Dump state of event sheets of all groups
      var states = eventSheetManager.dumpState();\n
    • Load state of event sheet of all groups
      eventSheetManager.loadState(states);\n
    "},{"location":"markedeventsheet/#events","title":"Events","text":"
    • Start A group of event sheets
      eventSheetManager.on('start', function(groupName, eventSheetManager){ });\n
    • A group of event sheets has been executed completed
      eventSheetManager.on('complete', function(groupName, eventSheetManager){ });\n
    • Enter an event sheet
      eventSheetManager.on('eventsheet.enter', function(title, groupName, eventSheetManager){ });\n
    • Exit an event sheet
      eventSheetManager.on('eventsheet.exit', function(title, groupName, eventSheetManager){ });\n
    • Enter a label (any heading) an event sheet
      eventSheetManager.on('label.enter', function(headingTitle, eventSheetTitle, groupName, eventSheetManager){ });\n
    • Exit a label (any heading) of an event sheet
      eventSheetManager.on('label.exit', function(headingTitle, eventSheetTitle, groupName, eventSheetManager){ });\n
    • Test condition of an event sheet failed
      eventSheetManager.on('eventsheet.catch', function(title, groupName, eventSheetManager){ });\n
    "},{"location":"markedeventsheet/#structure-of-event-sheet","title":"Structure of event sheet","text":"

    Sample

    "},{"location":"markedeventsheet/#main-headings","title":"Main headings","text":"
    # Title\n\ngroupName\nparallel\nactive=false\nonce\n\n## [Condition]\n\ncoin > 5\n\n## Script\n\n## [Catch]\n
    • H1 heading : Title of this event sheet
    • Content under Title (H1 heading) : Setting of this event sheet, optional.
      • groupName : Assign groupName in event sheet, put this event sheet in to that group.
      • parallel : Set parallel property of this event sheet to true.
      • active=false : Set active property of this event sheet to false.
      • once : Set once property of this event sheet to true.
    • H2 heading with [Condition] : Main condition.
      • Each line under [Condition] is a boolean equation, composed of AND logic.
      • Can have many [Condition] heading, each [Condition] heading will be composed of OR logic.
      • Read data from local memory
    • H2/H3/... headings between [Condition] and [Catch] : Actions when main condition is true.
      • Flow control instructions of headings
      • Actions : Custom command
    • H2 heading with [Catch] : Actions when main condition is false.
    "},{"location":"markedeventsheet/#flow-control-instructions","title":"Flow control instructions","text":""},{"location":"markedeventsheet/#if-else-if-else","title":"If, Else if, Else","text":"
    ### [If coin > 10]\n\nactions...\n\n### [Else If (coin > 5) && (coin <10)]\n\nactions...\n\n### [Else]\n\nactions...\n
    • H2/H3/... heading with [If expression], or [Else if expression] : If/Else If condition with expression
      • Read data from local memory
      • Boolean expression AND/OR : &&.
      • Boolean expression OR : ||.
      • Actions when expression is true.
    • H2/H3/... heading with [Else] :
      • Actions when previous expressions are all false.
    ## [If]\n\ncoin > 10\n\n### Label\n\nactions...\n\n## [Else If]\n\ncoin > 5\ncoin < 10\n\n### Label\n\nactions...\n\n## [Else]\n\n### Label\n\nactions...\n
    • H2/H3/... heading with [If], or [Else if] : If, Else If condition
      • Each line under [If], [Else If] is a boolean equation, composed of AND logic.
      • Read data from local memory
    • H3/H4/... heading under [If], [Else if] : - Actions when previous expressions are all false.
    "},{"location":"markedeventsheet/#repeat-loop","title":"Repeat loop","text":"
    ## [Repeat 3]\n\nactions...\n

    or

    ## [Repeat loopCount]\n\nactions...\n

    or

    ## [Repeat 3]\n\n### Label\n\nactions...\n
    • H2/H3/... heading with [Repeat N], or [Repeat var] : Repeat loop N times
    "},{"location":"markedeventsheet/#while-loop","title":"While loop","text":"
    ## [While loopCount > 0]\n\nactions...\n
    • H2/H3/... heading with [While expression] : While loop with expression
      • Read data from local memory
      • Actions when expression is true.
    ## [While]\n\nloopCount > 0\n\n### Label\n\nactions...\n
    • H2/H3/... heading with [While] : While loop
      • Each line under [While] is a boolean equation, composed of AND logic.
      • Read data from local memory
    • H3/H4/... heading under [While] : Actions running when condition is true
    "},{"location":"markedeventsheet/#break","title":"Break","text":"
    [break]\n
    • Action line with [break] : Ignore remainder actions in current label (heading).
    "},{"location":"markedeventsheet/#exit","title":"Exit","text":"
    [exit]\n
    • Action line with [exit] : Skip remainder label (heading) and actions.
    "},{"location":"markedeventsheet/#deactivate","title":"Deactivate","text":"
    [deactivate]\n

    or

    [deactivate title]\n
    • Action line with [deactivate], or [deactivate title] : Deactivate this event sheet, or deactivate event sheet by title in the same tree group. i.e. Set active property of this event shhet to false.
    "},{"location":"markedeventsheet/#activate","title":"Activate","text":"
    [activate]\n

    or

    [activate title]\n
    • Action line with [activate], or [activate title] : Activate this event sheet, or activate event sheet by title in the same tree group. i.e. Set active property of this event shhet to true.
    "},{"location":"markedeventsheet/#custom-command","title":"Custom command","text":"
    commandName\n  param0=value\n  param1=value\n
    • Each command is divided by space line. i.e. add space lines above and below command.
    • First line is the command name.
      1. Invoke commandExecutor.commandName method if this commandName method is existed.
        commandName(config, eventSheetManager) {\n// var resumeCallback = eventSheetManager.pauseEventSheet();\n// ... \n// resumeCallback()\n}\n
        • config : Parameter and value in a dictionary.
        • eventSheetManager : This event mangager.
          • Pause running of current event sheet
            var resumeCallback = eventSheetManager.pauseEventSheet();  //  resumeCallback();  // Resume running of current event sheet      \n
          • Pause running of current event sheet until another eventName firing from eventEmitter
            eventSheetManager.pauseEventSheetUnitlEvent(eventEmitter, eventName);\n
      2. Otherwise, invoke commandExecutor.defaultHandler.
        defaultHandler(commandName, config, eventSheetManager) {\n// var resumeCallback = eventSheetManager.pauseEventSheet();\n// ... \n// resumeCallback()\n}\n
        • commandName : Command name.
        • config : Parameter and value in a dictionary.
        • eventSheetManager : This event mangager.
          • Pause running of current event sheet
            var resumeCallback = eventSheetManager.pauseEventSheet(); //  resumeCallback();  // Resume running of current event sheet\n
          • Pause running of current event sheet until another eventName firing from eventEmitter
            eventSheetManager.pauseEventSheetUnitlEvent(eventEmitter, eventName);\n
    • Remainder lines are parameter composed of parameter name and value, with =
      • Space characters at line start will be discarded.
      • Value will be parsed to number, boolean, or string.
        • String value contains {{, and }} will be interpolation by mustache template syntax, return a string value.
        • String value wrapped by #( ) will be treated as expression, return a number value.
    • Any line start with // will be ignored as comment line.

    For multiple lines parameter :

    ```commandName,param0=value,param1=value\nline0\nline1\nline2\n```\n
    • Lines in code block will be assigned to text parameter.

    So it will be equal to

    commandName\n  text=...\n  param0=value\n  param1=value\n
    • '\\n'
    "},{"location":"markedeventsheet/#command-executor","title":"Command executor","text":"

    A command executor for phaser3 engine.

    "},{"location":"markedeventsheet/#create-command-executor-instance","title":"Create command executor instance","text":"
    var commandExecutor = scene.plugins.get('rexMarkedEventSheets').addCommandExecutor(scene, {\n// layers: ['layer0', 'layer1', ...]\n// layers: [{name, cameraName}, ...]\n\n// layerDepth: undefined,\n// rootLayer: undefined,\n\nlog: {\ndelimiters: '[]'\nenable: true\n}\n});\n\n// Add to event sheet manager\n// var eventSheetManager = scene.plugins.get('rexMarkedEventSheets').add({\n//     commandExecutor: commandExecutor\n// });\n

    or

    // import MarkedEventSheets from 'phaser3-rex-plugins/plugins/markedeventsheets.js';\n// import CommandExecutor from 'phaser3-rex-plugins/plugins/commandexecutor.js';\n\nvar commandExecutor = new CommandExecutor(scene, config);\n\n// var eventSheetManager = new MarkedEventSheets({\n//     commandExecutor: commandExecutor\n// });\n
    • layers : Add some initial layers
      • A string array : Add layers by string name
      • A array of plain object { name, cameraName }
        1. Add layer by string name
        2. Bind this layer to dedicate camera (indexed by cameraName), ignore other cameras Add a new camera if this target camera is not existing
    • layerDepth : Set depth to each layer game object.
      • undefined : Keep default depth value (0)
    • rootLayer : Add all layer game objects created by layer-manager into this root layer.
    • log : Configuration of BBCodeLog
      • log.delimiters : String of left-delimiter and right-delimiter.
        • A single string with 2 characters. Default value is '[]'.
        • A array with 2 strings
      • log.enable :
        • true : Can print message on console. Default behavior.
        • false : Don't print any message on console.
    "},{"location":"markedeventsheet/#local-memory-of-event-sheet-manager","title":"Local memory of event sheet manager","text":"
    • Set value by key
      setData\n  key=value\n
    • Increase value of key
      incData\n  key=value\n
      or
      setData\n  key=#(key+value)\n
    • Toggle value of key
      toggleData\n  key\n

    See Local memory

    "},{"location":"markedeventsheet/#bbcode-log","title":"BBCode Log","text":""},{"location":"markedeventsheet/#print-message-on-console","title":"Print message on console","text":"
    log\n  text=...\n

    or

    log\n  text=...\n  // logType='log'\n  // showTitle=true\n  // title\n  // titleColor='green'\n
    • text : Message with bbcode format.
      • [color=gold]...[/color]
      • [bgcolor=green]...[/bgcolor]
      • [b]...[/b]
      • [i]...[/i]
      • [u]...[/u]
    • logType :
      • 'log' : console.log. Default value.
      • 'warn': console.warn
    • showTitle
      • true : Show title before text message. Default behavior.
      • false : Don't show title.
    • title
      • undefined : Using title of current event sheet. Default behavior.
      • A string, custom string before text message.
    • titleColor : Background color of title block, default value is 'green'
    "},{"location":"markedeventsheet/#disable-console-message","title":"Disable console message","text":"
    log.disable\n
    • Disable console message of current event sheet.

    or

    log.disable\n  title=...\n
    • title : Disable console message of event sheet by title.
    "},{"location":"markedeventsheet/#enable-console-message","title":"Enable console message","text":"
    log.enable\n
    • Enable console message of current event sheet.

    or

    log.enable\n  title=...\n
    • title : Enable console message of event sheet by title.
    "},{"location":"markedeventsheet/#dump-memory","title":"Dump memory","text":"
    log.memory\n
    • Dump all key in memory

    or

    log.memory\n  text=...\n  keys=a,b,c\n
    • keys : Dump part of memory by keys.
    • text : Message with bbcode format.
    "},{"location":"markedeventsheet/#game-object","title":"Game object","text":""},{"location":"markedeventsheet/#register-custom-game-object","title":"Register custom game object","text":"
    commandExecutor.addGameObjectManager({\nname: GOTYPE,\n\nviewportCoordinate: false,\n// viewportCoordinate: { viewport: new Phaser.Geom.Rectangle() },\n\nfade: 500,\n// fade: {mode: 'tint', time: 500},\n\ndefaultLayer: layerName,\n\nautoClear: true,\n\ncommands: {\ncommandName(gameObject, config, commandExecutor, eventSheetManager, eventSheet) {\n// commandExecutor.waitEvent(eventEmitter, eventName);\n}\n}\n})\n
    • name : A string name of game object's type. Will register command GOTYPE to this command executor.
    • createGameObject : A callback for creating game object
      function(scene, config) {\nreturn gameObject;\n}\n
      • config : Parameters passed from event sheet.
        • id, layer, autoClear, eventSheetManager, eventsheet : These parameters are reserved.
        • eventSheetManager : This event sheet manager.
    • viewportCoordinate : Apply viewportCoordinate behavior to game object.
      • true : Attach vpx, vpy, vp to sprite game object.
        • vpx, vpy : Number between 0~1. Proportion of viewport.
        • vp : Viewport in rectangle
      • false : Do nothing, default behavior.
    • fade :
      • 0 : No fade-in or fade-out when adding or removing a sprite.
      • A number : Duration of fading. Default value is 500.
      • A plain object contains mode, time
        • fade.mode : Fade mode
          • 'tint', or 0 : Fade-in or fade-out via tint property.
          • 'alpha', or 1 : Fade-in or fade-out via alpha property.
          • 'revealUp', or 2 : Reveal up for fade-in.
          • 'revealDown', or 3 : Reveal down for fade-in.
          • 'revealLeft', or 4 : Reveal left for fade-in.
          • 'revealRight', or 5 : Reveal right for fade-in.
        • fade.time : Duration of fading. Default value is 500.
    • defaultLayer : A layer name defined in layers parameter of addCommandExecutor method
    • autoClear :
      • true : Clear game objects when exiting current event sheet. Default behavior.
      • false : Ignore this behavior.
    • commands : Custom commands, each command is a callback indexed by command name
      commandName: function(gameObject, config, commandExecutor, eventSheetManager) {\n// commandExecutor.waitEvent(eventEmitter, eventName);\n}\n
      • commandName : Command name. These command names are reserved : to, yoyo, destroy
      • gameObject : Game object instance.
      • config : Parameters passed from event sheet.
      • commandExecutor : This command executor instance. See also
      • eventSheetManager : This event sheet manager instance.
        • Store variable into blackboard of eventSheetManager : eventSheetManager.setData(key, value)
    "},{"location":"markedeventsheet/#create-custom-game-object","title":"Create custom game object","text":"
    GOTYPE\n  id=NAME\n  layer=\n  autoClear=\n  param0=value\n  param1=value\n
    • Create custom game object GOTYPE with config {param0, param1}, indexed by id
    • layer : Put this game object at layer.
      • undefined : Put this game object at default layer
    • autoClear : Clear game objects when exiting current event sheet.
      • undefined : Use default value of autoClear

    Reserved id : time, click, key, bgm, bgm2, se, se2, camera.

    Will store reference of this game object into memory at key @NAME, can see it by log.memory, or get property of game object via #(@NAME.x + 3).

    "},{"location":"markedeventsheet/#set-properties-of-custom-game-object","title":"Set properties of custom game object","text":"
    • Set properties of a game object indexing by NAME
      NAME.set\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n
      • vpx, vpy : viewportCoordinate properties injected if viewportCoordinate is true.
      • Add empty line above and below this command block.
    • Set properties of all game objects belong GOTYPE
      GOTYPE.set\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n
    • Set properties of all game objects belong GOTYPE excluding NAME
      !NAME.set\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n
    "},{"location":"markedeventsheet/#ease-properties-of-custom-game-object","title":"Ease properties of custom game object","text":"
    • Ease properties of a game object indexing by NAME
      NAME.to\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      NAME.from\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      NAME.yoyo\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      • These properties are reserved : id, duration, delay, ease, repeat, yoyo, wait
      • wait :
        • false : Run next command immediately. Default behavior.
        • true : Run next command after playing sound complete.
      • Add empty line above and below this command block.
    • Ease properties of all game objects belong GOTYPE
      GOTYPE.to\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      GOTYPE.from\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      GOTYPE.yoyo\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
    • Ease properties of all game objects belong GOTYPE excluding NAME
      !NAME.to\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      !NAME.from\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      !NAME.yoyo\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
    "},{"location":"markedeventsheet/#invoke-custom-command","title":"Invoke custom command","text":"
    • Invoke custom command of a game object indexing by NAME
      NAME.commandName\n  param0=value\n  param1=value\n
      • Invoke custom command commandName method with these parameters
        • gameObject : Indexed by NAME
        • config : {param0, param1}
      • Add empty line above and below this command block.
      • value :
        • For string value, characters \\n (2 characters) will be replaced by \\n new line character (1 character)
    • Invoke custom command of all game objects belong GOTYPE
      GOTYPE.commandName\n  param0=value\n  param1=value\n
    • Invoke custom command of all game objects belong GOTYPE excluding NAME
      !NAME.commandName\n  param0=value\n  param1=value\n

    Do nothing if gameObject or commandName is not found.

    "},{"location":"markedeventsheet/#destroy-custom-game-object","title":"Destroy custom game object","text":"
    • Destroy game object indexing by NAME
      NAME.destroy\n
    • Destroy all game objects belong GOTYPE
      GOTYPE.destroy\n
    • Destroy all game objects belong GOTYPE excluding NAME
      !NAME.destroy\n
    "},{"location":"markedeventsheet/#methods-used-in-command","title":"Methods used in command","text":"
    • Hold command execution until eventEmitter emits eventName event.
      commandExecutor.waitEvent(eventEmitter, eventName);\n
    • Apply value to property of
      commandExecutor.setGOProperty({\ngoType, id, property, ... });\n
      • goType : GameObject type assigned by commandExecutor.addGameObjectManager({name...}).
      • id : NAME of game object, which will store in gameObject.name.
        • gameObject.name : Apply value to property of this game object.
        • '!' + gameObject.name : Apply value to property of all game objects exclude this game object.
        • undefined : All game objects.
      • propertyName: value : Assign value to property. Can assign one or many properties.
    • Ease value of game object(s)' property
      if (wait) {\ncommandExecutor.setWaitEventFlag();\n}\ncommandExecutor.easeGOProperty({\ngoType, id, duration, ease, repeat, yoyo, wait, property, ... });\n
      • goType : GameObject type assigned by commandExecutor.addGameObjectManager({name...}).
      • id : NAME of game object, which will store in gameObject.name.
        • gameObject.name : Apply value to property of this game object.
        • '!' + gameObject.name : Apply value to property of all game objects exclude this game object.
        • undefined : All game objects.
      • duration : Duration of easing task.
      • ease : Ease function
      • repeat : Repeat times.
      • yoyo : Yoyo flag.
      • wait : Wait until easing task complete.
        • Invoke commandExecutor.setWaitEventFlag().
      • propertyName: value : Ease value of property. Can assign one or many properties.
    "},{"location":"markedeventsheet/#wait","title":"Wait","text":""},{"location":"markedeventsheet/#wait-click","title":"Wait click","text":"
    click\n
    • Run next command after clicking.
    "},{"location":"markedeventsheet/#wait-any","title":"Wait any","text":"

    Run next command after...

    wait\n  click\n  key=keyName\n  time=\n  GONAME.destroy\n  GONAME.PROPNAME\n  GONAME.DATAKEY\n  GONAME.EVTNAME\n  event=EVENTNAME\n
    • click : Run next command after clicking.
    • key : Run next command after key down
    • time : Run next command after time-out.
    • GONAME.destroy : Run next command after game object has destroyed.
    • GONAME.PROPNAME (ex. GONAME.x) : Run next command after game object's property tween complete
    • GONAME.DATAKEY, GONAME.!DATAKEY (ex. GONAME.!hp) : Run next command after game object's data is true (or > 0) or false (or <= 0). Will check PROPNAME first.
    • GONAME.EVTNAME : Run next command after game object's EVTNAME firing. Will check PROPNAME and DATAKEY first.
    • event : Run next command after eventSheetManager firing EVENTNAME event.

    Emit these events from eventSheetManager

    • Wait click or key down
      eventSheetManager.on('pause.input', function(){ });\n
      • Resume (run next command)
        eventSheetManager.on('resume.input', function(){ });\n
    • Wait click only
      eventSheetManager.on('pause.click', function(){ });\n
    • Wait key down only
      eventSheetManager.on('pause.key', function(keyName){ });\n
    "},{"location":"markedeventsheet/#sound","title":"Sound","text":"

    This command executor provides

    • 2 background music tracks : bgm, bgm2
    • 2 sound effects : se, se2.
    "},{"location":"markedeventsheet/#sound-properties","title":"Sound properties","text":"
    bgm.set\n  volume\n  mute\n  unmute\n
    • Command name : bgm, bgm2, se, se2
    "},{"location":"markedeventsheet/#play-sound","title":"Play sound","text":"
    bgm.play\n  key=\n  // volume\n  // detune\n  // rate\n  fadeIn=0\n  // loop\n  wait=false\n
    • Command name : bgm.play, bgm2.play, se.play, se2.play
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after playing sound complete.
    "},{"location":"markedeventsheet/#cross-fade-in-sound","title":"Cross fade in sound","text":"
    bgm.cross\n  key=\n  duration=500\n  wait=false\n
    • Command name : bgm.cross, bgm2.cross
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after playing sound complete.
    "},{"location":"markedeventsheet/#stop-sound","title":"Stop sound","text":"
    bgm.stop\n
    • Command name : bgm.stop, bgm2.stop, se.stop, se2.stop
    "},{"location":"markedeventsheet/#fade-out-sound","title":"Fade out sound","text":"
    bgm.fadeOut\n  duration=500\n  stop=true\n  wait=false\n
    • Command name : bgm.fadeOut, bgm2.fadeOut, se.fadeOut, se2.fadeOut
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after playing sound complete.
    "},{"location":"markedeventsheet/#fade-in-sound","title":"Fade in sound","text":"
    bgm.fadeIn\n  duration=500\n
    • Command name : bgm.fadeIn, bgm2.fadeIn
    "},{"location":"markedeventsheet/#pause-sound","title":"Pause sound","text":"
    bgm.pause\n
    • Command name : bgm.pause, bgm2.pause
    "},{"location":"markedeventsheet/#resume-sound","title":"Resume sound","text":"
    bgm.resume\n
    • Command name : bgm.resume, bgm2.resume
    "},{"location":"markedeventsheet/#mute-sound","title":"Mute sound","text":"
    bgm.mute\n
    • Command name : bgm.mute, bgm2.mute, se.mute, se2.mute
    "},{"location":"markedeventsheet/#unmute-sound","title":"Unmute sound","text":"
    bgm.unmute\n
    • Command name : bgm.unmute, bgm2.unmute, se.unmute, se2.unmute
    "},{"location":"markedeventsheet/#camera","title":"Camera","text":""},{"location":"markedeventsheet/#camera-properties","title":"Camera properties","text":"
    camera.set\n  x=\n  y=\n  rotate=\n  zoom=\n  name\n
    • x, y : Scroll
    • rotate : Rotate in degree
    • zoom : Zoom
    • name : Target camera indexed by name. Default is main camera.

    Run next command immediately.

    "},{"location":"markedeventsheet/#fade-in","title":"Fade in","text":"
    camera.fadeIn\n  duration=1000\n  red\n  green\n  blue\n  name\n  wait=false\n
    • duration, red, green, blue : See fade effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#fade-out","title":"Fade out","text":"
    camera.fadeOut\n  duration=1000\n  red\n  green\n  blue\n  name\n  wait=false\n
    • duration, red, green, blue : See fade effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#flash","title":"Flash","text":"
    camera.flash\n  duration=1000\n  red\n  green\n  blue\n  name\n  wait=false\n
    • duration, red, green, blue : See flash effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#shake","title":"Shake","text":"
    camera.shake\n  duration=1000\n  intensity\n  name\n  wait=false\n
    • duration, intensity : See shake effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#zoom","title":"Zoom","text":"
    camera.zoomTo\n  duration=1000\n  zoom\n  name\n  wait=false\n
    • duration, zoom : See zoom effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#rotate-to","title":"Rotate to","text":"
    camera.rotateTo\n  duration=1000\n  rotate\n  ease\n  name\n  wait=false\n
    • duration, rotate, ease : See rotateTo effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#scroll-to","title":"Scroll to","text":"
    camera.scrollTo\n  duration=1000\n  x\n  y\n  ease\n  name\n  wait=false\n
    • duration, x, y, ease : Scroll to position.
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#add-custom-command","title":"Add custom command","text":"
    commandExecutor.addCommand(commandName, function(config, eventSheetManager){\n// var resumeCallback = eventSheetManager.pauseEventSheet();\n// ... \n// resumeCallback()\n}, scope);\n
    • config : Parameters passed from event sheet.
    • eventSheetManager : This event mangager.
      • Pause running of current event sheet
        var resumeCallback = eventSheetManager.pauseEventSheet();\n//  resumeCallback();  // Resume running of current event sheet\n
      • Pause running of current event sheet until another eventName firing from eventEmitter
        eventSheetManager.pauseEventSheetUnitlEvent(eventEmitter, eventName);\n
    "},{"location":"mask/","title":"Mask","text":""},{"location":"mask/#introduction","title":"Introduction","text":"

    Apply mask on game object. Built-in render of phaser.

    • Author: Richard Davey
    "},{"location":"mask/#usage","title":"Usage","text":""},{"location":"mask/#add-mask","title":"Add mask","text":""},{"location":"mask/#create-mask-object","title":"Create mask object","text":""},{"location":"mask/#bitmap-mask","title":"Bitmap mask","text":"
    1. Create image (image, sprite, bitmap text, particles, text),or shader
      var shape = scene.add.image(x, y, key).setVisible(false);\n
    2. Create mask
      var mask = shape.createBitmapMask();\n
      or
      var mask = scene.add.bitmapMask(shape);\n

    or

    var mask =  scene.add.bitmapMask(undefined, x, y, key, frame);\n
    "},{"location":"mask/#geometry-mask","title":"Geometry mask","text":"

    The mask is essentially a clipping path which can only make a masked pixel fully visible or fully invisible without changing its alpha (opacity).

    1. Create graphics
      var shape = scene.make.graphics();\n
    2. Create mask
      var mask = shape.createGeometryMask();\n
    "},{"location":"mask/#apply-mask-object","title":"Apply mask object","text":"
    gameObject.setMask(mask); // image.mask = mask;\n

    A mask object could be added to many game objects.

    Error

    Don't put game object and its mask into a container together. See this testing, enable line 22-24.

    Note

    Bitmap Mask is WebGL only.

    Note

    Can combine Geometry Masks and Blend Modes on the same Game Object, but Bitmap Masks can't.

    "},{"location":"mask/#clear-mask","title":"Clear mask","text":"
    • Clear mask
      image.clearMask();\n
    • Clear mask and destroy mask object
      image.clearMask(true);\n
    "},{"location":"mask/#invert-alpha","title":"Invert alpha","text":"

    Only GeometryMask has inverse alpha feature.

    • Inverse alpha
      mask.setInvertAlpha();\n// mask.invertAlpha = true;\n
    • Disable
      mask.setInvertAlpha(false);\n// mask.invertAlpha = false;\n
    "},{"location":"mask/#get-shape-game-object","title":"Get shape game object","text":"
    • Bitmap mask
      var shape = mask.bitmapMask;\n
    • Geometry mask
      var shape = mask.geometryMask;\n
    "},{"location":"matterjs-attractor/","title":"Attractor","text":""},{"location":"matterjs-attractor/#introduction","title":"Introduction","text":"

    Apply continual forces on bodies.

    • Reference
    "},{"location":"matterjs-attractor/#usage","title":"Usage","text":""},{"location":"matterjs-attractor/#system-configuration","title":"System configuration","text":"
    • Game config
      var config = {\n// ...\nphysics: {\nmatter: {\n// ...\nplugins: {\nattractors: true,\n// ...\n}\n// ...\n}\n}\n// ...\n}\nvar game = new Phaser.Game(config);\n
    • Runtime
      scene.matter.system.enableAttractorPlugin();\n
    "},{"location":"matterjs-attractor/#matter-object-configuration","title":"Matter object configuration","text":"
    var options = {\n// ...\nplugin: {\nattractors: [\ncallback,\n// ...\n]\n},\n// ...\n}\n
    • callback :
      • Retuen a force ({x,y}), which will be applied to bodyB
        function(bodyA, bodyB) {\nreturn {x, y}; // Force\n}\n
        • bodyA : Attractor matter object.
        • bodyB : Other matter object.
      • Apply forece to bodies directly.
        function(bodyA, bodyB) {\nbodyA.gameObject.applyForce({x, y});\nbodyB.gameObject.applyForce({x, y});\n}\n
        • bodyA : Attractor matter object.
          • bodyA.gameObject : Game object.
        • bodyB : Other matter object.
          • bodyB.gameObject : Game object.
    "},{"location":"matterjs-gameobject/","title":"Game object","text":""},{"location":"matterjs-gameobject/#introduction","title":"Introduction","text":"

    Matterjs physics Image/Sprite/Group object.

    • Author: Richard Davey
    "},{"location":"matterjs-gameobject/#usage","title":"Usage","text":""},{"location":"matterjs-gameobject/#add-physics-object","title":"Add physics object","text":"

    Enable physics world

    "},{"location":"matterjs-gameobject/#image-object","title":"Image object","text":"
    var image = scene.matter.add.image(x, y, key, frame);\n// var image = scene.matter.add.image(x, y, key, frame, config);\n
    • config : Config object
    "},{"location":"matterjs-gameobject/#sprite-object","title":"Sprite object","text":"
    var image = scene.matter.add.sprite(x, y, key, frame);\n// var image = scene.matter.add.sprite(x, y, key, frame, config);\n
    • config : Config object
    "},{"location":"matterjs-gameobject/#any-game-object","title":"Any game object","text":"
    var gameObject = scene.matter.add.gameObject(gameObject);\n// var gameObject = scene.matter.add.gameObject(gameObject, config);\n
    • config : Config object
    "},{"location":"matterjs-gameobject/#image-composite","title":"Image composite","text":"

    Create a new composite containing Matter Image objects created in a grid arrangement.

    var composite = scene.matter.add.imageStack(key, frame, x, y, columns, rows);\n// var composite = scene.matter.add.imageStack(key, frame, x, y, columns, rows, columnGap, rowGap, options);\n
    • key, frame : Texture key and frame name.
    • x, y : Top-left position of these game objects.
    • columns, rows : The number of columns/rows in the grid.
    • columnGap, rowGap : The distance between each column/row.
    • config : Config object
    • composite : Composite matter object.
      • composite.bodies : An array of bodies.
    "},{"location":"matterjs-gameobject/#config","title":"Config","text":"
    {\nlabel: 'Body',\nshape: 'rectangle',\nchamfer: null,\n\nisStatic: false,\nisSensor: false,\nisSleeping: false,\nignoreGravity: false,\nignorePointer: false,\n\nsleepThreshold: 60,\ndensity: 0.001,\nrestitution: 0,\nfriction: 0.1,\nfrictionStatic: 0.5,\nfrictionAir: 0.01,\n\nforce: { x: 0, y: 0 },\nangle: 0,\ntorque: 0,\n\ncollisionFilter: {\ngroup: 0,\ncategory: 0x0001,\nmask: 0xFFFFFFFF,\n},\n\n// parts: [],\n\n// plugin: {\n//     attractors: [\n//         (function(bodyA, bodyB) { return {x, y}}),\n//     ]\n// },\n\nslop: 0.05,\n\ntimeScale: 1,\n}\n
    • label : An arbitrary String name to help the user identify and manage bodies.
    • shape :
      • A string : 'rectangle', 'circle', 'trapezoid', 'polygon', 'fromVertices', 'fromPhysicsEditor'
      • An object :
        • Rectangle shape
          {\ntype: 'rectangle',\n// width: gameObject.width\n// height: gameObject.height\n}\n
        • Circle shape
          {\ntype: 'circle',\n// radius: (Math.max(gameObject.width, gameObject.height) / 2),\n// maxSides: 25\n}\n
        • Trapezoid shape
          {\ntype: 'trapezoid',\n// slope: 0.5,\n}\n
        • Polygon shape
          {\ntype: 'polygon',\n// radius: (Math.max(gameObject.width, gameObject.height) / 2),\n// sides: 5,\n}\n
        • Vertices
          {\ntype: 'fromVertices',\nverts: points,\n// flagInternal: false,\n// removeCollinear: 0.01,\n// minimumArea: 10,\n}\n
          • points :
            • A string : 'x0 y0 x1 y1 ...'
            • An array of points : [{x:x0, y:y0}, {x:x1, y:y1}, ...]
    • chamfer :
      • null
      • A number
      • {radius: value}
      • {radius: [topLeft, topRight, bottomRight, bottomLeft]}
    • isStatic : A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed.
    • isSensor : A flag that indicates whether a body is a sensor. Sensor triggers collision events, but doesn't react with colliding body physically.
    • isSleeping : A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken.
    • sleepThreshold : The number of updates in which this body must have near-zero velocity before it is set as sleeping.
    • density : Density of the body, that is its mass per unit area.
    • restitution : The restitution/bounce/elasticity of the body. The value is always positive and is in the range (0, 1).
      • 0 : Collisions may be perfectly inelastic and no bouncing may occur.
      • 0.8 : The body may bounce back with approximately 80% of its kinetic energy.
    • friction : Friction of the body. The value is always positive and is in the range (0, 1).
      • 0 : The body may slide indefinitely.
      • 1 : The body may come to a stop almost instantly after a force is applied.
    • frictionStatic : The static friction of the body (in the Coulomb friction model).
      • 0 : The body will never 'stick' when it is nearly stationary and only dynamic friction is used.
      • 10 : The higher the value, the more force it will take to initially get the body moving when nearly stationary.
    • frictionAir : The air friction of the body (air resistance).
      • 0 : The body will never slow as it moves through space.
      • The higher the value, the faster a body slows when moving through space.
    • force : The force to apply in the current step.
    • angle : Angle of the body, in radians.
    • torque : the torque (turning force) to apply in the current step.
    • collisionFilter : An Object that specifies the collision filtering properties of this body.
      • collisionFilter.group
      • collisionFilter.category : A bit field that specifies the collision category this body belongs to.
      • collisionFilter.mask : A bit mask that specifies the collision categories this body may collide with.
    • slop : A tolerance on how far a body is allowed to 'sink' or rotate into other bodies.
      • The default should generally suffice, although very large bodies may require larger values for stable stacking.
    "},{"location":"matterjs-gameobject/#collision","title":"Collision","text":"

    Collisions between two bodies will obey the following rules:

    • (grpupA > 0) && (groupB > 0) :
      • Collision = (groupA == groupB)
    • (grpupA == 0) || (groupB == 0) :
      • Collision = ((categoryA & maskB) !== 0) && ((categoryB & maskA) !== 0)
    "},{"location":"matterjs-gameobject/#movement","title":"Movement","text":""},{"location":"matterjs-gameobject/#velocity","title":"Velocity","text":"
    gameObject.setVelocity(x, y);\n
    gameObject.setVelocityX(x);\n
    gameObject.setVelocityY(x);\n
    "},{"location":"matterjs-gameobject/#acceleration","title":"Acceleration","text":""},{"location":"matterjs-gameobject/#force","title":"Force","text":"
    • Applies a force to a body.
      gameObject.applyForce(force);\n
      • force : {x, y}
    • Applies a force to a body from a given position.
      gameObject.applyForceFrom(position, force); // position, force: {x, y}\n
      • position : {x, y}
      • force : {x, y}
    • Apply thrust to the forward position of the body.
      gameObject.thrust(speed);\n
      • speed : A number.
    • Apply thrust to the left position of the body.
      gameObject.thrustLeft(speed);\n
      • speed : A number.
    • Apply thrust to the right position of the body.
      gameObject.thrustRight(speed);\n
      • speed : A number.
    • Apply thrust to the back position of the body.
      gameObject.thrustBack(speed);\n
      • speed : A number.
    • Apply thrust to the back position of the body.
      gameObject.thrustBack(speed);\n
      • speed : A number.
    "},{"location":"matterjs-gameobject/#gravity","title":"Gravity","text":"
    • Ignore world gravity
      gameObject.setIgnoreGravity(ignore);\n
      • ignore : Set to true to ignore the effect of world gravity
    "},{"location":"matterjs-gameobject/#friction","title":"Friction","text":"
    gameObject.setFriction(value, air, fstatic);\n
    gameObject.setFrictionAir(v);\n
    gameObject.setFrictionStatic(v);\n
    "},{"location":"matterjs-gameobject/#rotation","title":"Rotation","text":""},{"location":"matterjs-gameobject/#fixed-rotation","title":"Fixed rotation","text":"
    gameObject.setFixedRotation();\n
    "},{"location":"matterjs-gameobject/#angular-velocity","title":"Angular velocity","text":"
    gameObject.setAngularVelocity(v);\n
    "},{"location":"matterjs-gameobject/#collision_1","title":"Collision","text":""},{"location":"matterjs-gameobject/#enable","title":"Enable","text":"
    • Get
      var isSensor = gameObject.isSensor();\n
    • Set
      gameObject.setSensor(value);\n
      • value : Set true to enable sensor.
    "},{"location":"matterjs-gameobject/#collision-group","title":"Collision group","text":"
    • Collision grpup
      gameObject.setCollisionGroup(value);\n
    • Collision category
      1. Get new collision category
        var category = scene.matter.world.nextCategory();\n
        • category : An one-shot number (1, 2, 4, 8, ...., 2147483648 (1<<31))
      2. Set collision category of game object
        gameObject.setCollisionCategory(category);\n
      3. Set category mask
        gameObject.setCollidesWith([categoryA, categoryB, ...]);\n// gameObject.setCollidesWith(categoryA);\n
    "},{"location":"matterjs-gameobject/#collision-event","title":"Collision event","text":"
    scene.matter.world.on('collisionstart', function (event, bodyA, bodyB) {\n// var pairs = event.pairs;\n});\n
    • event :
      • event.pairs : An array of collision pairs
        • event.pairs[i].bodyA, event.pairs[i].bodyB : Matter body object.
          • body.gameObject : Game object of matter body.
    • bodyA, bodyB : Equal to event.pairs[0].bodyA, event.pairs[0].bodyB.
    "},{"location":"matterjs-gameobject/#collision-bound","title":"Collision bound","text":"
    • Rectangle
      gameObject.setRectangle(width, height, options);\n
    • Circle
      gameObject.setCircle(radius, options);\n
    • Polygon
      gameObject.setPolygon(radius, sides, options);\n
    • Trapezoid
      gameObject.setTrapezoid(width, height, slope, options);\n
    • Any
      gameObject.setBody(config, options);\n
      • config :
        • Rectangle shape
          {\ntype: 'rectangle',\n// width: gameObject.width\n// height: gameObject.height\n}\n
        • Circle shape
          {\ntype: 'circle',\n// radius: (Math.max(gameObject.width, gameObject.height) / 2),\n// maxSides: 25\n}\n
        • Trapezoid shape
          {\ntype: 'trapezoid',\n// slope: 0.5,\n}\n
        • Polygon shape
          {\ntype: 'polygon',\n// radius: (Math.max(gameObject.width, gameObject.height) / 2),\n// sides: 5,\n}\n
    "},{"location":"matterjs-gameobject/#bounce","title":"Bounce","text":"
    gameObject.setBounce(v);\n
    • restitution
    "},{"location":"matterjs-gameobject/#mass","title":"Mass","text":"
    gameObject.setMass(v);\n
    gameObject.setDensity(v);\n
    "},{"location":"matterjs-gameobject/#sleep","title":"Sleep","text":""},{"location":"matterjs-gameobject/#enable_1","title":"Enable","text":"
    var config = {\n// ...\nphysics: {\nmatter: {\n// ...\nenableSleeping: true\n// ...\n}\n}\n\n}\n
    "},{"location":"matterjs-gameobject/#sleep-threshold","title":"Sleep threshold","text":"
    gameObject.setSleepThreshold(value);\n
    "},{"location":"matterjs-gameobject/#sleep-events","title":"Sleep events","text":"
    • Sleeping start
      scene.matter.world.on('sleepstart', function (event, body) {\n});\n
    • Sleeping end
      scene.matter.world.on('sleepend', function (event, body) {\n});\n
    "},{"location":"matterjs-world/","title":"World","text":""},{"location":"matterjs-world/#introduction","title":"Introduction","text":"

    Matter physics engine in phaser.

    • Author: Richard Davey
    "},{"location":"matterjs-world/#usage","title":"Usage","text":""},{"location":"matterjs-world/#configuration","title":"Configuration","text":"
    var config = {\n// ...\nphysics: {\ndefault: 'matter',\nmatter: {\n//    enabled: true,\n//    positionIterations: 6,\n//    velocityIterations: 4,\n//    constraintIterations: 2,\n//    enableSleeping: false,\n//    plugins: {\n//        attractors: false,\n//        wrap: false,\n//    },\n//    gravity: {\n//        x: 0,\n//        y: 0,\n//    }\n//    setBounds: {\n//        x: 0,\n//        y: 0,\n//        width: scene.sys.scale.width,\n//        height: scene.sys.scale.height,\n//        thickness: 64,\n//        left: true,\n//        right: true,\n//        top: true,\n//        bottom: true,\n//    },\n//    timing: {\n//        timestamp: 0,\n//        timeScale: 1,\n//    },\n//    correction: 1,\n//    getDelta: (function() { return 1000 / 60; }),\n//    autoUpdate: true,\n//    debug: false,\n//    debug: {\n//        showAxes: false,\n//        showAngleIndicator: false,\n//        angleColor: 0xe81153,\n//        showBroadphase: false,\n//        broadphaseColor: 0xffb400,\n//        showBounds: false,\n//        boundsColor: 0xffffff,\n//        showVelocity: false,\n//        velocityColor: 0x00aeef,\n//        showCollisions: false,\n//        collisionColor: 0xf5950c,\n//        showSeparations: false,\n//        separationColor: 0xffa500,\n//        showBody: true,\n//        showStaticBody: true,\n//        showInternalEdges: false,\n//        renderFill: false,\n//        renderLine: true,\n//        fillColor: 0x106909,\n//        fillOpacity: 1,\n//        lineColor: 0x28de19,\n//        lineOpacity: 1,\n//        lineThickness: 1,\n//        staticFillColor: 0x0d177b,\n//        staticLineColor: 0x1327e4,\n//        showSleeping: false,\n//        staticBodySleepOpacity: 0.7,\n//        sleepFillColor: 0x464646,\n//        sleepLineColor: 0x999a99,\n//        showSensors: true,\n//        sensorFillColor: 0x0d177b,\n//        sensorLineColor: 0x1327e4,\n//        showPositions: true,\n//        positionSize: 4,\n//        positionColor: 0xe042da,\n//        showJoint: true,\n//        jointColor: 0xe0e042,\n//        jointLineOpacity: 1,\n//        jointLineThickness: 2,\n//        pinSize: 4,\n//        pinColor: 0x42e0e0,\n//        springColor: 0xe042e0,\n//        anchorColor: 0xefefef,\n//        anchorSize: 4,\n//        showConvexHulls: false,\n//        hullColor: 0xd703d0\n//    }\n}\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"matterjs-world/#control","title":"Control","text":""},{"location":"matterjs-world/#pause","title":"Pause","text":"
    scene.matter.world.pause();\n
    "},{"location":"matterjs-world/#resume","title":"Resume","text":"
    scene.matter.world.resume();\n
    "},{"location":"matterjs-world/#drag-object","title":"Drag object","text":"
    scene.matter.add.mouseSpring();\n// scene.matter.add.mouseSpring(options);\n
    • options
      {\nlength: 0.01,\nstiffness: 0.1,\ndamping: 0,\nangularStiffness: 1,\ncollisionFilter: {\ncategory: 0x0001,\nmask: 0xFFFFFFFF,\ngroup: 0\n}\n}\n
      • collisionFilter : Drag filter, see collision.
    "},{"location":"matterjs-world/#world-bounds","title":"World bounds","text":""},{"location":"matterjs-world/#enable","title":"Enable","text":"
    • World :
      • Set bounds
        scene.matter.world.setBounds(x, y, width, height);\n// scene.matter.world.setBounds(x, y, width, height, thickness, left, right, top, bottom);\n
        • thickness : The thickness of each wall, in pixels.
        • left, right, top, bottom : If true will create the left/right/top/bottom bounds wall.
    "},{"location":"matterjs-world/#gravity","title":"Gravity","text":"
    • Set
      scene.matter.world.setGravity(x, y);\n// scene.matter.world.setGravity(x, y, scale);\n
    • Disable
      scene.matter.world.disableGravity();\n
    "},{"location":"matterjs-world/#constraint","title":"Constraint","text":""},{"location":"matterjs-world/#constraint-of-2-game-objects","title":"Constraint of 2 game objects","text":"
    var constraint = scene.matter.add.constraint(gameObjectA, gameObjectB);\n// var constraint = scene.matter.add.constraint(gameObjectA, gameObjectB, length, stiffness, options);\n
    • gameObjectA, gameObjectB : Matter game object, or matter body object.
    • length : The target resting length of the constraint.
      • undefined : Current distance between gameObjectA and gameObjectB. (Default value)
    • stiffness : The stiffness of the constraint.
      • 1 : Very stiff. (Default value)
      • 0.2 : Acts as a soft spring.
    • options :
      {\npointA: {\nx: 0,\ny: 0,\n},\npointB: {\nx: 0,\ny: 0,\n},\ndamping: 0,\nangularStiffness: 0,\n// render: {\n//     visible: true\n// }\n}\n
      • pointA, pointB : Offset position of gameObjectA, gameObjectB.

    Alias:

    var constraint = scene.matter.add.spring(gameObjectA, gameObjectB, length, stiffness, options);\nvar constraint = scene.matter.add.joint(gameObjectA, gameObjectB, length, stiffness, options);\n
    "},{"location":"matterjs-world/#constraint-to-world-position","title":"Constraint to world position","text":"
    var constraint = scene.matter.add.worldConstraint(gameObjectB, length, stiffness, options);\n
    • gameObjectB : Matter game object, or matter body object.
    • length : The target resting length of the constraint.
      • undefined : Current distance between gameObjectA and gameObjectB. (Default value)
    • stiffness : The stiffness of the constraint.
      • 1 : Very stiff. (Default value)
      • 0.2 : Acts as a soft spring.
    • options :
      {\npointA: {\nx: 0,\ny: 0,\n},\npointB: {\nx: 0,\ny: 0,\n},\ndamping: 0,\nangularStiffness: 0,\n// render: {\n//     visible: true\n// }\n}\n
      • pointA : World position.
      • pointB : Offset position of gameObjectB.
    "},{"location":"matterjs-world/#chain-game-objects","title":"Chain game objects","text":"
    var composite = scene.matter.add.chain(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options);\n
    • composite : Image composite
    • xOffsetA, yOffsetA : Offset position of gameObjectA, in scale.
      • xOffset = (Offset distance / width)
      • yOffset = (Offset distance / height)
    • xOffsetB, yOffsetB : Offset position of gameObjectB, in scale.
    • options :
      {\nlength: undefined,\nstiffness: 1,\ndamping: 0,\nangularStiffness: 0,\n// render: {\n//     visible: true\n// }\n}\n
      • length : The target resting length of the constraint.
        • undefined : Current distance between gameObjectA and gameObjectB. (Default value)
      • stiffness : The stiffness of the constraint.
        • 1 : Very stiff. (Default value)
        • 0.2 : Acts as a soft spring.
    • composite
      • composite.bodies : An array of bodies.
      • composite.constraints : An array of constraints
    "},{"location":"matterjs-world/#remove-constraint","title":"Remove constraint","text":"
    scene.matter.world.removeConstraint(constraint);\n
    "},{"location":"matterjs-wrap/","title":"Wrap","text":""},{"location":"matterjs-wrap/#introduction","title":"Introduction","text":"

    Automatically wrap the position of bodies and composites such that they always stay within the given bounds.

    • Reference
    "},{"location":"matterjs-wrap/#usage","title":"Usage","text":""},{"location":"matterjs-wrap/#system-configuration","title":"System configuration","text":"
    • Game config
      var config = {\n// ...\nphysics: {\nmatter: {\n// ...\nplugins: {\nwrap: true,\n// ...\n}\n// ...\n}\n}\n// ...\n}\nvar game = new Phaser.Game(config);\n
    • Runtime
      scene.matter.system.enableWrapPlugin();\n
    "},{"location":"matterjs-wrap/#matter-object-configuration","title":"Matter object configuration","text":"
    var options = {\n// ...\nplugin: {\nwrap: {\nmin: {\nx: 0,\ny: 0\n},\nmax: {\nx: 1024,\ny: 1024\n}\n}\n},\n// ...\n}\n
    "},{"location":"mesh/","title":"Mesh","text":""},{"location":"mesh/#introduction","title":"Introduction","text":"

    Render a group of textured vertices and manipulate the view of those vertices, such as rotation, translation or scaling.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"mesh/#usage","title":"Usage","text":""},{"location":"mesh/#quad","title":"Quad","text":"

    Note

    See also Plane

    1. Load texture
      scene.load.image(key, url);\n
    2. Add mesh object
      var mesh = scene.add.mesh(x, y, texture, frame);\n
      or
      var mesh = scene.make.mesh({\nx: 0,\ny: 0,\nadd: true,\n\nkey: null,\nframe: null\n});\n
    3. Set perspective or orthographic projection
      • Perspective projection
        mesh.setPerspective(width, height, fov);\n// mesh.setPerspective(width, height, fov, near, far);\n
        • width, height : The width/height of the projection matrix. Typically the same as the Mesh and/or Renderer.
        • fov : The field of view, in degrees.
        • near, far : The near/far value of the view. Default value are 0.01/1000.
      • Orthographic projection
        mesh.setOrtho(mesh.width/mesh.height, 1);\n// mesh.setOrtho(scaleX, scaleY, near, far);\n
        • scaleX, scaleY : The default horizontal/vertical scale in relation to the Mesh / Renderer dimensions.
        • near, far : The near/far value of the view. Default value are 0.01/1000.
    4. Creates a grid of vertices
      Phaser.Geom.Mesh.GenerateGridVerts({\nmesh: mesh,\ntexture: textureKey,\nframe: frameName,\nwidth: 1,\nheight: 1,\nwidthSegments: 1,\nheightSegments: 1,\n\n// x: 0,\n// y: 0,\n// colors: 0xffffff,\n// alphas: 1,\n// tile: false,\n// isOrtho: false\n})\n
      • mesh : The vertices of the generated grid will be added to this Mesh Game Object.
      • texture : The texture to be used for this Grid.
      • frame : The name or index of the frame within the Texture.
      • width , height : The width/height of the grid in 3D units.
        {\n// ...\nwidth: (frameWidth/frameHeight),\nheight: (frameHeight/frameHeight)\n// ...\n}\n
      • widthSegments, heightSegments : The number of segments to split the grid horizontally/vertically in to.
      • colors : An array of colors, one per vertex, or a single color value applied to all vertices.
      • alphas An array of alpha values, one per vertex, or a single alpha value applied to all vertices.
      • tile :
        • false : Display as a single texture. Default value.
        • true : Texture tile (repeat) across the grid segments.
    "},{"location":"mesh/#model","title":"Model","text":"
    1. Load model
      scene.load.obj(key, url, objURL, matURL);\n
      • objURL : URL to load the obj file.
      • matURL : URL to load the material file.
    2. Add mesh object
      var mesh = scene.add.mesh(x, y);\n
      or
      var mesh = scene.make.mesh({\nx: 0,\ny: 0,\nadd: true\n});\n
    3. Add model
      mesh.addVerticesFromObj(key, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp);\n
      • key : The key of the model data in the OBJ Cache to add to this Mesh.
      • scale : An amount to scale the model data by. Default is 1.
      • x, y, z : Translate the model x/y/z position by this amount.
      • rotateX, rotateY, rotateZ : Rotate the model on the x/y/z axis by this amount, in radians.
      • zIsUp :
        • true : Z axis is up.
        • false : Y axis is up.
    "},{"location":"mesh/#custom-mesh-class","title":"Custom mesh class","text":"
    • Define class
      class MyMesh extends Phaser.GameObjects.mesh {\nconstructor(scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) {\nsuper(scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var mesh = new MyMesh(scene, x, y, texture, frame);\n
    "},{"location":"mesh/#control","title":"Control","text":""},{"location":"mesh/#view","title":"View","text":"
    • Translates the view position of this Mesh on the x/y/z axis by the given amount.
      mesh.panX(x);\nmesh.panY(y);\nmesh.panZ(z);\n
    "},{"location":"mesh/#model_1","title":"Model","text":"
    • Position
      mesh.modelPosition.x = x;\nmesh.modelPosition.y = y;\nmesh.modelPosition.z = z;\n
      • x, y, z : Offset position.
        • z+ : Near
        • z- : Far
        • x- : Left
        • x+ : Right
        • y+ : Up
        • y- : Down
    • Rotation
      mesh.modelRotation.x = radiansX;\nmesh.modelRotation.y = radiansY;\nmesh.modelRotation.z = radiansZ;\n
      or
      mesh.rotateX = degreesX;\nmesh.rotateY = degreesY;\nmesh.rotateZ = degreesZ;\n
      • radiansX, radiansY, radiansZ : Rotation angle in radians.
      • degreesX, degreesY, degreesZ : Rotation angle in degrees.
    • Scale
      mesh.modelScale.x = scaleX;\nmesh.modelScale.y = scaleY;\nmesh.modelScale.z = scaleZ;\n
      • scaleX, scaleY, scaleZ : Scale value, 1 is origin size.
    "},{"location":"mesh/#backward-facing-faces","title":"Backward facing Faces","text":"
    • Hide backward facing Faces. Default behavior.
      mesh.hideCCW = true;\n
    • Show backward facing Faces
      mesh.hideCCW = false;\n
    "},{"location":"mesh/#faces","title":"Faces","text":"

    Mesh is composed of triangle faces.

    var faces = mesh.faces;\n
    "},{"location":"mesh/#contains","title":"Contains","text":"
    • Has any face which contains point
      var isHit = mesh.hasFaceAt(worldX, worldY);\n// var isHit = mesh.hasFaceAt(worldX, worldY, camera);\n
    • Get face contains point
      var face = mesh.getFaceAt(worldX, worldY);\n// var face = mesh.getFaceAt(worldX, worldY, camera);\n
    "},{"location":"mesh/#properties","title":"Properties","text":"
    • Alpha
      • Get
        var alpha = face.alpha;\n
      • Set
        face.alpha = alpha;\n
    • Angle
      • Rotate
        Phaser.Geom.Mesh.RotateFace(face, radians);\n
    • Center position
      • Get
        var x = face.x;\nvar y = face.y;\n
        • x : 0(left) ~ 1(right)
        • y : 1(top) ~ 0(bottom)
      • Set
        face.x = x;\nface.y = y;\n
        or
        face.translate(x, y);\n
        • x : 0(left) ~ 1(right)
        • y : 1(top) ~ 0(bottom)
    "},{"location":"mesh/#vertices","title":"Vertices","text":"

    Each face has 3 vertices.

    var vertices = mesh.vertices;\n
    • vertices : Array of vertex.
    "},{"location":"mesh/#properties_1","title":"Properties","text":"
    • Alpha
      • Get
        var alpha = vertex.alpha;\n
      • Set
        vertex.alpha = alpha;\n
    • Tint
      • Get
        var color = vertex.color;\n
      • Set
        vertex.color = color;\n
    "},{"location":"mesh/#update-properties","title":"Update properties","text":"
    • Start updating
      mesh.ignoreDirtyCache = true;\n
    • Stop updating
      mesh.ignoreDirtyCache = false;\n
    "},{"location":"mesh/#interactive","title":"Interactive","text":"

    To test if pointer is at any face of this mesh game object.

    mesh.setInteractive();\n
    "},{"location":"mesh/#debug","title":"Debug","text":"
    1. Set debug Graphics
      var debugGraphics = scene.add.graphics();\nmesh.setDebug(debugGraphics);\n
    2. Update Graphics in scene.update() method.
      debugGraphics.clear();\ndebugGraphics.lineStyle(1, 0x00ff00);\n
    "},{"location":"mesh/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"mesh/#create-mask","title":"Create mask","text":"
    var mask = mesh.createBitmapMask();\n

    See mask

    "},{"location":"mesh/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"modal-promise/","title":"Modal promise","text":""},{"location":"modal-promise/#introduction","title":"Introduction","text":"

    Modal behavior wrapped into promise.

    • Author: Rex
    • Promise
    "},{"location":"modal-promise/#live-demos","title":"Live demos","text":"
    • Manual
    • Timeout
    • Modal dialog
    "},{"location":"modal-promise/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"modal-promise/#install-plugin","title":"Install plugin","text":""},{"location":"modal-promise/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmodalplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmodalplugin.min.js', true);\n
    • Add modal behavior
      scene.plugins.get('rexmodalplugin').promise(gameObject, config)\n.then(function(closeEventData) {\n})\n
    "},{"location":"modal-promise/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add modal behavior
      scene.plugins.get('rexModal').promise(gameObject, config)\n.then(function(closeEventData) {\n})\n
    "},{"location":"modal-promise/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ModalPromise } from 'phaser3-rex-plugins/plugins/modal.js';\n
    • Add modal behavior
      ModalPromise(gameObject, config)\n.then(function(closeEventData) {\n})\n
    "},{"location":"modal-promise/#promise","title":"Promise","text":"
    scene.plugins.get('rexModal').promise(gameObject, config)\n.then(function(closeEventData) {\n})\n
    • config : See Modal behavior
    "},{"location":"modal-promise/#close","title":"Close","text":"

    scene.plugins.get('rexModal').close(gameObject);\n// scene.plugins.get('rexModal').close(gameObject, closeEventData);\n
    or
    gameObject.emit('modal.requestClose');\n// gameObject.emit('modal.requestClose', closeEventData);\n

    • Fire 'modal.requestClose' event on game object, which will invoke modal.requestClose() method. After closing dialog, resolve part of promise will be triggered.
    graph TB\n\nPromise[\"promose('gameObject, config)\"]\nOnOpen[\"gameObject.on('modal.open')\"]\nRequestCloseEvent[\"gameObject.emit('modal.requestClose', closeEventData)\"]\nTimeOut[\"Timeout<br>Any touch\"]\nOnClose[\"gameObject.on('modal.close')\"]\nResolve[\"then(function(closeEventData) { })\"]\n\nPromise --> |Transition-in| OnOpen\nOnOpen --> |manualClose| RequestCloseEvent\nOnOpen --> |Not manualClose| TimeOut\nRequestCloseEvent --> |Transition-out| OnClose\nTimeOut --> |Transition-out| OnClose\nOnClose --> Resolve
    "},{"location":"modal-promise/#events","title":"Events","text":"
    • To invoke modal.requestClose() method
      gameObject.emit('modal.requestClose', closeEventData);\n
    • On opened dialog
      gameObject.on('modal.open', function(modalBehavior) {\n})\n
    • On closed dialog
      gameObject.on('modal.close', function(closeEventData, modalBehavior) {\n})\n
    "},{"location":"modal/","title":"Modal behavior","text":""},{"location":"modal/#introduction","title":"Introduction","text":"

    Pop-up modal dialog, then scale-down this dialog.

    • Author: Rex
    • Behavior of game object
    "},{"location":"modal/#live-demos","title":"Live demos","text":"
    • Manual
    • Timeout
    • Touch outside
    • Custom transit
    "},{"location":"modal/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"modal/#install-plugin","title":"Install plugin","text":""},{"location":"modal/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmodalplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmodalplugin.min.js', true);\n
    • Add modal behavior
      var modal = scene.plugins.get('rexmodalplugin').add(gameObject, config);\n
    "},{"location":"modal/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add modal behavior
      var modal = scene.plugins.get('rexModal').add(gameObject, config);\n
    "},{"location":"modal/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ModalBehavoir } from 'phaser3-rex-plugins/plugins/modal.js';\n
    • Add modal behavior
      var modal = new ModalBehavoir(gameObject, config);\n
    "},{"location":"modal/#create-instance","title":"Create instance","text":"
    var modal = scene.plugins.get('rexModal').add(gameObject, {\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0,\n// transitOut: 0,\n\n// destroy: true,\n// openOnStart: true\n});\n
    • cover : Configuration of Cover -- A rectangle shape covered full window, and block all touch events.
      • false : Don't create cover game object.
      • cover.transitIn : Custom callback. Default behavior is fade-in.
        function(gameObject, duration) {\n\n}\n
      • cover.transitOut : Custom callback. Default behavior is fade-out.
        function(gameObject, duration) {\n\n}\n
    • touchOutsideClose : Set to true to close modal dialog when clicking out side of gameObject.
      • Default value is false. Will be set to false if anyTouchClose is set to true.
    • anyTouchClose : Set to true to close modal dialog when any clicking.
      • Default value is false.
    • timeOutClose : Set to true to close modal dialog when holding time out (duration.hold).
      • If duration.hold is given, default value is true. Otherwise default value is false.
    • manualClose : Set to true to close modal dialog via modal.requestClose() method.
      • Default value is false. When this parameter is true, other closing methods will be disabled.
      • If touchOutsideClose, anyTouchClose, and timeOutClose are false, it is equal to manualClose.
    • duration : Duration of transition-in, hold, trantion-out.
      • duration.in : Duration of transition-in (open dialog).
        • 0 : No transition, open dialog immediately.
      • duration.out : Duration of transition-out (close dialog).
        • 0 : No transition, close dialog immediately.
      • duration.hold : Duration of hold.
        • -1 : Disable timeOutClose.
    • transitIn : Transition behavior of opening dialog.
      • 0, 'popUp' : Pop up dialog from 0 to current scale.
      • 1, 'fadeIn' : Fade in dialog
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • transitOut : Tween behavior of closing dialog.
      • 0, 'scaleDown' : Scale down dialog
      • 1, 'fadeOut' : Fade out dialog
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • destroy
      • true : Destroy dialog game object and this behavior when closing completed. Default behavior.
      • fasle : Keep dialog game object and this behavior when closing completed. Could reuse it later.
    • openOnStart:
      • true : Open dialog game object (modal.requestOpen()) at beginning. Default behavior.
      • false : Open dialog game object manually.
    "},{"location":"modal/#open","title":"Open","text":"
    • Will open modal dialog game object (run transition-in callback) when creating this behavior, if openOnStart is set to true.
    • Invoke modal.requestOpen() to open modal dialog game object again, after closing modal dialog.
      • Set destroy to false to reuse dialog game object and this behavior.
    "},{"location":"modal/#close","title":"Close","text":"
    modal.requestClose();\n// modal.requestClose(closeEventData);\n
    • closeEventData : Emit 'close' event when closed dialog complete, pass closeEventData to callback of this event.
      modal.on('close', function(closeEventData) {\n})\n
    "},{"location":"modal/#events","title":"Events","text":"
    • On opened dialog
      modal.on('open', function(gameObject, modal) {\n})\n
    • On closed dialog
      modal.on('close', function(closeEventData) {\n})\n
    "},{"location":"mousewheel/","title":"Mouse wheel","text":""},{"location":"mousewheel/#introduction","title":"Introduction","text":"

    Mouse wheel events of phaser.

    • Author: Richard Davey
    "},{"location":"mousewheel/#usage","title":"Usage","text":""},{"location":"mousewheel/#mouse-wheel-events","title":"Mouse wheel events","text":"
    1. Events on touched Game object
      gameObject.on('wheel', function(pointer, dx, dy, dz, event){ /* ... */ });\n
    2. Event on input plugin for each touched Game object
      scene.input.on('gameobjectwheel', function(pointer, gameObject, dx, dy, dz, event){ /* ... */ });\n
    3. Events to get all touched Game Objects
      scene.input.on('wheel', function(pointer, currentlyOver, dx, dy, dz, event){ /* ... */ });\n
    "},{"location":"mousewheel/#mouse-wheel-properties","title":"Mouse wheel properties","text":"
    • pointer.deltaX : The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device.
    • pointer.deltaY : The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device.
    • pointer.deltaZ : The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device.
    "},{"location":"mousewheelscroller/","title":"Mouse wheel scroller","text":""},{"location":"mousewheelscroller/#introduction","title":"Introduction","text":"

    Emit scroll event when mouse-wheeling.

    • Author: Rex
    • Member of scene
    "},{"location":"mousewheelscroller/#live-demos","title":"Live demos","text":"
    • Scroller
    "},{"location":"mousewheelscroller/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"mousewheelscroller/#install-plugin","title":"Install plugin","text":""},{"location":"mousewheelscroller/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmousewheelscrollerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmousewheelscrollerplugin.min.js', true);\n
    • Add mouse-wheeling-to-cursor-key object
      var scroller = scene.plugins.get('rexmousewheelscrollerplugin').add(gameObject, config);\n
    "},{"location":"mousewheelscroller/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import MouseWheelScrollerPlugin from 'phaser3-rex-plugins/plugins/mousewheelscroller-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexMouseWheelScroller',\nplugin: MouseWheelScrollerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add mouse-wheeling-to-cursor-key object
      var scroller = scene.plugins.get('rexMouseWheelScroller').add(gameObject, config);\n
    "},{"location":"mousewheelscroller/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import MouseWheelScroller from 'phaser3-rex-plugins/plugins/mousewheelscroller.js';\n
    • Add mouse-wheeling-to-cursor-key object
      var scroller = new MouseWheelScroller(gameObject, config);\n
    "},{"location":"mousewheelscroller/#create-instance","title":"Create instance","text":"
    var scroller = scene.plugins.get('rexMouseWheelScroller').add(gameObject, {\n// focus: true,\n// speed: 0.1,\n// enable: true,\n});\n
    • focus : Fire 'scroll' event when mouse-wheeling --
      • false, or 0 : Without checking if cursor is over game object or not.
      • true, or 1 : Cursor is over game object. Default behavior.
      • 2 : Cursor is inside the rectangle bounds of game object.
    • speed : Scrolling speed. Default value is 0.1.
    • enable : Set true to enable 'scroll' event.
    "},{"location":"mousewheelscroller/#event","title":"Event","text":"
    • Scroll
      scroller.on('scroll', function(inc, gameObject, scroller) {\n\n}, scope)\n
      • inc : Scroll value,
        • Positive value : Mouse-wheeling down
        • Negative value : Mouse-wheeling up
    "},{"location":"mousewheelscroller/#speed","title":"Speed","text":"
    • Set
      scroller.setSpeed(speed);\n// scroller.speed = speed;\n
    • Get
      var speed = scroller.speed;\n
    "},{"location":"mousewheelscroller/#enable","title":"Enable","text":"
    • Set
      scroller.setEnable(enable);\n// scroller.enable = enable;\n
    • Get
      var enable = scroller.enable;\n
    "},{"location":"mousewheeltoupdown/","title":"Mouse-wheel to up/down","text":""},{"location":"mousewheeltoupdown/#introduction","title":"Introduction","text":"

    Map mouse-wheeling to (up/down) cursor key state.

    • Author: Rex
    • Member of scene
    "},{"location":"mousewheeltoupdown/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"mousewheeltoupdown/#install-plugin","title":"Install plugin","text":""},{"location":"mousewheeltoupdown/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmousewheeltoupdownplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmousewheeltoupdownplugin.min.js', true);\n
    • Add mouse-wheeling-to-cursor-key object
      var mouseWheelToUpDown = scene.plugins.get('rexmousewheeltoupdownplugin').add(scene);\n
    "},{"location":"mousewheeltoupdown/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import MouseWheelToUpDownPlugin from 'phaser3-rex-plugins/plugins/mousewheeltoupdown-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexMouseWheelToUpDown',\nplugin: MouseWheelToUpDownPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add mouse-wheeling-to-cursor-key object
      var mouseWheelToUpDown = scene.plugins.get('rexMouseWheelToUpDown').add(scene);\n
    "},{"location":"mousewheeltoupdown/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import MouseWheelToUpDown from 'phaser3-rex-plugins/plugins/mousewheeltoupdown.js';\n
    • Add mouse-wheeling-to-cursor-key object
      var mouseWheelToUpDown = new MouseWheelToUpDown(scene);\n
    "},{"location":"mousewheeltoupdown/#create-instance","title":"Create instance","text":"
    var mouseWheelToUpDown = scene.plugins.get('rexMouseWheelToUpDown').add(scene);\n
    "},{"location":"mousewheeltoupdown/#state-of-cursor-keys","title":"State of cursor keys","text":"
    var cursorKeys = mouseWheelToUpDown.createCursorKeys();\n\nvar upKeyDown = cursorKeys.up.isDown;\nvar downKeyDown = cursorKeys.down.isDown;\n

    Or

    var upKeyDown = mouseWheelToUpDown.up;\nvar downKeyDown = mouseWheelToUpDown.down;\nvar noKeyDown = mouseWheelToUpDown.noKey;\n
    "},{"location":"mousewheeltoupdown/#destroy","title":"Destroy","text":"
    mouseWheelToUpDown.destroy();\n
    "},{"location":"moveto/","title":"Move to","text":""},{"location":"moveto/#introduction","title":"Introduction","text":"

    Move game object towards target position with a steady speed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"moveto/#live-demos","title":"Live demos","text":"
    • Move-to
    "},{"location":"moveto/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"moveto/#install-plugin","title":"Install plugin","text":""},{"location":"moveto/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmovetoplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmovetoplugin.min.js', true);\n
    • Add move-to behavior
      var moveTo = scene.plugins.get('rexmovetoplugin').add(gameObject, config);\n
    "},{"location":"moveto/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import MoveToPlugin from 'phaser3-rex-plugins/plugins/moveto-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexMoveTo',\nplugin: MoveToPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add move-to behavior
      var moveTo = scene.plugins.get('rexMoveTo').add(gameObject, config);\n
    "},{"location":"moveto/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import MoveTo from 'phaser3-rex-plugins/plugins/moveto.js';\n
    • Add move-to behavior
      var moveTo = new MoveTo(gameObject, config);\n
    "},{"location":"moveto/#create-instance","title":"Create instance","text":"
    var moveTo = scene.plugins.get('rexMoveTo').add(gameObject, {\n// speed: 400,\n// rotateToTarget: false\n});\n
    • speed : Moving speed, pixels in second.
    • rotateToTarget : Set true to change angle towards path.
    "},{"location":"moveto/#start-moving","title":"Start moving","text":"
    • Move to target position
      moveTo.moveTo(x, y);\n
      or
      moveTo.moveTo({\nx: 0,\ny: 0,\n// speed: 0\n});\n
      • x , y : Target position
    • Move from start position to current position
      moveTo.moveFrom(x, y);\n
      or
      moveTo.moveFrom({\nx: 0,\ny: 0,\n// speed: 0\n});\n
      • x , y : Start position
    • Move toward angle
      moveTo.moveToward(angle, distance);\n
      • angle : Angle in radian.
    "},{"location":"moveto/#target-position","title":"Target position","text":"
    var targetX = moveTo.targetX;\nvar targetY = moveTo.targetY;\n
    "},{"location":"moveto/#enable","title":"Enable","text":"
    • Enable (default)
      moveTo.setEnable();\n
      or
      moveTo.enable = true;\n
    • Disable
      moveTo.setEnable(false);\n
      or
      moveTo.enable = false;\n
    "},{"location":"moveto/#pause-resume-stop-moving","title":"Pause, Resume, stop moving","text":"
    moveTo.pause();\nmoveTo.resume();\nmoveTo.stop();\n
    "},{"location":"moveto/#set-speed","title":"Set speed","text":"
    moveTo.setSpeed(speed);\n// moveTo.speed = speed;\n
    "},{"location":"moveto/#set-rotate-to-target","title":"Set rotate-to-target","text":"
    moveTo.setRotateToTarget(rotateToTarget);\n
    • rotateToTarget : Set true to change angle towards target
    "},{"location":"moveto/#events","title":"Events","text":"
    • On start moving
      moveTo.on('start', function(gameObject, moveTo){});\n
    • On reached target
      moveTo.on('complete', function(gameObject, moveTo){});\n// moveTo.once('complete', function(gameObject, moveTo){});\n
    "},{"location":"moveto/#status","title":"Status","text":"
    • Is moving
      var isRunning = moveTo.isRunning;\n
    "},{"location":"mustache/","title":"Mustache","text":""},{"location":"mustache/#introduction","title":"Introduction","text":"

    Format string with variables. Reference

    "},{"location":"mustache/#usage","title":"Usage","text":"
    var template = 'hello, {{name}}';\nvar view = {\nname: 'rex'\n};\nvar result = Mustache.render(template, view);\n
    "},{"location":"ninepatch/","title":"Nine patch","text":""},{"location":"ninepatch/#introduction","title":"Introduction","text":"

    Stretchable image, extended from RenderTexture game object.

    • Author: Rex
    • Game object
    "},{"location":"ninepatch/#live-demos","title":"Live demos","text":"
    • 3x3, 3x3
    • 5x5
    • Custom frame name
    • Custom base frame name
    • Preserve ratio
    • Max-fixed-part-scale
    "},{"location":"ninepatch/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ninepatch/#install-plugin","title":"Install plugin","text":""},{"location":"ninepatch/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexninepatchplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexninepatchplugin.min.js', true);\n
    • Add nine-patch object
      var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import NinePatchPlugin from 'phaser3-rex-plugins/plugins/ninepatch-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexNinePatchPlugin',\nplugin: NinePatchPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add nine-patch object
      var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import NinePatch from 'phaser3-rex-plugins/plugins/ninepatch.js';\n
    • Add nine-patch object
      var ninePatch = new NinePatch(scene, x, y, width, height, key, baseFrame, columns, rows, config);\nscene.add.existing(ninePatch);\n
    "},{"location":"ninepatch/#create-instance","title":"Create instance","text":"
    var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, baseFrame, columns, rows, {\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, columns, rows, {\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, {\ncolumns: undefined, // leftWidth: undefined, right: undefined,\nrows: undefined,    // topHeight: undefined, bottomHeight: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch(x, y, width, height, {\nkey: undefined,\ncolumns: undefined, // leftWidth: undefined, right: undefined,\nrows: undefined,    // topHeight: undefined, bottomHeight: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch(x, y, {\nwidth: 1, height: 1,\nkey: undefined,\ncolumns: undefined, // leftWidth: undefined, right: undefined,\nrows: undefined,    // topHeight: undefined, bottomHeight: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch({\nx: 0, y: 0,\nwidth: 1, height: 1,\nkey: undefined,\ncolumns: undefined, // leftWidth: undefined, rightWidth: undefined,\nrows: undefined,    // topHeight: undefined, bottomHeight: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,  // frame: undefined,\ngetFrameNameCallback: undefined\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • key : Texture key of source image.
    • baseFrame, or frame : Frame name of base texture.
      • undefined : Use default base frame '__BASE'.
    • columns : Configuration of columns.
      • A number array, like [20, 20, 20], or [20, undefined, 20] : Width of each column. undefined value will be replaced by remainder value from texture width.
        • Width of odd columns (column 0, column 2, ...) will be origin width.
        • Width of even columns (column 1, column 3, ...) will be stretched.
    • leftWidth, rightWidth : Set columns to [leftWidth, undefined, rightWidth], if columns is undefined.
    • rows : Configuration of rows.
      • A number array, like [20, 20, 20], or [20, undefined, 20] : Height of each row. undefined value will be replaced by remainder value from texture width.
        • Height of odd rows (row 0, row 2, ...) will be origin height.
        • Height of odd rows (row 1, row 3, ...) will be stretched.
    • topHeight, bottomHeight : Set rows to [topHeight, undefined, bottomHeight], if rows is undefined.
    • preserveRatio : Preserve ratio of fixed parts (i.e. displaying in origin size). Default is true.
    • maxFixedPartScale : Max scale value of fixed-part.
    • stretchMode : Stretch mode of edges and internal cells.
      • A number (0, or 1), or a string ('scale', or 'repeat'):
        • 0, or 'scale' : Stretch each edge and internal cell by scaled image. Default value.
        • 1, or 'repeat' : Stretch each edge and internal cell by repeated image (tile-sprite).
      • An object :
        {\nedge: 0, // 'scale', or 1, 'repeat'\ninternal: 0, // 'scale', or 1, 'repeat'\n}\n
    • getFrameNameCallback : Callback to get frame name of each cell.
      • undefined : Use default callback.
        • If baseFrame is '__BASE' : return ${colIndex},${rowIndex}
        • Else : return ${baseFrame}_${colIndex},${rowIndex}
      • Function object : Return a string, or undefined.
        function(colIndex, rowIndex, baseFrame) {\nreturn `${colIndex},${rowIndex}`;\n}\n
    "},{"location":"ninepatch/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNinePatch extends NinePatch {\nconstructor(scene, x, y, width, height, key, baseFrame, columns, rows, config) {\nsuper(scene, x, y, width, height, key, baseFrame, columns, rows, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var ninePatch = new MyNinePatch(scene, x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch/#resize","title":"Resize","text":"
    ninePatch.resize(width, height);\n

    Will update texture

    "},{"location":"ninepatch/#set-base-texture-of-source-image","title":"Set base texture of source image","text":"
    ninePatch.setBaseTexture(key, baseFrame, columns, rows);\n

    or

    ninePatch.setBaseTexture(key, baseFrame, leftWidth, rightWidth, topHeight, bottomHeight);\n

    or

    ninePatch.setBaseTexture(key, baseFrame);\n
    • key : Texture key of source image.
    • baseFrame : Frame name of base texture.
      • undefined, or null : Use default base frame '__BASE'. Default value.
    • columns : Configuration of columns.
      • A number array, like [20, 20, 20] : Width of each column.
        • Width of odd columns (column 0, column 2, ...) will be origin width.
        • Width of even columns (column 1, column 3, ...) will be stretched.
      • undefined : If columns and rows are undefined, it will use current configuration of columns and rows.
    • rows : Configuration of rows.
      • A number array, like [20, 20, 20] : Height of each row.
        • Height of odd rows (row 0, row 2, ...) will be origin height.
        • Height of odd rows (row 1, row 3, ...) will be stretched.
      • undefined : If columns and rows are undefined, it will use current configuration of columns and rows.
    • leftWidth, rightWidth : Set columns to [leftWidth, undefined, rightWidth].
    • topHeight, bottomHeight : Set rows to [topHeight, undefined, bottomHeight].

    Will update texture

    "},{"location":"ninepatch/#set-stretch-mode","title":"Set stretch mode","text":"
    ninePatch.setStretchMode(mode);\n
    • mode :
      • A number (0, or 1), or a string ('scale', or 'repeat'):
        • 0, or 'scale' : Stretch each edge and internal cell by scaled image. Default value.
        • 1, or 'repeat' : Stretch each edge and internal cell by repeated image (tile-sprite).
      • An object :
        {\nedge: 0, // 'scale', or 1, 'repeat'\ninternal: 0, // 'scale', or 1, 'repeat'\n}\n
    "},{"location":"ninepatch/#set-get-frame-name-callback","title":"Set get-frame-name callback","text":"
    ninePatch.setGetFrameNameCallback(callback);\n
    • callback : Return a string, or undefined.
      function(colIndex, rowIndex, baseFrame) {\nreturn `${colIndex},${rowIndex}`\n}\n
    "},{"location":"ninepatch/#fixed-part-scale","title":"Fixed-part scale","text":"
    • Fixed-part scale
      • Get
        var scaleX = ninePatch.fixedPartScaleX;\nvar scaleY = ninePatch.fixedPartScaleY;\n
    • Max fixed-part scale
      • Get
        var scaleX = ninePatch.maxFixedPartScaleX;\nvar scaleY = ninePatch.maxFixedPartScaleY;\n
      • Set
        ninePatch.setMaxFixedPartScale(scale);\n// ninePatch.setMaxFixedPartScale(scaleX, scaleY);\n
        or
        ninePatch.maxFixedPartScaleX = scaleX;\nninePatch.maxFixedPartScaleY = scaleY;\n
    "},{"location":"ninepatch/#update-texture","title":"Update texture","text":"
    ninePatch.updateTexture();\n
    "},{"location":"ninepatch/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"ninepatch/#create-mask","title":"Create mask","text":"
    var mask = ninePatch.createBitmapMask();\n

    See mask

    "},{"location":"ninepatch/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"ninepatch/#compare-with-nine-slice","title":"Compare with nine-slice","text":"
    • Nine-slice is a built-in game object.
    • Nine-slice has better render performance.
      • Nine-patch extends from render-texture, which will create a new texture, then draw frames on it.
    • Nine-slice is webgl mode only.
    • Nine-slice does not have flip, crop methods.
    "},{"location":"ninepatch2/","title":"Nine patch2","text":""},{"location":"ninepatch2/#introduction","title":"Introduction","text":"

    Stretchable image. Has better performance than nine-patch.

    • Author: Rex
    • Game object
    "},{"location":"ninepatch2/#live-demos","title":"Live demos","text":"
    • 3x3
    • Performance test
    "},{"location":"ninepatch2/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ninepatch2/#install-plugin","title":"Install plugin","text":""},{"location":"ninepatch2/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexninepatch2plugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexninepatch2plugin.min.js', true);\n
    • Add nine-patch object
      var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch2/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import NinePatch2Plugin from 'phaser3-rex-plugins/plugins/ninepatch2-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexNinePatch2Plugin',\nplugin: NinePatch2Plugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add nine-patch object
      var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch2/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import NinePatch2 from 'phaser3-rex-plugins/plugins/ninepatch2.js';\n
    • Add nine-patch object
      var ninePatch = new NinePatch2(scene, x, y, width, height, key, baseFrame, columns, rows, config);\nscene.add.existing(ninePatch);\n
    "},{"location":"ninepatch2/#create-instance","title":"Create instance","text":"
    var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, baseFrame, columns, rows, {\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, columns, rows, {\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, {\ncolumns: undefined,\nrows: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2(x, y, width, height, {\nkey: undefined,\ncolumns: undefined,\nrows: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2(x, y, {\nwidth: 1, height: 1,\nkey: undefined,\ncolumns: undefined,\nrows: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2({\nx: 0, y: 0,\nwidth: 1, height: 1,\nkey: undefined,\ncolumns: undefined,\nrows: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • key : Texture key of source image.
    • baseFrame : Frame name of base texture.
      • undefined : Use default base frame '__BASE'.
    • columns : Configuration of columns.
      • A number array, like [20, 20, 20], or [20, undefined, 20] : Width of each column. undefined value will be replaced by remainder value from texture width.
        • Width of odd columns (column 0, column 2, ...) will be origin width.
        • Width of even columns (column 1, column 3, ...) will be stretched.
    • rows : Configuration of rows.
      • A number array, like [20, 20, 20], or [20, undefined, 20] : Height of each row. undefined value will be replaced by remainder value from texture width.
        • Height of odd rows (row 0, row 2, ...) will be origin height.
        • Height of odd rows (row 1, row 3, ...) will be stretched.
    • preserveRatio : Preserve ratio of fixed parts (i.e. displaying in origin size). Default is true.
    • maxFixedPartScale : Max scale value of fixed-part.
    • stretchMode : Stretch mode of edges and internal cells.
      • A number (0, or 1), or a string ('scale', or 'repeat'):
        • 0, or 'scale' : Stretch each edge and internal cell by scaled image. Default value.
        • 1, or 'repeat' : Stretch each edge and internal cell by repeated image (tile-sprite).
      • An object :
        {\nedge: 0, // 'scale', or 1, 'repeat'\ninternal: 0, // 'scale', or 1, 'repeat'\n}\n
    • getFrameNameCallback : Callback to get frame name of each cell.
      • undefined : Use default callback.
        • If baseFrame is '__BASE' : return ${colIndex},${rowIndex}
        • Else : return ${baseFrame}:${colIndex},${rowIndex}
      • Function object : Return a string, or undefined.
        function(colIndex, rowIndex, baseFrame) {\nreturn `${colIndex},${rowIndex}`;\n}\n
    "},{"location":"ninepatch2/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNinePatch extends NinePatch2 {\nconstructor(scene, x, y, width, height, key, baseFrame, columns, rows, config) {\nsuper(scene, x, y, width, height, key, baseFrame, columns, rows, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var ninePatch = new MyNinePatch(scene, x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch2/#resize","title":"Resize","text":"
    ninePatch.resize(width, height);\n

    Will update texture

    "},{"location":"ninepatch2/#tint","title":"Tint","text":"
    • Set tint
      ninePatch.setTint(tint);\n
    • Clear tint
      ninePatch.clearTint();\n
    • Set tint fill
      ninePatch.setTintFill(tint);\n
    • Get tint
      var tint = ninePatch.tint;\nvar tintFill = ninePatch.tintFill;\n
      • tintFill :
        • false : Solid tint + texture alpha
        • true : Solid tint, no texture
    "},{"location":"ninepatch2/#set-texture-of-source-image","title":"Set texture of source image","text":"
    ninePatch.setBaseTexture(key, baseFrame, columns, rows);\n// ninePatch.setBaseTexture(key, columns, rows);\n
    • key : Texture key of source image.
    • baseFrame : Frame name of base texture.
      • undefined : Use default base frame '__BASE'. Default value.
    • columns : Configuration of columns.
      • A number array, like [20, 20, 20] : Width of each column.
        • Width of odd columns (column 0, column 2, ...) will be origin width.
        • Width of even columns (column 1, column 3, ...) will be stretched.
    • rows : Configuration of rows.
      • A number array, like [20, 20, 20] : Height of each row.
        • Height of odd rows (row 0, row 2, ...) will be origin height.
        • Height of odd rows (row 1, row 3, ...) will be stretched.

    Will update texture

    "},{"location":"ninepatch2/#set-stretch-mode","title":"Set stretch mode","text":"
    ninePatch.setStretchMode(mode);\n
    • mode :
      • A number (0, or 1), or a string ('scale', or 'repeat'):
        • 0, or 'scale' : Stretch each edge and internal cell by scaled image. Default value.
        • 1, or 'repeat' : Stretch each edge and internal cell by repeated image (tile-sprite).
      • An object :
        {\nedge: 0, // 'scale', or 1, 'repeat'\ninternal: 0, // 'scale', or 1, 'repeat'\n}\n
    "},{"location":"ninepatch2/#set-get-frame-name-callback","title":"Set get-frame-name callback","text":"
    ninePatch.setGetFrameNameCallback(callback);\n
    • callback : Return a string, or undefined.
      function(colIndex, rowIndex, baseFrame) {\nreturn `${colIndex},${rowIndex}`\n}\n
    "},{"location":"ninepatch2/#fixed-part-scale","title":"Fixed-part scale","text":"
    • Fixed-part scale
      • Get
        var scaleX = ninePatch.fixedPartScaleX;\nvar scaleY = ninePatch.fixedPartScaleY;\n
    • Max fixed-part scale
      • Get
        var scaleX = ninePatch.maxFixedPartScaleX;\nvar scaleY = ninePatch.maxFixedPartScaleY;\n
      • Set
        ninePatch.setMaxFixedPartScale(scale);\n// ninePatch.setMaxFixedPartScale(scaleX, scaleY);\n
        or
        ninePatch.maxFixedPartScaleX = scaleX;\nninePatch.maxFixedPartScaleY = scaleY;\n
    "},{"location":"ninepatch2/#update-texture","title":"Update texture","text":"
    ninePatch.updateTexture();\n
    "},{"location":"ninepatch2/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"ninepatch2/#create-mask","title":"Create mask","text":"
    var mask = ninePatch.createBitmapMask();\n

    See mask

    "},{"location":"ninepatch2/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"ninepatch2/#compare-with-nine-patch","title":"Compare with nine-patch","text":"
    • Nine-patch2 has better performance.
      • Nine-patch extends from render-texture, which will create a new texture, then draw frames on it.
      • Nine-patch2 draws frames directly.
    • Nine-patch2 does not have flip, crop methods.
    • Nine-patch2 can't apply custom spriteFx pipeline.
    "},{"location":"nineslice/","title":"Nine slice","text":""},{"location":"nineslice/#introduction","title":"Introduction","text":"

    Display a texture-based object that can be stretched both horizontally and vertically, but that retains fixed-sized corners, built-in game object of phaser.

    • Author: Richard Davey

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"nineslice/#usage","title":"Usage","text":""},{"location":"nineslice/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"nineslice/#add-nine-slice-object","title":"Add nine slice object","text":"
    var nineSlice = scene.add.nineslice(x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n

    or

    var nineSlice = scene.add.nineslice(x, y, texture, frame, width, height);\n// var nineSlice = scene.add.nineslice(x, y, texture, frame);\n
    • If that frame (indexed by texture, frame) is generated by Texture Packer.

    Add nine slice from JSON

    var nineSlice = scene.make.nineslice({\nx: 0,\ny: 0,\nkey: '',\n// frame: '',\n\n// width: 256,\n// height: 256,\n// leftWidth: 10,\n// rightWidth: 10,\n// topHeight: 0,\n// bottomHeight: 0,\n\n// angle: 0,\n// alpha: 1,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"nineslice/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNineSlice extends Phaser.GameObjects.NineSlice {\nconstructor(scene, x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight) {\nsuper(scene, x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var nineSlice = new MyNineSlice(scene, x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n
    "},{"location":"nineslice/#resize","title":"Resize","text":"
    nineSlice.setSize(width, height);\n
    "},{"location":"nineslice/#set-texture-of-source-image","title":"Set texture of source image","text":"
    nineSlice.setTexture(texture, frame);\nnineSlice.setSlices(width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n
    "},{"location":"nineslice/#texture","title":"Texture","text":"

    See game object - texture

    "},{"location":"nineslice/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"nineslice/#create-mask","title":"Create mask","text":"
    var mask = nineSlice.createBitmapMask();\n

    See mask

    "},{"location":"nineslice/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"nineslice/#compare-with-nine-patch","title":"Compare with nine-patch","text":"
    • Nine-slice is a built-in game object.
    • Nine-slice has better render performance.
      • Nine-patch extends from render-texture, which will create a new texture, then draw frames on it.
    • Nine-slice is webgl mode only.
    • Nine-slice does not have flip, crop methods.
    "},{"location":"orientation/","title":"Orientation","text":""},{"location":"orientation/#introduction","title":"Introduction","text":"

    Get oriention, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"orientation/#usage","title":"Usage","text":""},{"location":"orientation/#orientation","title":"Orientation","text":"
    var orientation = scene.scale.orientation;\n
    "},{"location":"orientation/#events","title":"Events","text":"
    • On orientation change
      scene.scale.on('orientationchange', function(orientation) {\nswitch (orientation) {\ncase Phaser.Scale.PORTRAIT:\ncase Phaser.Scale.PORTRAIT_SECONDARY:\n// ...\nbreak;\n\ndefault:  // Phaser.Scale.LANDSCAPE or Phaser.Scale.LANDSCAPE_SECONDARY\n// ...\nbreak;\n}\n});\n
    "},{"location":"orientation/#lock-orientation","title":"Lock orientation","text":"
    scene.scale.lockOrientation(orientation)\n
    • orientation :
      • 'portrait'
      • 'landscape'
      • 'portrait-primary'
      • 'portrait-secondary'
      • 'landscape-primary'
      • 'landscape-secondary'
      • 'default'
    "},{"location":"pad/","title":"Pad","text":""},{"location":"pad/#introduction","title":"Introduction","text":"

    Takes the given string and pads it out, to the length required, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"pad/#usage","title":"Usage","text":"
    var result = Phaser.Utils.String.Pad(str, len, pad, dir);\n
    • str : String, or number.
    • len : Length or result string.
    • pad : The string to pad it out.
    • dir :
      • 1 : Left
      • 2 : Right
      • 3 : Both
    "},{"location":"particles-along-bounds/","title":"Particles along bounds","text":""},{"location":"particles-along-bounds/#introduction","title":"Introduction","text":"

    Emit particles along bounds of game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"particles-along-bounds/#live-demos","title":"Live demos","text":"
    • Particles-along-bounds
    "},{"location":"particles-along-bounds/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"particles-along-bounds/#install-plugin","title":"Install plugin","text":""},{"location":"particles-along-bounds/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexparticlesalongboundsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexparticlesalongboundsplugin.min.js', true);\n
    • Start emit particles along bounds of game object
      var particles = scene.plugins.get('rexparticlesalongboundsplugin').startEffect(gameObject, config);\n
    "},{"location":"particles-along-bounds/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DragPlugin from 'phaser3-rex-plugins/plugins/particlesalongbounds-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexParticlesAlongBounds',\nplugin: ParticlesAlongBoundsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Start emit particles along bounds of game object
      var particles = scene.plugins.get('rexParticlesAlongBounds').startEffect(gameObject, config);\n
    "},{"location":"particles-along-bounds/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ParticlesAlongBounds from 'phaser3-rex-plugins/plugins/particlesalongbounds.js';\n
    • Start emit particles along bounds of game object
      var particles = ParticlesAlongBounds(gameObject, config);\n
    "},{"location":"particles-along-bounds/#create-instance","title":"Create instance","text":"
    var particles = scene.plugins.get('rexParticlesAlongBounds').startEffect(gameObject, {\ntextureKey: key,\n// textureFrames: undefined,\n// padding: 0,\n// blendMode: 'ADD',\n// lifespan: 1000,\n// stepRate: 10,\n// spread: 10,\n\n// scale: undefined,\n// alpha: undefined,\n// tint: undefined,\n\n// repeat: 0,\n// gravityX: 0,\n// gravityY: 0,\n// duration: undefined\n});\n
    • padding : Extra padded space around bounds of game object. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • textureKey : Texture key of particles.
    • textureFrames : : One or more texture frames, or a configuration object.
      • String or number value.
      • Array of string or number value.
      • Configuration object :
        {\nframes: [],\ncycle: false,\nquantity: 1\n}\n
    • blendMode : Blend mode of particles. Default value is ADD.
    • lifespan : Lifespan of particle.
    • stepRate : Step length between each particle's initial position along bounds of game object.
    • spread : Moving speed of particle.
    • scale : Scale changing of particle.
    • alpha : Alpha changing of particle.
    • tint : Tint changing of particle.
    • repeat : Fire particles around bounds repeatly.
      • 0 : Fire particles around bounds one time, default value.
    • gravityX, gravityY : Gravity vector of world axis. This vector will rotate back if game object is rotated.
    • duration : Total duration from firing of 1st particle to destroy last particle.
      • undefined : Use default behavior of particles
      • Less or equal to lifespan : Fires all particles at begining.

    Format of spread, scale, alpha, tint parameters :

    • {min, max} : Pick a random value between min and max
    • {start, end} : Pick values incremented continuously across a range. (ease='Linear')
      • {start, end, ease}
    • {start, end, steps} : Pick values incremented by steps across a range.
    • {start, end, random}
      • random: true or false
    • {min, max, steps} : Pick values between min to max, with steps.
    • {onEmit: function(particle, key, t, value) {return value}} : Get return value from a function invoking.
    "},{"location":"particles-along-bounds/#is-running","title":"Is running","text":"
    var isRunning = particles.isRunning;\n
    "},{"location":"particles-along-bounds/#events","title":"Events","text":"
    • On fire completed, i.e. last particle is dead
      particles.on('complete', function(gameObject, particles){\n\n}, scope);\n
    "},{"location":"particles/","title":"Particles","text":""},{"location":"particles/#introduction","title":"Introduction","text":"

    Particles uses its own lightweight physics system, and can interact only with its Emitter's bounds and zones. Built-in game object of phaser.

    • Author: Richard Davey

    Note

    API is not compatible with 3.55.x

    "},{"location":"particles/#usage","title":"Usage","text":""},{"location":"particles/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"particles/#add-particle","title":"Add particle","text":"
    var particles = scene.add.particles(x, y, texture, {\n\n// EmitterOp\naccelerationX: 0,\naccelerationY: 0,\nalpha: 1,\nangle: { min: 0, max: 360 },\nbounce: 0,\ncolor: undefined,\ndelay: 0,\nhold: 0,\nlifespan: 1000,\nmaxVelocityX: 10000,\nmaxVelocityY: 10000,\nmoveToX: 0,\nmoveToY: 0,\nquantity: 1,\nrotate: 0,\nscaleX: 1,\nscaleY: 1,\n// scale:\nspeedX: 0,\nspeedY: 0,\nspeed: tint: 0xffffff,\nx: 0,\ny: 0,\n\n// Emitter properties\nactive:\nadvance:\nblendMode:\ncolorEase:\ndeathCallback:\ndeathCallbackScope:\nduration:\nemitCallback:\nemitCallbackScope:\n// callbackScope    \nfrequency:\ngravityX:\ngravityY:\nmaxAliveParticles:\nmaxParticles:\nname:\nemitting:\nparticleBringToTop:\nparticleClass:\nradial:\nsortCallback:\nsortOrderAsc:\nsortProperty:\nstopAfter:\ntintFill:\ntimeScale:\ntrackVisible:\nvisible:\n\n// Position\n// emitZone : random-zone, edge-zone\n// random-zone\nemitZone: {\ntype: 'random',\nsource: geom,\n},\n\n// edge-zone\nemitZone:{\ntype: 'edge',\nsource: geom,\nquantity: 1,\nstepRate: 0,\ntotal: -1,\nyoyo: false,\nseamless: true\n},\n\ndeathZone: {\ntype: 'onEnter', // 'onEnter', or 'onLeave'\nsource: geom,\n},\n\nbounds:               // {x, y, w, h}, or {x, y, width, height}, or Phaser.Geom.Rectangle\ncollideLeft: true,\ncollideRight: true,\ncollideTop: true,\ncollideBottom: true,\n\nfollow:\nfollowOffset:{\nx: 0,\ny: 0\n},\n\n// Texture\ntexture:\nframe:\nanim: [],  // string, or array of string\n\nreserve: 0,\nadvance: 0\n});\n
    • Parameters of EmitterOp : Number, Random Array, Custom Callback, Stepped start/end, Eased start/end, min/max, Random object, Custom onEmit onUpdate, Interpolation
      • A number
      • {min, max} : Pick a random value between min and max
      • {min, max, int}
      • {start, end} : Pick values incremented continuously across a range. (ease='Linear')
        • {start, end, ease}
        • {start, end, ease, easeParams}
      • {start, end, steps} : Pick values incremented by steps across a range.
      • {start, end, steps, yoyo: true}
      • {start, end, random}
        • random: true or false
      • {random: [start, end]} : Pick a random number between start and and.
      • [a, b, c, d] : Pick a random number from an array.
      • {min, max, steps} : Pick values between min to max, with steps.
      • { values: [ a, b, c, d ], interpolation: 'catmull', ease: 'linear' } : Interpolation (linear, bezier, catmull) in values array.
      • function(particle, key, t, value) { return value; }
      • {onEmit, onUpdate} : Get return value from a function invoking.
        function(particle, key, t, value) {\nreturn value;\n}\n
    • active : Whether this emitter updates itself and its particles.
      • false : Equal to pause.
    • advance : If you wish to fast forward the emitter in time, set this value to a number representing the amount of ms the emitter should advance.
    • blendMode : See blend mode
    • colorEase : The string-based name of the Easing function to use if you have enabled Particle color interpolation via the color property, otherwise has no effect.
    • deathCallback, deathCallbackScope
      function(particle) {\n\n}\n
    • emitCallback, emitCallbackScope
      function(particle, emitter) {\n\n}\n
    • duration : Limit the emitter to emit particles for a maximum of duration ms.
      • 0 : Forever, default behavior.
    • follow : A Game Object whose position is used as the particle origin.
    • followOffset : The offset of the particle origin from thefollow target.
    • frequency
      • 0 : One particle flow cycle for each logic update (the maximum flow frequency).
      • > 0 : The time interval between particle flow cycles in ms.
      • -1 : Exploding emitter.
    • hold : Frozen or 'held in place' after it has finished its lifespan for a set number of ms
    • gravityX, gravityY
    • maxAliveParticles
    • maxParticles
      • 0 : Unlimited.
      • > 0 : Hard limit the amount of particle objects.
    • frames : One or more texture frames, or a configuration object.
      • String or number value
      • Array of string or number value
      • Configuration object :
        {\nframes: [],\ncycle: false,\nquantity: 1\n}\n
    • anim :
      • String
      • Array of string
      • Configuration object :
        {\nanim: [],  // Array of string\ncycle: false,\nquantity: 1\n}\n
    • particleBringToTop :
      • true : Newly emitted particles are added to the top of the particle list, i.e. rendered above those already alive. Default behavior.
    • sortCallback : The callback used to sort the particles.
    • sortProperty : Optionally sort the particles before they render based on this property. The property must exist on the Particle class, such as y, lifeT, scaleX, etc.
    • sortOrderAsc : When sortProperty is defined this controls the sorting order, either ascending or descending.
    • stopAfter : The Particle Emitter will stop emitting particles once this total has been reached. It will then enter a 'stopped' state, firing the STOP event.
    • radial : A radial emitter will emit particles in all directions between angle min and max,
    • emitting : Controls if the emitter is currently emitting a particle flow (when frequency >= 0). Already alive particles will continue to update until they expire.
      • false : Equal to stop
    • tintFill :
    • timeScale : The time rate applied to active particles, affecting lifespan, movement, and tweens. Values larger than 1 are faster than normal.
    • trackVisible : Whether the emitter's visible state will track the follow target's visibility state.
    • emitZone :
      • Emit zone
        {\ntype: 'random',\nsource: geom,\n}            
      • Emit edge
        {\ntype: 'edge',\nsource: curve,\n\nquantity: 1,\nstepRate: 0,\nyoyo: false,\nseamless: true\n}            
    • deathZone
      {\ntype: 'onEnter', // 'onEnter', or 'onLeave'\nsource: geom\n}\n
    • bounds : {x, y, w, h}, or {x, y, width, height}, or Rectangle.
    • collideLeft, collideRight, collideTop, collideBottom : Whether particles interact with the left/right/top/bottom edge of the bounds.
    • name
    • particleClass
    "},{"location":"particles/#control","title":"Control","text":"
    • Start
      emitter.start();\n// emitter.start(advance, duration);\n
      • advance : Advance this number of ms in time through the emitter.
      • duration : Limit this emitter to only emit particles for the given number of ms. Setting this parameter will override any duration already set in the Emitter configuration object.
    • Stop
      emitter.stop();\n// emitter.stop(kill);\n
      • kill :
        • true : Kill all particles immediately
        • false : Leave them to die after their lifespan expires. Default behavior.
    • Pause
      emitter.pause();  // set `active` to false\n
    • Resume
      emitter.resume();  // set `active` to true\n
    • Starts (or restarts) a particle flow.
      emitter.flow(frequency, count, stopAfter);\n
      • frequency :
        • >= 0 : The time interval of each flow cycle, in ms
        • -1 : Explosion mode.
      • count : The number of particles to emit at each flow cycle.
      • stopAfter : Stop this emitter from firing any more particles once this value is reached.
        • Setting this parameter will override any stopAfter value already set in the Emitter configuration object.
        • 0 : Unlimited
    • Explode : Puts the emitter in explode mode (frequency = -1), stopping any current particle flow, and emits several particles all at once.
      emitter.explode();\n// emitter.explode(count, x, y);\n
      • count : The number of Particles to emit.
      • x, y : The x, y coordinate to emit the Particles from.
    • Emit : Emits particles at the given position. If no position is given, it will emit from this Emitters current location.
      emitter.emitParticleAt();\n// emitter.emitParticleAt(x, y, count);    \n
      or
      emitter.emitParticle(count, x, y);\n
      • count : The number of Particles to emit.
      • x, y : The x, y coordinate to emit the Particles from.
    • Fast forward
      emitter.fastForward(time, delta);\n
      • time : The number of ms to advance the Particle Emitter by.
      • delta : The amount of delta to use for each step. Defaults to 1000 / 60.
    • Kill all alive particles
      emitter.killAll()\n
    "},{"location":"particles/#follow-target","title":"Follow target","text":"
    • Start
      emitter.startFollow(target);\n// emitter.startFollow(target, offsetX, offsetY, trackVisible);\n
      • target : The Game Object to follow.
      • offsetX, offsetY : Horizontal/vertical offset of the particle origin from the Game Object.
      • trackVisible : Whether the emitter's visible state will track the target's visible state.
    • Stop
      emitter.stopFollow();\n
    "},{"location":"particles/#frame","title":"Frame","text":"

    emitter.setEmitterFrame(frames);\n// emitter.setEmitterFrame(frames, pickRandom, quantity);\n
    - frames : One or more texture frames, or a configuration object. - String or number value - Array of string or number value - Configuration object :
    {\nframes: [],\ncycle: false,\nquantity: 1\n}\n
    - pickRandom : - true : Whether frames should be assigned at random from frames. Default behavior. - quantity : The number of consecutive particles that will receive each frame. Default value is 1.

    "},{"location":"particles/#animation","title":"Animation","text":"

    emitter.setAnim(anims);\n// emitter.setAnim(anims, pickRandom, quantity);\n
    - anims : One or more animations, or a configuration object. - String - Array of string - Configuration object :
    {\nanims: [],\ncycle: false,\nquantity: 1\n}\n
    - anims : One or more animations names, or Play Animation Config objects. - String - Array of string - Animation config - Array of Animation config - pickRandom : - true : Whether frames should be assigned at random from frames. Default behavior. - quantity : The number of consecutive particles that will receive each frame. Default value is 1.

    "},{"location":"particles/#particle","title":"Particle","text":"
    • Speed
      emitter.setParticleSpeed(x, y);\n
      or
      emitter.speedX = x;\nemitter.speedY = y;\n
      • Changes the emitter from radial to a point emitter
    • Bounce
      emitter.bounce = value;\n
      • 0 : No bounce
      • 1 : Full rebound
    • Max velocity
      emitter.maxVelocityX = x;\nemitter.maxVelocityY = y;\n
    • Gravity
      emitter.setParticleGravity(x, y);\n
      or
      emitter.gravityX = x;\nemitter.gravityY = y;\n
    • Acceleration
      emitter.accelerationX = x;\nemitter.accelerationY = y;\n
    • Lifespan : Sets the lifespan of newly emitted particles in milliseconds.
      emitter.setParticleLifespan(time);\n
      or
      emitter.lifespan = time\n
    • The number of milliseconds to wait after emission before the particles start updating.
      emitter.delay = time;\n
    • The number of milliseconds to wait after a particle has finished its life before it will be removed.
      emitter.hold = time;\n
    • Tint
      emitter.setParticleTint(tint);\n
      or
      emitter.particleTint = tint;\n
      • Webgl only
    • Color
      emitter.particleColor = color;   // WebGL only.\nemitter.colorEase = easeName;\n
      • Webgl only
    • Alpha
      emitter.setParticleAlpha(alpha);\n
      or
      emitter.setAlpha(alpha);\n
      or
      emitter.particleAlpha = alpha;\n
    • Scale : Sets the vertical and horizontal scale of the emitted particles.
      emitter.setParticleScale(x, y);\n
      or
      emitter.setScale(x, y);\n
      or
      emitter.particleScaleX = x;\nemitter.particleScaleY = y;\n
    • Position
      emitter.particleX = x;\nemitter.particleY = y;\n
    • Position to move toward
      emitter.moveToX = x;\nemitter.moveToY = y;\n
    • The angle at which the particles are emitted.
      emitter.particleAngle = angle;  // degrees    \n
    • The rotation (or angle) of each particle when it is emitted.
      emitter.particleRotate = rotation; // degrees\n
    • The number of particles that are emitted each time an emission occurs
      emitter.quantity = quantity;\n
    • Hard limit the amount of particle objects
      var count = emitter.maxParticles;\n
      • Whether this emitter is at its limit
        var atLimit = emitter.atLimit();\n
    • Alive (active) particles
      • Amount of alive particles
        var count = emitter.getAliveParticleCount();\n
        or
        var count = emitter.alive.length;\n
      • Add callback for newly emitted particle
        var callback = function(particle, emitter) { /* ... */ }\nemitter.onParticleEmit(callback, context);\n
        • Clear callback
          emitter.onParticleEmit();\n
      • For each alive particle
        var callback = function(particle, emitter) { /* ... */ }\nemitter.forEachAlive(callback, context);\n
    • Dead (inactive) particles
      • Amount of dead particles
        var count = emitter.getDeadParticleCount();\n
        or
        var count = emitter.dead.length;\n
      • Add callback for each particle death
        var callback = function(particle, emitter) { /* ... */ }\nemitter.onParticleDeath(callback, context);\n
        • Clear callback
          emitter.onParticleDeath();\n
      • For each dead particle
        var callback = function(particle, emitter) { /* ... */ }\nemitter.forEachDead(callback, context);\n
      • Add dead particles into pool
        emitter.reserve(count);\n
    • Total (alive + dead) number of particles.
      var count = emitter.getParticleCount();\n
    • Active particles overlaps with a Rectangle Geometry object or an Arcade Physics Body.
      var particles = emitter.overlap(target);\n
      • target :
        • A Rectangle.
        • Arcade Physics Body.
      • particles : An array of Particles that overlap with the given target
    • Gets a bounds Rectangle calculated from the bounds of all currently active Particles
      emitter.getBounds(padding, advance, delta, output);\n
      • padding : The amount of padding, in pixels, to add to the bounds Rectangle.
      • advance, delta : Fast forward in time to try and allow the bounds to be more accurate.
      • output : The Rectangle to store the results in.
    • Gets the bounds of this particle as a Geometry Rectangle
      particle.getBounds();\n
    "},{"location":"particles/#render-order","title":"Render order","text":"
    • Sort by property
      emitter.setSortProperty(property, ascending);\n
      • property : The property on the Particle class to sort by.
      • ascending : Should the particles be sorted in ascending or descending order?
    • Sort by callback
      var callback = function(particleA, particleB) {\nreturn 1; // 0,1,-1\n}\nemitter.setSortCallback(callback);\n
    "},{"location":"particles/#emitter","title":"Emitter","text":"
    • Frequency
      emitter.setFrequency(frequency);\n// emitter.setFrequency(frequency, quantity);\n
      • frequency :
        • >= 0 : The time interval of each flow cycle, in ms
        • -1 : Explosion mode.
      • quantity : The number of particles to release at each flow cycle or explosion.
    • Quantity
      emitter.setQuantity(quantity);\n
      • quantity : The number of particles to release at each flow cycle or explosion.
    "},{"location":"particles/#zone","title":"Zone","text":""},{"location":"particles/#emit-zone","title":"Emit zone","text":""},{"location":"particles/#add-emit-zone","title":"Add emit zone","text":"
    var zone = emitter.addEmitZone({\ntype: 'random',\nsource: geom,\n});\n
    • source : Geom like Circle, Ellipse, Rectangle,Triangle, Polygon, BitmapZone, or Path or Curve, which has getRandomPoint(point) method
      • Custom zone
        {\ngetRandomPoint: function(point) {\n// point.x = ...\n// point.y = ...\nreturn point;\n}\n}\n
    "},{"location":"particles/#add-emit-edge","title":"Add emit edge","text":"
    var zone = emitter.addEmitZone({\ntype: 'edge',\nsource: curve,\n\nquantity: 1,\nstepRate: 0,\nyoyo: false,\nseamless: true,\ntotal: -1\n});\n
    • source : Geom like Circle, Ellipse, Rectangle,Triangle, Polygon, or Path or Curve, which has getPoints(quantity, stepRate) method
      • Custom edge
        {\ngetPoints: function(quantity, stepRate) {\n// output = [point0, point1, ...];  // point: Phaser.Math.Vector2, or {x, y}\nreturn output;\n}\n}\n
    • quantity : The number of particles to place on the source edge. Set to 0 to use stepRate instead.
    • stepRate : The distance between each particle. When set, quantity is implied and should be set to 0.
    • yoyo : Whether particles are placed from start to end and then end to start. Default is false.
    • seamless : Whether one endpoint will be removed if it's identical to the other. Default is true.
    • total : The total number of particles this zone will emit before passing over to the next emission zone in the Emitter.

    quantity or stepRate

    • Any geometry like circle, ellipse, kine, polygon, rectangle, triangle source has quantity, or stepRate
    • Curve source has quantity, or stepRate
    • Path source only has quantity
    "},{"location":"particles/#set-emit-zone","title":"Set emit zone","text":"
    emitter.setEmitZone(zone);\n
    • zone : The Emit Zone to set as the active zone.
      • A zone object
      • A number as index
    "},{"location":"particles/#zone-source","title":"Zone source","text":"
    • Get
      // var zone = emitter.emitZones[i];\nvar source = zone.source;    
    • (Edge type only) Update points of curve source
      zone.updateSource();\n
    • (Edge type only) Set source to another curve, also update points
      zone.changeSource(curve);\n
    "},{"location":"particles/#remove-emit-zone","title":"Remove emit zone","text":"
    emitter.removeEmitZone(zone)\n
    "},{"location":"particles/#clear-emit-zone","title":"Clear emit zone","text":"

    emitter.clearEmitZones();\n
    or
    emitter.emitZones.length = 0;\nemitter.zoneIndex = 0;\n

    "},{"location":"particles/#death-zone","title":"Death zone","text":"
    var zone = emitter.addDeathZone({\ntype: 'onEnter',\nsource: geom\n});\n
    • type : 'onEnter' or 'onLeave'
    • source : Geom like Circle, Ellipse, Rectangle,Triangle, Polygon
      • Custom source :
        {\ncontains: function (x, y) {\n// ...\nreturn bool;\n}\n}\n
    "},{"location":"particles/#remove-death-zone","title":"Remove death zone","text":"
    emitter.removeDeathZone(zone)\n
    "},{"location":"particles/#clear-death-zone","title":"Clear death zone","text":"

    emitter.clearDeathZones();\n
    or
    emitter.deathZones.length = 0;\n

    "},{"location":"particles/#update-configuration","title":"Update Configuration","text":"
    emitter.updateConfig(config)\n
    • config : See config parameter in constructor.
    "},{"location":"particles/#events","title":"Events","text":"
    • Starts emission of particles.
      emitter.on('start', function(emitter) {\n\n})\n
    • Explodes a set of particles.
      emitter.on('explode', function(emitter, particle) {\n\n})\n
    • Death Zone kills a Particle instance.
      emitter.on('deathzone', function(emitter, particle, zone) {\n\n})\n
    • Stops emission
      emitter.on('stop', function(emitter) {\n\n})\n
      • Directly call the ParticleEmitter.stop method.
      • Stop after a set time via the duration property.
      • Stop after a set number of particles via the stopAfter property.
    • Complete Event, no particles are still rendering at this point in time.
      emitter.on('complete', function(emitter) {\n\n})\n
    "},{"location":"particles/#bounds","title":"Bounds","text":"
    • Add bounds
      var bounds = emitter.addParticleBounds(x, y, width, height);\n// var bounds = emitter.addParticleBounds(x, y, width, height, collideLeft, collideRight, collideTop, collideBottom);\n
      or
      var bounds = emitter.addParticleBounds(rect);\n
      • x, y, width, height, {x, y, width, height}, or {x, y, w, h}, or Rectangle : Bounds
      • collideLeft, collideRight, collideTop, collideBottom : Whether particles interact with the left/right/top/bottom edge of the bounds.
    • Collide edges
      bounds.collideLeft = enabled;\nbounds.collideRight = enabled;\nbounds.collideTop = enabled;\nbounds.collideBottom = enabled;\n
    • Bound rectangle
      var rect = bounds.bounds;\n
      • rect : Rectangle
    "},{"location":"particles/#gravity-well","title":"Gravity well","text":"
    • Create a gravity well
      var well = particles.createGravityWell({\n// x: 0,\n// y: 0,\n// power: 0,\n// epsilon: 100,\n// gravity: 50\n});\n
    • Enable
      • Active
        well.active = true;\n
      • Inactive
        well.active = false;\n
    • Position
      well.x = x;\nwell.y = y;\n
    • Gravity
      well.gravity = value;\n
    • Power
      well.power = value;\n
    "},{"location":"particles/#custom-particle-processor","title":"Custom Particle Processor","text":"
    • Declare Particle Processor class
      class MyParticleProcessor extends Phaser.GameObjects.Particles.ParticleProcessor {\nconstructor() {\nsuper(x, y, active);\n// ...\n}\n\nupdate(particle, delta, step, t) {\n// particle : The Particle to update.\n// delta : The delta time in ms.\n// step : The delta value divided by 1000.\n// t : The current normalized lifetime of the particle, between 0 (birth) and 1 (death).\n}\n\ndestroy() {\nsuper.destroy();\n}\n}\n
      • Override update method
    • Add to emitter
      var myParticleProcessor = emitter.addParticleProcessor(new MyParticleProcessor);\n
    "},{"location":"particles/#custom-particle-class","title":"Custom particle class","text":"
    class MyParticle extends Phaser.GameObjects.Particles.Particle {\nconstructor (emitter) {\nsuper(emitter);\n/* ... */\n}\n\nupdate (delta, step, processors) {\nsuper.update(delta, step, processors);\n/* ... */\n}\n}\n
    "},{"location":"particles/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"particles/#create-mask","title":"Create mask","text":"
    var mask = emitter.createBitmapMask();\n

    See mask

    "},{"location":"particles/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"path/","title":"Path","text":""},{"location":"path/#introduction","title":"Introduction","text":"

    Path in curves, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"path/#usage","title":"Usage","text":""},{"location":"path/#add-path-object","title":"Add path object","text":"
    var path = scene.add.path();\n// var path = scene.add.path(x, y);  // curve start from (x, y)\n

    or

    var path = new Phaser.Curves.Path();\n// var path = new Phaser.Curves.Path(x, y);  // curve start from (x, y)\n
    "},{"location":"path/#add-path-object-with-curves","title":"Add path object with curves","text":"

    Curves in JSON

    var path = scene.add.path(json);\n
    or
    var path = new Phaser.Curves.Path(json);\n

    "},{"location":"path/#add-curve","title":"Add curve","text":""},{"location":"path/#line","title":"Line","text":"
    • Add line object
      1. Create line object
        var curve = new Phaser.Curves.Line({x: x0, y: y0}, {x: x1, y: y1});\n
        or
        var curve = new Phaser.Curves.Line([x0, y0, x1, y1]);\n
      2. Add to path
        path.add(curve);\n
    • Add line started from previous end point to next point
      path.lineTo(endX, endY);\n
      or
      path.lineTo(new Phaser.Math.Vector2({x, y}));\n

    Properties:

    • curve.p0 : The first endpoint.
      • curve.p0.x, curve.p0.y
    • curve.p1 : The second endpoint.
      • curve.p1.x, curve.p1.y
    "},{"location":"path/#circleellipsearc","title":"Circle/ellipse/arc","text":"
    • Add circle/ellipse/arc object
      1. Create circle/ellipse/arc object
        • Circle
          var curve = new Phaser.Curves.Ellipse(x, y, radius);\n
        • Ellipse
          var curve = new Phaser.Curves.Ellipse(x, y, xRadius, yRadius);\n
        • Arc
          var curve = new Phaser.Curves.Ellipse(x, y, xRadius, yRadius, startAngle, endAngle, clockwise,     rotation);\n
      2. Add to path
        path.add(curve);\n
    • Add circle/ellipse/arc started from previous end point to next point
      • Circle
        path.circleTo(radius);\n
      • Ellipse
        path.ellipseTo(xRadius, yRadius);\n
      • Arc
        path.ellipseTo(xRadius, yRadius, startAngle, endAngle, clockwise, rotation);\n

    Properties:

    • curve.p0 : Center point.
      • curve.p0.x, curve.p0.y
    • curve.xRadius, curve.yRadius : Horizontal/vertical radiuse.
    • curve.startAngle, curve.endAngle : Start/end angle, in degrees.
    • curve.clockwise : true if Clockwise, false if anti-clockwise.
    • curve.angle : Rotation, in degrees.
      • curve.rotation : Rotation, in radians.
    "},{"location":"path/#spline","title":"Spline","text":"
    • Add spline object
      1. Create spline object
        var curve = new Phaser.Curves.Spline([\np0,            // {x, y}, or [x, y]\np1,            // {x, y}, or [x, y]\n// ...\n]);\n
        or
        var curve = new Phaser.Curves.Spline([\nx0, y0,\nx1, y1,\n// ...\n]);\n
      2. Add to path
        path.add(curve);\n
    • Add spline started from previous end point to next point
      var points = ;\npath.splineTo([\np0,            // {x, y}, or [x, y]\np1,            // {x, y}, or [x, y]\n// ...\n]);\n
      or
      path.splineTo([\nx0, y0,\nx1, y1,\n// ...\n]);\n
    "},{"location":"path/#append-point","title":"Append point","text":"
    var point = curve.addPoint(x, y);\n
    "},{"location":"path/#quadratic-bezier-curve","title":"Quadratic bezier curve","text":"
    1. Create quadratic bezier curve object
      var curve = new Phaser.Curves.QuadraticBezier(startPoint, controlPoint, endPoint); // point: {x, y}\n
      or
      var points = [\nx0, y0,     // start point\nx1, y1,     // control point\nx2, y2      // end point\n];\nvar curve = new Phaser.Curves.QuadraticBezier(points);\n
    2. Add to path
      path.add(curve);\n

    Add quadratic bezier curve started from previous end point to next point

    path.quadraticBezierTo(endX, endY, controlX, controlY);\n
    or
    path.quadraticBezierTo(endPoint, controlPoint);  // point : Phaser.Math.Vector2\n

    "},{"location":"path/#cubic-bezier-curve","title":"Cubic bezier curve","text":"
    1. Create quadratic bezier curve object
      var curve = new Phaser.Curves.CubicBezier(startPoint, controlPoint1, controlPoint2, endPoint); // point: {x, y}\n
      or
      var points = [\nx0, y0,     // start point\nx1, y1,     // control point1\nx2, y2,     // control point2\nx3, y3      // end point\n];\nvar curve = new Phaser.Curves.CubicBezier(points);\n
    2. Add to path
      path.add(curve);\n

    Add cubic bezier curve started from previous end point to next point

    path.cubicBezierTo(endX, endY, control1X, control1Y, control2X, control2Y);\n
    or
    path.cubicBezierTo(endPoint, controlPoint1, controlPoint2);  // point : Phaser.Math.Vector2\n

    "},{"location":"path/#move-to-point","title":"Move to point","text":"
    path.moveTo(x, y);\n
    "},{"location":"path/#add-curves-from-json","title":"Add curves from JSON","text":"
    path.fromJSON(json);\n
    "},{"location":"path/#get-curves","title":"Get curves","text":"
    var curves = path.curves;\n
    "},{"location":"path/#get-curve-at-t","title":"Get curve at t","text":"
    var curve = path.getCurveAt(t);\n
    • t : The normalized location on the Path. Between 0 and 1
    "},{"location":"path/#draw-on-graphics","title":"Draw on graphics","text":"
    path.draw(graphics);\n// path.draw(graphics, pointsTotal);\n
    • pointsTotal : The number of points to draw for each Curve.

    or

    curve.draw(graphics);\n// curve.draw(graphics, pointsTotal);\n
    • pointsTotal : The resolution of the curve.
    "},{"location":"path/#point","title":"Point","text":"
    • Get point
      var out = path.getPoint(t);  // t: 0 ~ 1\n// var out = path.getPoint(t, out);  // modify out\n
      or
      var out = curve.getPoint(t);  // t: 0 ~ 1\n// var out = curve.getPoint(t, out);  // modify out\n
      Distance of path from start point to target point (out) might not linear with t.
    • Get random point
      var out = path.getRandomPoint();\n// var out = path.getRandomPoint(out);  // modify out\n
      or
      var out = curve.getRandomPoint();\n// var out = curve.getRandomPoint(out);  // modify out\n
    • Get n points
      • Path
        var points = path.getPoints(divisions);\n
        • divisions : The number of divisions per resolution per curve.
      • Curve
        var points = curve.getPoints(divisions);\n// var points = curve.getPoints(divisions, undefined, out);\n
        or
        var points = curve.getPoints(undefined, stepRate);\n// var points = curve.getPoints(undefined, stepRate, out);\n
        • divisions : The number of divisions in this curve.
          1. divisions, if divisions > 0, else
          2. this.getLength / stepRate, if stepRate > 0, else
          3. defaultDivisions
        • points : Return 1 + divisions points.
    • Get (n+1) points equally spaced out along the curve
      var points = path.getSpacedPoints(n);\n
      or
      var points = curve.getSpacedPoints(n);\n// var points = curve.getSpacedPoints(undefined, stepRate);\n// var points = curve.getSpacedPoints(divisions, stepRate, out);\n
    • Get points spaced out n distance pixels apart
      var points = curve.getDistancePoints(n)\n
      The smaller the distance, the larger the array will be. Path object does NOT support this feature yet.
    • Get start point
      var out = path.getStartPoint();\n// var out = path.getStartPoint(out);  // modify out\n
      or
      var out = curve.getStartPoint();\n// var out = curve.getStartPoint(out);  // modify out\n
    • Get end point
      var out = path.getEndPoint();\n// var out = path.getEndPoint(out);  // modify out\n
      or
      var out = curve.getEndPoint();\n// var out = curve.getEndPoint(out);  // modify out\n
    • Get t (0~1) from distance
      var t = curve.getTFromDistance(d);\n
      Path object does NOT support this feature yet.
    • Get tangent
      var out = path.getTangent(t);  // t: 0~1\n// var out = path.getTangent(t, out);  // modify out\n
      or
      var out = curve.getTangent(t);  // t: 0~1\n// var out = curve.getTangent(t, out);  // modify out\n
    "},{"location":"path/#length-of-path","title":"Length of path","text":"

    var l = path.getLength();\n
    or
    var l = curve.getLength();\n

    Length of path/curve will be cached.

    "},{"location":"path/#update-length","title":"Update length","text":"

    path.updateArcLengths();\n
    or
    curve.updateArcLengths();\n

    "},{"location":"path/#curves-to-json","title":"Curves to JSON","text":"

    var json = path.toJSON();\n
    or
    var json = curve.toJSON();\n

    "},{"location":"path/#bounds","title":"Bounds","text":"

    Get bounds

    var out = path.getBounds();    // accuracy = 16\n// var out = path.getBounds(out);\n// var out = path.getBounds(out, accuracy);\n
    or
    var out = curve.getBounds();    // accuracy = 16\n// var out = curve.getBounds(out);\n// var out = curve.getBounds(out, accuracy);\n

    • out : A rectangle object
    "},{"location":"path/#destroy","title":"Destroy","text":"
    path.destroy();\n
    "},{"location":"pathfollower/","title":"Path follower","text":""},{"location":"pathfollower/#introduction","title":"Introduction","text":"

    Set position of game object on a path.

    • Author: Rex
    • Behavior of game object
    "},{"location":"pathfollower/#live-demos","title":"Live demos","text":"
    • Path follower
    • Spaced points
    "},{"location":"pathfollower/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"pathfollower/#install-plugin","title":"Install plugin","text":""},{"location":"pathfollower/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexpathfollowerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexpathfollowerplugin.min.js', true);\n
    • Add path-follower behavior
      var pathFollower = scene.plugins.get('rexpathfollowerplugin').add(gameObject, config);\n
    "},{"location":"pathfollower/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PathFollowerPlugin from 'phaser3-rex-plugins/plugins/pathfollower-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPathFollower',\nplugin: PathFollowerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add path-follower behavior
      var pathFollower = scene.plugins.get('rexPathFollower').add(gameObject, config);\n
    "},{"location":"pathfollower/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import PathFollower from 'phaser3-rex-plugins/plugins/pathfollower.js';\n
    • Add path-follower behavior
      var pathFollower = new PathFollower(gameObject, config);\n
    "},{"location":"pathfollower/#create-instance","title":"Create instance","text":"
    // var path = scene.add.path();\nvar pathFollower = scene.plugins.get('rexPathFollower').add(gameObject, {\n// path: path,          // path object\n// t: 0,                // t: 0~1\n// rotateToPath: false,\n// rotationOffset: 0,\n// angleOffset: 0,\n\n// spacedPoints: false,\n// spacedPoints: {\n//     divisions: undefined,\n//     stepRate: 10,\n// }\n\n});\n
    • path : Path object
    • t : Initial value of property t (0~1)
    • rotateToPath: Set true to change angle towards path
    • rotationOffset : Rotation offset in radian, or angleOffset in degrees
    • spacedPoints :
      • false, or undefined : Get point by path.getPoint(t)
      • spacedPoints.divisions, spacedPoints.stepRate :
        1. Get points by path.getSpacedPoints(divisions, stepRate)
        2. Get point from linear interpolation of points in step1.
    "},{"location":"pathfollower/#move-along-path","title":"Move along path","text":"

    Set pathFollower.t (0~1) to move along path

    pathFollower.t = t;  // t: 0~1\n// pathFollower.setT(t);\n

    or tween pathFollower.t

    var tween = scene.tweens.add({\ntargets: pathFollower,\nt: 1,\nease: 'Linear', // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,\nyoyo: false\n});\n
    "},{"location":"pathfollower/#set-path","title":"Set path","text":"
    pathFollower.setPath(path);\n
    "},{"location":"pathfollower/#set-rotate-to-path","title":"Set rotate-to-path","text":"
    pathFollower.setRotateToPath(rotateToPath, rotationOffset);\n
    • rotateToPath : Set true to change angle towards path
    • rotationOffset : Rotation offset in radian
    "},{"location":"percentage/","title":"Percentage","text":""},{"location":"percentage/#introduction","title":"Introduction","text":"

    Work out what percentage value is of the range between min and max, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"percentage/#usage","title":"Usage","text":"
    var result = Phaser.Math.Percent(value, min, max);\n
    • result: Percentage/t (0~1).
    • value : The value to determine the percentage of.
    "},{"location":"perlin/","title":"Perlin","text":""},{"location":"perlin/#introduction","title":"Introduction","text":"

    Perlin2/Perlin3 noise and simplex2/simplex3 noise. (Reference)

    • Author: Rex
    • Method only
    "},{"location":"perlin/#live-demos","title":"Live demos","text":"
    • Perlin2
    • Terrain generator
    "},{"location":"perlin/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perlin/#install-plugin","title":"Install plugin","text":""},{"location":"perlin/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperlinplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperlinplugin.min.js', true);\n
    • Add perlin noise object
      var noise = scene.plugins.get('rexperlinplugin').add(seed);\n
    "},{"location":"perlin/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerlinPlugin from 'phaser3-rex-plugins/plugins/perlin-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerlin',\nplugin: PerlinPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add perlin noise object
      var noise = scene.plugins.get('rexPerlin').add(seed);\n
    "},{"location":"perlin/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Perlin from 'phaser3-rex-plugins/plugins/perlin.js';\n
    • Add perlin noise object
      var noise = new Perlin(seed);\n
    "},{"location":"perlin/#create-noise-instance","title":"Create noise instance","text":"
    var noise = scene.plugins.get('rexPerlin').add(seed);\n
    • seed : A seed for this noise, like Math.random()
    "},{"location":"perlin/#perlin","title":"Perlin","text":"
    • Perlin2
      var value = noise.perlin2(x, y);\n
      • value : -1 ~ 1
    • Perlin3
      var value = noise.perlin3(x, y, z);\n
      • value : -1 ~ 1
    "},{"location":"perlin/#simplex","title":"Simplex","text":"
    • Simplex2
      var value = noise.simplex2(x, y);\n
      • value : -1 ~ 1
    • Simplex3
      var value = noise.simplex3(x, y, z);\n
      • value : -1 ~ 1
    "},{"location":"perlin/#set-seed","title":"Set seed","text":"
    noise.setSeed(seed);\n
    "},{"location":"perspective-card/","title":"Card","text":""},{"location":"perspective-card/#introduction","title":"Introduction","text":"

    A container with two perspective-images.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-card/#live-demos","title":"Live demos","text":"
    • Flip card
    • Label front face
    • Change texture
    "},{"location":"perspective-card/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-card/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-card/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add card object
      var card = scene.add.rexPerspectiveCard(config);\n
    "},{"location":"perspective-card/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add card object
      var card = scene.add.rexPerspectiveCard(config);\n
    "},{"location":"perspective-card/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveCard } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add card object
      var card = new PerspectiveCard(scene, config);\nscene.add.existing(card);\n
    "},{"location":"perspective-card/#create-instance","title":"Create instance","text":"
    var card = scene.add.rexPerspectiveCard({\nx: 0, y: 0,\n\nback: {key, frame},\nfront: {key, frame},\nface: 0,\n\norientation: 0,\n\n// width,\n// height,\n\n// flip : {\n//     frontToBack: 0,\n//     backToFront: 1,\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n// flip: false\n});\n
    • front, back : Perspective image game object for front and back face.
      • {key, frame} : Texture key and frame name, to create perspective image
      • {width, height} : Width and height, to create perspective render texture.
      • Perspective image
      • Perspective render texture
    • face : Show front or back face.
      • 'front', or 0 : Show front face.
      • 'back', or 1 : Show back face.
    • orientation : Flipping orientation.
      • 'horizontal','h', 'x', or 0 : Flipping left-to-right, or right-to-left.
      • 'vertical','v', 'y', or 1 : Flipping top-to-bottom, or bottom-to-top.
    • width, height : Specific width and height of this card container.
      • undefined : Use width and height of front and back face.
    • flip : Configuration of flipping behavior.
      • flip.frontToBack, flip.backToFront : Flipping direction.
        • 'right', 'left-to-right', or 0 : Flipping from right to left.
        • 'left', 'right-to-left', or 1 : Flipping from left to right.
      • flip.duration : Duration of flipping, in millisecond.
      • flip.delay : Initial delay.
      • flip.ease : Ease function. Default value is 'Cubic'.
      • false : Don't add flipping behavior.

    Add card from JSON

    var card = scene.make.rexPerspectiveCard({\nx: 0,\ny: 0,\n\nfront,\nback,\nface: 0,\n\norientation: 0,\n\nwidth,\nheight,\n\nflip,\n\nadd: true\n});\n
    "},{"location":"perspective-card/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveCard extends PerspectiveCard {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var card = new MyPerspectiveCard(scene, config);\n
    "},{"location":"perspective-card/#face","title":"Face","text":"
    • Get
      var face = card.face;\n
      • face:
        • 0 : Show front face.
        • 1 : Show back face.
    • Set
      card.setFace(face)\n
      • face
        • 'front', or 0 : Show front face.
        • 'back', or 1 : Show back face.
    • Toggle
      card.toggleFace()\n
    "},{"location":"perspective-card/#face-instances","title":"Face instances","text":"
    • Front face
      var frontFace = card.frontFace;\n// var frontFace = card.faces.front;\n
    • Back face
      var backFace = card.backFace;\n// var backFace = card.faces.back;\n
    "},{"location":"perspective-card/#face-texture","title":"Face texture","text":"
    • Set texture of front face, assume that front face is a perspective image
      card.frontFace.setTexture(key);\n// card.frontFace.setTexture(key, frame);\n
    • Set texture of back face, assume that back face is a perspective image
      card.backFace.setTexture(key);\n// card.backFace.setTexture(key, frame);\n
    "},{"location":"perspective-card/#flip-behavior","title":"Flip behavior","text":""},{"location":"perspective-card/#start-flipping","title":"Start flipping","text":"
    card.flip.flip();\n// card.flip.flip(duration, repeat);\n
    • duration : Overwrite default duration value.
    • repeat : Number of flipping time (repeat + 1) during duration. Default value is 0.

    or

    • Flip-right
      card.flip.flipRight();\n// card.flip.flipRight(duration, repeat);\n
    • Flip-left
      card.flip.flipLeft();\n// card.flip.flipLeft(duration, repeat);\n
    "},{"location":"perspective-card/#stop-flipping","title":"Stop flipping","text":"
    card.flip.stop();\n
    "},{"location":"perspective-card/#set-duration","title":"Set duration","text":"
    card.flip.setDuration(duration);\n// card.flip.duration = duration;\n
    "},{"location":"perspective-card/#set-ease","title":"Set ease","text":"
    card.flip.setEase(ease);\n// card.flip.ease = ease;\n
    "},{"location":"perspective-card/#events","title":"Events","text":"
    • On flipping start
      card.flip.on('start', function(flip, card){\n// ...\n});\n
    • On flipping complete
      card.flip.on('complete', function(flip, card){\n// ...\n});\n
    "},{"location":"perspective-card/#status","title":"Status","text":"
    • Is flipping
      var isRunning = card.flip.isRunning;\n
    "},{"location":"perspective-card/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleX = card.angleX; // Angle in degrees\nvar angleY = card.angleY; // Angle in degrees\nvar angleZ = card.angleZ; // Angle in degrees\n
      or
      var rotationX = card.rotationX; // Angle in radians\nvar rotationY = card.rotationY; // Angle in radians\nvar rotationZ = card.rotationZ; // Angle in radians\n
    • Set rotation angle
      card.angleX = angleX; // Angle in degrees\ncard.angleY = angleY; // Angle in degrees\ncard.angleZ = angleZ; // Angle in degrees\n
      or
      card.rotationX = rotationX; // Angle in radians\ncard.rotationY = rotationY; // Angle in radians\ncard.rotationZ = rotationZ; // Angle in radians\n
    "},{"location":"perspective-card/#debug","title":"Debug","text":"
    1. Set debug Graphics
      var debugGraphics = scene.add.graphics();\ncard.setDebug(debugGraphics);\n
    2. Update Graphics in scene.update() method.
      debugGraphics.clear();\ndebugGraphics.lineStyle(1, 0x00ff00);\n
    "},{"location":"perspective-card/#other-properties","title":"Other properties","text":"

    See container, Mesh game object, game object

    "},{"location":"perspective-card/#create-mask","title":"Create mask","text":"
    var mask = card.createBitmapMask();\n

    See mask

    "},{"location":"perspective-card/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-carousel/","title":"Carousel","text":""},{"location":"perspective-carousel/#introduction","title":"Introduction","text":"

    A container with cards.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-carousel/#live-demos","title":"Live demos","text":"
    • Carousel
    • List
    • UI cards
    "},{"location":"perspective-carousel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-carousel/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-carousel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add carousel object
      var carousel = scene.add.rexPerspectiveCarousel(config);\n
    "},{"location":"perspective-carousel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add carousel object
      var carousel = scene.add.rexPerspectiveCarousel(config);\n
    "},{"location":"perspective-carousel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveCarousel } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add carousel object
      var carousel = new PerspectiveCarousel(scene, config);\nscene.add.existing(carousel);\n
    "},{"location":"perspective-carousel/#create-instance","title":"Create instance","text":"
    var carousel = scene.add.rexPerspectiveCarousel({\nx: 0, y: 0,\n\nfaces: [],\n// face: 0,\n// rtl: false,\n\n// width,\n// height,\n\n// faceWidth,\n// faceSpace: 0,\n\n// z: 1,\n// zEnd: 0,\n\n// roll : {\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n});\n
    • faces : Array of perspective-card, perspective-rendertexture, perspective-image, or null.
      • Assume that all faces have the same size
    • face : Index or name of current face (face at angle 0).
    • rtl
      • false : Place faces from left to right. Default behavior.
      • true : Place faces from right to left.
    • width, height : Specific width and height of this carousel container.
      • undefined : Use width and height of first face.
    • faceWidth : Width of face.
      • undefined : Use width of face. Assume that all faces have the same size.
    • faceSpace : Extra space of face width. Used when faceWidth is undefined.
    • z, zEnd : Range of faces' z-index. Default value is 1/0.
    • roll : Configuration of rolling behavior.
      • roll.duration : Duration of rolling, in millisecond.
      • roll.delay : Initial delay.
      • roll.ease : Ease function. Default value is 'Cubic'.
      • false : Don't add rolling behavior.

    Add carousel from JSON

    var carousel = scene.make.rexPerspectiveCarousel({\nx: 0,\ny: 0,\n\nfaces: [],\n\n// width,\n// height,\n\n// faceWidth,\n// faceSpace: 0,\n\n// z: 1,\n// zEnd: 0,\n\nadd: true\n});\n
    "},{"location":"perspective-carousel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveCarousel extends PerspectiveCarousel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var carousel = new MyPerspectiveCarousel(scene, config);\n
    "},{"location":"perspective-carousel/#face-instances","title":"Face instances","text":"
    var faces = carousel.faces;\n
    • faces : Array of face instances.
    "},{"location":"perspective-carousel/#face","title":"Face","text":"
    • Get
      var face = carousel.face;\n
      • face: Index of carousel.faces.
    • Set
      carousel.setFace(face)\n
      • face : Index or name of current face (face at angle 0).
    "},{"location":"perspective-carousel/#roll-behavior","title":"Roll behavior","text":""},{"location":"perspective-carousel/#start-rolling","title":"Start rolling","text":"
    • Roll to next face
      carousel.roll.toNext(duration);\n
      • duration : Overwrite default duration value.
    • Roll to previous face
      carousel.roll.toPrevious(duration);\n
      • duration : Overwrite default duration value.
    • Roll to right face
      carousel.roll.toRight(duration);\n
      • duration : Overwrite default duration value.
    • Roll to left face
      carousel.roll.toLeft(duration);\n
      • duration : Overwrite default duration value.
    • Roll to face
      carousel.roll.to(faceIndex, duration);\n
      • faceIndex :
        • A number : Index of face in carousel.faces
        • A string : Name of face (face.setName(name))
      • duration : Overwrite default duration value.
    "},{"location":"perspective-carousel/#stop-flipping","title":"Stop flipping","text":"
    carousel.roll.stop();\n
    "},{"location":"perspective-carousel/#set-duration","title":"Set duration","text":"
    carousel.roll.setDuration(duration);\n// carousel.roll.duration = duration;\n
    "},{"location":"perspective-carousel/#set-ease","title":"Set ease","text":"
    carousel.roll.setEase(ease);\n// carousel.roll.ease = ease;\n
    "},{"location":"perspective-carousel/#events","title":"Events","text":"
    • On rolling complete
      carousel.roll.on('complete', function(){\n// ...\n});\n
    "},{"location":"perspective-carousel/#status","title":"Status","text":"
    • Is rolling
      var isRunning = carousel.roll.isRunning;\n
    "},{"location":"perspective-carousel/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleY = carousel.angleY; // Angle in degrees\n
      or
      var rotationY = carousel.rotationY; // Angle in radians\n
    • Set rotation angle
      carousel.angleY = angleY; // Angle in degrees\n
      or
      carousel.rotationY = rotationY; // Angle in radians\n
    "},{"location":"perspective-carousel/#other-properties","title":"Other properties","text":"

    See container, Mesh game object, game object

    "},{"location":"perspective-carousel/#create-mask","title":"Create mask","text":"
    var mask = carousel.createBitmapMask();\n

    See mask

    "},{"location":"perspective-carousel/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-image/","title":"Image","text":""},{"location":"perspective-image/#introduction","title":"Introduction","text":"

    Image with perspective rotation.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-image/#live-demos","title":"Live demos","text":"
    • Flip image
    "},{"location":"perspective-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-image/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexPerspectiveImage(x, y, texture, frame, config);\n
    "},{"location":"perspective-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexPerspectiveImage(x, y, texture, frame, config);\n
    "},{"location":"perspective-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveImage } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add image object
      var image = new PerspectiveImage(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"perspective-image/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexPerspectiveImage(x, y, texture, frame, {\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    or

    var image = scene.add.rexPerspectiveImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    Add perspectiveimage from JSON

    var perspectiveimage = scene.make.rexPerspectiveImage({\nx: 0,\ny: 0,\n\nkey: null,\nframe: null,\n\n// hideCCW: false,\n// gridWidth: 32,\n// girdHeight: 32,\n\nadd: true\n});\n
    "},{"location":"perspective-image/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveImage extends PerspectiveImage {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyPerspectiveImage(scene, x, y, texture, frame, config);\n
    "},{"location":"perspective-image/#transform-vertices","title":"Transform vertices","text":"

    Offset then rotate all vertices.

    image.transformVerts(x, y, z, rotateX, rotateY, rotateZ);\n
    • x, y, z : Offset vertices
      • z+ : Near
      • z- : Far
      • x- : Left
      • x+ : Right
      • y+ : Up
      • y- : Down
    • rotateX, rotateY, rotateZ : Rotate vertices
    "},{"location":"perspective-image/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleX = image.angleX; // Angle in degrees\nvar angleY = image.angleY; // Angle in degrees\nvar angleZ = image.angleZ; // Angle in degrees\n
      or
      var rotationX = image.rotationX; // Angle in radians\nvar rotationY = image.rotationY; // Angle in radians\nvar rotationZ = image.rotationZ; // Angle in radians\n
    • Set rotation angle
      image.angleX = angleX; // Angle in degrees\nimage.angleY = angleY; // Angle in degrees\nimage.angleZ = angleZ; // Angle in degrees\n
      or
      image.rotationX = rotationX; // Angle in radians\nimage.rotationY = rotationY; // Angle in radians\nimage.rotationZ = rotationZ; // Angle in radians\n
    "},{"location":"perspective-image/#flip","title":"Flip","text":"
    scene.tweens.add({\ntargets: image,\nangleY: { start: 0, to: -180}\n})\n
    "},{"location":"perspective-image/#tint-color","title":"Tint color","text":"
    • Get
      var color = image.tint;\n
    • Set
      image.tint = color;\n
      or
      image.setTint(color);\n
    "},{"location":"perspective-image/#texture","title":"Texture","text":"
    image.setTexture(key);\n// image.setTexture(key, frame);\n
    "},{"location":"perspective-image/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"perspective-image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"perspective-image/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-imagecarousel/","title":"Image carousel","text":""},{"location":"perspective-imagecarousel/#introduction","title":"Introduction","text":"

    Display list of images.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-imagecarousel/#live-demos","title":"Live demos","text":"
    • List
    "},{"location":"perspective-imagecarousel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-imagecarousel/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-imagecarousel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add carousel object
      var carousel = scene.add.rexPerspectiveImageCarousel(config);\n
    "},{"location":"perspective-imagecarousel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add carousel object
      var carousel = scene.add.rexPerspectiveImageCarousel(config);\n
    "},{"location":"perspective-imagecarousel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveImageCarousel } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add carousel object
      var carousel = new PerspectiveImageCarousel(scene, config);\nscene.add.existing(carousel);\n
    "},{"location":"perspective-imagecarousel/#create-instance","title":"Create instance","text":"
    var carousel = scene.add.rexPerspectiveImageCarousel({\nx: 0, y: 0,\n\nimages: [],  // Array of {key, frame}\n// index: 0,\n// rtl: false,\n// repeat: true,\n\n// width,\n// height,\n// faceCount: 4,\n\n// z: 1,\n// zEnd: 0,\n\n// roll : {\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n});\n
    • images : Array of textures {key, frame}
      • Assume that all textures have the same size
    • index : Index of current image.
    • rtl
      • false : Place images from left to right. Default behavior.
      • true : Place images from right to left.
    • repeat : Set true to roll to first image from last, or last to first.
    • width, height : Specific width and height of this carousel container.
      • undefined : Use width and height of first image.
    • faceCount : Faces count of this carousel. A integer which >=3.
    • z, zEnd : Range of faces' z-index. Default value is 1/0.
    • roll : Configuration of rolling behavior.
      • roll.duration : Duration of rolling, in millisecond.
      • roll.delay : Initial delay.
      • roll.ease : Ease function. Default value is 'Cubic'.
      • false : Don't add rolling behavior.

    Add perspectiveimage from JSON

    var perspectiveimage = scene.make.rexPerspectiveImageCarousel({\nx: 0,\ny: 0,\n\nimages: [],  // Array of {key, frame}\n// index: 0,\n// rtl: false,\n// repeat: true,\n\n// width,\n// height,\n// faceCount: 4,\n\n// z: 1,\n// zEnd: 0,\n\n// roll : {\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n\nadd: true\n});\n
    "},{"location":"perspective-imagecarousel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveImageCarousel extends PerspectiveImageCarousel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var carousel = new MyPerspectiveImageCarousel(scene, config);\n
    "},{"location":"perspective-imagecarousel/#roll-behavior","title":"Roll behavior","text":""},{"location":"perspective-imagecarousel/#start-rolling","title":"Start rolling","text":"
    • Roll to next image
      carousel.roll.toNext(duration);\n
      • duration : Overwrite default duration value.
    • Roll to previous image
      carousel.roll.toPrevious(duration);\n
      • duration : Overwrite default duration value.
    • Roll to right image
      carousel.roll.toRight(duration);\n
      • duration : Overwrite default duration value.
    • Roll to left image
      carousel.roll.toLeft(duration);\n
      • duration : Overwrite default duration value.
    • Roll to image
      carousel.roll.to(faceIndex, duration);\n
      • faceIndex :
        • A number : Index of image.
      • duration : Overwrite default duration value.
    "},{"location":"perspective-imagecarousel/#set-duration","title":"Set duration","text":"
    carousel.roll.setDuration(duration);\n// carousel.roll.duration = duration;\n
    "},{"location":"perspective-imagecarousel/#set-ease","title":"Set ease","text":"
    carousel.roll.setEase(ease);\n// carousel.roll.ease = ease;\n
    "},{"location":"perspective-imagecarousel/#events","title":"Events","text":"
    • On rolling complete
      carousel.roll.on('complete', function(){\n// ...\n});\n
    "},{"location":"perspective-imagecarousel/#status","title":"Status","text":"
    • Is rolling
      var isRunning = carousel.roll.isRunning;\n
    "},{"location":"perspective-imagecarousel/#other-properties","title":"Other properties","text":"

    See container, Mesh game object, game object

    "},{"location":"perspective-imagecarousel/#create-mask","title":"Create mask","text":"
    var mask = carousel.createBitmapMask();\n

    See mask

    "},{"location":"perspective-imagecarousel/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-imagecarousel/#compare-with-plane-game-object","title":"Compare with Plane game object","text":"
    • Size
      • Size of Plane is equal to current render size.
      • Size of PerspectiveImage is equak to texture size, like normal Image game object.
    • Animation
      • Plane hae animation feature.
      • Useing PerspectiveSprite for animation feature, PerspectiveImage does not have this feature.
    • Checkerboard
      • Plane hae checkerboard feature.
      • PerspectiveImage does not have this feature.
    "},{"location":"perspective-rendertexture/","title":"Render texture","text":""},{"location":"perspective-rendertexture/#introduction","title":"Introduction","text":"

    Render texture with perspective rotation.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-rendertexture/#live-demos","title":"Live demos","text":"
    • RenderTexture
    "},{"location":"perspective-rendertexture/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-rendertexture/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-rendertexture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add render texture object
      var image = scene.add.rexPerspectiveRenderTexture(x, y, width, height, config);\n
    "},{"location":"perspective-rendertexture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add render texture object
      var image = scene.add.rexPerspectiveRenderTexturege(x, y, width, height, config);\n
    "},{"location":"perspective-rendertexture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveRenderTexture } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add render texture object
      var image = new PerspectiveRenderTexture(scene, x, y, width, height, config);\nscene.add.existing(image);\n
    "},{"location":"perspective-rendertexture/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexPerspectiveRenderTexturege(x, y, width, height, {\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    or

    var image = scene.add.rexPerspectiveRenderTexturege({\n// x: 0,\n// y: 0,\n// width: 32,\n// height: 32,\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    Add prespective render texture from JSON

    var image = scene.make.rexPerspectiveRenderTexturege({\nx: 0,\ny: 0,    width: 32,\nheight: 32,\n\n// hideCCW: false,\n// gridWidth: 32,\n// girdHeight: 32,\n\nadd: true\n});\n
    "},{"location":"perspective-rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveRenderTexturege extends PerspectiveRenderTexturege {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyPerspectiveRenderTexturege(scene, x, y, width, height, config);\n
    "},{"location":"perspective-rendertexture/#internal-render-texture","title":"Internal render texture","text":"
    var rt = image.rt;\n
    • rt : Render texture
    "},{"location":"perspective-rendertexture/#paste-texture","title":"Paste texture","text":"
    • Paste game object
      image.rt.draw(gameObject, x, y);\n// image.rt.draw(gameObject, x, y, alpha, tint);\n
    • gameObject : a game object, or an array of game objects
    • Paste game objects in a group
      image.rt.draw(group, x, y);\n// image.rt.draw(group, x, y, alpha, tint);\n
    • Paste game objects in a scene
      image.rt.draw(scene.children, x, y);\n// image.rt.draw(scene.children, x, y, alpha, tint);\n
    • Paste texture
      image.rt.draw(key, x, y);\n// image.rt.draw(key, x, y, alpha, tint);\n
      or
      image.rt.drawFrame(key, frame, x, y);\n// image.rt.drawFrame(key, frame, x, y, alpha, tint);\n
      • key : The key of the texture to be used, as stored in the Texture Manager.
    • Snapshop game objects
      image.snapshot(gameObjects);\n
      • gameObjects : Array of game objects.
    "},{"location":"perspective-rendertexture/#erase","title":"Erase","text":"
    image.rt.erase(gameObject, x, y);\n
    • gameObject : a game object, or an array of game objects
    "},{"location":"perspective-rendertexture/#clear","title":"Clear","text":"
    image.rt.clear();\n
    "},{"location":"perspective-rendertexture/#fill","title":"Fill","text":"
    image.rt.fill(rgb, alpha);\n// image.rt.fill(rgb, alpha, x, y, width, height);\n
    "},{"location":"perspective-rendertexture/#other-properties","title":"Other properties","text":"

    See Perspective image game object, Mesh game object, game object

    "},{"location":"perspective-rendertexture/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"perspective-rendertexture/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-sprite/","title":"Sprite","text":""},{"location":"perspective-sprite/#introduction","title":"Introduction","text":"

    Play animation on perspective-image.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-sprite/#live-demos","title":"Live demos","text":"
    • Play animation
    "},{"location":"perspective-sprite/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-sprite/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-sprite/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add sprite object
      var sprite = scene.add.rexPerspectiveSprite(x, y, texture, frame, config);\n
    "},{"location":"perspective-sprite/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sprite object
      var sprite = scene.add.rexPerspectiveSprite(x, y, texture, frame, config);\n
    "},{"location":"perspective-sprite/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveSprite } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add sprite object
      var sprite = new PerspectiveSprite(scene, x, y, texture, frame, config);\nscene.add.existing(sprite);\n
    "},{"location":"perspective-sprite/#create-instance","title":"Create instance","text":"
    var sprite = scene.add.rexPerspectiveSprite(x, y, texture, frame, {\n// width: undefined,\n// height: undefined,\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    or

    var sprite = scene.add.rexPerspectiveImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n// width: undefined,\n// height: undefined,\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    Add perspectiveimage from JSON

    var perspectiveimage = scene.make.rexPerspectiveImage({\nx: 0,\ny: 0,\n\nkey: null,\nframe: null,\n\n// width: undefined,\n// height: undefined,\n// hideCCW: false,\n// gridWidth: 32,\n// girdHeight: 32,\n\nadd: true\n});\n
    "},{"location":"perspective-sprite/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveSprite extends PerspectiveSprite {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var sprite = new MyPerspectiveSprite(scene, x, y, texture, frame, config);\n
    "},{"location":"perspective-sprite/#play-animation","title":"Play animation","text":"
    • Play
      sprite.play(key);\n// sprite.play(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
        • String key of animation
        • Animation config, to override default config
          {\nkey,\nframeRate,\nduration,\ndelay,\nrepeat,\nrepeatDelay,\nyoyo,\nshowOnStart,\nhideOnComplete,\nstartFrame,\ntimeScale\n}\n
    • Play in reverse
      sprite.playReverse(key);\n// sprite.playReverse(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
    • Play after delay
      sprite.playAfterDelay(key, delay);\n
      • key : Animation key string, or animation config
    • Play after repeat
      sprite.playAfterRepeat(key, repeatCount);\n
      • key : Animation key string, or animation config
    "},{"location":"perspective-sprite/#chain","title":"Chain","text":"
    • Chain next animation
      sprite.chain(key);\n
      • key : Animation key string, or animation config
    • Chain next and next animation
      sprite.chain(key0).chain(key1);\n
      • key0, key1 : Animation key string, or animation config
    "},{"location":"perspective-sprite/#stop","title":"Stop","text":"
    • Immediately stop
      sprite.stop();\n
    • Stop after delay
      sprite.stopAfterDelay(delay);\n
    • Stop at frame
      sprite.stopOnFrame(frame);\n
      • frame : Frame object in current animation.
        var currentAnim = sprite.anims.currentAnim;\nvar frame = currentAnim.getFrameAt(index);\n
    • Stop after repeat
      sprite.stopAfterRepeat(repeatCount);\n
    "},{"location":"perspective-sprite/#restart","title":"Restart","text":"
    sprite.anims.restart();\n// sprite.anims.restart(includeDelay, resetRepeats);\n
    "},{"location":"perspective-sprite/#other-properties","title":"Other properties","text":"

    See Perspective image game object, Mesh game object, game object

    "},{"location":"perspective-sprite/#create-mask","title":"Create mask","text":"
    var mask = sprite.createBitmapMask();\n

    See mask

    "},{"location":"perspective-sprite/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"plane/","title":"Plane","text":""},{"location":"plane/#introduction","title":"Introduction","text":"

    A Plane is a kind of Mesh game object with one-sided grid of cells. which can have a texture that is either repeated (tiled) across each cell, or applied to the full Plane.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"plane/#usage","title":"Usage","text":""},{"location":"plane/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"plane/#add-plane-object","title":"Add plane object","text":"
    var plane = scene.add.plane(x, y, key);\n// var plane = scene.add.plane(x, y, key, frame);\n// var plane = scene.add.plane(x, y, texture, frame, width, height, tile);\n
    • x, y : Position
    • key, frame : Texture key of
    • width, height : The width/height of this Plane, in cells, not pixels.
    • tile : Is the texture tiled? I.e. repeated across each cell.

    Add plane from JSON

    var plane = scene.make.plane({\nx: 0,\ny: 0,\nkey: '',\n// frame: '',\n// width: 8,\n// height: 8,\n// tile: false,\n// checkerboard: null,\n// checkerboard: { color1, color2, alpha1, alpha2, height }\n\n// angle: 0,\n// alpha: 1,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"plane/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPlane extends Phaser.GameObjects.Plane {\nconstructor(scene, x, y, texture, frame, width, height, tile) {\nsuper(scene, x, y, texture, frame, width, height, tile);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var plane = new MyPlane(scene, x, y, texture, frame, width, height, tile);\n
    "},{"location":"plane/#texture","title":"Texture","text":"

    See game object - texture

    "},{"location":"plane/#animation","title":"Animation","text":"

    See Sprite's animation section.

    "},{"location":"plane/#play-animation","title":"Play animation","text":"
    • Play
      plane.play(key);\n// plane.play(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
        • String key of animation
        • Animation config, to override default config
          {\nkey,\nframeRate,\nduration,\ndelay,\nrepeat,\nrepeatDelay,\nyoyo,\nshowOnStart,\nhideOnComplete,\nstartFrame,\ntimeScale\n}\n
    • Play in reverse
      plane.playReverse(key);\n// plane.playReverse(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
    • Play after delay
      plane.playAfterDelay(key, delay);\n
      • key : Animation key string, or animation config
    • Play after repeat
      plane.playAfterRepeat(key, repeatCount);\n
      • key : Animation key string, or animation config
    "},{"location":"plane/#stop","title":"Stop","text":"
    • Immediately stop
      plane.stop();\n
    • Stop after delay
      plane.stopAfterDelay(delay);\n
    • Stop at frame
      plane.stopOnFrame(frame);\n
      • frame : Frame object in current animation.
        var currentAnim = plane.anims.currentAnim;\nvar frame = currentAnim.getFrameAt(index);\n
    • Stop after repeat
      plane.stopAfterRepeat(repeatCount);\n
    "},{"location":"plane/#properties","title":"Properties","text":"
    • Has started
      var hasStarted = plane.anims.hasStarted;\n
    • Is playing
      var isPlaying = plane.anims.isPlaying;\n
    • Is paused
      var isPaused = plane.anims.isPaused;\n
    • Total frames count
      var frameCount = plane.anims.getTotalFrames();\n
    • Delay
      var delay = plane.anims.delay;\n
    • Repeat
      • Total repeat count
        var repeatCount = plane.anims.repeat;\n
      • Repeat counter
        var repeatCount = plane.anims.repeatCounter;\n
      • Repeat delay
        var repeatDelay = plane.anims.repeatDelay;\n
      • Yoyo
        var repeatDelay = plane.anims.yoyo;\n
    • Current animation key
      var key = plane.anims.getName();\n
      • key : Return '' if not playing any animation.
    • Current frame name
      var frameName = plane.anims.getFrameName();\n
      • frameName : Return '' if not playing any animation.
    • Current animation
      var currentAnim = plane.anims.currentAnim;\n
    • Current frame
      var currentFrame = plane.anims.currentFrame;\n
    "},{"location":"plane/#interactive","title":"Interactive","text":"

    To test if pointer is at any face of this mesh game object.

    plane.setInteractive();\n
    "},{"location":"plane/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"plane/#checkerboard","title":"Checkerboard","text":"

    Creates a checkerboard style texture, based on the given colors and alpha values and applies it to this Plane, replacing any current texture it may have.

    • Create
      plane.createCheckerboard(color1, color2, alpha1, alpha2, height)\n
    • Remove
      plane.removeCheckerboard();\n
    "},{"location":"plane/#other-properties_1","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"plane/#create-mask","title":"Create mask","text":"
    var mask = plane.createBitmapMask();\n

    See mask

    "},{"location":"plane/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"plugin-list/","title":"Plugin list","text":""},{"location":"plugin-list/#list-of-my-plugins","title":"List of my plugins","text":"

    Version of phaser3

    Please upgrade your phaser3 to version >= 3.80.0.

    1. Achievements: Achievements in a csv table.
    2. Alpha mask image: Load a texture, then apply an alpha mask from another texture.
    3. Anchor: Set size and position based on visible window.
    4. Arcade-TCRP/Player: Run commands on step of Arcade.
    5. Arcade-TCRP/Recorder: Store commands with step of Arcade.
    6. AwaitLoader: Await custom task in preload stage.
    7. Away time: Get time from previous closing application to now.
    8. BBCode-text: Drawing text with BBCode protocol.
    9. Board: Core object of Board system.
    10. Board/Image: Image chess object.
    11. Board/Field of view: Visible testing, to find field of view.
    12. Board/Hexagon map: Create tile positions in hexagon/triangle/parallelogram geometry in hexagon grid.
    13. Board/Match: Get matched chess.
    14. Board/Mini board: Chess Container, to rotate/mirror/drag chess together.
    15. Board/Monopoly: Move through path tiles.
    16. Board/Move To: Move chess towards target position with a steady speed.
    17. Board/Path finder: Find moveable area or moving path.
    18. Board/Shape: Grid (polygon) shape chess object.
    19. Board/Sprite: Sprite chess object.
    20. Board/Tilemap: Create board from tilemap.
    21. Board/Tile texture: Create canvas-texture of tile.
    22. Bounds: Clamp or wrap position of game object inside target bounds.
    23. Bracket parser: A lite-weight bracket parser.
    24. Bracket parser2: A lite-weight bracket parser.
    25. Buff data: Data manager with buffs.
    26. Build arcade object: Create arcade body, and inject arcade object methods.
    27. Bullet: Move game object toward current angle of game object, with a constant speed.
    28. Button: Fires 'click' event when touch releasd after pressed.
    29. Camera controller: Control camera's scroll by pan/cursor-at-bounds(scroll), and zoom by pinch/mouse-wheel.
    30. Canvas: Drawing on canvas.
    31. CanvasInput: An invisible Input DOM element to receive character input and display on DynamicText.
    32. Canvas/Circular progress: Circular progress bar on canvas.
    33. Canvas/Line progress: Horizontal line progress bar filled with gradient color on canvas.
    34. Canvas/Round rectangle: Round rectangle on canvas.
    35. Canvas image data: Get image data from texture, or text object.
    36. Circle mask image: Load a texture, then apply a circle mask.
    37. Click outside: Fires 'clickoutside' event when pointer-down or pointer-up outside of game object.
    38. Clock: A clock to count elapsed time.
    39. Character cache: Generate bitmapfont from text game object, or bbcode text game object.
    40. Color/TintRGB: Attach tintR, tintG, tintB, and tintGray properties to a game object.
    41. Conditions table: Check conditions to find passed tests listed in a csv table.
    42. ContainerLite: Control the position and angle of children game objects.
    43. Containerlite-perspective: Snapshot children of containerlite, to a perspective render texture.
    44. Containerlite-skew: Snapshot children of containerlite, to a skew render texture.
    45. CSV-scenario: Run script in csv format.
    46. CSV-to-hash-table: Hash table indexed by (col-key, row-key) from csv string.
    47. Cursor at bound: Map position pf cursor to cursor key state.
    48. Curve/Spiral: Spiral curve.
    49. Cut Jigsaw Image: Cut image into pieces for jigsaw application.
    50. Drag: Drag game object.
    51. Drag-rotate: Get dragging angle around a specific point.
    52. Drop down: Drop down game object below another target game object.
    53. Dynamic text: Control position, angle of each character drawn on a canvas.
    54. Ease-data: Easing data value of game object's data-manager.
    55. Ease-move: Ease-move game object.
    56. Effect properties: Attach properties to a game object or camera, to add/remove/control builtin preFX or postFX effects.
    57. Eight direction: Move game object by cursor keys, with a constant speed.
    58. Event promise: Return a promise of an event.
    59. Expression parser: Parse expression string into function.
    60. Fade-out-destroy: Fade out game object then destroy it.
    61. Fade-volume: Fade-in/fade-out volume of sound.
    62. File chooser: Create a transparent file chooser button.
    63. File drop zone: Create a div element for dropping file(s).
    64. Firebase/Broadcast: Broadcast real-time messages, using firebase-database.
    65. Firebase/Files: Save JSON data, using firebase-firestore.
    66. Firebase/ID-alias: Map an unique ID to another unique ID, using firebase-firestore.
    67. Firebase/Item-table: 1d/2d/3d table, using firebase-database.
    68. Firebase/Leaderboard: Descending sort scores, using firebase-firestore.
    69. Firebase/Messages: Store messages in firebase-firestore.
    70. Firebase/Online-user-list: Online user list, using firebase-database.
    71. Firebase/Single-room: Chat room, using firebase-database.
    72. Flash: Flashing (set invisible then visible) game object.
    73. Flip: Flipping game object to another face by scaling width/height.
    74. Frame manager: Draw frames on canvas texture, or dynamic texture.
    75. FSM: Finite state machine.
    76. Fuzzy: A wrap of fuzzy logic.
    77. Gashapon: Pick random item from box.
    78. Geom/Hexagon: Hexagon geometry object.
    79. Geom/Rhombus: Rhombus shape and methods.
    80. Gesture/Pan: Get pan events of a game object.
    81. Gesture/Pinch: Get scale factor from 2 dragging touch pointers.
    82. Gesture/Press: Get press events of a game object.
    83. Gesture/Rotate: Get spin angle from 2 dragging touch pointers.
    84. Gesture/Swipe: Get swipe events of a game object.
    85. Gesture/Tap: Get tap/multi-taps events of a game object.
    86. Grid align: Align objects on quadrilateral or hexagon grid.
    87. Grid cut image: Grid cut image texture to frames, then create image game objects from these frames.
    88. Grid table: Viewer of grid table, to manipulate game object of each visible cell.
    89. Group navigator: Navigate between existing game objects, focus on next/previous/next-row/previous row game object.
    90. Hidden input text: An invisible Input DOM element to receive character input and display on text game object.
    91. Image box: Keep aspect ratio of image game object after scale-down resizing.
    92. Input text: Input DOM element.
    93. Interception: Predict the intersection position of two game objects with constant moving speed.
    94. In touching: Fires 'intouch' event every tick when pressing on a game object.
    95. Keys hub: Key object interface mapping from multiple source of key objects.
    96. Layer manager: A container of Layer game objects.
    97. Level counter: Map level value from experience value, by callback or a number array.
    98. Life time: Destroy game object when time-out.
    99. Line: Draw a line with start/end/body textures.
    100. Live2d: Display live2d model.
    101. Loading animation scene: Start loading animation scene, stop this scene when loading complete.
    102. Loading-progress: Pop-up dialog for loading-progress, then scale-down this dialog.
    103. LocalForage/Files: Save JSON data, using localforage.
    104. LocalStorage/Data: Sync data from data manager to local-storage.
    105. LZ-string: Compress string using LZ-based compression algorithm.
    106. Markdown event sheets: Event sheets contains main condition(s) and actions, in simple markdown format (headings, code block).
    107. Modal promise: Modal behavior wrapped into promise.
    108. Mouse-wheel to up/down: Map mouse-wheeling to (up/down) cursor key state.
    109. Mouse-wheel scroller: Emit scroll event when mouse-wheeling.
    110. Move to: Move game object towards target position with a steady speed.
    111. Nine patch: Stretchable image.
    112. Nine patch2: Stretchable image. Has better performance than nine-patch.
    113. Particles-along-bounds: Emit particles along bounds of game object.
    114. Particles/Bitmap-zone: Particles' emitter zone from canvas bitmap of text/canvas game object.
    115. Path follower: Set position of game object on a path.
    116. Perlin: Perlin2/Perlin3 noise and simplex2/simplex3 noise.
    117. Perspective/Card: A container with two perspective-images.
    118. Perspective/Carousel: A container with cards.
    119. Perspective/Image: Image with perspective rotation.
    120. Perspective/ImageCarousel: Display list of images.
    121. Perspective/Render texture: Render texture with perspective rotation.
    122. Perspective/Sprite: Play animation on perspective-image..
    123. PNG appender: Append user data below tail of PNG data, or extract this user data from PNG data.
    124. polar-coordinate: Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties to a game object.
    125. Pop up: Scale up game object.
    126. Quad/Image: Image with 4 or 9 vertex control points.
    127. Quad/Render texture: Render texture with 4 or 9 vertex control points.
    128. Quest: Question manager.
    129. Raycaster: Raycaster between obstacles.
    130. Random place: Place objects randomly inside an area without overlapping.
    131. Real-time timers: Start and counting timer by real-time timestamp.
    132. Repeat Image: Stamp image repeatly on canvas.
    133. Restorable data: Restorable data manager.
    134. RotateTo: Rotate game object towards target position with a steady speed.
    135. Rotate: Rotate game object continually with a steady speed.
    136. Run-commands: Run commands in array.
    137. Scale-down-destroy: Scale down game object then destroy it.
    138. Scale outer: Scroll and zoom camera to make default game window fit the display area, in RESIZE scale mode.
    139. Script-tag loader: Load script tag in preload stage.
    140. Scroller: Drag content. Slow down when dragging released, pull back when out of bounds.
    141. Sequence: Run sequence commands in array.
    142. Shader/Barrel: Barrel post processing filter.
    143. Shader/Color-replace: Replace color post processing filter.
    144. Shader/Cross-stitching: Cross-stitching post processing filter.
    145. Shader/CRT: CRT post processing filter.
    146. Shader/Dissolve: Dissolve transition post processing filter.
    147. Shader/Drop-shadow: Drop-shadow post processing filter.
    148. Shader/Fish-eye: Fish-eye post processing filter.
    149. Shader/Glow-filter: Glow post processing filter.
    150. Shader/Glow-filter: Glow post processing filter, ported from pixi.
    151. Shader/Gray-scale: Gray scale post processing filter.
    152. Shader/Horri-fi: 6-in-1 post processing filter.
    153. Shader/Hsl-adjust: Adjust color in HSL domain, post processing filter.
    154. Shader/Inverse: Inverse color post processing filter.
    155. Shader/Kawaseblur: Kawase-blur post processing filter.
    156. Shader/Outline: Outline post processing filter, ported from pixi.
    157. Shader/Pixelation: Pixelation post processing filter.
    158. Shader/Shockwave: Shockwave post processing filter.
    159. Shader/Split: Split image into 4 parts.
    160. Shader/Swirl: Swirl post processing filter.
    161. Shader/Toonify: Draw outlines and quantize color in HSV domain, post processing filter.
    162. Shader/Warp: Warp post processing filter.
    163. Shake-position: Shake position of game object.
    164. Shape/Checkbox: Checkbox input with drawing checker path animation.
    165. Shape/Circular progress: Circular progress bar shape.
    166. Shape/Cover: Rectangle shape covered full window, and block all touch events.
    167. Shape/Custom progress: Custom progress bar shape.
    168. Shape/Custom shapes: Custom shapes on shape.
    169. Shape/Full window rectangle: Rectangle shape covered full window.
    170. Shape/Line progress: Horizontal line progress bar shape.
    171. Shape/Quad: Quad shape, offsets can be given on four vertices, and additional points can be added on the four sides.
    172. Shape/Round-Rectangle: Round rectangle shape.
    173. Shape/Round-Rectangle progress: Horizontal or vertical round rectangle progress bar shape.
    174. Shape/Spinner: Loading animations on shape.
    175. Shape/Toggle-switch: Toggle-switch input.
    176. Shape/Triangle: Trangle shape inside a rectangle bounds.
    177. Shatter/Image: Shatter image to triangle faces.
    178. Shatter/Render texture: Shatter render texture to triangle faces.
    179. Ship: Move game object as a space ship by cursor keys.
    180. Skew/Image: Skewable Image.
    181. Skew/RenderTexture: Skewable render texture.
    182. Slider: Drag thumb on a slider bar.
    183. State manager: Another version of Finite state machine.
    184. Step: Interpolate points between previous position and current position with fixed step length.
    185. Tag-player: Text commands to control sprites, texts, sound effect or backgroun music.
    186. Tag-text: Displays text with multi-color, font face, or font size with tags.
    187. TCRP/Player: Run commands on time.
    188. TCRP/Recorder: Store commands with time.
    189. Text/Edit: Create an input text object above a text object to edit string content.
    190. Text/Typing: Typing text on text object.
    191. Text/Page: Display text page by page on text object.
    192. Text/Translation: Apply translated string (i18next) to text object.
    193. Text/Truncator: Constraints text game object size by truncating text with padding symbol on text object.
    194. Text player: Typing characters on dynamic text, waiting click or key enter, play sound effect or backgroun music.
    195. Touch event stop: Stop touch events propagation.
    196. Touch state: Store current touch input properties.
    197. Transition image: Transit texture to another one.
    198. Transition image pack: Transit texture to another one, with some pre-build effects.
    199. UI/Badge label: A container with badges above a main item.
    200. UI/Buttons: A container with a group of buttons.
    201. UI/Chart: Draw chart on canvas.
    202. UI/Color components: Edit color value by RGB, or HSV input fields.
    203. UI/Color input: Color value input field.
    204. UI/Color picker: Pick color value from H and SV palettes.
    205. UI/Confirm action: Create a modal confirm dialog temporary, invoke callback after clicking button.
    206. UI/Confirm action button: Create a modal confirm dialog temporary, invoke callback after clicking button.
    207. UI/Confrim dialog: Using json style to create confirm dialog.
    208. UI/Dialog: A container with a title, content, buttons and backgrounds.
    209. UI/Drop down list: A label can open a drop-down list panel.
    210. UI/Exp bar: Disply experience bar on NameValueLabel.
    211. UI/File selector button: A transparent file chooser button above a Label.
    212. UI/Fixwidthbuttons: A container with a group of fix-width buttons.
    213. UI/Fixwidthsizer: Layout children game objects into lines.
    214. UI/Folder: A container with a title, foldable child, and background.
    215. UI/Grid buttons: A container with a group of buttons in grids.
    216. UI/Grid sizer: Layout children game objects in grids.
    217. UI/Gird table: A container with a grid table, slider, and scroller.
    218. UI/Holy grail: Layout elements in Holy grail style.
    219. UI/Image input label: A container with a canvas icon, text, and background. Click icon to popup a (image) file chooser dialog, display selected image on canvas.
    220. UI/Knob: A knob button based on circular progress.
    221. UI/Label: A game object container with an icon, text, and background.
    222. UI/Menu: A container with buttons and sub-menu.
    223. UI/Name-input dialog: Enter first name and last name via a dialog.
    224. UI/Name-value label: A container with name text, value text in a row, with a horizontal line progress bar, 1d an icon, background.
    225. UI/Number bar: A container with an icon, slider, text, and background.
    226. UI/Overlap sizer: Layout children game objects overlapped.
    227. UI/Pages: A container with pages, only current page is visible.
    228. UI/Perspective card: A container with front and back faces.
    229. UI/Scroll-able panel: A container with a panel, slider, and scroller.
    230. UI/Scroll bar: A container with slider, two buttons, and background.
    231. UI/Simple drop down list: Using plain object to create drop down list.
    232. UI/Simple label: Using json style to create label.
    233. UI/Simple title label: Using json style to create title label.
    234. UI/Simple text box: Using json style to create text box.
    235. UI/Sizer: Layout children game objects.
    236. UI/Slider: A container with a track, indicator, thumb and background.
    237. UI/Split panels: A container with left(top) panel, right(bottom) panel, splitter, and background. Drag splitter to resize with left(top) panel, right(bottom) panel.
    238. UI/Tab-pages: A container with tabs and pages, only current page is visible.
    239. UI/Tabs: A container with 4 groups of buttons around a center panel.
    240. UI/Text area: A container with a text, slider, and scroller.
    241. UI/Text area input: A container with a canvasInput, and slider.
    242. UI/Text box: A container with an icon, (typing and paging) text, and background.
    243. UI/Title label: A container with title, text in two rows, and an icon, background.
    244. UI/Toast: Show text message for a short while.
    245. UI/Toast queue: Queue messages for a short while.
    246. UI/Trees: A container with trees and leaf-nodes.
    247. UI/Tweaker: Fine-tuning properties of target object.
    248. Unique item list: List of unique items. Support array and set methods.
    249. Viewport-coordinate: Attach vpx, vpy properties to a game object, to set position according to proportion of viewport.
    250. Virtual joystick: Simulate cursor keys according to touch events.
    251. Wait events: Wait fired events or callbacks.
    252. Webfont-loader: Load web font by google webfont loader in preload stage.
    253. XOR: Encrypt or decrypt string by XOR algorithm.
    254. YML-Achievements: Achievements in a YAML table.
    255. YML-Conditions table: Check conditions to find passed tests listed in a YAML table.
    256. Youtube player: Play youtube video on iframe.
    "},{"location":"pluginsystem/","title":"Plugin system","text":""},{"location":"pluginsystem/#introduction","title":"Introduction","text":"

    Plugin system, built-in system of phaser.

    • Author: Richard Davey
    "},{"location":"pluginsystem/#usage","title":"Usage","text":""},{"location":"pluginsystem/#global-plugin","title":"Global plugin","text":""},{"location":"pluginsystem/#load-plugin","title":"Load plugin","text":"
    • Load plugin before any scene start In game configuration
      // import pluginKlass from '...';\nvar config = {\n// ...\nplugins: {\nglobal: [\n{\nkey: key,\nplugin: pluginKlass,\nstart: true\n// mapping: memberName  // member name in each scene instance, optional\n// data: undefined\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • pluginKlass : Class instance
      • start : Whether the plugin should be started automatically.
      • mapping : If this plugin is to be injected into the Scene Systems, this is the property key map used.
      • data : Arbitrary data passed to the plugin's init() method.
    • Load plugin in scene
      scene.load.plugin(key, url, true);\n// scene.load.plugin(key, url, true, mapping);\n
      • url : File url or class instance.
    "},{"location":"pluginsystem/#get-instance","title":"Get instance","text":"
    var pluginInst = scene.plugins.get(key);\n
    "},{"location":"pluginsystem/#scene-plugin","title":"Scene plugin","text":""},{"location":"pluginsystem/#load-plugin_1","title":"Load plugin","text":"
    • Load plugin before any scene start In game configuration
      // import pluginKlass from '...';\nvar config = {\n// ...\nplugins: {\nscene: [\n{\nkey: key,\nplugin: pluginKlass,\nmapping: sceneKey,    // member name in each scene instance\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • pluginKlass : Class instance
    • Load plugin in scene
      scene.load.scenePlugin(key, url, systemKey, sceneKey);\n
      • url : File url or class instance.
    "},{"location":"pluginsystem/#get-instance_1","title":"Get instance","text":"
    var pluginInst = scene[sceneKey];\n
    "},{"location":"pluginsystem/#plugin-cache","title":"Plugin cache","text":"
    • Has custom plugin
      var hasPlugin = Phaser.Plugins.PluginCache.hasCustom(key);\n
    "},{"location":"png-appender/","title":"PNG Appender","text":""},{"location":"png-appender/#introduction","title":"Introduction","text":"

    Append user data below tail of PNG data, or extract this user data from PNG data.

    • Author: Rex
    • Methods
    "},{"location":"png-appender/#live-demos","title":"Live demos","text":"
    • Append-extract
    "},{"location":"png-appender/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"png-appender/#install-plugin","title":"Install plugin","text":""},{"location":"png-appender/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexpngappenderplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexpngappenderplugin.min.js', true);\n
    • Append, or extract data
      var resultBuffer = scene.plugins.get('rexpngappenderplugin').append(pngBuffer, data);\nvar data = scene.plugins.get('rexpngappenderplugin').extract(pngBuffer);\n
    "},{"location":"png-appender/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PNGAppenderPlugin from 'phaser3-rex-plugins/plugins/pngappender-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPNGAppender',\nplugin: PNGAppenderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Append, or extract data
      var resultBuffer = scene.plugins.get('rexPNGAppender').append(pngBuffer, data);\nvar data = scene.plugins.get('rexPNGAppender').extract(pngBuffer);\n
    "},{"location":"png-appender/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import PNGAppender from 'phaser3-rex-plugins/plugins/pngappender.js';\n
    • Append, or extract data
      var resultBuffer = PNGAppender.append(pngBuffer, data);\nvar data = PNGAppender.extract(pngBuffer);\n
    "},{"location":"png-appender/#append-data","title":"Append data","text":"
    var resultBuffer = scene.plugins.get('rexPNGAppender').append(pngBuffer, data);\n
    • pngBuffer : PNG data loaded from binary loader.
    • data : JSON. dictionary, array, string, number, or Uint8Array.
    • resultBuffer : PNG data with custom data (data).
      • Can add to texture cache via scene.load.image(...)
        1. Create blob from resultBuffer : var blob = new Blob([buffer], { type: 'image/png' })
        2. Create object url from blob : var url = window.URL.createObjectURL(blob)
        3. Load texture from object url : scene.load.image(textureKey, url)
        4. Start loader if in create stage of scene : scene.load.start()
      • Can download and display on image viewer as normal PNG file.
    "},{"location":"png-appender/#extract-data","title":"Extract data","text":"
    var data = scene.plugins.get('rexPNGAppender').extract(pngBuffer);\n
    • pngBuffer : PNG data loaded from binary loader.
    • data : User data.
      • null : This pngBuffer does not have user data.
    "},{"location":"point-light/","title":"Point light","text":""},{"location":"point-light/#introduction","title":"Introduction","text":"

    A point light with gradient color in a circle.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"point-light/#usage","title":"Usage","text":""},{"location":"point-light/#add-point-light","title":"Add point light","text":"
    var pointLight = scene.add.pointlight(x, y, color, radius, intensity, attenuation);\n
    • x, y : The horizontal/vertical position of this Game Object in the world.
    • color : Color of this light.
    • radius : Radius of this light.
    • intensity : 0~1, intensity of color.
    • attenuation : 0~1, decay intensity along radius.
    "},{"location":"point-light/#position","title":"Position","text":"
    • Set
      pointLight.setPosition(x, y);\n
      or
      pointLight.x = x;\npointLight.y = y;\n
    • Get
      var x = pointLight.x;\nvar y = pointLight.y;\n
    "},{"location":"point-light/#color","title":"Color","text":"
    • Set
      • Red, green, blue
        pointLight.color.set(red, green, blue);\n
        or
        pointLight.color.r = red;\npointLight.color.g = green;\npointLight.color.b = blue;\n
        • red, green, blue : 0~1.
    • Get
      • Red, green, blue
        var red = pointLight.color.r;\nvar green = pointLight.color.g;\nvar blue = pointLight.color.b;\n
        • red, green, blue : 0~1.
    "},{"location":"point-light/#radius","title":"Radius","text":"
    • Set
      pointLight.radius = radius;\n
    • Get
      var radius = pointLight.radius;\n
    "},{"location":"point-light/#intensity","title":"Intensity","text":"
    • Set
      pointLight.intensity = intensity;\n
    • Get
      var intensity = pointLight.intensity;\n
    "},{"location":"point-light/#attenuation","title":"Attenuation","text":"
    • Set
      pointLight.attenuation = attenuation;\n
    • Get
      var attenuation = pointLight.attenuation;\n
    "},{"location":"polar-coordinate/","title":"Polar-coordinate","text":""},{"location":"polar-coordinate/#introduction","title":"Introduction","text":"

    Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties to a game object.

    • Author: Rex
    • Method only
    "},{"location":"polar-coordinate/#live-demos","title":"Live demos","text":"
    • Circle
    • Spiral
    "},{"location":"polar-coordinate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"polar-coordinate/#install-plugin","title":"Install plugin","text":""},{"location":"polar-coordinate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexpolarcoordinateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexpolarcoordinateplugin.min.js', true);\n
    • Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties.
      scene.plugins.get('rexpolarcoordinateplugin').add(gameObject, ox, oy, rotation, radius);\ngameObject.polarRadius = 200;\ngameObject.polarAngle = -45;\n
    "},{"location":"polar-coordinate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PolarCoordinatePlugin from 'phaser3-rex-plugins/plugins/polarcoordinate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPolarCoordinate',\nplugin: PolarCoordinatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties.
      scene.plugins.get('rexPolarCoordinate').add(gameObject, ox, oy, rotation, radius);\ngameObject.polarRadius = 200;\ngameObject.polarAngle = -45;\n
    "},{"location":"polar-coordinate/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import AddPolarCoordinateProperties from 'phaser3-rex-plugins/plugins/polarcoordinate.js';\n
    • Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties.
      AddPolarCoordinateProperties(gameObject, ox, oy, rotation, radius);\ngameObject.polarOX = 400;\ngameObject.polarOY = 300;\ngameObject.polarRadius = 200;\ngameObject.polarAngle = -45;\n
    "},{"location":"polar-coordinate/#attach-properties","title":"Attach properties","text":"
    scene.plugins.get('rexPolarCoordinate').add(gameObject, ox, oy, rotation, radius);\ngameObject.polarOX = 400;\ngameObject.polarOY = 300;\ngameObject.polarRadius = 200;\ngameObject.polarAngle = -45;\n
    • ox, oy : Position of origin point.
    • rotation : Polar angle, in radian.
    • radius : Polar radius.
    x = ( polarRadius * cos(polarRotation) ) + polarOX\ny = ( polarRadius * sin(polarRotation) ) + polarOY\n
    "},{"location":"polar-coordinate/#circle","title":"Circle","text":"
    scene.tweens.add({\ntargets: gameObject,\npolarAngle: 360,\nduration: 3000\n})\n
    "},{"location":"popup/","title":"Pop up","text":""},{"location":"popup/#introduction","title":"Introduction","text":"

    Scale up from 0 to current scale of game object.

    • Author: Rex
    • Method only
    "},{"location":"popup/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"popup/#install-plugin","title":"Install plugin","text":""},{"location":"popup/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexscaleplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscaleplugin.min.js', true);\n
    • Pop-up object
      scene.plugins.get('rexscaleplugin').popup(gameObject, duration);\n
    "},{"location":"popup/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ScalePlugin from 'phaser3-rex-plugins/plugins/scale-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexScale',\nplugin: ScalePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Pop-up object
      scene.plugins.get('rexScale').popup(gameObject, duration);\n
    "},{"location":"popup/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import PopUp from 'phaser3-rex-plugins/plugins/popup.js';\n
    • Pop-up object
      PopUp(gameObject, duration);\n
    "},{"location":"popup/#pop-up","title":"Pop up","text":"
    • Pop up width and height
      var scale = scene.plugins.get('rexScale').popup(gameObject, duration);\n// var scale = popUp(gameObject, duration, undefined, ease);\n
      • ease : Ease function, default is 'Cubic'.
    • Pop up width only
      var scale = scene.plugins.get('rexScale').popup(gameObject, duration, 'x');\n// var scale = popUp(gameObject, duration, 'x', ease);\n
      • ease : Ease function, default is 'Cubic'.
    • Pop up height only
      var scale = scene.plugins.get('rexScale').popup(gameObject, duration, 'y');\n// var scale = popUp(gameObject, duration, 'y', ease);\n
      • ease : Ease function, default is 'Cubic'.
    "},{"location":"popup/#events","title":"Events","text":"

    See Events of tween task

    • Scale completes or is stopped.
      scale.on('complete', function(gameObject, scale){\n\n}, scope);\n
    "},{"location":"postfx-pipeline/","title":"Post fx pipeline","text":""},{"location":"postfx-pipeline/#introduction","title":"Introduction","text":"

    Post fx pipelines for game objects or camera. A game object or a camera can stack many post-fx effect.

    • Author: Richard Davey

    WebGL only

    All kinds of post fx pipelines only work in WebGL render mode.

    "},{"location":"postfx-pipeline/#usage","title":"Usage","text":""},{"location":"postfx-pipeline/#post-fx-pipeline-class","title":"Post fx pipeline class","text":"
    class MyPostFxClass extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline {\nconstructor(game) {\nsuper({\ngame: game,\nrenderTarget: true,\nfragShader: '...',  // GLSL shader\nuniforms: []\n});\n}\n\nonPreRender() {\nthis.set1f('intensity', this._intensity);\n}\n\nonDraw(renderTarget) {\n}\n}\n
    "},{"location":"postfx-pipeline/#set-uniform-values","title":"Set uniform values","text":"
    • Property with 1 value
      • Float
        pipelineInstance.set1f(name, value0);\n// pipelineInstance.set1f(name, value0, shader);\n
      • uniform1fv
        pipelineInstance.set1fv(name, value0);\n// pipelineInstance.set1fv(name, value0, shader);\n
      • Int
        pipelineInstance.set1i(name, value0);\n// pipelineInstance.set1i(name, value0, shader);\n
    • Property with 2 values
      • Float
        pipelineInstance.set2f(name, value0, value1);\n// pipelineInstance.set2f(name, value0, value1, shader);\n
      • uniform2fv
        pipelineInstance.set2fv(name, value0, value1);\n// pipelineInstance.set2fv(name, value0, value1, shader);\n
      • Int
        pipelineInstance.set2i(name, value0, value1);\n// pipelineInstance.set2i(name, value0, value1, shader);\n
    • Property with 3 value
      • Float
        pipelineInstance.set3f(name, value0, value1, value2);\n// pipelineInstance.set3f(name, value0, value1, value2, shader);\n
      • uniform3fv
        pipelineInstance.set3fv(name, value0, value1, value2);\n// pipelineInstance.set3fv(name, value0, value1, value2, shader);\n
      • Int
        pipelineInstance.set3i(name, value0, value1, value2);\n// pipelineInstance.set3i(name, value0, value1, value2, shader);\n
    • Property with 4 values
      • Float
        pipelineInstance.set4f(name, value0, value1, value2, value3);\n// pipelineInstance.set4f(name, value0, value1, value2, value3, shader);\n
      • uniform4fv
        pipelineInstance.set4fv(name, value0, value1, value2, value3);\n// pipelineInstance.set4fv(name, value0, value1, value2, value3, shader);\n
      • Int
        pipelineInstance.set4i(name, value0, value1, value2, value3);\n// pipelineInstance.set4i(name, value0, value1, value2, value3, shader);\n
    "},{"location":"postfx-pipeline/#onprerender","title":"onPreRender","text":"
    • Set uniform values in onPreRender method.
    "},{"location":"postfx-pipeline/#ondraw","title":"onDraw","text":"
    • Ping-pong drawing
      • Variables :
        • renderTarget : Render target, parameter of onDraw method.
        • pipelineInstance.fullFrame1, pipelineInstance.fullFrame2 : Ping-pong render texture.
      • Steps
        1. Copy frame to pipelineInstance.fullFrame1
          pipelineInstance.copyFrame(source, target);\n// pipelineInstance.copyFrame(source, target, brightness, clear, clearAlpha);\n
        2. Set uniform values
        3. Bind and draw on pipelineInstance.fullFrame1, pipelineInstance.fullFrame2.
          pipelineInstance.bindAndDraw(source, target);\n// pipelineInstance.bindAndDraw(source, target, clear, clearAlpha, shader);\n
        4. Draw result back
          pipelineInstance.bindAndDraw(source);\n
    "},{"location":"postfx-pipeline/#register-post-fx-pipeline","title":"Register post-fx pipeline","text":"
    • Register post-fx pipeline in game config
      import MyPostFxClass from 'path';\nvar config = {\n// ...\npipeline: [MyPostFxClass]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Or register post-fx pipeline at runtime
      var pipelineManager = scene.sys.renderer.pipelines;\npipelineManager.addPostPipeline(PostFxName, MyPostFxClass);\n
    "},{"location":"postfx-pipeline/#apply-effect","title":"Apply effect","text":"

    gameObject.setPostPipeline(MyPostFxClass);\n
    camera.setPostPipeline(MyPostFxClass);\n

    Will create an effect instance then push it into postPipelines list.

    "},{"location":"postfx-pipeline/#get-post-fx-pipeline","title":"Get post-fx pipeline","text":"

    var pipelineInstance = gameObject.getPostPipeline(MyPostFxClass);\n
    var pipelineInstance = camera.getPostPipeline(MyPostFxClass);\n

    "},{"location":"postfx-pipeline/#remove-post-fx-pipeline","title":"Remove post-fx pipeline","text":"

    gameObject.removePostPipeline(MyPostFxClass);\n
    camera.removePostPipeline(MyPostFxClass);\n

    "},{"location":"postfx-pipeline/#unregister-post-fx-pipeline","title":"Unregister post-fx pipeline","text":"
    var pipelineManager = scene.sys.renderer.pipelines;\npipelineManager.remove(PostFxName);\n
    "},{"location":"postfx-pipeline/#color-matrix","title":"Color matrix","text":"

    Use color martix to change RGB render result, and more...

    class MyPostFxClass extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline {\nconstructor(game) {\nsuper({\ngame: game,\nrenderTarget: true,\nfragShader: '...',  // GLSL shader\nuniforms: []\n});\n}\n\nonPreRender() {\n// this.set1f('intensity', this._intensity);\nthis.colorMatrix.grayscale(this._intensity);\n}\n\nonDraw(renderTarget) {\nthis.colorMatrix.grayscale(this._intensity);\nthis.drawFrame(renderTarget, this.fullFrame1);\nthis.bindAndDraw(this.fullFrame1);\n}\n}\n
    "},{"location":"postfx-pipeline/#color-adjusting","title":"Color adjusting","text":"

    Invoke before drawFrame().

    • Grayscale
      this.colorMatrix.grayscale(value);\n// this.colorMatrix.grayscale(value, true); // Cascade\n
      • value : 0 ~ 1
    • Night vision tone
      this.colorMatrix.night(value);\n// this.colorMatrix.night(value, true); // Cascade\n
      • value : 0 ~ 1
    • Sepia tone
      this.colorMatrix.sepia();\n// this.colorMatrix.sepia(true); // Cascade\n
    • Trippy color tone
      this.colorMatrix.lsd();\n// this.colorMatrix.lsd(true); // Cascade\n
    • Brown tone
      this.colorMatrix.brown();\n// this.colorMatrix.brown(true); // Cascade\n
    • Vintage pinhole color effect
      this.colorMatrix.vintagePinhole();\n// this.colorMatrix.vintagePinhole(true); // Cascade\n
    • Kodachrome color effect
      this.colorMatrix.kodachrome();\n// this.colorMatrix.kodachrome(true); // Cascade\n
    • Technicolor color effect
      this.colorMatrix.technicolor();\n// this.colorMatrix.technicolor(true); // Cascade\n
    • Polaroid color effect
      this.colorMatrix.polaroid();\n// this.colorMatrix.polaroid(true); // Cascade\n
    • Brightness
      this.colorMatrix.brightness(value);\n// this.colorMatrix.brightness(value, true); // Cascade\n
      • value : 0(black) ~ 1
    • Saturation
      this.colorMatrix.saturate(value);\n// this.colorMatrix.saturate(value, true); // Cascade\n
      • value : -1 ~ 1
    • Desaturate
      this.colorMatrix.desaturate();\n// this.colorMatrix.desaturate(true); // Cascade\n
    • Hue
      this.colorMatrix.hue(rotation);\n// this.colorMatrix.hue(rotation, true); // Cascade\n
      • rotation : Hue rotation, in degree.
    • Black and white
      this.colorMatrix.blackWhite();\n// this.colorMatrix.blackWhite(true); // Cascade\n
    • Negative
      this.colorMatrix.negative();\n// this.colorMatrix.negative(true); // Cascade\n
    • Contrast
      this.colorMatrix.contrast(value);\n// this.colorMatrix.contrast(value, true); // Cascade\n
    • Desaturate luminance
      this.colorMatrix.desaturateLuminance();\n// this.colorMatrix.desaturateLuminance(true); // Cascade\n
    • Shifts RGB to BGR order
      this.colorMatrix.shiftToBGR();\n// this.colorMatrix.shiftToBGR(true); // Cascade\n
    "},{"location":"postfx-pipeline/#draw","title":"Draw","text":"

    Invoke under onDraw(renderTarget).

    this.drawFrame(renderTarget, this.fullFrame1);\nthis.bindAndDraw(this.fullFrame1);\n
    "},{"location":"prefx-pipeline/","title":"Pre fx pipeline","text":""},{"location":"prefx-pipeline/#introduction","title":"Introduction","text":"

    Pre fx pipelines for texture-base game objects. A texture-base game object has a pre-fx effect.

    • Author: Richard Davey

    WebGL only

    All kinds of post fx pipelines only work in WebGL render mode.

    "},{"location":"prefx-pipeline/#usage","title":"Usage","text":""},{"location":"prefx-pipeline/#post-fx-pipeline-class","title":"Post fx pipeline class","text":"
    class MyPreFxClass extends Phaser.Renderer.WebGL.Pipelines.PreFXPipeline {\nconstructor(game) {\nsuper({\ngame: game,\nfragShader: '...',  // GLSL shader\n});\n}\n\nonDraw(renderTarget) {\nvar sprite = this.tempSprite;\nthis.set1f('intensity', sprite._intensity);\n\nsuper.onDraw(renderTarget);\n}\n}\n
    "},{"location":"prefx-pipeline/#set-uniform-values","title":"Set uniform values","text":"
    • Property with 1 value
      • Float
        pipelineInstance.set1f(name, value0);\n// pipelineInstance.set1f(name, value0, shader);\n
      • uniform1fv
        pipelineInstance.set1fv(name, value0);\n// pipelineInstance.set1fv(name, value0, shader);\n
      • Int
        pipelineInstance.set1i(name, value0);\n// pipelineInstance.set1i(name, value0, shader);\n
    • Property with 2 values
      • Float
        pipelineInstance.set2f(name, value0, value1);\n// pipelineInstance.set2f(name, value0, value1, shader);\n
      • uniform2fv
        pipelineInstance.set2fv(name, value0, value1);\n// pipelineInstance.set2fv(name, value0, value1, shader);\n
      • Int
        pipelineInstance.set2i(name, value0, value1);\n// pipelineInstance.set2i(name, value0, value1, shader);\n
    • Property with 3 value
      • Float
        pipelineInstance.set3f(name, value0, value1, value2);\n// pipelineInstance.set3f(name, value0, value1, value2, shader);\n
      • uniform3fv
        pipelineInstance.set3fv(name, value0, value1, value2);\n// pipelineInstance.set3fv(name, value0, value1, value2, shader);\n
      • Int
        pipelineInstance.set3i(name, value0, value1, value2);\n// pipelineInstance.set3i(name, value0, value1, value2, shader);\n
    • Property with 4 values
      • Float
        pipelineInstance.set4f(name, value0, value1, value2, value3);\n// pipelineInstance.set4f(name, value0, value1, value2, value3, shader);\n
      • uniform4fv
        pipelineInstance.set4fv(name, value0, value1, value2, value3);\n// pipelineInstance.set4fv(name, value0, value1, value2, value3, shader);\n
      • Int
        pipelineInstance.set4i(name, value0, value1, value2, value3);\n// pipelineInstance.set4i(name, value0, value1, value2, value3, shader);\n
    "},{"location":"prefx-pipeline/#ondraw","title":"onDraw","text":"
    • Set uniform values in onDraw method.
    "},{"location":"prefx-pipeline/#add-pre-fx-pipeline-instance","title":"Add pre-fx pipeline instance","text":"
    var pipelineManager = scene.sys.renderer.pipelines;\nvar pipelineInstance = pipelineManager.add(PreFxName, new MyPreFxClass(scene.game));\n
    "},{"location":"prefx-pipeline/#apply-effect","title":"Apply effect","text":"
    gameObject.setPipeline(pipelineInstance);\n

    Will replace current effect instance.

    "},{"location":"prefx-pipeline/#get-pre-fx-pipeline","title":"Get pre-fx pipeline","text":"
    var pipelineInstance = gameObject.pipeline;\n
    "},{"location":"prefx-pipeline/#reset-to-default-effect","title":"Reset to default effect","text":"
    gameObject.resetPipeline();\n
    "},{"location":"prefx-pipeline/#unregister-pre-fx-pipeline","title":"Unregister pre-fx pipeline","text":"
    var pipelineManager = scene.sys.renderer.pipelines;\npipelineManager.remove(PreFxName);\n
    "},{"location":"quad-image/","title":"Image","text":""},{"location":"quad-image/#introduction","title":"Introduction","text":"

    Image with 4 or 9 vertex control points.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"quad-image/#live-demos","title":"Live demos","text":"
    • Quad image
    • Nine points
    "},{"location":"quad-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"quad-image/#install-plugin","title":"Install plugin","text":""},{"location":"quad-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexQuadImage(x, y, texture, frame, config);\n
    "},{"location":"quad-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexQuadImage(x, y, texture, frame, config);\n
    "},{"location":"quad-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { QuadImage } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add image object
      var image = new QuadImage(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"quad-image/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexQuadImage(x, y, texture, frame, {\n// ninePointMode: false,\n});\n

    or

    var image = scene.add.rexQuadImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n// ninePointMode: false,\n// rtl: false\n});\n
    • ninePointMode :
      • true : Add 9 vertex control points.
      • false : Add 4 vertex control points. Default behavior.
    • rtl : Diagonal direction in 4 vertices mode.
      • true : Diagonal from right to left
      • false : Diagonal from left to right. Default behavior.

    Add quadimage from JSON

    var quadimage = scene.make.rexQuadImage({\nx: 0,\ny: 0,\n\nkey: null,\nframe: null,\n\n// ninePointMode: false,\n// rtl: false\n\nadd: true\n});\n
    "},{"location":"quad-image/#custom-class","title":"Custom class","text":"
    • Define class
      class MyQuadImage extends QuadImage {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyQuadImage(scene, x, y, texture, frame, config);\n
    "},{"location":"quad-image/#vertex-control-points","title":"Vertex control points","text":"
    • Array of vertex control points
      var controlPoints = image.controlPoints;\n
      • 4, or 9 vertex control points
    • 4 vertex control points
      var topLeftPoint = image.topLeft;         // image.controlPoints[0]\nvar topRightPoint = image.topRight;       // image.controlPoints[1]\nvar bottomLeftPoint = image.bottomLeft;   // image.controlPoints[2]\nvar bottomRightPoint = image.bottomRight; // image.controlPoints[3]\n
    • 9 vertex control points
      var topLeft = image.topLeft;               // image.controlPoints[0]\nvar topCenter = image.topCenter;           // image.controlPoints[1]\nvar topRight = image.topRight;             // image.controlPoints[2]\nvar centerLeft = image.centerLeft;         // image.controlPoints[3]\nvar center = image.center;                 // image.controlPoints[4]\nvar centerRight = image.centerRight;       // image.controlPoints[5]\nvar bottomLeft = image.bottomLeft;         // image.controlPoints[6]\nvar bottomCenter = image.bottomCenter;     // image.controlPoints[7]\nvar bottomRight = image.bottomRight;       // image.controlPoints[8]\n
    "},{"location":"quad-image/#position","title":"Position","text":"
    • Get
      var worldXY = controlPoint.getWorldXY();\nvar x = worldXY.x;\nvar y = worldXY.y;\n
      or
      var x = controlPoint.x;\nvar y = controlPoint.y;\n
    • Set
      controlPoint.setPosition(x, y);\n// controlPoint.setWorldXY(x, y);\n
      or
      controlPoint.x = x;\ncontrolPoint.y = y;\n
    "},{"location":"quad-image/#tint-color","title":"Tint color","text":"
    • Get
      var color = image.tint;\n
    • Set
      image.tint = color;\n
      or
      image.setTint(color);\n
    "},{"location":"quad-image/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"quad-image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"quad-image/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"quad-rendertexture/","title":"Render texture","text":""},{"location":"quad-rendertexture/#introduction","title":"Introduction","text":"

    Render texture with 4 or 9 vertex control points.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"quad-rendertexture/#live-demos","title":"Live demos","text":"
    • RenderTexture
    "},{"location":"quad-rendertexture/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"quad-rendertexture/#install-plugin","title":"Install plugin","text":""},{"location":"quad-rendertexture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add render texture object
      var image = scene.add.rexQuadRenderTexture(x, y, width, height, config);\n
    "},{"location":"quad-rendertexture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add render texture object
      var image = scene.add.rexQuadRenderTexturege(x, y, width, height, config);\n
    "},{"location":"quad-rendertexture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { QuadRenderTexture } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add render texture object
      var image = new QuadRenderTexture(scene, x, y, width, height, config);\nscene.add.existing(image);\n
    "},{"location":"quad-rendertexture/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexQuadRenderTexturege(x, y, width, height, {\n// hideCCW: true,\n// ninePointMode: false,\n});\n

    or

    var image = scene.add.rexQuadRenderTexturege({\n// x: 0,\n// y: 0,\n// width: 32,\n// height: 32,\n// hideCCW: true,\n// ninePointMode: false,\n});\n
    • ninePointMode :
      • true : Add 9 vertex control points.
      • false : Add 4 vertex control points. Default behavior.

    Add prespective render texture from JSON

    var image = scene.make.rexQuadRenderTexturege({\nx: 0,\ny: 0,    width: 32,\nheight: 32,\n\n// hideCCW: false,\n// ninePointMode: false,\n\nadd: true\n});\n
    "},{"location":"quad-rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MyQuadRenderTexturege extends QuadRenderTexturege {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyQuadRenderTexturege(scene, x, y, width, height, config);\n
    "},{"location":"quad-rendertexture/#internal-render-texture","title":"Internal render texture","text":"
    var rt = image.rt;\n
    • rt : Render texture
    "},{"location":"quad-rendertexture/#paste-texture","title":"Paste texture","text":"
    • Paste game object
      image.rt.draw(gameObject, x, y);\n// image.rt.draw(gameObject, x, y, alpha, tint);\n
    • gameObject : a game object, or an array of game objects
    • Paste game objects in a group
      image.rt.draw(group, x, y);\n// image.rt.draw(group, x, y, alpha, tint);\n
    • Paste game objects in a scene
      image.rt.draw(scene.children, x, y);\n// image.rt.draw(scene.children, x, y, alpha, tint);\n
    • Paste texture
      image.rt.draw(key, x, y);\n// image.rt.draw(key, x, y, alpha, tint);\n
      or
      image.rt.drawFrame(key, frame, x, y);\n// image.rt.drawFrame(key, frame, x, y, alpha, tint);\n
      • key : The key of the texture to be used, as stored in the Texture Manager.
    • Snapshop game objects
      image.snapshot(gameObjects);\n
      • gameObjects : Array of game objects.
    "},{"location":"quad-rendertexture/#erase","title":"Erase","text":"
    image.rt.erase(gameObject, x, y);\n
    • gameObject : a game object, or an array of game objects
    "},{"location":"quad-rendertexture/#clear","title":"Clear","text":"
    image.rt.clear();\n
    "},{"location":"quad-rendertexture/#fill","title":"Fill","text":"
    image.rt.fill(rgb, alpha);\n// image.rt.fill(rgb, alpha, x, y, width, height);\n
    "},{"location":"quad-rendertexture/#other-properties","title":"Other properties","text":"

    See Quad image game object, Mesh game object, game object

    "},{"location":"quad-rendertexture/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"quad-rendertexture/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"quest/","title":"Quest","text":""},{"location":"quest/#introduction","title":"Introduction","text":"

    Question manager.

    • Author: Rex
    • Member of scene, or game object
    "},{"location":"quest/#live-demos","title":"Live demos","text":"
    • (CSV) Branch
    • (YAML) Branch
    • Shuffle
    "},{"location":"quest/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"quest/#install-plugin","title":"Install plugin","text":""},{"location":"quest/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquestplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquestplugin.min.js', true);\n
    • Add quest-manager object
      var questionManager = scene.plugins.get('rexquestplugin').add(config);\n
    "},{"location":"quest/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuestPlugin from 'phaser3-rex-plugins/plugins/quest-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuest',\nplugin: QuestPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add quest-manager object
      var questionManager = scene.plugins.get('rexQuest').add(config);\n
    "},{"location":"quest/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Quest from 'phaser3-rex-plugins/plugins/quest.js';\n
    • Add quest-manager object
      var questionManager = new Quest(config);\n
    "},{"location":"quest/#question-manager","title":"Question manager","text":""},{"location":"quest/#create-question-manager-instance","title":"Create question manager instance","text":"
    var questionManager = scene.plugins.get('rexQuest').add({\nquestions: undefined,\n// format: undefined,\n// delimiter: ',',\n// types: {\n//     question: 'q',\n//     option: '',\n// },\n// convert: true,\n\nquest: undefined,\n// quest: {\n//     shuffleQuestions: false,\n//     shuffleOptions: false,\n// }\n});\n
    • format : Input data (parameter question) format.
      • 'csv' : Input data is a csv string
      • 'yaml' : Input data is a yaml string represented multiple documents, or an array of yaml string for each document.
      • 'json' : Input data is a json string.
      • undefined : Input data is a plain array of questions, don' parse it.
    • questions : Input data of questions.
      • A plain array of questions. Parsing result of other input formats.
        [\n{\nkey: q0,\nparam0: value0,\nparam1: value1,\nparam2: value2,\noptions: [\n{\nkey: o0,\nparam0: value0,\nparam1: value1,\n// ...\n},\n{\nkey: o1,\nparam0: value0,\nparam1: value1,\n// ...\n}\n]\n},\n{\nkey: q1,\nparam0: value0,\nparam1: value1,\nparam2: value2,\noptions: [\n{\nkey: o0,\nparam0: value0,\nparam1: value1,\n// ...\n},\n{\nkey: o1,\nparam0: value0,\nparam1: value1,\n// ...\n}\n]\n},\n]\n
        • Question object : {key, options, param, ...}
          • key : An unique key string. Create a key string '_' + serialNumber if not given.
          • options : An array of option objects.
          • Other key-value parameters.
        • Option object : {key, param, ...}
          • key : An unique key string. Create a key string '_' + serialNumber if not given.
          • Other key-value parameters.
      • A yaml string represented multiple documents, will parse it to array of questions.
        key: q0\nparam0: value0\nparam1: value1\noptions:\n- key: o0\nparam0: value0\nparam1: value1\n- key: o1\nparam0: value0\nparam1: value1\n---\nkey: q1\nparam0: value0\nparam1: value1\noptions:\n- key: o0\nparam0: value0\nparam1: value1\n- key: o1\nparam0: value0\nparam1: value1\n
      • An array of yaml strings for each document, will parse them to array of questions.
      • A csv string, will parse it to array of questions.
        type,key,param0,param1,...\nq,q0,value0,value1,...\n,o0,value0,value1,...\n,o1,value0,value1,...\nq,q1,value0,value1,...\n,o0,value0,value1,...\n,o1,value0,value1,...\n
        • Fields in first row
          • type : Type of this row. These values can be redefined via types in configuration object.
          • q : A row of question object.
          • Empty string : A row of option object belong a question object.
          • key : Unique key string. Create a key string '_' + serialNumber if this field does not exist.
          • Other fields.
      • A json string, will parse it to array of questions.
    • delimiter : Delimiter of csv string. Default value is ','
    • types : Define value of row type.
      • types.question : Define value of question row. Default value is q.
      • types.option : Define value of option row. Default value is '' (empty string).
    • convert : Convert string values to other types.
      • Default type converting : Convert string to number, boolean, null, or string
        • '0', '1', ... (number string) -> number
        • 'true', or 'false' -> true or false
        • '' (empty string) -> null
        • Others : string.
      • Set false to ignore types converting, i.e. all values are string.
      • A custom type converting function :
        function(stringValue, key) {\n// return value;\n}\n
    • quest : Create a private quest task object.
      • undefined : Don't create a private quest task object.
      • true : Create a private quest task object with default configuration.
      • Configuration of quest task :
        • quest.shuffleQuestions : Set true to shuffle questions.
        • quest.shuffleOptions : Set true to shuffle options.
    "},{"location":"quest/#add-questions","title":"Add questions","text":"
    questionManager.add(questions, config);\n
    • questions : An array of question objects, or a csv string. See questions section in Create question manager instance section.
    • config :
      • delimiter : Delimiter of csv string. Default value is ','
      • types : Define value of row type.
        • types.question : Define value of question row. Default value is q.
        • types.option : Define value of option row. Default value is '' (empty string).
      • convert : Convert string values to other types.
        • Default type converting : Convert string to number, boolean, null, or string
          • '0', '1', ... (number string) -> number
          • 'true', or 'false' -> true or false
          • '' (empty string) -> null
          • Others : string.
        • Set false to ignore types converting, i.e. all values are string.
        • A custom type converting function :
          function(stringValue, key) {\n// return value;\n}\n
    "},{"location":"quest/#remove-question","title":"Remove question","text":"
    • Remove a question object
      questionManager.remove(key);\n
      • key : An unique key string.
    • Remove all question objects
      questionManager.removeAll();\n
    "},{"location":"quest/#get-question","title":"Get question","text":"
    • Get a question object
      var question = questionManager.get(key);\n
    • Get all keys of question objects
      var questionKeys = questionManager.getKeys();\n// var out = questionManager.getKeys(out);\n
      • questionKeys : Array of question key string.
    "},{"location":"quest/#question-is-existed","title":"Question is existed","text":"
    var isExisted = questionManager.has(key);\n
    "},{"location":"quest/#array-of-questions","title":"Array of questions","text":"
    var questions = questionManager.questions;\n

    Rearrange items of this questions array to reorder questions in quest task.

    "},{"location":"quest/#get-option","title":"Get option","text":"
    var option = questionManager.getOption(question, optionKey);\n
    • question : A question object, or a question key string.
    • optionKey : A option key string.
    "},{"location":"quest/#private-quest-task","title":"Private quest task","text":""},{"location":"quest/#create-private-quest-task","title":"Create private quest task","text":"

    Each question manager can hava a private quest task object, created when creating question manager, or

    questionManager.startQuest(config);\n
    • config :
      • shuffleQuestions : Set true to shuffle questions.
      • shuffleOptions : Set true to shuffle options.
    "},{"location":"quest/#get-next-question-object","title":"Get next question object","text":"
    • Get next question object
      var question = questionManager.getNextQuestion();\n
    • Get next question object via question key
      var question = questionManager.getNextQuestion(questionKey);\n
    "},{"location":"quest/#event","title":"Event","text":"
    • Fire 'quest' when calling questionManager.getNextQuestion()
      questionManager.on('quest', function(question, questionManager, quest){\n// questionManager.getNextQuestion();\n})\n
      • question : Question object.
        • question.options : Option objects of this question.
      • questionManager : Question manager.
      • quest : Quest task.
    "},{"location":"quest/#is-last-question","title":"Is last question","text":"
    var isLast = questionManager.isLastQuestion();\n
    "},{"location":"quest/#restart-quest-task","title":"Restart quest task","text":"
    questionManager.restartQuest();\n
    "},{"location":"quest/#private-data","title":"Private data","text":"
    • Get data
      var value = questionManager.getData(key, defaultValue);\n
    • Get all data
      var data = questionManager.getData();\n
    • Set value
      questionManager.setData(key, value);\n
    • Increase value
      questionManager.incData(key, inc, defaultValue);\n
    • Multiple value
      questionManager.mulData(key, mul, defaultValue);\n
    • Clear all data
      questionManager.clearData();\n
    "},{"location":"quest/#quest-task","title":"Quest task","text":"

    Create new quest task if user needs more then 1 quest task.

    "},{"location":"quest/#create-quest-task","title":"Create quest task","text":"
    var quest = questionManager.newQuest(config);\n
    • config :
      • shuffleQuestions : Set true to shuffle questions.
      • shuffleOptions : Set true to shuffle options.
    "},{"location":"quest/#get-next-question-object_1","title":"Get next question object","text":"
    • Get next question object
      var question = quest.getNextQuestion();\n
    • Get next question object via question key
      var question = quest.getNextQuestion(questionKey);\n
    "},{"location":"quest/#event_1","title":"Event","text":"
    • Fire 'quest' when calling questionManager.getNextQuestion()
      quest.on('quest', function(question, questionManager, quest){\n// questionManager.getNextQuestion();\n})\n
      • question : Question object.
        • question.options : Option objects of this question.
      • questionManager : Question manager.
      • quest : Quest task.
    "},{"location":"quest/#is-last-question_1","title":"Is last question","text":"
    var isLast = quest.isLastQuestion();\n
    "},{"location":"quest/#restart-quest-task_1","title":"Restart quest task","text":"
    quest.start();\n
    "},{"location":"quest/#private-data_1","title":"Private data","text":"
    • Get data
      var value = quest.getData(key, defaultValue);\n
    • Get all data
      var data = quest.getData();\n
    • Set value
      quest.setData(key, value);\n
    • Increase value
      quest.incData(key, inc, defaultValue);\n
    • Multiple value
      quest.mulData(key, inc, defaultValue);\n
    • Clear all data
      quest.clearData();\n
    "},{"location":"quest/#get-option_1","title":"Get option","text":"
    var option = quest.getOption(question, optionKey);\n
    • question : A question object, or a question key string, or undefined to get current question object.
    • optionKey : A option key string.
    "},{"location":"random-data-generator/","title":"Random data generator","text":""},{"location":"random-data-generator/#introduction","title":"Introduction","text":"

    Get random value from a random generator, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"random-data-generator/#usage","title":"Usage","text":""},{"location":"random-data-generator/#random-data-generator","title":"Random data generator","text":"
    • Pre-defined random data generator
      var rnd = Phaser.Math.RND;\n
    • New random generator
      var rnd = new Phaser.Math.RandomDataGenerator(seed);\n
    "},{"location":"random-data-generator/#set-seed","title":"Set seed","text":"
    • Set seed in game config for pre-defined random data generator
      var config = {\n// ...\nseed: seed,\n// ...\n}\nvar game = new Phaser.Game(config);\n
      • seed :
        • An array of string, like [(Date.now() * Math.random()).toString()]
    • Set seed
      rnd.init(seed);\n
      • seed : A string or an array of string.
    "},{"location":"random-data-generator/#get-random-value","title":"Get random value","text":"
    • Random real number between 0 and 1.
      var value = rnd.frac();\n
    • Random integer between 0 and 2^32.
      var value = rnd.integer();\n
    • Random real number between 0 and 2^32.
      var value = rnd.real();\n
    • Random integer between and including min and max.
      var value = rnd.between(min, max);\n// var value = rnd.integerInRange(min, max);\n
    • Random real number between min and max.
      var value = rnd.realInRange(min, max);\n
    • Random real number between -1 and 1.
      var value = rnd.normal();\n
    • Random angle between -180 and 180.
      var angle = rnd.angle();\n
    • Random rotation in radians, between -3.141 and 3.141.
      var angle = rnd.rotation();\n
    • Random timestamp between min and max.
      var timestamp = rnd.timestamp(min, max);\n
      • min : Default value is the beginning of 2000.
      • max : Default value is the end of 2020.
    • UUID
      var uuid = rnd.uuid();\n
    • Random sign value
      var sign = rnd.sign();\n
      • sign : -1 or 1
    "},{"location":"random-data-generator/#get-random-item","title":"Get random item","text":"
    • Random element from within the given array.
      var item = rnd.pick(arr);\n
    • Random element from within the given array, favoring the earlier entries.
      var item = rnd.weightedPick(arr);\n
    "},{"location":"random-data-generator/#shuffle-array","title":"Shuffle array","text":"
    var arr = rnd.shuffle(arr);\n
    "},{"location":"random/","title":"Random number","text":""},{"location":"random/#introduction","title":"Introduction","text":"

    Get random value, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"random/#usage","title":"Usage","text":""},{"location":"random/#get-random-value-between-min-max","title":"Get random value between (min, max)","text":"
    • Random integer
      var value = Phaser.Math.Between(min, max);\n
    • Random floating point number
      var value = Phaser.Math.FloatBetween(min, max);\n
    "},{"location":"random/#get-random-vector","title":"Get random vector","text":"
    • 2D vector
      var vec = Phaser.Math.RandomXY(vec);    // return vec {x, y}\n// var vec = Phaser.Math.RandomXY(vec, scale);\n
    • 3D vector
      var vec = Phaser.Math.RandomXYZ(vec);    // return vec {x, y, z}\n// var vec = Phaser.Math.RandomXYZ(vec, scale);\n
    • 4D vector
      var vec = Phaser.Math.RandomXYZW(vec);    // return vec {x, y, z, w}\n// var vec = Phaser.Math.RandomXYZW(vec, scale);\n
    "},{"location":"randomplace/","title":"Random place","text":""},{"location":"randomplace/#introduction","title":"Introduction","text":"

    Place objects randomly inside an area without overlapping.

    • Author: Rex
    • Methods
    "},{"location":"randomplace/#live-demos","title":"Live demos","text":"
    • Random place
    "},{"location":"randomplace/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"randomplace/#install-plugin","title":"Install plugin","text":""},{"location":"randomplace/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrandomplaceplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrandomplaceplugin.min.js', true);\n
    • Random place objects
      scene.plugins.get('rexrandomplaceplugin').randomPlace(gameObjects, config);\n
    "},{"location":"randomplace/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RandomPlacePlugin from 'phaser3-rex-plugins/plugins/randomplace-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRandomPlace',\nplugin: RandomPlacePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Random place objects
      scene.plugins.get('rexRandomPlace').randomPlace(gameObjects, config);\n
    "},{"location":"randomplace/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RandomPlace from 'phaser3-rex-plugins/plugins/randomplace.js';\n
    • Random place objects
      RandomPlace(gameObjects, config);\n
    "},{"location":"randomplace/#random-place","title":"Random place","text":"
    scene.plugins.get('rexRandomPlace').randomPlace(gameObjects, {\nradius: radius,\n\ngetPositionCallback: undefined,\narea: areaGeomObject,\n});\n
    • gameObjects : An array of gameObjects. Each item can be
      • A game objects.
      • A plain object contains
        {\ngameObject: gameObject,\nradius: radius,\n}\n
        • radius : Collision radius of this game object.
    • radius : Default collision radius of each game object.
    • getPositionCallback : A callback to get a random position.
      • undefined : Use area.getRandomPoint(out) as callback.
      • A function object :
        function(out) {\nout.x = 0;\nout.y = 0;\n}\n
    • area : A geom object, which has getRandomPoint method.
      • A circle : new Phaser.Geom.Circle(x, y, radius)
      • A rectangle : new Phaser.Geom.Rectangle(x, y, width, height)
      • A triangle : new Phaser.Geom.Triangle(x1, y1, x2, y2, x3, y3)
      • An ellipse : new Phaser.Geom.Ellipse(x, y, width, height)
      • undefined : A rectangle (0, 0, gameWidth, gameHeight)
    "},{"location":"raycaster/","title":"Raycaster","text":""},{"location":"raycaster/#introduction","title":"Introduction","text":"

    Raycaster between obstacles.

    • Author: Rex
    • Member of scene
    "},{"location":"raycaster/#live-demos","title":"Live demos","text":"
    • Reflaction
    "},{"location":"raycaster/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"raycaster/#install-plugin","title":"Install plugin","text":""},{"location":"raycaster/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexraycasterplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexraycasterplugin.min.js', true);\n
    • Add raycaster object
      var raycaster = scene.plugins.get('rexraycasterplugin').add(config);\n
    "},{"location":"raycaster/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RaycasterPlugin from 'phaser3-rex-plugins/plugins/raycaster-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRaycaster',\nplugin: RaycasterPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add raycaster object
      var raycaster = scene.plugins.get('rexRaycaster').add(config);\n
    "},{"location":"raycaster/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Raycaster from 'phaser3-rex-plugins/plugins/raycaster.js';\n
    • Add raycaster object
      var raycaster = new Raycaster(config);\n
    "},{"location":"raycaster/#create-instance","title":"Create instance","text":"
    var raycaster = scene.plugins.get('rexRaycaster').add({\n// maxRayLength: 10000\n});\n
    • maxRayLength : Max length of ray.
    "},{"location":"raycaster/#obstacle","title":"Obstacle","text":""},{"location":"raycaster/#add","title":"Add","text":"
    raycaster.addObstacle(gameObject);\n// raycaster.addObstacle(gameObject, polygon);\n
    • polygon : A polygon.
      • undefined : Created polygon from 4 vertics of game object.

    or

    raycaster.addObstacle(gameObjects);\n
    • gameObjects : Array of game object.
    "},{"location":"raycaster/#remove","title":"Remove","text":"
    raycaster.removeObstacle(gameObject);\n
    • gameObject : A game object, or an array of game objects.
    "},{"location":"raycaster/#clear","title":"Clear","text":"
    raycaster.clearObstacle();\n
    "},{"location":"raycaster/#update-shape","title":"Update shape","text":"
    raycaster.updateObstacle(gameObject);\n// raycaster.updateObstacle(gameObject, polygon);\n
    • polygon : A polygon.
      • undefined : Created polygon from 4 vertics of game object.
    "},{"location":"raycaster/#raycaster","title":"Raycaster","text":"
    var result = raycaster.rayToward(x, y, angle);\n
    • x, y : Emit ray from world-position.
    • angle : Emit ray toward to angle, in radian.
    • result :
      • false : Ray dose not hit any game object.
      • An object : Hit to a game object.
        {\ngameObject,\npolygon,\nsegment,\nx, y,\nreflectAngle\n}\n
        • gameObject : Hitting game object.
        • polygon : Polygon of hitting game object.
        • segment : Segment(line) of hitting polygon.
        • x, y : World position of hitting
        • reflectAngle : Reflect angle, in radian.

    Reflection

    Use result.x, result.y, result.reflectAngle for next reflection ray.

    raycaster.rayToward(result.x, result.y, result.reflectAngle)\n

    "},{"location":"realtimetimers/","title":"Real time timers","text":""},{"location":"realtimetimers/#introduction","title":"Introduction","text":"

    Start and counting timer by real-time timestamp.

    Note

    Not support pause, or timescale features.

    • Author: Rex
    • Member of scene, or game object
    "},{"location":"realtimetimers/#live-demos","title":"Live demos","text":"
    • Progress
    "},{"location":"realtimetimers/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"realtimetimers/#install-plugin","title":"Install plugin","text":""},{"location":"realtimetimers/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrealtimetimersplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrealtimetimersplugin.min.js', true);\n
    • Add real-time timers object
      var realTimeTimers = scene.plugins.get('rexrealtimetimersplugin').add(config);\n
    "},{"location":"realtimetimers/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RealTimeTimersPlugin from 'phaser3-rex-plugins/plugins/realtimetimers-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRealTimeTimers',\nplugin: RealTimeTimersPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add real-time timers object
      var realTimeTimers = scene.plugins.get('rexRealTimeTimers').add(config);\n
    "},{"location":"realtimetimers/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RealTimeTimers from 'phaser3-rex-plugins/plugins/realtimetimers.js';\n
    • Add real-time timers object
      var realTimeTimers = new RealTimeTimers(config);\n
    "},{"location":"realtimetimers/#create-instance","title":"Create instance","text":"
    var realTimeTimers = scene.plugins.get('rexRealTimeTimers').add({\n// startTimestamp: new Date().getTime(),\n// getTimestampCallback: functio() { return timestamp; }\n});\n
    • getTimestampCallback : Custom callback of get current timestamp, optional.
      • Default behavior is getting current timestamp from system.
    • startTimestamp : Start time, optional. Use this start-timestamp if getTimestampCallback is not given.
      • Default value is current timestamp new Date().getTime().
    "},{"location":"realtimetimers/#set-start-timestamp","title":"Set start timestamp","text":"

    Start-timestamp is set when creating this real-time timers object.

    User still can change Start-timestamp by

    realTimeTimers.setStartTimestamp(timestamp);\n

    This changing won't affect existed timers.

    "},{"location":"realtimetimers/#add-a-timer","title":"Add a timer","text":"
    realTimeTimers.addTimer(name, period);\n// realTimeTimers.addTimer(name, period, data);\n// realTimeTimers.addTimer(name, period, data, currentTimestamp);\n
    • name : Any name string of this timer.
    • period : Will expire after period time, in millisecond.
    • data : Any kind of custom data.
    • currentTimestamp : Start this time in current time, optional.
      • undefined : Get current timestamp from getTimestampCallback callback.

    or

    realTimeTimers.addTimer(name, {\nday: dayCount,        // d: dayCount,\nhour: hourCount,      // h: hourCount,\nminute: minuteCount,  // m: minuteCount,\nsecond: secondCount,  // s: secondCount,\n}, data, currentTimestamp);\n
    • Sum period by
      • day, or d : Day count
      • hour, or h : Hour count
      • minute, or m : Minute count
      • second, or s : Second count
    "},{"location":"realtimetimers/#increase-period","title":"Increase period","text":"
    realTimeTimers.incTimerPeriod(name, period);\n
    • name : Any name string of this timer.
    • period : Will expire after period time, in millisecond.

    or

    realTimeTimers.incTimerPeriod(name, {\nday: dayCount,        // d: dayCount,\nhour: hourCount,      // h: hourCount,\nminute: minuteCount,  // m: minuteCount,\nsecond: secondCount,  // s: secondCount,\n});\n

    Will trigger 'update' event.

    "},{"location":"realtimetimers/#expire-timers","title":"Expire timers","text":"
    • Get expired timers
      var timers = realTimeTimers.getExpiredTimers();\n// var timers = realTimeTimers.getExpiredTimers(currentTimestamp);\n
      • timers : Array of expired timers. Each timer include these properties -
        {\nname: name,\nstart: timestamp,\nperiod: time\n}\n
      • currentTimestamp : Start this time in current time, optional.
        • undefined : Get current timestamp from getTimestampCallback callback.
    • Pop(get and remove) expired timers
      var timers = realTimeTimers.popExpiredTimers();\n// var timers = realTimeTimers.popExpiredTimers(currentTimestamp);\n
      • currentTimestamp : Start this time in current time, optional.
        • undefined : Get current timestamp from getTimestampCallback callback.
    • Get progress of timer
      var result = realTimeTimers.getTimersProgress()\n// var result = realTimeTimers.getTimersProgress(currentTimestamp);\n
      • currentTimestamp : Start this time in current time, optional.
        • undefined : Get current timestamp from getTimestampCallback callback.
      • result : Array of timer's progress. Include these properties -
        {\nname: name,\nperiod: time,\nelapsed: time,\nprogress: t    // elapsed/period\ntimer: timerObject\n}\n
        • timer : Timer object, can remove this timer object by
          realTimeTimers.removeTimers(timer);\n
    "},{"location":"realtimetimers/#get-timers","title":"Get timers","text":"
    • Get last added timer
      var timer = realtimetimers.lastTimer;\n
    • Get all timers
      var timers = realtimetimers.getTimers();\n
    • Get timers by name.
      var timers = realtimetimers.getTimers(name);\n
    • Amount of total timers
      var amount = realtimetimers.length;\n
    "},{"location":"realtimetimers/#remove-timers","title":"Remove timers","text":"
    • Remove timers by name
      realtimetimers.removeTimers(name);\n
    • Remove timer object
      realtimetimers.removeTimers(timer);\n
      • timer : A timer object, or an array of timer objects.
    • Remove all timers
      realtimetimers.clearTimers();\n
    "},{"location":"realtimetimers/#states","title":"States","text":"
    • Get states in plain object
      var states = realtimetimers.toJSON();\n
    • Get states in JSON string. Can store this JSON string into webstorage or server.
      var s = JSON.stringify(realtimetimers);\n
    • Set states by plain object
      realtimetimers.resetFromJSON(states)\n
    "},{"location":"realtimetimers/#events","title":"Events","text":"
    • On add a timer
      realtimetimers.on('add', function(timer, timers){ })\n
      • timer : Added timer.
        {\nname: name,\nstart: timestamp,\nperiod: time\n}\n
      • timers : Total timers after adding.
    • On remove a timer
      realtimetimers.on('remove', function(timer, timers){ })\n
      • timer : Removed timer.
        {\nname: name,\nstart: timestamp,\nperiod: time\n}\n
      • timers : Total timers after removing.
    • On timers updated (add, remove, or increas period).
      realtimetimers.on('update', function(timers){ var s = JSON.stringify(realtimetimers);\n// Store current states to webstorage or server here.\n})\n
      • timers : Total timers after updating.
    "},{"location":"rendertexture/","title":"Render texture","text":""},{"location":"rendertexture/#introduction","title":"Introduction","text":"

    Paste game objects or textures on dynaimc texture, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"rendertexture/#usage","title":"Usage","text":""},{"location":"rendertexture/#add-render-texture-object","title":"Add render texture object","text":"
    • Create an empty render texture object.
      var rt = scene.add.renderTexture(x, y, width, height);\n

    Add render texture from JSON

    var rt = scene.make.renderTexture({\nx: 0,\ny: 0,\nwidth: 32,\nheight: 32,\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n

    Origin position

    Origin position of this render texture is (0,0) (top-left)

    "},{"location":"rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRenderTexture extends Phaser.GameObjects.RenderTexture {\nconstructor(scene, x, y, width, height) {\nsuper(scene, x, y, width, height);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rt = new MyRenderTexture(scene, x, y, width, height);\n
    "},{"location":"rendertexture/#set-size","title":"Set size","text":"
    rt.setSize(width, height);\n
    "},{"location":"rendertexture/#fill-color","title":"Fill color","text":"
    rt.fill(rgb);\n// rt.fill(rgb, alpha, x, y, width, height);\n
    • rgb : The number color to fill this Dynamic Texture with.
    • alpha : The alpha value used by the fill. Default value is 1.
    • x, y, width, height : The area of the fill rectangle. Default behavior is filling whole size.
    "},{"location":"rendertexture/#clear","title":"Clear","text":"
    rt.clear();\n
    rt.clear(x, y, width, height);\n
    "},{"location":"rendertexture/#draw-game-object","title":"Draw game object","text":"
    rt.draw(entries);\n// rt.draw(entries,x, y);\n// rt.draw(entries, x, y, alpha, tint);\n
    • entries :
      • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
      • Tilemap Layers.
      • A Group. The contents of which will be iterated and drawn in turn.
      • A Container. The contents of which will be iterated fully, and drawn in turn.
      • A Scene Display List. Pass in Scene.children to draw the whole list.
      • Another Dynamic Texture, or a Render Texture.
      • A Texture Frame instance.
      • A string. This is used to look-up the texture from the Texture Manager.
    • x, y : The x/y position to draw the Frame at, or the offset applied to the object.
      • If the object is a Group, Container or Display List, the coordinates are added to the positions of the children.
      • For all other types of object, the coordinates are exact.
    • alpha, tint : Only used by Texture Frames.
      • Game Objects use their own alpha and tint values when being drawn.
    "},{"location":"rendertexture/#erase","title":"Erase","text":"
    rt.erase(entries);\n// rt.erase(entries, x, y);\n
    • entries :
      • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
      • Tilemap Layers.
      • A Group. The contents of which will be iterated and drawn in turn.
      • A Container. The contents of which will be iterated fully, and drawn in turn.
      • A Scene Display List. Pass in Scene.children to draw the whole list.
      • Another Dynamic Texture, or a Render Texture.
      • A Texture Frame instance.
      • A string. This is used to look-up the texture from the Texture Manager.
    • x, y : The x/y position to draw the Frame at, or the offset applied to the object.
      • If the object is a Group, Container or Display List, the coordinates are added to the positions of the children.
      • For all other types of object, the coordinates are exact.
    "},{"location":"rendertexture/#draw-frame","title":"Draw frame","text":"
    rt.stamp(key, frame, x, y, {\nalpha: 1,\ntint: 0xffffff,\nangle: 0,\nrotation: 0,\nscale: 1,\nscaleX: 1,\nscaleY: 1,\noriginX: 0.5,\noriginY: 0.5,\nblendMode: 0,\nerase: false,\nskipBatch: false\n})\n

    or

    rt.drawFrame(key, frame, x, y);\n// rt.drawFrame(key, frame, x, y, alpha, tint);\n
    • x, y : Top-left position
    "},{"location":"rendertexture/#draw-repeat-frames","title":"Draw repeat frames","text":"
    • Repeat frames full of size
      rt.repeat(key, frame);\n
    • Repeat in an area
      rt.repeat(key, frame, x, y, width, height);\n// rt.repeat(key, frame, x, y, width, height, alpha, tint, skipBatch);\n
    "},{"location":"rendertexture/#batch-draw","title":"Batch draw","text":"
    1. Begin
      rt.beginDraw();\n
    2. Draw
      • Draw game object
        rt.batchDraw(entries, x, y, alpha, tint);\n
        • entries :
          • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
          • Tilemap Layers.
          • A Group. The contents of which will be iterated and drawn in turn.
          • A Container. The contents of which will be iterated fully, and drawn in turn.
          • A Scene Display List. Pass in Scene.children to draw the whole list.
          • Another Dynamic Texture, or a Render Texture.
          • A Texture Frame instance.
          • A string. This is used to look-up the texture from the Texture Manager.
      • Draw frame
        rt.batchDrawFrame(key, frame, x, y, alpha, tint);\n
      • Draw image
        rt.stamp(key, frame, x, y, {\n// ...\nskipBatch: true\n})\n
      • Draw repeat images
        rt.repeat(key, frame, x, y, width, height, alpha, tint, true);\n
    3. End
      rt.endDraw();\n
    "},{"location":"rendertexture/#internal-camera","title":"Internal camera","text":"

    Internal camera rt.camera

    • Scroll (offset)
      rt.camera.setScroll(x, y);\n
    • Zoom (scale)
      rt.camera.setZoom(zoom);\n
    • Rotate
      rt.camera.setAngle(angle);  // angle in degrees\n
    "},{"location":"rendertexture/#snapshot","title":"Snapshot","text":""},{"location":"rendertexture/#snapshot-area","title":"Snapshot area","text":"
    texture.snapshot(callback);\n// texture.snapshot(callback, type, encoderOptions);\n

    or

    texture.snapshotArea(x, y, width, height, callback, type, encoderOptions);\n
    • callback : The Function to invoke after the snapshot image is created.
      function(imageElement) {\n}\n
      • imageElement : HTMLImageElement.
    • type : The format of the image to create, usually 'image/png' or 'image/jpeg'. Default value is 'image/png'.
    • encoderOptions : The image quality, between 0 and 1. Used for image formats with lossy compression, such as 'image/jpeg'. Default value is 0.92.
    • x, y, width, height : Snapshot area.
    "},{"location":"rendertexture/#get-color-of-a-pixel","title":"Get color of a pixel","text":"
    texture.snapshotPixel(x, y, callback);\n
    • x, y : The x/y coordinate of the pixel to get.
    • callback : The Function to invoke after the snapshot image is created.
      function(color) {        }\n
      • color : Color object.
    "},{"location":"rendertexture/#global-alpha","title":"Global alpha","text":"
    rt.setGlobalAlpha(alpha);\n// rt.globalAlpha = alpha;\n
    "},{"location":"rendertexture/#global-tint","title":"Global tint","text":"
    rt.setGlobalTint(tint);\n// rt.globalTint = tint;\n
    "},{"location":"rendertexture/#save-texture","title":"Save texture","text":"

    Stores a copy of this Render Texture in the Texture Manager using the given key.

    rt.saveTexture(key);\n

    Calling saveTexture again will not save another copy of the same texture, it will just rename the key of the existing copy.

    "},{"location":"rendertexture/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"rendertexture/#create-mask","title":"Create mask","text":"
    var mask = rt.createBitmapMask();\n

    See mask

    "},{"location":"rendertexture/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"repeatimage/","title":"Repeat image","text":""},{"location":"repeatimage/#introduction","title":"Introduction","text":"

    Stamp image repeatly on canvas, similar with TileSprite. It has better rendering result when the texture size is not power of 2, in WebGL and pixelArt mode.

    • Author: Rex
    • Game object
    "},{"location":"repeatimage/#live-demos","title":"Live demos","text":"
    • PixelArt, compared with TileSprite
    • Scroll
    "},{"location":"repeatimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"repeatimage/#install-plugin","title":"Install plugin","text":""},{"location":"repeatimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrepeatimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrepeatimageplugin.min.js', true);\n
    • Add repeat-image object
      var image = scene.add.rexRepeatImage(x, y, width, height, key, frame);\n
    "},{"location":"repeatimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RepeatImagePlugin from 'phaser3-rex-plugins/plugins/repeatimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRepeatImagePlugin',\nplugin: RepeatImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add repeat-image object
      var image = scene.add.rexRepeatImage(x, y, width, height, key, frame);\n
    "},{"location":"repeatimage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RepeatImage from 'phaser3-rex-plugins/plugins/repeatimage.js';\n
    • Add repeat-image object
      var image = new RepeatImage(scene, x, y, key, frame, config);\nscene.add.existing(image);\n
    "},{"location":"repeatimage/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRepeatImagePlugin',\nplugin: RepeatImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"repeatimage/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexRepeatImage(x, y, width, height, key, frame);\n

    Add image from JSON

    var image = scene.make.rexRepeatImage({\nx: 0,\ny: 0,\nwidth: 512,\nheight: 512,\nkey: '',\n\nadd: true\n});\n
    "},{"location":"repeatimage/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImage extends RepeatImage {\nconstructor(scene, x, y, width, height, key, frame) {\nsuper(scene, x, y, width, height, key, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImage(scene, x, y, width, height, key, frame);\n
    "},{"location":"repeatimage/#set-texture","title":"Set texture","text":"
    image.setTexture(key, frame);\n
    "},{"location":"repeatimage/#properties-of-tiles","title":"Properties of tiles","text":"
    • Position
      image.setTilePosition(x, y);\n
      or
      image.tilePositionX = x;\nimage.tilePositionY = y;\n
    • Scale
      image.setTileScale(scaleX, scaleY);\n
      or
      image.tileScaleX = scaleX;\nimage.tileScaleY = scaleY;\n
    "},{"location":"repeatimage/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"repeatimage/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"repeatimage/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"repeatimage/#compare-with-tilesprite","title":"Compare with TileSprite","text":"

    Using this RepeatImage when the texture size is not power of 2, in WebGL and pixelArt mode. Otherwise, using tileSprite

    "},{"location":"restorabledata/","title":"Restorable data","text":""},{"location":"restorabledata/#introduction","title":"Introduction","text":"

    Restorable data manager, extends from built-in data manager.

    • Author: Rex
    • Member of scene
    "},{"location":"restorabledata/#live-demos","title":"Live demos","text":"
    • Restorable canvas
    "},{"location":"restorabledata/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"restorabledata/#install-plugin","title":"Install plugin","text":""},{"location":"restorabledata/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrestorabledataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrestorabledataplugin.min.js', true);\n
    • Add restorable data object
      var data = scene.plugins.get('rexrestorabledataplugin').add(parent);\n
    "},{"location":"restorabledata/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RestorableDataPlugin from 'phaser3-rex-plugins/plugins/restorabledata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRestorableData',\nplugin: RestorableDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add restorable data object
      var data = scene.plugins.get('rexRestorableData').add(parent);\n
    "},{"location":"restorabledata/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RestorableData from 'phaser3-rex-plugins/plugins/restorabledata.js';\n
    • Add restorable data object
      var data = new RestorableData(parent);\n
    "},{"location":"restorabledata/#create-instance","title":"Create instance","text":"
    var data = scene.plugins.get('rexRData').add(parent);\n// var data = scene.plugins.get('rexRData').add(parent, eventEmitter);\n
    • parent : The object (a scene, or a game object) that this DataManager belongs to.
    • eventEmitter : The DataManager's event emitter.
    "},{"location":"restorabledata/#getsetremove-value","title":"Get/set/remove value","text":"

    See built-in data manager.

    "},{"location":"restorabledata/#commit","title":"Commit","text":"

    Commit current data status into repository, and increase current version number.

    data.commit();\n

    or

    data.commit(alias);\n
    • alias : A version alias string.
    "},{"location":"restorabledata/#restore","title":"Restore","text":"
    • Restore data status to a specific version.
      data.restore(version);\n
      or
      data.version = version;\n
      • version : Version number or version alias string.
    • Rebuild data status from version 0 to a specific version.
      data.restore(version, true);\n
      • version : Version number or version alias string.
    • Reverse data status to last version.
      data.restore();\n
    "},{"location":"restorabledata/#version","title":"Version","text":"
    • Get current version alias string
      var version = data.versionAlias;\n
    • Get all version alias strings
      var aliases = data.versionAliases;\n
    • Get current version number
      var version = data.version;\n
    • Get last version number
      var version = data.lastVersion;\n

    Version starts from 0 which has no data. Each data.commit() will increase this version number.

    "},{"location":"restorabledata/#saveload-status","title":"Save/load status","text":"
    • Get current status
      var o = data.toJSON();\n
    • Load status
      data.resetFromJSON(o);\n

    or

    • Get current status via JSON string
      var s = JSON.stringify(data);\n
    • Load status via JSON string
      data.resetFromJSON(JSON.parse(s));\n
    "},{"location":"reverse-string/","title":"Reverse","text":""},{"location":"reverse-string/#introduction","title":"Introduction","text":"

    Reverses string, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"reverse-string/#usage","title":"Usage","text":"
    var result = Phaser.Utils.String.ReverseString(str);\n
    "},{"location":"rexvideo/","title":"Rexvideo","text":"

    Warning

    This plugin is abandoned, please using built-in video.

    "},{"location":"rexvideo/#introduction","title":"Introduction","text":"

    Play video on DOM, or on canvas.

    • Author: Rex
    • DOM Game object, or Canvas Game object
    "},{"location":"rexvideo/#live-demos","title":"Live demos","text":""},{"location":"rexvideo/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"rexvideo/#install-plugin","title":"Install plugin","text":""},{"location":"rexvideo/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexvideoplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexvideoplugin.min.js', true);\n
    • Add video object
      var video = scene.add.rexVideoCanvas(x, y, width, height, config);    // var video = scene.add.rexVideo(x, y, width, height, config);\n
    "},{"location":"rexvideo/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import VideoPlugin from 'phaser3-rex-plugins/plugins/video-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexVideo',\nplugin: VideoPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add video object
      var video = scene.add.rexVideoCanvas(x, y, width, height, config);\n// var video = scene.add.rexVideo(x, y, width, height, config);\n
    "},{"location":"rexvideo/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import VideoCanvas from 'phaser3-rex-plugins/plugins/videocanvas/VideoCanvas.js';\n// import VideoDOM from 'phaser3-rex-plugins/plugins/videodom/VideoDOM.js';\n
    • Add text object
      var video = new VideoCanvas(scene, x, y, width, height, config);\nscene.add.existing(video);\n// var video = new VideoDOM(scene, x, y, width, height, config);\n// scene.add.existing(video);\n
    "},{"location":"rexvideo/#add-video-object","title":"Add video object","text":"
    • Video on DOM
      var video = scene.add.rexVideo(x, y, width, height, config);\n// var video = scene.add.rexVideo(x, y, config);\n// var video = scene.add.rexVideo(config);\n
    • Video on canvas
      var video = scene.add.rexVideoCanvas(x, y, width, height, config);\n// var video = scene.add.rexVideoCanvas(x, y, config);\n// var video = scene.add.rexVideoCanvas(config);\n

    Default configuration

    {\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\n// Element properties\nsrc: url,\n// src: {\n//     webm: webmFileURL,\n//     ogg: oggFileURL,\n//     mp4: mp4FileURL,\n//     h264: h264FileURL,\n// }\nid: undefined,\nautoPlay: true,\ncontrols: false,\nloop: false,\nmuted: false,\nplaysInline: true,\ncrossOrigin: 'anonymous',\nplaybackTimeChangeEventEnable: true,\n}\n
    • x, y : Position
    • width, height : Size of element
    • Element properties
      • src : Specifies the URL of the video file.
        • A string : url of the video file.
        • A plain object : { videoType: fileURL }
          1. Get webmFileURL if browser supports webm video format.
          2. Get oggFileURL if browser supports ogg video format.
          3. Get mp4FileURL if browser supports mp4 video format.
          4. Get h264FileURL if browser supports h264 video format.
      • id : id element property.
      • autoPlay : autoplay element property.
      • controls : controls element property.
      • loop : loop element property.
      • muted : muted element property.
      • playsInline : playsInline element property.
      • crossOrigin : crossOrigin element property.
    • playbackTimeChangeEventEnable : Set false to disable playbacktimechange event.
    "},{"location":"rexvideo/#different-between-rexvideo-and-rexvideocanvas","title":"Different between rexVideo and rexVideoCanvas","text":"
    • rexVideo plays video on DOM.
      • DOM object always above game canvas.
      • Won't be affected by webgl shader.
      • Right clicks to pop up a menu.
    • rexVideoCanvas plays video on canvas.
      • Can be placed between game objects via depth setting.
      • Can be affected by webgl shader.
    "},{"location":"rexvideo/#custom-class","title":"Custom class","text":"
    • Define class
      class MyVideo extends Video {  // or VideoCanvas\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     if (super.preUpdate) {\n//         super.preUpdate(time, delta)\n//     }\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var video = new MyVideo(scene, x, y, width, height, config);\n
    "},{"location":"rexvideo/#load","title":"Load","text":"
    video.load(src);\n
    • src : Specifies the URL of the video file.
      • A string : url of the video file.
      • A plain object : { videoType: fileURL }
        1. Get webmFileURL if browser supports webm video format.
        2. Get oggFileURL if browser supports ogg video format.
        3. Get mp4FileURL if browser supports mp4 video format.
        4. Get h264FileURL if browser supports h264 video format.
    "},{"location":"rexvideo/#play","title":"Play","text":"
    video.play();\n
    "},{"location":"rexvideo/#pause","title":"Pause","text":"
    video.pause();\n
    "},{"location":"rexvideo/#playback-time","title":"Playback time","text":"
    • Get
      var playbackTime = video.playbackTime; // time in seconds\n
      var t = video.t; // t: 0~1\n
    • Set
      video.setPlaybackTime(time); // time in seconds\n// video.playbackTime = time;\n
      video.setT(t); // t: 0~1\n// video.t = t;\n
    "},{"location":"rexvideo/#duration","title":"Duration","text":"
    var duration = video.duration;  // time in seconds\n
    "},{"location":"rexvideo/#volume","title":"Volume","text":"
    • Get
      var volume = video.volume;  // volume: 0~1\n
    • Set
      video.setVolume(volume);  // volume: 0~1\n// video.volume = volume;\n
    "},{"location":"rexvideo/#mute","title":"Mute","text":"
    • Get
      var muted = video.muted;  // muted: true/false\n
    • Set
      video.setMute(muted);  // muted: true/false\n// video.muted = muted;\n
    "},{"location":"rexvideo/#loop","title":"Loop","text":"
    • Get
      var loop = video.loop;  // loop: true/false\n
    • Set
      video.setLoop(loop);  // loop: true/false\n// video.loop = loop;\n
    "},{"location":"rexvideo/#resize","title":"Resize","text":"
    video.resize(width, height);\n
    "},{"location":"rexvideo/#status","title":"Status","text":"
    • Is playing
      var isPlaying = video.isPlaying;\n
    • Is paused
      var isPaused = video.isPaused;\n
    • Has end
      var hasEnded = video.hasEnded;\n
    • Ready state
      var readyState = video.readyState;\n
      • 0 = HAVE_NOTHING - no information whether or not the audio/video is ready
      • 1 = HAVE_METADATA - metadata for the audio/video is ready
      • 2 = HAVE_CURRENT_DATA - data for the current playback position is available, but not enough data to play next frame/millisecond
      • 3 = HAVE_FUTURE_DATA - data for the current and at least the next frame is available
      • 4 = HAVE_ENOUGH_DATA - enough data available to start playing
    "},{"location":"rexvideo/#events","title":"Events","text":"
    • Load start
      video.on('loadstart', function(video){ }, scope);\n
    • Can play
      video.on('canplay', function(video){ }, scope);\n
    • Can play through
      video.on('canplaythrough', function(video){ }, scope);\n
    • Playing
      video.on('playing', function(video){ }, scope);\n
    • Pause
      video.on('pause', function(video){ }, scope);\n
    • Stalled
      video.on('stalled', function(video){ }, scope);\n
    • Ended
      video.on('ended', function(video){ }, scope);\n
    • Error
      video.on('error', function(video){ }, scope);\n
    • Playback time changed
      video.on('playbacktimechange', function(video){ }, scope);\n
      • Set playbackTimeChangeEventEnable to true to enable this event.
    "},{"location":"rope/","title":"Rope","text":""},{"location":"rope/#introduction","title":"Introduction","text":"

    Manipulate the vertices of images, built-in game object of phaser.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"rope/#usage","title":"Usage","text":""},{"location":"rope/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"rope/#add-object","title":"Add object","text":"
    var rope = scene.add.rope(x, y, texture, frame, points, horizontal);\n// var rope = scene.add.rope(x, y, texture, frame, points, horizontal, colors, alphas);\n
    • points :
      • A number : Segments to split the texture frame into.
      • An number array : An array containing the vertices data.
    • horizontal :
      • true : Vertices of this Rope be aligned horizontally.
      • false : Vertices of this Rope be aligned vertically.
    • colors : An optional array containing the color data for this Rope. One color value per pair of vertices.
    • alphas : An optional array containing the alpha data for this Rope. One alpha value per pair of vertices.

    Add rope from JSON

    var rope = scene.make.rope({\nx: 0,\ny: 0,\nkey: '',\nframe: null,\nhorizontal: true,\npoints: undefined,\ncolors: undefined,\nalphas: undefined,\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"rope/#custom-rope-class","title":"Custom rope class","text":"
    • Define class
      class MyRope extends Phaser.GameObjects.Rope {\nconstructor(scene, x, y, texture, frame, points, horizontal, colors, alphas) {\nsuper(scene, x, y, texture, frame, points, horizontal, colors, alphas);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rope = new MyRope(scene, x, y, texture, frame, points, horizontal);\n
    "},{"location":"rope/#origin","title":"Origin","text":"

    A Ropes origin is always 0.5 x 0.5 and cannot be changed.

    "},{"location":"rope/#set-vertices","title":"Set vertices","text":"

    Set vertices via

    rope.setPoints(points);\n// rope.setPoints(points, colors, alphas);\n
    • points :
      • A number : Segments to split the texture frame into.
      • An number array : An array containing the vertices data.
    • colors : An optional array containing the color data for this Rope. One color value per pair of vertices.
    • alphas : An optional array containing the alpha data for this Rope. One alpha value per pair of vertices.

    Also change horizontal mode :

    • Change vertical rope to horizontal rope, do nothing if rope is horizontal mode already
      rope.setHorizontal(points);\n// rope.setHorizontal(points, colors, alphas);\n
    • Change horizontal rope to vertical rope, do nothing if rope is vertical mode already
      rope.setVertical(points);\n// rope.setVertical(points, colors, alphas);\n

    Or set rope.points directly :

    1. Change rope.points
      • Horizontal rope : rope.points[i].y = newY
      • Vertical rope : rope.points[i].x = newX
    2. Call rope.setDirty(), or rope.updateVertices()

    Each point is relative to position of rope object, get points of world via

    var worldX = rope.points[i].x + rope.x;\nvar worldY = rope.points[i].y + rope.y;\n
    "},{"location":"rope/#play-animation","title":"Play animation","text":"
    rope.play(key);\n// rope.play(key, ignoreIfPlaying, startFrame);\n
    • ignoreIfPlaying : If an animation is already playing then ignore this call. Default value is false.
    • startFrame : Optionally start the animation playing from this frame index. Default value is 0.
    "},{"location":"rope/#alpha","title":"Alpha","text":"
    • Single alpha
      rope.setAlphas(alpha);\n
    • Top - bottom alpha
      rope.setAlphas(topAlpha, bottomAlpha);\n
    • Alpha array for each point
      rope.setAlphas(alphaArray);\n
      • alphaArray : Array of alpha value.
    "},{"location":"rope/#color-tint","title":"Color tint","text":"
    • Single color tint
      rope.setColors(color);\n
    • Color tint array for each point
      rope.setAlphas(colorArray);\n
      • colorArray : Array of color tint value.
    "},{"location":"rope/#tint-fill-mode","title":"Tint fill mode","text":"

    Sets the tint fill mode.

    rope.setTintFill(mode);\n
    • mode :
      • 0 : Additive tint, blends the vertices colors with the texture. Default behavior.
      • 1 : Fill tint with alpha.
      • 2 : Fill tint without alpha.
    "},{"location":"rope/#flip","title":"Flip","text":"
    rope.flipX = flip;\nrope.flipY = flip;\n

    If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.

    "},{"location":"rope/#debug","title":"Debug","text":"

    Draw debug mesh each render tick.

    rope.setDebug(graphic);\n// rope.setDebug(graphic, callback);\n
    • graphic : Graphics game object
    • callback : Callback of rendering debug graphics (default callback)
      function(rope, meshLength, verts) {\n// var graphic = rope.debugGraphic;\n}\n
      • rope : Rope instance.
        • rope.debugGraphic : Graphics game object
      • meshLength : The number of mesh vertices in total.
      • verts : An array of the translated vertex coordinates.

    Note

    Clear Debug graphics (rope.debugGraphic.clear()) during scene's update stage (scene.update() { })

    "},{"location":"rotate/","title":"Rotate","text":""},{"location":"rotate/#introduction","title":"Introduction","text":"

    Rotate game object continually with a steady speed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"rotate/#live-demos","title":"Live demos","text":"
    • Change speed
    "},{"location":"rotate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"rotate/#install-plugin","title":"Install plugin","text":""},{"location":"rotate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrotateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrotateplugin.min.js', true);\n
    • Add rotate behavior
      var rotate = scene.plugins.get('rexrotateplugin').add(gameObject, config);\n
    "},{"location":"rotate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RotatePlugin from 'phaser3-rex-plugins/plugins/rotate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRotate',\nplugin: RotatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add rotate behavior
      var rotate = scene.plugins.get('rexRotate').add(gameObject, config);\n
    "},{"location":"rotate/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Rotate from 'phaser3-rex-plugins/plugins/rotate.js';\n
    • Add rotate behavior
      var rotate = new Rotate(gameObject, config);\n
    "},{"location":"rotate/#create-instance","title":"Create instance","text":"
    var rotate = scene.plugins.get('rexRotate').add(gameObject, {\n// speed: 180,\n// enable: true,\n// timeScale: 1,\n});\n
    • speed : Turn speed, degrees in second
    "},{"location":"rotate/#enable","title":"Enable","text":"
    • Enable (default)
      rotate.setEnable();\n
      or
      rotate.enable = true;\n
    • Disable
      rotate.setEnable(false);\n
      or
      rotate.enable = false;\n
    "},{"location":"rotate/#set-speed","title":"Set speed","text":"
    rotate.setSpeed(speed);\n// rotate.speed = speed;\n
    • speed : Turn speed, degrees in second
    "},{"location":"rotate/#status","title":"Status","text":"
    • Is rotating
      var enable = rotate.enable;\n// var isRunning = rotate.isRunning;\n
    "},{"location":"rotateto/","title":"Rotate to","text":""},{"location":"rotateto/#introduction","title":"Introduction","text":"

    Rotate game object towards target position with a steady speed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"rotateto/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"rotateto/#install-plugin","title":"Install plugin","text":""},{"location":"rotateto/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrotatetoplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrotatetoplugin.min.js', true);\n
    • Add rotate-to behavior
      var rotateTo = scene.plugins.get('rexrotatetoplugin').add(gameObject, config);\n
    "},{"location":"rotateto/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RotateToPlugin from 'phaser3-rex-plugins/plugins/rotateto-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRotateTo',\nplugin: RotateToPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add rotate-to behavior
      var rotateTo = scene.plugins.get('rexRotateTo').add(gameObject, config);\n
    "},{"location":"rotateto/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RotateTo from 'phaser3-rex-plugins/plugins/rotateto.js';\n
    • Add rotate-to behavior
      var rotateTo = new RotateTo(gameObject, config);\n
    "},{"location":"rotateto/#create-instance","title":"Create instance","text":"
    var rotateTo = scene.plugins.get('rexRotateTo').add(gameObject, {\n// speed: 180,\n// enable: true,\n// timeScale: 1,\n});\n
    • speed : Turn speed, degrees in second
    "},{"location":"rotateto/#start-moving","title":"Start moving","text":""},{"location":"rotateto/#rotate-game-object-towards-position","title":"Rotate game object towards position","text":"
    • Shortest angle
      rotateTo.rotateTowardsPosition(x, y);\n
      • x , y : Target position
    • Clockwise/counter-clockwise
      rotateTo.rotateTowardsPosition(x, y, dir);\n// rotateTo.rotateTowardsPosition(x, y, dir, speed);\n
      • dir :
        • 0 : Shortest angle
        • 1, or 'cw' : Clockwise
        • 2, or 'ccw' : Counter-clockwise
      • speed : Turn speed, degrees in second
    "},{"location":"rotateto/#rotate-game-object-to-angle","title":"Rotate game object to angle","text":"
    • Shortest angle
      rotateTo.rotateTo(angle);\n
      • angle : Target angle in degrees
    • Clockwise/counter-clockwise
      rotateTo.rotateTo(angle, dir);\n// rotateTo.rotateTo(angle, dir, speed);\n
      • dir :
        • 0 : Shortest angle
        • 1, or cw : Clockwise
        • 2, or ccw : Counter-clockwise
      • speed : Turn speed, degrees in second
    "},{"location":"rotateto/#enable","title":"Enable","text":"
    • Enable (default)
      rotateTo.setEnable();\n
      or
      rotateTo.enable = true;\n
    • Disable
      rotateTo.setEnable(false);\n
      or
      rotateTo.enable = false;\n
    "},{"location":"rotateto/#pause-resume-stop-rotating","title":"Pause, Resume, stop rotating","text":"
    rotateTo.pause();\nrotateTo.resume();\nrotateTo.stop();\n
    "},{"location":"rotateto/#set-speed","title":"Set speed","text":"
    rotateTo.setSpeed(speed);\n// rotateTo.speed = speed;\n
    • speed : Turn speed, degrees in second
    "},{"location":"rotateto/#events","title":"Events","text":"
    • On rotating start
      rotateTo.on('start', function(gameObject, rotateTo){});\n
    • On reached target
      rotateTo.on('complete', function(gameObject, rotateTo){});\n
    "},{"location":"rotateto/#status","title":"Status","text":"
    • Is moving
      var isRunning = rotateTo.isRunning;\n
    "},{"location":"round-to/","title":"Round to","text":""},{"location":"round-to/#introduction","title":"Introduction","text":"

    Round/ceil/floor to the given precision, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"round-to/#usage","title":"Usage","text":""},{"location":"round-to/#round-to","title":"Round to","text":"

    var result = Phaser.Math.RoundTo(value);\n
    or
    var result = Phaser.Math.RoundTo(value, place, base);\n

    • value : The value to round.
    • place : The place to round to. Positive to round the units, negative to round the decimal. Default is 0.
    • base : The base to round in. Default is 10 for decimal.

    Examples

    RoundTo(123.456789, 0) = 123\nRoundTo(123.456789, -1) = 123.5\nRoundTo(123.456789, -2) = 123.46\nRoundTo(123.456789, -3) = 123.457\n
    "},{"location":"round-to/#ceil-to","title":"Ceil to","text":"

    var result = Phaser.Math.CeilTo(value);\n
    or
    var result = Phaser.Math.CeilTo(value, place, base);\n

    • value : The value to round.
    • place : The place to round to. Positive to round the units, negative to round the decimal. Default is 0.
    • base : The base to round in. Default is 10 for decimal.
    "},{"location":"round-to/#floor-to","title":"Floor to","text":"

    var result = Phaser.Math.floorTo(value);\n
    or
    var result = Phaser.Math.floorTo(value, place, base);\n

    • value : The value to round.
    • place : The place to round to. Positive to round the units, negative to round the decimal. Default is 0.
    • base : The base to round in. Default is 10 for decimal.
    "},{"location":"runcommands/","title":"Run commands","text":""},{"location":"runcommands/#introduction","title":"Introduction","text":"

    Run commands in array.

    • Author: Rex
    • Method only
    "},{"location":"runcommands/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"runcommands/#install-plugin","title":"Install plugin","text":""},{"location":"runcommands/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexruncommandsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexruncommandsplugin.min.js', true);\n
    • Run commands
      scene.plugins.get('rexruncommandsplugin').run(commands, scope);\n
    "},{"location":"runcommands/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RunCommandsPlugin from 'phaser3-rex-plugins/plugins/runcommands-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRunCommands',\nplugin: RunCommandsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Run commands
      scene.plugins.get('rexRunCommands').run(commands, scope);\n
    "},{"location":"runcommands/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RunCommands from 'phaser3-rex-plugins/plugins/runcommands.js';\n
    • Run commands
      RunCommands(commands, scope);\n
    "},{"location":"runcommands/#run-commands","title":"Run commands","text":"
    scene.plugins.get('rexRunCommands').run(commands, scope);\n
    • Format of command :
      [fnName, param0, param1, ...]\n
      or
      [callback, param0, param1, ...]\n
    • Commands in nested array :
      [\ncommand0,\ncommand1\n[\ncommand2,\ncommand3\n]\n]\n
    • Run command :
      scope[fnName].call(scope, param0, param1 ...)\n
      or
      callback.call(scope, param0, param1 ...)\n
    "},{"location":"scaledowndestroy/","title":"Scale down destroy","text":""},{"location":"scaledowndestroy/#introduction","title":"Introduction","text":"

    Scale down (i.e. ease scaleX, scaleY to 0) game object then destroy it.

    • Author: Rex
    • Method only
    "},{"location":"scaledowndestroy/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"scaledowndestroy/#install-plugin","title":"Install plugin","text":""},{"location":"scaledowndestroy/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexscaleplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscaleplugin.min.js', true);\n
    • Scale down, then destroy object
      scene.plugins.get('rexscaleplugin').scaleDownDestroy(gameObject, duration);\n
    "},{"location":"scaledowndestroy/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ScalePlugin from 'phaser3-rex-plugins/plugins/scale-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexScale',\nplugin: ScalePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Scale down, then destroy object
      scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration);\n
    "},{"location":"scaledowndestroy/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ScaleDownDestroy from 'phaser3-rex-plugins/plugins/scale-down-destroy.js';\n
    • Scale down, then destroy object
      ScaleDownDestroy(gameObject, duration);\n
    "},{"location":"scaledowndestroy/#scale-down","title":"Scale down","text":"
    • Scale down width and height
      var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration);\n// var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, undefined, ease);\n
      • ease : Ease function, default is 'Linear'.
    • Scale down width only
      var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, 'x');\n// var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, 'x', ease);\n
    • Scale down height only
      var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, 'y');\n// var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, 'y', ease);\n
    "},{"location":"scaledowndestroy/#events","title":"Events","text":"

    See Events of tween task

    • Scale completes or is stopped.
      scale.on('complete', function(gameObject, scale){\n\n}, scope);\n
    "},{"location":"scaledowndestroy/#inject-methods","title":"Inject methods","text":"
    • Inject methods into game object
      scene.plugins.get('rexScale').injectMethods(gameObject);\n
    • Inject methods into class of game object
      scene.plugins.get('rexScale').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexScale').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into class of game object
      scene.plugins.get('rexScale').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexScale').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into root class of game object
      scene.plugins.get('rexScale').injectMethodsToRootClass(e);\n// scene.plugins.get('rexScale').injectMethods(Phaser.GameObjects.GameObject.prototype);\n
    "},{"location":"scaledowndestroy/#injected-methods","title":"Injected methods","text":"
    • Scale up from 0 to current scale of game object.
      • Pop-up width and height
        gameObject\n//.setScale(scaleX, scaleY)\n.popUp(duration);\n\n// gameObject.popUp(duration, undefined, ease);\n
        or
        gameObject\n//.setScale(scaleX, scaleY)\n.popUpPromise(duration)\n.then(function() {\n// ....\n})\n
        • ease : Ease function, default is 'Cubic'.
      • Pop-up width only
        gameObject\n//.setScaleX(scaleX)\n.popUp(duration, 'x');\n\n// gameObject.popUp(duration, 'x', ease);\n
        or
        gameObject\n//.setScaleX(scaleX)\n.popUpPromise(duration, 'x')\n.then(function() {\n// ....\n})\n
      • Pop-up height only
        gameObject\n//.setScaleY(scaleY)\n.popUp(duration, 'y');\n\n// gameObject.popUp(duration, 'y', ease);\n
        or
        gameObject\n//.setScaleY(scaleY)\n.popUpPromise(duration, 'y')\n.then(function() {\n// ....\n})\n
      • Pop-up via config
        gameObject\n//.setScale(scaleX, scaleY)\n.popUp({\nduration: undefined,\norientation: undefined,\nease: undefined,\n})\n
        or
        gameObject\n//.setScale(scaleX, scaleY)\n.popUpPromise(config)\n.then(function() {\n// ....\n})\n
        • orientation : undefined, x, or y
    • Scale-down destroy
      • Scale-down width and height
        gameObject.scaleDownDestroy(duration);\n// gameObject.scaleDownDestroy(duration, undefined, ease);\n
        or
        gameObject.scaleDownDestroyPromise(duration)\n.then(function() {\n// ....\n})\n
        • ease : Ease function, default is 'Linear'.
      • Scale-down width only
        gameObject.scaleDownDestroy(duration, 'x');\n// gameObject.scaleDownDestroy(duration, 'x', ease);\n
        or
        gameObject.scaleDownDestroyPromise(duration, 'x');\n.then(function() {\n// ....\n})\n
      • Scale-down height only
        gameObject.scaleDownDestroy(duration, 'y');\n// gameObject.scaleDownDestroy(duration, 'y', ease);\n
        or
        gameObject.scaleDownDestroyPromise(duration, 'y')\n.then(function() {\n// ....\n})\n
    • Scale-down without destroy
      • Scale-down width and height
        gameObject.scaleDown(duration);\n// gameObject.scaleDown(duration, undefined, ease);\n
        or
        gameObject.scaleDownPromise(duration, undefined, ease)\n.then(function() {\n// ....\n})\n
      • Scale-down width only
        gameObject.scaleDowny(duration, 'x');\n// gameObject.scaleDowny(duration, 'x', ease);\n
        or
        gameObject.scaleDownPromise(duration, 'x', ease)\n.then(function() {\n// ....\n})\n
      • Scale-down height only
        gameObject.scaleDown(duration, 'y');\n// gameObject.scaleDown(duration, 'y', ease);\n
        or
        gameObject.scaleDownPromise(duration, 'y', ease)\n.then(function() {\n// ....\n})\n
    • Scale up/down, then scale back (yoyo)
      • Scale up/down, then scale back width and height
        gameObject\n//.setScale(scaleX, scaleY)\n.scaleYoyo(duration, peakValue);\n\n// gameObject.scaleYoyo(duration, peakValue, repeat, undefined, ease);\n
        or
        gameObject\n//.setScale(scaleX, scaleY)\n.scaleYoyoPromise(duration, peakValue, repeat)\n.then(function() {\n// ....\n})\n
        • peakValue : Scale to this peak value, then scale back
        • repeat : Yoyo repeat, default value is 0.
        • ease : Ease function, default is 'Cubic'.
      • Scale up/down, then scale back width only
        gameObject\n//.setScaleX(scaleX)\n.scaleYoyo(duration, peakValue, 0, 'x');\n\n// gameObject.popUp(duration, peakValue, repeat, 'x', ease);\n
        or
        gameObject\n//.setScaleX(scaleX)\n.scaleYoyoPromise(duration, peakValue, repeat, 'x')\n.then(function() {\n// ....\n})\n
      • Scale up/down, then scale back height only
        gameObject\n//.setScaleY(scaleY)\n.scaleYoyo(duration, peakValue, 0, 'y');\n\n// gameObject.popUp(duration, peakValue, repeat, 'y', ease);\n
        or
        gameObject\n//.setScaleY(scaleY)\n.scaleYoyoPromise(duration, peakValue, repeat, 'y')\n.then(function() {\n// ....\n})\n
      • Scale up/down via config
        gameObject\n//.setScale(scaleX, scaleY)\n.scaleYoyo({\nduration: undefined,\npeakValue: 1.2,\nrepeat: 0,\norientation: undefined,\nease: undefined,\n})\n
        or
        gameObject\n//.setScale(scaleX, scaleY)\n.scaleYoyoPromise(config)\n.then(function() {\n// ....\n})\n
        • orientation : undefined, x, or y
    • Events
      • Pop-up complete
        gameObject.on('popup.complete', function(gameObject) { });\n
      • Scale-down, scale-down destroy complete
        gameObject.on('scaledown.complete', function(gameObject) { });\n
      • Scale up/down, then scale back (yoyo)
        gameObject.on('scaleyoyo.complete', function(gameObject) { });\n
    "},{"location":"scalemanager/","title":"Scale manager","text":""},{"location":"scalemanager/#introduction","title":"Introduction","text":"

    Scale game window, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"scalemanager/#usage","title":"Usage","text":""},{"location":"scalemanager/#setup","title":"Setup","text":"

    Setup scale mode in game configuration.

    var config = {\n// ...\nparent: divId,\n\n// Game size\nwidth: 1024,\nheight: 768,\n\nscale: {\n// Or set parent divId here\nparent: divId,\n\nmode: Phaser.Scale.FIT,\nautoCenter: Phaser.Scale.CENTER_BOTH,\n\n// Or put game size here\n// width: 1024,\n// height: 768,\n\n// Minimum size\nmin: {\nwidth: 800,\nheight: 600\n},\n// Or set minimum size like these\n// minWidth: 800,\n// minHeight: 600,\n\n// Maximum size\nmax: {\nwidth: 1600,\nheight: 1200\n},\n// Or set maximum size like these\n// maxWidth: 1600,\n// maxHeight: 1200,\n\nzoom: 1,  // Size of game canvas = game size * zoom\n},\nautoRound: false\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • scale.mode :
      • Phaser.Scale.NONE : No scaling happens at all.
      • Phaser.Scale.FIT : The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered.
      • Phaser.Scale.ENVELOP : The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size.
      • Phaser.Scale.WIDTH_CONTROLS_HEIGHT : The height is automatically adjusted based on the width.
      • Phaser.Scale.HEIGHT_CONTROLS_WIDTH : The width is automatically adjusted based on the height.
      • Phaser.Scale.EXPAND : The Canvas's visible area is resized to fit all available parent space like RESIZE mode, and scale canvas size to fit inside the visible area like FIT mode.
      • Phaser.Scale.RESIZE : The Canvas is resized to fit all available parent space, regardless of aspect ratio.
    • scale.autoCenter :
      • Phaser.Scale.NO_CENTER : The game canvas is not centered within the parent by Phaser.
      • Phaser.Scale.CENTER_BOTH : The game canvas is centered both horizontally and vertically within the parent.
      • Phaser.Scale.CENTER_HORIZONTALLY : The game canvas is centered horizontally within the parent.
      • Phaser.Scale.CENTER_VERTICALLY : The game canvas is centered both vertically within the parent.
    "},{"location":"scalemanager/#resize-canvas-element","title":"Resize canvas element","text":"
    scene.scale.resize(width, height);\n

    Modify the size of the Phaser canvas element directly. You should only use this if you are using the NO_SCALE scale mode,

    "},{"location":"scalemanager/#set-game-size","title":"Set game size","text":"
    scene.scale.setGameSize(width, height);\n

    It should only be used if you're looking to change the base size of your game and are using one of the Scale Manager scaling modes, i.e. FIT. If you're using NO_SCALE and wish to change the game and canvas size directly, then please use the resize method instead.

    "},{"location":"scalemanager/#get-view-port","title":"Get view port","text":"
    var viewport = scene.scale.getViewPort();\n// var viewport = scene.scale.getViewPort(camera, out);\n
    • viewport : The Rectangle of visible area.
    • camera : The camera this viewport is respond upon.
    • out : The Rectangle of visible area.
    "},{"location":"scalemanager/#members","title":"Members","text":"
    • The un-modified game size, as requested in the game config (the raw width / height), as used for world bounds, cameras, etc
      var gameSize = scene.scale.gameSize;\n
      • gameSize.width, gameSize.height
    • The modified game size, which is the auto-rounded gameSize, used to set the canvas width and height (but not the CSS style)
      var baseSize = scene.scale.baseSize;\n
      • baseSize.width, baseSize.height
    • The size used for the canvas style, factoring in the scale mode, parent and other values.
      var displaySize = scene.scale.displaySize;\n
      • displaySize.width, displaySize.height
    • The size of parent dom element
      var parentSize = scene.scale.parentSize;\n
      • parentSize.width, parentSize.height
    "},{"location":"scalemanager/#events","title":"Events","text":"
    scene.scale.on('resize', function(gameSize, baseSize, displaySize, previousWidth, previousHeight) {});\n
    • gameSize : The un-modified game size, as requested in the game config (the raw width / height)
      • gameSize.width, gameSize.height
    • baseSize : The canvas width and height (actually size of canvas)
      • baseSize.width, baseSize.height
    • displaySize : Size used for the canvas style (display size of canvas)
      • displaySize.width, displaySize.height
    "},{"location":"scalemanager/#update-bounds","title":"Update bounds","text":"

    This method dose not have to be invoked, unless the canvas position, or visibility is changed via any other method (i.e. via an Angular route).

    scene.scale.updateBounds();\n
    "},{"location":"scalemanager/#full-screen","title":"Full screen","text":"

    Under 'pointerup' touch event :

    • Start full screen
      scene.scale.startFullscreen();\n
    • Stop full screen
      scene.scale.stopFullscreen();\n
    • Toggle full screen
      scene.scale.toggleFullscreen();\n
    • Is full screen
      var isFullscreen = scene.scale.isFullscreen;\n

    Games within an iframe will also be blocked from fullscreen unless the iframe has the allowfullscreen attribute.

    Performing an action that navigates to another page, or opens another tab, will automatically cancel fullscreen mode, as will the user pressing the ESC key.

    "},{"location":"scalemanager/#events_1","title":"Events","text":"
    • Enter full screen
      scene.scale.on('enterfullscreen', function() {}, scope);\n
    • Enter full screen failed
      scene.scale.on('fullscreenfailed', function(error) {}, scope);\n
    • Leave full screen
      scene.scale.on('leavefullscreen', function() {}, scope);\n
    • Full screen unsupport
      scene.scale.on('fullscreenunsupported', function() {}, scope);\n
    • Leave full screen
      scene.scale.on('leavefullscreen', function() {}, scope);\n
    "},{"location":"scalemanager/#orientation","title":"Orientation","text":""},{"location":"scalemanager/#properties","title":"Properties","text":"
    • Is portrait orientation
      var isPortrait = scene.scale.isPortrait;\n
    • Is landscape orientation
      var isLandscape = scene.scale.isLandscape;\n
    "},{"location":"scalemanager/#lock-orientation","title":"Lock orientation","text":"
    scene.scale.lockOrientation(orientation);\n
    • orientation : 'landscape', or 'portrait';
    "},{"location":"scalemanager/#events_2","title":"Events","text":"
    scene.scale.on('orientationchange', function(orientation) {\nif (orientation === Phaser.Scale.PORTRAIT) {\n\n} else if (orientation === Phaser.Scale.LANDSCAPE) {\n\n}\n}, scope);\n
    "},{"location":"scaleouter/","title":"Scale outer","text":""},{"location":"scaleouter/#introduction","title":"Introduction","text":"

    Scroll and zoom camera to make default game window fit the display area, in RESIZE scale mode.

    • Author: Rex
    • Member of scene
    "},{"location":"scaleouter/#live-demos","title":"Live demos","text":"
    • Viewport
    • Static camera
    • Tween camera
    "},{"location":"scaleouter/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"scaleouter/#install-plugin","title":"Install plugin","text":""},{"location":"scaleouter/#set-scale-mode-to-resize","title":"Set scale mode to RESIZE","text":"
    var config = {\n// ...\nscale: {\nparent: divId,\nmode: Phaser.Scale.RESIZE,\nwidth: 1024,    // Default game window width\nheight: 768,    // Default game window height\n// ...\n}\n}\nvar game = new Phaser.Game(config);\n
    "},{"location":"scaleouter/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexscaleouterplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscaleouterplugin.min.js', 'rexScaleOuter', 'rexScaleOuter');\n
    • Scale outer is created as a member of scene (scene.rexScaleOuter) for each scene. It will control main camera (scene.cameras.main) by default.
    "},{"location":"scaleouter/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install scene plugin in configuration of game
      import ScaleOuterPlugin from 'phaser3-rex-plugins/plugins/scaleouter-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexScaleOuter',\nplugin: ScaleOuterPlugin,\nmapping: 'rexScaleOuter'\n}]\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Scale outer is created as a member of scene (scene.rexScaleOuter) for each scene. It will control main camera (scene.cameras.main) by default.
    "},{"location":"scaleouter/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ScaleOuter from 'phaser3-rex-plugins/plugins/scaleouter.js';\n
    • Add scaleouter object
      var scaleouter = new ScaleOuter(scene);\n
    "},{"location":"scaleouter/#create-instance","title":"Create instance","text":"

    ScaleOuter plugin is a scene plugin, which created as a member of scene (scene.rexScaleOuter) for each scene. It does not have to create other scale outer instance.

    "},{"location":"scaleouter/#remove-instance","title":"Remove instance","text":"

    Invoke scene.rexScaleOuter.destroy() under scene.create() { ... }.

    "},{"location":"scaleouter/#add-camera","title":"Add camera","text":"
    • Add camera manually, under scene.create() { ... }
      scene.rexScaleOuter.add(camera);\n
    • Scale outer will control main camera (scene.cameras.main) if no camera added.
    "},{"location":"scaleouter/#viewport","title":"Viewport","text":"
    • Inner viewport, a recangle object, for area of default size in game config after camera zoom/scroll.
      var innerViewport = scene.rexScaleOuter.innerViewport;\n
    • Outer viewport, a recangle object, for the visible area after camera zoom/scroll.
      var outerViewport = scene.rexScaleOuter.outerViewport;\n
    "},{"location":"scaleouter/#manual-scale","title":"Manual scale","text":"
    1. Stop resize callback
      scene.rexScaleOuter.stop()\n
    2. Manual scale
      scene.rexScaleOuter.scale();\n
    "},{"location":"scene/","title":"Scene","text":""},{"location":"scene/#define-a-scene","title":"Define a scene","text":""},{"location":"scene/#configuration-of-scene","title":"Configuration of scene","text":"
    var config = {\nkey: \"\",\n// active: false,\n// visible: true,\n// pack: false,\n// cameras: null,\n// map: {},\n// physics: {},\n// loader: {},\n// plugins: false,\n// input: {}\n};\n
    • key : The unique key of this Scene. Must be unique within the entire Game instance.
    • active : Does the Scene start as active or not? An active Scene updates each step.
    • visible : Does the Scene start as visible or not? A visible Scene renders each step.
    • pack : An optional Loader Packfile to be loaded before the Scene begins.
    • cameras : An optional Camera configuration object.
      {\nname: '',\nx: 0,\ny: 0,\nwidth: scene.sys.scale.width,\nheight: scene.sys.scale.height,\nzoom: 1,\nrotation: 0,\nscrollX: 0,\nscrollY: 0,\nroundPixels: false,\nvisible: true,\nbackgroundColor: false,\nbounds: null, // {x, y, width, height}\n}\n
    • map : Overwrites the default injection map for a scene.
    • physics : The physics configuration object for the Scene.
      {\ndefault: 'arcade', // 'arcade', or 'matter'\narcade: {...},\nmatter: {...}\n}\n
    • arcade : Arcade Physics configuration.
    • matter : Matter Physics configuration.
    • loader : The loader configuration object for the Scene.
      {\nbaseURL: '',\npath: '',\nenableParallel: true,\nmaxParallelDownloads: 4,\ncrossOrigin: undefined,\nresponseType: '',\nasync: true,\nuser: '',\npassword: '',\ntimeout: 0\n}\n
    • plugins : The plugin configuration object for the Scene.
      {\nglobal: [\n//{key, plugin, start}\n],\nscene: [\n// ...\n]\n}\n
    • input : The input configuration object for the Scene.
      {\nkeyboard: {\ntarget: window\n},\nmouse: {\ntarget: null,\ncapture: true\n},\nactivePointers: 1,\ntouch: {\ntarget: null,\ncapture: true\n},\nsmoothFactor: 0,\ngamepad: false,\nwindowEvents: true,\n}\n
    "},{"location":"scene/#es6-class","title":"ES6 class","text":"
    class MyScene extends Phaser.Scene {\nconstructor(config) {\nsuper(config);\n}\n\ninit(data) {}\npreload() {}\ncreate(data) {}\nupdate(time, delta) {}\n}\n
    • data : Parameters passed from adding new scene, or starting scene
    "},{"location":"scene/#class","title":"Class","text":"
    var MyScene = new Phaser.Class({\nExtends: Phaser.Scene,\n\ninitialize: function MyScene(config) {\nPhaser.Scene.call(this, config);\n},\n\ninit: function (data) {},\npreload: function () {},\ncreate: function (data) {},\nupdate: function (time, delta) {},\n});\n
    • data : Parameters passed from adding new scene, or starting scene
    var MyGame = {};\n\nMyGame.Boot = function () {};\n\nMyGame.Boot.prototype.constructor = MyGame.Boot;\n\nMyGame.Boot.prototype = {\ninit: function (data) {},\npreload: function () {},\ncreate: function (data) {},\nupdate: function (time, delta) {},\n};\n
    • data : Parameters passed from adding new scene, or starting scene
    "},{"location":"scene/#override","title":"Override","text":"
    var demo = new Phaser.Scene(\"Demo\");\n\ndemo.init = function (data) {};\ndemo.preload = function () {};\ndemo.create = function (data) {};\ndemo.update = function (time, delta) {};\n
    • data : Parameters passed from adding new scene, or starting scene
    "},{"location":"scene/#flow-chart","title":"Flow chart","text":"
    graph TB\n\nsubgraph Stop\nSceneEventDestroy>\"scene.events: destroy\"]\nShutdown[\"Shutdown<br>Free game objects\"]\nend\n\nsubgraph Update\nSceneUpdate[\"Run: Every tick<br>scene.update()\"]\nSceneEventPauseSleep>\"scene.events: pause<br>scene.events: sleep\"]\nPause[\"Pause: render but no update<br>Sleep: no update, no render\"]\nSceneEventResumeWake>\"scene.events: resume<br>scene.events: wake\"]\nend\n\nsubgraph Create\nSceneEventStart>\"scene.events: start\"]\nSceneEventReady>\"scene.events: ready\"]\nSceneInit[\"scene.init()\"]\nScenePreLoad[\"Load assets<br>scene.preload()\"]\nSceneCreate[\"Create game objects<br>scene.create()\"]\nend\n\nStart((Start)) --> SceneEventStart\nSceneEventStart --> SceneEventReady\nSceneEventReady --> SceneInit\nSceneInit --> ScenePreLoad\nScenePreLoad --> SceneCreate\nSceneCreate --> SceneUpdate\nSceneUpdate --> SceneUpdate\nSceneUpdate --> |\"scene.scene.pause()<br>scene.scene.sleep()\"|SceneEventPauseSleep\nSceneEventPauseSleep --> Pause\nPause --> |\"scene.scene.resume()<br>scene.scene.wake()\"|SceneEventResumeWake\nSceneEventResumeWake --> SceneUpdate\n\nSceneUpdate --> |\"scene.scene.stop()<br>scene.scene.restart()\"|Stop\nPause --> |\"scene.scene.stop()<br>scene.scene.restart()\"|SceneEventDestroy\nSceneEventDestroy --> Shutdown\n\nShutdown --> |\"scene.scene.start()<br>scene.scene.launch()<br>scene.scene.restart()\"|SceneEventStart
    • Run : Update and render
    • Pause : Render but no update
    • Sleep : No update, no render
    • Stop : Shutdown

    See also

    • Pause/resume
    • Stop
    • Main loop
    "},{"location":"scene/#start","title":"Start","text":"
    1. Invoke scene.preload()
    2. Invoke scene.create()

    scene.scene.restart() is equal to

    scene.scene.stop();\nscene.scene.start();\n
    "},{"location":"scene/#stop","title":"Stop","text":"
    • All game objects will be destroyed.
    • Registered events on game objects will also be clear, too.
    • Touch, keyboard and GamePad events will be clear.
    • Cameras will be destroyed.
    • Loader will be stopped.
    • Assets will be stored in global cache.
    • Events registered on scene plugin (scene.events.on) won't be clear.
    "},{"location":"scene/#members","title":"Members","text":"
    • plugins
    • load : Loader
    • events : Local events
    • input : Touch, keyboard
    • tweens : Tween tasks
    • time : Timer
    • cameras : Camera
    • scene : scenePlugin
    • anims
    • physics : ArcadePhysics
    • matter :\u3000 MatterPhysics
    • registry : Global data manager across all scenes
      scene.registry.set(key, value);\nvar value = scene.registry.get(key);\n
    • data : Local data manager
      scene.data.set(key, value);\nvar value = scene.data.get(key);\n
    • sys
    • game
    • render
    • cache
    • sound
    • textures
    • add
    • make
    • children : DisplayList
      scene.children.bringToTop(child);\nscene.children.sendToBack(child);\nscene.children.moveUp(child);\nscene.children.moveDown(child);\nscene.children.moveUp(child);\nscene.children.moveTo(child, index);\nscene.children.moveAbove(child1, child2); // Move child1 above child2\nscene.children.moveBelow(child1, child2); // Move child1 below child2\nscene.children.swap(child1, child2);\n
    • lights

    Preserve word in a scene.

    "},{"location":"scene/#events","title":"Events","text":"
    • Start (Before scene.init())
      scene.events.on(\"start\", function () {});\n
    • Ready (After start)
      scene.events.on(\"ready\", function () {});\n
    • Every tick
      • Preupdate
        scene.events.on(\"preupdate\", function (time, delta) {});\n
      • Update
        scene.events.on(\"update\", function (time, delta) {});\n
      • Postupdate
        scene.events.on(\"postupdate\", function (time, delta) {});\n
      • Render
        scene.events.on(\"render\", function () {});\n
    • State changed
      • Pause (from scene.scene.pause())
        scene.events.on(\"pause\", function () {});\n
      • Resume (from scene.scene.resume())
        scene.events.on(\"resume\", function () {});\n
      • Sleep (from scene.scene.sleep())
        scene.events.on(\"sleep\", function () {});\n
      • Wake (from scene.scene.wake())
        scene.events.on(\"wake\", function () {});\n
      • Stop/shutdown (from scene.scene.stop())
        scene.events.on(\"shutdown\", function () {});\n
        • Free-up any resources that may be in use by this scene
    • Destroy (from scene.scene.remove())
      scene.events.on(\"destroy\", function () {});\n
    • Boot
      scene.events.on(\"boot\", function () {});\n
    • Game object added to scene
      • Add
        scene.events.on(\"addedtoscene\", function (gameObject, scene) {});\n
      • Remove
        scene.events.on(\"removedfromscene\", function (gameObject, scene) {});\n
    "},{"location":"scenemanager/","title":"Scene manager","text":"

    Scene manager plugin:

    • In each scene instance: scene.scene
    "},{"location":"scenemanager/#add-new-scene","title":"Add new scene","text":"
    var newScene = scene.scene.add(key, sceneConfig, autoStart, data);\n// var newScene = game.scene.add(key, sceneConfig, autoStart, data);\n
    • key : A unique key used to reference the Scene.
    • sceneConfig :
      • A scene class
      • A plain object
        {\ninit(data) {},\npreload() {},\ncreate(data) {},\nupdate(time, delta) {},\n\nextend: {\ndata: {},\n// ...\n},\n}\n
    • autoStart : Set true to start scene immediately after added.
    • data : Optional data object. This will be set as scene.settings.data and passed to scene.init.
    "},{"location":"scenemanager/#load-scene-from-external-files","title":"Load scene from external files","text":"
    1. load script
      scene.load.script(key, url);\n
    2. add new scene
      scene.scene.add(key, sceneConfig, autoStart);\n// game.scene.add(key, sceneConfig, autoStart);\n
    "},{"location":"scenemanager/#destroy-scene","title":"Destroy scene","text":"
    scene.scene.remove(key);\n
    • Fires scene.events destroy
    "},{"location":"scenemanager/#start-scene","title":"Start scene","text":"
    • Launch the given Scene and run it in parallel with this one
      scene.scene.launch(key, data);\n
    • Shutdown this Scene and run the given one
      scene.scene.start(key, data);\n
    • Restarts this Scene
      scene.scene.restart(data);\n
    "},{"location":"scenemanager/#pauseresume-scene","title":"Pause/Resume scene","text":"
    • Pause : stops the update step but still renders
      scene.scene.pause(key);\n// scene.scene.pause();  // pause myself\n
      • Fires scene.events pause
    • Resume : starts the update loop again
      scene.scene.resume(key);\n// scene.scene.resume();  // resume myself\n
      • Fires scene.events resume
    • Sleep : no update, no render but doesn't shutdown
      scene.scene.sleep(key);\n// scene.scene.sleep();  // sleep myself\n
      • Fires scene.events sleep
    • Wake-up: starts update and render
      scene.scene.wake(key);\n// scene.scene.wake();  // wake-up myself\n
      • Fires scene.events wake
    • Makes this Scene sleep then starts the Scene given
      scene.scene.switch(key, data);\n
    "},{"location":"scenemanager/#run-scene","title":"Run scene","text":"

    Runs the given Scene, but does not change the state of this Scene.

    If the given Scene is paused, it will resume it. If sleeping, it will wake it. If not running at all, it will be started.

    scene.scene.run(key, data);\n
    "},{"location":"scenemanager/#stop-scene","title":"Stop scene","text":"

    Shutdown the Scene, clearing display list, timers, etc.

    scene.scene.stop(key);\n// scene.scene.stop();  // stop myself\n
    "},{"location":"scenemanager/#set-visible","title":"Set visible","text":"
    scene.scene.setVisible(value, key);  // value: true/false\n// scene.scene.setVisible(value);    // set visible to myself\n
    "},{"location":"scenemanager/#read-status","title":"Read status","text":"
    var isSleep = scene.scene.isSleeping(key);\n// var isSleep = scene.scene.isSleeping();\n
    var isPaused = scene.scene.isPaused(key);\n// var isPaused = scene.scene.isPaused();\n
    var isActive = scene.scene.isActive(key);\n// var isActive = scene.scene.isActive();\n
    var isVisible = scene.scene.isVisible(key);\n// var isVisible = scene.scene.isVisible();\n
    Update/isActive Render/isVisible Run Pause Sleep

    Pause/Sleep/Stop

    • Pause: Pause update stage.
    • Sleep: Pause update stage, and set scene invisible.
    • Stop: Shoutdown, clearing display list, timers, etc.
    var status = scene.scene.getStatus(key);\n// var status = scene.scene.getStatus();\n
    • status :
      • Phaser.Scenes.PENDING, or 0
      • Phaser.Scenes.INIT, or 1
      • Phaser.Scenes.START, or 2
      • Phaser.Scenes.LOADING, or 3
      • Phaser.Scenes.CREATING, or 4
      • Phaser.Scenes.RUNNING, or 5
      • Phaser.Scenes.PAUSED, or 6
      • Phaser.Scenes.SLEEPING, or 7
      • Phaser.Scenes.SHUTDOWN, or 8
      • Phaser.Scenes.DESTROYED, or 9
    "},{"location":"scenemanager/#get-scene","title":"Get scene","text":"
    var scene = scene.scene.get(key);\n
    "},{"location":"scenemanager/#order-of-scenes","title":"Order of scenes","text":"

    Swaps the position of two scenes in the Scenes list.

    scene.scene.swapPosition(keyA, keyB);\n// scene.scene.stop(keyA);\n
    scene.scene.moveAbove(keyA, keyB);\n// scene.scene.moveAbove(keyA);\n

    Scene B is directly above Scene A.

    scene.scene.moveBelow(keyA, keyB);\n// scene.scene.moveBelow(keyA);\n

    Scene B is directly below Scene A.

    scene.scene.moveUp(keyA);\n// scene.scene.moveBelow();\n
    scene.scene.moveDown(keyA);\n// scene.scene.moveDown();\n
    scene.scene.bringToTop(keyA);\n// scene.scene.bringToTop();\n
    scene.scene.sendToBack(keyA);\n// scene.scene.sendToBack();\n
    "},{"location":"scenemanager/#transition","title":"Transition","text":"
    scene.scene.transition({\ntarget: key,\n// data: null,\n// moveAbove: false,\n// moveBelow: false,\n\nduration: 1000,\n\n// remove: false,\n// sleep: false,\n// allowInput: false,\n\n// onStart: null,\n// onStartScope: scene,\n\n// onUpdate: null,\n// onUpdateScope: scene,\n})\n
    • target : The Scene key to transition to.
    • data : An object containing any data you wish to be passed to the target scenes init / create methods.
    • moveAbove. moveBelow : Move the target Scene to be above/below this current scene before the transition starts.
    • duration : Transition duration, in ms.
    • remove : Set true to remove this scene.
    • sleep : Set true to sleep this scene, set false to stop this scene.
    • allowInput : Set true to enable input system of current scene and target scene.
    • onStart, onStartScope : Invoked when transition start
      function(fromScene, toScene, duration) {\n\n}\n
      • fromScene : Current scene instance
      • toScene : Target scene instance
      • duration : Transition duration, in ms.
    • onUpdate ,onUpdateScope : Transition callback in each tick.
      function(progress) {\n\n}\n
      • progress : 0 ~ 1
    "},{"location":"scenemanager/#execution-flow","title":"Execution flow","text":"
    1. Invoke scene.scene.transition method.
      • Current scene :
        • Fire 'transitionout' event.
          fromScene.events.on('transitionout', function(targetScene, duration){ });\n
        • Run transition's onUpdate callback every tick.
        • Current scene's update method is still running every tick.
      • Target scene :
        • Start target scene immediately.
        • Fire target scene's 'transitionstart' event. (Register this event in create stage)
          targetScene.events.on('transitionstart', function(fromScene, duration){ });\n
    2. When transition completed.
      • Current scene :
        • Remove or sleep current scene after transition completed.
      • Target scene :
        • Fire target scene's transitioncomplete event.
          targetScene.events.on('transitioncomplete', function(fromScene){ });\n
    "},{"location":"scenemanager/#events","title":"Events","text":"
    • boot
      scene.events.on('transitioninit', function(fromScene, duration)){ });\n
    • start
      scene.events.on('transitionstart', function(fromScene, duration){ });\n
    • transition-out
      scene.events.on('transitionout', function(targetScene){ });\n
    • complete
      scene.events.on('transitioncomplete', function(fromScene){ });\n
    • wake : wake-up target scene if it was previously asleep
      scene.events.on('transitionwake', function(fromScene, duration){ });\n
    "},{"location":"scenemanager/#system-scene","title":"System scene","text":"

    A default empty Scene that lives outside of the Scene list, but can be used by plugins and managers that need access to a live Scene, without being tied to one.

    var scene = scene.scene.get('__SYSTEM');\n

    or

    var scene = scene.scene.systemScene;\n
    "},{"location":"scripttagloader/","title":"Script tag loader","text":""},{"location":"scripttagloader/#introduction","title":"Introduction","text":"

    Load script tag in preload stage.

    • Author: Rex
    • Custom File of loader
    "},{"location":"scripttagloader/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"scripttagloader/#install-plugin","title":"Install plugin","text":""},{"location":"scripttagloader/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      var sceneConfig = {\n// ....\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'rexscripttagloaderplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscripttagloaderplugin.min.js',\nstart: true\n}]\n}\n};\nclass MyScene extends Phaser.Scene {\nconstructor() {\nsuper(sceneConfig)\n}\n// ....\n\npreload() {\n// rexscripttagloaderplugin will be installed before preload(), but not added to loader yet\n// Call addToScene(scene) to add this await loader to loader of this scene\nthis.plugins.get('rexscripttagloaderplugin').addToScene(this);\n\nthis.load.rexScriptTag(url);\n}\n}\n
    "},{"location":"scripttagloader/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ScriptTagLoaderPlugin from 'phaser3-rex-plugins/plugins/scripttagloader-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexScriptTagLoader',\nplugin: ScriptTagLoaderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In preload stage
      scene.load.rexScriptTag(url);\n
    "},{"location":"scripttagloader/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ScriptTagLoader from 'phaser3-rex-plugins/plugins/scripttagloader.js';\n
    • Start loading task
      ScriptTagLoader.call(scene.load, url);\n// ScriptTagLoader.call(scene.load, url, availableTest);\n
    "},{"location":"scripttagloader/#load-script-tag","title":"Load script tag","text":"

    In preload stage:

    this.load.rexScriptTag(url);\n// this.load.rexScriptTag(url, availableTest);\n

    or

    this.load.rexScriptTag({\nurl: url,\navailableTest: undefined\n});\n
    • availableTest : Callback invoked after loading script tag, optional.
      function() {        return true;\n}\n
      • Wait until availableTest return true.
    "},{"location":"scripttagloader/#compare-with-script-loader","title":"Compare with script loader","text":"
    • Built-in script loader uses AJAX to load text as script, which might have CORS issue.
    • Script tag loader uses <script> tag to load script.
    "},{"location":"scroller/","title":"Scroller","text":""},{"location":"scroller/#introduction","title":"Introduction","text":"

    Drag content. Slow down when dragging released, pull back when out of bounds.

    • Author: Rex
    • Behavior of game object
    "},{"location":"scroller/#live-demos","title":"Live demos","text":"
    • Scroller
    "},{"location":"scroller/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"scroller/#install-plugin","title":"Install plugin","text":""},{"location":"scroller/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexscrollerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscrollerplugin.min.js', true);\n
    • Add scroller behavior
      var scroller = scene.plugins.get('rexscrollerplugin').add(gameObject, config);\n
    "},{"location":"scroller/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ScrollerPlugin from 'phaser3-rex-plugins/plugins/scroller-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexScroller',\nplugin: ScrollerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add scroller behavior
      var scroller = scene.plugins.get('rexScroller').add(gameObject, config);\n
    "},{"location":"scroller/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Scroller from 'phaser3-rex-plugins/plugins/scroller.js';\n
    • Add scroller behavior
      var scroller = new Scroller(gameObject, config);\n
    "},{"location":"scroller/#create-instance","title":"Create instance","text":"
    var scroller = scene.plugins.get('rexScroller').add(gameObject, {\nbounds: [\nbottomBound,\ntopBound\n],\nvalue: topBound,    // threshold: 10,\n// slidingDeceleration: 5000,\n// backDeceleration: 2000,\n\n// dragReverse: false,\n// dragRate: 1,\n\n// enable: true,\n// orientation: 'vertical',\n// pointerOutRelease: true,\n// rectBoundsInteractive: false,\n\n// valuechangeCallback: null,\n// valuechangeCallbackScope: null,\n\n// overmaxCallback: null,\n// overmaxCallbackScope: null,\n\n// overminCallback: null,\n// overminCallbackScope: null,\n});\n
    • bounds : An array of 2 values [bound0, bound1]
    • value : Initial value between bound0 and bound1
      • Map this value to position of content under event 'valuechange'
    • threshold : Minimal movement to scroll. Set 0 to scroll immediately.
    • slidingDeceleration : Deceleration of slow down when dragging released.
      • Set false to disable it.
    • backDeceleration : Deceleration of pull back when out of bounds.
      • Set false to disable it.
    • dragReverse :
      • false : Dragging up will decrease value, dragging down will increase value. Default behavior.
        • Use this mode when scrolling by position of game object.
      • true : Dragging up will increase value, dragging down will decrease value.
        • Use this mode when scrolling by camera.
    • dragRate : Rate of dragging distance/dragging speed. Default value is 1.
    • enable : Set true to get dragging events.
    • orientation :
      • 'vertical','v', 'y', or 0 : dragging on vertical/y axis.
      • 'horizontal','h', 'x', or 1 : dragging on horizontal/x axis.
    • pointerOutRelease : Set to true to release input control when pointer out of gameObject. Default value is true.
    • rectBoundsInteractive :
      • false : Detect scrolling by game object's touch input. Default behavior.
      • true : Detect scrolling by rectangle bounds of game object.
    • valuechangeCallback , valuechangeCallbackScope : Bind this callback to valuechange event
    • overminCallback , overmaxCallbackScope : Bind this callback to overmax event
    • overminCallback , overminCallbackScope : Bind this callback to overmin event
    "},{"location":"scroller/#set-bounds","title":"Set bounds","text":"
    this.setBounds(bounds);  // bounds: [bound0, bound1]\n// this.setBounds(bound0, bound1);\n
    "},{"location":"scroller/#set-deceleration","title":"Set deceleration","text":"
    • Deceleration of slow down when dragging released
      scroller.setSlidingDeceleration(dec);\n
      • Disable
        scroller.setSlidingDeceleration(false);\n
    • Deceleration of pull back when out of bounds
      scroller.setBackDeceleration(dec);\n
      • Disable
        scroller.setBackDeceleration(false);\n
    "},{"location":"scroller/#get-value","title":"Get value","text":"
    var value = scroller.value;\n
    "},{"location":"scroller/#set-value","title":"Set value","text":"
    • Set value
      scroller.value = newValue;\n// scroller.setValue(newValue);\n
    • Set value, clamp between minValue and maxValue
      scroller.setValue(newValue, true);\n
    • Add value
      scroller.value += inc;\n// scroller.addValue(inc);\n
    • Add value, clamp between minValue and maxValue
      scroller.addValue(inc, true);\n

    Fires valuechange event if new value is not equal to current value.

    "},{"location":"scroller/#events","title":"Events","text":"
    • Value changed
      scroller.on('valuechange', function(newValue, prevValue){ /* ... */ });\n
      • Set position of content under this event
    • Value out of max/min bound
      scroller.on('overmax', function(newValue, prevValue){ /* ... */ });\n
      scroller.on('overmin', function(newValue, prevValue){ /* ... */ });\n
    • On drag start
      scroller.on('dragstart', function() { /* ... */ });\n
    • On drag end
      scroller.on('dragend', function() { /* ... */ });\n
    "},{"location":"scroller/#drag","title":"Drag","text":""},{"location":"scroller/#drag-enable","title":"Drag enable","text":"
    • Get
      var enable = scroller.enable;\n
    • Set
      scroller.setEnable();\n// scroller.setEnable(enable);  // enable: true, or false\n
      or
      scroller.enable = enable; // enable: true, or false\n
    • Toggle
      scroller.toggleEnable();\n
    "},{"location":"scroller/#is-dragging","title":"Is dragging","text":"
    var isDragging = scroller.isDragging;\n
    "},{"location":"scroller/#state-machine","title":"State machine","text":"
    graph TB\n\nIDLE[\"Idle\"] --> |Drag| DRAG[\"Dragging<br>event 'valuechange'\"]\nDRAG --> |Release| OnRelease{\"Under bounds?\"}\n\nOnRelease --> |Yes| SLIDE[\"Sliding<br>Sliding-deceleration\"]\nSLIDE --> |Stop| IDLE\nSLIDE --> |Drag| DRAG\n\nOnRelease --> |No| BACK[\"Pull back to bounds<br>Back-deceleration\"]\nBACK --> |Stop| IDLE\nBACK --> |Drag| DRAG
    • Get state
      var state = scroller.state;\n
      • 'IDLE' : No dragging, no sliding
      • 'DRAG' : Dragging
      • 'SLIDE' : Sliding when dragging released
      • 'BACK' : Sliding back to bound when out of bound
    "},{"location":"sequence/","title":"Sequence","text":""},{"location":"sequence/#introduction","title":"Introduction","text":"

    Run sequence commands in array.

    • Author: Rex
    • Object
    "},{"location":"sequence/#live-demos","title":"Live demos","text":"
    • Sequence
    "},{"location":"sequence/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"sequence/#install-plugin","title":"Install plugin","text":""},{"location":"sequence/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexsequenceplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexsequenceplugin.min.js', true);\n
    • Create sequence instance
      var seq = this.plugins.get('rexsequenceplugin').add(config);\n
    "},{"location":"sequence/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SequencePlugin from 'phaser3-rex-plugins/plugins/sequence-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSequence',\nplugin: SequencePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create sequence instance
      var seq = this.plugins.get('rexSequence').add(config);\n
    "},{"location":"sequence/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Sequence from 'phaser3-rex-plugins/plugins/sequence.js';\n
    • Create sequence instance
      var seq = new Sequence(config);\n
    "},{"location":"sequence/#create-sequence-instance","title":"Create sequence instance","text":"
    var seq = this.plugins.get('rexSequence').add({\n// yoyo: false,\n// repeat: 0, \n// loop: false\n});\n
    • yoyo : Reverse sequence when it reaches the end
    • repeat : Repeat count
    • loop : Repeat forever
    "},{"location":"sequence/#load-commands","title":"Load commands","text":"
    seq.load(commands, actionScope);\n
    • Format of command :
      [fnName, param0, param1, ...]\n
    • Commands in nested array :
      [\ncommand0,\ncommand1\n[\ncommand2,\ncommand3\n]\n]\n
    • ActionScope

    Format of command is the same as run-command.

    "},{"location":"sequence/#run-commands","title":"Run commands","text":"
    seq.start();\n
    • Run command :
      var eventEmitter = actionScope[fnName].call(actionScope, param0, param1 ...);\n
      • Return an event emitter to pause the sequence, otherwise run next command
      • Sequence will continue when that event emitter fires complete event
    "},{"location":"sequence/#stop","title":"Stop","text":"
    seq.stop();\n
    "},{"location":"sequence/#events","title":"Events","text":"
    • On sequence completed :
      seq.on('complete', function(actionScope, seq){ });\n
    "},{"location":"sequence/#action-of-commands","title":"Action of commands","text":"

    Action of commands, extended from Phaser.Events.EventEmitter.

    class ActionKlass extends Phaser.Events.EventEmitter {\nconstructor(scene) {\nsuper();\n\nthis.scene = scene;\nthis.myConsole = scene.add.text(100, 100, '');\n\nthis['wait-click'] = this.waitClick;\nthis['wait-time'] = this.waitTime;\n}\n\n// callbacks\nprint(msg) {\nthis.myConsole.setText(msg);\n// return undefined to run next command\n}\n\nwaitClick() {\nthis.scene.input.once('pointerup', this.complete, this);\nreturn this;  // return eventEmitter to pause the sequence\n}\n\nwaitTime(delay) {\nthis.scene.time.delayedCall(delay * 1000, this.complete, [], this);\nreturn this;  // return eventEmitter to pause the sequence\n}\n\ncomplete() {\nthis.emit('complete');  // resume sequence\n}\n}\nvar actionScope = new ActionKlass(scene);\n

    Now this scope supports 3 commands

    • print(msg): ['print', msg]
    • waitClick(): ['wait-click']
    • waitTime(delay): ['wait-time', delay]
    "},{"location":"sequence/#state","title":"State","text":"
    var state = seq.state;\n
    • 0 : Idle
    • 1 : Run
    • 2 : Last command
    • 3 : Completed
    var completed = seq.completed; // seq.state === 3\n
    "},{"location":"sequence/#other-properties","title":"Other properties","text":"
    • Yoyo
      • Get
        var yoyo = seq.yoyo;\n
      • Set
        seq.setYoyo();\nseq.setYoyo(fals);\n// seq.yoyo = yoyo;\n
    • Repeat
      • Get
        var repeat = seq.repeat;\n
      • Set
        seq.setRepeat(count);\n
    • Loop
      • Get
        var loop = seq.loop;\n
      • Set
        seq.setLoop();\nseq.setLoop(fals);\n// seq.loop = loop;\n
    "},{"location":"shader-barrel/","title":"Barrel","text":"

    Note

    Phaser3.60 has a built-in barrel effect.

    "},{"location":"shader-barrel/#introduction","title":"Introduction","text":"

    Barrel post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-barrel/#live-demos","title":"Live demos","text":"
    • Barrel
    "},{"location":"shader-barrel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-barrel/#install-plugin","title":"Install plugin","text":""},{"location":"shader-barrel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbarrelpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbarrelpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexbarrelpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexbarrelpipelineplugin').add(camera, config);\n
    "},{"location":"shader-barrel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BarrelPipelinePlugin from 'phaser3-rex-plugins/plugins/barrelpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBarrelPipeline',\nplugin: BarrelPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexBarrelPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexBarrelPipeline').add(camera, config);\n
    "},{"location":"shader-barrel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import BarrelPostFx from 'phaser3-rex-plugins/plugins/barrelpipeline.js';\nvar config = {\n// ...\npipeline: [BarrelPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(BarrelPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(BarrelPostFx);\n
    "},{"location":"shader-barrel/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 barrel effect.
      var pipelineInstance = scene.plugins.get('rexBarrelPipeline').add(gameObject, {\n// shrink: false,\n// center: {\n//    x: windowWidth / 2,\n//    y: windowHeight / 2\n//}\n// radius: 0,\n// power: 0.5,\n// intensity: 1,\n\n// name: 'rexBarrelPostFx'\n});\n
      • shrink :
        • false : Fish-eye effect
        • true : Anti fish-eye effect.
      • center.x, center.y : Local position of barrel center.
      • radius : Barrel radius.
      • power : 0~1.
      • intensity : 0(original) ~ 1(barrel). Default value is 1.
    • Apply effect to camera. A camera only can add 1 barrel effect.
      var pipelineInstance = scene.plugins.get('rexBarrelPipeline').add(camera, config);\n
    "},{"location":"shader-barrel/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexBarrelPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexBarrelPipeline').remove(camera);\n
    "},{"location":"shader-barrel/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexBarrelPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexBarrelPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexBarrelPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexBarrelPipeline').get(camera);\n
    "},{"location":"shader-barrel/#shrink-mode","title":"Shrink mode","text":"
    • Get
      var shrinkMode = pipelineInstance.shrinkMode;\n
    • Set
      pipelineInstance.setShrinkMode(true);\n// pipelineInstance.setShrinkMode(false);\n
    "},{"location":"shader-barrel/#radius","title":"Radius","text":"
    • Get
      var radius = pipelineInstance.radius;\n
    • Set
      pipelineInstance.radius = radius;\n// pipelineInstance.radius += value;\n
      or
      pipelineInstance.setRadius(radius);\n
    "},{"location":"shader-barrel/#power","title":"Power","text":"
    • Get
      var power = pipelineInstance.power;\n
    • Set
      pipelineInstance.power = power;\n
      or
      pipelineInstance.setPower(power);\n
    "},{"location":"shader-barrel/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(radius);\n
      • intensity : 0(original) ~ 1(barrel)
    "},{"location":"shader-barrel/#center-position","title":"Center position","text":"

    Default value is center of window.

    • Get
      var x = pipelineInstance.centerX;\nvar y = pipelineInstance.centerY;\n
    • Set
      pipelineInstance.centerX = x;\npipelineInstance.centerY = y;\n
      or
      pipelineInstance.setCenter(x, y);\n// pipelineInstance.setCenter();   // set to center of window\n
    "},{"location":"shader-builtin/","title":"Effects","text":""},{"location":"shader-builtin/#introduction","title":"Introduction","text":"

    Built-in pre-fx, and post-fx shader effects.

    • Barrel Distortion : A nice pinch / bulge distortion effect.
    • Bloom : Add bloom to any Game Object, with custom offset, blur strength, steps and color.
    • Blur : 3 different levels of gaussian blur (low, medium and high) and custom distance and color.
    • Bokeh / Tilt Shift : A bokeh and tiltshift effect, with intensity, contrast and distance settings.
    • Circle Outline : Add a circular ring around any Game Object, useful for masking / avatar frames, with custom color, width and background color.
    • Color Matrix : Add a ColorMatrix to any Game Object with access to all of its methods, such as sepia, greyscale, lsd and lots more.
    • Glow : Add a smooth inner or outer glow, with custom distance, strength and color.
    • Displacement : Use a displacement texture, such as a noise texture, to drastically (or subtly!) alter the appearance of a Game Object.
    • Gradient : Draw a gradient between two colors across any Game Object, with optional 'chunky' mode for classic retro style games.
    • Pixelate : Make any Game Object appear pixelated, to a varying degree.
    • Shine : Run a 'shine' effect across a Game Object, either additively or as part of a reveal.
    • Shadow : Add a drop shadow behind a Game Object, with custom depth and color.
    • Vignette : Apply a vignette around a Game Object, with custom offset position, radius and color.
    • Wipe / Reveal : Set a Game Object to 'wipe' or 'reveal' with custom line width, direction and axis of the effect.

    Texture-based Game Objects also support Pre FX, including: Image, Sprite, TileSprite, Text, RenderTexture, Video.

    All Game Objects and camera support Post FX. These are effects applied after the Game Object has been rendered.

    • Author: Richard Davey
    • Pre-fx, and Post-fx shader effects

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-builtin/#live-demos","title":"Live demos","text":"
    • Official demos
    "},{"location":"shader-builtin/#usage","title":"Usage","text":""},{"location":"shader-builtin/#barrel","title":"Barrel","text":"
    • Add pre-fx to game object
      // gameObject.preFX.setPadding(padding);\nvar effect = gameObject.preFX.addBarrel(amount);\n
      • padding : The amount of padding to add to this Game Object, in pixels.
        • Used when amount is larger than 1.
      • amount : The amount of distortion applied to the barrel effect.
        • 1 : No distortion
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addBarrel(amount);\n
      var effect = camera.postFX.addBarrel(amount);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.amount = amount;\n
    "},{"location":"shader-builtin/#bloom","title":"Bloom","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addBloom(color, offsetX, offsetY, blurStrength, strength, steps);\n
      • color : The color of the Bloom, as a hex value.
      • offsetX, offsetY : The horizontal/vertical offset of the bloom effect. Default value is 1.
      • blurStrength , strength : The strength of the blur/blend process of the bloom effect. Default value is 1.
      • steps : The number of steps to run the Bloom effect for. This value should always be an integer. Default value is 4.
        • The higher the value, the smoother the Bloom, but at the cost of exponentially more gl operations.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addBloom(color, offsetX, offsetY, blurStrength, strength, steps);\n
      var effect = camera.postFX.addBloom(color, offsetX, offsetY, blurStrength, strength, steps);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.color = color;  // hex value\neffect.offsetX = offsetX;\neffect.offsetY = offsetY;\neffect.blurStrength = blurStrength;\neffect.strength = strength;\neffect.steps = steps; // integer\n
    "},{"location":"shader-builtin/#blur","title":"Blur","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addBlur(quality, x, y, strength, color, steps);\n
      • quality : The quality of the blur effect. Default value is 0.
        • 0 : Low Quality
        • 1 : Medium Quality
        • 2 : High Quality
      • x, y : The horizontal/vertical offset of the blur effect. Default value is 2
      • strength : The strength of the blur effect. Default value is 1.
      • color : The color of the blur, as a hex value. Default value is 0xffffff.
      • steps : The number of steps to run the blur effect for. This value should always be an integer.
        • The higher the value, the smoother the blur, but at the cost of exponentially more gl operations.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addBlur(quality, x, y, strength, color, steps);\n
      var effect = camera.postFX.addBlur(quality, x, y, strength, color, steps);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.quality = quality;\neffect.x = x;\neffect.y = y;\neffect.strength = strength;\neffect.color = color;\neffect.steps = steps;\n
    "},{"location":"shader-builtin/#bokeh","title":"Bokeh","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addBokeh(radius, amount, contrast);\n
      • radius : The radius of the bokeh effect. Default value is 0.5.
      • amount : The amount of the bokeh effect. Default value is 1.
      • contrast : The color contrast of the bokeh effect. Default value is 0.2.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addBlur(quality, x, y, strength, color, steps);\n
      var effect = camera.postFX.addBokeh(radius, amount, contrast);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.radius = radius;\neffect.amount = amount;\neffect.contrast = contrast;\n
    "},{"location":"shader-builtin/#tilt-shift","title":"Tilt Shift","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addTiltShift(radius, amount, contrast, blurX, blurY, strength);\n
      • radius : The radius of the bokeh effect. Default value is 0.5.
      • amount : The amount of the bokeh effect. Default value is 1.
      • contrast : The color contrast of the bokeh effect. Default value is 0.2.
      • blurX, blurY : The amount of horizontal/vertical blur.
      • strength : The strength of the blur.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addTiltShift(radius, amount, contrast, blurX, blurY, strength);\n
      var effect = camera.postFX.addTiltShift(radius, amount, contrast, blurX, blurY, strength);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.radius = radius;\neffect.amount = amount;\neffect.contrast = contrast;\neffect.blurX = blurX;\neffect.blurY = blurY;\neffect.strength = strength;\n
    "},{"location":"shader-builtin/#circle-outline","title":"Circle Outline","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addCircle(thickness, color, backgroundColor, scale, feather);\n
      • thickness : The width of the circle around the texture, in pixels. Default value is 8.
      • color : The color of the circular ring, given as a number value. Default value is 0xfeedb6.
      • backgroundColor : The color of the background, behind the texture, given as a number value. Default value is 0xff0000.
      • scale : The scale of the circle. Default value is 1.
        • 1 : Full size of the underlying texture.
      • feather : The amount of feathering to apply to the circle from the ring. Default value is 0.005.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addCircle(thickness, color, backgroundColor, scale, feather);\n
      var effect = camera.postFX.addCircle(thickness, color, backgroundColor, scale, feather);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.thickness = thickness;\neffect.color = color;\neffect.backgroundColor = backgroundColor;\neffect.backgroundAlpha = backgroundAlpha;\neffect.scale = scale;\neffect.feather = feather;\n
    "},{"location":"shader-builtin/#colormatrix","title":"ColorMatrix","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addColorMatrix();\n
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addColorMatrix();\n
      var effect = camera.postFX.addColorMatrix();\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Methods
      • Brightness : Changes the brightness of this ColorMatrix by the given amount.
        effect.brightness(value, multiply);\n
        • value : The amount of brightness to apply to this ColorMatrix. 0(black)~1. Default value is 0.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Saturate : Changes the saturation of this ColorMatrix by the given amount.
        effect.saturate(value, multiply);\n
        • value : The amount of saturation to apply to this ColorMatrix. Default value is 0.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Desaturate : Desaturates this ColorMatrix (removes color from it).
        effect.desaturate(value, multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Hue : Rotates the hues of this ColorMatrix by the value given.
        effect.hue(rotation, multiply);\n
        • rotation : The amount of hue rotation to apply to this ColorMatrix, in degrees. Default value is 0.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Grayscale : Sets this ColorMatrix to be grayscale.
        effect.grayscale(value, multiply);\n
        • value : The grayscale scale 0(black)~1. Default value is 1.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • BlackWhite : Sets this ColorMatrix to be black and white.
        effect.blackWhite(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Contrast : Change the contrast of this ColorMatrix by the amount given.
        effect.contrast(value, multiply);\n
        • value : The amount of contrast to apply to this ColorMatrix. Default value is 0.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Negative : Converts this ColorMatrix to have negative values.
        effect.negative(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • DesaturateLuminance : Apply a desaturated luminance to this ColorMatrix.
        effect.desaturateLuminance(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Sepia : Applies a sepia tone to this ColorMatrix.
        effect.sepia(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Night : Applies a night vision tone to this ColorMatrix.
        effect.night(intensity, multiply);\n
        • intensity : The intensity of this effect. Default value is 0.1.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • LSD : Applies a trippy color tone to this ColorMatrix.
        effect.lsd(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Brown : Applies a brown tone to this ColorMatrix.
        effect.brown(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • VintagePinhole : Applies a vintage pinhole color effect to this ColorMatrix.
        effect.vintagePinhole(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Kodachrome : Applies a kodachrome color effect to this ColorMatrix.
        effect.kodachrome(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Technicolor : Applies a technicolor color effect to this ColorMatrix.
        effect.technicolor(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Polaroid : Applies a polaroid color effect to this ColorMatrix.
        effect.polaroid(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • ShiftToBGR : Shifts the values of this ColorMatrix into BGR order.
        effect.shiftToBGR(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
    "},{"location":"shader-builtin/#displacement","title":"Displacement","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addDisplacement(texture, x, y);\n
      • texture : The unique string-based key of the texture to use for displacement, which must exist in the Texture Manager. Default value is '__WHITE'.
        • You can only use a whole texture, not a frame from a texture atlas or sprite sheet.
      • x, y : The amount of horizontal/vertical displacement to apply. Default value is 0.005.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addDisplacement(texture, x, y);\n
      var effect = camera.postFX.addDisplacement(texture, x, y);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.x = x;\neffect.y = y;    
    • Methods
      • Set texture
        effect.setTexture(key);\n
    "},{"location":"shader-builtin/#glow","title":"Glow","text":"
    • Add pre-fx to game object
      // gameObject.preFX.setPadding(padding);\nvar effect = gameObject.preFX.addGlow(color, outerStrength, innerStrength, knockout);\n
      • padding : The amount of padding to add to this Game Object, in pixels.
        • Used when amount is larger than 1.
      • color : The color of the glow effect as a number value. Default value is 0xffffff.
      • outerStrength, innerStrength : The strength of the glow outward/inward from the edge of the Sprite. Default value is 4/0.
      • knockout :
        • true : Only the glow is drawn
        • false : Draw glow and texture. Default behavior.
      • quality : Only available for PostFX. Sets the quality of this Glow effect. Default is 0.1. Cannot be changed post-creation.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addGlow(color, outerStrength, innerStrength, knockout, quality, distance);\n
      var effect = camera.postFX.addGlow(color, outerStrength, innerStrength, knockout, quality, distance);\n
      • quality : Sets the quality of this Glow effect. Default is 0.1. Cannot be changed post-creation.
      • distance : Sets the distance of this Glow effect. Default is 10. Cannot be changed post-creation.
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.color = color;\neffect.outerStrength = outerStrength;\neffect.innerStrength = innerStrength;\neffect.knockout = knockout;\n
    "},{"location":"shader-builtin/#gradient","title":"Gradient","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addGradient(color1, color2, alpha, fromX, fromY, toX, toY, size);\n
      • color1, color2 : The first/second gradient color, given as a number value. Default values are 0xff0000/0x00ff00.
      • alpha : The alpha value of the gradient effect.
      • fromX, fromY : The horizontal/vertical position the gradient will start from. Value between 0 and 1.
      • toX, toY : The horizontal/vertical position the gradient will end at. Value between 0 and 1.
      • size : How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture.
        • 0 : Smooth gradient. Default behavior.
        • Others : Retro chunky effect.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addGradient(color1, color2, alpha, fromX, fromY, toX, toY, size);\n
      var effect = camera.postFX.addGradient(color1, color2, alpha, fromX, fromY, toX, toY, size);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.color1 = color1;\neffect.color2 = color2;\neffect.alpha = alpha;\neffect.fromX = fromX;\neffect.fromY = fromY;\neffect.toX = toX;\neffect.toY = toY;\neffect.size = size;\n
    "},{"location":"shader-builtin/#pixelate","title":"Pixelate","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addPixelate(amount);\n
      • amount : The amount of pixelation to apply, in pixels.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addPixelate(amount);\n
      var effect = camera.postFX.addPixelate(amount);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.amount = amount;\n
    "},{"location":"shader-builtin/#shadow","title":"Shadow","text":"
    • Add pre-fx to game object
      // gameObject.preFX.setPadding(padding);\nvar effect = gameObject.preFX.addShadow(x, y, decay, power, color, samples, intensity);\n
      • padding : The amount of padding to add to this Game Object, in pixels.
        • Used when amount is larger than 1.
      • x, y : The horizontal/vertical offset of the shadow effect. Default value is 0.
      • decay : The amount of decay for shadow effect. Default value is 0.1.
      • power : The power of the shadow effect. Default value is 1.
      • color : The color of the shadow. Default value is 0x000000.
      • samples : The number of samples that the shadow effect will run for. An integer between 1 and 12.
      • intensity : The intensity of the shadow effect. Default value is 1.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addShadow(x, y, decay, power, color, samples, intensity);\n
      var effect = camera.postFX.addShadow(x, y, decay, power, color, samples, intensity);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.x = x;\neffect.y = y;\neffect.decay = decay;\neffect.power = power;\neffect.color = color;\neffect.samples = samples;\neffect.intensity = intensity;\n
    "},{"location":"shader-builtin/#shine","title":"Shine","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addShine(speed, lineWidth, gradient, reveal);\n
      • speed : The speed of the Shine effect. Default value is 0.5.
      • lineWidth : The line width of the Shine effect. Default value is 0.5.
      • gradient : The gradient of the Shine effect. Default value is 3.
      • reveal : Does this Shine effect reveal or get added to its target?
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addShine(speed, lineWidth, gradient, reveal);\n
      var effect = camera.postFX.addShine(speed, lineWidth, gradient, reveal);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.speed = speed;\neffect.lineWidth = lineWidth;\neffect.gradient = gradient;\neffect.reveal = reveal;\n
    "},{"location":"shader-builtin/#vignette","title":"Vignette","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addVignette(x, y, radius, strength);\n
      • x, y : The horizontal/vertical offset of the vignette effect. Value is between 0 and 1. Default value is 0.5.
      • radius : The radius of the vignette effect. Value is between 0 and 1. Default value is 0.5.
      • strength : The strength of the vignette effect. Default value is 0.5.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addVignette(x, y, radius, strength);\n
      var effect = camera.postFX.addVignette(x, y, radius, strength);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.x = x;\neffect.y = y;\neffect.radius = radius;\neffect.strength = strength;\n
    "},{"location":"shader-builtin/#wipe","title":"Wipe","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addWipe(wipeWidth, direction, axis);\n
      • wipeWidth : The width of the wipe effect. Value is between 0 and 1. Default value is 0.1.
      • direction : The direction of the wipe effect.
        • 0 : Left to right, or top to bottom
        • 1 : Right to left, or bottom to top
      • axis : The axis of the wipe effect.
        • 0 : Left to right, or right to left
        • 1 : Bottom to top, or top to bottom
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addWipe(wipeWidth, direction, axis);\n
      var effect = camera.postFX.addWipe(wipeWidth, direction, axis);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.progress = t; // 0~1\neffect.wipeWidth = wipeWidth;\neffect.direction = direction;  // 0, 1\neffect.axis = axis;  // 0, 1    \n
    "},{"location":"shader-builtin/#reveal","title":"Reveal","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addReveal(wipeWidth, direction, axis);\n
      • wipeWidth : The width of the wipe effect. Value is between 0 and 1. Default value is 0.1.
      • direction : The direction of the wipe effect.
        • 0 : Left to right, or top to bottom
        • 1 : Right to left, or bottom to top
      • axis : The axis of the wipe effect.
        • 0 : Left to right, or right to left
        • 1 : Bottom to top, or top to bottom
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addReveal(wipeWidth, direction, axis);\n
      var effect = camera.postFX.addReveal(wipeWidth, direction, axis);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.progress = t; // 0~1\neffect.wipeWidth = wipeWidth;\neffect.direction = direction;  // 0, 1\neffect.axis = axis;  // 0, 1\n
    "},{"location":"shader-builtin/#remove-all-effects","title":"Remove all effects","text":"

    gameObject.preFX.clear();\n
    gameObject.postFX.clear();\n
    camera.postFX.clear();\n

    "},{"location":"shader-builtin/#disable-all-effects","title":"Disable all effects","text":"

    gameObject.preFX.disable();\n// gameObject.preFX.disable(true);  // Also remove all effects\n
    gameObject.postFX.disable();\n// gameObject.postFX.disable(true);  // Also remove all effects\n
    camera.postFX.disable();\n// camera.postFX.disable(true);  // Also remove all effects\n

    "},{"location":"shader-colorreplace/","title":"Color replace","text":""},{"location":"shader-colorreplace/#introduction","title":"Introduction","text":"

    Replace color post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-colorreplace/#live-demos","title":"Live demos","text":"
    • Color replace
    "},{"location":"shader-colorreplace/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-colorreplace/#install-plugin","title":"Install plugin","text":""},{"location":"shader-colorreplace/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcolorreplacepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcolorreplacepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexcolorreplacepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexcolorreplacepipelineplugin').add(camera, config);\n
    "},{"location":"shader-colorreplace/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ColorReplacePipelinePlugin from 'phaser3-rex-plugins/plugins/colorreplacepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexColorReplacePipeline',\nplugin: ColorReplacePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').add(camera, config);\n
    "},{"location":"shader-colorreplace/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import ColorReplacePostFx from 'phaser3-rex-plugins/plugins/colorreplacepipeline.js';\nvar config = {\n// ...\npipeline: [ColorReplacePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(ColorReplacePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(ColorReplacePostFx);\n
    "},{"location":"shader-colorreplace/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 colorreplace effect.
      var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').add(gameObject, {\noriginalColor: 0xFF0000,\nnewColor: 0x000000,\n// epsilon: 0.4,\n\n// name: 'rexColorReplacePostFx'\n});\n
      • originalColor : The color (0xRRGGBB) that will be changed.
      • newColor : The resulting color (0xRRGGBB).
      • epsilon : Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive)
    • Apply effect to camera. A camera only can add 1 colorreplace effect.
      var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').add(camera, config);\n
    "},{"location":"shader-colorreplace/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexColorReplacePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexColorReplacePipeline').remove(camera);\n
    "},{"location":"shader-colorreplace/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexColorReplacePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexColorReplacePipeline').get(camera);\n
    "},{"location":"shader-colorreplace/#original-color","title":"Original color","text":"
    • Get
      var color = pipelineInstance.originalColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setOriginalColor(value);\n
      pipelineInstance.originalColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-colorreplace/#new-color","title":"New color","text":"
    • Get
      var color = pipelineInstance.newColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setNewColor(value);\n
      pipelineInstance.newColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-colorreplace/#epsilon","title":"Epsilon","text":"
    • Get
      var epsilon = pipelineInstance.epsilon;\n
    • Set
      pipelineInstance.epsilon = epsilon;\n// pipelineInstance.epsilon += value;\n
      or
      pipelineInstance.setEpsilon(value);\n
    "},{"location":"shader-crossstitching/","title":"Cross-stitching","text":""},{"location":"shader-crossstitching/#introduction","title":"Introduction","text":"

    Cross-stitching post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-crossstitching/#live-demos","title":"Live demos","text":"
    • Cross-stitching
    "},{"location":"shader-crossstitching/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-crossstitching/#install-plugin","title":"Install plugin","text":""},{"location":"shader-crossstitching/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcrossstitchingpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcrossstitchingpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexcrossstitchingpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexcrossstitchingpipelineplugin').add(camera, config);\n
    "},{"location":"shader-crossstitching/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CrossStitchingPipelinePlugin from 'phaser3-rex-plugins/plugins/crossstitchingpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCrossStitchingPipeline',\nplugin: CrossStitchingPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').add(camera, config);\n
    "},{"location":"shader-crossstitching/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import CrossStitchingPostFx from 'phaser3-rex-plugins/plugins/crossstitchingpipeline.js';\nvar config = {\n// ...\npipeline: [CrossStitchingPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(CrossStitchingPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(CrossStitchingPostFx);\n
    "},{"location":"shader-crossstitching/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 cross-stitching effect.
      var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').add(gameObject, {\n// stitchingWidth: 6,\n// stitchingHeight: 6,\n// brightness: 0,\n\n// name: 'rexCrossStitchingPostFx'\n});\n
      • stitchingWidth, stitchingHeight : Stitching size.
      • brightness : Brightness of stitching edges
    • Apply effect to camera. A camera only can add 1 cross-stitching effect.
      var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').add(camera, config);\n
    "},{"location":"shader-crossstitching/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexCrossStitchingPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexCrossStitchingPipeline').remove(camera);\n
    "},{"location":"shader-crossstitching/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexCrossStitchingPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexCrossStitchingPipeline').get(camera);\n
    "},{"location":"shader-crossstitching/#stitching-size","title":"Stitching size","text":"
    • Get
      var stitchingWidth = pipelineInstance.stitchingWidth;\nvar stitchingHeight = pipelineInstance.stitchingHeight;\n
    • Set
      pipelineInstance.stitchingWidth = stitchingWidth;\npipelineInstance.stitchingHeight = stitchingHeight;\n// pipelineInstance.stitchingWidth += value;\n// pipelineInstance.stitchingHeight += value;\n
      or
      pipelineInstance.setStitchingWidth(stitchingWidth);\npipelineInstance.setStitchingHeight(stitchingHeight);\npipelineInstance.setStitchingSize(stitchingWidth, stitchingHeight);\n
    "},{"location":"shader-crossstitching/#brightness","title":"Brightness","text":"
    • Get
      var brightness = pipelineInstance.brightness;\n
    • Set
      pipelineInstance.brightness = brightness;\n// pipelineInstance.brightness += value;\n
      or
      pipelineInstance.setBrightness(radius);\n
      • brightness : 0(black) ~ 1(white)
    "},{"location":"shader-crt/","title":"CRT","text":""},{"location":"shader-crt/#introduction","title":"Introduction","text":"

    CRT post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-crt/#live-demos","title":"Live demos","text":"
    • CRT
    "},{"location":"shader-crt/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-crt/#install-plugin","title":"Install plugin","text":""},{"location":"shader-crt/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcrtpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcrtpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexcrtpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexcrtpipelineplugin').add(camera, config);\n
    "},{"location":"shader-crt/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CrtPipelinePlugin from 'phaser3-rex-plugins/plugins/crtpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCrtPipeline',\nplugin: CrtPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexCrtPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexCrtPipeline').add(camera, config);\n
    "},{"location":"shader-crt/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import CrtPostFx from 'phaser3-rex-plugins/plugins/crtpipeline.js';\nvar config = {\n// ...\npipeline: [CrtPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(CrtPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(CrtPostFx);\n
    "},{"location":"shader-crt/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 crt effect.
      var pipelineInstance = scene.plugins.get('rexCrtPipeline').add(gameObject, {\n// warpX: 0.75,\n// warpY: 0.75,\n// scanLineStrength: 0.2,\n// scanLineWidth: 1024,\n\n// name: 'rexCrtPostFx'\n});\n
      • warpX, warpY : Horizontal and Vertical warp.
      • scanLineStrength, scanLineWidth : Scan line parameters.
    • Apply effect to camera. A camera only can add 1 crt effect.
      var pipelineInstance = scene.plugins.get('rexCrtPipeline').add(camera, config);\n
    "},{"location":"shader-crt/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexCrtPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexCrtPipeline').remove(camera);\n
    "},{"location":"shader-crt/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexCrtPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexCrtPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexCrtPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexCrtPipeline').get(camera);\n
    "},{"location":"shader-crt/#warp","title":"Warp","text":"
    • Get
      var warpX = pipelineInstance.warpX;\nvar warpY = pipelineInstance.warpY;\n
    • Set
      pipelineInstance.setWarp(warpX, warpY);\n
      or
      pipelineInstance.warpX = warpX;\npipelineInstance.warpY = warpY;\n
    "},{"location":"shader-crt/#scan-lines","title":"Scan lines","text":"
    • Get
      var scanLineStrength = pipelineInstance.scanLineStrength;\nvar scanLineWidth = pipelineInstance.scanLineWidth;\n
    • Set
      pipelineInstance.setScanStrength(scanLineStrength);\npipelineInstance.setScanLineWidth(scanLineWidth);\n
      or
      pipelineInstance.scanLineStrength = scanLineStrength;\npipelineInstance.scanLineWidth = scanLineWidth;\n
    "},{"location":"shader-dissolve/","title":"Dissolve","text":""},{"location":"shader-dissolve/#introduction","title":"Introduction","text":"

    Dissolve transition post processing filter. (Reference)

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-dissolve/#live-demos","title":"Live demos","text":"
    • Dissolve
    "},{"location":"shader-dissolve/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-dissolve/#install-plugin","title":"Install plugin","text":""},{"location":"shader-dissolve/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdissolvepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdissolvepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexdissolvepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexdissolvepipelineplugin').add(camera, config);\n
    "},{"location":"shader-dissolve/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DissolvePipelinePlugin from 'phaser3-rex-plugins/plugins/dissolvepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDissolvePipeline',\nplugin: DissolvePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexDissolvePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexDissolvePipeline').add(camera, config);\n
    "},{"location":"shader-dissolve/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import DissolvePostFx from 'phaser3-rex-plugins/plugins/dissolvepipeline.js';\nvar config = {\n// ...\npipeline: [DissolvePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(DissolvePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(DissolvePostFx);\n
    "},{"location":"shader-dissolve/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 dissolve effect.
      var pipelineInstance = scene.plugins.get('rexDissolvePipeline').add(gameObject, {\n// toTexture: textureKey,\n// toFrame: frameName,\n// resizeMode: 1,\n\n// noiseX: undefined,\n// noiseY: undefined,\n// noiseZ: undefined,\n// fromEdgeStart: 0.01,\n// fromEdgeWidth: 0.05,\n// toEdgeStart: 0.01,\n// toEdgeWidth: 0.05,\n\n// progress: 0,\n\n// name: 'rexDissolvePostFx'\n});\n
      • toTexture, toFrame : Texture key and frame name of transition target texture.
      • resizeMode : Resize mode of transition target texture.
        • 0, or 'stretch' : The target texture is stretched to the size of the source texture.
        • 1, or 'contain' : The target texture is resized to fit the source texture.
        • 2, or 'cover' : The target texture is resized to cover the source texture.
      • noiseX, noiseY, noiseZ : Parameter of Perline noise.
        • undefined : A random value.
      • fromEdgeStart, fromEdgeWidth : Dissolve edge start, edge width of from-texture (texture of game object, or render result of camera).
      • toEdgeStart, toEdgeWidth : Reveal edge start, edge width of to-texture.
    • Apply effect to camera. A camera only can add 1 dissolve effect.
      var pipelineInstance = scene.plugins.get('rexDissolvePipeline').add(camera, config);\n
    "},{"location":"shader-dissolve/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexDissolvePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexDissolvePipeline').remove(camera);\n
    "},{"location":"shader-dissolve/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexDissolvePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexDissolvePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexDissolvePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexDissolvePipeline').get(camera);\n
    "},{"location":"shader-dissolve/#transition-target-texture","title":"Transition target texture","text":"
    • Get
      var textureKey = pipelineInstance.toFrame.texture.key;\nvar frameName = pipelineInstance.toFrame.name;\n
    • Set
      pipelineInstance.setTransitionTargetTexture(textureKey, frameName);\n// pipelineInstance.setTransitionTargetTexture(textureKey, frameName, resizeMode);\n
    "},{"location":"shader-dissolve/#progress","title":"Progress","text":"
    • Get
      var progress = pipelineInstance.progress;\n
    • Set
      pipelineInstance.setProgress(value);  // value: 0~1\n
      or
      pipelineInstance.progress = value;  // value: 0~1\n
    "},{"location":"shader-dissolve/#resize-mode","title":"Resize mode","text":"
    • Get
      var mode = pipelineInstance.resizeMode;\n
    • Set
      pipelineInstance.setResizeMode(mode);\n
      • mode :
        • 0, or 'stretch' : The target texture is stretched to the size of the source texture.
        • 1, or 'contain' : The target texture is resized to fit the source texture.
        • 2, or 'cover' : The target texture is resized to cover the source texture.
    "},{"location":"shader-dissolve/#noise","title":"Noise","text":"
    • Get
      var noiseX = pipelineInstance.noiseX;\nvar noiseY = pipelineInstance.noiseY;\nvar noiseZ = pipelineInstance.noiseZ;\n
    • Set
      pipelineInstance.noiseX = noiseX;\npipelineInstance.noiseY = noiseY;\npipelineInstance.noiseZ = noiseZ;\n
      or
      pipelineInstance.setNoise(noiseX, noiseY, noiseZ);\n// pipelineInstance.setNoise(); // Passing 3 random float numbers\n
    "},{"location":"shader-dissolve/#edge","title":"Edge","text":"
    • Get
      • From texture (texture of game object, or render result of camera)
        var edgeStart = pipelineInstance.fromEdgeStart;\nvar edgeWidth = pipelineInstance.fromEdgeWidth;\n
      • To texture (transition target texture)
        var edgeStart = pipelineInstance.toEdgeStart;\nvar edgeWidth = pipelineInstance.toEdgeWidth;\n
    • Set
      • From texture (texture of game object, or render result of camera)
        pipelineInstance.fromEdgeStart = edgeStart;\npipelineInstance.fromEdgeWidth = edgeWidth;\n
        or
        pipelineInstance.setFromEdge(edgeStart, edgeWidth);\n
        • edgeStart : 0~1, default value is 0.01
        • edgeWidth : 0~1, default value is 0.05
      • To texture (transition target texture)
        pipelineInstance.toEdgeStart = edgeStart;\npipelineInstance.toEdgeWidth = edgeWidth;\n
        or
        pipelineInstance.setToEdge(edgeStart, edgeWidth);\n
        • edgeStart : 0~1, default value is 0.01
        • edgeWidth : 0~1, default value is 0.05
    "},{"location":"shader-dropshadow/","title":"Drop shadow","text":"

    Note

    Built-in preFX/postFX also provide shadow effect, might try these first.

    "},{"location":"shader-dropshadow/#introduction","title":"Introduction","text":"

    Drop-shadow post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-dropshadow/#live-demos","title":"Live demos","text":"
    • Drop-shadow
    "},{"location":"shader-dropshadow/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-dropshadow/#install-plugin","title":"Install plugin","text":""},{"location":"shader-dropshadow/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdropshadowpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdropshadowpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexdropshadowpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexdropshadowpipelineplugin').add(camera, config);\n
    "},{"location":"shader-dropshadow/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DropShadowPipelinePlugin from 'phaser3-rex-plugins/plugins/dropshadowpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDropShadowPipeline',\nplugin: DropShadowPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').add(camera, config);\n
    "},{"location":"shader-dropshadow/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import DropShadowPostFx from 'phaser3-rex-plugins/plugins/dropshadowpipeline.js';\nvar config = {\n// ...\npipeline: [DropShadowPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(DropShadowPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(DropShadowPostFx);\n
    "},{"location":"shader-dropshadow/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 dropshadow effect.
      var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').add(gameObject, {\n// ** Offset **\n// rotation: \n// angle: 45,      // degrees\n// distance: 5,\n\n// ** Shadow color **\n// shadowColor: 0xffffff,\n// alpha: 0.5,\n\n// shadowOnly: false,\n\n// ** Parameters of KawaseBlur **\n// blur: 4,\n// quality: 3,\n// pixelWidth: 1,\n// pixelHeight: 1,\n\n// name: 'rexDropShadowPostFx'\n});\n
      • Offset
        • rotation, angle : The angle of the shadow in radians/degrees.
        • distance : Distance of shadow.
      • Color
        • shadowColor : Color of the shadow.
        • alpha : Alpha of the shadow.
      • shadowOnly : Whether render shadow only.
      • Parameters of KawaseBlur
        • blur : The blur of the filter. Should be greater than 0. If value is an Array, setting kernels.
        • quality : The quality of the filter. Should be an integer greater than 1.
        • pixelWidth, pixelHeight : Sets the pixel size of the filter. Large size is blurrier. For advanced usage.
    • Apply effect to camera. A camera only can add 1 dropshadow effect.
      var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').add(camera, config);\n
    "},{"location":"shader-dropshadow/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexDropShadowPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexDropShadowPipeline').remove(camera);\n
    "},{"location":"shader-dropshadow/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexDropShadowPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexDropShadowPipeline').get(camera);\n
    "},{"location":"shader-dropshadow/#rotation","title":"Rotation","text":"
    • Get
      var rotation = pipelineInstance.rotation;  // radians\n// var angle = pipelineInstance.angle;     // degrees\n
    • Set
      pipelineInstance.rotation = rotation;   // radians\n// pipelineInstance.angle = angle;      // degrees\n
      or
      pipelineInstance.setRotation(radians);\npipelineInstance.setAngle(degrees);\n
    "},{"location":"shader-dropshadow/#distance","title":"Distance","text":"
    • Get
      var distance = pipelineInstance.distance;\n
    • Set
      pipelineInstance.distance = distance;\n// pipelineInstance.distance += value;\n
      or
      pipelineInstance.setDistance(distance);\n
    "},{"location":"shader-dropshadow/#shadow-color","title":"Shadow color","text":"
    • Get
      var color = pipelineInstance.shadowColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setShadowColor(value);\n
      pipelineInstance.shadowColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-dropshadow/#alpha","title":"Alpha","text":"
    • Get
      var alpha = pipelineInstance.alpha;\n
    • Set
      pipelineInstance.alpha = alpha;\n
      or
      pipelineInstance.setAlpha(alpha);\n
    "},{"location":"shader-dropshadow/#shadow-only","title":"Shadow-only","text":"
    • Get
      var enable = pipelineInstance.shadowOnly;\n
    • Set
      pipelineInstance.shadowOnly = enable;\n
      or
      pipelineInstance.setShadowOnly(enable);\n
    "},{"location":"shader-dropshadow/#blur","title":"Blur","text":"
    • Get
      var blur = pipelineInstance.blur;\n
    • Set
      pipelineInstance.blur = blur;\n// pipelineInstance.blur += value;\n
      or
      pipelineInstance.setBlur(value);\n
    "},{"location":"shader-dropshadow/#quality","title":"Quality","text":"
    • Get
      var quality = pipelineInstance.quality;\n
    • Set
      pipelineInstance.quality = quality;\n// pipelineInstance.quality += value;\n
      or
      pipelineInstance.setQuality(value);\n
    "},{"location":"shader-dropshadow/#pixel-size","title":"Pixel size","text":"
    • Get
      var pixelWidth = pipelineInstance.pixelWidth;\nvar pixelHeight = pipelineInstance.pixelHeight;\n
    • Set
      pipelineInstance.pixelWidth = pixelWidth;\npipelineInstance.pixelHeight = pixelHeight;\n
      or
      pipelineInstance.setPixelWidth(pixelWidth);\npipelineInstance.setPixelHeight(pixelHeight);\npipelineInstance.setPixelSize(pixelWidth, pixelHeight);\n
    "},{"location":"shader-fisheye/","title":"Fisheye","text":""},{"location":"shader-fisheye/#introduction","title":"Introduction","text":"

    Fish-eye post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-fisheye/#live-demos","title":"Live demos","text":"
    • FishEye
    "},{"location":"shader-fisheye/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-fisheye/#install-plugin","title":"Install plugin","text":""},{"location":"shader-fisheye/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfisheyepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfisheyepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexfisheyepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexfisheyepipelineplugin').add(camera, config);\n
    "},{"location":"shader-fisheye/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FishEyePipelinePlugin from 'phaser3-rex-plugins/plugins/fisheyepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFishEyePipeline',\nplugin: FishEyePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexFishEyePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexFishEyePipeline').add(camera, config);\n
    "},{"location":"shader-fisheye/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import FishEyePostFx from 'phaser3-rex-plugins/plugins/fisheyepipeline.js';\nvar config = {\n// ...\npipeline: [FishEyePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(FishEyePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(FishEyePostFx);\n
    "},{"location":"shader-fisheye/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 fisheye effect.
      var pipelineInstance = scene.plugins.get('rexFishEyePipeline').add(gameObject, {\n// center: {\n//    x: windowWidth / 2,\n//    y: windowHeight / 2\n//}\n// radius: 0,\n// intensity: 1,\n// mode:0,  // 0|1|'asin'|'sin'\n\n// name: 'rexFishEyePostFx'\n});\n
      • center.x, center.y : Local position of fisheye center.
      • radius : FishEye radius.
      • intensity : 0(original) ~ 1(fisheye). Default value is 1.
      • mode :
        • 0, or 'asin' : asin mode. Defaule value is 0.
        • 1, or 'sin' : sin mode.
    • Apply effect to camera. A camera only can add 1 fisheye effect.
      var pipelineInstance = scene.plugins.get('rexFishEyePipeline').add(camera, config);\n
    "},{"location":"shader-fisheye/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexFishEyePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexFishEyePipeline').remove(camera);\n
    "},{"location":"shader-fisheye/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexFishEyePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexFishEyePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexFishEyePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexFishEyePipeline').get(camera);\n
    "},{"location":"shader-fisheye/#radius","title":"Radius","text":"
    • Get
      var radius = pipelineInstance.radius;\n
    • Set
      pipelineInstance.radius = radius;\n// pipelineInstance.radius += value;\n
      or
      pipelineInstance.setRadius(radius);\n
    "},{"location":"shader-fisheye/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(intensity);\n
      • intensity : 0(original) ~ 1(fisheye)
    "},{"location":"shader-fisheye/#center-position","title":"Center position","text":"

    Default value is center of window.

    • Get
      var x = pipelineInstance.centerX;\nvar y = pipelineInstance.centerY;\n
    • Set
      pipelineInstance.centerX = x;\npipelineInstance.centerY = y;\n
      or
      pipelineInstance.setCenter(x, y);\n// pipelineInstance.setCenter();   // set to center of window\n
    "},{"location":"shader-fisheye/#mode","title":"Mode","text":"
    • Get
      var mode = pipelineInstance.fishEyeMode;\n
    • Set
      pipelineInstance.setFishEyeMode(mode);\n
      • 0, or 'asin' : asin mode.
      • 1, or 'sin' : sin mode.
    "},{"location":"shader-glowfilter/","title":"Glow","text":"

    Note

    Phaser3.60 has a built-in Glow effect.

    "},{"location":"shader-glowfilter/#introduction","title":"Introduction","text":"

    Glow post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-glowfilter/#live-demos","title":"Live demos","text":"
    • Glow filter
    "},{"location":"shader-glowfilter/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-glowfilter/#install-plugin","title":"Install plugin","text":""},{"location":"shader-glowfilter/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexglowfilterpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexglowfilterpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexglowfilterpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexglowfilterpipelineplugin').add(camera, config);\n
    "},{"location":"shader-glowfilter/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GlowFilterPipelinePlugin from 'phaser3-rex-plugins/plugins/glowfilterpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGlowFilterPipeline',\nplugin: GlowFilterPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(camera, config);\n
    "},{"location":"shader-glowfilter/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import GlowFilterPostFx from 'phaser3-rex-plugins/plugins/glowfilterpipeline.js';\nvar config = {\n// ...\npipeline: [GlowFilterPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(GlowFilterPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(GlowFilterPostFx);\n
    "},{"location":"shader-glowfilter/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 glow effect.
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(gameObject, {\n// intensity: 0\n});\n
      • intensity : 0(original color) ~ 1(white color)
        • Suggestion value : 0 ~ 0.02
    • Apply effect to camera. A camera only can add 1 glow effect.
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(camera, config);\n
    "},{"location":"shader-glowfilter/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexGlowFilterPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexGlowFilterPipeline').remove(camera);\n
    "},{"location":"shader-glowfilter/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexGlowFilterPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexGlowFilterPipeline').get(camera);\n
    "},{"location":"shader-glowfilter/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(radius);\n
      • intensity : 0(original color) ~ 1(white color)
        • Suggestion value : 0 ~ 0.02
    "},{"location":"shader-glowfilter2/","title":"Glow","text":"

    Note

    Phaser3.60 has a built-in Glow effect.

    "},{"location":"shader-glowfilter2/#introduction","title":"Introduction","text":"

    Glow post processing filter, port from pixi. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-glowfilter2/#live-demos","title":"Live demos","text":"
    • Glow filter
    "},{"location":"shader-glowfilter2/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-glowfilter2/#install-plugin","title":"Install plugin","text":""},{"location":"shader-glowfilter2/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexglowfilter2pipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexglowfilter2pipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexglowfilter2pipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexglowfilter2pipelineplugin').add(camera, config);\n
    "},{"location":"shader-glowfilter2/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GlowFilterPipelinePlugin from 'phaser3-rex-plugins/plugins/glowfilter2pipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGlowFilterPipeline',\nplugin: GlowFilterPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(camera, config);\n
    "},{"location":"shader-glowfilter2/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import GlowFilterPostFx from 'phaser3-rex-plugins/plugins/glowfilter2pipeline.js';\nvar config = {\n// ...\npipeline: [GlowFilterPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(GlowFilterPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(GlowFilterPostFx);\n
    "},{"location":"shader-glowfilter2/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 glowfilter effect.
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(gameObject, {    // outerStrength: 4,\n// innerStrength: 0,\n// glowColor: 0xffffff,\n// knockout: false,\n\n// distance: 10,\n// quality: 0.1,\n\n// name: 'rexGlowFilterPostFx'\n});\n
      • outerStrength : The strength of the glow outward from the edge of the texture.
      • innerStrength : The strength of the glow inward from the edge of the texture.
      • glowColor : The color of the glow.
      • knockout :
        • true : Only show effect.
        • false : Show content and effect.
      • distance : The distance of the glow. It can't be changed after filter creation.
      • quality : 0~1. The higher the number the less performant. It can't be changed after filter creation.
    • Apply effect to camera. A camera only can add 1 glowfilter effect.
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(camera, config);\n
    "},{"location":"shader-glowfilter2/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexGlowFilterPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexGlowFilterPipeline').remove(camera);\n
    "},{"location":"shader-glowfilter2/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexGlowFilterPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexGlowFilterPipeline').get(camera);\n
    "},{"location":"shader-glowfilter2/#outer-strength","title":"Outer strength","text":"
    • Get
      var outerStrength = pipelineInstance.outerStrength;\n
    • Set
      pipelineInstance.outerStrength = outerStrength;\n// pipelineInstance.outerStrength += value;\n
      or
      pipelineInstance.setOuterStrength(value);\n
    "},{"location":"shader-glowfilter2/#inner-strength","title":"Inner strength","text":"
    • Get
      var innerStrength = pipelineInstance.innerStrength;\n
    • Set
      pipelineInstance.innerStrength = innerStrength;\n// pipelineInstance.innerStrength += value;\n
      or
      pipelineInstance.setInnerStrength(value);\n
    "},{"location":"shader-glowfilter2/#glow-color","title":"Glow color","text":"
    • Get
      var color = pipelineInstance.glowColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setGlowColor(value);\n
      pipelineInstance.glowColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-glowfilter2/#distance","title":"Distance","text":"

    The distance of the glow. Make it 2 times more for resolution=2. It can't be changed after filter creation.

    • Get
      var distance = pipelineInstance.distance;\n
    • Set
      pipelineInstance.setDistance(distance);\n
      or
      pipelineInstance.distance = distance;\n
      • distance : The distance of the glow.
    "},{"location":"shader-glowfilter2/#quality","title":"Quality","text":"

    A number between 0 and 1 that describes the quality of the glow. The higher the number the less performant.

    • Get
      var quality = pipelineInstance.quality;\n
    • Set
      pipelineInstance.setQuality(quality);\n
      or
      pipelineInstance.quality = quality;\n
      • quality : 0 ~ 1, default is 0.1.
        • 0.1 : 10 sample points.
        • 0.08 : 8 sample points.
        • 1 : 100 sample points.
    "},{"location":"shader-grayscale/","title":"Gray scale","text":"

    Note

    Phaser3.60 has a built-in Color Matrix effects.

    "},{"location":"shader-grayscale/#introduction","title":"Introduction","text":"

    Gray scale post processing filter.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-grayscale/#live-demos","title":"Live demos","text":"
    • Gray scale
    "},{"location":"shader-grayscale/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-grayscale/#install-plugin","title":"Install plugin","text":""},{"location":"shader-grayscale/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgrayscalepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgrayscalepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexgrayscalepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexgrayscalepipelineplugin').add(camera, config);\n
    "},{"location":"shader-grayscale/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GrayScalePipelinePlugin from 'phaser3-rex-plugins/plugins/grayscalepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGrayScalePipeline',\nplugin: GrayScalePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').add(camera, config);\n
    "},{"location":"shader-grayscale/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import GrayScalePostFx from 'phaser3-rex-plugins/plugins/grayscalepipeline.js';\nvar config = {\n// ...\npipeline: [GrayScalePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(GrayScalePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(GrayScalePostFx);\n
    "},{"location":"shader-grayscale/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 gray-scale effect.
      var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').add(gameObject, {\n// intensity: 1,\n\n// name: 'rexGrayScalePostFx'\n});\n
      • intensity : 0(original color) ~ 1(gray scale). Default value is 1.
    • Apply effect to camera. A camera only can add 1 gray-scale effect.
      var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').add(camera, config);\n
    "},{"location":"shader-grayscale/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexGrayScalePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexGrayScalePipeline').remove(camera);\n
    "},{"location":"shader-grayscale/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexGrayScalePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexGrayScalePipeline').get(camera);\n
    "},{"location":"shader-grayscale/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(radius);\n
      • intensity : 0(original color) ~ 1(gray scale)
    "},{"location":"shader-horrifi/","title":"Horri-fi","text":""},{"location":"shader-horrifi/#introduction","title":"Introduction","text":"

    6-in-1 post processing filter

    • Bloom
    • Chromatic Abberation
    • Scanlines
    • VHS Distortion
    • CRT TV Curve
    • Noise
    • Vignette

    Reference : Horri-fi shader effect

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-horrifi/#live-demos","title":"Live demos","text":"
    • Horrifi
    "},{"location":"shader-horrifi/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-horrifi/#install-plugin","title":"Install plugin","text":""},{"location":"shader-horrifi/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexhorrifipipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexhorrifipipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexhorrifipipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexhorrifipipelineplugin').add(camera, config);\n
    "},{"location":"shader-horrifi/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import HorrifiPipelinePlugin from 'phaser3-rex-plugins/plugins/horrifipipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexHorrifiPipeline',\nplugin: HorrifiPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').add(camera, config);\n
    "},{"location":"shader-horrifi/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import HorrifiPostFx from 'phaser3-rex-plugins/plugins/horrifipipeline.js';\nvar config = {\n// ...\npipeline: [HorrifiPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(HorrifiPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(HorrifiPostFx);\n
    "},{"location":"shader-horrifi/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 horrifi effect.
      var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').add(gameObject, {\nenable: false,\n\n// Bloom\nbloomEnable: false,\nbloomRadius: 0, bloomIntensity: 0, bloomThreshold: 0,\nbloomTexelWidth: 0, bloomTexelHeight: 0,\n\n// Chromatic abberation\nchromaticEnable: false,\nchabIntensity: 0,\n\n// Vignette\nvignetteEnable: false,\nvignetteStrength: 0, vignetteIntensity: 0,\n\n// Noise\nnoiseEnable: false,\nnoiseStrength: 0,\nnoiseSeed: 0,\n\n// VHS\nvhsEnable: false,\nvhsStrength: 0,\n\n// Scanlines\nscanlinesEnable: false,\nscanStrength: 0,\n\n// CRT\ncrtEnable: false,\ncrtWidth: 0, crtHeight: 0,\n\n// name: 'rexHorrifiPostFx'\n});\n
      • enable : Default enable value for all shader effects.
      • Bloom
        • bloomEnable : Set true to enable bloom effect.
        • bloomRadius, bloomIntensity, bloomThreshold
        • bloomTexelWidth, bloomTexelHeight
      • Chromatic abberation
        • chromaticEnable : Set true to enable chromatic abberation effect.
        • chabIntensity
      • Vignette
        • vignetteEnable : Set true to enable vignette effect.
        • vignetteStrength, vignetteIntensity
      • Noise
        • noiseEnable : Set true to enable noise effect.
        • noiseStrength
        • noiseSeed
      • VHS
        • vhsEnable : Set true to enable VHS effect.
        • vhsStrength
      • Scanlines
        • scanlinesEnable : Set true to enable Scanlines effect.
        • scanStrength
      • CRT
        • crtEnable : Set true to enable Scanlines effect.
        • crtWidth, crtHeight
    • Apply effect to camera. A camera only can add 1 horrifi effect.
      var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').add(camera, config);\n
    "},{"location":"shader-horrifi/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexHorrifiPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexHorrifiPipeline').remove(camera);\n
    "},{"location":"shader-horrifi/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexHorrifiPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexHorrifiPipeline').get(camera);\n
    "},{"location":"shader-horrifi/#bloom","title":"Bloom","text":""},{"location":"shader-horrifi/#enable","title":"Enable","text":"
    • Enable
      pipelineInstance.setBloomEnable();\n// pipelineInstance.setBloomEnable(true);\n
      or
      pipelineInstance.bloomEnable = true;\n
    • Disable
      pipelineInstance.setBloomEnable(false);\n
      or
      pipelineInstance.bloomEnable = false;\n
    • Get
      var bloomEnable = pipelineInstance.bloomEnable;\n
    "},{"location":"shader-horrifi/#parameters","title":"Parameters","text":"
    • Set
      pipelineInstance.setBloomRadius(value);\npipelineInstance.setBloomIntensity(value);\npipelineInstance.setBloomThreshold(value);\npipelineInstance.setBloomTexelSize(width, height);\n
      or
      pipelineInstance.bloomRadius = value;\npipelineInstance.bloomIntensity = value;\npipelineInstance.bloomThreshold = value;\npipelineInstance.bloomTexelWidth = width;\npipelineInstance.bloomTexelHeight = height;\n
    • Get
      var bloomRadius = pipelineInstance.bloomRadius;\nvar bloomIntensity = pipelineInstance.bloomIntensity;\nvar bloomThreshold = pipelineInstance.bloomThreshold;\nvar bloomTexelWidth = pipelineInstance.bloomTexelWidth;\nvar bloomTexelHeight = pipelineInstance.bloomTexelHeight;\n
    "},{"location":"shader-horrifi/#chromatic-abberation","title":"Chromatic abberation","text":""},{"location":"shader-horrifi/#enable_1","title":"Enable","text":"
    • Enable
      pipelineInstance.setChromaticEnable();\n// pipelineInstance.setChromaticEnable(true);\n
      or
      pipelineInstance.chromaticEnable = true;\n
    • Disable
      pipelineInstance.setChromaticEnable(false);\n
      or
      pipelineInstance.chromaticEnable = false;\n
    • Get
      var chromaticEnable = pipelineInstance.chromaticEnable;\n
    "},{"location":"shader-horrifi/#parameters_1","title":"Parameters","text":"
    • Set
      pipelineInstance.setChabIntensity(value);\n
      or
      pipelineInstance.chabIntensity = value;\n
    • Get
      var chabIntensity = pipelineInstance.chabIntensity;\n
    "},{"location":"shader-horrifi/#vignette","title":"Vignette","text":""},{"location":"shader-horrifi/#enable_2","title":"Enable","text":"
    • Enable
      pipelineInstance.setVignetteEnable();\n// pipelineInstance.setVignetteEnable(true);\n
      or
      pipelineInstance.vignetteEnable = true;\n
    • Disable
      pipelineInstance.setVignetteEnable(false);\n
      or
      pipelineInstance.vignetteEnable = false;\n
    • Get
      var vignetteEnable = pipelineInstance.vignetteEnable;\n
    "},{"location":"shader-horrifi/#parameters_2","title":"Parameters","text":"
    • Set
      pipelineInstance.setVignetteStrength(value);\npipelineInstance.setVignetteIntensity(value);\n
      or
      pipelineInstance.vignetteStrength = value;\npipelineInstance.vignetteIntensity = value;\n
    • Get
      var vignetteStrength = pipelineInstance.vignetteStrength;\nvar vignetteIntensity = pipelineInstance.vignetteIntensity;\n
    "},{"location":"shader-horrifi/#noise","title":"Noise","text":""},{"location":"shader-horrifi/#enable_3","title":"Enable","text":"
    • Enable
      pipelineInstance.setNoiseEnable();\n// pipelineInstance.setNoiseEnable(true);\n
      or
      pipelineInstance.noiseEnable = true;\n
    • Disable
      pipelineInstance.setNoiseEnable(false);\n
      or
      pipelineInstance.noiseEnable = false;\n
    • Get
      var noiseEnable = pipelineInstance.noiseEnable;\n
    "},{"location":"shader-horrifi/#parameters_3","title":"Parameters","text":"
    • Set
      pipelineInstance.setNoiseStrength(value);\npipelineInstance.setNoiseSeed(value);\n
      or
      pipelineInstance.noiseStrength = value;\npipelineInstance.noiseSeed = value;\n
    • Get
      var noiseStrength = pipelineInstance.noiseStrength;\nvar noiseSeed = pipelineInstance.noiseSeed;\n
    "},{"location":"shader-horrifi/#vhs","title":"VHS","text":""},{"location":"shader-horrifi/#enable_4","title":"Enable","text":"
    • Enable
      pipelineInstance.setVHSEnable();\n// pipelineInstance.setVHSEnable(true);\n
      or
      pipelineInstance.vhsEnable = true;\n
    • Disable
      pipelineInstance.setVHSEnable(false);\n
      or
      pipelineInstance.vhsEnable = false;\n
    • Get
      var vhsEnable = pipelineInstance.vhsEnable;\n
    "},{"location":"shader-horrifi/#parameters_4","title":"Parameters","text":"
    • Set
      pipelineInstance.setVhsStrength(value);\n
      or
      pipelineInstance.vhsStrength = value;\n
    • Get
      var vhsStrength = pipelineInstance.vhsStrength;\n
    "},{"location":"shader-horrifi/#scanlines","title":"Scanlines","text":""},{"location":"shader-horrifi/#enable_5","title":"Enable","text":"
    • Enable
      pipelineInstance.setScanlinesEnable();\n// pipelineInstance.setScanlinesEnable(true);\n
      or
      pipelineInstance.scanlinesEnable = true;\n
    • Disable
      pipelineInstance.setScanlinesEnable(false);\n
      or
      pipelineInstance.scanlinesEnable = false;\n
    • Get
      var scanlinesEnable = pipelineInstance.scanlinesEnable;\n
    "},{"location":"shader-horrifi/#parameters_5","title":"Parameters","text":"
    • Set
      pipelineInstance.setScanStrength(value);\n
      or
      pipelineInstance.scanStrength = value;\n
    • Get
      var scanStrength = pipelineInstance.scanStrength;\n
    "},{"location":"shader-horrifi/#crt","title":"CRT","text":""},{"location":"shader-horrifi/#enable_6","title":"Enable","text":"
    • Enable
      pipelineInstance.setCRTEnable();\n// pipelineInstance.setCRTEnable(true);\n
      or
      pipelineInstance.crtEnable = true;\n
    • Disable
      pipelineInstance.setCRTEnable(false);\n
      or
      pipelineInstance.crtEnable = false;\n
    • Get
      var crtEnable = pipelineInstance.crtEnable;\n
    "},{"location":"shader-horrifi/#parameters_6","title":"Parameters","text":"
    • Set
      pipelineInstance.setCrtSize(width, height);\n
      or
      pipelineInstance.crtWidth = width;\npipelineInstance.crtHeight = height;\n
    • Get
      var crtWidth = pipelineInstance.crtWidth;\nvar crtHeight = pipelineInstance.crtHeight;\n
    "},{"location":"shader-horrifi/#enable-all-effects","title":"Enable all effects","text":"
    • Enable all
      pipelineInstance.setEnable();\n// pipelineInstance.setEnable(true);\n
    • Disable all
      pipelineInstance.setEnable(false);\n
    "},{"location":"shader-hsladjust/","title":"HSL adjust","text":"

    Note

    Phaser3.60 has a built-in Color Matrix effects.

    "},{"location":"shader-hsladjust/#introduction","title":"Introduction","text":"

    Adjust color in HSL domain, post processing filter.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-hsladjust/#live-demos","title":"Live demos","text":"
    • HSL adjust
    "},{"location":"shader-hsladjust/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-hsladjust/#install-plugin","title":"Install plugin","text":""},{"location":"shader-hsladjust/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexhsladjustpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexhsladjustpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexhsladjustpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexhsladjustpipelineplugin').add(camera, config);\n
    "},{"location":"shader-hsladjust/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import HSLAdjustPipelinePlugin from 'phaser3-rex-plugins/plugins/hsladjustpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexHSLAdjustPipeline',\nplugin: HSLAdjustPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexHSLAdjustPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexHSLAdjustPipeline').add(camera, config);\n
    "},{"location":"shader-hsladjust/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import HSLAdjustPostFx from 'phaser3-rex-plugins/plugins/hsladjustpipeline.js';\nvar config = {\n// ...\npipeline: [HSLAdjustPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(HSLAdjustPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(HSLAdjustPostFx);\n
    "},{"location":"shader-hsladjust/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 hsl-adjust effect.
      var pipelineInstance = scene.plugins.get('rexHslAdjustPipeline').add(gameObject, {\n// hueRotate: 0,\n// satAdjust: 1,\n// lumAdjust: 0.5,\n\n// name: 'rexHslAdjustPostFx'\n});\n
      • hueRotate : Hue rotation
        • 0 : Rotate 0 degrees, original color (Default value)
        • 0.5 : Rotate 180 degrees
        • 1 : Rotate 360 degrees
      • satAdjust : Saturation adjustment
        • 0 : Gray
        • 1 : Original color (Default value)
        • 1 :

      • lumAdjust : Lumen adjustment
        • 0 : Dark
        • 0.5 : Original color (Default value)
        • 1 : White
    • Apply effect to camera. A camera only can add 1 hsl-adjust effect.
      var pipelineInstance = scene.plugins.get('rexHslAdjustPipeline').add(camera, config);\n
    "},{"location":"shader-hsladjust/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexHslAdjustPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexHslAdjustPipeline').remove(camera);\n
    "},{"location":"shader-hsladjust/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexHslAdjustPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexHslAdjustPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexHslAdjustPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexHslAdjustPipeline').get(camera);\n
    "},{"location":"shader-hsladjust/#hue-rotation","title":"Hue rotation","text":"
    • Get
      var hueRotate = pipelineInstance.hueRotate;\n
    • Set
      pipelineInstance.hueRotate = hueRotate;\n// pipelineInstance.hueRotate += value;\n
      or
      pipelineInstance.setHueRotate(value);\n
      • 0 : Rotate 0 degrees, original color
      • 0.5 : Rotate 180 degrees
      • 1 : Rotate 360 degrees
    "},{"location":"shader-hsladjust/#saturation-adjustment","title":"Saturation adjustment","text":"
    • Get
      var satAdjust = pipelineInstance.satAdjust;\n
    • Set
      pipelineInstance.satAdjust = satAdjust;\n// pipelineInstance.satAdjust += value;\n
      or
      pipelineInstance.setSatAdjust(value);\n
      • 0 : Gray
      • 1 : Original color
      • 1 :

    "},{"location":"shader-hsladjust/#lumen-adjustment","title":"Lumen adjustment","text":"
    • Get
      var lumAdjust = pipelineInstance.lumAdjust;\n
    • Set
      pipelineInstance.lumAdjust = lumAdjust;\n// pipelineInstance.lumAdjust += value;\n
      or
      pipelineInstance.setLumAdjust(value);\n
      • 0 : Dark
      • 0.5 : Original color
      • 1 : White
    "},{"location":"shader-inverse/","title":"Inverse","text":"

    Note

    Phaser3.60 has a built-in Color Matrix effects.

    "},{"location":"shader-inverse/#introduction","title":"Introduction","text":"

    Inverse color post processing filter.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-inverse/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-inverse/#install-plugin","title":"Install plugin","text":""},{"location":"shader-inverse/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexinversepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexinversepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexinversepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexinversepipelineplugin').add(camera, config);\n
    "},{"location":"shader-inverse/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import InversePipelinePlugin from 'phaser3-rex-plugins/plugins/inversepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexInversePipeline',\nplugin: InversePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexInversePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexInversePipeline').add(camera, config);\n
    "},{"location":"shader-inverse/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import InversePostFx from 'phaser3-rex-plugins/plugins/inversepipeline.js';\nvar config = {\n// ...\npipeline: [InversePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(InversePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(InversePostFx);\n
    "},{"location":"shader-inverse/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 inverse effect.
      var pipelineInstance = scene.plugins.get('rexInversePipeline').add(gameObject, {\n// intensity: 1,\n\n// name: 'rexInversePostFx'\n});\n
      • intensity : 0(original color) ~ 1(inverse scale). Default value is 1.
    • Apply effect to camera. A camera only can add 1 inverse effect.
      var pipelineInstance = scene.plugins.get('rexInversePipeline').add(camera, config);\n
    "},{"location":"shader-inverse/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexInversePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexInversePipeline').remove(camera);\n
    "},{"location":"shader-inverse/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexInversePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexInversePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexInversePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexInversePipeline').get(camera);\n
    "},{"location":"shader-inverse/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(radius);\n
      • intensity : 0(original color) ~ 1(inverse color)
    "},{"location":"shader-kawaseblur/","title":"Kawase blur","text":"

    Note

    Phaser3.60 has a built-in blur effect.

    "},{"location":"shader-kawaseblur/#introduction","title":"Introduction","text":"

    Kawase-blur post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-kawaseblur/#live-demos","title":"Live demos","text":"
    • Kawase-blur
    "},{"location":"shader-kawaseblur/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-kawaseblur/#install-plugin","title":"Install plugin","text":""},{"location":"shader-kawaseblur/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexkawaseblurpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexkawaseblurpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexkawaseblurpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexkawaseblurpipelineplugin').add(camera, config);\n
    "},{"location":"shader-kawaseblur/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import KawaseBlurPipelinePlugin from 'phaser3-rex-plugins/plugins/kawaseblurpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexKawaseBlurPipeline',\nplugin: KawaseBlurPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').add(camera, config);\n
    "},{"location":"shader-kawaseblur/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import KawaseBlurPostFx from 'phaser3-rex-plugins/plugins/kawaseblurpipeline.js';\nvar config = {\n// ...\npipeline: [KawaseBlurPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(KawaseBlurPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(KawaseBlurPostFx);\n
    "},{"location":"shader-kawaseblur/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 kawaseblur effect.
      var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').add(gameObject, {\n// blur: 4,\n// quality: 3,\n// pixelWidth: 1,\n// pixelHeight: 1,\n\n// name: 'rexKawaseBlurPostFx'\n});\n
      • blur : The blur of the filter. Should be greater than 0. If value is an Array, setting kernels.
      • quality : The quality of the filter. Should be an integer greater than 1.
      • pixelWidth, pixelHeight : Sets the pixel size of the filter. Large size is blurrier. For advanced usage.
    • Apply effect to camera. A camera only can add 1 kawaseblur effect.
      var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').add(camera, config);\n
    "},{"location":"shader-kawaseblur/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexKawaseBlurPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexKawaseBlurPipeline').remove(camera);\n
    "},{"location":"shader-kawaseblur/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexKawaseBlurPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexKawaseBlurPipeline').get(camera);\n
    "},{"location":"shader-kawaseblur/#blur","title":"Blur","text":"
    • Get
      var blur = pipelineInstance.blur;\n
    • Set
      pipelineInstance.blur = blur;\n// pipelineInstance.blur += value;\n
      or
      pipelineInstance.setBlur(value);\n
    "},{"location":"shader-kawaseblur/#quality","title":"Quality","text":"
    • Get
      var quality = pipelineInstance.quality;\n
    • Set
      pipelineInstance.quality = quality;\n// pipelineInstance.quality += value;\n
      or
      pipelineInstance.setQuality(value);\n
    "},{"location":"shader-kawaseblur/#pixel-size","title":"Pixel size","text":"
    • Get
      var pixelWidth = pipelineInstance.pixelWidth;\nvar pixelHeight = pipelineInstance.pixelHeight;\n
    • Set
      pipelineInstance.pixelWidth = pixelWidth;\npipelineInstance.pixelHeight = pixelHeight;\n
      or
      pipelineInstance.setPixelWidth(pixelWidth);\npipelineInstance.setPixelHeight(pixelHeight);\npipelineInstance.setPixelSize(pixelWidth, pixelHeight);\n
    "},{"location":"shader-outline/","title":"Outline","text":""},{"location":"shader-outline/#introduction","title":"Introduction","text":"

    Outline post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-outline/#live-demos","title":"Live demos","text":"
    • Outline
    "},{"location":"shader-outline/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-outline/#install-plugin","title":"Install plugin","text":""},{"location":"shader-outline/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexoutlinepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexoutlinepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexoutlinepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexoutlinepipelineplugin').add(camera, config);\n
    "},{"location":"shader-outline/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import OutlinePipelinePlugin from 'phaser3-rex-plugins/plugins/outlinepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexOutlinePipeline',\nplugin: OutlinePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexOutlinePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexOutlinePipeline').add(camera, config);\n
    "},{"location":"shader-outline/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import OutlinePostFx from 'phaser3-rex-plugins/plugins/outlinepipeline.js';\nvar config = {\n// ...\npipeline: [OutlinePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(OutlinePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(OutlinePostFx);\n
    "},{"location":"shader-outline/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 outline effect.
      var pipelineInstance = scene.plugins.get('rexOutlinePipeline').add(gameObject, {\n// thickness: 3,\n// outlineColor: 0x000000,\n\n// quality: 0.1,\n\n// name: 'rexOutlinePostFx'\n});\n
      • thickness : Thickness of outline.
      • outlineColor : Color of outline.
      • quality : 0~1. The higher the number the less performant. It can't be changed after filter creation.
    • Apply effect to camera. A camera only can add 1 outline effect.
      var pipelineInstance = scene.plugins.get('rexOutlinePipeline').add(camera, config);\n
    "},{"location":"shader-outline/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexOutlinePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexOutlinePipeline').remove(camera);\n
    "},{"location":"shader-outline/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexOutlinePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexOutlinePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexOutlinePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexOutlinePipeline').get(camera);\n
    "},{"location":"shader-outline/#thickness","title":"Thickness","text":"
    • Get
      var thickness = pipelineInstance.thickness;\n
    • Set
      pipelineInstance.thickness = thickness;\n// pipelineInstance.thickness += value;\n
      or
      pipelineInstance.setThickness(value);\n
    "},{"location":"shader-outline/#outline-color","title":"Outline color","text":"
    • Get
      var color = pipelineInstance.outlineColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setOutlineColor(value);\n
      pipelineInstance.outlineColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-outline/#quality","title":"Quality","text":"

    The quality of the outline from 0 to 1, using a higher quality setting will result in slower performance and more accuracy.

    • Get
      var quality = pipelineInstance.quality;\n
    • Set
      pipelineInstance.setQuality(quality);\n
      or
      pipelineInstance.quality = quality;\n
      • quality : 0 ~ 1, default is 0.1.
        • 0.1 : 10 sample points.
        • 0.08 : 8 sample points.
        • 1 : 100 sample points.
    "},{"location":"shader-pixelation/","title":"Pixelation","text":"

    Note

    Phaser3.60 has a built-in pixelate effect.

    "},{"location":"shader-pixelation/#introduction","title":"Introduction","text":"

    Pixelation post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-pixelation/#live-demos","title":"Live demos","text":"
    • Pixelation
    "},{"location":"shader-pixelation/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-pixelation/#install-plugin","title":"Install plugin","text":""},{"location":"shader-pixelation/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexpixelationpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexpixelationpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexpixelationpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexpixelationpipelineplugin').add(camera, config);\n
    "},{"location":"shader-pixelation/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PixelationPipelinePlugin from 'phaser3-rex-plugins/plugins/pixelationpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPixelationPipeline',\nplugin: PixelationPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexPixelationPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexPixelationPipeline').add(camera, config);\n
    "},{"location":"shader-pixelation/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import PixelationPostFx from 'phaser3-rex-plugins/plugins/pixelationpipeline.js';\nvar config = {\n// ...\npipeline: [PixelationPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(PixelationPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(PixelationPostFx);\n
    "},{"location":"shader-pixelation/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 pixelation effect.
      var pipelineInstance = scene.plugins.get('rexPixelationPipeline').add(gameObject, {\n// pixelWidth: 0,\n// pixelHeight: 0,\n\n// name: 'rexPixelationPostFx'\n});\n
      • pixelWidth, pixelHeight : Pixel size.
    • Apply effect to camera. A camera only can add 1 pixelation effect.
      var pipelineInstance = scene.plugins.get('rexPixelationPipeline').add(camera, config);\n
    "},{"location":"shader-pixelation/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexPixelationPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexPixelationPipeline').remove(camera);\n
    "},{"location":"shader-pixelation/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexPixelationPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexPixelationPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexPixelationPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexPixelationPipeline').get(camera);\n
    "},{"location":"shader-pixelation/#pixel-size","title":"Pixel size","text":"
    • Get
      var pixelWidth = pipelineInstance.pixelWidth;\nvar pixelHeight = pipelineInstance.pixelHeight;\n
    • Set
      pipelineInstance.pixelWidth = pixelWidth;\npipelineInstance.pixelHeight = pixelHeight;\n// pipelineInstance.pixelWidth += value;\n// pipelineInstance.pixelHeight += value;\n
      or
      pipelineInstance.setPixelWidth(pixelWidth);\npipelineInstance.setPixelHeight(pixelHeight);\npipelineInstance.setPixelSize(pixelWidth, pixelHeight);\n
    "},{"location":"shader-shockwave/","title":"Shockwave","text":""},{"location":"shader-shockwave/#introduction","title":"Introduction","text":"

    Shockwave post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-shockwave/#live-demos","title":"Live demos","text":"
    • Shockwave
    "},{"location":"shader-shockwave/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-shockwave/#install-plugin","title":"Install plugin","text":""},{"location":"shader-shockwave/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshockwavepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshockwavepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexshockwavepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexshockwavepipelineplugin').add(camera, config);\n
    "},{"location":"shader-shockwave/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ShockwavePipelinePlugin from 'phaser3-rex-plugins/plugins/shockwavepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShockwavePipeline',\nplugin: ShockwavePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexShockwavePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexShockwavePipeline').add(camera, config);\n
    "},{"location":"shader-shockwave/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import ShockwavePostFx from 'phaser3-rex-plugins/plugins/shockwavepipeline.js';\nvar config = {\n// ...\npipeline: [ShockwavePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(ShockwavePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(ShockwavePostFx);\n
    "},{"location":"shader-shockwave/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 shockwave effect.
      var pipelineInstance = scene.plugins.get('rexShockwavePipeline').add(gameObject, {\n// center: {\n//    x: windowWidth / 2,\n//    y: windowHeight / 2\n//}\n// waveRadius: 0,\n// waveWidth: 20,\n// powBaseScale: 0.8,\n// powExponent: 0.1,\n\n// name: 'rexShockwavePostFx'\n});\n
      • waveRadius : Radius of shockwave, in pixels.
      • waveWidth : Width of shockwave, in pixels.
      • powBaseScale, powExponent : Parameters of shockwave.
    • Apply effect to camera. A camera only can add 1 shockwave effect.
      var pipelineInstance = scene.plugins.get('rexShockwavePipeline').add(camera, config);\n
    "},{"location":"shader-shockwave/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexShockwavePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexShockwavePipeline').remove(camera);\n
    "},{"location":"shader-shockwave/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexShockwavePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexShockwavePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexShockwavePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexShockwavePipeline').get(camera);\n
    "},{"location":"shader-shockwave/#wave-radius","title":"Wave radius","text":"
    • Get
      var waveRadius = pipelineInstance.waveRadius;\n
    • Set
      pipelineInstance.waveRadius = waveRadius;\n
      or
      pipelineInstance.setWaveRadius(waveRadius);\n
    "},{"location":"shader-shockwave/#wave-width","title":"Wave width","text":"
    • Get
      var waveWidth = pipelineInstance.waveWidth;\n
    • Set
      pipelineInstance.waveWidth = waveWidth;\n
      or
      pipelineInstance.setWaveWidth(waveWidth);\n
    "},{"location":"shader-split/","title":"Split","text":""},{"location":"shader-split/#introduction","title":"Introduction","text":"

    Split image into 4 parts.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-split/#live-demos","title":"Live demos","text":"
    • Split
    "},{"location":"shader-split/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-split/#install-plugin","title":"Install plugin","text":""},{"location":"shader-split/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexsplitpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexsplitpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexsplitpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexsplitpipelineplugin').add(camera, config);\n
    "},{"location":"shader-split/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SplitPipelinePlugin from 'phaser3-rex-plugins/plugins/splitpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSplitPipeline',\nplugin: SplitPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexSplitPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexSplitPipeline').add(camera, config);\n
    "},{"location":"shader-split/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import SplitPostFx from 'phaser3-rex-plugins/plugins/splitpipeline.js';\nvar config = {\n// ...\npipeline: [SplitPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(SplitPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(SplitPostFx);\n
    "},{"location":"shader-split/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 split effect.
      var pipelineInstance = scene.plugins.get('rexSplitPipeline').add(gameObject, {\n// x: undefined,  // renderer.width / 2\n// y: undefined,  // renderer.height / 2\n\n// width: undefined,\n// left: 0,\n// right: 0,\n// height: undefined,\n// top: 0,\n// bottom: 0,\n\n// angle: undefined,  // Degrees\n// rotation: 0,       // Radian\n\n// shiftEnable: true,\n\n// name: 'rexSplitPostFx'\n});\n
      • x : Vertical split position. Default value is center of render width.
      • y : Horizontal split position. Default value is center of render height.
      • width, height : Vertical/Horizontal split length.
      • left, right : Specify left/right part length of vertical split. Default value is half Vertical split length.
      • top, bottom : Specify top/bottom part length of horizontal split. Default value is half Horizontal split length.
      • angle, rotation : Rotation of split axis. Default value is 0.
      • shiftEnable :
        • true : Shift splitted parts out. Default value.
        • false : Don't shift splitted parts. Equal to apply mask on this image.
    • Apply effect to camera. A camera only can add 1 split effect.
      var pipelineInstance = scene.plugins.get('rexSplitPipeline').add(camera, config);\n
    "},{"location":"shader-split/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexSplitPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexSplitPipeline').remove(camera);\n
    "},{"location":"shader-split/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexSplitPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexSplitPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexSplitPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexSplitPipeline').get(camera);\n
    "},{"location":"shader-split/#split-position","title":"Split position","text":"
    • Get
      var splitX = pipelineInstance.splitX;\nvar splitY = pipelineInstance.splitY;\n
    • Set
      pipelineInstance.splitX = splitX;\npipelineInstance.splitY = splitY;\n
      or
      pipelineInstance.setSplit(x, y);\n
    "},{"location":"shader-split/#split-at-center-of-render","title":"Split at center of render","text":"
    pipelineInstance.splitAtCenter();\n// pipelineInstance.splitAtCenter(width, height);\n
    "},{"location":"shader-split/#split-length","title":"Split length","text":"
    • Get
      var splittedWidth = pipelineInstance.splittedWidth;\nvar splittedHeight = pipelineInstance.splittedHeight;\n
    • Set
      pipelineInstance.splittedWidth = splittedWidth;\npipelineInstance.splittedHeight = splittedHeight;\n
      or
      pipelineInstance.setSplittedWidth(splittedWidth);\npipelineInstance.setSplittedHeight(splittedHeight);\n

    or specify left/right/top/bottom of split length

    • Get
      var left = pipelineInstance.spaceLeft;\nvar right = pipelineInstance.spaceRight;\nvar top = pipelineInstance.spaceTop;\nvar bottom = pipelineInstance.spaceBottom;\n
    • Set
      pipelineInstance.spaceLeft = left;\npipelineInstance.spaceRight = right;\npipelineInstance.spaceTop = top;\npipelineInstance.spaceBottom = bottom;\n
      or
      pipelineInstance.setSpace(left, right, top, bottom);\n
    "},{"location":"shader-split/#rotation-axis-of-split-edge","title":"Rotation Axis of Split edge","text":"
    • Get
      var rotation = pipelineInstance.rotation;  // radians\n// var angle = pipelineInstance.angle;     // degrees\n
    • Set
      pipelineInstance.rotation = rotation;\npipelineInstance.rotation += value;\n// pipelineInstance.angle = angle;\n// pipelineInstance.angle += value;\n
      or
      pipelineInstance.setRotation(rotation);\n// pipelineInstance.setAngle(angle);\n
    "},{"location":"shader-split/#shift-enable","title":"Shift enable","text":"
    • Get
      var enable = pipelineInstance.shiftEnable;\n
    • Set
      pipelineInstance.shiftEnable = enable;\n
      or
      pipelineInstance.setShiftEnable(enable);\n
    "},{"location":"shader-swirl/","title":"Swirl","text":""},{"location":"shader-swirl/#introduction","title":"Introduction","text":"

    Swirl post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-swirl/#live-demos","title":"Live demos","text":"
    • Swirl
    "},{"location":"shader-swirl/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-swirl/#install-plugin","title":"Install plugin","text":""},{"location":"shader-swirl/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexswirlpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexswirlpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexswirlpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexswirlpipelineplugin').add(camera, config);\n
    "},{"location":"shader-swirl/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SwirlPipelinePlugin from 'phaser3-rex-plugins/plugins/swirlpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSwirlPipeline',\nplugin: SwirlPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexSwirlPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexSwirlPipeline').add(camera, config);\n
    "},{"location":"shader-swirl/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import SwirlPostFx from 'phaser3-rex-plugins/plugins/swirlpipeline.js';\nvar config = {\n// ...\npipeline: [SwirlPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(SwirlPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(SwirlPostFx);\n
    "},{"location":"shader-swirl/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 swirl effect.
      var pipelineInstance = scene.plugins.get('rexSwirlPipeline').add(gameObject, {\n// center: {\n//    x: windowWidth / 2,\n//    y: windowHeight / 2\n//}\n// radius: 0,\n// rotation: 0,  // or angle: 0,\n\n// name: 'rexSwirlPostFx'\n});\n
      • center.x, center.y : Local position of swirl center.
      • radius : Swirl radius.
      • rotation (angle) : Swirl angle.
    • Apply effect to camera. A camera only can add 1 swirl effect.
      var pipelineInstance = scene.plugins.get('rexSwirlPipeline').add(camera, config);\n
    "},{"location":"shader-swirl/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexSwirlPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexSwirlPipeline').remove(camera);\n
    "},{"location":"shader-swirl/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexSwirlPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexSwirlPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexSwirlPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexSwirlPipeline').get(camera);\n
    "},{"location":"shader-swirl/#radius","title":"Radius","text":"
    • Get
      var radius = pipelineInstance.radius;\n
    • Set
      pipelineInstance.radius = radius;\n// pipelineInstance.radius += value;\n
      or
      pipelineInstance.setRadius(radius);\n
    "},{"location":"shader-swirl/#rotation","title":"Rotation","text":"
    • Get
      var rotation = pipelineInstance.rotation;  // radians\n// var angle = pipelineInstance.angle;     // degrees\n
    • Set
      pipelineInstance.rotation = rotation;\npipelineInstance.rotation += value;\n// pipelineInstance.angle = angle;\n// pipelineInstance.angle += value;\n
      or
      pipelineInstance.setRotation(rotation);\n// pipelineInstance.setAngle(angle);\n
    "},{"location":"shader-swirl/#center-position","title":"Center position","text":"

    Default value is center of window.

    • Get
      var x = pipelineInstance.centerX;\nvar y = pipelineInstance.centerY;\n
    • Set
      pipelineInstance.centerX = x;\npipelineInstance.centerY = y;\n
      or
      pipelineInstance.setCenter(x, y);\n// pipelineInstance.setCenter();   // set to center of window\n
    "},{"location":"shader-toonify/","title":"Toonify","text":""},{"location":"shader-toonify/#introduction","title":"Introduction","text":"

    Draw outlines and quantize color in HSV domain, post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-toonify/#live-demos","title":"Live demos","text":"
    • Toonify
    "},{"location":"shader-toonify/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-toonify/#install-plugin","title":"Install plugin","text":""},{"location":"shader-toonify/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextoonifypipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextoonifypipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rextoonifypipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rextoonifypipelineplugin').add(camera, config);\n
    "},{"location":"shader-toonify/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ToonifyPipelinePlugin from 'phaser3-rex-plugins/plugins/toonifypipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexToonifyPipeline',\nplugin: ToonifyPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexToonifyPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexToonifyPipeline').add(camera, config);\n
    "},{"location":"shader-toonify/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import ToonifyPostFx from 'phaser3-rex-plugins/plugins/toonifypipeline.js';\nvar config = {\n// ...\npipeline: [ToonifyPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(ToonifyPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(ToonifyPostFx);\n
    "},{"location":"shader-toonify/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 toonify effect.
      var pipelineInstance = scene.plugins.get('rexToonifyPipeline').add(gameObject, {\n// edgeThreshold: 0.2,\n// hueLevels: 0,\n// sLevels: 0,\n// vLevels: 0,\n// edgeColor: 0,\n\n// name: 'rexToonifyPostFx'\n});\n
      • edgeThreshold : Threshold of edge. Set 1.1 (or any number larger then 1) to disable this feature.
      • hueLevels : Amount of hue levels. Set 0 to disable this feature.
      • sLevels : Amount of saturation levels. Set 0 to disable this feature.
      • vLevels : Amount of value levels. Set 0 to disable this feature.
      • edgeColor : Color of edge, could be a number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    • Apply effect to camera. A camera only can add 1 toonify effect.
      var pipelineInstance = scene.plugins.get('rexToonifyPipeline').add(camera, config);\n
    "},{"location":"shader-toonify/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexToonifyPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexToonifyPipeline').remove(camera);\n
    "},{"location":"shader-toonify/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexToonifyPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexToonifyPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexToonifyPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexToonifyPipeline').get(camera);\n
    "},{"location":"shader-toonify/#edge-threshold","title":"Edge threshold","text":"
    • Get
      var edgeThreshold = pipelineInstance.edgeThreshold;\n
    • Set
      pipelineInstance.edgeThreshold = edgeThreshold;\n
      or
      pipelineInstance.setEdgeThreshold(value);\n
      • Set 1.1 (or any number larger then 1) to disable this feature.
    "},{"location":"shader-toonify/#hue-levels","title":"Hue levels","text":"
    • Get
      var hueLevels = pipelineInstance.hueLevels;\n
    • Set
      pipelineInstance.hueLevels = hueLevels;\n
      or
      pipelineInstance.setHueLevels(value);\n
      • Set 0 to disable this feature.
    "},{"location":"shader-toonify/#saturation-levels","title":"Saturation levels","text":"
    • Get
      var satLevels = pipelineInstance.satLevels;\n
    • Set
      pipelineInstance.satLevels = satLevels;\n
      or
      pipelineInstance.setSatLevels(value);\n
      • Set 0 to disable this feature.
    "},{"location":"shader-toonify/#value-levels","title":"Value levels","text":"
    • Get
      var valLevels = pipelineInstance.valLevels;\n
    • Set
      pipelineInstance.valLevels = valLevels;\n
      or
      pipelineInstance.setValLevels(value);\n
      • Set 0 to disable this feature.
    "},{"location":"shader-toonify/#edge-color","title":"Edge color","text":"
    • Get
      var color = pipelineInstance.edgeColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setEdgeColor(value);\n
      or
      pipelineInstance.edgeColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-warp-transition/","title":"Warp","text":""},{"location":"shader-warp-transition/#introduction","title":"Introduction","text":"

    Warp transition post processing filter.

    • Author: Richard Davey
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-warp-transition/#usage","title":"Usage","text":"

    Reference

    "},{"location":"shader-warp-transition/#install-plugin","title":"Install plugin","text":""},{"location":"shader-warp-transition/#import-class","title":"Import class","text":"
    • Get minify file from github
    • Add to game config
      import { WarpPostFX } from './dist/WarpPostFX.js';  // Path to your minify file\nvar config = {\n// ...\npipeline: { WarpPostFX }\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(WarpPostFX);\n
      • Apply effect to camera
        camera.setPostPipeline(WarpPostFX);\n
    "},{"location":"shader-warp-transition/#remove-effect","title":"Remove effect","text":"
    gameObject.removePostPipeline(WarpPostFX); // WarpPostFX class\n
    "},{"location":"shader-warp-transition/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = gameObject.getPostPipeline(WarpPostFX); // WarpPostFX class\n
    • Get effect from camera
      var pipelineInstance = camera.getPostPipeline(WarpPostFX); // WarpPostFX class\n
    "},{"location":"shader-warp-transition/#set-texture","title":"Set texture","text":"
    pipelineInstance.setTexture(textureKey, resizeMode);\n
    • textureKey : The key of the texture to use.
    • resizeMode :
      • 0, or 'stretch' : The target texture is stretched to the size of the source texture.
      • 1, or 'contain' : The target texture is resized to fit the source texture.
      • 2, or 'cover' : The target texture is resized to cover the source texture.
    "},{"location":"shader-warp-transition/#progress","title":"Progress","text":"
    • Get
      var progress = pipelineInstance.progress;\n
    • Set
      pipelineInstance.setProgress(value);  // value: 0~1\n
      or
      pipelineInstance.progress = value;  // value: 0~1\n
    "},{"location":"shader-warp-transition/#direction","title":"Direction","text":"
    • Get
      var direction = pipelineInstance.direction;  // {x, y}\n
      • Default value is {x:-1, y:1}
    • Set
      pipelineInstance.setDirection(x, y);  // x, y : 1, or -1\n
    "},{"location":"shader-warp-transition/#smoothness","title":"Smoothness","text":"
    • Get
      var smoothness = pipelineInstance.smoothness;\n
    • Set
      pipelineInstance.setSmoothness(value);  // value: 0~1\n
      or
      pipelineInstance.smoothness = value;  // value: 0~1\n
    "},{"location":"shader-warp-transition/#resize-mode","title":"Resize mode","text":"
    • Get
      var mode = pipelineInstance.resizeMode;\n
    • Set
      pipelineInstance.setResizeMode(mode);\n
      • mode :
        • 0, or 'stretch' : The target texture is stretched to the size of the source texture.
        • 1, or 'contain' : The target texture is resized to fit the source texture.
        • 2, or 'cover' : The target texture is resized to cover the source texture.
    "},{"location":"shader-warp/","title":"Warp","text":""},{"location":"shader-warp/#introduction","title":"Introduction","text":"

    Warp post processing filter.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-warp/#live-demos","title":"Live demos","text":"
    • Warp
    "},{"location":"shader-warp/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-warp/#install-plugin","title":"Install plugin","text":""},{"location":"shader-warp/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexwarppipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexwarppipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexwarppipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexwarppipelineplugin').add(camera, config);\n
    "},{"location":"shader-warp/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import WarpPipelinePlugin from 'phaser3-rex-plugins/plugins/warppipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexWarpPipeline',\nplugin: WarpPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexWarpPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexWarpPipeline').add(camera, config);\n
    "},{"location":"shader-warp/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import WarpPostFx from 'phaser3-rex-plugins/plugins/warppipeline.js';\nvar config = {\n// ...\npipeline: [WarpPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(WarpPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(WarpPostFx);\n
    "},{"location":"shader-warp/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 warp effect.

      var pipelineInstance = scene.plugins.get('rexWarpPipeline').add(gameObject, {\n// frequencyX: 10,\n// frequencyY: 10,\n\n// amplitudeX: 10,\n// amplitudeY: 10,\n\n// speedX: 0,\n// speedY: 0,\n// speedEnable: \n\n// name: 'rexWarpPostFx'\n});\n

      • frequencyX, frequencyY : Horizontal/vertical frequency, in pixel.
      • amplitudeX, amplitudeY : Horizontal/vertical amplitude, in pixel.
      • speedX, speedY : Horizontal/vertical speed.
      • speedEnable
        • true : Enable speed. Default value if speedX or speedY is not 0.
        • false : Disable speed. Default value if speedX and speedY are both 0.
    • Apply effect to camera. A camera only can add 1 warp effect.

      var pipelineInstance = scene.plugins.get('rexWarpPipeline').add(camera, config);\n

    "},{"location":"shader-warp/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexWarpPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexWarpPipeline').remove(camera);\n
    "},{"location":"shader-warp/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexWarpPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexWarpPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexWarpPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexWarpPipeline').get(camera);\n
    "},{"location":"shader-warp/#frequency","title":"Frequency","text":"

    Horizontal/vertical frequency, in pixel.

    • Get
      var frequencyX = pipelineInstance.frequencyX;\nvar frequencyY = pipelineInstance.frequencyY;\n
    • Set
      pipelineInstance.frequencyX = frequencyX;\npipelineInstance.frequencyY = frequencyY;\n// pipelineInstance.frequencyX += value;\n// pipelineInstance.frequencyY += value;\n
      or
      pipelineInstance.setFrequencyX(frequencyX);\npipelineInstance.setFrequencyY(frequencyY);\npipelineInstance.setFrequency(frequencyX, frequencyY);\n
    "},{"location":"shader-warp/#amplitude","title":"Amplitude","text":"

    Horizontal/vertical amplitude, in pixel.

    • Get
      var amplitudeX = pipelineInstance.amplitudeX;\nvar amplitudeY = pipelineInstance.amplitudeY;\n
    • Set
      pipelineInstance.amplitudeX = amplitudeX;\npipelineInstance.amplitudeY = amplitudeY;\n// pipelineInstance.amplitudeX += value;\n// pipelineInstance.amplitudeY += value;\n
      or
      pipelineInstance.setAmplitudeX(amplitudeX);\npipelineInstance.setAmplitudeY(amplitudeY);\npipelineInstance.setAmplitude(amplitudeX, amplitudeY);\n
    "},{"location":"shader-warp/#speed","title":"Speed","text":"

    Horizontal/vertical speed.

    • Eanble/resume
      pipelineInstance.setSpeedEnable();\n
    • Pause
      pipelineInstance.setSpeedEnable(false);\n
    • Get
      var speedX = pipelineInstance.speedX;\nvar speedY = pipelineInstance.speedY;\n
    • Set
      pipelineInstance.speedX = speedX;\npipelineInstance.speedY = speedY;\n// pipelineInstance.speedX += value;\n// pipelineInstance.speedY += value;\n
      or
      pipelineInstance.setSpeedX(speedX);\npipelineInstance.setSpeedY(speedY);\npipelineInstance.setSpeed(speedX, speedY);\n
    "},{"location":"shader/","title":"Shader","text":""},{"location":"shader/#introduction","title":"Introduction","text":"

    A quad with its own shader, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shader/#usage","title":"Usage","text":""},{"location":"shader/#load-glsl","title":"Load GLSL","text":"
    scene.load.glsl(key, url);\n

    Reference: load glsl

    "},{"location":"shader/#add-shader-object","title":"Add shader object","text":"
    var shader = scene.add.shader(key, x, y, width, height, textures);\n
    • key : The key of the shader to use from the shader cache, or a BaseShader instance.
    • x, y : Position.
    • width, height : Size.
    • textures : Optional array of texture keys to bind to the iChannel0, iChannel1, iChannel2, iChannel3 uniforms.

    Note

    Lots of shaders expect textures to be power-of-two sized.

    Add shader object from JSON

    var shader = scene.make.shader({\nx: 0,\ny: 0,\nkey: '',\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    • key : The key of the shader to use from the shader cache, or a BaseShader instance.
      • A string
      • An array of string to pick one element at random
    • x, y, scale.x, scale.y :
      • A number
      • A callback to get return value
        function() { return 0; }\n
      • Random integer between min and max
        { randInt: [min, max] }\n
      • Random float between min and max
        { randFloat: [min, max] }\n
    "},{"location":"shader/#custom-class","title":"Custom class","text":"
    • Define class
      class MyShader extends Phaser.GameObjects.Shader {\nconstructor(scene, key, x, y, width, height, textures) {\nsuper(scene, key, x, y, width, height, textures);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var shader = new MyShader(scene, key, x, y, width, height, textures);\n
    "},{"location":"shader/#sampler2d-uniform","title":"Sampler2D uniform","text":"
    • Default uniform mappings :
      • resolution (2f) - Set to the size of this shader.
        • uniform vec2 resolution; in GLSL.
      • time (1f) - The elapsed game time, in seconds.
        • uniform float time; in GLSL.
      • mouse (2f) - If a pointer has been bound (with setPointer), this uniform contains its position each frame.
        • uniform vec2 mouse; in GLSL.
      • date (4fv) - A vec4 containing the year, month, day and time in seconds.
        • uniform vec4 date; in GLSL.
      • sampleRate (1f) - Sound sample rate. 44100 by default.
        • uniform float sampleRate; in GLSL.
      • iChannel0...3 (sampler2D) - Input channels 0 to 3. null by default. uniform sampler2D iChannel0; in GLSL.
    • Get uniform object
      var uniform = shader.getUniform(key);\n
      • Texture key
        var textureKey = uniform.textureKey;\n
      • Get texture key of iChannel0, iChannel1, iChannel2, iChannel3 sampler2D uniform.
        var textureKey = shader.getUniform('iChannel0').textureKey;\nvar textureKey = shader.getUniform('iChannel1').textureKey;\nvar textureKey = shader.getUniform('iChannel2').textureKey;\nvar textureKey = shader.getUniform('iChannel3').textureKey;\n
    • Sets a property of a uniform already present on this shader.
      shader.setUniform(key, value);\n
      • key : The key of the uniform to modify. Use dots for deep properties, i.e. resolution.value.x.
    • Sets a sampler2D uniform from texture manager.
      shader.setChannel0(textureKey);\nshader.setChannel1(textureKey);\nshader.setChannel2(textureKey);\nshader.setChannel3(textureKey);\n// shader.setChannel0(textureKey, textureData);\n// shader.setChannel1(textureKey, textureData);\n// shader.setChannel2(textureKey, textureData);\n// shader.setChannel3(textureKey, textureData);\n
      or
      shader.setSampler2D(uniformKey, textureKey, textureIndex);\n// shader.setSampler2D(uniformKey, textureKey, textureIndex, textureData);\n
      • uniformKey : 'iChannel0', 'iChannel1', 'iChannel2', or 'iChannel3'.
      • textureIndex : 0(for iChannel0), 1(for iChannel1), 2(for iChannel2), 3(for iChannel3).
      • textureData : Additional texture data.
      • textureKey: Key from the Texture Manager cache. It cannot be a single frame from a texture, only the full image. Lots of shaders expect textures to be power-of-two sized.
    • Sets a sampler2D uniform from a webgl texture.
      shader.setSampler2DBuffer(uniformKey, texture, width, height, textureIndex);\n// shader.setSampler2DBuffer(uniformKey, texture, width, height, textureIndex, textureData);\n
      • uniformKey : 'iChannel0', 'iChannel1', 'iChannel2', or 'iChannel3'.
      • width, height : The width, height of the texture.
      • textureIndex : 0(for iChannel0), 1(for iChannel1), 2(for iChannel2), 3(for iChannel3).
      • textureData : Additional texture data.
    "},{"location":"shader/#other-uniforms","title":"Other uniforms","text":"
    • mouse, a pointer parameter.
      • Get
        var pointer = shader.pointer;\n
      • Set
        shader.setPointer(pointer);\n
        • pointer : {x, y}
    • time, the elapsed game time, in seconds.
      • Get
        var time = shader.getUniform('time').value;\n// var time = shader.uniforms.time.value\n
      • Set
        shader.setUniform('time.value', time);\n
    "},{"location":"shader/#output","title":"Output","text":"
    • Render to Display list, by default.
    • Redirect render result to internal webgl texture.
      shader.setRenderToTexture();\nvar texture = shader.glTexture;\n
    • Redirect render result to internal webgl texture, and sample2D from buffer.
      shader.setRenderToTexture(undefined, true);\nvar texture = shader.glTexture;\n
    • Redirect render result to texture manager, for texture-based game object.
      shader.setRenderToTexture(textureKey);\n// var texture = shader.glTexture;\n
    • Redirect render result to texture manager, and Sample2D from buffer.
      shader.setRenderToTexture(textureKey, true);\n// var texture = shader.glTexture;\n
    "},{"location":"shader/#texture-routing","title":"Texture routing","text":"
    graph TB\n\nTextureManagerIn[\"Texture manager\"] --> |\"shader.setSampler2D()\"| Sampler2D[\"Samplers:<br>iChannel0<br>iChannel1<br>iChannel2<br>iChannel3\"]\nSampler2D--> Shader[\"shader<br>Shader game object\"]\nShader --> DisplayList[\"Display list\"]\nShader --> |\"shader.setRenderToTexture()\"| InternalTexture[\"shader.glTexture\"]\nInternalTexture -.-> |\"Texture key\"| TextureManagerOut[\"Texture manager\"]\nTextureManagerOut -.-> GameObject[\"Image game object\"]\nGameObject -.-> DisplayList\n\nWebGLTexture[\"WebGl texture<br>gameObject.glTexture\"] --> |\"shader.setSampler2DBuffer()\"| Sampler2D\nInternalTexture --> WebGLTexture\n\nsubgraph Output\nDisplayList\nGameObject\nTextureManagerOut\nend\n\nsubgraph Input\nTextureManagerIn\nWebGLTexture\nend
    "},{"location":"shader/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shader/#create-mask","title":"Create mask","text":"
    var mask = shader.createBitmapMask();\n

    See mask

    "},{"location":"shader/#baseshader","title":"BaseShader","text":"
    var baseShader = new Phaser.Display.BaseShader(key, fragmentSrc, vertexSrc, uniforms);\n
    • key : The key of this shader
    • fragmentSrc : The fragment source for the shader.
    • vertexSrc : The vertex source for the shader.
      • undefined, or '' : Use default vertex source.
    • uniforms : Optional object defining the uniforms the shader uses.
      {\nuniformName : {type: uniformType, value: initValue},\n...\n}\n
      • uniformName : Uniform name in fragment source.
      • uniformType, initValue : Type and initial value of uniform.
        • '1f' : initValue is a single float value.
          • Example : time: { type: '1f', value: 0 }
        • '2f' : initValue is float numbers {x, y}.
          • Example : resolution: { type: '2f', value: { x: this.width, y: this.height } }
        • '3f' : initValue is float numbers {x, y, z}.
          • Example : color: { type: '3f', value: {x: 0, y: 0, z: 0}}
        • '4f' : initValue is float numbers {x, y, z, w}.
    "},{"location":"shake-position/","title":"Shake position","text":""},{"location":"shake-position/#introduction","title":"Introduction","text":"

    Shake position of game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"shake-position/#live-demos","title":"Live demos","text":"
    • Shake position
    • Shake position on mutliple game objects
    "},{"location":"shake-position/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shake-position/#install-plugin","title":"Install plugin","text":""},{"location":"shake-position/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshakepositionplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshakepositionplugin.min.js', true);\n
    • Add shake-position behavior
      var shakePosition = scene.plugins.get('rexshakepositionplugin').add(gameObject, config);\n
    "},{"location":"shake-position/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ShakePositionPlugin from 'phaser3-rex-plugins/plugins/shakeposition-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShakePosition',\nplugin: ShakePositionPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shake-position behavior
      var shakePosition = scene.plugins.get('rexShakePosition').add(gameObject, config);\n
    "},{"location":"shake-position/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ShakePosition from 'phaser3-rex-plugins/plugins/shakeposition.js';\n
    • Add shake-position behavior
      var shakePosition = new ShakePosition(gameObject, config);\n
    "},{"location":"shake-position/#create-instance","title":"Create instance","text":"
    var shake = scene.plugins.get('rexShake').add(gameObject, {\n// mode: 1, // 0|'effect'|1|'behavior'\n// duration: 500,\n// magnitude: 10,\n// magnitudeMode: 1, // 0|'constant'|1|'decay'\n// axis: 0,      //0|'both'|'h&v'|1|'horizontal'|'h'|2|'vertical'|'v'\n});\n
    • mode :
      • 'effect', or 0 : Shake position in 'poststep' game event, and restore in 'prestep' game event.
      • 'behavior', or 1 : Shake position in 'preupdate' scene event.
    • duration : Duration of shaking, in millisecond.
    • magnitude : The strength of the shake, in pixels.
    • magnitudeMode :
      • 'constant', or 0 : Constant strength of the shake.
      • 'decay', or 1 : Decay the strength of the shake.
    • axis :
      • 'both','h&v', 'x&y', or 0 : Changing position on all directions.
      • 'horizontal','h', 'x', or 1 : Changing position on horizontal/x axis.
      • 'vertical','v', 'y', or 2 : Changing position on vertical/y axis.
    "},{"location":"shake-position/#start-shaking","title":"Start shaking","text":"
    shake.shake();\n// shake.shake(duration, magnitude);\n

    or

    shake.shake({\nduration: 500,\nmagnitude: 10\n});\n
    "},{"location":"shake-position/#stop-shakeing","title":"Stop shakeing","text":"
    shake.stop();\n
    "},{"location":"shake-position/#enable","title":"Enable","text":"
    • Enable/resume (default)
      shake.setEnable();\n
      or
      shake.enable = true;\n
    • Disable/pause
      shake.setEnable(false);\n
      or
      shake.enable = false;\n
    "},{"location":"shake-position/#set-updating-mode","title":"Set updating mode","text":"
    shake.setMode(mode);\n
    • mode :
      • 'effect', or 0 : Shake position in post-update stage, and restore in pre-update stage.
      • 'behavior', or 1 : Shake position in pre-update stage.
    "},{"location":"shake-position/#set-duration","title":"Set duration","text":"
    shake.setDuration(duration);\n// shake.duration = duration;\n
    "},{"location":"shake-position/#set-magnitude","title":"Set magnitude","text":"
    shake.setMagnitude(magnitude);\nshake.magnitude = magnitude;\n
    • magnitude : The strength of the shake, in pixels.
    "},{"location":"shake-position/#set-magnitude-mode","title":"Set magnitude mode","text":"
    shake.setMagnitudeMode(magnitudeMode);\n// shake.magnitudeMode = magnitudeMode;\n
    • magnitudeMode :
      • 'constant', or 0 : Constant strength of the shake.
      • 'decay', or 1 : Decay the strength of the shake.
    "},{"location":"shake-position/#set-axis-mode","title":"Set axis mode","text":"
    shake.setAxisMode(axis);\n
    • axis :
      • 'both','h&v', 'x&y', or 0 : Dragging on all directions.
      • 'horizontal','h', 'x', or 1 : Dragging on horizontal/x axis.
      • 'vertical','v', 'y', or 2 : Dragging on vertical/y axis.
    "},{"location":"shake-position/#events","title":"Events","text":"
    • On reached target
      shake.on('complete', function(gameObject, shake){});\n
    "},{"location":"shake-position/#status","title":"Status","text":"
    • Is shakeing
      var isRunning = shake.isRunning;\n
    "},{"location":"shape-arc/","title":"Arc","text":""},{"location":"shape-arc/#introduction","title":"Introduction","text":"

    Arc shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-arc/#usage","title":"Usage","text":""},{"location":"shape-arc/#create-shape","title":"Create shape","text":"
    var arc = scene.add.arc(x, y, radius, startAngle, endAngle, anticlockwise, fillColor);\n// var arc = scene.add.arc(x, y, radius, startAngle, endAngle, anticlockwise, fillColor, fillAlpha);\n
    "},{"location":"shape-arc/#custom-class","title":"Custom class","text":"
    • Define class
      class MyArc extends Phaser.GameObjects.Arc {\nconstructor(scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor) {\nsuper(scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var arc = new MyArc(scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor);\n
    "},{"location":"shape-arc/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = arc.fillColor;\nvar alpha = arc.fillAlpha;\n
      • Set
        arc.setFillStyle(color, alpha);\n
      • Clear
        arc.setFillStyle();\n
    • Stroke color
      • Get
        var color = arc.strokeColor;\n
      • Set
        arc.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        arc.setStrokeStyle();\n

    No tint methods

    Uses arc.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-arc/#alpha","title":"Alpha","text":"
    • Get
      var alpha = arc.alpha;\n
    • Set
      arc.setAlpha(alpha);\n// arc.alpha = alpha;\n
    "},{"location":"shape-arc/#angle","title":"Angle","text":"
    • Start angle, in degrees.
      • Get
        var startAngle = arc.startAngle;\n
      • Set
        arc.setStartAngle(startAngle);\n// arc.setStartAngle(startAngle, anticlockwise);\n
        or
        arc.startAngle = startAngle;\n
    • End angle, in degrees.
      • Get
        var endAngle = arc.endAngle;\n
      • Set
        arc.seEndAngle(endAngle);\n
        or
        arc.endAngle = endAngle;\n
    • Anticlockwise (true, or false)
      • Get
        var anticlockwise = arc.anticlockwise;\n
      • Set
        arc.anticlockwise = anticlockwise;\n
    "},{"location":"shape-arc/#radius","title":"Radius","text":"
    • Radius
      • Get
        var radius = arc.radius;\n
      • Set
        arc.setRadius(radius);\n
        or
        arc.radius = radius;\n
    • Iterations: Increase this value for smoother arcs, at the cost of more polygons being rendered. Default is 0.01
      • Get
        var iterations = arc.iterations;\n
      • Set
        arc.iterations = iterations;\n
    "},{"location":"shape-arc/#display-size","title":"Display size","text":"
    • Get
      var width = arc.displayWidth;\nvar height = arc.displayHeight;\n
    • Set
      arc.setDisplaySize(width, height);\n
      or
      arc.displayWidth = width;\narc.displayHeight = height;\n
    "},{"location":"shape-arc/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-arc/#create-mask","title":"Create mask","text":"
    var mask = arc.createGeometryMask();\n

    See mask

    "},{"location":"shape-arc/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-checkbox/","title":"Checkbox","text":""},{"location":"shape-checkbox/#introduction","title":"Introduction","text":"

    Checkbox input with drawing checker path animation.

    • Author: Rex
    • Game object
    "},{"location":"shape-checkbox/#live-demos","title":"Live demos","text":"
    • Checkbox
    "},{"location":"shape-checkbox/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-checkbox/#install-plugin","title":"Install plugin","text":""},{"location":"shape-checkbox/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcheckboxplugin', 'https://raw.githubusercontent.com/rexrainbow/    phaser3-rex-notes/master/dist/rexcheckboxplugin.min.js', true);\n
    • Add checkbox input
      var checkbox = scene.add.rexCheckbox(x, y, width, height, color, config);\n
    • Add checkbox shape (without click input)
      var checkbox = scene.add.rexCheckboxShape(x, y, width, height, color, config);\n
    "},{"location":"shape-checkbox/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CheckboxPlugin from 'phaser3-rex-plugins/plugins/checkbox-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCheckboxPlugin',\nplugin: CheckboxPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add checkbox input
      var checkbox = scene.add.rexCheckbox(x, y, width, height, color, config);\n
    • Add checkbox shape (without click input)
      var checkbox = scene.add.rexCheckboxShape(x, y, width, height, color, config);\n
    "},{"location":"shape-checkbox/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Checkbox from 'phaser3-rex-plugins/plugins/checkbox.js';\n
    • Add checkbox input
      var checkbox = new Checkbox(scene, x, y, width, height, color, config);\nscene.add.existing(checkbox);\n
    • Add checkbox shape (without click input)
      // import CheckboxShape from 'phaser3-rex-plugins/plugins/checkboxshape.js';\nvar checkbox = new CheckboxShape(scene, x, y, width, height, color, config);\nscene.add.existing(checkbox);\n
    "},{"location":"shape-checkbox/#create-checkbox-input","title":"Create checkbox input","text":"
    var checkbox = scene.add.rexCheckbox(x, y, width, height, color, config);\n

    or

    var checkbox = scene.add.rexCheckbox({\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\ncolor: 0x005cb2,\nboxFillAlpha: 1,\nuncheckedColor: null,\nuncheckedBoxFillAlpha: 1,\n\nboxLineWidth: 4,\nboxStrokeColor: 0x005cb2,\nboxStrokeAlpha: 1,\nuncheckedBoxStrokeColor: 0x005cb2,\nuncheckedBoxStrokeAlpha: 1,\n\ncheckerColor: 0xffffff,\ncheckerAlpha: 1,\n\n// boxSize: 1,\n// checkerSize: 1,\n\ncircleBox: false,\n\nanimationDuration: 150,\n\nchecked: false, // or value: false,\n\nclick: undefined,\n// click: {\n//     mode: 1,            // 0|'press'|1|'release'\n//     clickInterval: 100  // ms\n//     threshold: undefined\n// },\nreadOnly: false,\n});\n
    • width, height : Size of checkbox.
    • Box fill style
      • color, boxFillAlpha : Box color and alpha of checked
      • uncheckedColor, uncheckedBoxFillAlpha : Box color and alpha of unchecked
    • Box stroke style
      • boxLineWidth, boxStrokeColor, boxStrokeAlpha : Box stroke color and alpha of checked.
      • uncheckedBoxStrokeColor, uncheckedBoxStrokeAlpha : Box stroke color and alpha of unchecked.
    • Checker style
      • checkerColor, checkerAlpha : Checker color and alpha
    • circleBox : Shape of box
      • false : Rectangle shape box. Default behavior.
      • true : Circle shape box
    • boxSize, checkerSize : Size ratio of box, and checker. Default value is 1.
    • animationDuration : Duration of drawing path of checker.
    • checked : Initial value of checked.
    • click : Configuration of click input
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
      • click.threshold : Cancel clicking detecting when dragging distance is larger then this threshold.
        • undefined : Ignore this feature. Default behavior.
    • readOnly : Set ture to disable input.
    "},{"location":"shape-checkbox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCheckbox extends RexPlugins.GameObjects.Checkbox {\nconstructor(scene, x, y, width, height, color, config) {\nsuper(scene, x, y, width, height, color, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var checkbox = new MyCheckbox(scene, x, y, width, height, color, config);\n
    "},{"location":"shape-checkbox/#check","title":"Check","text":"
    • Get
      var checked = checkbox.checked;\n// var checked = checkbox.value;\n
    • Set
      • Check
        checkbox.setChecked();\n// checkbox.setChecked(true);\n// checkbox.setValue(true);\n
        or
        checkbox.checked = true;\n// checkbox.value = true;\n
      • Uncheck
        checkbox.setChecked(false);\n// checkbox.setValue(false);\n
        or
        checkbox.checked = false;\n// checkbox.value = false;\n
      • Toggle
        checkbox.toggleChecked();\n// checkbox.setValue(!checkbox.checked);\n
        or
        checkbox.checked = !checkbox.checked;\n// checkbox.value = !checkbox.value;\n
    "},{"location":"shape-checkbox/#read-only","title":"Read only","text":"
    • Get
      var readOnly = checkbox.readOnly;\n
    • Set
      checkbox.setReadOnly();\n// checkbox.setReadOnly(true);\n
      or
      checkbox.readOnly = true;\n
    "},{"location":"shape-checkbox/#box-fill-style","title":"Box fill style","text":"
    • Get
      var color = checkbox.boxFillColor;\nvar alpha = checkbox.boxFillAlpha;\n
      var color = checkbox.uncheckedBoxFillColor;\nvar alpha = checkbox.uncheckedBoxFillAlpha;\n
    • Set
      checkbox.setBoxFillStyle(color, alpha);\n// checkbox.boxFillColor = color;\n// checkbox.boxFillAlpha = alpha;\n
      checkbox.setUncheckedBoxFillStyle(color, alpha);\n// checkbox.uncheckedBoxFillColor = color;\n// checkbox.uncheckedBoxFillAlpha = alpha;\n
    "},{"location":"shape-checkbox/#box-stroke-style","title":"Box stroke style","text":"
    • Get
      var lineWidth = checkbox.boxLineWidth;\nvar color = checkbox.boxStrokeColor;\nvar alpah = checkbox.boxStrokeAlpha;\n
      var lineWidth = checkbox.uncheckedBoxLineWidth;\nvar color = checkbox.uncheckedBoxStrokeColor;\nvar alpah = checkbox.uncheckedBoxStrokeAlpha;\n
    • Set
      checkbox.setBoxStrokeStyle(lineWidth, color, alpha);\n// checkbox.boxLineWidth = lineWidth;\n// checkbox.boxStrokeColor = color;\n// checkbox.boxStrokeAlpha = alpha;\n
      checkbox.setUncheckedBoxStrokeStyle(lineWidth, color, alpha);\n// checkbox.uncheckedBoxLineWidth = lineWidth;\n// checkbox.uncheckedBoxStrokeColor = color;\n// checkbox.uncheckedBoxStrokeAlpha = alpha;\n
    "},{"location":"shape-checkbox/#checker-style","title":"Checker style","text":"
    • Get
      var color = checkbox.checkerColor;\nvar alpha = checkbox.checkAlpha;\n
    • Set
      checkbox.setCheckerStyle(color, alpha);\n// checkbox.checkerColor = color;\n// checkbox.checkAlpha = alpha;\n
    "},{"location":"shape-checkbox/#checker-animation","title":"Checker animation","text":"
    • Duration
      • Get
        var duration = checkbox.checkerAnimDuration;\n
      • Set
        checkbox.setCheckerAnimDuration(duration);\ncheckbox.checkerAnimDuration = duration;\n
    "},{"location":"shape-checkbox/#size","title":"Size","text":"
    • Get
      var width = checkbox.width;\nvar height = checkbox.height;\n
    • Set
      checkbox.setSize(width, height);\n
      or
      checkbox.width = width;\ncheckbox.height = height;\n
    "},{"location":"shape-checkbox/#display-size","title":"Display size","text":"
    • Get
      var width = checkbox.displayWidth;\nvar height = checkbox.displayHeight;\n
    • Set
      checkbox.setDisplaySize(width, height);\n
      or
      checkbox.displayWidth = width;\ncheckbox.displayHeight = height;\n
    "},{"location":"shape-checkbox/#size-ratio","title":"Size ratio","text":"
    • Get
      var boxSize = checkbox.boxSize;\nvar checkerSize =checkbox.checkerSize;\n
      • boxSize, checkerSize : Size ratio of box, and checker
    • Set
      checkbox.setBoxSize(sizeRatio);\ncheckbox.setCheckerSize(sizeRatio);\n
    "},{"location":"shape-checkbox/#events","title":"Events","text":"
    • On value change
      checkbox.on('valuechange', function(value) {\n// value: checked\n})\n
    "},{"location":"shape-checkbox/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-checkbox/#create-mask","title":"Create mask","text":"
    var mask = checkbox.createGeometryMask();\n

    See mask

    "},{"location":"shape-checkbox/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-circle/","title":"Circle","text":""},{"location":"shape-circle/#introduction","title":"Introduction","text":"

    Circle shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-circle/#usage","title":"Usage","text":""},{"location":"shape-circle/#create-shape-object","title":"Create shape object","text":"
    var circle = scene.add.circle(x, y, radius, fillColor);\n// var circle = scene.add.circle(x, y, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-circle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCircle extends Phaser.GameObjects.Arc {\nconstructor(scene, x, y, radius, fillColor, fillAlpha) {\nsuper(scene, x, y, radius, 0, 360, false, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var circle = new MyCircle(scene, x, y, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-circle/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = circle.fillColor;\nvar alpha = circle.fillAlpha;\n
      • Set
        circle.setFillStyle(color, alpha);\n
      • Clear
        circle.setFillStyle();\n
    • Stroke color
      • Get
        var color = circle.strokeColor;\n
      • Set
        circle.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        circle.setStrokeStyle();\n

    No tint methods

    Uses circle.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-circle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = circle.alpha;\n
    • Set
      circle.setAlpha(alpha);\n// circle.alpha = alpha;\n
    "},{"location":"shape-circle/#radius","title":"Radius","text":"
    • Radius
      • Get
        var radius = circle.radius;\n
      • Set
        circle.setRadius(radius);\n
        or
        circle.radius = radius;\n
    • Iterations: Increase this value for smoother arcs, at the cost of more polygons being rendered. Default is 0.01
      • Get
        var iterations = circle.iterations;\n
      • Set
        circle.iterations = iterations;\n
    "},{"location":"shape-circle/#display-size","title":"Display size","text":"
    • Get
      var width = circle.displayWidth;\nvar height = circle.displayHeight;\n
    • Set
      circle.setDisplaySize(width, height);\n
      or
      circle.displayWidth = width;\ncircle.displayHeight = height;\n
    "},{"location":"shape-circle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-circle/#create-mask","title":"Create mask","text":"
    var mask = circle.createGeometryMask();\n

    See mask

    "},{"location":"shape-circle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-circularprogress/","title":"Circular progress","text":""},{"location":"shape-circularprogress/#introduction","title":"Introduction","text":"

    Circular progress bar shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-circularprogress/#live-demos","title":"Live demos","text":"
    • Circular-progress
    • Pie bar
    "},{"location":"shape-circularprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-circularprogress/#install-plugin","title":"Install plugin","text":""},{"location":"shape-circularprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcircularprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcircularprogressplugin.min.js', true);\n
    • Add circular-progress object
      var circularProgress = scene.add.rexCircularProgress(x, y, radius, color, value, config);\n
    "},{"location":"shape-circularprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CircularProgressPlugin from 'phaser3-rex-plugins/plugins/circularprogress-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircularProgressPlugin',\nplugin: CircularProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add circular-progress object
      var circularProgress = scene.add.rexCircularProgress(x, y, radius, color, value, config);\n
    "},{"location":"shape-circularprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CircularProgress from 'phaser3-rex-plugins/plugins/circularprogress.js';\n
    • Add circular-progress object
      var circularProgress = new CircularProgress(scene, x, y, radius, color, value, config);\nscene.add.existing(image);\n
    "},{"location":"shape-circularprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircularProgressPlugin',\nplugin: CircularProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"shape-circularprogress/#create-instance","title":"Create instance","text":"
    var circularProgress = scene.add.rexCircularProgress(x, y, radius, barColor, value, {    trackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nanticlockwise: false,\n// iterations: 128,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n

    or

    var circularProgress = scene.add.rexCircularProgress({\nx: 0,\ny: 0,\nradius: 1,\n\nbarColor: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nanticlockwise: false,\n// iterations: 128,\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},  });\n
    • x, y : Position of this object.
    • radius : Radius of this circle. Size will be (radius*2, radius*2).
    • barColor : Color of circular bar, in number or css string value.
    • trackColor : Color of circular track, in number or css string value.
    • centerColor : Color of center circle, in number or css string value.
    • thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
    • startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
    • anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
    • iterations : Iterations of curve, set larger value to get more smooth rendering result. Default value is 128.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, circularProgress) {\n}\n

    Add circular-progress from JSON

    var circularProgress = scene.make.rexCircularProgress({\nx: 0,\ny: 0,\nradius: 1,\n\nbarColor: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nanticlockwise: false,\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},  add: true\n});\n
    "},{"location":"shape-circularprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCircularProgress extends CircularProgress {\nconstructor(scene, x, y, radius, color, value, config) {\nsuper(scene, x, y, radius, color, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var circularProgress = new MyCircularProgress(scene, x, y, radius, color, value, config);\n
    "},{"location":"shape-circularprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = circularProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = circularProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = circularProgress.value; // value: 0 ~ 1\n
    • Set value
      circularProgress.setValue(value, min, max); // value: min ~ max\n
      or
      circularProgress.setValue(value); // value: 0 ~ 1\n
      or
      circularProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      circularProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      circularProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      circularProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"shape-circularprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      circularProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      circularProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      circularProgress.stopEaseValue();\n
    • Set ease duration
      circularProgress.setEaseValueDuration(duration);\n
    • Set ease function
      circularProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"shape-circularprogress/#radius","title":"Radius","text":"
    • Get
      var radius = circularProgress.radius;\n
    • Set
      circularProgress.setRadius(radius);\n// circularProgress.radius = radius;\n
      • Also resize this game object to (radius*2, radius*2)
    "},{"location":"shape-circularprogress/#circular-track","title":"Circular track","text":"
    • Color
      • Get
        var trackColor = circularProgress.trackColor;\n
      • Set
        circularProgress.setTrackColor(trackColor);\n// circularProgress.trackColor = trackColor;\n
    • Thickness : radius*thickness
      circularProgress.setThickness(thickness);\n
      • thickness : 0~1.
    "},{"location":"shape-circularprogress/#circular-bar","title":"Circular bar","text":"
    • Color
      • Get
        var barColor = circularProgress.barColor;\n
      • Set
        circularProgress.setBarColor(barColor);\n// circularProgress.barColor = barColor;\n
    • Thickness : radius*thickness
      circularProgress.setThickness(thickness);\n
      • thickness : 0~1.
    • Start angle
      • Get
        var startAngle = circularProgress.startAngle;\n
      • Set
        circularProgress.setStartAngle(startAngle);\ncircularProgress.startAngle = startAngle;\n
        • startAngle : Start angle of circular bar, in radians.
    • Anticlockwise
      • Get
        var anticlockwise = circularProgress.anticlockwise;\n
      • Set
        circularProgress.setAnticlockwise(anticlockwise);\n// circularProgress.anticlockwise = anticlockwise;\n
    "},{"location":"shape-circularprogress/#center-circle","title":"Center circle","text":"
    • Color
      • Get
        var centerColor = circularProgress.centerColor;\n
      • Set
        circularProgress.setCenterColor(centerColor);\n// circularProgress.centerColor = centerColor;\n
    "},{"location":"shape-circularprogress/#events","title":"Events","text":"
    • On value changed
      circularProgress.on('valuechange', function(newValue, oldValue, circularProgress){\n//\n}, scope);\n
    "},{"location":"shape-circularprogress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = circularProgress.alpha;\n
    • Set
      circularProgress.setAlpha(alpha);\n// circularProgress.alpha = alpha;\n
    "},{"location":"shape-circularprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-circularprogress/#create-mask","title":"Create mask","text":"
    var mask = circularProgress.createGeometryMask();\n

    See mask

    "},{"location":"shape-circularprogress/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-circularprogress/#compare-with-circular-progress-canvas","title":"Compare with Circular-progress canvas","text":"
    • Circular-progress canvas creates a canvas then draw on that canvas, circular progress shape draw on GRAPHICS pipeline like Shape or Graphics game object.
    • Circular-progress canvas can draw text directly, circular progress shape can't draw any text.
    "},{"location":"shape-cover/","title":"Cover","text":""},{"location":"shape-cover/#introduction","title":"Introduction","text":"

    Rectangle shape covered full window, and block all touch events.

    • Author: Rex
    • Game object
    "},{"location":"shape-cover/#live-demos","title":"Live demos","text":"
    • Cover
    "},{"location":"shape-cover/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-cover/#install-plugin","title":"Install plugin","text":""},{"location":"shape-cover/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcoverplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcoverplugin.min.js', true);\n
    • Add cover object
      var cover = scene.add.rexCover(config);\n
    "},{"location":"shape-cover/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CoverPlugin from 'phaser3-rex-plugins/plugins/cover-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCoverPlugin',\nplugin: CoverPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add cover object
      var cover = scene.add.rexCover(config);\n
    "},{"location":"shape-cover/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Cover from 'phaser3-rex-plugins/plugins/cover.js';\n
    • Add cover object
      var cover = new Cover(scene, config);\nscene.add.existing(cover);\n
    "},{"location":"shape-cover/#create-cover-object","title":"Create cover object","text":"
    var cover = scene.add.rexCover({\n// color: 0x0,\n// alpha: 0.8\n});\n
    • color : Color of cover.
    • alpha : Alpha value of cover.
    "},{"location":"shape-cover/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCover extends RexPlugins.GameObjects.Cover {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var cover = new MyCover(scene, config);\n
    "},{"location":"shape-cover/#color","title":"Color","text":"
    • Tint
      • Get
        var tint = cover.tint;\n
      • Set
        cover.tint = tint;\n
    • Alpha
      • Get
        var alpha = cover.alpha;\n
      • Set
        cover.alpha = alpha;\n
    • Fill color
      • Get
        var color = cover.fillColor;\nvar alpha = cover.fillAlpha;\n
      • Set
        cover.setFillStyle(color, alpha);\n
      • Clear
        cover.setFillStyle();\n
    "},{"location":"shape-cover/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-cover/#create-mask","title":"Create mask","text":"
    var mask = cover.createGeometryMask();\n

    See mask

    "},{"location":"shape-cover/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-curve/","title":"Curve","text":""},{"location":"shape-curve/#introduction","title":"Introduction","text":"

    Curve shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-curve/#usage","title":"Usage","text":""},{"location":"shape-curve/#create-shape-object","title":"Create shape object","text":"
    var curve = scene.add.curve(x, y, path, fillColor);\n// var curve = scene.add.curve(x, y, path, fillColor, fillAlpha);\n
    • path : Path object.
    "},{"location":"shape-curve/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCurve extends Phaser.GameObjects.Curve {\nconstructor(scene, x, y, path, fillColor, fillAlpha) {\nsuper(scene, x, y, path, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var curve = new MyCurve(scene, x, y, path, fillColor, fillAlpha);\n
    "},{"location":"shape-curve/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = curve.fillColor;\nvar alpha = curve.fillAlpha;\n
      • Set
        curve.setFillStyle(color, alpha);\n
      • Clear
        curve.setFillStyle();\n
    • Stroke color
      • Get
        var color = curve.strokeColor;\n
      • Set
        curve.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        curve.setStrokeStyle();\n

    No tint methods

    Uses curve.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-curve/#alpha","title":"Alpha","text":"
    • Get
      var alpha = curve.alpha;\n
    • Set
      curve.setAlpha(alpha);\n// curve.alpha = alpha;\n
    "},{"location":"shape-curve/#smoothness","title":"Smoothness","text":"

    The number of points used when rendering it. Increase this value for smoother curves, at the cost of more polygons being rendered.

    curve.setSmoothness(smoothness);\n
    or
    curve.smoothness = smoothness;\n

    "},{"location":"shape-curve/#display-size","title":"Display size","text":"
    • Get
      var width = curve.displayWidth;\nvar height = curve.displayHeight;\n
    • Set
      curve.setDisplaySize(width, height);\n
      or
      curve.displayWidth = width;\ncurve.displayHeight = height;\n
    "},{"location":"shape-curve/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-curve/#create-mask","title":"Create mask","text":"
    var mask = curve.createGeometryMask();\n

    See mask

    "},{"location":"shape-curve/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-custom-progress/","title":"Custom progress","text":""},{"location":"shape-custom-progress/#introduction","title":"Introduction","text":"

    Custom progress bar based on custom-shapes.

    • Author: Rex
    • Game object
    "},{"location":"shape-custom-progress/#live-demos","title":"Live demos","text":"
    • React-circle-progress-bar
    • Round rectangle
    • Orb
    • Trapezoid Mask
    • Round rectangles mask
    • Slash effect with rexUI
    • Path segment animation
    "},{"location":"shape-custom-progress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-custom-progress/#install-plugin","title":"Install plugin","text":""},{"location":"shape-custom-progress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcustomprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcustomprogressplugin.min.js', true);\n
    • Add custom shapes object
      var customProgress = scene.add.rexCustomProgress(x, y, width, height, config);\n
    "},{"location":"shape-custom-progress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CustomProgressPlugin from 'phaser3-rex-plugins/plugins/customprogress-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCustomProgressPlugin',\nplugin: CustomProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add custom shapes object
      var customProgress = scene.add.rexCustomProgress(x, y, width, height, config);\n
    "},{"location":"shape-custom-progress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CustomProgress from 'phaser3-rex-plugins/plugins/bbcodetext.js';\n
    • Add custom shapes object
      var customProgress = new CustomProgress(scene, x, y, width, height, config);\nscene.add.existing(customProgress);\n
    "},{"location":"shape-custom-progress/#add-custom-shapes-object","title":"Add custom shapes object","text":"
    var customProgress = scene.add.rexCustomProgress(x, y, width, height, {\n// type: 'rexCustomProgress',\n\ncreate: [\n{ name: name0, type: shapeType},\n{ name: name1, type: shapeType},\n...\n],\n\n// create: {\n//     shapeType: [name0, name1, ...],\n//     shapeType: number,\n//     shapeType: name,\n// },\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n

    or

    var customProgress = scene.add.rexCustomProgress({\n// x: 0,\n// y: 0,\n// width: 64,\n// height: 64,\n// type: 'rexCustomProgress',\n\ncreate: [\n{ name: name0, type: shapeType},\n{ name: name1, type: shapeType},\n...\n],\n\n// create: {\n//     shapeType: [name0, name1, ...],\n//     shapeType: number,\n//     shapeType: name,\n// },\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\n\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • create : Callback to create shapes
      • An array of object with name and type
        { name: name0, type: shapeType }\n
        • shapeType :
          • 'arc' : Create Arc shape.
          • 'circle' : Create Circle shape.
          • 'ellipse' : Create Ellipse shape.
          • 'line' : Create Line shape.
          • 'lines' : Create Lines shape.
          • 'rectangle' : Create Rectangle shape.
          • 'roundRectangle' : Create Round rectangle shape.
          • 'triangle' : Create Triangle shape.
      • A plain object with shapeType: name, or shapeType: number
        • shapeType : arc, circle, ellipse, line, rectangle, triangle
        • nameArray : An array of unique string name for each shape.
        • name : An unique string name of this shape.
        • number : Amount of shapes to create.
      • A callback
        function() {\n// this : This custom shapes game object\nvar shape = this.createShape(shapeType, name);\nthis.addShape(shape);\n}\n
        • this.createShape(shapeType, name) : Crate a shape instance, with an unique name.
        • this.addShape(shape) : Add this shape instance to this custom custom shapes.
    • update : Callback when refresh
      function() {\n// this : This custom shapes game object     \nvar shapes = this.getShapes();\nvar shape = this.getShape(name);\n// ...\n// var isSizeChanged = this.isSizeChanged;\n\n// var fillColor = this.fillColor;\n// var fillAlpha = this.fillAlpha;\n// var lineWidth = this.lineWidth;\n// var strokeColor = this.strokeColor;\n// var strokeAlpha = this.strokeAlpha;\n// ...\n// var value = this.value;\n}\n
      • Shape instances : Change properties of shape instances.
        • this.getShapes() : Return all shapes in an array.
        • this.getShape(name) : Return a shape by the unique string name.
      • Is size changed : this.isSizeChanged
      • Fill style : this.fillColor, this.fillAlpha
      • Stroke style : this.strokeColor, this.strokeAlpha, this.lineWidth
      • Current progress value : this.value
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, customProgress) {\n}\n
    "},{"location":"shape-custom-progress/#set-update-shape-callback","title":"Set update shape callback","text":"

    See Shape class

    "},{"location":"shape-custom-progress/#size","title":"Size","text":"

    See Size

    "},{"location":"shape-custom-progress/#styles","title":"Styles","text":"

    See Styles

    "},{"location":"shape-custom-progress/#recreate-shapes","title":"Recreate shapes","text":"

    See Shape class

    "},{"location":"shape-custom-progress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = customProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = customProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = customProgress.value; // value: 0 ~ 1\n
    • Set value
      customProgress.setValue(value, min, max); // value: min ~ max\n
      or
      customProgress.setValue(value); // value: 0 ~ 1\n
      or
      customProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      customProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      customProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      customProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"shape-custom-progress/#ease-progress-value","title":"Ease progress value","text":"
    • Set ease duration
      customProgress.setEaseValueDuration(duration);\n
    • Set ease function
      customProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    • Ease value to
      customProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      customProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Ease value repeat
      customProgress.easeValueRepeat(from, to);  // from, to: 0 ~ 1\n// customProgress.easeValueRepeat(from, to, repeat, repeatDelay);\n
    • Stop ease
      customProgress.stopEaseValue();\n
    "},{"location":"shape-custom-progress/#refresh","title":"Refresh","text":"

    Redraw shapes when

    • Value changed : customProgress.setValue(newValue), customProgress.easeValueTo(newValue)
    • Resize : customProgress.resize(width, height)
    • Set dirty : customProgress.setDirty()
    • Set update shape callback : customProgress.setUpdateShapesCallback(callback)
    "},{"location":"shape-custom-progress/#shape-class","title":"Shape class","text":"

    See Shape class

    "},{"location":"shape-custom-progress/#events","title":"Events","text":"
    • On value changed
      customProgress.on('valuechange', function(newValue, oldValue, customProgress){\n//\n}, scope);\n
    "},{"location":"shape-custom-progress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = customProgress.alpha;\n
    • Set
      customProgress.setAlpha(alpha);\n// customProgress.alpha = alpha;\n
    "},{"location":"shape-custom-progress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-custom-progress/#create-mask","title":"Create mask","text":"
    var mask = customProgress.createGeometryMask();\n

    See mask

    "},{"location":"shape-custom-progress/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-custom-shapes/","title":"Custom shapes","text":""},{"location":"shape-custom-shapes/#introduction","title":"Introduction","text":"

    Custom shapes on shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-custom-shapes/#live-demos","title":"Live demos","text":"
    • Speech bubble
    • Jigsaw
    • Checkbox
    • World to localXY
    "},{"location":"shape-custom-shapes/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-custom-shapes/#install-plugin","title":"Install plugin","text":""},{"location":"shape-custom-shapes/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcustomshapesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcustomshapesplugin.min.js', true);\n
    • Add custom shapes object
      var customShapes = scene.add.rexCustomShapes(x, y, width, height, config);\n
    "},{"location":"shape-custom-shapes/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CustomShapesPlugin from 'phaser3-rex-plugins/plugins/customshapes-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCustomShapesPlugin',\nplugin: CustomShapesPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add custom shapes object
      var customShapes = scene.add.rexCustomShapes(x, y, width, height, config);\n
    "},{"location":"shape-custom-shapes/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CustomShapes from 'phaser3-rex-plugins/plugins/bbcodetext.js';\n
    • Add custom shapes object
      var customShapes = new CustomShapes(scene, x, y, width, height, config);\nscene.add.existing(customShapes);\n
    "},{"location":"shape-custom-shapes/#add-custom-shapes-object","title":"Add custom shapes object","text":"
    var customShapes = scene.add.rexCustomShapes(x, y, width, height, {\n// type: 'rexCustomShapes',\n\ncreate: [\n{ name: name0, type: shapeType},\n{ name: name1, type: shapeType},\n...\n],\n\n// create: {\n//     shapeType: [name0, name1, ...],\n//     shapeType: number,\n//     shapeType: name,\n// },\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n});\n

    or

    var customShapes = scene.add.rexCustomShapes({\n// x: 0,\n// y: 0,\n// width: 64,\n// height: 64,\n// type: 'rexCustomShapes',\n\ncreate: [\n{ name: name0, type: shapeType},\n{ name: name1, type: shapeType},\n...\n],\n\n// create: {\n//     shapeType: [name0, name1, ...],\n//     shapeType: number,\n//     shapeType: name,\n// },\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • create : Callback to create shapes
      • An array of object with name and type
        { name: name0, type: shapeType }\n
        • shapeType :
          • 'arc' : Create Arc shape.
          • 'circle' : Create Circle shape.
          • 'ellipse' : Create Ellipse shape.
          • 'line' : Create Line shape.
          • 'lines' : Create Lines shape.
          • 'rectangle' : Create Rectangle shape.
          • 'roundRectangle' : Create Round rectangle shape.
          • 'triangle' : Create Triangle shape.
      • A plain object with shapeType: name, or shapeType: number
        • shapeType : arc, circle, ellipse, line, rectangle, triangle
        • nameArray : An array of unique string name for each shape.
        • name : An unique string name of this shape.
        • number : Amount of shapes to create.
      • A callback
        function() {\n// this : This custom shapes game object\nvar shape = this.createShape(shapeType, name);\nthis.addShape(shape);\n}\n
        • this.createShape(shapeType, name) : Crate a shape instance, with an unique name.
        • this.addShape(shape) : Add this shape instance to this custom custom shapes.
    • update : Callback when refresh
      function() {\n// this : This custom shapes game object     \nvar shapes = this.getShapes();\nvar shape = this.getShape(name);\n// ...\n// var isSizeChanged = this.isSizeChanged;\n\n// var fillColor = this.fillColor;\n// var fillAlpha = this.fillAlpha;\n// var lineWidth = this.lineWidth;\n// var strokeColor = this.strokeColor;\n// var strokeAlpha = this.strokeAlpha;\n}\n
      • Shape instances : Change properties of shape instances.
        • this.getShapes() : Return all shapes in an array.
        • this.getShape(name) : Return a shape by the unique string name.
      • Is size changed : this.isSizeChanged
      • Fill style : this.fillColor, this.fillAlpha
      • Stroke style : this.strokeColor, this.strokeAlpha, this.lineWidth
    "},{"location":"shape-custom-shapes/#set-update-shape-callback","title":"Set update shape callback","text":"
    customShapes.setUpdateShapesCallback(callback);\n
    • callback :
      function() {\n// this : This custom shapes game object     \nvar shapes = this.getShapes();\nvar shape = this.getShape(name);\n// ...\n// var isSizeChanged = this.isSizeChanged;\n}\n
      • Shape instances : Change properties of shape instances.
        • this.getShapes() : Return all shapes in an array.
        • this.getShape(name) : Return a shape by the unique string name.
      • Is size changed: this.isSizeChanged
    "},{"location":"shape-custom-shapes/#size","title":"Size","text":"

    customShapes.setSize(width, height);\n
    or
    customShapes.resize(width, height);\n
    or
    customShapes.width = width;\ncustomShapes.height = height;\n

    Will set dirty and redraw shapes

    "},{"location":"shape-custom-shapes/#styles","title":"Styles","text":"
    • Fill style
      customShapes.setFillStyle(color, alpha);\n
      or
      customShapes.fillColor = color;\ncustomShapes.fillAlpha = alpha;\n
    • Stroke style
      customShapes.setStrokeStyle(lineWidth, color, alpha);\n
      or
      customShapes.lineWidth = lineWidth;\ncustomShapes.strokeColor = color;\ncustomShapes.strokeAlpha = alpha;\n

    Will set dirty and redraw shapes. Apply styles to shapes in update callback.

    "},{"location":"shape-custom-shapes/#world-position-to-local-position","title":"World position to local position","text":"
    var localXY = customShapes.worldToLocalXY(worldX, worldY); // localXY: {x, y}\n

    or

    var out = customShapes.worldToLocalXY(worldX, worldY, camera, out);\n
    "},{"location":"shape-custom-shapes/#recreate-shapes","title":"Recreate shapes","text":"
    • Clear all shapes
      customShapes.clear();\n
    • Add new shape
      customShapes.createShape(shapeType, name);\n
      • shapeType :
        • 'arc' : Create Arc shape.
        • 'circle' : Create Circle shape.
        • 'ellipse' : Create Ellipse shape.
        • 'line' : Create Line shape.
        • 'lines' : Create Lines shape.
        • 'rectangle' : Create Rectangle shape.
        • 'roundRectangle' : Create Round rectangle shape.
        • 'triangle' : Create Triangle shape.
      • name : A string name of this shape.
    "},{"location":"shape-custom-shapes/#refresh","title":"Refresh","text":"

    Redraw shapes when

    • Resize : customShapes.resize(width, height)
      • customShapes.isSizeChanged will also be true.
    • Set fill color : customShapes.setFillStyle(color, alpha)
    • Set stroke color : customShapes.setStrokeStyle(lineWidth, color, alpha)
    • Set dirty : customShapes.setDirty()
    • Set update shape callback : customShapes.setUpdateShapesCallback(callback)
    "},{"location":"shape-custom-shapes/#update-shape-data","title":"Update shape data","text":"

    Shape data will be updated during rendering, or call shape.updateData() to update shape data before rendering.

    "},{"location":"shape-custom-shapes/#shape-class","title":"Shape class","text":""},{"location":"shape-custom-shapes/#common-properties","title":"Common properties","text":"
    • Style
      • Get
        var fillColor = shape.fillColor;\nvar fillAlpha = shape.fillAlpha;\nvar lineWidth = shape.lineWidth;\nvar strokeColor = shape.strokeColor;\nvar strokeAlpha = shape.strokeAlpha;\n
      • Set
        shape.fillStyle(color, alpha);\nshape.lineStyle(lineWidth, color, alpha);\n
      • Clear
        shape.fillStyle().lineStyle();\n
    • Visible
      • Get
        var visible = shape.visible;\n
      • Set javascript shape.setVisible(visible);
    • Private data
      • Get
        var data = shape.getData(key);\n// var data = shape.getData(key, defaultValue);\n
      • Set
        shape.setData(key, value);\n
        or
        shape.setData({key:value, ...});\n
      • Inc
        shape.incData(key, incValue);\n// shape.incData(key, incValue, defaultValue);\n
      • Mul
        shape.mulData(key, mulValue);\n// shape.mulData(key, mulValue, defaultValue);\n
      • Clear
        shape.clearData();\n
    • Name
      • Get
        var name = shape.name;\n
    "},{"location":"shape-custom-shapes/#line","title":"Line","text":"
    • End points
      • Get
        var x0 = line.x0;\nvar y0 = line.y0;\nvar x1 = line.x1;\nvar y1 = line.y1;\n
      • Set
        line.setP0(x, y);\nline.setP1(x, y);\n
        or
        line.x0 = x0;\nline.y0 = y0;\nline.x1 = x1;\nline.y1 = y1;\n
    "},{"location":"shape-custom-shapes/#lines","title":"Lines","text":""},{"location":"shape-custom-shapes/#create-path","title":"Create path","text":"
    • Start, clear points data
      lines.start();\n
    • Start at position, clear points data
      lines.startAt(x, y);\n
    • Line to
      • To position
        lines.lineTo(x, y);\n
      • To relative position
        lines.lineTo(x, y, true);\n
      • To vertical position
        lines.verticalLineTo(x);\n
      • To relative vertical position
        lines.verticalLineTo(x, true);\n
      • To horizontal position
        lines.horizontalLineTo(y);\n
      • To relative horizontal position
        lines.horizontalLineTo(y, true);\n
    • Add arc composed of lines
      lines.arc(centerX, centerY, radius, startAngle, endAngle, anticlockwise);\n
      • startAngle, endAngle : Start and end angle in degrees.
    • Add elliptical arc composed of lines
      lines.ellipticalArc(centerX, centerY, radiusX, radiusY, startAngle, endAngle, anticlockwise);\n
      • startAngle, endAngle : Start and end angle in degrees.
    • Add quadratic bezier of lines
      lines.quadraticBezierTo(cx, cy, x, y);\n
      • cx, cy : Control point
      • x, y : End point
    • Add smooth quadratic bezier of lines
      lines.smoothQuadraticBezierTo(x, y);\n
      • x, y : End point
    • Add cubic bezier of lines
      lines.cubicBezierCurveTo(cx0, cy0, cx1, cy1, x, y);\n
      • cx0, cy0 : Control point0
      • cx1, cy1 : Control point1
      • x, y : End point
    • Add smooth cubic bezier of lines
      lines.smoothCubicBezierCurveTo(cx1, cy1, x, y);\n
      • cx1, cy1 : Control point1
      • x, y : End point
    • End commands
      • Close path, to fill color
        lines.close();\n
      • End path, to draw lines only
        lines.end();\n
    • Copy path from another lines
      lines.copyPathFrom(srcLine);\n
      or
      lines.copyPathFrom(srcLine, startT, endT);\n
    • Append path from another lines
      lines.appendPathFrom(srcLine);\n
      or
      lines.appendPathFrom(srcLine, startT, endT);\n
    "},{"location":"shape-custom-shapes/#transform","title":"Transform","text":"
    • Offset all points
      lines.offset(x, y);\n
    • Rotation all points
      lines.rotateAround(centerX, centerY, angle);\n
      • angle : Rotate angle in degrees.
    "},{"location":"shape-custom-shapes/#display-path-segment","title":"Display path segment","text":"
    1. Create path, under customShapes.isSizeChanged condition.
    2. Display segment of path
      lines.setDisplayPathSegment(startT, endT);\n
      or
      lines.setDisplayPathSegment(endT);  // startT = 0\n
      • startT, endT : 0~1. Start, end position on path, in percentage of path.
        • 0 : Start position of path
        • 1 : End position of path
    "},{"location":"shape-custom-shapes/#misc","title":"Misc","text":"
    • Get polygon
      var polygon = lines.toPolygon();\n
      • Can be used in setInteractive method
        shape.setInteractive({\nhitArea: shape.getShapes()[0].toPolygon(),\nhitAreaCallback: Phaser.Geom.Polygon.Contains,\n})\n
    • Position of first or last point
      var p0x = lines.firstPointX;\nvar p0y = lines.firstPointY;\nvar pNx = lines.lastPointX;\nvar pNy = lines.lastPointY;\n
    "},{"location":"shape-custom-shapes/#rectangle","title":"Rectangle","text":"
    • Top-left
      • Get
        var left = rectangle.x;\nvar top = rectangle.y;\n
      • Set
        rectangle.setTopLeftPosition(x, y);\n
        or
        rectangle.x = left;\nrectangle.y = top;\n
    • Center
      • Get
        var centerX = rectangle.centerX;\nvar centerY = rectangle.centerY;\n
      • Set
        rectangle.setCenterPosition(x, y);\n
        or
        rectangle.centerX = centerX;\nrectangle.centerY = centerY;\n
        • Will change rectangle.x, rectangle.y
    • Size
      • Get
        var width = rectangle.width;\nvar height = rectangle.height;\n
      • Set
        rectangle.setSize(width, height);\n
        or
        rectangle.width = width;\nrectangle.height = height;\n
    "},{"location":"shape-custom-shapes/#round-rectangle","title":"Round rectangle","text":"
    • Top-left
      • Get
        var left = roundRectangle.x;\nvar top = roundRectangle.y;\n
      • Set
        roundRectangle.setTopLeftPosition(x, y);\n
        or
        roundRectangle.x = left;\nroundRectangle.y = top;\n
    • Center
      • Get
        var centerX = roundRectangle.centerX;\nvar centerY = roundRectangle.centerY;\n
      • Set
        roundRectangle.setCenterPosition(x, y);\n
        or
        roundRectangle.centerX = centerX;\nroundRectangle.centerY = centerY;\n
        • Will change roundRectangle.x, roundRectangle.y
    • Size
      • Get
        var width = roundRectangle.width;\nvar height = roundRectangle.height;\n
      • Set
        roundRectangle.setSize(width, height);\n
        or
        roundRectangle.width = width;\nroundRectangle.height = height;\n
    • Radius
      • Get
        var radius = roundRectangle.radius;\n
        or
        var radiusTL = roundRectangle.radiusTL;\nvar radiusTR = roundRectangle.radiusTR;\nvar radiusBL = roundRectangle.radiusBL;\nvar radiusBR = roundRectangle.radiusBR;\n
      • Set
        roundRectangle.setRadius(radius);\n// roundRectangle.radius = radius;\n
        or
        roundRectangle.setRadius({\ntl: radiusTL, tr: radiusTR,\nbl: radiusBL, br: radiusBR,\n});\n// roundRectangle.radiusTL = radiusTL;\n// roundRectangle.radiusTR = radiusTR;\n// roundRectangle.radiusBL = radiusBL;\n// roundRectangle.radiusBR = radiusBR;\n
        • radius :
          • 0 : No round corner
          • > 0 : Convex round corner
          • < 0 : Concave round corner
    "},{"location":"shape-custom-shapes/#triangle","title":"Triangle","text":"
    • Vertices
      • Get
        var x0 = triangle.x0;\nvar y0 = triangle.x0;\nvar x1 = triangle.x1;\nvar y1 = triangle.x1;\nvar x2 = triangle.x2;\nvar y2 = triangle.x2;\n
      • Set
        triangle.setP0(x, y);\ntriangle.setP1(x, y);\ntriangle.setP2(x, y);\n
        or
        triangle.x0 = x0;\ntriangle.x0 = y0;\ntriangle.x1 = x1;\ntriangle.x1 = y1;\ntriangle.x2 = x2;\ntriangle.x2 = y2;\n
    "},{"location":"shape-custom-shapes/#arc","title":"Arc","text":"
    • Center position
      • Get
        var x = arc.x;\nvar y = arc.y;\n
      • Set
        arc.setCenterPosition(x, y);\n
        or
        arc.x = x;\narc.y = y;\n
    • Radius
      • Get
        var radiusX = arc.radiusX;\nvar radiusY = arc.radiusY;\n
      • Set
        arc.setRadius(radiusX, radiusY);\n// arc.setRadius(radius);\n
        or
        arc.radiusX = radiusX;\narc.radiusY = radiusY;\n
    • Angles
      • Get
        var startAngle = arc.startAngle;\nvar endAngle = arc.endAngle;\nvar anticlockwise = arc.anticlockwise; // boolean        \n
      • Set
        arc.setAngle(startAngle, endAngle);  // anticlockwise = false\n// arc.setAngle(startAngle, endAngle, anticlockwise);\n
        or
        arc.startAngle = startAngle;\narc.endAngle = endAngle;\narc.anticlockwise = anticlockwise; // boolean\n
        • startAngle, endAngle : Start/end angle in degrees.
    • Pie
      • Get
        var pie = arc.pie; // boolean\n
      • Set
        arc.setPie();\n
        or
        arc.pie = true;\n
    "},{"location":"shape-custom-shapes/#circle","title":"Circle","text":"
    • Center position
      • Get
        var x = circle.x;\nvar y = circle.y;\n
      • Set
        circle.setCenterPosition(x, y);\n
        or
        circle.x = x;\ncircle.y = y;\n
    • Radius
      • Get
        var radiusX = circle.radiusX;\nvar radiusY = circle.radiusY;\n
      • Set
        circle.setRadius(radiusX, radiusY);\n// arc.setRadius(radius);\n
        or
        circle.radiusX = radiusX;\ncircle.radiusY = radiusY;\n
    "},{"location":"shape-custom-shapes/#ellipse","title":"Ellipse","text":"

    The same as Circle.

    "},{"location":"shape-custom-shapes/#alpha","title":"Alpha","text":"
    • Get
      var alpha = shape.alpha;\n
    • Set
      shape.setAlpha(alpha);\n// shape.alpha = alpha;\n
    "},{"location":"shape-custom-shapes/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-custom-shapes/#create-mask","title":"Create mask","text":"
    var mask = shape.createGeometryMask();\n

    See mask

    "},{"location":"shape-custom-shapes/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-custom-shapes/#compare-with-similar-plugins","title":"Compare with similar plugins","text":"
    • Custom Shapes : Draw shapes.
    • Custom Porgress : Similar with custom-shapes, plus a value property
    • Custom Spinner : Similar with custom-progress, plus a value tween task.
    "},{"location":"shape-ellipse/","title":"Ellipse","text":""},{"location":"shape-ellipse/#introduction","title":"Introduction","text":"

    Ellipse shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-ellipse/#usage","title":"Usage","text":""},{"location":"shape-ellipse/#create-shape-object","title":"Create shape object","text":"
    var ellipse = scene.add.ellipse(x, y, width, height, fillColor);\n// var ellipse = scene.add.ellipse(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-ellipse/#custom-class","title":"Custom class","text":"
    • Define class
      class MyEllipse extends Phaser.GameObjects.Ellipse {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var ellipse = new MyEllipse(scene, x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-ellipse/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = ellipse.fillColor;\nvar alpha = ellipse.fillAlpha;\n
      • Set
        ellipse.setFillStyle(color, alpha);\n
      • Clear
        ellipse.setFillStyle();\n
    • Stroke color
      • Get
        var color = ellipse.strokeColor;\n
      • Set
        ellipse.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        ellipse.setStrokeStyle();\n

    No tint methods

    Uses ellipse.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-ellipse/#alpha","title":"Alpha","text":"
    • Get
      var alpha = ellipse.alpha;\n
    • Set
      ellipse.setAlpha(alpha);\n// ellipse.alpha = alpha;\n
    "},{"location":"shape-ellipse/#size","title":"Size","text":"
    • Get
      var width = ellipse.width;\nvar height = ellipse.height;\n
    • Set
      ellipse.setSize(width, height);\n
    "},{"location":"shape-ellipse/#display-size","title":"Display size","text":"
    • Get
      var width = ellipse.displayWidth;\nvar height = ellipse.displayHeight;\n
    • Set
      ellipse.setDisplaySize(width, height);\n
      or
      ellipse.displayWidth = width;\nellipse.displayHeight = height;\n
    "},{"location":"shape-ellipse/#smoothness","title":"Smoothness","text":"

    The number of points used when rendering it. Increase this value for smoother curves, at the cost of more polygons being rendered.

    ellipse.setSmoothness(smoothness);\n
    or
    ellipse.smoothness = smoothness;\n

    "},{"location":"shape-ellipse/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-ellipse/#create-mask","title":"Create mask","text":"
    var mask = ellipse.createGeometryMask();\n

    See mask

    "},{"location":"shape-ellipse/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-fullwindowrectangle/","title":"Full window rectangle","text":""},{"location":"shape-fullwindowrectangle/#introduction","title":"Introduction","text":"

    Rectangle shape covered full window.

    • Author: Rex
    • Game object
    "},{"location":"shape-fullwindowrectangle/#live-demos","title":"Live demos","text":"
    • Cover
    "},{"location":"shape-fullwindowrectangle/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-fullwindowrectangle/#install-plugin","title":"Install plugin","text":""},{"location":"shape-fullwindowrectangle/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfullwindowrectangleplugin', 'https://raw.githubusercontent.com/rexrainbow/    phaser3-rex-notes/master/dist/rexfullwindowrectangleplugin.min.js', true);\n
    • Add shape object
      var rect = scene.add.rexFullWindowRectangle(fillColor, fillAlpha);\n
    "},{"location":"shape-fullwindowrectangle/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FullWindowRectanglePlugin from 'phaser3-rex-plugins/plugins/fullwindowrectangle-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFullWindowRectanglePlugin',\nplugin: FullWindowRectanglePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shape object
      var rect = scene.add.rexFullWindowRectangle(fillColor, fillAlpha);\n
    "},{"location":"shape-fullwindowrectangle/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import FullWindowRectangle from 'phaser3-rex-plugins/plugins/fullwindowrectangle.js';\n
    • Add shape object
      var rect = new FullWindowRectangle(scene, fillColor, fillAlpha);\nscene.add.existing(rect);\n
    "},{"location":"shape-fullwindowrectangle/#create-shape-object","title":"Create shape object","text":"
    var rect = scene.add.rexFullWindowRectangle(fillColor, fillAlpha);\n
    "},{"location":"shape-fullwindowrectangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFullWindowRectangle extends RexPlugins.GameObjects.FullWindowRectangle {\nconstructor(scene, fillColor, fillAlpha) {\nsuper(scene, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rect = new MyFullWindowRectangle(scene, fillColor, fillAlpha);\n
    "},{"location":"shape-fullwindowrectangle/#color","title":"Color","text":"
    • Tint
      • Get
        var tint = rect.tint;\n
      • Set
        rect.tint = tint;\n
    • Alpha
      • Get
        var alpha = rect.alpha;\n
      • Set
        rect.alpha = alpha;\n
    • Fill color
      • Get
        var color = rect.fillColor;\nvar alpha = rect.fillAlpha;\n
      • Set
        rect.setFillStyle(color, alpha);\n
      • Clear
        rect.setFillStyle();\n
    "},{"location":"shape-fullwindowrectangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-fullwindowrectangle/#create-mask","title":"Create mask","text":"
    var mask = rect.createGeometryMask();\n

    See mask

    "},{"location":"shape-fullwindowrectangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-grid/","title":"Grid","text":""},{"location":"shape-grid/#introduction","title":"Introduction","text":"

    Grid shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-grid/#usage","title":"Usage","text":""},{"location":"shape-grid/#create-shape-object","title":"Create shape object","text":"
    var grid = scene.add.grid(x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha);\n
    "},{"location":"shape-grid/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGrid extends Phaser.GameObjects.Grid {\nconstructor(scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha) {\nsuper(scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var grid = new MyGrid(scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha);\n
    "},{"location":"shape-grid/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = grid.fillColor;\nvar alpha = grid.fillAlpha;\n
      • Set
        grid.setFillStyle(color, alpha);\n
      • Clear
        grid.setFillStyle();\n
    • Stroke color
      • Get
        var color = grid.strokeColor;\n
      • Set
        grid.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        grid.setStrokeStyle();\n
    • Alternating color
      • Get
        var color = grid.altFillColor;\n
      • Set
        grid.setAltFillStyle(color, alpha);\n
      • Clear
        grid.setAltFillStyle();\n
    • Outline color
      • Get
        var color = grid.outlineFillColor;\n
      • Set
        grid.setOutlineStyle(color, alpha;\n
      • Clear
        grid.setOutlineStyle();\n

    No tint methods

    Uses grid.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-grid/#alpha","title":"Alpha","text":"
    • Get
      var alpha = grid.alpha;\n
    • Set
      grid.setAlpha(alpha);\n// grid.alpha = alpha;\n
    "},{"location":"shape-grid/#display-size","title":"Display size","text":"
    • Get
      var width = grid.displayWidth;\nvar height = grid.displayHeight;\n
    • Set
      grid.setDisplaySize(width, height);\n
      or
      grid.displayWidth = width;\ngrid.displayHeight = height;\n
    "},{"location":"shape-grid/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-grid/#create-mask","title":"Create mask","text":"
    var mask = grid.createGeometryMask();\n

    See mask

    "},{"location":"shape-grid/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-isobox/","title":"Iso box","text":""},{"location":"shape-isobox/#introduction","title":"Introduction","text":"

    Iso-box shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-isobox/#usage","title":"Usage","text":""},{"location":"shape-isobox/#create-shape-object","title":"Create shape object","text":"
    var isoBox = scene.add.isobox(x, y, width, height, fillTop, fillLeft, fillRight);\n
    "},{"location":"shape-isobox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyIsoBox extends Phaser.GameObjects.IsoBox {\nconstructor(scene, x, y, width, height, fillTop, fillLeft, fillRight) {\nsuper(scene, x, y, width, height, fillTop, fillLeft, fillRight);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var isoBox = new MyIsoBox(scene, x, y, width, height, fillTop, fillLeft, fillRight);\n
    "},{"location":"shape-isobox/#set-color","title":"Set color","text":"
    • Fill color
      isoBox.setFillStyle(fillTop, fillLeft, fillRight);\n
    • Show face
      isoBox.setFaces(showTop, showLeft, showRight);\n
      • showTop, showLeft, showRight: Set true to show that face

    No tint methods

    Uses isoBox.setFillStyle(fillTop, fillLeft, fillRight) to change color.

    "},{"location":"shape-isobox/#alpha","title":"Alpha","text":"
    • Get
      var alpha = isoBox.alpha;\n
    • Set
      isoBox.setAlpha(alpha);\n// isoBox.alpha = alpha;\n
    "},{"location":"shape-isobox/#projection","title":"Projection","text":"
    • Get
      var projection = isoBox.projection;\n
    • Set
      isoBox.setProjection(value)\n
      or
      isoBox.projection = value;\n
    "},{"location":"shape-isobox/#display-size","title":"Display size","text":"
    • Get
      var width = isoBox.displayWidth;\nvar height = isoBox.displayHeight;\n
    • Set
      isoBox.setDisplaySize(width, height);\n
      or
      isoBox.displayWidth = width;\nisoBox.displayHeight = height;\n
    "},{"location":"shape-isobox/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-isobox/#create-mask","title":"Create mask","text":"
    var mask = isoBox.createGeometryMask();\n

    See mask

    "},{"location":"shape-isobox/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-isotriangle/","title":"Iso triangle","text":""},{"location":"shape-isotriangle/#introduction","title":"Introduction","text":"

    Iso-triangle shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-isotriangle/#usage","title":"Usage","text":""},{"location":"shape-isotriangle/#create-shape-object","title":"Create shape object","text":"
    var isoTriangle = scene.add.isotriangle(x, y, width, height, reversed, fillTop, fillLeft, fillRight);\n
    "},{"location":"shape-isotriangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyIsoTriangle extends Phaser.GameObjects.IsoTriangle {\nconstructor(scene, x, y, width, height, reversed, fillTop, fillLeft, fillRight) {\nsuper(scene, x, y, width, height, reversed, fillTop, fillLeft, fillRight);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var isoTriangle = new MyIsoTriangle(scene, x, y, width, height, reversed, fillTop, fillLeft, fillRight);\n
    "},{"location":"shape-isotriangle/#set-color","title":"Set color","text":"
    • Fill color
      isoTriangle.setFillStyle(fillTop, fillLeft, fillRight);\n
    • Show face
      isoTriangle.setFaces(showTop, showLeft, showRight);\n
      • showTop, showLeft, showRight: Set true to show that face

    No tint methods

    Uses isoTriangle.setFillStyle(fillTop, fillLeft, fillRight) to change color.

    "},{"location":"shape-isotriangle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = isoTriangle.alpha;\n
    • Set
      isoTriangle.setAlpha(alpha);\n// isoTriangle.alpha = alpha;\n
    "},{"location":"shape-isotriangle/#projection","title":"Projection","text":"
    • Get
      var projection = isoTriangle.projection;\n
    • Set
      isoTriangle.setProjection(value)\n
      or
      isoTriangle.projection = value;\n
    "},{"location":"shape-isotriangle/#reverse","title":"Reverse","text":"
    • Get
      var isReversed = isoTriangle.isReversed;\n
    • Set
      isoTriangle.setReversed(reversed);\n
      or
      isoTriangle.reversed = reversed;\n
    • Set true to render upside down.
    "},{"location":"shape-isotriangle/#display-size","title":"Display size","text":"
    • Get
      var width = isoTriangle.displayWidth;\nvar height = isoTriangle.displayHeight;\n
    • Set
      isoTriangle.setDisplaySize(width, height);\n
      or
      isoTriangle.displayWidth = width;\nisoTriangle.displayHeight = height;\n
    "},{"location":"shape-isotriangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-isotriangle/#create-mask","title":"Create mask","text":"
    var mask = isoTriangle.createGeometryMask();\n

    See mask

    "},{"location":"shape-isotriangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-line/","title":"Line","text":""},{"location":"shape-line/#introduction","title":"Introduction","text":"

    Line shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-line/#usage","title":"Usage","text":""},{"location":"shape-line/#create-shape-object","title":"Create shape object","text":"
    var line = scene.add.line(x, y, x1, y1, x2, y2, strokeColor);\n// var line = scene.add.line(x, y, x1, y1, x2, y2, strokeColor, strokeAlpha);\n
    "},{"location":"shape-line/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCurve extends Phaser.GameObjects.Line {\nconstructor(scene, x, y, x1, y1, x2, y2, strokeColor) {\nsuper(scene, x, y, x1, y1, x2, y2, strokeColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var line = new MyLine(scene, x, y, x1, y1, x2, y2, strokeColor);\n
    "},{"location":"shape-line/#set-color","title":"Set color","text":"
    • Fill color
      • Get
        var color = line.fillColor;\nvar alpha = line.fillAlpha;\n
      • Set
        line.setFillStyle(color, alpha);\n
      • Clear
        line.setFillStyle();\n
    • Stroke color
      • Get
        var color = line.strokeColor;\n
      • Set
        line.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        line.setStrokeStyle();\n

    No tint methods

    Uses line.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-line/#alpha","title":"Alpha","text":"
    • Get
      var alpha = line.alpha;\n
    • Set
      line.setAlpha(alpha);\n// line.alpha = alpha;\n
    "},{"location":"shape-line/#set-end-points","title":"Set end points","text":"
    line.setTo(x1, y1, x2, y2);\n
    "},{"location":"shape-line/#line-width","title":"Line width","text":"
    line.setLineWidth(startWidth, endWidth);\n
    • endWidth : The end width of the line. Only used in WebGL.
    "},{"location":"shape-line/#display-size","title":"Display size","text":"
    • Get
      var width = line.displayWidth;\nvar height = line.displayHeight;\n
    • Set
      line.setDisplaySize(width, height);\n
      or
      line.displayWidth = width;\nline.displayHeight = height;\n
    "},{"location":"shape-line/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-line/#create-mask","title":"Create mask","text":"
    var mask = line.createGeometryMask();\n

    See mask

    "},{"location":"shape-line/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-lineprogress/","title":"Line progress","text":""},{"location":"shape-lineprogress/#introduction","title":"Introduction","text":"

    Horizontal line progress bar shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-lineprogress/#live-demos","title":"Live demos","text":"
    • Line-progress
    "},{"location":"shape-lineprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-lineprogress/#install-plugin","title":"Install plugin","text":""},{"location":"shape-lineprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlineprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlineprogressplugin.min.js', true);\n
    • Add line-progress object
      var lineProgress = scene.add.rexLineProgress(x, y, width, height, barColor, value, config);\n
    "},{"location":"shape-lineprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LineProgressPlugin from 'phaser3-rex-plugins/plugins/lineprogress-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLineProgressPlugin',\nplugin: LineProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add line-progress object
      var lineProgress = scene.add.rexLineProgress(x, y, width, height, barColor, value, config);\n
    "},{"location":"shape-lineprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LineProgress from 'phaser3-rex-plugins/plugins/lineprogress.js';\n
    • Add line-progress object
      var lineProgress = new LineProgress(scene, x, y, width, height, barColor, value, config);\nscene.add.existing(lineProgress);\n
    "},{"location":"shape-lineprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLineProgressPlugin',\nplugin: LineProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"shape-lineprogress/#create-instance","title":"Create instance","text":"
    var lineProgress = scene.add.rexLineProgress(x, y, width, height, barColor, value, {    trackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n});\n

    or

    var lineProgress = scene.add.rexLineProgress({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\nbarColor: undefined,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • barColor : Fill color of line bar, in number or css string value.
    • trackColor : Fill color of line track, in number or css string value.
    • trackStrokeColor : Stroke color of track, in number or css string value.
    • trackStrokeThickness : Stroke line width of track.
    • skewX : Horizontal skew of track and bar.
    • rtl :
      • false : Bar starts from left side. Default behavior.
      • true : Bar starts from right side.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, lineProgress) {\n}\n

    Add line-progress from JSON

    var lineProgress = scene.make.rexLineProgress({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\nbarColor: undefined,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n\nadd: true\n});\n
    "},{"location":"shape-lineprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLineProgress extends LineProgress {\nconstructor(scene, x, y, width, height, barColor, value, config) {\nsuper(scene, x, y, width, height, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var lineProgress = new MyLineProgress(scene, x, y, width, height, barColor, value, config);\n
    "},{"location":"shape-lineprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = lineProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = lineProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = lineProgress.value; // value: 0 ~ 1\n
    • Set value
      lineProgress.setValue(value, min, max); // value: min ~ max\n
      or
      lineProgress.setValue(value); // value: 0 ~ 1\n
      or
      lineProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      lineProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      lineProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      lineProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"shape-lineprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      lineProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      lineProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      lineProgress.stopEaseValue();\n
    • Set ease duration
      lineProgress.setEaseValueDuration(duration);\n
    • Set ease function
      lineProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"shape-lineprogress/#track","title":"Track","text":"
    • Color
      • Get
        var trackColor = lineProgress.trackColor;\n
      • Set
        lineProgress.setTrackColor(trackColor);\n// lineProgress.trackColor = trackColor;\n
    • Stroke
      • Get
        var trackStrokeColor = lineProgress.trackStrokeColor;\nvar trackStrokeThickness = lineProgress.trackStrokeThickness;\n
      • Set
        lineProgress.setTrackColor(color);\nlineProgress.setTrackStroke(lineWidth, color);\n
    "},{"location":"shape-lineprogress/#bar","title":"Bar","text":"
    • Color
      • Get
        var barColor = lineProgress.barColor;\n
      • Set
        lineProgress.setBarColor(barColor);\n// lineProgress.barColor = barColor;\n
    "},{"location":"shape-lineprogress/#horizontal-skew","title":"Horizontal skew","text":"
    • Get
      var skewX = lineProgress.skewX;\n
    • Set
      lineProgress.setSkewX(skewX);\n// lineProgress.skewX = skewX;\n
    "},{"location":"shape-lineprogress/#right-to-left","title":"Right-to-left","text":"
    • Get
      var rtl = lineProgress.rtl;\n
    • Set
      lineProgress.setRTL(rtl);\n// lineProgress.rtl = rtl;\n
    "},{"location":"shape-lineprogress/#events","title":"Events","text":"
    • On value changed
      lineProgress.on('valuechange', function(newValue, oldValue, lineProgress){\n//\n}, scope);\n
    "},{"location":"shape-lineprogress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = lineProgress.alpha;\n
    • Set
      lineProgress.setAlpha(alpha);\n// lineProgress.alpha = alpha;\n
    "},{"location":"shape-lineprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-lineprogress/#create-mask","title":"Create mask","text":"
    var mask = lineProgress.createGeometryMask();\n

    See mask

    "},{"location":"shape-lineprogress/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-polygon/","title":"Polygon","text":""},{"location":"shape-polygon/#introduction","title":"Introduction","text":"

    Polygon shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-polygon/#usage","title":"Usage","text":""},{"location":"shape-polygon/#create-shape-object","title":"Create shape object","text":"
    var polygon = scene.add.polygon(x, y, points, fillColor);\n// var polygon = scene.add.polygon(x, y, points, fillColor, fillAlpha);\n
    • points :
      • An array of number : [x0, y0, x1, y1, ...]
      • An array of points : [{x:x0, y:y0}, {x:x1, y:y1}, ...]
      • A string : 'x0 y0 x1 y1 ...'

    Note

    Shift given points to align position (0, 0)

    "},{"location":"shape-polygon/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPolygon extends Phaser.GameObjects.Polygon {\nconstructor(scene, x, y, points, fillColor) {\nsuper(scene, x, y, points, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var polygon = new MyPolygon(scene, x, y, points, fillColor);\n
    "},{"location":"shape-polygon/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = polygon.fillColor;\nvar alpha = polygon.fillAlpha;\n
      • Set
        polygon.setFillStyle(color, alpha);\n
      • Clear
        polygon.setFillStyle();\n
    • Stroke color
      • Get
        var color = polygon.strokeColor;\n
      • Set
        polygon.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        polygon.setStrokeStyle();\n

    No tint methods

    Uses polygon.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-polygon/#alpha","title":"Alpha","text":"
    • Get
      var alpha = polygon.alpha;\n
    • Set
      polygon.setAlpha(alpha);\n// polygon.alpha = alpha;\n
    "},{"location":"shape-polygon/#smooth","title":"Smooth","text":"

    Smooths the polygon over the number of iterations specified.

    polygon.smooth(iterations);\n
    "},{"location":"shape-polygon/#set-points","title":"Set points","text":"
    polygon.setTo(points);\n
    • point :
      • A string containing paired values separated by a single space : '40 0 40 20 100 20 100 80 40 80 40 100 0 50'
      • An array of Point objects : [new Phaser.Point(x1, y1), ...]
      • An array of objects with public x/y properties : [obj1, obj2, ...]
      • An array of paired numbers that represent point coordinates : [x1,y1, x2,y2, ...]
      • An array of arrays with two elements representing x/y coordinates : [[x1, y1], [x2, y2], ...]
    "},{"location":"shape-polygon/#display-size","title":"Display size","text":"
    • Get
      var width = polygon.displayWidth;\nvar height = polygon.displayHeight;\n
    • Set
      polygon.setDisplaySize(width, height);\n
      or
      polygon.displayWidth = width;\npolygon.displayHeight = height;\n
    "},{"location":"shape-polygon/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-polygon/#create-mask","title":"Create mask","text":"
    var mask = polygon.createGeometryMask();\n

    See mask

    "},{"location":"shape-polygon/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-quad/","title":"Quad","text":""},{"location":"shape-quad/#introduction","title":"Introduction","text":"

    Quad shape, offsets can be given on four vertices, and additional points can be added on the four sides.

    • Author: Rex
    • Game object
    "},{"location":"shape-quad/#live-demos","title":"Live demos","text":"
    • Ease vertices
    • Ease side-points
    "},{"location":"shape-quad/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-quad/#install-plugin","title":"Install plugin","text":""},{"location":"shape-quad/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadshapeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadshapeplugin.min.js', true);\n
    • Add shape object
      var quad = scene.add.rexQuadShape(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-quad/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadShapePlugin from 'phaser3-rex-plugins/plugins/quadshape-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadShapePlugin',\nplugin: QuadShapePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shape object
      var quad = scene.add.rexQuadShape(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-quad/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import QuadShape from 'phaser3-rex-plugins/plugins/quadshape.js';\n
    • Add shape object
      var quad = new QuadShape(scene, x, y, width, height, fillColor, fillAlpha);\nscene.add.existing(quad);\n
    "},{"location":"shape-quad/#create-shape-object","title":"Create shape object","text":"
    var quad = scene.add.rexQuadShape(x, y, width, height, fillColor, fillAlpha);\n

    or

    var quad = scene.add.rexQuadShape({\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\ncolor: undefined,\nalpha: undefined,\n\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: 2,\n\ntlx: 0,\ntly: 0,\ntrx: 0,\ntry: 0,\nblx: 0,\nbly: 0,\nbrx: 0,\nbry: 0,\n\nleftSidePoints: [\n// {t, x, y, key},\n// {t, x, y, key},\n// ...\n],\nrightSidePoints: [\n// {t, x, y, key},\n// {t, x, y, key},\n// ...\n],\ntopSidePoints: [\n// {t, x, y, key},\n// {t, x, y, key},\n// ...\n],\nbottomSidePoints: [\n// {t, x, y, key},\n// {t, x, y, key},\n// ...\n],\n});\n
    • width, height : Size of quadangle.
      • undefined : Set ot undefined to draw a circle.
    • tlx, tly : Offset of top-left vertex.
    • trx, try : Offset of top-right vertex.
    • blx, bly : Offset of bottom-left vertex.
    • brx, bry : Offset of bottom-right vertex.
    • leftSidePoints, rightSidePoints, topSidePoints, bottomSidePoints : A list of points, additional points on left-side/right-side/top-side/bottom-side.
      {\nt, x, y, key\n}\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key :
        • undefined : Ignore this feature. Default value.
        • A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    "},{"location":"shape-quad/#custom-class","title":"Custom class","text":"
    • Define class
      class MyQuadShape extends RexPlugins.GameObjects.QuadShape {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var quad = new MyQuadShape(scene, x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-quad/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = quad.fillColor;\nvar alpha = quad.fillAlpha;\n
      • Set
        quad.setFillStyle(color, alpha);\n
      • Clear
        quad.setFillStyle();\n
    • Stroke color
      • Get
        var color = quad.strokeColor;\n
      • Set
        quad.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        quad.setStrokeStyle();\n

    No tint methods

    Uses quad.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-quad/#alpha","title":"Alpha","text":"
    • Get
      var alpha = quad.alpha;\n
    • Set
      quad.setAlpha(alpha);\n// quad.alpha = alpha;\n
    "},{"location":"shape-quad/#size","title":"Size","text":"
    • Get
      var width = quad.width;\nvar height = quad.height;\n
    • Set
      quad.setSize(width, height);\n
      or
      quad.width = width;\nquad.height = height;\n
    "},{"location":"shape-quad/#display-size","title":"Display size","text":"
    • Get
      var width = quad.displayWidth;\nvar height = quad.displayHeight;\n
    • Set
      quad.setDisplaySize(width, height);\n
      or
      quad.displayWidth = width;\nquad.displayHeight = height;\n
    "},{"location":"shape-quad/#position-of-vertices","title":"Position of vertices","text":"
    • Top-left vertex
      • Get
        var x = quad.tlx;\nvar y = quad.tly;\n
      • Set
        quad.setTLPosition(x, y);\n
        or
        quad.tlx = x;\nquad.tly = y;\n
    • Top-right vertex
      • Get
        var x = quad.trx;\nvar y = quad.try;\n
      • Set
        quad.setTRPosition(x, y);\n
        or
        quad.trx = x;\nquad.try = y;\n
    • Bottom-left vertex
      • Get
        var x = quad.blx;\nvar y = quad.bly;\n
      • Set
        quad.setBLPosition(x, y);\n
        or
        quad.blx = x;\nquad.bly = y;\n
    • Bottom-right vertex
      • Get
        var x = quad.brx;\nvar y = quad.bry;\n
      • Set
        quad.setBRPosition(x, y);\n
        or
        quad.brx = x;\nquad.bry = y;\n
    "},{"location":"shape-quad/#position-of-side-points","title":"Position of side points","text":"
    • Top side
      quad.insertTopSidePoint(t, x, y);\n// quad.insertTopSidePoint(t, x, y, key);\n// quad.insertTopSidePoint({t, x, y, key});\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key : - undefined : Ignore this feature. Default value. - A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    • Right side
      quad.insertRightSidePoint(t, x, y);\n// quad.insertRightSidePoint(t, x, y, key);\n// quad.insertRightSidePoint({t, x, y, key});\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key : - undefined : Ignore this feature. Default value. - A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    • Bottom side
      quad.insertBottomSidePoint(t, x, y);\n// quad.insertBottomSidePoint(t, x, y, key);\n// quad.insertBottomSidePoint({t, x, y, key});\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key : - undefined : Ignore this feature. Default value. - A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    • Left side
      quad.insertLeftSidePoint(t, x, y);\n// quad.insertLeftSidePoint(t, x, y, key);\n// quad.insertLeftSidePoint({t, x, y, key});\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key : - undefined : Ignore this feature. Default value. - A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    "},{"location":"shape-quad/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-quad/#create-mask","title":"Create mask","text":"
    var mask = quad.createGeometryMask();\n

    See mask

    "},{"location":"shape-quad/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-rectangle/","title":"Rectangle","text":""},{"location":"shape-rectangle/#introduction","title":"Introduction","text":"

    Rectangle shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-rectangle/#usage","title":"Usage","text":""},{"location":"shape-rectangle/#create-shape-object","title":"Create shape object","text":"
    var rect = scene.add.rectangle(x, y, width, height, fillColor);\n// var rect = scene.add.rectangle(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-rectangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRectangle extends Phaser.GameObjects.Rectangle {\nconstructor(scene, x, y, width, height, fillColor) {\nsuper(scene, x, y, width, height, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rect = new MyRectangle(scene, x, y, width, height, fillColor);\n
    "},{"location":"shape-rectangle/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = rect.fillColor;\nvar alpha = rect.fillAlpha;\n
      • Set
        rect.setFillStyle(color, alpha);        
      • Clear
        rect.setFillStyle();\n
    • Stroke color
      • Get
        var color = rect.strokeColor;\n
      • Set
        rect.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        rect.setStrokeStyle();\n

    No tint methods

    Uses rect.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-rectangle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = rect.alpha;\n
    • Set
      rect.setAlpha(alpha);\n// rect.alpha = alpha;\n
    "},{"location":"shape-rectangle/#size","title":"Size","text":"
    • Get
      var width = rect.width;\nvar height = rect.height;\n
    • Set
      rect.setSize(width, height);\n
      or
      rect.width = width;\nrect.height = height;\n
    "},{"location":"shape-rectangle/#display-size","title":"Display size","text":"
    • Get
      var width = rect.displayWidth;\nvar height = rect.displayHeight;\n
    • Set
      rect.setDisplaySize(width, height);\n
      or
      rect.displayWidth = width;\nrect.displayHeight = height;\n
    "},{"location":"shape-rectangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-rectangle/#create-mask","title":"Create mask","text":"
    var mask = rect.createGeometryMask();\n

    See mask

    "},{"location":"shape-rectangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-roundrectangle/","title":"Round Rectangle","text":""},{"location":"shape-roundrectangle/#introduction","title":"Introduction","text":"

    Round rectangle shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-roundrectangle/#live-demos","title":"Live demos","text":"
    • Round rectangle
    "},{"location":"shape-roundrectangle/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-roundrectangle/#install-plugin","title":"Install plugin","text":""},{"location":"shape-roundrectangle/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexroundrectangleplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexroundrectangleplugin.min.js', true);\n
    • Add shape object
      var rect = scene.add.rexRoundRectangle(x, y, width, height, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-roundrectangle/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RoundRectanglePlugin from 'phaser3-rex-plugins/plugins/roundrectangle-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRoundRectanglePlugin',\nplugin: RoundRectanglePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shape object
      var rect = scene.add.rexRoundRectangle(x, y, width, height, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-roundrectangle/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RoundRectangle from 'phaser3-rex-plugins/plugins/roundrectangle.js';\n
    • Add shape object
      var rect = new RoundRectangle(scene, x, y, width, height, radius, fillColor, fillAlpha);\nscene.add.existing(rect);\n
    "},{"location":"shape-roundrectangle/#create-shape-object","title":"Create shape object","text":"
    var rect = scene.add.rexRoundRectangle(x, y, width, height, radius, fillColor, fillAlpha);\n

    or

    var rect = scene.add.rexRoundRectangle({\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\nradius: 0,\n\ncolor: undefined,\nalpha: undefined,\n\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: 2\n});\n
    • width, height : Size of rectangle.
      • undefined : Set ot undefined to draw a circle.
    • radius : Radius of four corners.
      • 0, or undefined : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
        • Radius and iteration
          {\nradius: radius,\niteration: 0\n}\n
          or
          {\nradius: {x: radiusX, y: radiusY},\niteration: 0\n}\n
          or
          {\nradius: {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n},\niteration: 0\n}\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
          • iteration : Number of interpolation points in each round corner. Default value is 4.
            • 0 : Draw a straight line instead of arc.
    "},{"location":"shape-roundrectangle/#deform","title":"Deform","text":"
    • Rectangle, set radius of 4 corners to 0.
      var rect = scene.add.rexRoundRectangle(x, y,  width, height, 0, fillColor, fillAlpha);\n
    • Circle, set width and height to undefined.
      var rect = scene.add.rexRoundRectangle(x, y, undefined, undefined, radius, fillColor, fillAlpha);\n
    • Ellipse, set width and height to undefined, and radiusX/radiusY.
      var rect = scene.add.rexRoundRectangle(x, y, undefined, undefined, {x: radiusX, y: radiusY}, fillColor, fillAlpha);\n
    • Rhombus, set width and height to undefined, and assign iteration to 0
      var rect = scene.add.rexRoundRectangle(x, y, undefined, undefined, {\nradius: radius,\niteration: 0\n}, fillColor, fillAlpha);\n
    • Octagon, assign iteration to 0
      var rect = scene.add.rexRoundRectangle(x, y, width, height, {\nradius: radius,\niteration: 0\n}, fillColor, fillAlpha);\n
    "},{"location":"shape-roundrectangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRoundRectangle extends RexPlugins.GameObjects.RoundRectangle {\nconstructor(scene, x, y, width, height, radius, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, radius, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rect = new MyRoundRectangle(scene, x, y, width, height, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-roundrectangle/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = rect.fillColor;\nvar alpha = rect.fillAlpha;\n
      • Set
        rect.setFillStyle(color, alpha);\n
      • Clear
        rect.setFillStyle();\n
    • Stroke color
      • Get
        var color = rect.strokeColor;\n
      • Set
        rect.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        rect.setStrokeStyle();\n

    No tint methods

    Uses rect.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-roundrectangle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = rect.alpha;\n
    • Set
      rect.setAlpha(alpha);\n// rect.alpha = alpha;\n
    "},{"location":"shape-roundrectangle/#size","title":"Size","text":"
    • Get
      var width = rect.width;\nvar height = rect.height;\n
    • Set
      rect.setSize(width, height);\n
      or
      rect.width = width;\nrect.height = height;\n
    "},{"location":"shape-roundrectangle/#display-size","title":"Display size","text":"
    • Get
      var width = rect.displayWidth;\nvar height = rect.displayHeight;\n
    • Set
      rect.setDisplaySize(width, height);\n
      or
      rect.displayWidth = width;\nrect.displayHeight = height;\n
    "},{"location":"shape-roundrectangle/#radius","title":"Radius","text":"
    • Get
      var radius = rect.radius;\nvar radiusTL = rect.radiusTL;\nvar radiusTR = rect.radiusTR;\nvar radiusBL = rect.radiusBL;\nvar radiusBR = rect.radiusBR;\n
      or
      var cornerRadius = rect.cornerRadius;\n
      • radius : Number, maximum radius of 4 corners.
      • cornerRadius : JSON object of 4 corners.
        {\ntl: {x : radiusX, y: radiusY, convex : true},\ntr: {x : radiusX, y: radiusY, convex : true},\nbl: {x : radiusX, y: radiusY, convex : true},\nbr: {x : radiusX, y: radiusY, convex : true},\n}\n
    • Set
      rect.setRadius(value);\nrect.setRadiusTL(value);  // number, or {x,y}\nrect.setRadiusTR(value);  // number, or {x,y}\nrect.setRadiusBL(value);  // number, or {x,y}\nrect.setRadiusBR(value);  // number, or {x,y}\n
      or
      rect.radius = radius;\nrect.radiusTL = radius;  // number, or {x,y}\nrect.radiusTR = radius;  // number, or {x,y}\nrect.radiusBL = radius;  // number, or {x,y}\nrect.radiusBR = radius;  // number, or {x,y}\n
      • radius :
        • Number : 4 corners with the same radius.
          • 0 : No round corner
          • > 0 : Convex round corner
          • < 0 : Concave round corner
        • JSON
          • 4 corners with the same radius X/Y
            {\nx: radiusX,\ny: radiusY\n}\n
          • Eeach radius of corner
            {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
            or ```javascript { tl: {x : radiusX, y: radiusY}, tr: {x : radiusX, y: radiusY}, bl: {x : radiusX, y: radiusY}, br: {x : radiusX, y: radiusY}, }
    "},{"location":"shape-roundrectangle/#iteration","title":"Iteration","text":"
    • Get
      var iteration = rect.iteration;\n
    • Set
      rect.setIteration(value);\n
      or
      rect.iteration = value;\n

    Number of interpolation points in each round corner. Default value is 4.

    • 0 : Draw a straight line instead of arc.
    "},{"location":"shape-roundrectangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-roundrectangle/#create-mask","title":"Create mask","text":"
    var mask = rect.createGeometryMask();\n

    See mask

    "},{"location":"shape-roundrectangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-roundrectangleprogress/","title":"Round rectangle progress","text":""},{"location":"shape-roundrectangleprogress/#introduction","title":"Introduction","text":"

    Horizontal or vertical round rectangle progress bar shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-roundrectangleprogress/#live-demos","title":"Live demos","text":"
    • RoundRectangle-progress
    "},{"location":"shape-roundrectangleprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-roundrectangleprogress/#install-plugin","title":"Install plugin","text":""},{"location":"shape-roundrectangleprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexroundrectangleprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexroundrectangleprogressplugin.min.js', true);\n
    • Add roundrectangle-progress object
      var roundRectangleProgress = scene.add.rexRoundRectangleProgress(x, y, width, height, radius, barColor, value, config);\n
    "},{"location":"shape-roundrectangleprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RoundRectangleProgressPlugin from 'phaser3-rex-plugins/plugins/roundrectangleprogress-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRoundRectangleProgressPlugin',\nplugin: RoundRectangleProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add roundrectangle-progress object
      var roundRectangleProgress = scene.add.rexRoundRectangleProgress(x, y, width, height, radius, barColor, value, config);\n
    "},{"location":"shape-roundrectangleprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RoundRectangleProgress from 'phaser3-rex-plugins/plugins/roundrectangleprogress.js';\n
    • Add roundrectangle-progress object
      var roundRectangleProgress = new RoundRectangleProgress(scene, x, y, width, height, radius, barColor, value, config);\nscene.add.existing(roundRectangleProgress);\n
    "},{"location":"shape-roundrectangleprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRoundRectangleProgressPlugin',\nplugin: RoundRectangleProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"shape-roundrectangleprogress/#create-instance","title":"Create instance","text":"
    var roundRectangleProgress = scene.add.rexRoundRectangleProgress(x, y, width, height, radius, barColor, value, {    trackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nrtl: false,\norientation: 0,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, roundRectangleProgress) {\n},\n});\n

    or

    var roundRectangleProgress = scene.add.rexRoundRectangleProgress({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\nradius: 0,\n\nbarColor: undefined,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nrtl: false,\norientation: 0,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, roundRectangleProgress) {\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • radius : Radius of four corners.
      • 0, or undefined : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
        • Radius and iteration
          {\nradius: radius,\niteration: 0\n}\n
          or
          {\nradius: {x: radiusX, y: radiusY},\niteration: 0\n}\n
          or
          {\nradius: {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n},\niteration: 0\n}\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
          • iteration : Number of interpolation points in each round corner. Default value is 4.
            • 0 : Draw a straight line instead of arc.
    • barColor : Fill color of line bar, in number or css string value.
    • trackColor : Fill color of line track, in number or css string value.
    • trackStrokeColor : Stroke color of track, in number or css string value.
    • trackStrokeThickness : Stroke line width of track.
    • orientation : Orientation of the bar.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right. Default value is 0.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    • rtl :
      • false : Bar starts from left side. Default behavior.
      • true : Bar starts from right side.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, roundRectangleProgress) {\n}\n

    Add roundrectangle-progress from JSON

    var roundRectangleProgress = scene.make.rexRoundRectangleProgress({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\nradius: 0,\n\nbarColor: undefined,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nrtl: false,\norientation: 0,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, roundRectangleProgress) {\n},\n\nadd: true\n});\n
    "},{"location":"shape-roundrectangleprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRoundRectangleProgress extends RoundRectangleProgress {\nconstructor(scene, x, y, width, height, radius, barColor, value, config) {\nsuper(scene, x, y, width, height, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var roundRectangleProgress = new MyRoundRectangleProgress(scene, x, y, width, height, radius, barColor, value, config);\n
    "},{"location":"shape-roundrectangleprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = roundRectangleProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = roundRectangleProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = roundRectangleProgress.value; // value: 0 ~ 1\n
    • Set value
      roundRectangleProgress.setValue(value, min, max); // value: min ~ max\n
      or
      roundRectangleProgress.setValue(value); // value: 0 ~ 1\n
      or
      roundRectangleProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      roundRectangleProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      roundRectangleProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      roundRectangleProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"shape-roundrectangleprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      roundRectangleProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      roundRectangleProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      roundRectangleProgress.stopEaseValue();\n
    • Set ease duration
      roundRectangleProgress.setEaseValueDuration(duration);\n
    • Set ease function
      roundRectangleProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"shape-roundrectangleprogress/#track","title":"Track","text":"
    • Color
      • Get
        var trackColor = roundRectangleProgress.trackColor;\n
      • Set
        roundRectangleProgress.setTrackColor(trackColor);\n// roundRectangleProgress.trackColor = trackColor;\n
    • Stroke
      • Get
        var trackStrokeColor = roundRectangleProgress.trackStrokeColor;\nvar trackStrokeThickness = roundRectangleProgress.trackStrokeThickness;\n
      • Set
        roundRectangleProgress.setTrackColor(color);\nroundRectangleProgress.setTrackStroke(lineWidth, color);\n
    "},{"location":"shape-roundrectangleprogress/#bar","title":"Bar","text":"
    • Color
      • Get
        var barColor = roundRectangleProgress.barColor;\n
      • Set
        roundRectangleProgress.setBarColor(barColor);\n// roundRectangleProgress.barColor = barColor;\n
    "},{"location":"shape-roundrectangleprogress/#orientation","title":"Orientation","text":"
    • Get
      var orientation = roundRectangleProgress.orientation;\n
      • orientation :
        • 0 : Horizontal
        • 1 : Vertical
    • Set
      roundRectangleProgress.setOrientation(orientation);\n// roundRectangleProgress.orientation = orientation;\n
      • orientation : Orientation of the bar.
        • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right.
        • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    "},{"location":"shape-roundrectangleprogress/#right-to-left","title":"Right-to-left","text":"

    Right-to-left, or bottom-to-top

    • Get
      var rtl = roundRectangleProgress.rtl;\n
    • Set
      roundRectangleProgress.setRTL(rtl);\n// roundRectangleProgress.rtl = rtl;\n
    "},{"location":"shape-roundrectangleprogress/#events","title":"Events","text":"
    • On value changed
      roundRectangleProgress.on('valuechange', function(newValue, oldValue, roundRectangleProgress){\n//\n}, scope);\n
    "},{"location":"shape-roundrectangleprogress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = roundRectangleProgress.alpha;\n
    • Set
      roundRectangleProgress.setAlpha(alpha);\n// roundRectangleProgress.alpha = alpha;\n
    "},{"location":"shape-roundrectangleprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-roundrectangleprogress/#create-mask","title":"Create mask","text":"
    var mask = roundRectangleProgress.createGeometryMask();\n

    See mask

    "},{"location":"shape-roundrectangleprogress/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-spinner/","title":"Spinner","text":""},{"location":"shape-spinner/#introduction","title":"Introduction","text":"

    Loading animations on shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-spinner/#live-demos","title":"Live demos","text":"
    • Spinners
      • Arrow
      • AIO
    • Custom spinner
    • Loading animation
    "},{"location":"shape-spinner/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-spinner/#install-plugin","title":"Install plugin","text":""},{"location":"shape-spinner/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin(\n\"rexspinnerplugin\",\n\"https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexspinnerplugin.min.js\",\n\"rexSpinner\",\n\"rexSpinner\"\n);\n
    • Add spinner object
      var aio = scene.rexSpinner.add.aio(config);\nvar arrow = scene.rexSpinner.add.arrow(config);\nvar downArrow = scene.rexSpinner.add.downArrow(config);\nvar leftArrow = scene.rexSpinner.add.leftArrow(config);\nvar rightArrow = scene.rexSpinner.add.rightArrow(config);\nvar upArrow = scene.rexSpinner.add.upArrow(config);\nvar audio = scene.rexSpinner.add.audio(config);\nvar ball = scene.rexSpinner.add.ball(config);\nvar bars = scene.rexSpinner.add.bars(config);\nvar box = scene.rexSpinner.add.box(config);\nvar clock = scene.rexSpinner.add.clock(config);\nvar cube = scene.rexSpinner.add.cube(config);\nvar dots = scene.rexSpinner.add.dots(config);\nvar facebook = scene.rexSpinner.add.facebook(config);\nvar grid = scene.rexSpinner.add.grid(config);\nvar hearts = scene.rexSpinner.add.hearts(config);\nvar ios = scene.rexSpinner.add.ios(config);\nvar orbit = scene.rexSpinner.add.orbit(config);\nvar oval = scene.rexSpinner.add.oval(config);\nvar pie = scene.rexSpinner.add.pie(config);\nvar puff = scene.rexSpinner.add.puff(config);\nvar radio = scene.rexSpinner.add.radio(config);\nvar rings = scene.rexSpinner.add.rings(config);\nvar spinner = scene.rexSpinner.add.spinner(config);\n
    "},{"location":"shape-spinner/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SpinnerPlugin from \"phaser3-rex-plugins/templates/spinner/spinner-plugin.js\";\nvar config = {\n// ...\nplugins: {\nscene: [\n{\nkey: \"rexSpinner\",\nplugin: SpinnerPlugin,\nmapping: \"rexSpinner\",\n},\n// ...\n],\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add spinner object
      var aio = scene.rexSpinner.add.aio(config);\nvar arrow = scene.rexSpinner.add.arrow(config);\nvar downArrow = scene.rexSpinner.add.downArrow(config);\nvar leftArrow = scene.rexSpinner.add.leftArrow(config);\nvar rightArrow = scene.rexSpinner.add.rightArrow(config);\nvar upArrow = scene.rexSpinner.add.upArrow(config);  var audio = scene.rexSpinner.add.audio(config);\nvar ball = scene.rexSpinner.add.ball(config);\nvar bars = scene.rexSpinner.add.bars(config);\nvar box = scene.rexSpinner.add.box(config);\nvar clock = scene.rexSpinner.add.clock(config);\nvar cube = scene.rexSpinner.add.cube(config);\nvar dots = scene.rexSpinner.add.dots(config);\nvar facebook = scene.rexSpinner.add.facebook(config);\nvar grid = scene.rexSpinner.add.grid(config);\nvar hearts = scene.rexSpinner.add.hearts(config);\nvar ios = scene.rexSpinner.add.ios(config);\nvar orbit = scene.rexSpinner.add.orbit(config);\nvar oval = scene.rexSpinner.add.oval(config);\nvar pie = scene.rexSpinner.add.pie(config);\nvar puff = scene.rexSpinner.add.puff(config);\nvar radio = scene.rexSpinner.add.radio(config);\nvar rings = scene.rexSpinner.add.rings(config);\nvar spinner = scene.rexSpinner.add.spinner(config);    
    "},{"location":"shape-spinner/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { AIO, Arrow, Audio, Ball, Bars, Box, Clock, Cube, Custom, Dots, Facebook, Grid, Hearts, Ios, Orbit, Oval, Puff, Radio, Rings, Spinner\n} from \"phaser3-rex-plugins/templates/spinner/spinner-components.js\";\n
    • Add spinner object
      var spinner = new Audio(scene, config);\nscene.add.existing(spinner);\n
    "},{"location":"shape-spinner/#add-spinner-object","title":"Add spinner object","text":""},{"location":"shape-spinner/#general","title":"General","text":"
    var spinner = scene.rexSpinner.add.audio({\n// x: 0,\n// y: 0,\n// width: 64,\n// height: 64,\n// color: 0xffffff,\n\n// duration: 1000,\n// start: true,\n// delay: 0,\n// repeatDelay: 0,\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • color : Fill color, or stroke color. Default value is 0xffffff
    • duration : Duration of animation.
    • start : Start animation when object created.
    • false : Don't play animation at beginning.
    • delay : Delay time in ms before running.
    • repeatDelay : Delay time between 2 periods.
    "},{"location":"shape-spinner/#arrow","title":"Arrow","text":"
    var spinner = scene.rexSpinner.add.audio({\n// ...\n// direction: 'down'\n});\n
    • direction :
      • 0, 'right' : Arrow from left to right.
      • 1, 'down' : Arrow from up to down. Default behavior.
      • 2, 'left' : Arrow from right to left.
      • 3, 'up' : Arrow from down to up.
    "},{"location":"shape-spinner/#aio","title":"AIO","text":"

    All-in-one

    var spinner = scene.rexSpinner.add.aio({\n// ...\n// animationMode: undefined\n});\n
    • animationMode :
      • undefined : Play random spinner animation.
      • 'leftArrow' : Play leftArrow spinner animation.
      • 'rightArrow' : Play rightArrow spinner animation.
      • 'upArrow' : Play upArrow spinner animation.
      • 'downArrow' : Play dowbArrow spinner animation.
      • 'audio' : Play audio spinner animation.
      • 'ball' : Play ball spinner animation.
      • 'bars' : Play bars spinner animation.
      • 'box' : Play box spinner animation.
      • 'clock' : Play clock spinner animation.
      • 'cube' : Play cube spinner animation.
      • 'dots' : Play dots spinner animation.
      • 'facebook' : Play facebook spinner animation.
      • 'grid' : Play grid spinner animation.
      • 'hearts' : Play hearts spinner animation.
      • 'ios' : Play ios spinner animation.
      • 'oribit' : Play oribit spinner animation.
      • 'oval' : Play oval spinner animation.
      • 'pie' : Play pie spinner animation.
      • 'puff' : Play puff spinner animation.
      • 'radio' : Play radio spinner animation.
      • 'rings' : Play rings spinner animation.
      • 'spinner' : Play spinner spinner animation.
    "},{"location":"shape-spinner/#play-animation","title":"Play animation","text":""},{"location":"shape-spinner/#start","title":"Start","text":"
    • Start playing, won't restart when playing
      spinner.start();\n
    • Restart with new duration
      spinner.start(duration);\n
    "},{"location":"shape-spinner/#pause","title":"Pause","text":"
    spinner.pause();\n
    "},{"location":"shape-spinner/#resume","title":"Resume","text":"
    spinner.resume();\n
    "},{"location":"shape-spinner/#stop","title":"Stop","text":"
    spinner.stop();\n
    "},{"location":"shape-spinner/#play-animation-manually","title":"Play animation manually","text":"
    1. Set start to false in config
    2. Set progress manually
      spinner.setValue(t);\n
      or
      spinner.value = t;\n
      • t : 0 ~ 1
    "},{"location":"shape-spinner/#is-running","title":"Is running","text":"
    var isRunning = spinner.isRunning;\n
    "},{"location":"shape-spinner/#color","title":"Color","text":"
    • Get
      var color = spinner.color;\n
    • Set
      spinner.setColor(color);\n
      or
      spinner.color = color;\n
      • color : Fill color, or stroke color, in number.
    "},{"location":"shape-spinner/#alpha","title":"Alpha","text":"
    • Get
      var alpha = spinner.alpha;\n
    • Set
      spinner.setAlpha(alpha);\n// spinner.alpha = alpha;\n
    "},{"location":"shape-spinner/#duration","title":"Duration","text":"
    • Get
      var duration = spinner.duration;\n
    • Set, will apply to next animation playing.
      spinner.setDuration(duration);\n
      or
      spinner.duration = duration;\n
    "},{"location":"shape-spinner/#ease","title":"Ease","text":"
    • Get
      var ease = spinner.ease;\n
    • Set, will apply to next animation playing.
      spinner.setEasen(ease);\n
      or
      spinner.ease = ease;\n
    "},{"location":"shape-spinner/#set-animation-mode","title":"Set animation mode","text":"

    AIO-spinner only

    aioSpinner.setAnimationMode(mode);\n
    • mode :
      • undefined : Play random spinner animation.
      • 'leftArrow' : Play leftArrow spinner animation.
      • 'rightArrow' : Play rightArrow spinner animation.
      • 'upArrow' : Play upArrow spinner animation.
      • 'downArrow' : Play dowbArrow spinner animation.
      • 'audio' : Play audio spinner animation.
      • 'ball' : Play ball spinner animation.
      • 'bars' : Play bars spinner animation.
      • 'box' : Play box spinner animation.
      • 'clock' : Play clock spinner animation.
      • 'cube' : Play cube spinner animation.
      • 'dots' : Play dots spinner animation.
      • 'facebook' : Play facebook spinner animation.
      • 'grid' : Play grid spinner animation.
      • 'hearts' : Play hearts spinner animation.
      • 'ios' : Play ios spinner animation.
      • 'oribit' : Play oribit spinner animation.
      • 'oval' : Play oval spinner animation.
      • 'pie' : Play pie spinner animation.
      • 'puff' : Play puff spinner animation.
      • 'radio' : Play radio spinner animation.
      • 'rings' : Play rings spinner animation.
      • 'spinner' : Play spinner spinner animation.
    aioSpinner.setRandomAnimationMode();\n
    "},{"location":"shape-spinner/#custom-spinner","title":"Custom spinner","text":"
    var customSpinner = scene.rexSpinner.add.custom({\n// x: 0,\n// y: 0,\n// width: 64,\n// height: 64,\n// color: 0xffffff,\n\n// duration: 1000,\n// start: true,\n\ncreate: {\n// shapeType: [name0, name1, ...],\n// shapeType: number,\n// shapeType: name,\n},\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n})\n
    • create : Callback to create shapes
      • A plain object with shapeType: name, or shapeType: number
        • shapeType :
          • 'arc' : Create Arc shape.
          • 'circle' : Create Circle shape.
          • 'ellipse' : Create Ellipse shape.
          • 'line' : Create Line shape.
          • 'lines' : Create Lines shape.
          • 'rectangle' : Create Rectangle shape.
          • 'roundRectangle' : Create Round rectangle shape.
          • 'triangle' : Create Triangle shape.
        • nameArray : An array of unique string name for each shape.
        • name : An unique string name of this shape.
        • number : Amount of shapes to create.
      • A callback
        function() {\n// this : This spinner game object\nvar shape = this.createShape(shapeType, name);\nthis.addShape(shape);\n}\n
        • this.createShape(shapeType, name) : Crate a shape instance, with an unique name.
        • this.addShape(shape) : Add this shape instance to this custom spinner.
    • update : Callback when porgressing
      function() {\n// this : This spinner game object\nvar centerX = this.centerX;\nvar centerY = this.centerY;\nvar radius = this.radius;\nvar color = this.color;\nvar shapes = this.getShapes();\nvar shape = this.getShape(name);\nvar t = this.value;\n// ...\n}\n
      • this.value : Progress, 0~1.
      • Position :
        • this.centerX, this.centerY : Center position of this spinner. The coordinate of top-left point is (0,0)
        • this.radius : Minimun value of this.centerX, this.centerY, to draw shape at square.
      • Color :
        • this.color : Color property of this spinner.
      • Shape instances : Change properties of shape instances.
        • this.getShapes() : Return all shapes in an array.
        • this.getShape(name) : Return a shape by the unique string name.
    "},{"location":"shape-spinner/#shape-class","title":"Shape class","text":"

    See Shape class

    "},{"location":"shape-spinner/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-spinner/#create-mask","title":"Create mask","text":"
    var mask = customSpinner.createGeometryMask();\n

    See mask

    "},{"location":"shape-spinner/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-star/","title":"Star","text":""},{"location":"shape-star/#introduction","title":"Introduction","text":"

    Star shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-star/#usage","title":"Usage","text":""},{"location":"shape-star/#create-shape-object","title":"Create shape object","text":"
    var star = scene.add.star(x, y, points, innerRadius, outerRadius, fillColor);\n// var star = scene.add.star(x, y, points, innerRadius, outerRadius, fillColor, fillAlpha);\n
    • points : The number of points on the star. Default is 5.
    • innerRadius : The inner radius of the star. Default is 32.
    • outerRadius : The outer radius of the star. Default is 64.
    "},{"location":"shape-star/#custom-class","title":"Custom class","text":"
    • Define class
      class MyStar extends Phaser.GameObjects.Star {\nconstructor(scene, x, y, points, innerRadius, outerRadius, fillColor) {\nsuper(scene, x, y, points, innerRadius, outerRadius, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var star = new MyStar(scene, x, y, points, innerRadius, outerRadius, fillColor);\n
    "},{"location":"shape-star/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = star.fillColor;\nvar alpha = star.fillAlpha;\n
      • Set
        star.setFillStyle(color, alpha);\n
      • Clear
        star.setFillStyle();\n
    • Stroke color
      • Get
        var color = star.strokeColor;\n
      • Set
        star.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        star.setStrokeStyle();\n

    No tint methods

    Uses star.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-star/#alpha","title":"Alpha","text":"
    • Get
      var alpha = star.alpha;\n
    • Set
      star.setAlpha(alpha);\n// star.alpha = alpha;\n
    "},{"location":"shape-star/#radius","title":"Radius","text":"
    • Inner radius
      • Get
        var innerRadius = star.innerRadius;\n
      • Set
        star.setInnerRadius(innerRadius);\n
        or
        star.innerRadius = innerRadius;\n
    • Outer radius
      • Get
        var outerRadius = star.outerRadius;\n
      • Set
        star.setOuterRadius(outerRadius);\n
        or
        star.outerRadius = outerRadius;\n
    • Points
      • Get
        var points = star.points;\n
      • Set
        star.setPoints(points);\n
        or
        star.points = points;\n
    "},{"location":"shape-star/#display-size","title":"Display size","text":"
    • Get
      var width = star.displayWidth;\nvar height = star.displayHeight;\n
    • Set
      star.setDisplaySize(width, height);\n
      or
      star.displayWidth = width;\nstar.displayHeight = height;\n
    "},{"location":"shape-star/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-star/#create-mask","title":"Create mask","text":"
    var mask = star.createGeometryMask();\n

    See mask

    "},{"location":"shape-star/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-toggleswitch/","title":"Toggle switch","text":""},{"location":"shape-toggleswitch/#introduction","title":"Introduction","text":"

    Toggle-switch input.

    • Author: Rex
    • Game object
    "},{"location":"shape-toggleswitch/#live-demos","title":"Live demos","text":"
    • Toggle-switch
    "},{"location":"shape-toggleswitch/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-toggleswitch/#install-plugin","title":"Install plugin","text":""},{"location":"shape-toggleswitch/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextoggleswitchplugin', 'https://raw.githubusercontent.com/rexrainbow/    phaser3-rex-notes/master/dist/rextoggleswitchplugin.min.js', true);\n
    • Add toggle-switch input
      var toggleSwitch = scene.add.rexToggleSwitch(x, y, width, height, color, config);\n
    • Add toggle-switch shape (without click input)
      var toggleSwitch = scene.add.rexToggleSwitchShape(x, y, width, height, color, config);\n
    "},{"location":"shape-toggleswitch/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ToggleSwitchPlugin from 'phaser3-rex-plugins/plugins/toggleswitch-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexToggleSwitchPlugin',\nplugin: ToggleSwitchPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add toggle-switch input
      var toggleSwitch = scene.add.rexToggleSwitch(x, y, width, height, color, config);\n
    • Add toggle-switch shape (without click input)
      var toggleSwitch = scene.add.rexToggleSwitchShape(x, y, width, height, color, config);\n
    "},{"location":"shape-toggleswitch/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ToggleSwitch from 'phaser3-rex-plugins/plugins/toggleswitch.js';\n
    • Add toggle-switch input
      var toggleswitch = new ToggleSwitch(scene, x, y, width, height, color, config);\nscene.add.existing(toggleSwitch);\n
    • Add toggle-switch shape (without click input)
      // import ToggleSwitchShape from 'phaser3-rex-plugins/plugins/toggleswitchshape.js';\nvar toggleSwitch = new ToggleSwitchShape(scene, x, y, width, height, color, config);\nscene.add.existing(toggleSwitch);\n
    "},{"location":"shape-toggleswitch/#create-toggle-switch-input","title":"Create toggle-switch input","text":"
    var toggleSwitch = scene.add.rexToggleSwitch(x, y, width, height, color, config);\n

    or

    var toggleSwitch = scene.add.rexToggleSwitch({\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\ncolor: 0x005cb2,\ntrackFillAlpha: 1,\nfalseValueTrackColor: undefined,\nfalseValueTrackFillAlpha: 1,\n\nthumbColor: 0xffffff,\nthumbAlpha: 1,\n\ntrackWidth: 0.9,\ntrackHeight: 0.5,\ntrackCornerRadius: (trackHeight * 0.5),\n\nthumbHeight: (trackHeight * 0.9),\nthumbWidth: (thumbHeight),\nthumbCornerRadius: (thumbHeight * 0.5),\n\nthumbLeft: 0.3,\nthumbRight: (1 - thumbLeft),\nrtl: false,\n\nanimationDuration: 150,\n\nvalue: false,\n\nclick: undefined,\n// click: {\n//     mode: 1,            // 0|'press'|1|'release'\n//     clickInterval: 100  // ms\n//     threshold: undefined\n// },\nreadOnly: false,\n});\n
    • width, height : Size of toggleswitch.
    • Track fill style
      • color, trackFillAlpha : Track color and alpha when value is true.
      • falseValueTrackColor, falseValueTrackFillAlpha : Track color and alpha when value is false.
        • Default value of falseValueTrackColor is the grayscale of color.
    • Thumb fill style
      • thumbColor, thumbAlpha : Thumb color and alpha
    • Track size
      • trackWidth : Width ration of track. Default value is 0.9.
      • thumbWidth : Height ratio of track. Default value is 0.5.
      • trackCornerRadius : Ratio of track corner. Default value is half of trackHeight.
    • Thumb size
      • thumbWidth : Width ration of thumb. Default value is equal to thumbHeight.
      • thumbHeight : Height ratio of thumb. Default value trackHeight * 0.5.
      • thumbCornerRadius : Ratio of thumb corner. Default value is half of thumbHeight.
    • Thumb position
      • thumbLeft : Thumb position if value is false. Default value is 0.3.
      • thumbRight : Thumb position if value is true. Default value is 1 - thumbLeft.
      • rtl : Moving direction of thumb when when value changes from false to true.
        • false : Thumb moves from left to right. Default behavior.
        • true : Thumb moves from right to left.
    • animationDuration : Duration of drawing path of checker.
    • value : Initial value.
    • click : Configuration of click input
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
      • click.threshold : Cancel clicking detecting when dragging distance is larger then this threshold.
        • undefined : Ignore this feature. Default behavior.
    • readOnly : Set ture to disable input.
    "},{"location":"shape-toggleswitch/#custom-class","title":"Custom class","text":"
    • Define class
      class MyToggleSwitch extends RexPlugins.GameObjects.ToggleSwitch {\nconstructor(scene, x, y, width, height, color, config) {\nsuper(scene, x, y, width, height, color, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var toggleSwitch = new MyToggleSwitch(scene, x, y, width, height, color, config);\n
    "},{"location":"shape-toggleswitch/#value","title":"Value","text":"
    • Get
      var value = toggleSwitch.value;\n// var value = toggleSwitch.value;\n
    • Set
      toggleSwitch.setValue(value);\n// toggleSwitch.setValue(value, duration);\n
      or
      toggleSwitch.value = value;\n
    • Toggle
      toggleSwitch.toggleValue();\n// toggleSwitch.toggleValue(duration);\n
      or
      toggleSwitch.value = !toggleSwitch.value;\n// toggleSwitch.value = !toggleSwitch.value;\n
    "},{"location":"shape-toggleswitch/#read-only","title":"Read only","text":"
    • Get
      var readOnly = toggleSwitch.readOnly;\n
    • Set
      toggleSwitch.setReadOnly();\n// toggleSwitch.setReadOnly(true);\n
      or
      toggleSwitch.readOnly = true;\n
    "},{"location":"shape-toggleswitch/#track-fill-style","title":"Track fill style","text":"
    • Get
      var color = toggleSwitch.trackFillColor;\nvar alpha = toggleSwitch.trackFillAlpha;\n
      var color = toggleSwitch.falseValueTrackColor;\nvar alpha = toggleSwitch.falseValueTrackFillAlpha;\n
    • Set
      toggleSwitch.setTrackFillStyle(color, alpha);\n// toggleSwitch.trackFillColor = color;\n// toggleSwitch.trackFillAlpha = alpha;\n
      toggleSwitch.setFalseValueTrackFillStyle(color, alpha);\n// toggleSwitch.falseValueTrackColor = color;\n// toggleSwitch.falseValueTrackFillAlpha = alpha;\n
    "},{"location":"shape-toggleswitch/#thumb-fill-style","title":"Thumb fill style","text":"
    • Get
      var color = toggleSwitch.thumbColor;\nvar alpha = toggleSwitch.thumbAlpha;\n
    • Set
      toggleSwitch.setThumbStyle(color, alpha);\n// toggleSwitch.thumbColor = color;\n// toggleSwitch.thumbAlpha = alpha;\n
    "},{"location":"shape-toggleswitch/#toggle-animation","title":"Toggle animation","text":"
    • Duration
      • Get
        var duration = toggleSwitch.toggleAnimProgress;\n
      • Set
        toggleSwitch.setToggleAnimationDuration(duration);\ntoggleSwitch.toggleAnimProgress = duration;\n
    "},{"location":"shape-toggleswitch/#size","title":"Size","text":"
    • Get
      var width = toggleSwitch.width;\nvar height = toggleSwitch.height;\n
    • Set
      toggleSwitch.setSize(width, height);\n
      or
      toggleSwitch.width = width;\ntoggleSwitch.height = height;\n
    "},{"location":"shape-toggleswitch/#display-size","title":"Display size","text":"
    • Get
      var width = toggleSwitch.displayWidth;\nvar height = toggleSwitch.displayHeight;\n
    • Set
      toggleSwitch.setDisplaySize(width, height);\n
      or
      toggleSwitch.displayWidth = width;\ntoggleSwitch.displayHeight = height;\n
    "},{"location":"shape-toggleswitch/#track-size-ratio","title":"Track size ratio","text":"
    • Get
      var trackWidth = toggleSwitch.trackWidth;\nvar trackHeight = toggleSwitch.trackHeight;\n
      • trackWidth, trackHeight : Size ratio of track
    • Set
      toggleSwitch.setTrackSize(trackWidth, trackHeight);\n// toggleSwitch.trackWidth = trackWidth;\n// toggleSwitch.trackHeight = trackHeight;\n
    "},{"location":"shape-toggleswitch/#track-corner-ratio","title":"Track corner ratio","text":"
    • Get
      var trackRadius = toggleSwitch.trackRadius;\n
      • trackRadius : Corner ratio of track
    • Set
      toggleSwitch.setTrackRadius(trackRadius);\n// toggleSwitch.trackRadius = trackRadius;\n
    "},{"location":"shape-toggleswitch/#thumb-size-ratio","title":"Thumb size ratio","text":"
    • Get
      var thumbWidth = toggleSwitch.thumbWidth;\nvar thumbHeight = toggleSwitch.thumbHeight;\n
      • trackWidth, trackHeight : Size ratio of thumb
    • Set
      toggleSwitch.setThumbSize(thumbWidth, thumbHeight);\n// toggleSwitch.thumbWidth = thumbWidth;\n// toggleSwitch.thumbHeight = thumbHeight;\n
    "},{"location":"shape-toggleswitch/#thumb-corner-ratio","title":"Thumb corner ratio","text":"
    • Get
      var thumbRadius = toggleSwitch.thumbRadius;\n
      • thumbRadius : Corner ratio of track
    • Set
      toggleSwitch.setThumbRadius(thumbRadius);\n// toggleSwitch.thumbRadius = thumbRadius;\n
    "},{"location":"shape-toggleswitch/#thumb-position-ratio","title":"Thumb position ratio","text":"
    • Get
      var thumbLeft = toggleSwitch.thumbLeftX;\nvar thumbRight = toggleSwitch.thumbRightX;\n
      var rtl = toggleSwitch.rtl;\n
    • Set
      toggleSwitch.setThumbPosition(thumbLeft, thumbRight);\n// toggleSwitch.thumbLeftX = thumbLeft;\n// toggleSwitch.thumbRightX = thumbRight;\n
      toggleSwitch.setRTL(rtl);\n// toggleSwitch.rtl = rtl;\n
    "},{"location":"shape-toggleswitch/#events","title":"Events","text":"
    • On value change
      toggleSwitch.on('valuechange', function(value) {\n// value: checked\n})\n
    "},{"location":"shape-toggleswitch/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-toggleswitch/#create-mask","title":"Create mask","text":"
    var mask = toggleSwitch.createGeometryMask();\n

    See mask

    "},{"location":"shape-toggleswitch/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-triangle/","title":"Triangle","text":""},{"location":"shape-triangle/#introduction","title":"Introduction","text":"

    Triangle shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-triangle/#usage","title":"Usage","text":""},{"location":"shape-triangle/#create-shape-object","title":"Create shape object","text":"
    var triangle = scene.add.triangle(x, y, x1, y1, x2, y2, x3, y3, fillColor);\n// var triangle = scene.add.triangle(x, y, x1, y1, x2, y2, x3, y3, fillColor, fillAlpha);\n
    "},{"location":"shape-triangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTriangle extends Phaser.GameObjects.Triangle {\nconstructor(scene, x, y, x1, y1, x2, y2, x3, y3, fillColor) {\nsuper(scene, x, y, x1, y1, x2, y2, x3, y3, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var triangle = new MyTriangle(scene, x, y, x1, y1, x2, y2, x3, y3, fillColor);\n
    "},{"location":"shape-triangle/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = triangle.fillColor;\nvar alpha = triangle.fillAlpha;\n
      • Set
        triangle.setFillStyle(color, alpha);\n
      • Clear
        triangle.setFillStyle();\n
    • Stroke color
      • Get
        var color = triangle.strokeColor;\n
      • Set
        triangle.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        triangle.setStrokeStyle();\n

    No tint methods

    Uses triangle.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-triangle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = triangle.alpha;\n
    • Set
      triangle.setAlpha(alpha);\n// triangle.alpha = alpha;\n
    "},{"location":"shape-triangle/#set-vertices","title":"Set vertices","text":"
    triangle.setTo(x1, y1, x2, y2, x3, y3);\n
    "},{"location":"shape-triangle/#triangle-width","title":"Triangle width","text":"
    triangle.setLineWidth(startWidth, endWidth);\n
    • endWidth : The end width of the triangle. Only used in WebGL.
    "},{"location":"shape-triangle/#display-size","title":"Display size","text":"
    • Get
      var width = triangle.displayWidth;\nvar height = triangle.displayHeight;\n
    • Set
      triangle.setDisplaySize(width, height);\n
      or
      triangle.displayWidth = width;\ntriangle.displayHeight = height;\n
    "},{"location":"shape-triangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-triangle/#create-mask","title":"Create mask","text":"
    var mask = triangle.createGeometryMask();\n

    See mask

    "},{"location":"shape-triangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-triangle2/","title":"Triangle 2","text":""},{"location":"shape-triangle2/#introduction","title":"Introduction","text":"

    Trangle shape inside a rectangle bounds.

    • Author: Rex
    • Game object
    "},{"location":"shape-triangle2/#live-demos","title":"Live demos","text":"
    • Ease direction
    • Rotate
    "},{"location":"shape-triangle2/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-triangle2/#install-plugin","title":"Install plugin","text":""},{"location":"shape-triangle2/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextriangleplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextriangleplugin.min.js', true);\n
    • Add triangle object
      var triangle = scene.add.rexTriangle(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-triangle2/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TrianglePlugin from 'phaser3-rex-plugins/plugins/triangle-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTrianglePlugin',\nplugin: TrianglePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add triangle object
      var triangle = scene.add.rexTriangle(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-triangle2/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Triangle from 'phaser3-rex-plugins/plugins/triangle.js';\n
    • Add triangle object
      var triangle = new Triangle(scene, x, y, width, height, fillColor, fillAlpha);\nscene.add.existing(triangle);\n
    "},{"location":"shape-triangle2/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTrianglePlugin',\nplugin: TrianglePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"shape-triangle2/#create-instance","title":"Create instance","text":"
    var triangle = scene.add.rexTriangle(x, y, width, height, fillColor, fillAlpha);\n

    or

    var triangle = scene.add.rexTriangle({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n\narrowOnly: false,\n\ndirection: 0,\neaseDuration: 0,\npadding: 0,\n// padding: {\n//     left: 0,\n//     right: 0,\n//     top: 0,\n//     bottom: 0,\n// },\n\nradius: undefined,\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • arrowOnly :
      • false : Fill and stroke triangle shape. Default behavior.
      • true : Only stroke arrow of triangle shape.
    • direction : Direction of triangle's arrow.
      • 0, or 'right' : Arrow to right. Default value.
      • 1, or 'down' : Arrow to down.
      • 2, or 'left' : Arrow to left.
      • 3, or 'up' : Arrow to up.
    • easeDuration : Ease duration when direction changed.
      • 0 : No ease transform. Default value.
    • padding : Space around triagnle.
      • A number. Default value is 0.
      • A plain object
        {\nleft:0, right:0, top: 0, bottom: 0\n}\n
    • radius : Put 3 vertices of trangle in a circle.
      • undefined : Disable this mode. Default behavior.
      • 0~1 : Radius in ratio of min(half-width, half-height)
    "},{"location":"shape-triangle2/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTriangle extends Triangle {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var triangle = new MyTriangle(scene, x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-triangle2/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = triangle.fillColor;\nvar alpha = triangle.fillAlpha;\n
      • Set
        triangle.setFillStyle(color, alpha);\n
      • Clear
        triangle.setFillStyle();\n
    • Stroke color
      • Get
        var color = triangle.strokeColor;\n
      • Set
        triangle.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        triangle.setStrokeStyle();\n

    No tint methods

    Uses triangle.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-triangle2/#alpha","title":"Alpha","text":"
    • Get
      var alpha = triangle.alpha;\n
    • Set
      triangle.setAlpha(alpha);\n// triangle.alpha = alpha;\n
    "},{"location":"shape-triangle2/#size","title":"Size","text":"
    • Get
      var width = triangle.width;\nvar height = triangle.height;\n
    • Set
      triangle.setSize(width, height);\n
      or
      triangle.width = width;\ntriangle.height = height;\n
    "},{"location":"shape-triangle2/#display-size","title":"Display size","text":"
    • Get
      var width = triangle.displayWidth;\nvar height = triangle.displayHeight;\n
    • Set
      triangle.setDisplaySize(width, height);\n
      or
      triangle.displayWidth = width;\ntriangle.displayHeight = height;\n
    "},{"location":"shape-triangle2/#direction","title":"Direction","text":"
    • Get
      var direction = triangle.direction;\n
      • 0 : Arrow to right. Default value.
      • 1 : Arrow to down.
      • 2 : Arrow to left.
      • 3 : Arrow to up.
    • Set
      triangle.setDirection(direction);\n// triangle.direction = direction;\n
      or
      triangle.setDirection(direction, easeDuration);\n
      • direction :
        • 0, or 'right' : Arrow to right.
        • 1, or 'down' : Arrow to down.
        • 2, or 'left' : Arrow to left.
        • 3, or 'up' : Arrow to up.
      • easeDuration : Override current ease-duration time.
    • Toggle
      triangle.toggleDirection();\n// triangle.direction += 2;\n
      or
      triangle.toggleDirection(easeDuration);\n
    "},{"location":"shape-triangle2/#padding","title":"Padding","text":"
    • Get
      var padding = triangle.padding;\n
      • padding :
        { left, right, top, bottom }\n
    • Set
      triangle.setPadding(padding);\n
      or
      triangle.setPadding({\nleft, right, top, bottom\n});\n
      or
      triangle.setPadding({\nx, y\n});\n
    "},{"location":"shape-triangle2/#ease-duration","title":"Ease duration","text":"
    • Get
      var easeDuration = triangle.easeDuration;\n
    • Set
      triangle.setEaseDuration(easeDuration);\n
    "},{"location":"shape-triangle2/#arrow-only","title":"Arrow only","text":"
    • Get
      var arrowOnly = triangle.arrowOnly;\n
    • Set
      triangle.setArrowOnly(enable);\n// triangle.arrowOnly = enable;\n
    "},{"location":"shape-triangle2/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-triangle2/#create-mask","title":"Create mask","text":"
    var mask = triangle.createGeometryMask();\n

    See mask

    "},{"location":"shape-triangle2/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shatter-image/","title":"Image","text":""},{"location":"shatter-image/#introduction","title":"Introduction","text":"

    Shatter image to triangle faces.

    Reference: Delaunay Triangulation

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"shatter-image/#live-demos","title":"Live demos","text":"
    • Shatter image
    "},{"location":"shatter-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shatter-image/#install-plugin","title":"Install plugin","text":""},{"location":"shatter-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshatterimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshatterimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexShatterImage(x, y, texture, frame, config);\n
    "},{"location":"shatter-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ShatterImagePlugin from 'phaser3-rex-plugins/plugins/shatterimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShatterImagePlugin',\nplugin: ShatterImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexShatterImage(x, y, texture, frame, config);\n
    "},{"location":"shatter-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ShatterImage } from 'phaser3-rex-plugins/plugins/shatterimage.js';\n
    • Add image object
      var image = new ShatterImage(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"shatter-image/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexShatterImage(x, y, texture, frame, {\n// ringRadiusList: [1 / 27, 3 / 27, 9 / 27],\n// ringRadiusList: function(width, height) {\n//    return [1 / 27, 3 / 27, 9 / 27];\n// },\n\n// samplesPerRing: 12\n// variation: 0.25,    \n});\n

    or

    var image = scene.add.rexShatterImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n\n// ringRadiusList: [1 / 27, 3 / 27, 9 / 27],\n// ringRadiusList: function(width, height) {\n//    return [1 / 27, 3 / 27, 9 / 27];\n// },\n\n// samplesPerRing: 12,\n// variation: 0.25,\n\n});\n
    • ringRadiusList :
      • A list of number. Default value is [1 / 27, 3 / 27, 9 / 27]
      • A callback to return a list of number
        function(width, height) {\nreturn [1 / 27, 3 / 27, 9 / 27];\n}\n

    Add perspectiveimage from JSON

    var perspectiveimage = scene.make.rexShatterImage({\nx: 0,\ny: 0,\nkey: null,\nframe: null,\n\n// ringRadiusList: [1 / 27, 3 / 27, 9 / 27],\n// ringRadiusList: function(width, height) {\n//    return [1 / 27, 3 / 27, 9 / 27];\n// },\n\n// samplesPerRing: 12,\n// variation: 0.25,\n\n\nadd: true\n});\n
    "},{"location":"shatter-image/#custom-class","title":"Custom class","text":"
    • Define class
      class MyShatterImage( extends ShatterImage( {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyShatterImage(scene, x, y, texture, frame, config);\n
    "},{"location":"shatter-image/#shatter-image","title":"Shatter image","text":"
    image.shatter(centerX, centerY);\n// image.shatter();\n

    or

    image.shatter(centerX, centerY, {\n// ringRadiusList:\n// samplesPerRing: \n// variation\n});\n

    or

    image.shatter({\n// centerX: \n// centerY: \n// ringRadiusList:\n// samplesPerRing: \n// variation\n});\n
    • centerX, centerY : Center position of shatter.
      • undefined : Default value is center of image.

    Shatter image into triangle faces.

    "},{"location":"shatter-image/#position-of-shatter-center","title":"Position of Shatter center","text":"
    var shatterCenter = image.shatterCenter; // {x, y}\n
    "},{"location":"shatter-image/#faces","title":"Faces","text":"
    var faces = image.faces;\n

    Faces will be sorted nearby shatter-center to far away.

    "},{"location":"shatter-image/#properties","title":"Properties","text":"
    • Alpha
      • Get
        var alpha = face.alpha;\n
      • Set
        face.alpha = alpha;\n
        or
        face.setAlpha(value);\n
    • Tint color
      • Get
        var color = face.tint;\n
      • Set
        face.tint = color;\n
        or
        face.setTint(color);\n
    • Angle
      • Get
        var radians = face.rotation;\n// var degree = face.angle;\n
      • Set
        face.rotation = radians;\n// face.angle = degree;\n
        or
        face.setRotation(radians);\n// face.setAngle(degree);\n
    • Center position
      • Get
        var x = face.x;\nvar y = face.y;\n
        • x : 0(left) ~ 1(right)
        • y : 1(top) ~ 0(bottom)
      • Set
        face.x = x;\nface.y = y;\n
        or
        face.translate(x, y);\n
        • x : 0(left) ~ 1(right)
        • y : 1(top) ~ 0(bottom)
    "},{"location":"shatter-image/#update-properties","title":"Update properties","text":"
    • Start updating
      image.startUpdate();\n
      or
      image.ignoreDirtyCache = true;\n
    • Stop updating
      image.stopUpdate();\n
      or
      image.ignoreDirtyCache = false;\n
    "},{"location":"shatter-image/#tween-properties","title":"Tween properties","text":"
    image.startUpdate();\nscene.tweens.add({\ntargets: image.faces,\nalpha: 0,\nangle: function () { return -90 + Math.random() * 180; },\ny: '-=0.5',\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\ndelay: scene.tweens.stagger(20),\nrepeat: 0,            // -1: infinity\nyoyo: false,\nonComplete: function () {\nimage.stopUpdate()\n}\n});\n
    "},{"location":"shatter-image/#reset-image","title":"Reset image","text":"

    Display original image with 2 faces.

    image.resetImage();\n
    "},{"location":"shatter-image/#tint-color","title":"Tint color","text":"
    • Get
      var color = image.tint;\n
    • Set
      image.tint = color;\n
      or
      image.setTint(color);\n
    "},{"location":"shatter-image/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"shatter-image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"shatter-image/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shatter-rendertexture/","title":"Render texture","text":""},{"location":"shatter-rendertexture/#introduction","title":"Introduction","text":"

    Shatter render texture to triangle faces.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"shatter-rendertexture/#live-demos","title":"Live demos","text":"
    • RenderTexture
    "},{"location":"shatter-rendertexture/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shatter-rendertexture/#install-plugin","title":"Install plugin","text":""},{"location":"shatter-rendertexture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshatterimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshatterimageplugin.min.js', true);\n
    • Add render texture object
      var image = scene.add.rexShatterRenderTexture(x, y, width, height, config);\n
    "},{"location":"shatter-rendertexture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ShatterImagePlugin from 'phaser3-rex-plugins/plugins/shatterimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShatterImagePlugin',\nplugin: ShatterImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add render texture object
      var image = scene.add.rexShatterRenderTexturege(x, y, width, height, config);\n
    "},{"location":"shatter-rendertexture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ShatterRenderTexture } from 'phaser3-rex-plugins/plugins/shatterimage.js';\n
    • Add render texture object
      var image = new ShatterRenderTexture(scene, x, y, width, height, config);\nscene.add.existing(image);\n
    "},{"location":"shatter-rendertexture/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexShatterRenderTexturege(x, y, width, height, {\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    or

    var image = scene.add.rexShatterRenderTexturege({\n// x: 0,\n// y: 0,\n// width: 32,\n// height: 32,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    Add prespective render texture from JSON

    var image = scene.make.rexShatterRenderTexturege({\nx: 0,\ny: 0,    width: 32,\nheight: 32,\n\n// gridWidth: 32,\n// girdHeight: 32,\n\nadd: true\n});\n
    "},{"location":"shatter-rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MyShatterRenderTexturege extends ShatterRenderTexturege {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyShatterRenderTexturege(scene, x, y, width, height, config);\n
    "},{"location":"shatter-rendertexture/#internal-render-texture","title":"Internal render texture","text":"
    var rt = image.rt;\n
    • rt : Render texture
    "},{"location":"shatter-rendertexture/#paste-texture","title":"Paste texture","text":"
    • Paste game object
      image.rt.draw(gameObject, x, y);\n// image.rt.draw(gameObject, x, y, alpha, tint);\n
    • gameObject : a game object, or an array of game objects
    • Paste game objects in a group
      image.rt.draw(group, x, y);\n// image.rt.draw(group, x, y, alpha, tint);\n
    • Paste game objects in a scene
      image.rt.draw(scene.children, x, y);\n// image.rt.draw(scene.children, x, y, alpha, tint);\n
    • Paste texture
      image.rt.draw(key, x, y);\n// image.rt.draw(key, x, y, alpha, tint);\n
      or
      image.rt.drawFrame(key, frame, x, y);\n// image.rt.drawFrame(key, frame, x, y, alpha, tint);\n
      • key : The key of the texture to be used, as stored in the Texture Manager.
    "},{"location":"shatter-rendertexture/#erase","title":"Erase","text":"
    image.rt.erase(gameObject, x, y);\n
    • gameObject : a game object, or an array of game objects
    "},{"location":"shatter-rendertexture/#clear","title":"Clear","text":"
    image.rt.clear();\n
    "},{"location":"shatter-rendertexture/#fill","title":"Fill","text":"
    image.rt.fill(rgb, alpha);\n// image.rt.fill(rgb, alpha, x, y, width, height);\n
    "},{"location":"shatter-rendertexture/#other-properties","title":"Other properties","text":"

    See Shatter image game object, Mesh game object, game object

    "},{"location":"shatter-rendertexture/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"shatter-rendertexture/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"ship/","title":"Ship","text":""},{"location":"ship/#introduction","title":"Introduction","text":"

    Move game object as a space ship by cursor keys.

    • Author: Rex
    • Arcade behavior of game object
    "},{"location":"ship/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ship/#install-plugin","title":"Install plugin","text":""},{"location":"ship/#load-minify-file","title":"Load minify file","text":"
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshipplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshipplugin.min.js', true);\n
    • Add ship behavior
      var ship = scene.plugins.get('rexshipplugin').add(gameObject, config);\n
    "},{"location":"ship/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine and install plugin in configuration of game
      import ShipPlugin from 'phaser3-rex-plugins/plugins/ship-plugin.js';\nvar config = {\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShip',\nplugin: ShipPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add ship behavior
      var ship = scene.plugins.get('rexShip').add(gameObject, config);\n
    "},{"location":"ship/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Import class
      import Ship from 'phaser3-rex-plugins/plugins/ship.js';\n
    • Add ship behavior
      var ship = new Ship(gameObject, config);\n
    "},{"location":"ship/#create-instance","title":"Create instance","text":"
    var ship = scene.plugins.get('rexShip').add(gameObject, {\n// maxSpeed: 200,\n// acceleration: 200,\n// drag: 0.99,\n// turnSpeed: 300,\n// wrap: true,\n// padding: 0,\n// enable: true,\n// cursorKeys: scene.input.keyboard.createCursorKeys()\n});\n
    • Movement
      • maxSpeed
      • acceleration
      • drag
    • Rotation
      • turnSpeed : Angular velocity
    • Wrap
      • wrap : Set true to enable wrap mode. Default value is true.
      • padding
    • enable : set false to disable moving.
    • cursorKeys : CursorKey object, using keyboard's cursorKeys by default.
    "},{"location":"ship/#set-max-speed","title":"Set max speed","text":"
    ship.setMaxSpeed(speed);\n
    "},{"location":"ship/#set-acceleration","title":"Set acceleration","text":"
    ship.setAcceleration(acc);\n
    "},{"location":"ship/#set-drag","title":"Set drag","text":"
    ship.setDrag(drag);\n
    "},{"location":"ship/#set-turn-speed","title":"Set turn speed","text":"
    ship.setTurnSpeed(angularVelocity);\n
    "},{"location":"ship/#set-wrap-mode","title":"Set wrap mode","text":"
    ship.setWrapMode(wrap, padding);\n
    • wrap : Set true to enable wrap mode.
    "},{"location":"skew-image/","title":"Image","text":""},{"location":"skew-image/#introduction","title":"Introduction","text":"

    Skewable Image.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"skew-image/#live-demos","title":"Live demos","text":"
    • Skew image
    "},{"location":"skew-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"skew-image/#install-plugin","title":"Install plugin","text":""},{"location":"skew-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexSkewImage(x, y, texture, frame);\n
    "},{"location":"skew-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexSkewImage(x, y, texture, frame);\n
    "},{"location":"skew-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SkewImage } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add image object
      var image = new SkewImage(scene, x, y, texture, frame);\nscene.add.existing(image);\n
    "},{"location":"skew-image/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexSkewImage(x, y, texture, frame);\n

    or

    var image = scene.add.rexSkewImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n});\n

    Add quadimage from JSON

    var quadimage = scene.make.rexSkewImage({\nx: 0,\ny: 0,\n\nkey: null,\nframe: null,\n\nadd: true\n});\n
    "},{"location":"skew-image/#custom-class","title":"Custom class","text":"
    • Define class
      class MySkewImage extends SkewImage {\nconstructor(scene, x, y, texture, frame) {\nsuper(scene, x, y, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MySkewImage(scene, x, y, texture, frame);\n
    "},{"location":"skew-image/#skew","title":"Skew","text":"
    • Set
      image.setSkewX(skewXRad);\nimage.setSkewXDeg(skewXDeg);\n
      image.setSkewY(skewXRad);\nimage.setSkewYDeg(skewXDeg);\n
      image.setSkew(skewXRad, skewYRad);\nimage.setSkewDeg(skewXDeg, skewYDeg);\n
      image.skewX = skewXRad;\nimage.skewXDeg = skewXDeg;\n
      image.skewY = skewYRad;\nimage.skewYDeg = skewYDeg;\n
    • Get
      var skewXRad = image.skewX;\nvar skewXDeg = image.skewXDeg;\n
      var skewYRad = image.skewY;\nvar skewYDeg = image.skewYDeg;\n
    "},{"location":"skew-image/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"skew-image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"skew-image/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"skew-rendertexture/","title":"Render texture","text":""},{"location":"skew-rendertexture/#introduction","title":"Introduction","text":"

    Skewable render texture.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"skew-rendertexture/#live-demos","title":"Live demos","text":""},{"location":"skew-rendertexture/#usage","title":"Usage","text":""},{"location":"skew-rendertexture/#install-plugin","title":"Install plugin","text":""},{"location":"skew-rendertexture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add render texture object
      var image = scene.add.rexSkewRenderTexture(x, y, width, height);\n
    "},{"location":"skew-rendertexture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add render texture object
      var image = scene.add.rexSkewRenderTexturege(x, y, width, height);\n
    "},{"location":"skew-rendertexture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SkewRenderTexture } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add render texture object
      var image = new SkewRenderTexture(scene, x, y, width, height);\nscene.add.existing(image);\n
    "},{"location":"skew-rendertexture/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexSkewRenderTexturege(x, y, width, height);\n

    or

    var image = scene.add.rexSkewRenderTexturege({\n// x: 0,\n// y: 0,\n// width: 32,\n// height: 32,\n});\n

    Add prespective render texture from JSON

    var image = scene.make.rexSkewRenderTexturege({\nx: 0,\ny: 0,    width: 32,\nheight: 32,\n\nadd: true\n});\n
    "},{"location":"skew-rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MySkewRenderTexturege extends SkewRenderTexturege {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MySkewRenderTexturege(scene, x, y, width, height);\n
    "},{"location":"skew-rendertexture/#internal-render-texture","title":"Internal render texture","text":"
    var rt = image.rt;\n
    • rt : Render texture
    "},{"location":"skew-rendertexture/#paste-texture","title":"Paste texture","text":"
    • Paste game object
      image.rt.draw(gameObject, x, y);\n// image.rt.draw(gameObject, x, y, alpha, tint);\n
    • gameObject : a game object, or an array of game objects
    • Paste game objects in a group
      image.rt.draw(group, x, y);\n// image.rt.draw(group, x, y, alpha, tint);\n
    • Paste game objects in a scene
      image.rt.draw(scene.children, x, y);\n// image.rt.draw(scene.children, x, y, alpha, tint);\n
    • Paste texture
      image.rt.draw(key, x, y);\n// image.rt.draw(key, x, y, alpha, tint);\n
      or
      image.rt.drawFrame(key, frame, x, y);\n// image.rt.drawFrame(key, frame, x, y, alpha, tint);\n
      • key : The key of the texture to be used, as stored in the Texture Manager.
    "},{"location":"skew-rendertexture/#erase","title":"Erase","text":"
    image.rt.erase(gameObject, x, y);\n
    • gameObject : a game object, or an array of game objects
    "},{"location":"skew-rendertexture/#clear","title":"Clear","text":"
    image.rt.clear();\n
    "},{"location":"skew-rendertexture/#fill","title":"Fill","text":"
    image.rt.fill(rgb, alpha);\n// image.rt.fill(rgb, alpha, x, y, width, height);\n
    "},{"location":"skew-rendertexture/#other-properties","title":"Other properties","text":"

    See Skew image game object, Mesh game object, game object

    "},{"location":"skew-rendertexture/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"skew-rendertexture/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"slider/","title":"Slider","text":""},{"location":"slider/#introduction","title":"Introduction","text":"

    Drag thumb on a slider bar.

    • Author: Rex
    • Behavior of game object
    "},{"location":"slider/#live-demos","title":"Live demos","text":"
    • Slider
    • Color picker
    "},{"location":"slider/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"slider/#install-plugin","title":"Install plugin","text":""},{"location":"slider/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexsliderplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexsliderplugin.min.js', true);\n
    • Add slider behavior
      var slider = scene.plugins.get('rexsliderplugin').add(gameObject, config);\n
    "},{"location":"slider/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SliderPlugin from 'phaser3-rex-plugins/plugins/slider-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSlider',\nplugin: SliderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add slider behavior
      var slider = scene.plugins.get('rexSlider').add(gameObject, config);\n
    "},{"location":"slider/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Slider from 'phaser3-rex-plugins/plugins/slider.js';\n
    • Add slider behavior
      var slider = new Slider(gameObject, config);\n
    "},{"location":"slider/#create-instance","title":"Create instance","text":"
    var slider = scene.plugins.get('rexSlider').add(gameObject, {\n// endPoints: [\n//     {x:0, y:0},\n//     {x:0, y:0}\n// ],\n// value: 0,\n// enable: true,\n\n// valuechangeCallback: null,\n// valuechangeCallbackScope: null\n});\n
    • endPoints : An array of 2 end-points ([{x,y}, {x,y}])
    • value : Initial value between 0 to 1
    • enable : Set true to drag thumb
    • valuechangeCallback , valuechangeCallbackScope : Bind this callback to valuechange event
    "},{"location":"slider/#set-end-points","title":"Set end-points","text":"
    slider.setEndPoints(p0x, p0y, p1x, p1y);\n// slider.setEndPoints(p0, p1); // p0, p1: {x, y}\n// slider.setEndPoints(points); // points: [p0, p1]\n
    "},{"location":"slider/#get-value","title":"Get value","text":"
    var value = slider.value;          // value: between 0 to 1\n// var value = slider.getValue();  // value: between 0 to 1\n// var value = slider.getValue(min, max);  // value: between min to max\n
    "},{"location":"slider/#set-value","title":"Set value","text":"
    slider.value = newValue;       // newValue: between 0 to 1\n// slider.setValue(newValue);  // newValue: between 0 to 1\n// slider.setValue(newValue, min, max);  // newValue: between min to max\n
    slider.addValue(inc);  // inc: between 0 to 1\n// slider.addValue(inc, min, max);  // inc: between min to max\n

    Fires valuechange event if new value is not equal to current value.

    "},{"location":"slider/#events","title":"Events","text":"
    • Value changed
      slider.on('valuechange', function(newValue, prevValue){ /* ... */ });\n
      • newValue: between 0 to 1
      • prevValue: between 0 to 1
    "},{"location":"slider/#drag","title":"Drag","text":""},{"location":"slider/#drag-enable","title":"Drag enable","text":"
    • Get
      var enable = slider.enable;\n
    • Set
      slider.setEnable(enable);  // enable: true, or false\nslider.enable = enable;\n
    • Toggle
      slider.toggleEnable();\n
    "},{"location":"slider/#is-dragging","title":"Is dragging","text":"
    var isDragging = slider.isDragging;\n
    "},{"location":"snap/","title":"Snap","text":""},{"location":"snap/#introduction","title":"Introduction","text":"

    Snap a value to nearest grid slice, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"snap/#usage","title":"Usage","text":""},{"location":"snap/#round","title":"Round","text":"
    var out = Phaser.Math.Snap.To(value, gap);\n// var out = Phaser.Math.Snap.To(value, gap, start);\n

    Example: set gap to 5

    • Set value to 12, return 10
    • Set value to 14, return 15
    "},{"location":"snap/#ceil","title":"Ceil","text":"
    var out = Phaser.Math.Snap.Ceil(value, gap);\n// var out = Phaser.Math.Snap.Ceil(value, gap, start);\n

    Example: set gap to 5

    • Set value to 12, return 15
    • Set value to 14, return 15
    "},{"location":"snap/#floor","title":"Floor","text":"
    var out = Phaser.Math.Snap.Floor(value, gap);\n// var out = Phaser.Math.Snap.Floor(value, gap, start);\n

    Example: set gap to 5

    • Set value to 12, return 10
    • Set value to 14, return 10
    "},{"location":"snapshot/","title":"Snapshot","text":""},{"location":"snapshot/#introduction","title":"Introduction","text":"

    Get snapshot image, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"snapshot/#usage","title":"Usage","text":""},{"location":"snapshot/#get-snapshot-image","title":"Get snapshot image","text":"
    • Whole canvas
      game.renderer.snapshot(callback);\n// game.renderer.snapshot(callback, type, encoderOptions);\n
    • A rectangle area
      game.renderer.snapshotArea(x, y, width, height, callback);\n// game.renderer.snapshot(x, y, width, height, callback, type, encoderOptions);\n
      • x, y, width, height : Top-left position and size based on game viewport. (not the world)
    • A pixel
      game.renderer.snapshotPixel(x, y, callback);\n

    Parameters:

    • type : 'image/png'
    • encoderOptions : 0.92
    • callback :
      function(image){ /* ... */};\n
      • image : Image element
    "},{"location":"sprite/","title":"Sprite","text":""},{"location":"sprite/#introduction","title":"Introduction","text":"

    Display of both static and animated images, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"sprite/#usage","title":"Usage","text":""},{"location":"sprite/#load-texture","title":"Load texture","text":"

    Texture for static image

    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"sprite/#load-atlas","title":"Load atlas","text":"

    Atlas for animation images

    scene.load.atlas(key, textureURL, atlasURL);\n

    Reference: load atlas

    "},{"location":"sprite/#add-sprite-object","title":"Add sprite object","text":"
    var sprite = scene.add.sprite(x, y, key);\n// var sprite = scene.add.sprite(x, y, key, frame);\n

    Add sprite from JSON

    var sprite = scene.make.sprite({\nx: 0,\ny: 0,\nkey: '',\n// frame: '',\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n\n// anims: {\n// key: ,\n// repeat: ,\n// ...\n// },\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    • key :
      • A string
      • An array of string to pick one element at random
    • x, y, scale.x, scale.y :
      • A number
      • A callback to get return value
        function() { return 0; }\n
      • Random integer between min and max
        { randInt: [min, max] }\n
      • Random float between min and max
        { randFloat: [min, max] }\n
    "},{"location":"sprite/#custom-class","title":"Custom class","text":"
    • Define class
      class MySprite extends Phaser.GameObjects.Sprite {\nconstructor(scene, x, y, texture, frame) {\nsuper(scene, x, y, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var sprite = new MySprite(scene, x, y, key);\n
    "},{"location":"sprite/#texture","title":"Texture","text":"

    See game object - texture

    "},{"location":"sprite/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"sprite/#create-mask","title":"Create mask","text":"
    var mask = sprite.createBitmapMask();\n

    See mask

    "},{"location":"sprite/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"sprite/#animation","title":"Animation","text":""},{"location":"sprite/#create-animation","title":"Create animation","text":"
    • Global animation for all sprites
      scene.anims.create(config);\n
    • Private animation for this sprite
      sprite.anims.create(config);\n

    config : See Add animation section.

    "},{"location":"sprite/#create-aseprite-animation","title":"Create Aseprite animation","text":"
    • Global Aseprite animation for all sprites
      scene.anims.createFromAseprite(key, tags);\n
    • Private Aseprite animation for this sprite
      sprite.anims.createFromAseprite(key, tags);\n
    "},{"location":"sprite/#remove-animation","title":"Remove animation","text":"
    • Remove from global animation manager
      scene.anims.remove(key);\n
      or
      sprite.anims.globalRemove(key);\n
    • Remove from private animation state
      sprite.anims.remove(key);\n
    "},{"location":"sprite/#get-animation","title":"Get animation","text":"
    • Get global animation object
      var anim = scene.anims.get(key);\n
    • Get private animation object
      var anim = sprite.anims.get(key);\n
    "},{"location":"sprite/#has-animation","title":"Has animation","text":"
    • Has global animation object
      var hasAnim = scene.anims.exists(key);\n
    • Get private animation object
      var hasAnim = sprite.anims.exists(key);\n
    "},{"location":"sprite/#play-animation","title":"Play animation","text":"
    • Play
      sprite.play(key);\n// sprite.play(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
        • String key of animation
        • Animation config, to override default config
          {\nkey,\nframeRate,\nduration,\ndelay,\nrepeat,\nrepeatDelay,\nyoyo,\nshowOnStart,\nhideOnComplete,\nstartFrame,\ntimeScale\n}\n
    • Play in reverse
      sprite.playReverse(key);\n// sprite.playReverse(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
    • Play after delay
      sprite.playAfterDelay(key, delay);\n
      • key : Animation key string, or animation config
    • Play after repeat
      sprite.playAfterRepeat(key, repeatCount);\n
      • key : Animation key string, or animation config
    "},{"location":"sprite/#chain","title":"Chain","text":"
    • Chain next animation
      sprite.chain(key);\n
      • key : Animation key string, or animation config
    • Chain next and next animation
      sprite.chain(key0).chain(key1);\n
      • key0, key1 : Animation key string, or animation config
    "},{"location":"sprite/#stop","title":"Stop","text":"
    • Immediately stop
      sprite.stop();\n
    • Stop after delay
      sprite.stopAfterDelay(delay);\n
    • Stop at frame
      sprite.stopOnFrame(frame);\n
      • frame : Frame object in current animation.
        var currentAnim = sprite.anims.currentAnim;\nvar frame = currentAnim.getFrameAt(index);\n
    • Stop after repeat
      sprite.stopAfterRepeat(repeatCount);\n
    "},{"location":"sprite/#restart","title":"Restart","text":"
    sprite.anims.restart();\n// sprite.anims.restart(includeDelay, resetRepeats);\n
    "},{"location":"sprite/#time-scale","title":"Time scale","text":"
    • Get
      var timeScale = sprite.anims.globalTimeScale;\n
    • Set
      sprite.anims.globalTimeScale = timeScale;\n

    See also Global time scale

    "},{"location":"sprite/#properties","title":"Properties","text":"
    • Has started
      var hasStarted = sprite.anims.hasStarted;\n
    • Is playing
      var isPlaying = sprite.anims.isPlaying;\n
    • Is paused
      var isPaused = sprite.anims.isPaused;\n
    • Total frames count
      var frameCount = sprite.anims.getTotalFrames();\n
    • Delay
      var delay = sprite.anims.delay;\n
    • Repeat
      • Total repeat count
        var repeatCount = sprite.anims.repeat;\n
      • Repeat counter
        var repeatCount = sprite.anims.repeatCounter;\n
      • Repeat delay
        var repeatDelay = sprite.anims.repeatDelay;\n
      • Yoyo
        var repeatDelay = sprite.anims.yoyo;\n
    • Current animation key
      var key = sprite.anims.getName();\n
      • key : Return '' if not playing any animation.
    • Current frame name
      var frameName = sprite.anims.getFrameName();\n
      • frameName : Return '' if not playing any animation.
    • Current animation
      var currentAnim = sprite.anims.currentAnim;\n
    • Current frame
      var currentFrame = sprite.anims.currentFrame;\n
    "},{"location":"sprite/#events","title":"Events","text":"
    • On start
      sprite.on('animationstart', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationstart-' + key, function(currentAnim, currentFrame, sprite){});\n
    • On restart
      sprite.on('animationrestart', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationrestart-' + key, function(currentAnim, currentFrame, sprite){});\n
    • On complete
      sprite.on('animationcomplete', function(currentAnim, currentFramee, sprite){});\n
      sprite.on('animationcomplete-' + key, function(currentAnim, currentFramee, sprite){});\n
    • On stop
      sprite.on('animationstop', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationstop-' + key, function(currentAnim, currentFrame, sprite){});\n
    • On update
      sprite.on('animationupdate', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationupdate-' + key, function(currentAnim, currentFrame, sprite){});\n
    • On repeat
      sprite.on('animationrepeat', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationrepeat-' + key, function(currentAnim, currentFrame, sprite){});\n
    "},{"location":"statemanager/","title":"State manager","text":""},{"location":"statemanager/#introduction","title":"Introduction","text":"

    Another version of Finite state machine.

    • Author: Rex
    • Object
    "},{"location":"statemanager/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"statemanager/#install-plugin","title":"Install plugin","text":""},{"location":"statemanager/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexstatemanagerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexstatemanagerplugin.min.js', true);\n
    • Add StateManager object
      var states = scene.plugins.get('rexstatemanagerplugin').add(config);\n
    "},{"location":"statemanager/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import StateManagerPlugin from 'phaser3-rex-plugins/plugins/statemanager-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexStateManager',\nplugin: StateManagerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add StateManager object
      var states = scene.plugins.get('rexStateManager').add(config);\n
    "},{"location":"statemanager/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import StateManager from 'phaser3-rex-plugins/plugins/statemanager.js';\n
    • Add StateManager object
      var states = new StateManager(config);\n
    "},{"location":"statemanager/#create-instance","title":"Create instance","text":"
    var states = scene.plugins.get('rexStateManager').add({\neventEmitter: undefined\n});\n
    • eventEmitter
      • undefined : Create a private event emitter, default value.
      • false : Don't add any event emitter, i.e. no event will be fired.
      • Event emitter object : Fire event through this event emitter.
    "},{"location":"statemanager/#custom-class","title":"Custom class","text":"
    • Define class
      class MyStates extends StateManager {\nconstructor(config) {\nsuper(config);\n\nthis.addStates({\nA: {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n},\n// ...\n});\n}\n}\n
    • Create instance
      var states = new MyStates(config);\n
    "},{"location":"statemanager/#add-new-state","title":"Add new state","text":"

    states.addState(name, {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n})\n
    states.addState({\nname: 'A',\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n})\n

    or

    states.addStates({\n'A' : {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n},\n// ...\n})\n
    states.addStates([\n{\nname: 'A',\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n},\n// ...\n]);\n

    "},{"location":"statemanager/#read-state","title":"Read state","text":"
    • Current state
      var curState = state.state;\n
    • Previous state
      var preState = state.prevState;\n
    "},{"location":"statemanager/#start-at-state","title":"Start at state","text":"

    Set new state without triggering any state-changing callbacks or events.

    state.start(newState);\n
    "},{"location":"statemanager/#next-state","title":"Next state","text":"
    graph TB\n\nnext[\"states.next()\"] --> next_A[\"stateA.next()<br>return 'B'\"]\n\nnext_A --> eventStateChange[\"states.emit('statechange', states)<br>states.prevState -> states.state\"]\n\nsubgraph State changing\n\neventStateChange --> exit_A[\"stateA.exit()\"]\nexit_A --> eventExitA[\"states.emit('exit_A', states)\"]\n\neventExitA --> enter_B[\"stateB.enter()\"]\nenter_B --> eventEnterB[\"states.emit('enter_B', states)\"]\n\nsubgraph Exit\nexit_A\neventExitA\nend\n\nsubgraph Enter\nenter_B\neventEnterB\nend\n\nend\n\ngoto[\"states.goto('B')\"] --> eventStateChange\n\nsubgraph Request\n\nsubgraph Next\nnext\nnext_A\nend\n\nsubgraph Goto\ngoto\nend\n\nend
    "},{"location":"statemanager/#request","title":"Request","text":"
    • Get next state by callback
      states.next();    // nextState = stateA.next()    \n
    • Goto state
      states.goto(nextState);\n// states.state = nextState;\n
    "},{"location":"statemanager/#state-changing","title":"State-changing","text":"

    These callbacks or events will be triggered if state is changing.

    For example, state is changing from 'A' to 'B'.

    1. event statechange
      states.on('statechange', function(states) {\nconsole.log( states.prevState + '->' + states.state );\n});\n
    2. callback stateA.exit
    3. event exit_A
      states.on('exit_A', function(states) {\n/*...*/\n});\n
    4. callback stateB.enter
    5. event enter_B
      states.on('enter_B', function(states) {\n/*...*/\n});\n
    "},{"location":"statemanager/#enable","title":"Enable","text":"
    states.setEnable();\n// states.setEnable(false); // disable\n

    or

    states.toggleEnable();\n

    states.next() and states.goto() will be ignored if disabled.

    "},{"location":"statemanager/#update","title":"Update","text":"
    • Start
      states.startUpdate();\nstates.startPreUpdate();\nstates.startPostUpdate();\n// Assume that `scene` is assigned in config of constructor\n
      or
      states.startUpdate(scene);\nstates.startPreUpdate(scene);\nstates.startPostUpdate(scene);\n
      • scene : Scene object
    • Stop
      states.stopUpdate();\nstates.stopPreUpdate();\nstates.stopPostUpdate();\n
    • Get scene
      var scene = states.getScene();\n// var scene = states._scene;\n
    "},{"location":"statemanager/#remove-state","title":"Remove state","text":"
    • Remve a state
      states.removeState(stateName);\n
    • Remve all states
      states.removeAllStates();\n
    "},{"location":"step/","title":"Step","text":""},{"location":"step/#introduction","title":"Introduction","text":"

    Interpolate points between previous position and current position with fixed step length.

    • Author: Rex
    • Behavior of game object
    "},{"location":"step/#live-demos","title":"Live demos","text":"
    • Step
    "},{"location":"step/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"step/#install-plugin","title":"Install plugin","text":""},{"location":"step/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexstepplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexstepplugin.min.js', true);\n
    • Add step behavior
      var step = scene.plugins.get('rexstepplugin').add(gameObject, config);\n
    "},{"location":"step/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import StepPlugin from 'phaser3-rex-plugins/plugins/step-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexStep',\nplugin: StepPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add move-to behavior
      var step = scene.plugins.get('rexStep').add(gameObject, config);\n
    "},{"location":"step/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Step from 'phaser3-rex-plugins/plugins/step.js';\n
    • Add move-to behavior
      var step = new Step(gameObject, config);\n
    "},{"location":"step/#create-instance","title":"Create instance","text":"
    var step = scene.plugins.get('rexStep').add(gameObject, {\n// enable: true,\n// stepLength: 5,    \n});\n
    • enable : Set true to fire step event for each interpolate point.
    • stepLength : Fixed length between each interpolate point.
    "},{"location":"step/#enable","title":"Enable","text":"
    • Enable (default)
      step.setEnable();\n
      or
      step.enable = true;\n
    • Disable
      step.setEnable(false);\n
      or
      step.enable = false;\n
    "},{"location":"step/#set-step-length","title":"Set step length","text":"
    step.setStepLength(stepLength);\n// step.stepLength = stepLength;\n
    "},{"location":"step/#events","title":"Events","text":"
    • On each interpolate point
      step.on('step', function(gameObject, step, x, y){\n\n}, scope);\n
      • Invoke step.cancelStep() to cancel interpolation.
    • On interpolate points between previous position and current position
      step.on('steps', function(gameObject, step, points){\n\n}, scope);\n
      • points : Array of point {x, y}
    "},{"location":"step/#inject-methods","title":"Inject methods","text":"
    • Inject methods into game object
      scene.plugins.get('rexStep').injectMethods(gameObject);\n
    • Inject methods into class of game object
      scene.plugins.get('rexStep').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexStep').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into class of game object
      scene.plugins.get('rexStep').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexStep').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into root class of game object
      scene.plugins.get('rexStep').injectMethodsToRootClass(e);\n// scene.plugins.get('rexStep').injectMethods(Phaser.GameObjects.GameObject.prototype);\n
    "},{"location":"step/#injected-methods","title":"Injected methods","text":"
    • Step start
      gameObject.stepStart(stepLength);\n// gameObject.stepStart({stepLength});\n
    • Step stop
      gameObject.stepStop();\n
    • Events
      • Step
        gameObject.on('step.step', function(gameObject, x, y) { });\n
    "},{"location":"structs-list/","title":"List","text":""},{"location":"structs-list/#introduction","title":"Introduction","text":"

    An ordered list, built-in data structure of phaser.

    • Author: Richard Davey
    "},{"location":"structs-list/#usage","title":"Usage","text":""},{"location":"structs-list/#create-instance","title":"Create instance","text":"
    var list = new Phaser.Structs.List();\n
    "},{"location":"structs-list/#add-child","title":"Add child","text":"
    list.add(child);\n
    list.addAt(child, index);\n
    "},{"location":"structs-list/#exist","title":"Exist","text":"
    var hasChild = list.exists(child);\n
    "},{"location":"structs-list/#get-child","title":"Get child","text":"
    var firstChild = list.first;\nvar nextChild = list.next;\nvar prevChild = list.previous;\nvar lastChild = list.last;\n
    var child = list.getByName(name);\n
    var child = list.getRandom(startIndex, length);\n
    var child = list.getFirst(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    var child = list.getAll(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    var child = list.count(property, value);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    "},{"location":"structs-list/#get-children","title":"Get children","text":"
    var children = list.list;\n
    "},{"location":"structs-list/#sort-children","title":"Sort children","text":"
    • Sort by property
      list.sort(property);\n// list.sort(property, handler);\n
      • property : The property to lexically sort by.
      • handler :
        function (childA, childB) {\nreturn 0; // 0, 1, -1\n}\n
    "},{"location":"structs-list/#remove-child","title":"Remove child","text":"
    list.remove(child);\n
    list.removeAt(index);\n
    list.removeBetween(startIndex, endIndex);\n
    list.removeAll();\n
    "},{"location":"structs-list/#order-of-child","title":"Order of child","text":"
    list.moveTo(child, index);\n
    list.bringToTop(child);\n
    list.sendToBack(child);\n
    list.moveUp(child);\n
    list.moveDown(child);\n
    list.moveAbove(child1, child2);  // Move child1 above child2\n
    list.moveBelow(child1, child2);  // Move child1 below child2\n
    list.swap(child1, child2);\n
    list.reverse();\n
    list.shuffle();\n
    "},{"location":"structs-list/#replace-child","title":"Replace child","text":"
    list.replace(oldChild, newChild);\n
    "},{"location":"structs-list/#set-properties","title":"Set properties","text":"
    list.setAll(property, value, startIndex, endIndex);\n
    "},{"location":"structs-list/#for-each-child","title":"For each child","text":"
    • Iterate current children list
      list.each(callback);\n// list.each(callback, context);\n// list.iterate(callback, context, arg0, arg1, ...);\n
      • callback :
        function(child, arg0, arg1, ...) {\n\n}\n
    "},{"location":"structs-list/#children-counts","title":"Children counts","text":"
    var size = list.length;\n
    "},{"location":"structs-set/","title":"Set","text":""},{"location":"structs-set/#introduction","title":"Introduction","text":"

    A collection of unique elements, built-in data structure of phaser.

    • Author: Richard Davey
    "},{"location":"structs-set/#usage","title":"Usage","text":""},{"location":"structs-set/#create-instance","title":"Create instance","text":"
    var set = new Phaser.Structs.Set();\n

    or

    var set = new Phaser.Structs.Set(elements);\n
    "},{"location":"structs-set/#add-an-element","title":"Add an element","text":"
    set.set(element);\n
    "},{"location":"structs-set/#remove-an-element","title":"Remove an element","text":"
    set.delete(element);\n
    "},{"location":"structs-set/#remove-all-elements","title":"Remove all elements","text":"
    set.clear();\n
    "},{"location":"structs-set/#has-element","title":"Has element","text":"
    set.contains(element);\n
    "},{"location":"structs-set/#get-elements","title":"Get elements","text":"
    var elements = set.entries;\n

    or get a shallow copy of elements

    var elements = set.getArray();\n
    "},{"location":"structs-set/#element-counts","title":"Element counts","text":"
    var size = set.size;\n
    "},{"location":"structs-set/#for-each-element","title":"For each element","text":"
    • For when you know this Set will be modified during the iteration.
      set.each(function(element, index) {\n// return false;  // return false to cancel iteration\n}, scope)\n
    • For when you absolutely know this Set won't be modified during the iteration.
      set.iterate(function(element, index) {\n// return false;  // return false to cancel iteration\n}, scope)\n
    "},{"location":"structs-set/#set-operations","title":"Set operations","text":"
    • C = A | B
      var setC = setA.union(setB);\n
    • C = A & B
      var setC = setA.intersect(setB);\n
    • C = A - B
      var setC = setA.difference(setB);\n
    "},{"location":"tagplayer/","title":"Tag player","text":""},{"location":"tagplayer/#introduction","title":"Introduction","text":"

    Text commands to control sprites, texts, sound effect or backgroun music.

    • Author: Rex
    • Member of scene
    "},{"location":"tagplayer/#live-demos","title":"Live demos","text":"
    • Sprite
    • Textbox
    • Custom game object
    • Viewport-coordinate
    "},{"location":"tagplayer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tagplayer/#install-plugin","title":"Install plugin","text":""},{"location":"tagplayer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextagplayerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextagplayerplugin.min.js', true);\n
    • Add tag-player object
      var tagPlayer = scene.plugins.get('rextagplayerplugin').add(scene, config);\n
    "},{"location":"tagplayer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TagPlayerPlugin from 'phaser3-rex-plugins/plugins/tagplayer-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTagPlayerPlugin',\nplugin: TagPlayerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tag-player object
      var tagPlayer = scene.plugins.get('rexTagPlayerPlugin').add(scene, config);\n
    "},{"location":"tagplayer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TagPlayer from 'phaser3-rex-plugins/plugins/tagplayer.js';\n
    • Add tag-player object
      var tagPlayer = new TagPlayer(scene, config);\n
    "},{"location":"tagplayer/#create-instance","title":"Create instance","text":"
    var tagPlayer = scene.plugins.get('rexTagPlayerPlugin').add(scene, {\nparser: {\ndelimiters: '[]',\ncomment: '//',\n// translateTagNameCallback: undefined,\n}\n\nsprites: {\n// createGameObject: 'sprite',\n// fade: 500,  \n// fade: {mode: 'tint', time: 500},\n// viewportCoordinate: false,\n// symbols: undefined,  // { key:value }\n}, // sprites: false,\n\ntexts: {\n// createGameObject: undefined,        \n// fade: 500,\n// fade: {mode: 'tint', time: 500},\n// viewportCoordinate: false,\n// symbols: undefined,  // { key:value }\n}\n// texts: false,\n\nlayers: undefined, // []\n\nsounds: {\nbgm: {\ninitial: undefinied,\nloop: true,\nfade: 500\n},\nbgm2: {\ninitial: undefinied,\nloop: true,\nfade: 500\n}\n},\n\nclickTarget: scene,\n});\n
    • parser : Configuration of parser.
      • parser.delimiters : Delimiters of tag.
        • A single string with 2 characters. Default value is '[]'.
        • A array with 2 strings. e.x. ['[[',']]'].
      • parser.comment : Start word of a comment line. Default value is '//'.
        • null, or false : No comment line.
      • parser.translateTagNameCallback : Callback to translate tag-name
        • undefined : Use original tag-name. Default behavior.
        • A function, return new tag name.
          function(tagName) {\nreturn newTagName;\n}\n
    • sprites : Configuration of sprites.
      • sprites.createGameObject :
        • 'sprite' : Create sprite game object. Default behavior.
        • 'image' : Create image game object.
        • Callback to return a game object
          function(scene, a, b, c) {\n// return gameObject;\n}\n
          • a, b, c : Parameters pass from [sprite.name=a,b,c]
      • sprites.fade :
        • 0 : No fade-in or fade-out when adding or removing a sprite.
        • A number : Duration of fading. Default value is 500.
        • A plain object contains mode, time
          • sprite.fade.mode : Fade mode
            • 'tint', or 0 : Fade-in or fade-out via tint property.
            • 'alpha', or 1 : Fade-in or fade-out via alpha property.
            • 'revealUp', or 2 : Reveal up for fade-in.
            • 'revealDown', or 3 : Reveal down for fade-in.
            • 'revealLeft', or 4 : Reveal left for fade-in.
            • 'revealRight', or 5 : Reveal right for fade-in.
          • sprite.fade.time : Duration of fading. Default value is 500.
      • sprites.viewportCoordinate : Apply viewportCoordinate behavior to sprite game object.
        • true : Attach vpx, vpy, vp to sprite game object.
          • vpx, vpy : Number between 0~1. Proportion of viewport.
          • vp : Viewport in rectangle
        • false : Do nothing, default behavior.
      • sprites.symbols : Convert string value to number value when Set or Ease property of game object.
        • A plain object contains string key and number value.
      • false, null : No sprite manager
    • texts : Configuration of texts.
      • texts.createGameObject :
        • undefined, or 'text' : Create text game object. Default behavior.
        • Callback to return a game object
          function(scene, a, b, c) {\n// return gameObject;\n}\n
          • a, b, c : Parameters pass from [text.name=a,b,c]
      • texts.fade :
        • 0 : No fade-in or fade-out when adding or removing a text game object.
        • A number : Duration of fading. Default value is 500.
        • A plain object contains mode, time
          • texts.fade.mode : Fade mode
            • 'tint', or 0 : Fade-in or fade-out via tint property.
            • 'alpha', or 1 : Fade-in or fade-out via alpha property.
            • 'revealUp', or 2 : Reveal up for fade-in.
            • 'revealDown', or 3 : Reveal down for fade-in.
            • 'revealLeft', or 4 : Reveal left for fade-in.
            • 'revealRight', or 5 : Reveal right for fade-in.
          • texts.fade.time : Duration of fading. Default value is 500.
      • texts.viewportCoordinate : Apply viewportCoordinate behavior to text game object.
        • true : Attach vpx, vpy, vp to sprite game object.
          • vpx, vpy : Number between 0~1. Proportion of viewport.
          • vp : Viewport in rectangle
        • false : Do nothing, default behavior.
      • texts.symbols : Convert string value to number value when Set or Ease property of game object.
        • A plain object contains string key and number value.
      • false, null : No text manager
    • layers :
      • undefined : Don't create layerManger.
      • Array of string : Pre-create layer game objects in layerManger.
    • sounds : Configuration of sound effect, or background music.
      • sounds.bgm.initial, sounds.bgm2.initial : Initial music instance created by scene.sound.add(key) before starting playing content.
        • undefined : No initial music instance, default value.
      • sounds.bgm.loop, sounds.bgm2.loop :
        • true : Loop background music, default behavior.
        • false : Play background music once.
      • sounds.bgm.fade, sounds.bgm2.fade :
        • 0 : No fade-in or fade-out when starting or stopping a background music.
        • A number : Fade-in or fade-out (cross-fade) when starting or stopping a background music. Default value is 500.
    • clickTarget : Click target.
      • scene : Any pointer down on this scene. Default target.
    "},{"location":"tagplayer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTagPlayer extends TagPlayer {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\n}\n// ...\n}\n
    • Create instance
      var tagPlayer = new MyTagPlayer(scene, config);\n
    "},{"location":"tagplayer/#game-object-manager","title":"Game object manager","text":"
    tagPlayer.addGameObjectManager({\nname: goType,\ncreateGameObject: function(scene, ...) {\nreturn gameObject\n},\n\n// fade: 500,\n// fade: {mode: 'tint', time: 500},\n\n// viewportCoordinate: false,\n// viewportCoordinate: { viewport: new Phaser.Geom.Rectangle() },\n\n// defaultLayer: layerName,\n\n// symbols: undefined,  // { key:value },\n})\n
    • name : Name of this game object manager, a string.
    • createGameObject : Callback to return a game object
      function(scene, a, b, c) {\n// return gameObject;\n}\n
      • a, b, c : Parameters pass from [goType.name=a,b,c]
    • fade : Tint-fade (if game object has tint property) or alpha-fade game object when creating or destroying a game object.
      • 0 : No fade-in or fade-out when adding or removing a game object.
      • A number : Duration of fading. Default value is 500.
      • A plain object contains mode, time
        • fade.mode : Fade mode
          • 'tint', or 0 : Fade-in or fade-out via tint property.
          • 'alpha', or 1 : Fade-in or fade-out via alpha property.
          • 'revealUp', or 2 : Reveal up for fade-in.
          • 'revealDown', or 3 : Reveal down for fade-in.
          • 'revealLeft', or 4 : Reveal left for fade-in.
          • 'revealRight', or 5 : Reveal right for fade-in.
        • fade.time : Duration of fading. Default value is 500.
    • viewportCoordinate : Apply viewportCoordinate behavior to sprite game object.
      • false : Do nothing, default behavior.
      • true, or an object :
        • viewport :
          • undefined : Rectangle of display area under main camera of current scene. Default value.
          • A rectangle
    • defaultLayer : Put this game object into layer inside of layerManager.
    • symbols : Convert string value to number value when Set or Ease property of game object.
      • A plain object contains string key and number value.
    "},{"location":"tagplayer/#built-in-commands","title":"Built-in commands","text":"

    goType : name parameter in config of tagPlayer.addGameObjectManager method

    • Add game object : [goType.name=a,b,c]
      • Tint-fade-in, or alpha-fade-in if fade is not 0
    • Remove game object : [/goType.name]
      • Tint-fade-out, or alpha-fade-out if fade is not 0
    • Remove all game objects : [/goType]
      • Tint-fade-out, or alpha-fade-out if fade is not 0
    • Call method : [goType.name.methodName=value0,value1,value2]
    • Set property : [goType.name.x=value], [goType.name.alpha=value], ....
    • Ease property :
      [goType.name.prop.easeMode=value,duration]\n[goType.name.prop.easeMode=value,duration,repeat]\n[goType.name.prop.easeMode=value,duration,easeFunction,repeat]\n[goType.name.prop.easeMode=value]\n
      • prop : Any number property of this sprite.
      • easeMode : One of these modes
        • to, toLeft, toRight, toUp, toDown
        • yoyo, yoyoLeft, yoyoRight, yoyoUp, yoyoDown
        • from, fromLeft, fromRight, fromUp, fromDown
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Wait ease task of game object's number property : [wait=goType.name.prop]
      • Also fire event 'wait.' + goType
        tagPlayer.on('wait.' + goType, function(name, prop) {\n})\n
    • Wait a game objects are destroyed : [wait=goType.name]
      • Also fire event 'wait.' + goType
        tagPlayer.on('wait.' + goType, function(name, prop) {\n// prop parameter are `undefined` here\n})\n
    • Wait all game objects are destroyed : [wait=goType]
      • Also fire event 'wait.' + goType
        tagPlayer.on('wait.' + goType, function(name, prop) {\n// name and prop parameter are `undefined` here\n})\n
    • Wait boolean data in game object's data manager set to true/false : [wait=goType.name.dataKey]/[wait=goType.name.!dataKey]
      • Also fire event 'wait.' + goType
        tagPlayer.on('wait.' + goType, function(name, prop) {\n})\n
    "},{"location":"tagplayer/#execute-commands","title":"Execute commands","text":"
    tagPlayer.play(commands);\n

    or

    tagPlayer.playPromise(commands)\n.then(function(){\n// Typing content complete\n})\n
    "},{"location":"tagplayer/#pause","title":"Pause","text":"
    • Pause
      tagPlayer.pause();\n
    • Pause until event
      tagPlayer.pauseUntilEvent(eventEmitter, eventName);\n
    • Is paused (not playing)
      var isPaused = !tagPlayer.isPlaying;\n

    Invoke this method during tag-start,tag-end, or content events to suspend parsing.

    "},{"location":"tagplayer/#resume","title":"Resume","text":"
    tagPlayer.resume();\n
    "},{"location":"tagplayer/#time-scale","title":"Time scale","text":"

    Time scale of typing, typing animation, sprite animation and easing of sprite's properties.

    • Get
      var timeScale = tagPlayer.timeScale;\n
    • Set
      tagPlayer.setTimeScale(timeScale);    
      tagPlayer.timeScale = timeScale;\n
    "},{"location":"tagplayer/#events","title":"Events","text":"
    • On typing content complete
      tagPlayer.on('complete', function() {\n\n})\n
    "},{"location":"tagplayer/#tags-of-content","title":"Tags of content","text":""},{"location":"tagplayer/#sprite","title":"Sprite","text":"
    • Add sprite : [sprite.name=textureKey,frameKey]
      • Tint-fade-in if sprite.fade is not 0
    • Remove sprite : [/sprite.name]
      • Tint-fade-out if sprite.fade is not 0
    • Remove all sprites : [/sprite]
      • Tint-fade-out if sprite.fade is not 0
    • Call method : [sprite.name.methodName=value0,value1,value2]
    • Set property : [sprite.name.x=value], [sprite.name.alpha=value], ....
    • Ease property :
      [sprite.name.prop.easeMode=value,duration]\n[sprite.name.prop.easeMode=value,duration,repeat]\n[sprite.name.prop.easeMode=value,duration,easeFunction,repeat]\n[sprite.name.prop.easeMode=value]\n
      • prop : Any number property of this sprite.
      • easeMode : One of these modes
        • to, toLeft, toRight, toUp, toDown
        • yoyo, yoyoLeft, yoyoRight, yoyoUp, yoyoDown
        • from, fromLeft, fromRight, fromUp, fromDown
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Set texture : [sprite.name.texture=textureKey,frameKey]
    • Play animation : [sprite.name.play=animationKey], or [sprite.name.play=animationKey0,animationKey1,...]
      • Can play animation without adding sprite first.
    • Stop animation : [/sprite.name.play], or [sprite.name.stop]
    • Pause animation : [sprite.name.pause]
    "},{"location":"tagplayer/#text","title":"Text","text":"
    • Add text : [text.name]
      • Tint-fade-in if text.fade is not 0
    • Remove text : [/text.name]
      • Tint-fade-out if text.fade is not 0
    • Remove all texts : [/text]
      • Tint-fade-out if text.fade is not 0
    • Call method : [text.name.methodName=value0,value1,value2]
    • Set property : [text.name.x=value], [text.name.alpha=value], ....
    • Ease property :
      [sprite.name.prop.easeMode=value,duration]\n[sprite.name.prop.easeMode=value,duration,repeat]\n[sprite.name.prop.easeMode=value,duration,easeFunction,repeat]\n[sprite.name.prop.easeMode=value]\n
      • prop : Any number property of this sprite.
      • easeMode : One of these modes
        • to, toLeft, toRight, toUp, toDown
        • yoyo, yoyoLeft, yoyoRight, yoyoUp, yoyoDown
        • from, fromLeft, fromRight, fromUp, fromDown
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Set text
      [text.name.text]\ncontent\\\\n\nnewline\\\\n\nnewline\n
    • Typing text
      [text.name.typing]\n// [text.name.typing=speed]\ncontent\\\\n\nnewline\\\\n\nnewline\n
    "},{"location":"tagplayer/#sound-effect","title":"Sound effect","text":"
    • Play : [se=key], [se2=key]
      • Sound effect will be destroyed when complete
    • Play with fade in volume : [se=key,1000], [se2=key,1000]
    • Fade in volume : [se.fadein=1000], [se2.fadein=1000]
    • Fade out volume : [se.fadeout=1000], [se2.fadeout=1000]
    • Fade out volume then stop : [se.fadeout=1000,stop], [se2.fadeout=1000,stop]
    • Set volume : [se.volume=1], [se2.volume=1]
    "},{"location":"tagplayer/#background-music","title":"Background music","text":"
    • Play, stop : [bgm=key], [/bgm], [bgm2=key], [/bgm2]
      • Previous background music will be stopped and destroyed.
      • Cross fade to next background music if sounds.bgm.fade/sounds.bgm2.fade is not 0
    • Play with fade in volume : [bgm=key,1000], [bgm2=key,1000]
    • Pause, resume : [bgm.pause], [/bgm.pause], [bgm2.pause], [/bgm2.pause]
    • Fade in volume : [bgm.fadein=1000], [bgm2.fadein=1000]
    • Fade out volume : [bgm.fadeout=1000], [bgm2.fadeout=1000]
    • Fade out volume then stop : [bgm.fadeout=1000,stop], [bgm2.fadeout=1000,stop]
    • Cross fade to another background music : [bgm.cross=key,10000], [bgm2.cross=key,10000]
    • Set volume : [bgm.volume=1], [bgm2.volume=1]
    • Mute : [bgm.mute], [bgm2.mute], [bgm.unmute], [bgm2.unmute]
    "},{"location":"tagplayer/#camera","title":"Camera","text":"
    • Fade-in effect : [camera.fadein], [camera.fadein=1000], or [camera.fadein=duration,red,green,blue]
    • Fade-out effect : [camera.fadeout], [camera.fadeout=1000], or [camera.fadeout=duration,red,green,blue]
    • Flash effect : [camera.flash], [camera.flash=1000], or [camera.flash=duration,red,green,blue]
    • Shake effect : [camera.shake], [camera.shake=1000], or [camera.shake=duration,intensity]
    • Zoom
      • Set zoom : [camera.zoom=2]
      • Zoom to : [camera.zoom.to=1,1000], or [camera.zoom.to=zoomValue,duration,Cubic]
    • Rotate
      • Set angle : [camera.rotate=90], angle in degrees
      • Rotate to : [camera.rotate.to=0,1000], or [camera.rotate.to=deg,duration,Cubic], angle in degrees
    • Scroll
      • Scroll x,y : [camera.scroll=0,200]
      • Scroll x,y to : [camera.scroll.to=0,200,1000], or [camera.rotate.to=x,y,duration,Cubic]
    "},{"location":"tagplayer/#wait-conditions","title":"Wait conditions","text":"
    • Wait click : [wait=click], [click]
      • Also fire event 'wait.click'
         tagPlayer.on('wait.click', function() {\n})\n
    • Wait key-down : [wait=enter], [wait=space], ....
      • Also fire event 'wait.keydown'
         tagPlayer.on('wait.keydown', function(keyName) {\n})\n
    • Wait time : [wait=1000]
      • Also fire event 'wait.time'
         tagPlayer.on('wait.time', function(time) {\n})\n
    • Wait sound effect : [wait=se], [wait=se2]
      • Also fire event 'wait.music'
         tagPlayer.on('wait.music', function(music) {\n// var key = music.key;\n})\n
    • Wait background music : [wait=bgm], [wait=bgm2]
      • Also fire event 'wait.music'
         tagPlayer.on('wait.music', function(music) {\n// var key = music.key;\n})\n
    • Wait camera effect : [wait=camera.fadein], [wait=camera.fadeout], [wait=camera.flash], [wait=camera.shake], [wait=camera.zoom], [wait=camera.rotate], [wait=camera.scroll]
      • Also fire event 'wait.camera'
         tagPlayer.on('wait.camera', function(effectName) {\n// effectName : 'camera.fadein', 'camera.fadeout', 'camera.flash', 'camera.shake', 'camera.zoom', 'camera.rotate', 'camera.scroll'\n})\n
    • Wait ease task of sprite's property : [wait=sprite.name.prop]
      • Also fire event 'wait.sprite'
        tagPlayer.on('wait.sprite', function(name, prop) {\n})\n
    • Wait a sprite are destroyed : [wait=sprite.name]
      • Also fire event 'wait.sprite'
        tagPlayer.on('wait.sprite', function(name, prop) {\n// prop parameter are `undefined` here\n})\n
    • Wait all sprites are destroyed : [wait=sprite]
      • Also fire event 'wait.sprite'
        tagPlayer.on('wait.sprite', function(name, prop) {\n// name and prop parameter are `undefined` here\n})\n
    • Wait boolean data in sprite's data manager set to true/false : [wait=sprite.name.dataKey]/[wait=sprite.name.!dataKey]
      • Also fire event 'wait.sprite'
        tagPlayer.on('wait.sprite', function(name, prop) {\n})\n
    • Wait callback : [wait], or [wait=xxx] (xxx is any string which not been used in above case)
      • Fire event 'wait'
        tagPlayer.on('wait', function(callback) {\n// Invoke `callback()` to continue typing\n})\n
      • Fire event 'wait.xxx'
        tagPlayer.on('wait.xxx', function(callback) {\n// Invoke `callback()` to continue typing\n})\n
    • Combine conditions : [wait=cond0|cond1|...]
      • Wait click, or enter key down : [wait=click|enter]
      • Wait click, enter key down, or 100ms : [wait=click|enter|1000]
    "},{"location":"tagplayer/#custom-tag","title":"Custom tag","text":"

    Assume that adding a custom tag : [custom=10,20][/custom]

    • On parse/execute a +custom tag, will add a custom command child
      tagPlayer.on('+custom', function(parser, a, b) {\n// console.log('Parse +custom tag:', a, b)\n})\n
      • a, b, ... : Parameters after =
      • Set content callback, will invoke this callback when getting a content
        var callback = function(content) {\n// ...\n}\ntagPlayer.setContentCallback(callback, scope);\n
    • On parse/execute a -custom tag, will add a custom command child
      tagPlayer.on('-custom', function(parser) {\n// console.log('Parse -custom tag')\n})\n
      • Clear content callback
        tagPlayer.setContentCallback();\n
    "},{"location":"tagplayer/#content","title":"Content","text":"

    These lines will be skipped :

    • Empty line, which only has space characters.
    • Comment line, start with '//'.

    New line symbol '\\n' will be removed, use \\\\n to insert a new line character.

    Content will pass to one of these callback/event

    1. Set content callback
      tagPlayer.setContentCallback(callback, scope);\n
      • Clear content callback
        tagPlayer.setContentCallback();\n
    2. On parse/execute a content, after a [custom] tag.
      tagPlayer.on('custom#content', function(content) {   })\n
    3. On parse/execute a content, after any tag.
      tagPlayer.on('content', function(content) {   })\n
    "},{"location":"tagplayer/#game-objects","title":"Game objects","text":"
    • Get game object by name
      var gameObject = tagPlayer.getGameObject(goType, name);\n
    • Get all game objects of a game object manager
      var gameObjects = tagPlayer.getGameObject(goType);\n
      • gameObjects : {name: gameObject}
    • Add existed game object into game object manager
      tagPlayer.addGameObject(goType, name, gameObject);\n
    "},{"location":"tagplayer/#data","title":"Data","text":"
    • Get
      var value = tagPlayer.getData(key);\nvar values = tagPlayer.getData(keys); // keys: an array of keys\nvar value = tagPlayer.data.values[key];\n
    • Set
      tagPlayer.setData(key, value);\ntagPlayer.incData(key, value);    tagPlayer.setData(obj); // obj: {key0:value0, key1:value1, ...}\ntagPlayer.data.values[key] = value;\ntagPlayer.data.values[key] += inc;\n
      or
      tagPlayer.toggleData(key);\n
    • Enable
      tagPlayer.setDataEnabled();\n
    • Events :
      • Set data evant
        tagPlayer.on('setdata', function(tagPlayer, key, value){ /* ... */ });\n
      • Change data event
        tagPlayer.on('changedata', function(tagPlayer, key, value, previousValue){ /* ... */ });\n
        tagPlayer.on('changedata-' + key, function(tagPlayer, value, previousValue){ /* ... */ });\n

    See data manager

    Note

    Ensure data manager is created before binding any data-changed events.

    "},{"location":"tagtext/","title":"Tag Text","text":""},{"location":"tagtext/#introduction","title":"Introduction","text":"

    Displays text with multi-color, font face, or font size with tags.

    • Author: Rex
    • Game object
    "},{"location":"tagtext/#live-demos","title":"Live demos","text":"
    • Tag text
    "},{"location":"tagtext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tagtext/#install-plugin","title":"Install plugin","text":""},{"location":"tagtext/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextagtextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextagtextplugin.min.js', true);\n
    • Add text object
      var txt = scene.add.rexTagText(x, y, content, config);\n
    "},{"location":"tagtext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TagTextPlugin from 'phaser3-rex-plugins/plugins/tagtext-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTagTextPlugin',\nplugin: TagTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text object
      var txt = scene.add.rexTagText(x, y, content, config);\n
    "},{"location":"tagtext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TagText from 'phaser3-rex-plugins/plugins/tagtext.js';\n
    • Add text object
      var txt = new TagText(scene, x, y, content, config);\nscene.add.existing(txt);\n
    "},{"location":"tagtext/#add-text-object","title":"Add text object","text":"
    var tags = {\ntag0: {\ncolor: 'red'\n},\ntag1: {\ncolor: 'blue'\n}\n};\nvar txt = scene.add.rexTagText(x, y, '<class=\"tag0\">h</class>ello', {tags:tags});\n// var txt = scene.add.rexTagText(x, y, '<class=\"tag0\">h</class>ello', { fontFamily: 'Arial', fontSize: 64, color: '#00ff00', tags:tags });\n
    • tags : {tagName:tag}, see Properties of tag.

    Default style

    {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\nbackgroundColor2: null,\nbackgroundHorizontalGradient: true,\nbackgroundStrokeColor: null,\nbackgroundStrokeLineWidth: 2,\n\nbackgroundCornerRadius: 0,\n// 0   : no round corner, \n// > 0 : convex round corner\n// < 0 : concave round corner\n\nbackgroundCornerIteration: null, color: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nunderline: {\ncolor: '#000',\nthickness: 0,\noffset: 0\n},\nstrikethrough: {\ncolor: '#000',\nthickness: 0,\noffset: 0\n},    // align: 'left',  // Equal to halign\nhalign: 'left', // 'left'|'center'|'right'\nvalign: 'top',  // 'top'|'center'|'bottom'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\nlineSpacing: 0,\ntestString: '|M\u00c9qgy',\n\nwrap: {\nmode: 'none'     // 0|'none'|1|'word'|2|'char'|'character'\nwidth: null\n},\n// wordWrap: { width: 0 },   // Compatible with Text game object\n\n// rtl: false,\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n\n// images: {\n//    key: { y:-8 }\n// }\n\ntags: {\n//tag0: {\n//  color: 'red'\n//},\n//tag1: {\n//  color: 'blue'\n//}\n}\n}\n
    var txt = scene.add.rexTagText({\nx: 0,\ny: 0,\ntext: '',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',\nbackgroundColor: '#ff00ff',\ntags: {}\n}\n})\n

    or

    var txt = scene.make.rexTagText({\nx: 100,\ny: 100,\npadding: {\nleft: 64,\nright: 16,\ntop: 20,\nbottom: 40\n//x: 32,    // 32px padding on the left/right\n//y: 16     // 16px padding on the top/bottom\n},\ntext: 'Text\\nGame Object\\nCreated from config',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',\nbackgroundColor: '#ff00ff',\ntags: {}\n},\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    • Alignment
      • halign, or align : Horizontal alignment.
        • left, center, right
      • valign : Vertical alignment.
        • top, center, bottom
    • images : See Image
    "},{"location":"tagtext/#properties-of-tag","title":"Properties of tag","text":"
    {\nfontFamily: 'Courier',   // or 'family', 'font-family'\nfontSize: '16px',        // or 'size', 'font-size'\nfontStyle: 'bold italic',// or 'style', 'font-style'\ncolor: 'red',            // or 'font-color'\nstroke: {\ncolor: 'blue',\nthickness: 1\n},\nshadow: {\ncolor: 'black',\noffsetX: 2,\noffsetY: 2,\nblur: 2\n},\nunderline: {            // or 'u'\ncolor: 'blue',\nthickness: 3,\noffset: -1\n},\nstrikethrough: {        // or 's'\ncolor: 'red',\nthickness: 3,\noffset: -1\n},    y: 0,\nimg: textureKey,\narea: areaKey,\n}\n
    "},{"location":"tagtext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends TagText {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, '<class=\"tag0\">h</class>ello', {tags:tags});\n
    "},{"location":"tagtext/#add-tag","title":"Add tag","text":"
    • Add a tag
      txt.addTag(name, prop);\n
      • name : Tag name.
      • prop : See Properties of tag
    • Add tags
      txt.addTags({\nname: prop\n});\n
    "},{"location":"tagtext/#wrap","title":"Wrap","text":"
    • Wrap by word or character.
      var txt = scene.make.text({\nx: 400,\ny: 100,\ntext: 'The sky above the port was the color of television, tuned to a dead channel.',\norigin: { x: 0.5, y: 0.5 },\nstyle: {\nfont: 'bold 25px Arial',\nfill: 'white',\nwrap: {\nmode: 'word'     // 0|'none'|1|'word'|2|'char'|'character'\nwidth: 300\n}\n}\n});\n
    • Wrap mode
      • Get
        var mode = txt.style.wrapMode;\n
      • Set
        txt.setWrapMode(mode);\n
        • 'none', or 0 : No wrap
        • 'word', or 1 : Word wrap
        • 'character', or 2 : Character wrap
    • Wrap width
      • Get
        var width = txt.style.wrapWidth;\n
      • Set
        txt.setWrapWidth(width);\n// txt.setWordWrapWidth(width);\n
    "},{"location":"tagtext/#content","title":"Content","text":"
    • Get source text
      var curContent = txt.text;\n
    • Get plain text
      var plainText = txt.getPlainText();\n
    • Get sub-string
      var text = txt.getText(start, end);\n
    • Set
      txt.setText('<class=\"name1\">wor</class>ld');\n// txt.text = '<class=\"name1\">wor</class>ld';\n
    • Append
      txt.appendText(text);\n// txt.text += '\\n' + text;\n
      or
      txt.appendText(text, false);\n// txt.text += text;\n
    "},{"location":"tagtext/#set-style","title":"Set style","text":"
    txt.setStyle(style);\ntxt.setFont(font);  // font: {fontFamily, fontSize, fontStyle}\ntxt.setFontFamily(family);\ntxt.setFontSize(size);\ntxt.setFontStyle(style);\n
    "},{"location":"tagtext/#color","title":"Color","text":"
    • Text color
      • Get
        var color = txt.style.color;\n
      • Set
        txt.setColor(color);\n
        or
        txt.setFill(color);\n
    • Stroke color, thickness
      • Get
        var color = txt.style.stroke;\nvar thickness = txt.style.strokeThickness;\n
      • Set
        txt.setStroke(color, thickness);\n
      • Clear
        txt.setStroke();\n
    • Underline color, thickness
      • Get
        var color = txt.style.underlineColor;\nvar thickness = txt.style.underlineThickness;\nvar offset = txt.style.underlineOffset;\n
      • Set
        txt.setUnderline(color, thickness, ofset);\ntxt.setUnderlineColor(color);\ntxt.setUnderlineThinkness(thickness);\ntxt.setUnderlineOffset(ofset);\n
    • Strikethrough color, thickness
      • Get
        var color = txt.style.strikethroughColor;\nvar thickness = txt.style.strikethroughThickness;\nvar offset = txt.style.strikethroughOffset;\n
      • Set
        txt.setStrikethrough(color, thickness, ofset);\ntxt.setStrikethroughColor(color);\ntxt.setStrikethroughThinkness(thickness);\ntxt.setStrikethroughOffset(ofset);\n
    • Background
      • Color, or gradient color
        • Get
          var color = txt.style.backgroundColor;\nvar color2 = txt.style.backgroundColor2;\nvar isHorizontalGradient = txt.style.backgroundHorizontalGradient;\n
        • Set
          txt.setBackgroundColor(color);\n// txt.setBackgroundColor(color, color2, isHorizontalGradient);\n
      • Stroke color
        • Get
          var color = txt.style.backgroundStrokeColor;\nvar lineWidth = txt.style.backgroundStrokeLineWidth;\n
        • Set
          txt.setBackgroundStrokeColor(color, lineWidth);\n
      • Round rectangle
        • Get
          var radius = txt.style.backgroundCornerRadius;\nvar iteration = txt.style.backgroundCornerIteration;\n
        • Set
          txt.setBackgroundCornerRadius(radius);\n// txt.setBackgroundCornerRadius(radius, iteration);\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
          • iteration :
            • undefined : Round rectangle
            • 0 : Octagon
    • Shadow
      • Get
        var color = txt.style.shadowColor;\nvar offsetX = txt.style.shadowOffsetX;\nvar offsetY = txt.style.shadowOffsetY;\nvar blur = txt.style.shadowBlur;\nvar stroke = txt.style.shadowStroke;\nvar enabled = txt.style.shadowFill;\n
      • Set
        txt.setShadow(x, y, color, blur, shadowStroke, shadowFill);\ntxt.setShadowOffset(x, y);\ntxt.setShadowColor(color);\ntxt.setShadowBlur(blur);\ntxt.setShadowStroke(enabled);\ntxt.setShadowFill(enabled);\n
    "},{"location":"tagtext/#image","title":"Image","text":"
    • Uses texture key as image key by default.
    • Add image render information
      txt.addImage(imgKey, {\nkey: textureKey,\nframe: frameName,\nwidth: undefined,\nheight: undefined,\ny: 0,\nleft: 0,\nright: 0\n});\n
      • imgKey : Image key used in text content, i.e. [img=imgKey].
      • key : Texture key.
      • frame : Frame name.
      • width : Render width, set undefined to use the cut width of frame.
      • height : Render height, set undefined to use the cut height of frame.
      • y : Extra offset y.
      • left : Left padding space.
      • Right : Right padding space.
    • Add some image render informations
      txt.addImage(data);\n
      • data : {imgKey, config}
    "},{"location":"tagtext/#hit-area-of-words","title":"Hit area of words","text":""},{"location":"tagtext/#hitting-events","title":"Hitting events","text":"
    • Pointer down
      txt.on('areadown', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areadown-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer up
      txt.on('areaup', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaup-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    "},{"location":"tagtext/#draw-hit-areas","title":"Draw hit-areas","text":"
    txt.drawAreaBounds(graphics, color);\n
    • graphics : Graphics game object
    • color : Default value is 0xffffff
    "},{"location":"tagtext/#line-spacing","title":"Line spacing","text":"

    This value is added to the height of the font when calculating the overall line height.

    • Get
      var lineSpacing = txt.style.lineSpacing;\n
    • Set
      txt.setLineSpacing(value);\n
    "},{"location":"tagtext/#padding","title":"Padding","text":"
    • Get
      var left = txt.padding.left;\nvar top = txt.padding.top;\nvar right = txt.padding.right;\nvar bottom = txt.padding.bottom;\n
    • Set
      txt.setPadding(left, top, right, bottom);\n// txt.setPadding(padding); // padding: {left, top, right, bottom}\n
    "},{"location":"tagtext/#max-lines","title":"Max lines","text":"
    • Get
      var maxLines = txt.style.maxLines;\n
    • Set
      txt.setMaxLines(max);\n
    "},{"location":"tagtext/#fixed-size","title":"Fixed size","text":"
    • Get
      var width = txt.style.fixedWidth;\nvar height = txt.style.fixedHeight;\n
    • Set
      txt.setFixedSize(width, height);\n
    "},{"location":"tagtext/#left-margin-of-text","title":"Left margin of text","text":"
    var leftMargin = txt.measureTextMargins(testString).left;\n
    • testString : Measure left margin of this text.
    "},{"location":"tagtext/#shift-start-position-of-text","title":"Shift start position of text","text":"
    txt.setXOffset(value);\n
    "},{"location":"tagtext/#resolution","title":"Resolution","text":"
    • Get
      var resolution = txt.style.resolution;\n
    • Set
      txt.setResolution(resolution);\n
    "},{"location":"tagtext/#inline-style","title":"Inline style","text":"

    Define style inline text.

    • <style='color:red'>Some text</style>
    • <style='size:30px'>Some text</style>
    • <style='y:-12;size:20px'>Some text</style>
    • <style='stroke:blue 1px'>Some text</style> (color thickness)
    • <style='shadow:blue 2px 2px 2px'>Some text</style> (color offsetX offsetY blur)
    • <style='underline:blue 3px -1px'>Some text</style> (color thickness offset)
    • <style='strikethrough:blue 3px -1px'>Some text</style> (color thickness offset)

    Or mix them

    • <style='color:red;size:30px'>Some text</style>
    "},{"location":"tagtext/#test-string","title":"Test string","text":"

    Set the test string to use when measuring the font.

    txt.setTestString(text);\n
    "},{"location":"tagtext/#save-texture","title":"Save texture","text":"
    txt.generateTexture(key);\n// txt.generateTexture(key, x, y, width, height);\n
    "},{"location":"tagtext/#rtl","title":"RTL","text":"
    • Set rtl in style config when creating this text game object
    • Change rtl during runtime
      txt.setRTL(rtl).setText(newContent);\n
      • Invoke setRTL method before setting new content.
    "},{"location":"tagtext/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"tagtext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"tagtext/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"tcrp-player/","title":"Player","text":""},{"location":"tcrp-player/#introduction","title":"Introduction","text":"

    Player of T ime-C ommand-R ecorder-P layer, to run commands on time.

    • Author: Rex
    • Member of scene
    "},{"location":"tcrp-player/#live-demos","title":"Live demos","text":"
    • Replay drawing
    "},{"location":"tcrp-player/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tcrp-player/#install-plugin","title":"Install plugin","text":""},{"location":"tcrp-player/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextcrpplugin.min.js', true);\n
    • Create instance
      var player = scene.plugins.get('rextcrpplugin').addPlayer(scene, config);\n
    "},{"location":"tcrp-player/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/tcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var player = scene.plugins.get('rexTCRP').addPlayer(scene, config);\n
    "},{"location":"tcrp-player/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/tcrp.js';\n
    • Create instance
      var player = new TCRP.Player(scene, config);\n
    "},{"location":"tcrp-player/#create-instance","title":"Create instance","text":"
    var player = scene.plugins.get('rexTCRP').addPlayer(scene, {\n// timeUnit: 0,        // 'ms'|0|'s'|'sec'|1\n// dtMode: 0,          // 'abs'|'absolute'|0|'inc'|'increment'|1\n// commands: [],       // [[time, command], [time, command], ...]\n// timeScale: 1,\n// scope: undefined\n});\n
    • scene : A scene object, or a game object.
    • timeUnit : see next section
    • dtMode : see next section
    • commands : see next section
    • timeScale
    "},{"location":"tcrp-player/#load-commands","title":"Load commands","text":"
    player.load(commands, scope, {\n// timeUnit: 0,        // 'ms'|0|'s'|'sec'|1\n// dtMode: 0           // 'abs'|'absolute'|0|'inc'|'increment'|1\n});\n
    • Commands : see also Run commands
      [\n[time, command],\n[time, command],\n...\n]\n
      • Format of each row :
        [time, fnName, param0, param1, ...]\n// [time, callback, param0, param1, ...]\n
        [time, [fnName, param0, param1, ...]]\n// [time, [callback, param0, param1, ...]]\n
        [time, [command0, command1, ...]]\n
    • timeUnit: time-unit of time
      • 'ms', or 0 : time in millisecond
      • 's', 'sec', or 1 : time in second
    • dtMode: mode of counting time
      • 'abs', 'absolute', or 0 : timeout = time
      • 'inc', 'increment', 1 : timeout = time + previous-time
    "},{"location":"tcrp-player/#clear-all-commands","title":"Clear all commands","text":"
    player.clear();\n
    "},{"location":"tcrp-player/#append-command","title":"Append command","text":"
    player.append(time, fn, param0, param1, ...);\n
    • time : Delay time
    • fn :
      • A function (callback) object.
      • A string , to get function (callback) object from scope.
    • param0, param1 ... : Parameters of callback.
    "},{"location":"tcrp-player/#start-playing","title":"Start playing","text":"
    player.start();\n// player.start(startAt);  // Start-at time in ms\n
    "},{"location":"tcrp-player/#events","title":"Events","text":"
    • Start
      player.on('start', function(scene, player){});\n
    • Pause
      player.on('pause', function(scene, player){});\n
    • Resume
      player.on('resume', function(scene, player){});\n
    • Stop
      player.on('stop', function(scene, player){});\n
    • Complete
      player.on('complete', function(scene, player){});\n
    • Run command
      player.on('runcommand', function(commands, scope){});\n
    "},{"location":"tcrp-player/#pause-resume-stop-playing","title":"Pause, Resume, stop playing","text":"
    player.pause();\nplayer.resume();\nplayer.stop();\n
    "},{"location":"tcrp-player/#seek-elapsed-time","title":"Seek elapsed time","text":"
    player.seek(time);   // Elapsed time in ms\n
    "},{"location":"tcrp-player/#seek-to-next-command","title":"Seek to next command","text":"
    player.seekToNext();\n

    Seek to time of next command. i.e. run next command immediately.

    "},{"location":"tcrp-player/#state-of-player","title":"State of player","text":"
    var isPlaying = player.isPlaying;\nvar completed = player.completed;\nvar now = player.now;\n
    "},{"location":"tcrp-player/#time-scale","title":"Time-scale","text":"
    • Set
      player.setTimeScale(value);\n// player.timeScale = value;\n
    • Get
      var timeScale = player.timeScale;\n
    "},{"location":"tcrp-recoder/","title":"Recoder","text":""},{"location":"tcrp-recoder/#introduction","title":"Introduction","text":"

    Recorder of T ime-C ommand-R ecorder-P layer, to store commands with time.

    • Author: Rex
    • Member of scene
    "},{"location":"tcrp-recoder/#live-demos","title":"Live demos","text":"
    • Replay drawing
    "},{"location":"tcrp-recoder/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tcrp-recoder/#install-plugin","title":"Install plugin","text":""},{"location":"tcrp-recoder/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextcrpplugin.min.js', true);\n
    • Create instance
      var recorder = scene.plugins.get('rextcrpplugin').addRecorder(scene);\n
    "},{"location":"tcrp-recoder/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/tcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var recorder = scene.plugins.get('rexTCRP').addRecorder(scene);\n
    "},{"location":"tcrp-recoder/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/tcrp.js';\n
    • Create instance
      var recorder = new TCRP.Recorder(scene);\n
    "},{"location":"tcrp-recoder/#create-instance","title":"Create instance","text":"
    var recorder = scene.plugins.get('rexTCRP').addRecorder(scene);\n
    • Destroy when scene stopped

    or

    var recorder = scene.plugins.get('rexTCRP').addRecorder(gameObject);\n
    • Destroy when game object destroyed
    "},{"location":"tcrp-recoder/#start-recording","title":"Start recording","text":"
    recorder.start();\n// recorder.start(startAt);  // start-at time in ms\n
    "},{"location":"tcrp-recoder/#push-commands","title":"Push commands","text":"
    recorder.addCommand([fnName, param0, param1, ...]);\n// recorder.addCommand([command0, command1, ...]);\n// recorder.addCommand([fnName, param0, param1, ...], offset);  // time-offset in ms\n

    See also Run commands

    "},{"location":"tcrp-recoder/#get-commands","title":"Get commands","text":"
    var commands = recorder.getCommands();        // Get a shallow copy of commands\n// var commands = recorder.getCommands(true); // Get reference of commands\n

    Format of return commands:

    [\n[time, [command]],\n[time, [command0,command1]],\n...\n]\n
    "},{"location":"tcrp-recoder/#clear-commands","title":"Clear commands","text":"
    recorder.clear();\n
    "},{"location":"tcrp-recoder/#pause-resume-stop-recording","title":"Pause, Resume, stop recording","text":"
    recorder.pause();\nrecorder.resume();\nrecorder.stop();\n
    "},{"location":"tcrp-recoder/#seek-elapsed-time","title":"Seek elapsed time","text":"
    recorder.seek(time);   // elapsed time in ms\n
    "},{"location":"tcrp-recoder/#state-of-recorder","title":"State of recorder","text":"
    var isRecording = recorder.isRecording;\nvar now = recorder.now;\n
    "},{"location":"tcrp-recoder/#time-scale","title":"Time-scale","text":"
    • Set
      recorder.setTimeScale(value);\n// recorder.timeScale = value;\n
    • Get
      var timeScale = recorder.timeScale;\n
    "},{"location":"tcrp-recoder/#events","title":"Events","text":"
    • Start
      recorder.on('start', function(scene, recorder){});\n
    • Pause
      recorder.on('pause', function(scene, recorder){});\n
    • Resume
      recorder.on('resume', function(scene, recorder){});\n
    • Stop
      recorder.on('stop', function(scene, recorder){});\n
    "},{"location":"text/","title":"Text","text":""},{"location":"text/#introduction","title":"Introduction","text":"

    Drawing text on canvas, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"text/#usage","title":"Usage","text":""},{"location":"text/#add-text-object","title":"Add text object","text":"
    var txt = scene.add.text(x, y, 'hello');\n// var txt = scene.add.text(x, y, 'hello', { fontFamily: 'Arial', fontSize: 64, color: '#00ff00' });\n

    Default style

    {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nalign: 'left',  // 'left'|'center'|'right'|'justify'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\nrtl: false,\ntestString: '|M\u00c9qgy',\nwordWrap: {\nwidth: null,\ncallback: null,\ncallbackScope: null,\nuseAdvancedWrap: false\n},\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n}\n

    Add text from JSON

    var txt = scene.make.text({\nx: 100,\ny: 100,\npadding: {\nleft: 64,\nright: 16,\ntop: 20,\nbottom: 40\n//x: 32,    // 32px padding on the left/right\n//y: 16     // 16px padding on the top/bottom\n},\ntext: 'Text\\nGame Object\\nCreated from config',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',  // 'left'|'center'|'right'|'justify'\nbackgroundColor: '#ff00ff'\n},\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"text/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends Phaser.GameObjects.Text {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, 'hello');\n
    "},{"location":"text/#word-wrap","title":"Word wrap","text":"
    • Wrap by width
      var txt = scene.make.text({\nx: 400,\ny: 100,\ntext: 'The sky above the port was the color of television, tuned to a dead channel.',\norigin: { x: 0.5, y: 0.5 },\nstyle: {\nfont: 'bold 25px Arial',\nfill: 'white',\nwordWrap: { width: 300 }\n},\n// origin: {x: 0.5, y: 0.5},\n});\n
    • Wrap by callback
      var txt = scene.make.text({\nx: 400,\ny: 300,\ntext: 'The sky above the port was the color of television, tuned to a dead channel.',\norigin: 0.5,\nstyle: {\nfont: 'bold 30px Arial',\nfill: 'white',\nwordWrap: { callback: wordWrap, scope: this }\n},\n// origin: {x: 0.5, y: 0.5},\n});\n\nfunction wordWrap (text, textObject)\n{\n// First parameter will be the string that needs to be wrapped\n// Second parameter will be the Text game object that is being wrapped currently\n\n// This wrap just puts each word on a separate line, but you could inject your own\n// language-specific logic here.\nvar words = text.split(' ');\n\n// You can return either an array of individual lines or a string with line breaks (e.g. \\n) in\n// the correct place.\nreturn words;\n}\n
    • Wrap width
      • Get
        var width = txt.style.wordWrapWidth;\nvar useAdvancedWrap = txt.style.wordWrapUseAdvanced;\n
      • Set
        txt.setWordWrapWidth(width);\n// txt.setWordWrapWidth(width, useAdvancedWrap);\n
    • Wrap callback
      • Get
        var callback = txt.style.wordWrapCallback;\nvar scope = txt.style.wordWrapCallbackScope;\n
      • Set
        txt.setWordWrapCallback(callback, scope);\n
    "},{"location":"text/#content","title":"Content","text":"
    • Get
      var content = txt.text;\n
    • Set
      txt.setText(text);\n// txt.text = text;\n
    • Append
      txt.appendText(text);\n// txt.text += '\\n' + text;\n
      or
      txt.appendText(text, false);\n// txt.text += text;\n
    "},{"location":"text/#set-style","title":"Set style","text":"
    txt.setStyle(style);\ntxt.setFont(font);\ntxt.setFontFamily(family);\ntxt.setFontSize(size);\ntxt.setFontStyle(style);\n
    "},{"location":"text/#set-align","title":"Set align","text":"
    txt.setAlign(align);\n
    • align : 'left', 'center', 'right', 'justify'
    "},{"location":"text/#color","title":"Color","text":"
    • Text color
      • Get
        var color = txt.style.color;\n
      • Set
        txt.setColor(color);\n
        or
        txt.setFill(color);\n
    • Stroke color, thickness
      • Get
        var color = txt.style.stroke;\nvar thickness = txt.style.strokeThickness;\n
      • Set
        txt.setStroke(color, thickness);\n
      • Clear
        txt.setStroke();\n
    • Background color
      • Get
        var color = txt.style.backgroundColor;\n
      • Set
        txt.setBackgroundColor(color);\n
    • Shadow
      • Get
        var color = txt.style.shadowColor;\nvar offsetX = txt.style.shadowOffsetX;\nvar offsetY = txt.style.shadowOffsetY;\nvar blur = txt.style.shadowBlur;\nvar stroke = txt.style.shadowStroke;\nvar enabled = txt.style.shadowFill;\n
      • Set
        txt.setShadow(x, y, color, blur, shadowStroke, shadowFill);\ntxt.setShadowOffset(x, y);\ntxt.setShadowColor(color);\ntxt.setShadowBlur(blur);\ntxt.setShadowStroke(enabled);\ntxt.setShadowFill(enabled);\n
    "},{"location":"text/#line-spacing","title":"Line spacing","text":"

    This value is added to the height of the font when calculating the overall line height.

    • Get
      var lineSpacing = txt.lineSpacing;\n
    • Set
      txt.setLineSpacing(value);\n
    "},{"location":"text/#letter-spacing","title":"Letter spacing","text":"
    • Get
      var letterSpacing = txt.letterSpacing;\n
    • Set
      txt.setLetterSpacing(value);\n
    • value : Positive or negative value.

    Note

    Enabling this feature will cause Phaser to render each character in this Text object one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with either long strings, or lots of strings in total.

    "},{"location":"text/#padding","title":"Padding","text":"
    • Get
      var left = txt.padding.left;\nvar top = txt.padding.top;\nvar right = txt.padding.right;\nvar bottom = txt.padding.bottom;\n
    • Set
      txt.setPadding(left, top, right, bottom);\n// txt.setPadding(padding); // padding: {left, top, right, bottom}\n
    "},{"location":"text/#max-lines","title":"Max lines","text":"
    • Get
      var maxLines = txt.style.maxLines;\n
    • Set
      txt.setMaxLines(max);\n
    "},{"location":"text/#fixed-size","title":"Fixed size","text":"
    • Get
      var width = txt.style.fixedWidth;\nvar height = txt.style.fixedHeight;\n
    • Set
      txt.setFixedSize(width, height);\n
    "},{"location":"text/#test-string","title":"Test string","text":"

    Set the test string to use when measuring the font.

    txt.style.setTestString(text);\n
    "},{"location":"text/#rtl","title":"RTL","text":"
    • Set rtl in style config when creating this text game object
    • Change rtl during runtime
      txt.setRTL(rtl).setText(newContent);\n
      • Invoke setRTL method before setting new content.
    "},{"location":"text/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"text/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"text/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"textedit/","title":"Edit","text":""},{"location":"textedit/#introduction","title":"Introduction","text":"

    Create an input text object above a text object to edit string content.

    • Author: Rex
    • Behavior of text object
    "},{"location":"textedit/#live-demos","title":"Live demos","text":"
    • Text edit
    • Text area
    • Number edit
    • With rexui-Label
    • Text game object inside container
    "},{"location":"textedit/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"textedit/#install-plugin","title":"Install plugin","text":""},{"location":"textedit/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextexteditplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexteditplugin.min.js', true);\n
    • Open editor
      • Add text-edit behavior, will open editor under 'pointerdown' event.
        var editor = scene.plugins.get('rextexteditplugin').add(textGameObject, config);\n
      • Open editor directly
        var editor = scene.plugins.get('rextexteditplugin').edit(textGameObject, config);\n
    "},{"location":"textedit/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextEditPlugin from 'phaser3-rex-plugins/plugins/textedit-plugin.js';\nvar config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextEdit',\nplugin: TextEditPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Open editor
      • Add text-edit behavior, will open editor under 'pointerdown' event.
        var editor = scene.plugins.get('rexTextEdit').add(textGameObject, config);\n
      • Open editor directly
        var editor = scene.plugins.get('rexTextEdit').edit(textGameObject, config);\n
    "},{"location":"textedit/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { TextEdit, Edit } from 'phaser3-rex-plugins/plugins/textedit.js';\n
    • Open editor
      • Add text-edit behavior, will open editor under 'pointerdown' event.
        var editor = new TextEdit(textGameObject, config);\n
      • Open editor directly
        var editor = Edit(textGameObject, config);\n
    "},{"location":"textedit/#open-text-editor","title":"Open text editor","text":"

    Open editor directly.

    var editor = scene.plugins.get('rexTextEdit').edit(textObject, {\n// inputType: 'text',   // 'text'|'password'|'textarea'|...\n// type: 'text',    // 'text'|'password'|'textarea'|...\n\n// enterClose: true,\n// selectAll: false,\n\n// onOpen: undefined,\n// onTextChanged: undefined,\n// onClose: undefined,\n\n// text: '',\n});\n// var editor = scene.plugins.get('rexTextEdit').edit(textObject, config, onClose);\n
    • textObject : Text object, bbcode text object, or tag text object.
    • config :
      • config.inputType, or config.type :
        • 'text' (default), or
        • 'password'
        • 'number'
      • config.onOpen : Callback invoked when input text is created.
        function (textObject) {\n}\n
      • config.onTextChanged : Callback invoked when input text changed.
        function (textObject, text) {\ntextObject.text = text;\n}\n
      • config.onClose : Callback invoked when input text is closed. This parameter is valid only when onClose parameter is not given.
        function (textObject) {\n}\n
      • enterClose :
        • true : Close input text when enter-key was pressed. Default value is true if inputType is not 'textarea'.
        • false : If inputType is set to 'textarea', default value will be false.
      • config.selectAll : Set true to select all text.
      • config.text : Initial string content. Default is the string content of textObject.
      • More configuration parameters...
    • onClose : Callback invoked when input text is closed.
      var callback = function(textObject) {\n}\n

    Create a text editor (input element) above text object.

    • Size, font size, font family, font color, background color, background corner radius, padding-left, padding-right of text editor will be assigned from text object.
    • Text object will be invisible when text editor is opened.
    • Store reference of text editor at textObject._editor.
    • Text editor will be closed when
      • Press enter key and enterClose is set, or
      • Touch outside of editor, or
      • Open another text editor, or
      • Call editor.close()

    Limitation of text game object

    Don't assign height property of text game object. Because that text input element does not have vertical align setting, text will always align to middle/center.

    "},{"location":"textedit/#create-instance","title":"Create instance","text":"

    Add text-edit behavior, will open editor under 'pointerdown' event.

    var editor = scene.plugins.get('rexTextEdit').add(textGameObject, {\n// type: 'text',   //'text','password','number'\n// enterClose: true,\n// selectAll: false,\n\n// onOpen: undefined,\n// onTextChanged: undefined,\n// onClose: undefined,\n\n// text: '',\n});\n
    "},{"location":"textedit/#open-editor","title":"Open editor","text":"
    editor.open(config);\n// editor.open(config, onClose);\n
    • config
      • config.type :
        • text (default), or
        • password
      • config.text : Initial string content.
      • config.onTextChanged : Callback invoked when input text changed.
        function (textObject, text) {\ntextObject.text = text;\n}\n
      • More configuration parameters...
    • onClose : Callback invoked when text editor is closed.
      var callback = function(textObject) {\n}\n

    Create a text editor (input element) above text object.

    • Size, font size, font family, font color, background color of text editor will be equal to text object.
    • Text object will be invisible when text editor is opened.
    "},{"location":"textedit/#is-opened","title":"Is opened","text":"
    var isOpened = editor.isOpened;\n
    "},{"location":"textedit/#close-editor","title":"Close editor","text":"
    editor.close();\n

    Text editor will be closed when

    • Press enter key, or
    • Touch outside of editor, or
    • Open another text editor, or
    • Call editor.close()
    "},{"location":"textedit/#get-dom","title":"Get DOM","text":"
    var inputText = editor.inputText.node;\n
    "},{"location":"textedit/#bypass-key-input","title":"Bypass key input","text":"

    See InputText/Bypass key input

    "},{"location":"textedit/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"textpage/","title":"Page","text":""},{"location":"textpage/#introduction","title":"Introduction","text":"

    Display text page by page on text object, bbcode text object, or tag text object.

    • Author: Rex
    • Behavior of text object
    "},{"location":"textpage/#live-demos","title":"Live demos","text":"
    • BBCode text + page + typing
    "},{"location":"textpage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"textpage/#install-plugin","title":"Install plugin","text":""},{"location":"textpage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextextpageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextextpageplugin.min.js', true);\n
    • Add page behavior
      var page = scene.plugins.get('rextextpageplugin').add(textGameObject, config);\n
    "},{"location":"textpage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextPagePlugin from 'phaser3-rex-plugins/plugins/textpage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextPage',\nplugin: TextPagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add page behavior
      var page = scene.plugins.get('rexTextPage').add(textGameObject, config);\n
    "},{"location":"textpage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TextPage from 'phaser3-rex-plugins/plugins/textpage.js';\n
    • Add page behavior
      var page = new TextPage(textGameObject, config);\n
    "},{"location":"textpage/#create-instance","title":"Create instance","text":"
    var page = scene.plugins.get('rexTextPage').add(textGameObject, {\n// text: '',              // content in string or array\n// maxLines: undefined,\n// pageBreak: '\\f\\n',\n});\n
    • textObject : Text object, bbcode text object, tag text object, or bitmap text object
    • text : content in string or array, optional
    • maxLines : Max lines of a page.
      • undefined : Default value. For Text object, bbcode text object, tag text object
        • Use style property maxLines.
        • Count number of lines if it has fixedHeight setting.
      • A number : Max lines of a page, for bitmap text object
    • pageBreak : Symbol of page-break. Default value is '\\f\\n'. String after this page-break symbol will be placed to a new page.
    "},{"location":"textpage/#set-content","title":"Set content","text":"
    • Set content
      page.setText(content);\n
      • content : String, number, or string array. Can insert pageBreak symbol.
    • Append content
      page.appendText(content);\n
      • content : String, number, or string array. Can insert pageBreak symbol.
    • Clear content
      page.clearText()\n
    • Append page
      page.appendPage(content);   // content in string or array\n
      • content : String, number, or string array. Don't insert pageBreak symbol.
    "},{"location":"textpage/#show-page","title":"Show page","text":"
    • Display current page
      page.showPage();\n
    • Display next page
      page.showNextPage();\n
    • Display previous page
      page.showPreviousPage();\n
    • Display first page
      page.showFirstPage();\n
    • Display last page
      page.showLastPage();\n
    • Display page by index
      page.showPage(index);\n
    • Display page by line index
      page.showPageNyLineIndex(index);\n

    Note

    Initial page index is -1, so user could call page.showNextPage() to display first page.

    "},{"location":"textpage/#get-lines-of-page","title":"Get lines of page","text":""},{"location":"textpage/#page-by-page","title":"Page by page","text":"
    • Get lines of current page
      var lines = page.getPage();\n
    • Get lines of next page
      var lines = page.getNextPage();\n
    • Get lines of previous page
      var lines = page.getPreviousPage();\n
    • Get lines of first page
      var lines = page.getFirstPage();\n
    • Get lines of last page
      var lines = page.getLastPage();\n
    • Get lines of page by page index
      var lines = page.getPage(index);\n
    "},{"location":"textpage/#page-of-line","title":"Page of line","text":"
    • Get line of page by line index
      var lines = page.getPageByLineIndex(index);\n
    • Get page of next line
      var lines = page.getPageOfNextLine(index);\n
    • Get page of previous line
      var lines = page.getPageOfPreviousLine(index);\n
    "},{"location":"textpage/#other-properties","title":"Other properties","text":""},{"location":"textpage/#page-by-page_1","title":"Page by page","text":"
    • Is last page
      var isLastPage = page.isLastPage;\n
    • Is first page
      var isFirstPage = page.isFirstPage;\n
    • Current page index
      var pageIndex = page.pageIndex;\n
    • Number of pages
      var pageIndex = page.pageCount;\n
    "},{"location":"textpage/#page-of-line_1","title":"Page of line","text":"
    • Is last line
      var isLastLine = page.isLastLine;\n
    • Is first line
      var isFirstLine = page.isFirstLine;\n
    • Start line index
      var startLineIndex = page.startLineIndex;\n
    • End line index
      var endLineIndex = page.endLineIndex;\n
    • Number of lines
      var totalLinesCount = page.totalLinesCount;\n
    "},{"location":"textplayer/","title":"Text player","text":""},{"location":"textplayer/#introduction","title":"Introduction","text":"

    Typing characters on dynamic text, waiting click or key enter, play sound effect or backgroun music.

    • Author: Rex
    • Game object
    "},{"location":"textplayer/#live-demos","title":"Live demos","text":"
    • BBCode
    • Play
    • Sprite control
    • Show page
    • Fast typing
    • Custom game object
    • Fade out page
    • Choices
      • Custonm tag
      • Choice dailog
    • Resolution
    "},{"location":"textplayer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"textplayer/#install-plugin","title":"Install plugin","text":""},{"location":"textplayer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextextplayerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextextplayerplugin.min.js', true);\n
    • Add text-player object
      var txt = scene.add.rexTextPlayer(config);\n
    "},{"location":"textplayer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextPlayerPlugin from 'phaser3-rex-plugins/plugins/textplayer-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextPlayerPlugin',\nplugin: TextPlayerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-player object
      var txt = scene.add.rexTextPlayer(config);\n
    "},{"location":"textplayer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TextPlayer from 'phaser3-rex-plugins/plugins/textplayer.js';\n
    • Add text-player object
      var txt = new TextPlayer(scene, config);\nscene.add.existing(txt);\n
    "},{"location":"textplayer/#create-instance","title":"Create instance","text":"
    var txt = scene.add.rexTextPlayer({\nx: 0, y: 0,\nwidth: undefined, height: undefined,\nresolution: 1,\n\npadding: 0,  // {left: 0, right: 0, top: 0, bottom: 0}\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\noffsetX: 0,\noffsetY: 0,\nleftSpace: 0,\nrightSpace: 0,\n},\n\nparser: {\ndelimiters: '[]',\ncomment: '//',\n// translateTagNameCallback: undefined,\n}\n\nwrap: {\ncallback: undefined, // Default wrapping callback is dynamicText.runWordWrap()\nlineHeight:\n// maxLines: \npadding: { top: 0, left: 0, right: 0, bottom: 0 },\nletterSpacing: 0,\nwrapMode: 'word',  // 1|'word'|2|'char'|'character'|3|'mix'\nhAlign: 0, // 0|'left'|1|'center'|2|'right'|3|'justify'|'justify-left'|4|'justify-center'|5| justify-right'\nvAlign: 0, // 0|'top'|1|'center'|2|'bottom'\n\n},\n\ntyping: {\nspeed: 250,\nonTypingStart: function (children) {\nfor (var i = 0, cnt = children.length; i < cnt; i++) {\nchildren[i].setVisible(false);\n}\n},  // Default: set all children invisible\nanimation: undefined,  // Default: no typing animation, only invoke onStart callback\nanimation: {\nduration: 1000,\nyoyo: false,\nonStart: function(child) {\nchild.setVisible();\n},\nonProgress: function(child, t) {\n\n},\nonComplete: function(child) {\n\n}\n},\n\n// skipSpace: false,\n\n// minSizeEnable: false,\n\nfadeOutPage: undefined,  // Default: no fade-out-page animation\nfadeOutPage: function(children) {\nreturn eventEmitter;\nreturn promise;\n},\n\n},\n\nimages: {\n// key: {width, height}\n// key: {key, frame, width, height}\n},\n\nsprites: {\n// createCallback: 'sprite',\n// createCallback: function(scene, ...) { return gameObject; },\n\n// fade: 500,\n// fade: {mode: 'tint', time: 500},\n\n// viewportCoordinate: false,\n// viewportCoordinate: { viewport: new Phaser.Geom.Rectangle() },\n\n}, layers: undefined, // []\n\nsounds: {\nbgm: {\ninitial: undefinied,\nloop: true,\nfade: 500\n},\nbgm2: {\ninitial: undefinied,\nloop: true,\nfade: 500\n}\n},\n\nclickTarget: this,  // This text player    \nnextPageInput: null,\n// ignoreNextPageInput: false,\n\ntext: undefined\n});\n
    • x, y : Position of this text-player game object.
    • width : Fixed width.
      • A number : Width of this text-player game object.
        • Wrap-width is width - padding.left - padding.right.
      • undefined : Width of this text-player game object will be set after invoked runWordWrap method.
    • height : Fixed height.
      • A number : Height of this text-player game object.
      • undefined : Height of this text-player game object will be set after invoked runWordWrap method.
    • resolution : The resolution the content is rendered to its internal canvas at. Default value is 1.
    • padding : Padding of bounds.
      • A number
      • padding.left, padding.right, padding.top, padding.bottom
    • background : Properties of background round-rectangle.
      • background.color : Fill color.
        • null : No filling.
      • background.color2 : Gradient fill color.
        • null : No gradient filling.
      • background.horizontalGradient : Horizontal or vertical gradient filling.
        • true : Horizontal gradient filling.
        • false : Vertical gradient filling.
      • background.stroke : Stroke color.
        • null : No stroke.
      • background.strokeThickness : Line width of stroke.
      • background.cornerRadius : Corner-radius of round rectangle.
        • 0 : No round corner
        • > 0 : Convex round corner
        • < 0 : Concave round corner
      • background.cornerIteration : Iteration of corner-radius.
        • null : Draw corner-radius via arc directly.
        • A number : Draw corner-radius via lines
    • innerBounds : Properties of inner-bounds.
      • innerBounds.color : Fill color.
        • null : No filling.
      • innerBounds.color2 : Gradient fill color.
        • null : No gradient filling.
      • innerBounds.horizontalGradient : Horizontal or vertical gradient filling.
        • true : Horizontal gradient filling.
        • false : Vertical gradient filling.
      • innerBounds.stroke : Stroke color.
        • null : No stroke.
      • innerBounds.strokeThickness : Line width of stroke.
    • style : Initial text-style.
      • style.bold : Bold
      • style.italic : Italic
      • style.fontSize : Font size
      • style.fontFamily : Font family
      • style.color : Fill color
      • style.stroke : Stroke color
      • style.strokeThickness : Line width of stroke.
      • style.shadowColor : Shadow color.
        • null : No shadow.
      • style.shadowOffsetX : OffsetX of shadow.
      • style.shadowOffsetY : OffsetY of shadow.
      • style.shadowBlur : Blur of shadow.
      • style.offsetX : OffsetX.
      • style.offsetY : OffsetY.
      • style.leftSpace : Extra space between this character and previous character.
      • style.rightSpace : Extra space between this character and next character.
      • style.align : Override default line-alignment setting.
        • 0, 'left', 'top' : Align remainder lines to left/top.
        • 1, 'center' : Align remainder lines to center.
        • 2, 'right', 'bottom' : Align remainder lines to right/bottom.
        • undefined : Use default line-alignment setting.
    • wrap : Default configuration Horizontal/Vertical wrapping.
    • typing :
      • typing.speed : Default typing speed of each character.
      • typing.onTypingStart : Callback when typing start. Default is to set all children to invisible.
        function (children) {\nfor (var i = 0, cnt = children.length; i < cnt; i++) {\nchildren[i].setVisible(false);\n}\n
        • children : Array of child.
      • typing.animation : Configuration of typing animation
        • undefined : No typing animation, default behavior
      • typing.animation.duration : Duration of typing animation.
      • typing.animation.yoyo :
        • false : Mapping progress t to 0 - 1. Default behavior.
        • true : Mapping progress t to 0 - 1 - 0.
      • typing.animation.onStart : Callback when typing start of a character. Default is to set this child to visible.
        function(child) { child.setVisible(); }\n
        • child
      • typing.animation.onProgress : Callback when progress typing animation.
        function(child, t) {\n}\n
        • child
      • typing.animation.onComplete : Callback when typing animation complete.
        function(child) {\n}\n
        • child
      • typing.skipSpace :
        • false : Will have delay when typing space character. Default behavior.
        • true : Typing space character immediately.
      • typing.minSizeEnable :
        • true : Resize to minimun size for showing all visible characters.
        • false : Won't resize during typing. Default behavior.
      • typing.fadeOutPage : Callback to fade-out characters of previous page.
        • undefined : Default value, no fade-out-page animation.
        • Callback
          function(characters) {\nreturn tween;  // eventEmitter\nreturn promise;\n}\n
          • characters : Fade out targets.
          • Return value could be tween object (event emitter), or promise object.
            • Tween object : Wait until 'complete' event triggering.
            • Promise object : Wait until promoise resolving.
    • parser : Configuration of parser.
      • parser.delimiters : Delimiters of tag. Default value is '[]'.
      • parser.comment : Start word of a comment line. Default value is '//'.
        • null, or false : No comment line.
      • parser.translateTagNameCallback : Callback to translate tag-name
        • undefined : Use original tag-name. Default behavior.
        • A function, return new tag name.
          function(tagName) {\nreturn newTagName;\n}\n
    • images : Configuration of images.
    • sprites : Configuration of sprites.
      • sprites.createCallback :
        • 'sprite' : Create sprite game object. Default behavior.
        • 'image' : Create image game object.
        • Callback to return a game object
          function(scene, textureKey, frameName) {\n// return scene.add.sprite(0, 0, textureKey, frameName);\n}\n
      • sprites.fade :
        • 0 : No fade-in or fade-out when adding or removing a sprite.
        • A number : Duration of fading. Default value is 500.
        • A plain object contains mode, time
          • sprite.fade.mode : Fade mode
            • 'tint', or 0 : Fade-in or fade-out via tint property.
            • 'alpha', or 1 : Fade-in or fade-out via alpha property.
            • 'revealUp', or 2 : Reveal up for fade-in.
            • 'revealDown', or 3 : Reveal down for fade-in.
            • 'revealLeft', or 4 : Reveal left for fade-in.
            • 'revealRight', or 5 : Reveal right for fade-in.
          • sprite.fade.time : Duration of fading. Default value is 500.
      • sprites.viewportCoordinate : Apply viewportCoordinate behavior to sprite game object.
        • true : Attach vpx, vpy, vp to sprite game object.
          • vpx, vpy : Number between 0~1. Proportion of viewport.
          • vp : Viewport in rectangle
        • false : Do nothing, default behavior.
      • sprites.symbols : Convert string value to number value when Set or Ease property of game object.
        • A plain object contains string key and number value.
    • layers :
      • undefined : Don't create layerManger.
      • Array of string : Pre-create layer game objects in layerManger.
    • sounds : Configuration of sound effect, or background music.
      • sounds.bgm.initial, sounds.bgm2.initial : Initial music instance created by scene.sound.add(key) before starting playing content.
        • undefined : No initial music instance, default value.
      • sounds.bgm.loop, sounds.bgm2.loop :
        • true : Loop background music, default behavior.
        • false : Play background music once.
      • sounds.bgm.fade, sounds.bgm2.fade :
        • 0 : No fade-in or fade-out when starting or stopping a background music.
        • A number : Fade-in or fade-out (cross-fade) when starting or stopping a background music. Default value is 500.
    • nextPageInput : Wait condition to type next page
      • null, or false : Stop tying next page. Default behavior
        • Typing next manually via txt.typingNextPage().
      • 'click' : Wait click.
      • 'click|2000' : Wait one of condition: click, or 2000ms.
      • 'click|enter|2000' : Wait one of condition: click, enter key down, or 2000ms.
      • A function callback :
        function(callback) {\n// Invoke `callback()` to continue typing\n}\n
    • clickTarget : Click target, default is text player itself.
      • scene : Any pointer down on this scene.
    • ignoreNextPageInput : Set true to continue typing next page without any waiting.
    • text : Content of text to play.

    or

    var txt = scene.add.rexTextPlayer(x, y, width, height, config);\n

    or

    var txt = scene.add.rexTextPlayer(x, y, config);\n

    Add textplayer from JSON

    var txt = scene.make.rexTextPlayer({\nx: 0,\ny: 0,\n\n// origin: {x: 0.5, y: 0.5},\n// fill: null,\n\nadd: true\n});\n
    "},{"location":"textplayer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextPlayer extends TextPlayer {\nconstructor(scene, x, y, config) {\nsuper(scene, x, y, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyTextPlayer(scene, x, y, config);\n
    "},{"location":"textplayer/#game-object-manager","title":"Game object manager","text":"
    txt.addGameObjectManager({\nname: goType,\ncreateGameObject: function(scene, ...) {\nreturn gameObject\n},\n\nfade: 500,\n// fade: {mode: 'tint', time: 500},\n\n// viewportCoordinate: false,\n// viewportCoordinate: { viewport: new Phaser.Geom.Rectangle() },\n\n// defaultLayer: layerName,\n\n// symbols: undefined,  // { key:value },\n})\n
    • name : Name of this game object manager, a string.
    • createGameObject : Callback to return a game object
      function(scene, a, b, c) {\n// return gameObject;\n}\n
      • a, b, c : Parameters pass from [goType.name=a,b,c]
    • fade : Tint-fade (if game object has tint property) or alpha-fade game object when creating or destroying a game object.
      • 0 : No fade-in or fade-out when adding or removing a game object.
      • A number : Duration of fading. Default value is 500.
      • A plain object contains mode, time
        • fade.mode : Fade mode
          • 'tint', or 0 : Fade-in or fade-out via tint property.
          • 'alpha', or 1 : Fade-in or fade-out via alpha property.
          • 'revealUp', or 2 : Reveal up for fade-in.
          • 'revealDown', or 3 : Reveal down for fade-in.
          • 'revealLeft', or 4 : Reveal left for fade-in.
          • 'revealRight', or 5 : Reveal right for fade-in.
        • fade.time : Duration of fading. Default value is 500.
    • viewportCoordinate : Apply viewportCoordinate behavior to sprite game object.
      • false : Do nothing, default behavior.
      • true, or an object :
        • viewport :
          • undefined : Rectangle of display area under main camera of current scene. Default value.
          • A rectangle
    • defaultLayer : Put this game object into layer inside of layerManager.
    • symbols : Convert string value to number value when Set or Ease property of game object.
      • A plain object contains string key and number value.
    "},{"location":"textplayer/#built-in-commands","title":"Built-in commands","text":"

    goType : name parameter in config of txt.addGameObjectManager method

    • Add game object : [goType.name=a,b,c]
      • Tint-fade-in, or alpha-fade-in if fade is not 0
    • Remove game object : [/goType.name]
      • Tint-fade-out, or alpha-fade-out if fade is not 0
    • Remove all game objects : [/goType]
      • Tint-fade-out, or alpha-fade-out if fade is not 0
    • Call method : [goType.name.methodName=value0,value1,value2]
    • Set property : [goType.name.x=value], [goType.name.alpha=value], ....
    • Ease property :
      [goType.name.prop.easeMode=value,duration]\n[goType.name.prop.easeMode=value,duration,repeat]\n[goType.name.prop.easeMode=value,duration,easeFunction,repeat]\n[goType.name.prop.easeMode=value]\n
      • prop : Any number property of this sprite.
      • easeMode : One of these modes
        • to, toLeft, toRight, toUp, toDown
        • yoyo, yoyoLeft, yoyoRight, yoyoUp, yoyoDown
        • from, fromLeft, fromRight, fromUp, fromDown
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Wait ease task of game object's number property : [wait=goType.name.prop]
      • Also fire event 'wait.' + goType
        txt.on('wait.' + goType, function(name, prop) {\n})\n
    • Wait a game objects are destroyed : [wait=goType.name]
      • Also fire event 'wait.' + goType
        txt.on('wait.' + goType, function(name, prop) {\n// prop parameter are `undefined` here\n})\n
    • Wait all game objects are destroyed : [wait=goType]
      • Also fire event 'wait.' + goType
        txt.on('wait.' + goType, function(name, prop) {\n// name and prop parameter are `undefined` here\n})\n
    • Wait boolean data in game object's data manager set to true/false : [wait=goType.name.dataKey]/[wait=goType.name.!dataKey]
      • Also fire event 'wait.' + goType
        txt.on('wait.' + goType, function(name, prop) {\n})\n
    "},{"location":"textplayer/#typing-content","title":"Typing content","text":"
    txt.play(content);\n

    or

    txt.playPromise(content)\n.then(function(){\n// Typing content complete\n})\n
    "},{"location":"textplayer/#show-current-page","title":"Show current page","text":"
    txt.showPage();\n
    • Set typing speed to 0.
    • Set animation progress to 1.
    • Skip all waiting events.
    • Stop current sound effects, and ignore remainder sound effects.
    "},{"location":"textplayer/#typing-next-page","title":"Typing next page","text":"
    txt.typingNextPage();\n
    • Set nextPageInput to null, or false in config.
    "},{"location":"textplayer/#ignore-next-page-input","title":"Ignore next page input","text":"
    • Ignore next page input
      txt.setIgnoreNextPageInput();\n
    • Rollback waiting next page input
      txt.setIgnoreNextPageInput(false);\n
    "},{"location":"textplayer/#pause","title":"Pause","text":"
    • Pause typing
      txt.pauseTyping();\n
    • Pause typing and typing animation
      txt.pause();\n
    "},{"location":"textplayer/#resume","title":"Resume","text":"
    • Resume typing
      txt.resumeTyping();\n
    • Resume typing and typing animation
      txt.resume();\n
    "},{"location":"textplayer/#typing-speed","title":"Typing speed","text":"
    • Get
      • Default typing speed
        var speed = txt.defaultTypingSpeed;\n
      • Current typing speed
        var speed = txt.typingSpeed;\n
    • Set
      • Default typing speed
        txt.setDefaultTypingSpeed(speed);\n
        txt.defaultTypingSpeed = speed;\n
      • Current typing speed
        txt.setTypingSpeed(speed);\n// txt.setTypingSpeed();    // Set speed to default speed\n
        txt.typingSpeed = speed;\n
    "},{"location":"textplayer/#time-scale","title":"Time scale","text":"

    Time scale of typing, typing animation, sprite animation and easing of sprite's properties.

    • Get
      var timeScale = txt.timeScale;\n
    • Set
      txt.setTimeScale(timeScale);    
      txt.timeScale = timeScale;\n
    "},{"location":"textplayer/#status","title":"Status","text":"
    • Is playing : After txt.play(content), before typing all pages completed
      var isPlaying = txt.isPlaying\n
    • Is page typing : After txt.play(content), or txt.typingNextPage(), before page typing completed
      var isPageTyping = txt.isPageTYyping;\n
    "},{"location":"textplayer/#events","title":"Events","text":"
    • On typing content complete
      txt.on('complete', function() {\n\n})\n
    • On typing a character or an image
      txt.on('typing', function(child) {\nif (child.type === 'text') {\nvar character = child.text;\n} else {\nvar textureLey = child.key;\nvar frameKey = child.frame;\n}\n})\n
    • On typing a page start
      txt.on('page.start', function() {\n\n})\n
    • On typing a page complete
      txt.on('page.complete', function() {\n\n})\n
    "},{"location":"textplayer/#tags-of-content","title":"Tags of content","text":""},{"location":"textplayer/#content","title":"Content","text":"

    These lines will be skipped :

    • Empty line, which only has space characters.
    • Comment line, start with '//'.

    New line symbol '\\n' will be removed, use [r] to insert a new line character.

    "},{"location":"textplayer/#content-output-switch","title":"Content output switch","text":"
    • Turn off content output : [content.off]
    • Turn on content output : [content.on]
    "},{"location":"textplayer/#content-output-enable","title":"Content output enable","text":"
    • Content won't output if parser.setContentOutputEnable(false) under custom tag events
      • Fire 'parser.+custom#content' event if conent is ignored now
        txt.on('parser.+custom#content', function(parser, content) {\n\n})\n
    • Invoke parser.setContentOutputEnable() to turn on content output back.
    "},{"location":"textplayer/#text-style","title":"Text style","text":"
    • Font color : [color=red]content[/color], [color=#FF0000]content[/color]
    • Font size : [size=24]content[/size]
    • Bold : [b]content[/b]
    • Italic : [i]content[/i]
    • Stroke : [stroke]content[/stroke], [stroke=red]content[/stroke]
      • strokeThickness is set in config
    • Shadow : [shadow]content[/shadow], [shadow=red]content[/shadow]
      • shadowOffsetX, shadowOffsetY, shadowBlur are set in config
    • Character offset Y : [y=-8]c[/y]ontent
    • Character offset X : [x=10]c[/x]ontent
    • Left space : [left=10]c[/left]ontent
    • Right space : conten[right=10]t[/right]
    • Line-align : [align=left], [align=center], [align=right]
    "},{"location":"textplayer/#new-line","title":"New line","text":"
    • New line : [r]
      • New line via \\n will be ignored.
    "},{"location":"textplayer/#page-break","title":"Page break","text":"
    • [pagebreak], or [pb] : Put remainder characters to next page.
    "},{"location":"textplayer/#image","title":"Image","text":"

    [img=key]

    "},{"location":"textplayer/#render-size","title":"Render size","text":"
    • Set render size in config
      {\nimages: {\n// key: {width, height},\n// key: {key, frame, width, height, tintFill: false}\n}\n}\n
      • tintFill :
        • false : Keep original color. Default behavior.
        • true : Change fill-color by color tag. [color=...][img=...].
    • Set render size by method
      txt.addImage({\n// key: {width, height},\n// key: {key, frame, width, height, tintFill: false}\n})\n
    • Use origin render size by default
    "},{"location":"textplayer/#space","title":"Space","text":"

    [space=width]

    "},{"location":"textplayer/#typing-speed_1","title":"Typing speed","text":"
    • No typing : [speed=0]
    • Set speed : [speed=1000]
    • Back to default speed : [/speed]
    "},{"location":"textplayer/#sprite","title":"Sprite","text":"
    • Add sprite : [sprite.name=textureKey,frameKey]
      • Tint-fade-in if sprite.fade is not 0
    • Remove sprite : [/sprite.name]
      • Tint-fade-out if sprite.fade is not 0
    • Remove all sprites : [/sprite]
      • Tint-fade-out if sprite.fade is not 0
    • Call method : [sprite.name.methodName=value0,value1,value2]
    • Set property : [sprite.name.x=value], [sprite.name.alpha=value], ....
    • Ease property :
      [sprite.name.x.to=value,duration]\n
      [sprite.name.x.to=value,duration,repeat]\n
      [sprite.name.x.to=value,duration,easeFunction,repeat]\n
      [sprite.name.x.to=value]\n
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Yoyo ease property :
      [sprite.name.x.yoyo=value,duration]\n
      [sprite.name.x.yoyo=value,duration,repeat]\n
      [sprite.name.x.yoyo=value,duration,easeFunction,repeat]\n
      [sprite.name.x.yoyo=value]\n
    • Set texture : [sprite.name.texture=textureKey,frameKey]
    • Play animation : [sprite.name.play=animationKey], or [sprite.name.play=animationKey0,animationKey1,...]
      • Can play animation without adding sprite first.
    • Stop animation : [/sprite.name.play], or [sprite.name.stop]
    • Pause animation : [sprite.name.pause]
    "},{"location":"textplayer/#sound-effect","title":"Sound effect","text":"
    • Play : [se=key], [se2=key]
      • Sound effect will be destroyed when complete
    • Play with fade in volume : [se=key,1000], [se2=key,1000]
    • Fade in volume : [se.fadein=1000], [se2.fadein=1000]
    • Fade out volume : [se.fadeout=1000], [se2.fadeout=1000]
    • Fade out volume then stop : [se.fadeout=1000,stop], [se2.fadeout=1000,stop]
    • Set volume : [se.volume=1], [se2.volume=1]
    "},{"location":"textplayer/#background-music","title":"Background music","text":"
    • Play, stop : [bgm=key], [/bgm], [bgm2=key],[/bgm2]`
      • Previous background music will be stopped and destroyed.
      • Cross fade to next background music if sounds.bgm.fade/sounds.bgm2.fade is not 0
    • Play with fade in volume : [bgm=key,1000], [bgm2=key,1000]
    • Pause, resume : [bgm.pause], [/bgm.pause], [bgm2.pause], [/bgm2.pause]
    • Fade in volume : [bgm.fadein=1000], [bgm2.fadein=1000]
    • Fade out volume : [bgm.fadeout=1000], [bgm2.fadeout=1000]
    • Fade out volume then stop : [bgm.fadeout=1000,stop], [bgm2.fadeout=1000,stop]
    • Cross fade to another background music : [bgm.cross=key,10000], [bgm2.cross=key,10000]
    • Set volume : [bgm.volume=1], [bgm2.volume=1]
    • Mute : [bgm.mute], [bgm2.mute], [bgm.unmute], [bgm2.unmute]
    "},{"location":"textplayer/#camera","title":"Camera","text":"
    • Fade-in effect : [camera.fadein], [camera.fadein=1000], or [camera.fadein=duration,red,green,blue]
    • Fade-out effect : [camera.fadeout], [camera.fadeout=1000], or [camera.fadeout=duration,red,green,blue]
    • Flash effect : [camera.flash], [camera.flash=1000], or [camera.flash=duration,red,green,blue]
    • Shake effect : [camera.shake], [camera.shake=1000], or [camera.shake=duration,intensity]
    • Zoom
      • Set zoom : [camera.zoom=2]
      • Zoom to : [camera.zoom.to=1,1000], or [camera.zoom.to=zoomValue,duration,Cubic]
    • Rotate
      • Set angle : [camera.rotate=90], angle in degrees
      • Rotate to : [camera.rotate.to=0,1000], or [camera.rotate.to=deg,duration,Cubic], angle in degrees
    • Scroll
      • Scroll x,y : [camera.scroll=0,200]
      • Scroll x,y to : [camera.scroll.to=0,200,1000], or [camera.rotate.to=x,y,duration,Cubic]
    "},{"location":"textplayer/#wait-conditions","title":"Wait conditions","text":"
    • Wait click : [wait=click], [click]
      • Also fire event 'wait.click'
         txt.on('wait.click', function() {\n})\n
    • Wait key-down : [wait=enter], [wait=space], ....
      • Also fire event 'wait.keydown'
         txt.on('wait.keydown', function(keyName) {\n})\n
    • Wait time : [wait=1000]
      • Also fire event 'wait.time'
         txt.on('wait.time', function(time) {\n})\n
    • Wait sound effect : [wait=se], [wait=se2]
      • Also fire event 'wait.music'
         txt.on('wait.music', function(music) {\n// var key = music.key;\n})\n
    • Wait background music : [wait=bgm], [wait=bgm2]
      • Also fire event 'wait.music'
         txt.on('wait.music', function(music) {\n// var key = music.key;\n})\n
    • Wait camera effect : [wait=camera.fadein], [wait=camera.fadeout], [wait=camera.flash], [wait=camera.shake], [wait=camera.zoom], [wait=camera.rotate], [wait=camera.scroll]
      • Also fire event 'wait.camera'
         txt.on('wait.camera', function(effectName) {\n// effectName : 'camera.fadein', 'camera.fadeout', 'camera.flash', 'camera.shake', 'camera.zoom', 'camera.rotate', 'camera.scroll'\n})\n
    • Wait ease task of sprite's property : [wait=sprite.name.prop]
      • Also fire event 'wait.sprite'
         txt.on('wait.sprite', function(name, prop) {\n})\n
    • Wait all sprites are destroyed : [wait=sprite]
      • Also fire event 'wait.sprite'
         txt.on('wait.sprite', function(name, prop) {\n// name and prop parameter are `undefined` here\n})\n
    • Wait callback : [wait], or [wait=xxx] (xxx is any string which not been used in above case)
      • Fire event 'wait'
        txt.on('wait', function(callback) {\n// Invoke `callback()` to continue typing\n})\n
      • Fire event 'wait.xxx'
        txt.on('wait.xxx', function(callback) {\n// Invoke `callback()` to continue typing\n})\n
    • Combine conditions : [wait=cond0|cond1|...]
      • Wait click, or enter key down : [wait=click|enter]
      • Wait click, enter key down, or 100ms : [wait=click|enter|1000]
    "},{"location":"textplayer/#custom-tag","title":"Custom tag","text":"

    Assume that adding a custom tag : [custom=10,20][/custom].

    +custom parses the open tag [custom=10,20] and -custom parses the closing tag [/custom]

    • On parse a +custom tag, will add a custom command child
      txt.on('parser.+custom', function(parser, a, b, params) {\n// console.log('Parse +custom tag:', a, b)\n})\n
      • parses opening tag
      • a, b, ... : Parameters after =
      • params : Arguments array used when executing +custom. Equal to [a, b] in this case.
      • Disable content after this start tag
        parser.setContentOutputEnable(false);\n
    • On execute a +custom command child
      txt.on('tag.+custom', function(a, b) {\n// console.log('Execute +custom tag:', a, b)\n})\n
      • a, b, ... : Parameters passed from params in 'parser.+custom' event.
    • On parse a -custom tag, will add a custom command child
      txt.on('parser.-custom', function(parser, params) {\n// console.log('Parse -custom tag')\n})\n
      • parses closing tag
      • params : Arguments array used when executing -custom. Equal to [] in this case.
      • Enable content after this start tag
        parser.setContentOutputEnable(true);\n
    • On execute a -custom command child
      txt.on('tag.-custom', function(...params) {\n// console.log('Execute -custom tag')\n})\n
      • params : Parameters passed from params in 'parser.-custom' event.
    "},{"location":"textplayer/#size","title":"Size","text":"
    • Resize canvas size
      txt.setCanvasSize(width, height)\n
    • Reisze text wrapping size and canvas size.
      txt.setSize(width, height);\n
      or
      txt.setFixedSize(width, height);\n
    • Resize to minimun size to show all visible characters.
      txt.setToMinSize();\n
    "},{"location":"textplayer/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"textplayer/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"textplayer/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"texttranslation/","title":"Translation","text":""},{"location":"texttranslation/#introduction","title":"Introduction","text":"

    Apply translated string (i18next) to text object, bbcode text object, tag text object, bitmap text object, or label game object

    • Author: Rex
    • Behavior of text object
    "},{"location":"texttranslation/#live-demos","title":"Live demos","text":"
    • Inline resources
    • External resources
    • External yaml resource
    "},{"location":"texttranslation/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"texttranslation/#install-plugin","title":"Install plugin","text":""},{"location":"texttranslation/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in scene's config
      class Demo extends Phaser.Scene {\nconstructor() {\nsuper({\nkey: 'Scnee',\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'rextexttranslationplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexttranslationplugin.min.js',\nstart: true,\nmapping: 'translation'  // Add text-translation plugin to `scene.translation`\n}]\n},\n// ...\n});\n}\n// ...\n}\n
    • Initialize i18next during preload stage
      scene.plugins.get('rextexttranslationplugin').initI18Next(scene, {\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n\n// backend: {\n//     loadPath: '',\n//     parse: function(data) { return JSON.parse(data); }\n// },\n})\n
    • Add translation behavior
      var translation = scene.plugins.get('rextexttranslationplugin').add(textGameObject, config);\n
    "},{"location":"texttranslation/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextTranslationPlugin from 'phaser3-rex-plugins/plugins/texttranslation-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextTranslation',\nplugin: TextTranslationPlugin,\nstart: true,\nmapping: 'translation'  // Add text-translation plugin to `scene.translation`\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize i18next during preload stage
      scene.plugins.get('rexTextTranslation').initI18Next(scene, {\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n\n// backend: {\n//     loadPath: '',\n//     parse: function(data) { return JSON.parse(data); }\n// },\n})\n
    • Add translation behavior
      var translation = scene.plugins.get('rexTextTranslation').add(textGameObject, config);\n
    "},{"location":"texttranslation/#import-class","title":"Import class","text":"
    • Install rex plugins, i18next, i18next-http-backend from npm
      npm i phaser3-rex-plugins\nnpm i i18next\nnpm i i18next-http-backend\n
    • Import class
      import TextTranslationBehavior from 'phaser3-rex-plugins/plugins/texttranslation.js';\nimport i18next from 'i18next';\nimport Backend from 'i18next-http-backend';\nimport Awaitloader from 'phaser3-rex-plugins/plugins/awaitloader.js';\n
    • Initialize i18next during preload stage
      Awaitloader.call(scene.load, function (successCallback, failureCallback) {\ni18next\n.use(Backend)\n.init({\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n\n// backend: {\n//     loadPath: '',\n//     parse: function(data) { return JSON.parse(data); }\n// },\n}, successCallback);\n})\nTextTranslationBehavior.setI18Next(i18next);\n
      • Awaitloader : Using Awaitloader to load external resource.
      • Backend : i18next-http-backend module can be used to load external resource.
      • TextTranslationBehavior.setI18Next(i18next) : Pass i18next to TextTranslationBehavior.
        • TextTranslationBehavior.setI18Next is a static method.
    • Add translation behavior
      var translation = new TextTranslationBehavior(textGameObject, config);\n
    "},{"location":"texttranslation/#initialize-i18next","title":"Initialize i18next","text":"
    scene.plugins.get('rexTextTranslation').initI18Next(scene, {\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n\n// backend: {\n//     loadPath: '',\n//     parse: function(data) { return JSON.parse(data); }\n// },\n})\n

    or

    i18next\n.use(Backend)\n.init(config, onComplete);\n
    • lng : Language to use. Will fallback to 'dev'.
    • fallbackLng : Language to use if translations in user language are not available. Setting it explicitly to false will not trigger to load the fallbackLng at all.
    • ns : String or array of namespaces to load. Default value is 'translation'.
    • debug : Logs info level to console output. Helps finding issues with loading not working. Default value is false.
    • resources : Resources to initialize with.
    • backend.loadPath : Path where resources get loaded from, or a function returning a path.
      function(lngs, namespaces) { return customPath; }\n
    • backend.parse : Parse data after it has been fetched. Optional.
      function(data) { return JSON.parse(data); }\n

    See also Configuration Options, and Backend Options

    "},{"location":"texttranslation/#create-instance","title":"Create instance","text":"
    var translation = scene.plugins.get('rexTextTranslation').add(textGameObject, {\n// translationKey: '',\n// interpolation: {},\n\n// updateText: true,\n\n// setText: function(gameObject, text) { \n//     gameObject.setText(text); \n// }\n});\n
    • textObject : text object, bbcode text object, tag text object, bitmap text object, or label game object
    • translationKey : Key in translation resource. See Essentials
    • interpolation : Integrating dynamic values into translation result. See Interpolation
    • updateText :
      • true : Update text object via translationKey, and interpolation. Default behavior.
      • false : Don't update text object now.
    • setText : Callback invoked when updating text object. Default value is
      function(gameObject, text) {\ngameObject.setText(text);\n}\n
    "},{"location":"texttranslation/#set-translation-key","title":"Set translation key","text":"
    translation\n.setTranslationKey(key)\n.updateText()\n
    "},{"location":"texttranslation/#set-interpolation","title":"Set interpolation","text":"
    • Assign interpolation object
      translation\n.setInterpolation(object)\n.updateText()\n
    • Update current interpolation object
      translation\n.updateInterpolation(key, value)\n.updateText()\n
      or
      translation\n.updateInterpolation(object)\n.updateText()\n
    "},{"location":"texttranslation/#update-text","title":"Update text","text":"

    Update text object via translationKey, and interpolation.

    translation.updateText()\n
    "},{"location":"texttranslation/#change-language","title":"Change language","text":"
    scene.plugins.get('rexTextTranslation').changeLanguage(language);\n// scene.plugins.get('rexTextTranslation').changeLanguage(language, onComplete);\n

    or

    i18next.changeLanguage(language, onComplete);\n

    All translation behavior will update text object after changing language.

    "},{"location":"texttranslation/#set-default-namespace","title":"Set default namespace","text":"
    scene.plugins.get('rexTextTranslation').setDefaultNamespace(namespace);\n

    or

    i18next.setDefaultNamespace(namespace);\n
    "},{"location":"texttranslation/#translate-string","title":"Translate string","text":"
    var result = scene.plugins.get('rexTextTranslation').t(translationKey, interpolation);\n

    or

    var result = i18next.t(translationKey, interpolation);\n
    "},{"location":"texttranslation/#events","title":"Events","text":"
    • On language changed, triggered by changeLanguage method.
      scene.plugins.get('rexTextTranslation').on('languageChanged', function (lng) {\n});\n
      or
      i18next.on('languageChanged', function (lng) {\n});\n
    "},{"location":"texttruncator/","title":"Truncator","text":""},{"location":"texttruncator/#introduction","title":"Introduction","text":"

    Constraints text game object size by truncating text with padding symbol on text object, bbcode text object, or tag text object.

    • Author: Rex
    • Behavior of text object
    "},{"location":"texttruncator/#live-demos","title":"Live demos","text":"
    • Truncate text
    • Truncate BBCodeText
    "},{"location":"texttruncator/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"texttruncator/#install-plugin","title":"Install plugin","text":""},{"location":"texttruncator/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextexttruncatorplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexttruncatorplugin.min.js', true);\n
    • Add text-truncator behavior
      var truncator = scene.plugins.get('rextexttruncatorplugin').add(textGameObject, config);\n
    "},{"location":"texttruncator/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextTruncatorPlugin from 'phaser3-rex-plugins/plugins/texttruncator-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextTruncator',\nplugin: TextTruncatorPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-truncator behavior
      var truncator = scene.plugins.get('rexTextTruncator').add(textGameObject, config);\n
    "},{"location":"texttruncator/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TextTruncator from 'phaser3-rex-plugins/plugins/texttruncator.js';\n
    • Add text-truncator behavior
      var truncator = new TextTruncator(textGameObject, config);\n
    "},{"location":"texttruncator/#create-instance","title":"Create instance","text":"
    var truncator = scene.plugins.get('rexTextTruncator').add(textGameObject, {\n// enable: true,\n// symbol: '...',\n// maxWidth: undefined,\n// maxHeight: undefined,\n// text: '',              // content in string or array\n});\n
    • textObject : Text object, bbcode text object, tag text object, or bitmap text object
    • enable :
      • true : Truncate string with padding symbol. Default value.
      • false : Display all text.
    • symbol : Padding symbol. Default value is '...'
    • maxWidth : Maximum width of game object, for single-line mode.
      • undefined : Use fixedWidth as maximum width.
    • maxHeight : Maximum height of game object, for multiple-line mode.
      • undefined : Use fixedHeight as maximum height.
    • text : content in string or array, optional
    "},{"location":"texttruncator/#truncation-modes","title":"Truncation modes","text":"
    • Single-line mode :
      • maxHeight or fixedHeight are not given, or 0
      • Have maxWidth or fixedWidth
    • Multiple-line mode
      • Have fixedWidth or wordWrap.width (wrap-width)
      • Have maxHeight or fixedHeight
    "},{"location":"texttruncator/#set-content","title":"Set content","text":"
    • Set content
      truncator.setText(content);\n
      • content : String, number, or string array.
    • Append content
      truncator.appendText(content);\n
      • content : String, number, or string array.

    Will update displaying content.

    • Get content back
      var text = truncator.text;\n
    "},{"location":"texttruncator/#update-display-content","title":"Update display content","text":"
    truncator.updateText();\n
    "},{"location":"texttruncator/#set-enable","title":"Set enable","text":"
    truncator.setEnable(enable).updateText();\n
    "},{"location":"texttruncator/#set-paddding-symbol","title":"Set paddding symbol","text":"
    truncator.setSymbol(symbol).updateText();\n
    "},{"location":"texttruncator/#set-max-size","title":"Set max size","text":"
    • Max width
      • Set
        truncator.setMaxWidth(width).updateText();\n
      • Get
        var width = truncator.maxWidth;\n
    • Max height
      • Set
        truncator.setMaxHeight(height).updateText();\n
      • Get
        var height = truncator.maxHeight;\n
    "},{"location":"texttyping/","title":"Typing","text":""},{"location":"texttyping/#introduction","title":"Introduction","text":"

    Typing text on text object, bbcode text object, or tag text object.

    • Author: Rex
    • Behavior of text object
    "},{"location":"texttyping/#live-demos","title":"Live demos","text":"
    • BBCode text + page + typing
    • Text wrap enable
    • TextBox, see text-box.
    "},{"location":"texttyping/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"texttyping/#install-plugin","title":"Install plugin","text":""},{"location":"texttyping/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextexttypingplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexttypingplugin.min.js', true);\n
    • Add typing behavior
      var typing = scene.plugins.get('rextexttypingplugin').add(textGameObject, config);\n
    "},{"location":"texttyping/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextTypingPlugin from 'phaser3-rex-plugins/plugins/texttyping-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextTyping',\nplugin: TextTypingPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add typing behavior
      var typing = scene.plugins.get('rexTextTyping').add(textGameObject, config);\n
    "},{"location":"texttyping/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TextTyping from 'phaser3-rex-plugins/plugins/texttyping.js';\n
    • Add typing behavior
      var typing = new TextTyping(textGameObject, config);\n
    "},{"location":"texttyping/#create-instance","title":"Create instance","text":"
    var typing = scene.plugins.get('rexTextTyping').add(textGameObject, {\n// wrap: false,\n// speed: 333,       // typing speed in ms\n// typeMode: 0,      //0|'left-to-right'|1|'right-to-left'|2|'middle-to-sides'|3|'sides-to-middle'\n// setTextCallback: function(text, isLastChar, insertIdx){ return text; }  // callback before set-text\n// setTextCallbackScope: null,   \n});\n
    • textObject : Text object, bbcode text object, tag text object, or bitmap text object
    • wrap :
      • false : Don't insert \\n, default behavior.
      • true : Insert \\n to wrap content according to style of text, to prevent typing jittering.
    • speed : Typing speed in ms, default value is 333.
    • typeMode :
      • 'left-to-right', or 0 : Typing characters from left to right.
      • 'right-to-left', or 1 : Typing characters from right to left.
      • 'middle-to-sides', or 2 : Typing characters from middle to sides.
      • 'sides-to-middle', or 3 : Typing characters from sides to middle.
    • setTextCallback : Callback befor set-text, to decorate display text.
      function(text, isLastChar, insertIdx) { return text; }\n
    • setTextCallbackScope : Scope of setTextCallback function.
    "},{"location":"texttyping/#start-typing","title":"Start typing","text":"
    typing.start(text);\n// typing.start(text, speed); \n
    • text : Typing content string.
    • speed : Typing speed in ms.
    "},{"location":"texttyping/#start-typing-from-line","title":"Start typing from line","text":"
    typing.startFromLine(text, lineIndex);\n// typing.startFromLine(text, lineIndex, speed);\n
    • text : Typing content string.
    • lineIndex : Start from line.
    • speed : Typing speed in ms.
    "},{"location":"texttyping/#typing-more-text","title":"Typing more text","text":"
    typing.appendText(text);\n
    "},{"location":"texttyping/#stop-typing","title":"Stop typing","text":"
    typing.stop();\n// typing.stop(true);;  // stop and show all text\n
    "},{"location":"texttyping/#pauseresume-typing","title":"Pause/Resume typing","text":"
    • Pause typing
      typing.pause();\n
    • Resume typing
      typing.resume();\n
    "},{"location":"texttyping/#set-typing-speed","title":"Set typing speed","text":"
    typing.setTypingSpeed(speed);  // speed in ms\n// typing.speed = speed;\n

    Set speed in typing event or setTextCallback to change typing speed of remaining text.

    "},{"location":"texttyping/#set-typing-mode","title":"Set typing mode","text":"
    typing.setTypeMode(mode);\n
    • typeMode :
      • 'left-to-right', or 0 : typing characters from left to right.
      • 'right-to-left', or 1 : typing characters from right to left.
      • 'middle-to-sides', or 2 : typing characters from middle to sides, optional.
      • 'sides-to-middle', or 3 : typing characters from sides to middle.
    "},{"location":"texttyping/#events","title":"Events","text":"
    • On changing content of text game object :
      typing.on('type', function(){\n\n});\n
    • On typing a character
      typing.on('typechar', function(char){\n\n});\n
    • On typing completed :
      typing.on('complete', function(typing, txt){});\n
    "},{"location":"texttyping/#status","title":"Status","text":"
    • Is typing
      var isTyping = typing.isTyping;\n
    "},{"location":"textures/","title":"Textures","text":""},{"location":"textures/#introduction","title":"Introduction","text":"

    Textures cache, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"textures/#usage","title":"Usage","text":""},{"location":"textures/#image-texture","title":"Image texture","text":"
    • Load image texture
      scene.load.image(key, url);\n
      Reference: Loader
    • Load image texture via base64 string
      scene.textures.addBase64(key, data)\n
    • Get image texture
      var texture = scene.textures.get(key);\nvar image = texture.getSourceImage();\n// var width = image.width;\n// var height = image.height;\n
    • Get image texture from frame object
      var texture = scene.textures.get(frameObject);\n
    "},{"location":"textures/#get-pixel","title":"Get pixel","text":"
    var color = scene.textures.getPixel(x, y, key);\n// var color = scene.textures.getPixel(x, y, key, frame);\n

    Properties of color

    • r : 0 ~ 255
    • g : 0 ~ 255
    • b : 0 ~ 255
    • a : 0 ~ 255
    • color : color integer
    var alpha = scene.textures.getPixelAlpha(x, y, key);\n// var alpha = scene.textures.getPixelAlpha(x, y, key, frame);\n

    alpha : 0 ~ 255

    Return null if the coordinates were out of bounds.

    "},{"location":"textures/#generate-texture-from-array","title":"Generate texture from array","text":"
    var config = {\ndata: data,\n// 3x3:\n// [ '...',\n//   '...',\n//   '...' ]\npixelWidth: 1,    // pixel width of each data\npixelHeight: 1,   // pixel height of each data\npreRender: null,  // callback, function(canvas, ctx) {}\npostRender: null, // callback, function(canvas, ctx) {}\n\ncanvas: null,  // create a canvas if null\nresizeCanvas: true,\nclearCanvas: true\n};\nvar texture = scene.textures.generate(key, config);\n
    "},{"location":"textures/#has-key","title":"Has key","text":"
    var hasKey = scene.textures.exists(key);\n
    "},{"location":"textures/#remove-texture","title":"Remove texture","text":"

    Remove texture stored in texture cache.

    scene.textures.remove(key);\n
    "},{"location":"textures/#get-base64","title":"Get base64","text":"
    var s = scene.textures.getBase64(key);  // type= 'image/png', encoderOptions= 0.92\n// var s = scene.textures.getBase64(key, frame, type, encoderOptions);\n
    "},{"location":"textures/#default-textures","title":"Default textures","text":"
    • Default : '__DEFAULT'
    • Missing : '__MISSING'
    • 4x4 white : '__WHITE'
    "},{"location":"textures/#get-key-list-of-all-textures","title":"Get key list of all textures","text":"
    var keys = scene.textures.getTextureKeys();\n
    "},{"location":"textures/#texture","title":"Texture","text":""},{"location":"textures/#get-texture","title":"Get texture","text":"
    var texture = scene.textures.get(key);\n
    "},{"location":"textures/#has-frame","title":"Has frame","text":"
    var hasFrame = texture.has(frameName);\n
    "},{"location":"textures/#add-frame","title":"Add frame","text":"
    var frame = texture.add(frameName, sourceIndex, x, y, width, height);\n
    • key : Texture key.
    • frameName : The name of this Frame. The name is unique within the Texture.
    • sourceIndex : The index of the TextureSource that this Frame is a part of.
    • x, y : The x/y coordinate of the top-left of this Frame.
    • width, height : The width/height of this Frame.
    "},{"location":"textures/#remove-frame","title":"Remove frame","text":"
    var removed = texture.remove(frameName);\n
    "},{"location":"textures/#get-name-of-frames","title":"Get name of frames","text":"
    var nameList = texture.getFrameNames();\n// nameList does not include `__BASE`\n

    or

    var nameList = texture.getFrameNames(true);\n// nameList includes `__BASE`\n
    "},{"location":"textures/#frame-object","title":"Frame object","text":""},{"location":"textures/#get-frame","title":"Get frame","text":"
    var frame = scene.textures.getFrame(key, frame);\n
    "},{"location":"textures/#properties","title":"Properties","text":"
    • frame.source.image : Image of texture source.
    • frame.cutX : X position within the source image to cut from.
    • frame.cutY : Y position within the source image to cut from.
    • frame.cutWidth : The width of the area in the source image to cut.
    • frame.cutHeight : The height of the area in the source image to cut.
    "},{"location":"textures/#add-atlas","title":"Add atlas","text":"
    scene.textures.addAtlas(key, HTMLImageElement, data);\n// scene.textures.addAtlas(key, HTMLImageElement, data, dataSource);\n
    • key : The unique string-based key of the Texture.
    • HTMLImageElement : HTML Image element/s.
    • data : The Texture Atlas data/s.
      {\nframes: [\n{\n// Location of frame image\nframe: {\nx, y, w, h\n},\n\n// trimmed\ntrimmed:\nsourceSize: {\nw, h\n},\nspriteSourceSize: {\nx, y, w, h\n},\n\nrotated:\n\n// Custom origin\nanchor: pivot: {\nx, y\n},\n\n// Other custom properties of this frame ...\n}\n],\n\n// Other custom properties of this texture ...\n}\n
    • dataSource : An optional data Image element (normal map).

    or

    scene.textures.addAtlas(undefined, texture, data);\n// scene.textures.addAtlas(undefined, texture, data, dataSource);\n
    • texture : Phaser Texture.
    "},{"location":"textures/#add-sprite-sheet","title":"Add sprite sheet","text":"
    scene.textures.addSpriteSheet(key, HTMLImageElement, config);\n// scene.textures.addAtlas(key, HTMLImageElement, config, dataSource);\n
    • key : The unique string-based key of the Texture.
    • HTMLImageElement : HTML Image element/s.
    • config : The configuration object for this Sprite Sheet.
      {\nframeWidth: ,\nframeHeight: ,\nstartFrame: 0,\nendFrame: -1,\nmargin: 0,\nspacing: 0\n}\n
    • dataSource : An optional data Image element (normal map).

    or

    scene.textures.addSpriteSheet(undefined, texture, config);\n// scene.textures.addSpriteSheet(undefined, texture, config, dataSource);\n
    • texture : Phaser Texture.
    "},{"location":"textures/#events","title":"Events","text":"
    • Texture manager is ready
      scene.textures.on('ready', function() {\n\n})\n
    • Add texture
      scene.textures.on('addtexture', function(key) {\n\n})\n
      or
      scene.textures.on('addtexture-' + key, function() {\n\n})\n
    • Error when adding texture
      scene.textures.on('onerror', function(key) {\n\n})\n
    • Remove texture
      scene.textures.on('removetexture', function(key) {\n\n})\n
      or
      scene.textures.on('removetexture-' + key, function() {\n\n})\n
    "},{"location":"tiledmapdata/","title":"Tiled map data","text":""},{"location":"tiledmapdata/#introduction","title":"Introduction","text":"

    Parses a Tiled JSON object into a new MapData object.

    • Author: Richard Davey
    "},{"location":"tiledmapdata/#usage","title":"Usage","text":"
    var mapData = Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled(name, json, insertNull);\n
    • name : The name of the tilemap, used to set the name on the MapData.
    • json : The Tiled JSON object.
    • insertNull : Controls how empty tiles, tiles with an index of -1.
      • true : Empty locations will get a value of null.
      • false : Empty location will get a Tile object with an index of -1.
    "},{"location":"tiledmapdata/#map-data","title":"Map data","text":""},{"location":"tiledmapdata/#map-type","title":"Map type","text":"
    var mapType = mapData.orientation;\n
    • mapType : orthogonal, isometric, hexagonal
    "},{"location":"tiledmapdata/#map-size","title":"Map size","text":"
    • Grid size
      var mapWidth = mapData.width;\nvar mapHeight = mapData.height;\n
    • Pixel size
      var mapWidth = mapData.widthInPixels;\nvar mapHeight = mapData.heightInPixels;\n
    "},{"location":"tiledmapdata/#tile-size","title":"Tile size","text":"
    var tileWidth = mapData.tileWidth;\nvar tileHeight = mapData.tileHeight;\n
    "},{"location":"tiledmapdata/#layer","title":"Layer","text":"
    var layers = mapData.layers;\n
    mapData.layers.forEach(function(layer){\nvar name = layer.name;\n\n\nvar alpha = layer.alpha;\nvar visible = layer.visible;\n\nvar x = layer.x;\nvar y = layer.y;\nvar width = layer.width;\nvar height = layer.height;\nvar data = layer.data;\n\nlayer.data.forEach(function(gid, index){\nvar tileX = index % width;\nvar tileY = Math.floor(index / width);\nif (gid === -1) { // Empty\n\n} else {\n\n}\n})\n})\n
    "},{"location":"tilemap/","title":"Tile map","text":""},{"location":"tilemap/#introduction","title":"Introduction","text":"

    Display of tiles map, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"tilemap/#usage","title":"Usage","text":""},{"location":"tilemap/#hierarchy","title":"Hierarchy","text":"
    graph TB\n\ntilemap --> layerA[\"layerA<br>(Game object)\"]\ntilemap --> layerB\n\nlayerA --> tilesA[\"tiles<br>(layer.data[x][y])\"]\nlayerB --> tilesB[\"tiles\"]
    • map : A container for Tilemap data.
    • layer : A Game Object that renders LayerData from a map when used in combination with one or more tileset.
    • tiles : A 2d array of Tile object
      • Tile : A lightweight data representation, store position information without factoring in scroll, layer scale or layer position.
    • tileset : Image and tileData of some kind of tiles.
    "},{"location":"tilemap/#load-tile-map","title":"Load tile map","text":"
    scene.load.tilemapTiledJSON(key, url);   // JSON\nscene.load.tilemapCSV(key, url);         // CSV\n
    "},{"location":"tilemap/#add-tile-map-object","title":"Add tile map object","text":"
    1. Create map
      • Create map from tiled
        var map = scene.add.tilemap(key);\n
        or
        var map = this.make.tilemap({ key: 'map', tileWidth: 16, tileHeight: 16\n});\n
        • Support ORTHOGONAL, ISOMETRIC, STAGGERED, HEXAGONAL map
      • Create map from 2d array
        var map = this.make.tilemap({\n// data: tileIdxArray,  // [ [], [], ... ]\ntileWidth: 32,\ntileHeight: 32,\nwidth: 10,\nheight: 10,\n});\n
        • Only support ORTHOGONAL map
      • Create map from csv
        var map = this.make.tilemap({\nkey: 'map',     // csv file\ntileWidth: 32,\ntileHeight: 32,\n});\n
        • Only support ORTHOGONAL map
    2. Add tileset image
      var tileset = map.addTilesetImage(tilesetName, key); // key: texture key\n// var tileset = map.addTilesetImage(tilesetName);  // key = tilesetName\n// var tileset = map.addTilesetImage(tilesetName, key, tileWidth, tileHeight, tileMargin, tileSpacing, gid, tileOffset);\n
      • key : The key of the Phaser.Cache image used for this tileset.
        • undefined , null : Use tilesetName as default value.
      • tileWidth , tileHeight : The width/height of the tile (in pixels) in the Tileset Image.
        • undefined : Default to the map's tileWidth/tileHeight.
      • tileMargin : The margin around the tiles in the sheet (in pixels).
        • undefined : Default to 0
      • tileSpacing The spacing between each the tile in the sheet (in pixels).
        • undefined : Default to 0
      • gid : If adding multiple tilesets to a blank map, specify the starting GID this set will use here.
      • tileOffset : {x, y} Tile texture drawing offset.
    3. Create layer
      • Create existed layer
        var layer = map.createLayer(layerID, tileset);\n// var layer = map.createLayer(layerID, tileset, x, y);\n
        • tileset : The tileset, or an array of tilesets.
          • A string, or an array of string.
          • A tileset object, or an array of tileset objects.
        • x, y : Offset in pixels. Default is 0/0.
      • Create a new and empty layer
        var layer = map.createBlankLayer(layerID, tileset);\n// var layer = map.createBlankLayer(layerID, tileset, x, y, width, height, tileWidth, tileHeight); // x, y : offset in pixels\n
        • layerID : The name of this layer. Must be unique within the map.
        • tileset : The tileset, or an array of tilesets.
          • A string, or an array of string.
          • A tileset object, or an array of tileset objects.
        • x, y : Offset in pixels. Default is 0/0.
        • width, height : The width/height of the layer in tiles. Default is map.width/map.height.
        • tileWidth, tileHeight : The width/height of the tiles the layer uses for calculations. Default is map's tileWidth/tileHeight.
    4. Create game objects (optional)
      • Create game objects by Object-ID/Object-GID/Object-Name
        var sprites = map.createFromObjects(layerName, {\n// gid: 26,\n// name: 'bonus',\n// id: 9,\n\n// classType: Sprite,\n// ignoreTileset\n// scene,\n// container: null,\n// key: null,\n// frame: null\n}, useTileset);\n
        or
        var sprites = map.createFromObjects(layerName, configArray, useTileset);\n
        • One of filter
          • gid : Object GID.
          • id : Object ID.
          • name : Object Name.
        • classType : Class of game object, default is Sprite.
        • ignoreTileset :
        • scene : A Scene reference, passed to the Game Objects constructors. Default is map's scene.
        • container : Optional Container to which the Game Objects are added.
        • key, frame : Optional key of a Texture to be used.
      • Create game objects by tile
        var sprites = map.createFromTiles(indexes, replacements, spriteConfig);\n// var sprites = map.createFromTiles(indexes, replacements, spriteConfig, scene, camera, layer);\n
        • indexes : The tile index, or array of indexes
        • replacements :
          • null : Leave the tiles unchanged
          • Array of indexes : One-to-one mapping indexes to replacements.
        • spriteConfig : The config object to pass into the Sprite creator (i.e. scene.make.sprite).
          • useSpriteSheet : Set to true to load the tileset as a sprite sheet (not an image), map frame to tile index.
          • Copy rotation, flipX, flipY, alpha, visible and tint properties from Tile to sprites if these properties are not given.
        • scene : The Scene to create the Sprites within.
        • camera : The Camera to use when determining the world XY.
        • layer : The Tilemap Layer to act upon.
    "},{"location":"tilemap/#map","title":"Map","text":""},{"location":"tilemap/#map-size","title":"Map size","text":"
    var mapWidth = map.width;\nvar mapHeight = map.height;\n
    "},{"location":"tilemap/#tile-size","title":"Tile size","text":"
    • Set
      map.setBaseTileSize(tileWidth, tileHeight);\n
    • Get
      var tileWidth = map.tileWidth;\nvar tileHeight = map.tileHeight;\n
    "},{"location":"tilemap/#tileworld-position","title":"Tile/world position","text":"
    • World position -> Tile position
      var tileXY = map.worldToTileXY(worldX, worldY);\n// var out = map.worldToTileXY(worldX, worldY, snapToFloor, out, camera, layer);\n
    • Tile position -> World position
      var worldXY = map.tileToWorldXY(tileX, tileY);\n// var out = map.tileToWorldXY(tileX, tileY, out, camera, layer);\n
    "},{"location":"tilemap/#tile-at-world-xy","title":"Tile at world XY","text":"
    var hasTile = map.hasTileAtWorldXY(worldX, worldY);\n

    or

    var hasTile = map.hasTileAtWorldXY(worldX, worldY, camera, layer);\n
    "},{"location":"tilemap/#draw-on-graphics","title":"Draw on graphics","text":"
    map.renderDebug(graphics);\n

    or

    map.renderDebug(graphics, {\ntileColor: new Phaser.Display.Color(105, 210, 231, 150),         // null\ncollidingTileColor: new Phaser.Display.Color(243, 134, 48, 200), // null\nfaceColor: new Phaser.Display.Color(40, 39, 37, 150)             // null\n});\n

    or

    map.renderDebug(graphics, styleConfig, layer);\n
    • graphics : Graphics game object.
    "},{"location":"tilemap/#layer","title":"Layer","text":"

    A Game Object that renders LayerData from a map when used in combination with one or more tileset.

    "},{"location":"tilemap/#get-layer","title":"Get layer","text":"
    • Get layer instance
      var layer = map.getLayer(name);\n
    • Set current layer of map
      map.setLayer(layer);  // layer name, layer index\n
      or
      map.layer = layer;\n
    "},{"location":"tilemap/#render-pipeline","title":"Render pipeline","text":"
    layer.setPipeline(pipelineName);\n
    layer.setPostPipeline(pipelineName);\n

    See Render pipeline section of Game object.

    "},{"location":"tilemap/#render-order","title":"Render order","text":"
    layer.setRenderOrder(renderOrder);\n
    • renderOrder
      • 0, or 'right-down'
      • 1, or 'left-down'
      • 2, or 'right-up'
      • 3, or 'left-up'
    "},{"location":"tilemap/#fill-tiles","title":"Fill tiles","text":"
    • Fill current layer
      map.fill(index);  // Fill all grids\n
      or
      map.fill(index, tileX, tileY, width, height);\n
    • Fill layer
      layer.fill(index);  // Fill all grids\n
      or
      layer.fill(index, tileX, tileY, width, height);\n
    "},{"location":"tilemap/#randomize","title":"Randomize","text":"
    • Randomize current layer
      map.randomize(); // Randomize all grids\n
      or
      map.randomize(tileX, tileY, width, height, indexes);\n
      • indexes An array of tile indexes.
        • -1 : Empty tile.
    • Weight randomize current layer
      map.weightedRandomize(\n{\n{ index: 0, weight: 4 },\n{ index: [0, 1], weight: 4 }\n},\ntileX, tileY, width, height);\n
    • Randomize layer
      layer.randomize();  // Randomize all grids\n
      or
      layer.randomize(tileX, tileY, width, height, indexes);\n
      • indexes An array of tile indexes.
    • Weight randomize layer
      layer.weightedRandomize(\n{\n{ index: 0, weight: 4 },\n{ index: [0, 1], weight: 4 }\n},\ntileX, tileY, width, height);\n
    "},{"location":"tilemap/#copy-tiles","title":"Copy tiles","text":"
    • Copy current layer
      map.copy(srcTileX, srcTileY, width, height, destTileX, destTileY);\n
    • Copy layer
      map.copy(srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer);\n
      or
      layer.copy(srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces);\n
    "},{"location":"tilemap/#put-tile-at","title":"Put tile at","text":"
    • Put on current layer
      map.putTileAt(tile, tileX, tileY);\n
      • tile :
        • Tile index
        • Tile object :
          var tile = map.getTileAt(tileX, tileY);\n
          or
          var tile = map.getTileAtWorldXY(worldX, worldY);\n
    • Put on layer
      map.putTileAt(tile, tileX, tileY, recalculateFaces, layer);\n
      or
      layer.putTileAt(tile, tileX, tileY, recalculateFaces);\n
      • tile : Tile index, or tile object.
    "},{"location":"tilemap/#put-tiles-at","title":"Put tiles at","text":"
    • Put on current layer
      map.putTilesAt(tilesArray, tileX, tileY);  // tilesArray: 1d/2d array of Tile object or tile index\n
      • tilesArray : 1d/2d array of tile objects or tile indexes
    • Put on layer
      map.putTilesAt(tilesArray, tileX, tileY, recalculateFaces, layer);\n
      or
      layer.putTilesAt(tilesArray, tileX, tileY, recalculateFaces);\n
      • tilesArray : 1d/2d array of tile objects or tile indexes
    "},{"location":"tilemap/#replace-tiles","title":"Replace tiles","text":"
    • Replace on current layer
      map.replaceByIndex(findIndex, newIndex); // Search on all grids\n
      or
      map.replaceByIndex(findIndex, newIndex, tileX, tileY, width, height);\n
    • Replace on layer
      map.replaceByIndex(findIndex, newIndex, tileX, tileY, width, height, layer);\n
      or
      layer.replaceByIndex(findIndex, newIndex, tileX, tileY, width, height);\n
    "},{"location":"tilemap/#swap-tiles","title":"Swap tiles","text":"
    • Swap on current layer
      map.swapByIndex(indexA, indexB);\n
      or
      map.swapByIndex(indexA, indexB, tileX, tileY, width, height);\n
    • Swap on layer
      map.swapByIndex(indexA, indexB, tileX, tileY, width, height, layer);\n
      or
      layer.swapByIndex(indexA, indexB, tileX, tileY, width, height);\n
    "},{"location":"tilemap/#shuffle-tiles","title":"Shuffle tiles","text":"
    • Shuffle on current layer
      map.shuffle();\n
      or
      map.shuffle(tileX, tileY, width, height);\n
    • Shuffle on layer
      map.shuffle(tileX, tileY, width, height, layer);\n
      or
      layer.shuffle(tileX, tileY, width, height);\n
    "},{"location":"tilemap/#shader-effects","title":"Shader effects","text":"

    `layer`` support postFX effects

    Note

    No preFX effect support

    "},{"location":"tilemap/#tile","title":"Tile","text":""},{"location":"tilemap/#get-tile","title":"Get tile","text":"
    var tile = map.getTileAt(tileX, tileY);\n// var tile = map.getTileAtWorldXY(worldX, worldY);\n

    or

    var tile = map.getTileAt(tileX, tileY, true, layer);  // Return a Tile object with an index of -1 for empty tile\n// var tile = map.getTileAtWorldXY(worldX, worldY, true, camera, layer);\n
    • layer : The tile layer to use. Default is current layer (map.setLayer(layer))
    • tile : A tile, or null if layer is invalid.
    "},{"location":"tilemap/#get-tiles-within-a-rectangle-area","title":"Get tiles within a rectangle area","text":"
    var tiles = map.getTilesWithin(tileX, tileY, width, height);\n

    or

    var tiles = map.getTilesWithin(tileX, tileY, width, height, {\n// isNotEmpty: false,\n// isColliding: false,\n// hasInterestingFace: false\n}, layer);\n
    • tileX , tileY : The left/top most tile index (in tile coordinates) to use as the origin of the area. Default is 0/0.
    • width , height : How many tiles wide/tall from the tileX/tileY index the area will be. Default is map.width/map.height.
    • filteringOptions : Optional filters to apply when getting the tiles.
      • isNotEmpty : If true, only return tiles that don't have -1 for an index.
      • isColliding : If true, only return tiles that collide on at least one side.
      • hasInterestingFace : If true, only return tiles that have at least one interesting face.
    • layer : The tile layer to use. Default is current layer (map.setLayer(layer))
    • tiles : An array of Tiles, or null if layer is invalid.
    "},{"location":"tilemap/#get-tiles-within-world-xy","title":"Get tiles within world XY","text":"
    var tiles = map.getTilesWithinWorldXY(worldX, worldY, width, height);\n

    or

    var tiles = map.getTilesWithinWorldXY(worldX, worldY, width, height,  {\n// isNotEmpty: false,\n// isColliding: false,\n// hasInterestingFace: false\n}, camera, layer);\n
    • worldX , worldY : The world x/y coordinate for the top-left of the area.
    • width , height : The width/height of the area. Default is map.width/map.height.
    • filteringOptions : Optional filters to apply when getting the tiles.
      • isNotEmpty : If true, only return tiles that don't have -1 for an index.
      • isColliding : If true, only return tiles that collide on at least one side.
      • hasInterestingFace : If true, only return tiles that have at least one interesting face.
    • camera : The Camera to use when factoring in which tiles to return. Default is main camera.
    • layer : The tile layer to use. Default is current layer (map.setLayer(layer))
    • tiles : An array of Tiles, or null if layer is invalid.
    "},{"location":"tilemap/#get-tiles-within-shape","title":"Get tiles within shape","text":"
    vat tiles = map.getTilesWithinShape(shape);\n

    or

    vat tiles = map.getTilesWithinShape(shape, {\n// isNotEmpty: false,\n// isColliding: false,\n// hasInterestingFace: false\n}, camera, layer);\n

    Shape:

    • new Phaser.Geom.Rectangle(x0, y0, width, height)
    • new Phaser.Geom.Line(x0, y0, x1, y1)
    • new Phaser.Geom.Circle(x, y, radius)
    • new Phaser.Geom.Triangle(x0, y0, x1, y1, x2, y2)
    "},{"location":"tilemap/#for-each-tile-in-layer","title":"For each tile in layer","text":"
    map.forEachTile(function(tile, index, tileArray) { /* ... */ }, context);\n

    or

    map.forEachTile(function(tile, index, tileArray) { /* ... */ }, context,\ntileX, tileY, width, height, {\n// isNotEmpty: false,\n// isColliding: false,\n// hasInterestingFace: false\n}, layer);\n
    • tileX , tileY : The left/top most tile index (in tile coordinates) to use as the origin of the area to search.
    • width , height : How many tiles wide/tall from the tileX/tileY index the area will be. Default is map.width/map.height.
    • filteringOptions : Optional filters to apply when getting the tiles.
      • isNotEmpty : If true, only return tiles that don't have -1 for an index.
      • isColliding : If true, only return tiles that collide on at least one side.
      • hasInterestingFace : If true, only return tiles that have at least one interesting face.
    • layer : The tile layer to use. Default is current layer (map.setLayer(layer))
    "},{"location":"tilemap/#tile-index","title":"Tile index","text":"
    • Get index
      var index = tile.index;\n
    • Copy index
      tile.index = index;\n
    • Copy
      tile.copy(tileSrc);\n
      Copies the tile data & properties from the given tile to this tile. This copies everything except for position and interesting faces.
    "},{"location":"tilemap/#tile-position","title":"Tile position","text":"
    var x = tile.x;\nvar y = tile.y;\n
    "},{"location":"tilemap/#tile-corners","title":"Tile corners","text":"
    var points = map.getTileCorners(tileX, tileY, camera, layer);\n
    • points : Array of vector2 corresponding to the world XY location of each tile corner.
    "},{"location":"tilemap/#alpha","title":"Alpha","text":"
    • Set
      tile.setAlpha(value);\n
      or
      tile.alpha = value;\n
    • Get
      var alpha = tile.alpha;\n
    "},{"location":"tilemap/#visible","title":"Visible","text":"
    • Set
      tile.setVisible(visible);\n
      or
      tile.visible = visible;\n
    • Get
      var visible = visible;\n
    "},{"location":"tilemap/#flip","title":"Flip","text":"
    • Set
      tile.setFlipX(flipX);\ntile.setFlipY(flipY);\n
      or
      tile.flipX = flipX;\ntile.flipY = flipY;\n
    • Toggle
      tile.toggleFlipX();\ntile.toggleFlipY();\n
      or
      tile.flipX = !tile.flipX;\ntile.flipY = !tile.flipY;\n
    • Reset
      tile.resetFlip();\n
      or
      tile.flipX = false;\ntile.flipY = false;\n
    • Get
      var flipX = tile.flipX;\nvar flipY = tile.flipY;\n
    "},{"location":"tilemap/#bounds","title":"Bounds","text":"
    • Bounds rectangle
      var bounds = tile.getBounds();\n// var out = tile.getBounds(camera, out);\n
    • Left
      var left = tile.getLeft();\n// var left = tile.getLeft(camera);\n
    • Right
      var right = tile.getRight();\n// var right = tile.getRight(camera);\n
    • CenterX
      var centerX = tile.getCenterX();\n// var centerX = tile.getCenterX(camera);\n
    • Top
      var top = tile.getTop();\n// var top = tile.getTop(camera);\n
    • Bottom
      var bottom = tile.getBottom();\n// var bottom = tile.getBottom(camera);\n
    • CenterY
      var centerY = tile.getCenterY();\n// var centerY = tile.getCenterY(camera);\n
    "},{"location":"tilemap/#properties","title":"Properties","text":"
    var properties = tile.properties;  // object or null\nvar value = properties[key];\n
    tile.properties[key] = value;\n
    "},{"location":"tilemap/#collision","title":"Collision","text":""},{"location":"tilemap/#enable-collision","title":"Enable collision","text":"
    • Enable collision by tile index
      map.setCollision(index);\n// map.setCollision(index, true, recalculateFaces, updateLayer);\n
      • index : Tile index, or an array of tile indexes.
    • Enable collision by tile index in a range
      map.setCollisionBetween(start, stop);\n// map.setCollisionBetween(start, stop, true, recalculateFaces, layer);\n
      • start , stop : The first/last index of the tile.
    • Enable collision excluded tile indexes
      map.setCollisionByExclusion(indexes);\n// map.setCollisionByExclusion(indexes, true, recalculateFaces, layer);\n
      • index : An array of tile indexes.
    • Enable collision by properties matching
      • Enable collision if value of tile property 'key' is equal to 'value'
        map.setCollisionByProperty({key:value});\n// map.setCollisionByProperty({key:value}, true, recalculateFaces, layer);\n
      • Enable collision if value of tile property 'key' is equal to 'value0', or 'value1'
        map.setCollisionByProperty({key:[value0, value1]});\n// map.setCollisionByProperty({key:[value0, value1]}, true, recalculateFaces, layer);\n
    • Enable collision by collision group
      map.setCollisionFromCollisionGroup();\n// map.setCollisionFromCollisionGroup(true, recalculateFaces, layer);\n
    "},{"location":"tilemap/#disable-collision","title":"Disable collision","text":"
    • Disable collision by tile index
      map.setCollision(index, false);\n// map.setCollision(index, false, recalculateFaces, layer);\n
      • index : Tile index, or an array of tile indexes.
    • Disable collision by tile index in a range
      map.setCollisionBetween(start, stop, false);\n// map.setCollisionBetween(start, stop, false, recalculateFaces, layer);\n
      • start , stop : The first/last index of the tile.
    • Disable collision by properties matching
      • Disable collision if value of tile property 'key' is equal to 'value'
        map.setCollisionByProperty({key:value}, false);\n// map.setCollisionByProperty({key:value}, false, recalculateFaces, layer);\n
      • Disable collision if value of tile property 'key' is equal to 'value0', or 'value1'
        map.setCollisionByProperty({key:[value0, value1]}, false);\n// map.setCollisionByProperty({key:[value0, value1]}, false, recalculateFaces, layer);\n
    • Disable collision by collision group
      map.setCollisionFromCollisionGroup(false);\n// map.setCollisionFromCollisionGroup(false, recalculateFaces, layer);\n
    "},{"location":"tilemap/#get-collision-group","title":"Get collision group","text":"
    var collisionGroup = tile.getCollisionGroup();\n

    or

    var collisionGroup = tileset.getTileCollisionGroup(tile.index); // array of collision shapes, or null\n

    Types of collision shape (collisionGroup.objects[i])

    • object.rectangle :
      {\nrectangle: true,\nx, y,\nwidth, height\n}\n
      • x, y : Offset position related top-left of tile.
        var worldX = tile.getLeft() + object.x;\nvar worldY = tile.getTop() + object.y;\n
      • width, height : Width/height of rectangle area in pixels.
    • object.ellipse :
      {\nellipse: true,\nx, y,\nwidth, height\n}\n
      • x, y : Offset position related top-left of tile.
        var centerX = tile.getLeft() + object.x + (object.width / 2);\nvar centerY = tile.getTop() + object.y + (object.height / 2);\n
      • width, height : Width/height of ellipse area in pixels.
    • object.polygon :
      {\nx, y,\npolygon: [{x,y}, {x,y}, ...]\n}\n
      • Each point :
        {\nx: tile.getLeft() + object.x + polygon[i].x,\ny: tile.getTop() + object.y + polygon[i].y\n}\n
    • object.polyline :
      {\nx, y,\npolyline: [{x,y}, {x,y}, ...]\n}\n
      • Each point :
        {\nx: tile.getLeft() + object.x + polyline[i].x,\ny: tile.getTop() + object.y + polyline[i].y\n}\n
    "},{"location":"tilemap/#arcade-collision","title":"Arcade collision","text":"
    scene.physics.add.collider(arcadeGO, layer);\n

    or, in update stage:

    scene.physics.world.collide(arcadeGO, layer);\n

    See Collision section of Arcade-world.

    "},{"location":"tilemap/#matter-collision","title":"Matter collision","text":"
    • Any colliding tiles will be given a Matter body.
      scene.matter.world.convertTilemapLayer(layer);\n
    "},{"location":"tilemap/#tileset","title":"Tileset","text":""},{"location":"tilemap/#get-tileset","title":"Get tileset","text":"
    var tileset = map.getTileset(name);\n
    "},{"location":"tilemap/#change-texture-of-tileset","title":"Change texture of tileset","text":"
    var texture = scene.sys.textures.get(key);\ntileset.setImage(texture);\n
    "},{"location":"tilesprite/","title":"Tile sprite","text":""},{"location":"tilesprite/#introduction","title":"Introduction","text":"

    Display of repeating texture, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"tilesprite/#usage","title":"Usage","text":""},{"location":"tilesprite/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"tilesprite/#add-tile-sprite-object","title":"Add tile sprite object","text":"
    var image = scene.add.tileSprite(x, y, width, height, textureKey);\n

    Add tile sprite from JSON

    var image = scene.make.tileSprite({\nx: 0,\ny: 0,\nwidth: 512,\nheight: 512,\nkey: '',\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"tilesprite/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTileSprite extends Phaser.GameObjects.TileSprite {\nconstructor(scene, x, y, width, height, texture, frame) {\nsuper(scene, x, y, width, height, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyTileSprite(scene, x, y, key);\n
    "},{"location":"tilesprite/#properties-of-tiles","title":"Properties of tiles","text":"
    • Position
      image.setTilePosition(x, y);\n
      or
      image.tilePositionX = x;\nimage.tilePositionY = y;\n
    • Scale
      image.setTileScale(scaleX, scaleY);\n
      or
      image.tileScaleX = scaleX;\nimage.tileScaleY = scaleY;\n
    "},{"location":"tilesprite/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"tilesprite/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"tilesprite/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"timeline/","title":"Timeline","text":""},{"location":"timeline/#introduction","title":"Introduction","text":"

    Schedule commands to happen at specific times in the future, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"timeline/#usage","title":"Usage","text":""},{"location":"timeline/#create-timeline","title":"Create timeline","text":"
    var timeline = scene.add.timeline([    {\n// Time condition\nat: 0,\nin:\nfrom:\n\n// Enable condition\nif(event) {\n// this: target parameter\nreturn true;  // false\n},\n\nset: {\nkey: value,\n},\n\ntween: {\ntargets: gameObject,\nalpha: 1,\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false\n},\n\nrun(){ // this: target parameter\n},\n\nloop() {\n\n},\n\nsound: '',\n\nevent: '',\n\n// target: this,\n\n// once: false,\n// stop: false,\n},\n\n// ...\n])\n
    • Time :
      • at : Absolute delay time after starting in ms.
      • in : Absolute delay time after current time in ms.
      • from : Relative delay time after previous event in ms
    • Enable :
      • if : A function. Invoking every tick, run actions when it returns true.
    • Actions :
      • set : A key-value object of properties to set on the target.
      • tween : tween config
      • run : A function which will be called when the Event fires.
        function() {\n// this: target parameter\n}\n
      • loop : A function which will be called when the Event sequence repeat again.
        function() {\n// this: target parameter\n}\n
      • sound :
        • A string : A key from the Sound Manager to play
        • A config object for a sound to play when the Event fires.
          {\nkey,\nconfig\n}\n
          • key : The key of the sound to play
          • config : config of playing sound
      • event : String-based event name to emit when the Event fires. The event is emitted from the Timeline instance.
        timeline.on(eventName);\n
      • target : The scope (this object) with which to invoke the run.
    • Control
      • once : If set, the Event will be removed from the Timeline when it fires.
      • stop : If set, the Timeline will stop and enter a complete state when this Event fires, even if there are other events after it.

    The Timeline always starts paused.

    "},{"location":"timeline/#steps-of-commands","title":"Steps of commands","text":"

    For each tick, for each command :

    1. Test time (at, in, from)
    2. Test enable (if)
    3. Run actions (set, tween, run, sound, event)
    4. Control (once, stop)
    "},{"location":"timeline/#start","title":"Start","text":"
    timeline.play();\n
    "},{"location":"timeline/#restart","title":"Restart","text":"
    timeline.play(true);\n
    "},{"location":"timeline/#start-with-repeat","title":"Start with repeat","text":"
    • Repeat infinite
      timeline.repeat().play();\n// timeline.repeat(true).play();\n// timeline.repeat(-1).play();\n
    • Amount of times to repeat
      timeline.repeat(amount).play();\n
      • amount : A positive number
    • No repeat
      timeline.repeat(false);\n
    • Current loop counter
      var loopCounter = timeline.iteration;\n
    "},{"location":"timeline/#stop","title":"Stop","text":"
    timeline.stop();\n
    "},{"location":"timeline/#pause-resume","title":"Pause / Resume","text":"
    timeline.pause();\n// timeline.paused = true;\n
    timeline.resume();\n// timeline.paused = false;\n

    Will also pause/resume currently active Tweens.

    "},{"location":"timeline/#reset","title":"Reset","text":"

    Resets this Timeline back to the start, include loop counter.

    If the Timeline had any events that were set to once that have already been removed, they will not be present again after calling this method.

    timeline.reset();\n

    If the Timeline isn't currently running (i.e. it's paused or complete) then calling this method resets those states, the same as calling Timeline.play(true) (restart).

    "},{"location":"timeline/#add-command","title":"Add command","text":"
    timeline.add(config);\n

    or

    timeline.add([config0, config1, ...]);\n
    "},{"location":"timeline/#clear-all-commands","title":"Clear all commands","text":"
    timeline.clear();\n

    Will also destroy currently active Tweens.

    "},{"location":"timeline/#events","title":"Events","text":"
    • On all commands are completed
      timeline.on('complete', function(){\n\n});\n
    "},{"location":"timeline/#other-properties","title":"Other properties","text":"
    • Timeline is currently playing, not paused or not complete.
      var isPlaying = timeline.isPlaying()\n
    • Is paused
      var isPaused = timeline.paused;\n
    • All commands are complete
      var isCompleted = timeline.complete;\n
    "},{"location":"timeline/#destroy","title":"Destroy","text":"

    Also remove updating.

    timeline.destroy();\n

    Will also destroy currently active Tweens.

    "},{"location":"timer/","title":"Timer","text":""},{"location":"timer/#introduction","title":"Introduction","text":"

    Execute callback when time-out, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"timer/#usage","title":"Usage","text":""},{"location":"timer/#start-timer","title":"Start timer","text":"
    • Looped timer
      var timer = scene.time.addEvent({\ndelay: 500,                // ms\ncallback: callback,\n//args: [],\ncallbackScope: thisArg,\nloop: true\n});\n
    • Repeat timer
      var timer = scene.time.addEvent({\ndelay: 500,                // ms\ncallback: callback,\n//args: [],\ncallbackScope: thisArg,\nrepeat: 4\n});\n
    • Oneshot timer
      var timer = scene.time.delayedCall(delay, callback, args, scope);  // delay in ms\n
    • All properties of timer
      var timer = scene.time.addEvent({\ndelay: 500,                // ms\ncallback: callback,\nargs: [],\ncallbackScope: thisArg,\nloop: false,\nrepeat: 0,\nstartAt: 0,\ntimeScale: 1,\npaused: false\n});\n
    • Reuse timer
      timer.reset({\ndelay: 500,                // ms\ncallback: callback,\nargs: [],\ncallbackScope: thisArg,\nloop: false,\nrepeat: 0,\nstartAt: 0,\ntimeScale: 1,\npaused: false\n})\nscene.time.addEvent(timer);\n

    Note

    Throw error message if delay : 0 with (repeat > 0 or loop: true)

    "},{"location":"timer/#pauseresume","title":"Pause/resume","text":"
    • Pause timer
      timer.paused = true;\n
    • Resume timer
      timer.paused = false;\n
    • Is paused
      var isPaused = timer.paused;\n
    "},{"location":"timer/#stop","title":"Stop","text":"
    • Stop a running timer
      timer.remove();\n
    • Remove from timeline's all internal lists, for timer re-using
      scene.time.removeEvent(timer);\n
    "},{"location":"timer/#time-scale","title":"Time scale","text":"
    • Set
      timer.timeScale = 2;\n
    • Get
      var timeScale = timer.timeScale;\n
    "},{"location":"timer/#other-properties","title":"Other properties","text":"
    • Get elapsed time
      var elapsed = timer.getElapsed();   // ms\nvar elapsed = timer.getElapsedSeconds(); // sec\n// var elapsed = timer.elapsed;  // ms\n
    • Get remaining time
      var remaining = timer.getRemaining();   // ms\nvar remaining = timer.getRemainingSeconds(); // sec\n// var remaining = timer.getOverallRemaining();   // ms\n// var remaining = timer.getOverallRemainingSeconds(); // sec\n
    • Get repeat count
      var repeat = timer.getRepeatCount();\n
    • Gets the progress of the current iteration
      var progress = timer.getProgress();  // elapsed / delay\n
    • Gets the progress of the timer overall, factoring in repeats.
      var progress = timer.getOverallProgress();  // totalElapsed / totalDuration\n
    • Get delay time
      var delay = timer.delay;   // ms\n
    "},{"location":"tintrgb/","title":"TintRGB","text":""},{"location":"tintrgb/#introduction","title":"Introduction","text":"

    Attach tintR, tintG, tintB, and tintGray properties to a game object.

    Note

    This behavior will override default tint property

    • Author: Rex
    • Method only
    "},{"location":"tintrgb/#live-demos","title":"Live demos","text":"
    • Fade
    • Yellow to green
    "},{"location":"tintrgb/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tintrgb/#install-plugin","title":"Install plugin","text":""},{"location":"tintrgb/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextintrgbplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextintrgbplugin.min.js', true);\n
    • Attach tintR, tintG, tintB, and tintGray properties.
      scene.plugins.get('rextintrgbplugin').add(gameObject, tintRGB);\ngameObject.tintGray = 128;\n
    "},{"location":"tintrgb/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TintRGBPlugin from 'phaser3-rex-plugins/plugins/tintrgb-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTintRGB',\nplugin: TintRGBPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Attach tintR, tintG, tintB, and tintGray properties.
      scene.plugins.get('rexTintRGB').add(gameObject, tintRGB);\ngameObject.tintGray = 128;\n
    "},{"location":"tintrgb/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import AddTintRGBProperties from 'phaser3-rex-plugins/plugins/tintrgb.js';\n
    • Attach tintR, tintG, tintB, and tintGray properties.
      AddTintRGBProperties(gameObject, tintRGB);\ngameObject.tintGray = 128;\n
    "},{"location":"tintrgb/#attach-properties","title":"Attach properties","text":"
    scene.plugins.get('rexTintRGB').add(gameObject, tintRGB);\ngameObject.tintGray = 128;\n// gameObject.tintR = 128;\n// gameObject.tintG = 128;\n// gameObject.tintB = 128;\n
    • tintRGB : Initial tintRGB value in 0xRRGGBB.
    • tintR : color R of tint, 0~255. Default is 255.
    • tintG : color G of tint, 0~255. Default is 255.
    • tintB : color B of tint, 0~255. Default is 255.
    • tintGray :\u3000Gray tint, 0~255. Default is 255.
      • Set gameObject.tintGray is equal to set tintR, tintG, tintB with the same value.
    "},{"location":"tintrgb/#fade","title":"Fade","text":"
    scene.tweens.add({\ntargets: gameObject,\ntintR: 0,\ntintG: 0,\ntintB: 0,\n// tintGray: 0,\nduration: 3000\n})\n
    "},{"location":"tools/","title":"Tools","text":""},{"location":"tools/#texture-atlas","title":"Texture atlas","text":""},{"location":"tools/#texture-packer","title":"Texture-packer","text":"

    Texture-packer

    "},{"location":"tools/#free-texture-packer","title":"Free texture packer","text":"

    Free texture packer, Web app

    "},{"location":"tools/#leshy-spritesheet-tool","title":"Leshy SpriteSheet Tool","text":"

    Leshy SpriteSheet Tool

    Export to JSON-TP-Hash

    "},{"location":"tools/#aseprite","title":"Aseprite","text":"

    Aseprite

    1. Go to \"File - Export Sprite Sheet\"
    2. On the Layout tab:
    3. Set the \"Sheet type\" to \"Packed\"
    4. Set the \"Constraints\" to \"None\"
    5. Check the \"Merge Duplicates\" checkbox
    6. On the Sprite tab:
      1. Set \"Layers\" to \"Visible layers\"
      2. Set \"Frames\" to \"All frames\", unless you only wish to export a sub-set of tags
    7. On the Borders tab:
      1. Check the \"Trim Sprite\" and \"Trim Cells\" options
      2. Ensure \"Border Padding\", \"Spacing\" and \"Inner Padding\" are all > 0 (1 is usually enough)
    8. On the Output tab:
      1. Check \"Output File\", give your image a name and make sure you choose \"png files\" as the file type
      2. Check \"JSON Data\" and give your json file a name
      3. The JSON Data type can be either a Hash or Array, Phaser doesn't mind.
      4. Make sure \"Tags\" is checked in the Meta options
      5. In the \"Item Filename\" input box, make sure it says just \"{frame}\" and nothing more.
    9. Click export

    Tested with Aseprite 1.2.25

    "},{"location":"tools/#atlas-packer","title":"Atlas-packer","text":"
    • gammafp/Atlas-packer
    "},{"location":"tools/#animation","title":"Animation","text":"
    • gammafp/Animator
    "},{"location":"tools/#bitmap-font","title":"Bitmap font","text":"
    • SnowB BMF
    • 71squared-glyphdesigner
    • Bitmap Font Generator
    • TTF to PNG
    "},{"location":"touchevents/","title":"Touch events","text":""},{"location":"touchevents/#introduction","title":"Introduction","text":"

    Built-in touch/mouse events of phaser.

    • Author: Richard Davey

    Note

    No touch input event fired in preload stage.

    "},{"location":"touchevents/#usage","title":"Usage","text":""},{"location":"touchevents/#quick-start","title":"Quick start","text":"
    • Is touching
      var pointer = scene.input.activePointer;\nif (pointer.isDown) {\nvar touchX = pointer.x;\nvar touchY = pointer.y;\n// ...\n}\n
    • On any touching start
      scene.input.on('pointerdown', function(pointer){\nvar touchX = pointer.x;\nvar touchY = pointer.y;\n// ...\n}, scope);\n
    • On any touching end
      scene.input.on('pointerup', function(pointer){\nvar touchX = pointer.x;\nvar touchY = pointer.y;\n// ...\n}, scope);\n
    • On touch game object start
      gameObject.setInteractive().on('pointerdown', function(pointer, localX, localY, event){\n// ...\n}, scope);\n
    • On touch game object end
      gameObject.setInteractive().on('pointerup', function(pointer, localX, localY, event){\n// ...\n}, scope);\n
    • Drag game object
      gameObject\n.setInteractive({ draggable: true })\n.on('dragstart', function(pointer, dragX, dragY){\n// ...\n}, scope);\n.on('drag', function(pointer, dragX, dragY){\ngameObject.setPosition(dragX, dragY);\n}, scope);\n.on('dragend', function(pointer, dragX, dragY, dropped){\n// ...\n}, scope);\n

    Reference : Properties of point

    "},{"location":"touchevents/#register-interactive","title":"Register interactive","text":"

    Call gameObject.setInteractive(...) to register touch input of Game Object before listening touching events.

    • Set hit area from width & height (rectangle) of the texture
      gameObject.setInteractive();\n
    • Set hit area from game object
      gameObject.setInteractive(shape, callback);\n
      • Circle
        • shape : new Phaser.Geom.Circle(x, y, radius)
        • callback : Phaser.Geom.Circle.Contains
      • Ellipse
        • shape : new Phaser.Geom.Ellipse(x, y, width, height)
        • callback : Phaser.Geom.Ellipse.Contains
      • Rectangle
        • shape : new Phaser.Geom.Rectangle(x, y, width, height)
        • callback : Phaser.Geom.Rectangle.Contains
      • Triangle
        • shape : new Phaser.Geom.Triangle(x1, y1, x2, y2, x3, y3)
        • callback : Phaser.Geom.Triangle.Contains
      • Polygon
        • shape : new Phaser.Geom.Polygon(points)
        • callback : Phaser.Geom.Polygon.Contains
      • Hexagon
        • shape : new Phaser.Geom.rexHexagon(x, y, size, type)
        • callback : Phaser.Geom.Polygon.Contains
      • Rhombus
        • shape : new Phaser.Geom.rexRhombus(x, y, width, height)
        • callback : Phaser.Geom.Polygon.Contains
      • Note: x, y relate to the top-left of the gameObject.
    • Set hit area from input plugin
      scene.input.setHitArea(gameObjects, shape, callback);\n
      • Circle
        scene.input.setHitAreaCircle(gameObjects, x, y, radius);\n// scene.input.setHitAreaCircle(gameObjects, x, y, radius, callback); // callback = Circle.Contains\n
      • Ellipse
        scene.input.setHitAreaEllipse(gameObjects, x, y, width, height);\n// scene.input.setHitAreaEllipse(gameObjects, x, y, width, height, callback); // callback = Ellipse.Contains\n
      • Rectangle
        scene.input.setHitAreaRectangle(gameObjects, x, y, width, height);\n// scene.input.setHitAreaRectangle(gameObjects, x, y, width, height, callback); // callback = Rectangle.Contains\n
      • Triangle
        scene.input.setHitAreaTriangle(gameObjects, x1, y1, x2, y2, x3, y3);\n// scene.input.setHitAreaTriangle(gameObjects, x1, y1, x2, y2, x3, y3, callback); // callback = Triangle.Contains\n
      • Note: x, y relate to the top-left of the gameObject.
    • Set interactive configuration
      gameObject.setInteractive({\nhitArea: shape,\nhitAreaCallback: callback,\nhitAreaDebug: shape,\ndraggable: false,\ndropZone: false,\nuseHandCursor: false,\ncursor: CSSString,\npixelPerfect: false,\nalphaTolerance: 1\n});\n
      • Hit area
        • shape
        • Pixel alpha
          • pixelPerfect : true
          • alphaTolerance : 1 (0-255)
        • Custom hit-testing function
          • hitAreaCallback
            function(shape, x, y, gameObject) {\nreturn hit;  // true/false\n}\n
            • shape : Hit area object
            • x, y : Local position of texture.
            • gameObject : Game object.
        • hitAreaDebug : Debug shape.
      • Dragging
        • draggable : true
      • Drop zone
        • dropZone : true
      • Cursor
        • cursor : CSS string
        • useHandCursor : true

    Pixel perfect hit-testing

    This is an expensive process, should only be enabled on Game Objects that really need it.

    "},{"location":"touchevents/#disable-interactive","title":"Disable interactive","text":"
    • Disable temporary
      gameObject.disableInteractive();\n// gameObject.disableInteractive(resetCursor);\n
      • resetCursor : Should the currently active Input cursor, if any, be reset to the default cursor?
    • Remove interaction
      gameObject.removeInteractive();\n// gameObject.removeInteractive(resetCursor);\n
      • resetCursor : Should the currently active Input cursor, if any, be reset to the default cursor?
    "},{"location":"touchevents/#top-only","title":"Top only","text":"

    When set to true this Input Plugin will emulate DOM behavior by only emitting events from the top-most Game Objects in the Display List. If set to false it will emit events from all Game Objects below a Pointer, not just the top one.

    • Get
      var topOnly = scene.input.topOnly;\n
    • Set
      scene.input.topOnly = topOnly;\nscene.input.setTopOnly(topOnly);\n

    Each scene can has its own scene.input.topOnly setting.

    "},{"location":"touchevents/#touch-events","title":"Touch events","text":"

    Trigger these events from top scene to bottom scene.

    1. Events on touched Game object
      gameObject.on('pointerdown', function(pointer, localX, localY, event){ /* ... */ }, scope);\ngameObject.on('pointerup', function(pointer, localX, localY, event){ /* ... */ }, scope);\ngameObject.on('pointermove', function(pointer, localX, localY, event){ /* ... */ }, scope);\ngameObject.on('pointerover', function(pointer, localX, localY, event){ /* ... */ }, scope);\ngameObject.on('pointerout', function(pointer, event){ /* ... */ }, scope);\n
      • Cancel remaining touched events
        function(pointer, localX, localY, event) {\nevent.stopPropagation();\n}\n
    2. Event on input plugin for each touched Game object
      scene.input.on('gameobjectdown', function(pointer, gameObject, event){ /* ... */ }, scope);\nscene.input.on('gameobjectup', function(pointer, gameObject, event){ /* ... */ }, scope);\nscene.input.on('gameobjectmove', function(pointer, gameObject, event){ /* ... */ }, scope);\nscene.input.on('gameobjectover', function(pointer, gameObject, event){ /* ... */ }, scope);\nscene.input.on('gameobjectout', function(pointer, gameObject, event){ /* ... */ }, scope);\n
      • Cancel remaining touched events
        function(pointer, gameObject, event) {\nevent.stopPropagation();\n}\n
    3. Events to get all touched Game Objects
      scene.input.on('pointerdown', function(pointer, currentlyOver){ /* ... */ }, scope);\nscene.input.on('pointerdownoutside', function(pointer){ /* ... */ }, scope);\nscene.input.on('pointerup', function(pointer, currentlyOver){ /* ... */ }, scope);\nscene.input.on('pointerupoutside', function(pointer){ /* ... */ }, scope);\nscene.input.on('pointermove', function(pointer, currentlyOver){ /* ... */ }, scope);\nscene.input.on('pointerover', function(pointer, justOver){ /* ... */ }, scope);\nscene.input.on('pointerout', function(pointer, justOut){ /* ... */ }, scope);\nscene.input.on('gameout', function(timeStamp, domEvent){ /* ... */ }, scope);\nscene.input.on('gameover', function(timeStamp, domEvent){ /* ... */ }, scope);\n
      • Check pointer.camera in multiple-cameras scene.
    "},{"location":"touchevents/#game-canvas","title":"Game canvas","text":"
    scene.input.on('gameout', function(timeStamp, event){ /* ... */ }, scope);\nscene.input.on('gameover', function(timeStamp, event){ /* ... */ }, scope);\n
    "},{"location":"touchevents/#dragging","title":"Dragging","text":""},{"location":"touchevents/#enable-dragging","title":"Enable dragging","text":"
    • Enable dragging when registering interactive
      gameObject.setInteractive({ draggable: true });\n
    • Enable dragging and add it to dragging detecting list after registered interactive
      scene.input.setDraggable(gameObject);\n
    • Enable dragging
      gameObject.input.draggable = true;\n
    "},{"location":"touchevents/#disable-dragging","title":"Disable dragging","text":"
    • Remove Game Object from dragging detecting list
      scene.input.setDraggable(gameObject, false);\n
    • Disable dragging but keep it in dragging detecting list
      gameObject.input.draggable = false;\n
    "},{"location":"touchevents/#dragging-events","title":"Dragging events","text":"
    gameObject.on('dragstart', function(pointer, dragX, dragY){ /* ... */ }, scope);\ngameObject.on('drag', function(pointer, dragX, dragY){ /* ... */ }, scope);\ngameObject.on('dragend', function(pointer, dragX, dragY, dropped){ /* ... */ }, scope);\n
    scene.input.on('dragstart', function(pointer, gameObject){ /* ... */ }, scope);\nscene.input.on('drag', function(pointer, gameObject, dragX, dragY){ /* ... */ }, scope);\nscene.input.on('dragend', function(pointer, gameObject, dropped){ /* ... */ }, scope);\n
    • dropped : 'dragend' and also 'drop'.
    "},{"location":"touchevents/#dragging-properties","title":"Dragging properties","text":"
    scene.input.dragDistanceThreshold = 16;\nscene.input.dragTimeThreshold = 500;\n
    "},{"location":"touchevents/#drop-zone","title":"Drop zone","text":""},{"location":"touchevents/#enable-drop-zone","title":"Enable drop zone","text":"
    • Enable dropping when registering interactive
      gameObject.setInteractive({ dropZone: true });\n
    • Enable dropping after registered interactive
      gameObject.input.dropZone = true;\n
    "},{"location":"touchevents/#disable-drop-zone","title":"Disable drop zone","text":"
    gameObject.input.dropZone = false;\n
    "},{"location":"touchevents/#dropping-events","title":"Dropping events","text":"
    gameObject.on('drop', function(pointer, target){ /* ... */ }, scope);\n\ngameObject.on('dragenter', function(pointer, target){ /* ... */ }, scope);\ngameObject.on('dragover', function(pointer, target){ /* ... */ }, scope);\ngameObject.on('dragleave', function(pointer, target){ /* ... */ }, scope);\n
    scene.input.on('drop', function(pointer, gameObject, target){ /* ... */ }, scope);\n\nscene.input.on('dragenter', function(pointer, gameObject, target){ /* ... */ }, scope);\nscene.input.on('dragover', function(pointer, gameObject, target){ /* ... */ }, scope);\nscene.input.on('dragleave', function(pointer, gameObject, target){ /* ... */ }, scope);\n
    "},{"location":"touchevents/#force-state-of-pointer","title":"Force state of pointer","text":"
    • Down state
      scene.input.forceDownState(pointer, gameObject);\n
      • Emit 'pointerdown' event from game object.
      • Emit 'gameobjectdown' event from scene.input.
    • Up state
      scene.input.forceUpState(pointer, gameObject);\n
      • Emit 'pointerup' event from game object.
      • Emit 'gameobjectup' event from scene.input.
    • Over state
      scene.input.forceOverState(pointer, gameObject);\n
      • Emit 'pointerover' event from game object.
      • Emit 'gameobjectover' event from scene.input.
    • Out state
      scene.input.forceOutState(pointer, gameObject);\n
      • Emit 'pointeroutr' event from game object.
      • Emit 'gameobjectout' event from scene.input.
    "},{"location":"touchevents/#first-event-of-all","title":"First event of all","text":"
    scene.input.on('preupdate', function() { /* ... */ }, scope);\n
    "},{"location":"touchevents/#single-touch","title":"Single touch","text":""},{"location":"touchevents/#pointer","title":"Pointer","text":"
    var pointer = scene.input.activePointer;\n
    "},{"location":"touchevents/#multi-touch","title":"Multi-touch","text":""},{"location":"touchevents/#amount-of-active-pointers","title":"Amount of active pointers","text":"

    Set amount of active pointers in game configuration

    var config = {\n// ...\ninput: {\nactivePointers: 1,\n// ...\n}\n};\nvar game = new Phaser.Game(config);\n

    Or add pointers in run-time.

    scene.input.addPointer(num);  // total points = num + 1\n
    "},{"location":"touchevents/#pointers","title":"Pointers","text":"
    • pointer 1 ~ 10
      var pointer = scene.input.pointer1;\n// ...\nvar pointer = scene.input.pointer10;\n
    • pointer n
      var pointer = scene.input.manager.pointers[n];\n
    • Amount of total pointers
      var amount = scene.input.manager.pointersTotal;\n
      • 1 in desktop
      • 2 in touch device. (0 for mouse, 1 for 1 touch pointer)
    "},{"location":"touchevents/#pointer_1","title":"Pointer","text":"
    • Position
      • Current touching
        • Position in screen : pointer.x , pointer.y
        • Position in camera :
          • Single camera :
            var worldX = pointer.worldX;\nvar worldY = pointer.worldY;\n
          • Multiple cameras :
            var worldXY = pointer.positionToCamera(camera);  // worldXY: {x, y}\n// var worldXY = pointer.positionToCamera(camera, worldXY);\nvar worldX = worldXY.x;\nvar worldY = worldXY.y;\n
          • Camera
            var camera = pointer.camera;\n
        • Position of previous moving : pointer.prevPosition.x , pointer.prevPosition.y
          • Updating when pointer-down, potiner-move, or pointer-up.
        • Interpolated position :
          var points = pointer.getInterpolatedPosition(step);\n// var out = pointer.getInterpolatedPosition(step, out);\n
      • Drag
        • Touching start : pointer.downX, pointer.downY
        • Touching end : pointer.upX, pointer.upY
        • Drag distance between pointer-down to latest pointer : pointer.getDistance()
          • Horizontal drag distance : pointer.getDistanceX()
          • Vertical drag distance : pointer.getDistanceY()
        • Drag angle : pointer.getAngle()
    • Time
      • Touching start : pointer.downTime
      • Touching end : pointer.upTime
      • Drag : pointer.getDuration()
    • Touch state
      • Is touching/any button down : pointer.isDown
      • Is primary button down : pointer.primaryDown
    • Button state : pointer.button
      • On Touch devices the value is always 0.
    • Button down
      • No button down : pointer.noButtonDown()
      • Is primary (left) button down : pointer.leftButtonDown()
      • Is secondary (right) button down : pointer.rightButtonDown()
      • Is middle (mouse wheel) button down : pointer.middleButtonDown()
      • Is back button down : pointer.backButtonDown()
      • Is forward button down : pointer.forwardButtonDown()
    • Button released
      • Is primary (left) button released : pointer.leftButtonReleased()
      • Is secondary (right) button released : pointer.rightButtonReleased()
      • Is middle (mouse wheel) button released : pointer.middleButtonReleased()
      • Is back button released : pointer.backButtonReleased()
      • Is forward button released : pointer.forwardButtonReleased()
    • Index in scene.input.manager.pointers : pointer.id
    • Motion
      • Angle: pointer.angle
      • Distance: pointer.distance
      • Velocity: pointer.velocity
        • pointer.velocity.x, `pointer.velocity.y
    "},{"location":"touchevents/#input-object","title":"Input object","text":"
    • gameObject.input : Game object's input object.
    • gameObject.input.localX, gameObject.input.localY : Pointer to local position of texture.
    • gameObject.input.dragStartX, gameObject.input.dragStartY : The x/y coordinate of the Game Object that owns this Interactive Object when the drag started.
    • gameObject.input.dragStartXGlobal, gameObject.input.dragStartYGlobal : The x/y coordinate that the Pointer started dragging this Interactive Object from.
    • gameObject.input.dragX, gameObject.input.dragY : The x/y coordinate that this Interactive Object is currently being dragged to.
    "},{"location":"touchevents/#smooth","title":"Smooth","text":"

    Get touch position from interpolation of previous touch position and current touch position.

    Touch-position = (current-touch-position * smooth-factor) + (previous-touch-position * (1 - smooth-factor))\n
    1. Set smooth factor. In game configuration
      var config = {\n// ....\ninput: {\nsmoothFactor: 0\n}\n}\n
    2. Get touch position
      var x = pointer.x;\nvar y = pointer.y;\nvar worldX = pointer.worldX;\nvar worldY = pointer.worldY;\n
    "},{"location":"touchevents/#debug","title":"Debug","text":"
    • Enable, draw shape of (shape) hit area.
      scene.input.enableDebug(gameObject);\n// scene.input.enableDebug(gameObject, color);\n
    • Disable
      scene.input.removeDebug(gameObject);\n
    • Get debug shape game object
      var shape = gameObject.input.hitAreaDebug;\n
    "},{"location":"touchevents/#poll-rate","title":"Poll rate","text":"
    • Poll when touches moved, or updated. Default behavior.
      scene.input.setPollOnMove();\n
    • Poll every tick.
      scene.input.setPollAlways();\n
    • Set poll rate.
      scene.input.setPollRate(rate);\n
    "},{"location":"toucheventstop/","title":"Touch event stop","text":""},{"location":"toucheventstop/#introduction","title":"Introduction","text":"

    Stop touch events propagation.

    • Author: Rex
    • Behavior of game object
    "},{"location":"toucheventstop/#live-demos","title":"Live demos","text":"
    • Stop touch events
    "},{"location":"toucheventstop/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"toucheventstop/#install-plugin","title":"Install plugin","text":""},{"location":"toucheventstop/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextoucheventstopplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextoucheventstopplugin.min.js', true);\n
    • Add touch-event-stop behavior
      var touchEventStop = scene.plugins.get('rextoucheventstopplugin').add(gameObject, config);\n
    "},{"location":"toucheventstop/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TouchEventStopPlugin from 'phaser3-rex-plugins/plugins/toucheventstop-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTouchEventStop',\nplugin: TouchEventStopPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add touch-event-stop behavior
      var touchEventStop = scene.plugins.get('rexTouchEventStop').add(gameObject, config);\n
    "},{"location":"toucheventstop/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import TouchEventStop from 'phaser3-rex-plugins/plugins/toucheventstop.js';\n
    • Add touch-event-stop behavior
      var touchEventStop = newe TouchEventStop(gameObject, config);\n
    "},{"location":"toucheventstop/#create-instance","title":"Create instance","text":"
    var touchEventStop = scene.plugins.get('rexTouchEventStop').add(gameObject, {\n// hitAreaMode: 0,    // 0|1|'default'|'fullWindow'\n// enable: true\n});\n
    • hitAreaMode : Mode of hit-area
      • 0, or 'default' : Set hit-area to size of game object, only touch events on this game object will be stopped..
      • 1, or 'fullWindow' : Set hit-area to whole window, all touch events will be stopped.
    • enable : Set false to disable touch-event-stop behavior.
    "},{"location":"toucheventstop/#enable","title":"Enable","text":"
    • Get
      var enable = touchEventStop.enable;  // enable: true, or false\n
    • Set
      touchEventStop.setEnable(enable);  // enable: true, or false\n// touchEventStop.enable = enable;\n
    • Toggle
      touchEventStop.toggleEnable();\n
    "},{"location":"touchstate/","title":"Touch state","text":""},{"location":"touchstate/#introduction","title":"Introduction","text":"

    Store current touch input properties.

    • Author: Rex
    • Behavior of game object
    "},{"location":"touchstate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"touchstate/#install-plugin","title":"Install plugin","text":""},{"location":"touchstate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextouchstateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextouchstateplugin.min.js', true);\n
    • Add touch-state behavior
      var touchState = scene.plugins.get('rextouchstateplugin').add(gameObject, config);\n
    "},{"location":"touchstate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TouchStatePlugin from 'phaser3-rex-plugins/plugins/touchstate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTouchState',\nplugin: TouchStatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add touch-state behavior
      var touchState = scene.plugins.get('rexTouchState').add(gameObject, config);\n
    "},{"location":"touchstate/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TouchState from 'phaser3-rex-plugins/plugins/touchstate.js';\n
    • Add touch-state behavior
      var touchState = new TouchState(gameObject, config);\n
    "},{"location":"touchstate/#create-instance","title":"Create instance","text":"
    var touchState = scene.plugins.get('rexTouchState').add(gameObject, {\n// enable: true,\n});\n
    • enable : Can touch.
    "},{"location":"touchstate/#properties","title":"Properties","text":"
    • Is pointer down, is pointer up
      var isDown = touchState.isDown;\nvar isUp = touchState.isUp;\n
    • Is in touching
      var isInTouching = touchState.isInTouching;\n
    • Pointer in local position
      var localX = touchState.localX;\nvar localY = touchState.localY;\n
    • Drag speed
      var speed = touchState.speed;\nvar speedX =  touchState.speedX;\nvar speedY =  touchState.speedY;\n
      var dx = touchState.dx;\nvar dy = touchState.dy;\nvar dt = touchState.dt;    
    "},{"location":"touchstate/#events","title":"Events","text":"
    • Touch start (pointer down)
      touchState.on('touchstart', function (touchState, gameObject, pointer, localX, localY, event) {\n// ...\n}, scope);\n
    • Touch end (pointer up)
      touchState.on('touchend', function (touchState, gameObject, pointer) {\n// ...\n}, scope);\n
    • Touch move (pointer move)
      touchState.on('touchmove', function (touchState, gameObject, pointer, localX, localY, event) {\n// ...\n}, scope);\n
    "},{"location":"touchstate/#enable","title":"Enable","text":"
    • Get
      var enabled = touchState.enable;  // enabled: true, or false\n
    • Set
      touchState.setEnable(enabled);  // enabled: true, or false\n// touchState.enable = enabled;\n
    • Toggle
      touchState.toggleEnable();\n
    "},{"location":"transitionimage/","title":"Transition image","text":""},{"location":"transitionimage/#introduction","title":"Introduction","text":"

    Transit texture to another one. A containerLite game object with 2 image game objects.

    • Author: Rex
    • Game object
    "},{"location":"transitionimage/#live-demos","title":"Live demos","text":"
    • Ease property of current/next image
      • Cross-fade
      • Scale
      • Slide
    • Apply shader effect to current/next image, then ease property this shader effect.
      • Split
      • Dissolve
    • Grid cut current/next image to cell images, then ease property of cell images
      • Grid cut
      • 3 columns
    • Morph custom mask game object
      • Pie mask
    • Transition modes
    "},{"location":"transitionimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"transitionimage/#install-plugin","title":"Install plugin","text":""},{"location":"transitionimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextransitionimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextransitionimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexTransitionImage(x, y, texture, frame, config);\n
    "},{"location":"transitionimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TransitionImagePlugin from 'phaser3-rex-plugins/plugins/transitionimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTransitionImagePlugin',\nplugin: TransitionImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexTransitionImage(x, y, texture, frame, config);\n
    "},{"location":"transitionimage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TransitionImage from 'phaser3-rex-plugins/plugins/transitionimage.js';\n
    • Add image object
      var image = new TransitionImage(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"transitionimage/#create-instance","title":"Create instance","text":"

    var image = scene.add.rexTransitionImage(x, y, texture, frame, {\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,    \n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n\n// width: undefined, height: undefined,\n});\n
    or

    var image = scene.add.rexTransitionImage(x, y, texture, frame, {\n// x: 0,\n// y: 0,\n// key: \n// frame: \n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,    \n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n\n// width: undefined, height: undefined,\n});\n
    • dir : Transition direction.
      • 0, or 'out' : Transit current texture/image out.
      • 1, or 'in' : Transit next texture/image in.
    • onStart, onStartScope : Callback and scope of transition-start. See Set transition callbacks
    • onProgress, onProgressScope : Callback and scope of transition-progress. See Set transition callbacks
    • onComplete, onCompleteScope : Callback and scope of transition-complete. See Set transition callbacks
    • duration : Duration of transition.
    • ease : Ease function of transition-progress.
    • mask : Mask game object.
      • true : Default graphics game object.
      • Any shape game object, or custom shape, custom progress game object.
    • width, height : Scale images to fit this size (widthxheight).
      • undefined : Don't scale images.

    If onStart, onProgress and onComplete are all undefined, it will use cross-fade as default transition callbacks.

    Add transitionimage from JSON

    var image = scene.make.rexTransitionImage({\nx: 0,\ny: 0,\nkey: null,\nframe: null,\n\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,\n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n\n// width: undefined, height: undefined,\n\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"transitionimage/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTransitionImage extends TransitionImage {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var transitionimage = new MyTransitionImage(scene, x, y, texture, frame, config);\n
    "},{"location":"transitionimage/#transit","title":"Transit","text":"
    image\n// .setTransitionDirection(dir)\n// .setTransitionStartCallback(onStart, onStartScope)\n// .setTransitionProgressCallback(onProgress, onProgressScope)\n// .setTransitionCompleteCallback(onComplete, onCompleteScope)\n// .setDuration(duration)\n// .setEaseFunction(ease)\n// .setMaskEnable(enable)\n.transit(texture, frame)\n

    or

    image.transit({\nkey: undefined,\n// frame: undefined,\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,\n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n})\n
    • mask : Mask game object.
      • true : Default graphics game object. Also apply this mask to current and next textures/images
      • Any shape game object, or custom shape, custom progress game object.
        • Apply mask to current texture :
          image.setCurrentImageMaskEnable();\n// image.setCurrentImageMaskEnable(enable, invertAlpha);\n
        • Apply mask to next texture :
          image.setNextImageMaskEnable();\n// image.setNextImageMaskEnable(enable, invertAlpha);\n
        • Apply mask to both current and next trextures :
          image.setMaskEnable();\n// image.setMaskEnable(enable, invertAlpha);\n

    Fire 'complete' event when transition completed.

    "},{"location":"transitionimage/#register-transtion-mode","title":"Register transtion mode","text":"
    • Register transtion mode
      image.addTransitionMode(modeName, {\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,\n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n});\n
    • Trnasit by transition mode
      image.transit(texture, frame, modeName);\n// image.transit(texture, frame, modeNames);\n
      or
      image.transit({\nkey: undefined,\n// frame: undefined,\n\nmode: modeName, // or modeName\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,\n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n})\n
      • Can override configuration of transition mode
      • modeName : A string, or an array of string to pick a random mode.
    • Current transition mode
      var modeName = image.currentTransitionMode;\n
    "},{"location":"transitionimage/#current-texture","title":"Current texture","text":"
    var textureKey = image.texture.key;\nvar frameName = image.frame.name;\n
    "},{"location":"transitionimage/#transition-callbacks","title":"Transition callbacks","text":"
    • Set transition direction
      image.setTransitionDirection(dir);\n
      • 0, or 'out' : Transit current texture out.
      • 1, or 'in' : Transit next texture in.
    • Set transition-start callback
      image.setTransitionStartCallback(onStart, onStartScope)\n
      • onStart
        function(parent, currentImage, nextImage, t) { }\n
        • parent : Transition image game object, extends from ContainerLite
        • currentImage : Image game object to display current texture.
        • nextImage : Image game object to display next texture.
        • t : Progress percentage. It is 0 in this case.
    • Set transition-progress callback
      image.setTransitionProgressCallback(onProgress, onProgressScope)\n
      • onProgress
        function(parent, currentImage, nextImage, t) { // parent.setChildLocalAlpha(currentImage, 1 - t);\n// parent.setChildLocalScale(currentImage, 1 - t);\n// parent.setChildLocalPosition(currentImage, x, 0);\n}\n
        • parent : Transition image game object, extends from ContainerLite
        • currentImage : Image game object to display current texture.
          • Set alpha of currentImage, or nextImage by parent.setChildLocalAlpha(currentImage, alpha).
          • Set scale of currentImage, or nextImage by parent.setChildLocalScale(currentImage, scale).
          • Set position of currentImage, or nextImage by parent.setChildLocalScale(currentImage, x, y).
        • nextImage : Image game object to display next texture.
        • t : Progress percentage. 0~1.
    • Set transition-complete callback
      image.setTransitionCompleteCallback(onComplete, onCompleteScope)\n
      • onComplete
        function(parent, currentImage, nextImage, t) { }\n
        • parent : Transition image game object, extends from ContainerLite
        • currentImage : Image game object to display current texture.
        • nextImage : Image game object to display next texture.
        • t : Progress percentage. It is 1 in this case.
    "},{"location":"transitionimage/#transition-duration","title":"Transition duration","text":"
    • Set
      image.setDuration(duration);\n
    • Get
      var duration = image.duration;\n
    "},{"location":"transitionimage/#ease-function","title":"Ease function","text":"
    • Set
      image.setEaseFunction(ease);\n
      • ease : Ease function of transition-progress.
    • Get
      var ease = image.easeFunction;\n
    "},{"location":"transitionimage/#mask","title":"Mask","text":"
    • Apply mask to current texture :
      image.setCurrentImageMaskEnable();\n// image.setCurrentImageMaskEnable(enable, invertAlpha);\n
    • Apply mask to next texture :
      image.setNextImageMaskEnable();\n// image.setNextImageMaskEnable(enable, invertAlpha);\n
    • Apply mask to both current and next trextures :
      image.setMaskEnable();\n// image.setMaskEnable(enable, invertAlpha);\n
    • Assign default mask game object
      image.setMaskGameObject(true);\n
    • Assign custom mask game object
      image.setMaskGameObject(maskGameObject);\n
      • maskGameObject : A graphics game object, or any shape game objects, custom-progress shape game object
    "},{"location":"transitionimage/#grid-cut","title":"Grid cut","text":"

    Grid cut texture to cells.

    • Grid cut current texture :
      var cellImageGameObjects = image.gridCutCurrentImage(columns, rows);\n
      • cellImageGameObjects : Array of cell game objects.
    • Grid cut next texture :
      var cellImageGameObjects = image.gridCutNextImage(columns, rows);\n
      • cellImageGameObjects : Array of cell game objects.
    • Get cut cell image game objects, after cutting.
      var cellImageGameObjects = image.getCellImages();\n
    • Apply mask to cell images
      image.setCellImagesMaskEnable();\n// image.setCellImagesMaskEnable(enable, invertAlpha);\n

    Cut cell image game objects will be set to invisible after transition complete.

    "},{"location":"transitionimage/#pauseresume","title":"Pause/Resume","text":"
    image.pause();\n
    image.resume();\n
    "},{"location":"transitionimage/#stop","title":"Stop","text":"
    image.stop();\n

    Also will fire 'complete' event.

    "},{"location":"transitionimage/#events","title":"Events","text":"
    • On complete
      image.on('complete', function(){\n})\n
    "},{"location":"transitionimage/#flip","title":"Flip","text":"

    Apply flipX, flipY to both current and next trextures.

    • Flip
      image.flipX(value);\nimage.flipY(value);\nimage.flip(x, y);\n
    • Toggle
      image.toggleFlipX();\nimage.toggleFlipY();\n
    "},{"location":"transitionimage/#tint","title":"Tint","text":"

    Apply tint to both current and next trextures.

    image.setTint(value);\n
    "},{"location":"transitionimage/#use-cases","title":"Use cases","text":"
    • Ease property of current/next image.
      • Scale
      • Slide, apply mask to current/next image.
    • Apply shader effect to current/next image, then ease property this shader effect.
      • Dissolve
      • Split
    • Grid cut current/next image to cell images, then ease property of cell images
      • Grid cut
      • Three-columns, apply mask to cell images.
    • Morph custom mask game object
      • Pie-mask, mask current/next image by a custom-progress game object.
    "},{"location":"transitionimage/#internal-image-game-object","title":"Internal image game object","text":"
    • Current, next image game object
      var curentImageGO = image.currentImage;\nvar nextImageGO = image.nextImage;\n
    • Front, back image game object
      var frontImageGO = image.frontImage;\nvar backImageGO = image.backImage;\n
    "},{"location":"transitionimage/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"transitionimage/#shader-effects","title":"Shader effects","text":"

    Internal image game objects (image.currentImage, image.nextImage) support preFX and postFX effects

    "},{"location":"transitionimagepack/","title":"Transition image pack","text":""},{"location":"transitionimagepack/#introduction","title":"Introduction","text":"

    Transit texture to another one, with some pre-build effects, extended from TransitionImage

    • Author: Rex
    • Game object
    "},{"location":"transitionimagepack/#live-demos","title":"Live demos","text":"
    • Effect list
    • Slide modes
    • Fade modes
    • Mask modes
    • Shader effect modes
    "},{"location":"transitionimagepack/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"transitionimagepack/#install-plugin","title":"Install plugin","text":""},{"location":"transitionimagepack/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextransitionimagepackplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextransitionimagepackplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexTransitionImagePack(x, y, texture, frame, config);\n
    "},{"location":"transitionimagepack/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TransitionImagePackPlugin from 'phaser3-rex-plugins/templates/transitionimagepack/transitionimagepack-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTransitionImagePackPlugin',\nplugin: TransitionImagePackPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexTransitionImagePack(x, y, texture, frame, config);\n
    "},{"location":"transitionimagepack/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TransitionImagePack from 'phaser3-rex-plugins/templates/transitionimagepack/TransitionImagePack.js';\n
    • Add image object
      var image = new TransitionImagePack(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"transitionimagepack/#create-instance","title":"Create instance","text":"

    var image = scene.add.rexTransitionImagePack(x, y, texture, frame, {   // duration: 1000,\n// width: undefined, height: undefined,\n});\n
    or

    var image = scene.add.rexTransitionImagePack(x, y, texture, frame, {\n// x: 0,\n// y: 0,\n// key: \n// frame: \n// duration: 1000,\n// width: undefined, height: undefined,\n});\n
    • duration : Duration of transition.
    • width, height : Scale images to fit this size (widthxheight).
      • undefined : Don't scale images.

    Add transitionimage from JSON

    var image = scene.make.rexTransitionImagePack({\nx: 0,\ny: 0,\nkey: null,\nframe: null,\n\n// duration: 1000,\n// width: undefined, height: undefined,\n\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"transitionimagepack/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTransitionImagePack extends TransitionImagePack {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var transitionimage = new MyTransitionImagePack(scene, x, y, texture, frame, config);\n
    "},{"location":"transitionimagepack/#transit","title":"Transit","text":"
    image\n// .setDuration(duration)\n// .setEaseFunction(ease)\n.transit(texture, frame, modeName)\n

    or

    image.transit({\nkey: undefined,\n// frame: undefined,\n// duration: 1000,\n// ease: 'Linear',\nmode: modeName\n})\n
    • duration : Override default duration setting.
    • ease : Override default ease setting.
    • mode : Pre-build effects
      • Fade effects :
        • 'fade' : Tint old image to black, then tint new image from black to origin color.
        • 'crossFade' : Ease alpha of old image from 1 to 0, and ease alpha of new image from 0 to 1 at the same time.
      • Slide effects : 'slideLeft', 'slideRight', 'slideUp', 'slideDown', 'slideAwayLeft', 'slideAwayRight', 'slideAwayUp', 'slideAwayDown', 'pushLeft', 'pushRight', 'pushUp', 'pushDown'.
      • Zoom(scale) effects : 'zoomOut', 'zoomIn', 'zoomInOut'.
      • Mask effects : 'wipeLeft', 'wipeRight', 'wipeUp', 'wipeDown', 'irisOut', 'irisIn', 'irisInOut', 'pieOut', 'pieIn', 'pieInOut', 'blinds', 'squares', 'diamonds', 'circles', 'curtain'.
      • Shader effects : 'pixellate', 'dissolve', 'revealLeft', 'revealRight', 'revealUp', 'revealDown'
    "},{"location":"transitionimagepack/#current-texture","title":"Current texture","text":"
    var textureKey = image.texture.key;\nvar frameName = image.frame.name;\n
    "},{"location":"transitionimagepack/#transition-duration","title":"Transition duration","text":"
    • Set
      image.setDuration(duration);\n
    • Get
      var duration = image.duration;\n
    "},{"location":"transitionimagepack/#ease-function","title":"Ease function","text":"
    • Set
      image.setEaseFunction(ease);\n
      • ease : Ease function of transition-progress.
    • Get
      var ease = image.easeFunction;\n
    "},{"location":"transitionimagepack/#pauseresume","title":"Pause/Resume","text":"
    image.pause();\n
    image.resume();\n
    "},{"location":"transitionimagepack/#stop","title":"Stop","text":"
    image.stop();\n

    Also will fire 'complete' event.

    "},{"location":"transitionimagepack/#events","title":"Events","text":"
    • On complete
      image.on('complete', function(){\n})\n
    "},{"location":"transitionimagepack/#flip","title":"Flip","text":"
    • Flip
      image.flipX(value);\nimage.flipY(value);\nimage.flip(x, y);\n
    • Toggle
      image.toggleFlipX();\nimage.toggleFlipY();\n
    "},{"location":"transitionimagepack/#other-properties","title":"Other properties","text":"

    See transition image object, game object

    "},{"location":"tween/","title":"Tween","text":""},{"location":"tween/#introduction","title":"Introduction","text":"

    Change properties by tween equations, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"tween/#usage","title":"Usage","text":""},{"location":"tween/#create-tween-task","title":"Create tween task","text":"
    var tween = scene.tweens.add({\ntargets: gameObject,\nx: 1,\n// x: '+=1',\n// x: '-=1',\n// x: '*=1',\n// x: '/=1',\n// x: 'random(0.25, 0.75)',\n// x: 'int(10, 100)',\n// x: [100, 300, 200, 600],\n// x: { from: 0, to: 1 },\n// x: { start: 0, to: 1 },  \n// x: { start: value0, from: value1, to: value2 },  \n// x: {\n//      getActive: function (target, key, value, targetIndex, totalTargets, tween) { return newValue; },\n//      getStart: function (target, key, value, targetIndex, totalTargets, tween) { return newValue; },\n//      getEnd: function (target, key, value, targetIndex, totalTargets, tween) { return newValue; }\n// },\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false,\n\n// interpolation: null,\n});\n
    • key: value2 : Tween to value2.
    • key: '+=deltaValue' : Tween to current value + deltaValue
      • Support these expressions : key: '+=deltaValue', key: '-=deltaValue', key: '*=deltaValue', key: '/=deltaValue'
    • key: 'random(10, 100)' : Tween to a random float value.
    • key: 'int(10, 100)' : Tween to a random int value.
    • key: [100, 300, 200, 600] : Use interpolation to determine the value.
    • key: { from: value1, to: value2 } : Set the property to value11 when tween started after delay, then tween to value2.
    • value1, value2 : A number, string, or callback(function(target, key, value, targetIndex, totalTargets, tween) { return newValue; })
    • key: { start: value0, to: value2 } : Set the property to value0 immediately, then tween to value2.
      • value1, value2 : A number, string, or callback(function(target, key, value, targetIndex, totalTargets, tween) { return newValue; })
    • key: { start: value0, from: value1, to: value2 } : Set the property to value0 immediately, then set to value1 when tween started after delay, then tween to value2.
      • value0, value1, value2 : A number, string, or callback(function(target, key, value, targetIndex, totalTargets, tween) { return newValue; })
    • key: function(target, key, value, targetIndex, totalTargets, tween) { return newValue; }
      • target :\u3000The tween target.
      • key : The target property.
      • value : The current value of the target property.
      • targetIndex : The index of the target within the Tween.
      • totalTargets : The total number of targets in this Tween.
      • tween : The Tween that invoked this callback.
    • key: { getActive:callback, getStart:callback, getEnd:callback}
      • callback : function(target, key, value, targetIndex, totalTargets, tween) { return newValue; }

    or

    var tween = scene.tweens.add({\ntargets: gameObject,\npaused: false,\ncallbackScope: tween,\n\n// timming/callback of each state\nonStart: function () {},\nonStartParams: [],\n\n// initial delay\ndelay: 0,  // function(target, targetKey, value, targetIndex, totalTargets, tween) { },\n\n// tween duration\nduration: 1000,\nease: 'Linear',\neaseParams: null,\n\nonActive: function () {},\nonUpdate: function (tween, target, key, current, previous, param) {},\nonUpdateParams: [],\n\n// delay between tween and yoyo\nhold: 0,\nyoyo: false,  // true to tween backward\nflipX: false,\nflipY: false,\nonYoyo: function (tween, target, key, current, previous, param) {},\nonYoyoParams: [],\n\n// repeat count (-1: infinite)\nrepeat: 0,\nonRepeat: function (tween, target, key, current, previous, param) {},\nonRepeatParams: [],\n// delay to next pass\nrepeatDelay: 0,\n\n// loop count (-1: infinite)\nloop: 0,\nonLoop: function () {},\nonLoopParams: [],\n// delay to next loop\nloopDelay: 0,\n\n// delay to onComplete callback\ncompleteDelay: 0,\nonComplete: function () {},\nonCompleteParams: [],\n// timming/callback of each state\n\nonStop: function () {}, onPause: function () {}, onResume: function () {}, // properties:\nx: '+=600',        // start from current value\ny: 500,\nrotation: ...\nangle: ...\nalpha: ...\n// ...\n\n// or\nprops: {\nx: { value: '+=600', duration: 3000, ease: 'Power2' },\ny: { value: '500', duration: 1500, ease: 'Bounce.easeOut' }\n},\n\n// or\nprops: {\nx: {\nduration: 400,\nyoyo: true,\nrepeat: 8,\nease: 'Sine.easeInOut',\nvalue: {\ngetActive: function (target, key, value, targetIndex, totalTargets, tween)\n{\nreturn value;\n},\ngetStart: function (target, key, value, targetIndex, totalTargets, tween)\n{\nreturn value + 30;\n},\ngetEnd: function (target, key, value, targetIndex, totalTargets, tween)\n{\ndestX -= 30;\nreturn destX;\n}\n}\n},\n....\n},\n\npersist: false,\n\ninterpolation: null,\ninterpolationData: null,\n\n});\n
    • targets : The targets the tween is updating.
    • delay : The time the tween will wait before it first starts
      • A number, for all targets
      • A callback function, built via stagger builder :
        • From 0 to endValue :
          • scene.tweens.stagger(endValue)
        • From startValue to endValue :
          • scene.tweens.stagger([startValue, endValue])
        • From 0 to endValue, with specific ease function :
          • scene.tweens.stagger(endValue, {ease: 'cubic.inout'})
        • From startValue to endValue, with specific ease function :
          • scene.tweens.stagger([startValue, endValue], {ease: 'cubic.inout'})
        • From 0 to endValue, with specific start index :
          • scene.tweens.stagger(endValue, {from: 'last'})
          • scene.tweens.stagger(endValue, {from: 'center'})
          • scene.tweens.stagger(endValue, {from: index})
        • From startValue to endValue, , with specific start index :
          • scene.tweens.stagger([startValue, endValue], {from: 'last'})
          • scene.tweens.stagger([startValue, endValue], {from: 'center'})
          • scene.tweens.stagger([startValue, endValue], {from: index})
        • From 0 to endValue, with specific ease function, with specific start index :
          • scene.tweens.stagger(endValue, {from: 'last', ease: 'cubic.inout'})
        • From startValue to endValue, with specific ease function , with specific start index :
          • scene.tweens.stagger([startValue, endValue], {from: 'last', ease: 'cubic.inout'})
        • Grid mode. From 0 to endValue.
          • scene.tweens.stagger(endValue, {grid: [gridWidth, gridHeight], })
          • scene.tweens.stagger(endValue, {grid: [gridWidth, gridHeight], from: 'center'})
          • scene.tweens.stagger(endValue, {grid: [gridWidth, gridHeight], from: 'center', ease: 'cubic.inout'})
        • Grid mode. From startValue to endValue.
          • scene.tweens.stagger([startValue, endValue], {grid: [gridWidth, gridHeight], })
          • scene.tweens.stagger([startValue, endValue], {grid: [gridWidth, gridHeight], from: 'center'})
          • scene.tweens.stagger([startValue, endValue], {grid: [gridWidth, gridHeight], from: 'center', ease: 'cubic.inout'})
    • duration : The duration of the tween
    • ease : The ease function used by the tween
    • easeParams : The parameters to go with the ease function (if any)
    • hold : The time the tween will pause before running a yoyo
    • repeat : The number of times the tween will repeat itself (a value of 1 means the tween will play twice, as it repeated once)
    • repeatDelay : The time the tween will pause for before starting a repeat. The tween holds in the start state.
    • yoyo : boolean - Does the tween reverse itself (yoyo) when it reaches the end?
    • flipX : flip X the GameObject on tween end
    • flipY : flip Y the GameObject on tween end
    • completeDelay : The time the tween will wait before the onComplete event is dispatched once it has completed
    • loop : -1 for an infinite loop
    • loopDelay
    • paused : Does the tween start in a paused state, or playing?
    • props : The properties being tweened by the tween
    • onActive : Tween becomes active within the Tween Manager.
      function(tween, target) { }\n
    • onStart : A tween starts.
      function(tween, targets) { }\n
    • onUpdate : Callback which fired when tween task updated
      function(tween, target, key, current, previous, param) { }\n
    • onComplete : Tween completes or is stopped.
      function(tween, targets) { }\n
    • onYoyo : A function to call each time the tween yoyos. Called once per property per target.
      function(tween, target, key, current, previous, param) { }\n
    • onLoop : A function to call each time the tween loops.
      function(tween, targets) { }\n
    • onRepeat : A function to call each time the tween repeats. Called once per property per target.
      function(tween, target, key, current, previous, param) { }\n
    • onStop : A function to call when the tween is stopped.
      function(tween, targets) { }\n
    • onPause : A function to call when the tween is paused.
      function(tween, targets) { }\n
    • onResume : A function to call when the tween is resumed after being paused.
      function(tween, targets) { }\n
    • persist : Will the Tween be automatically destroyed on completion, or retained for future playback?
    • interpolation : The interpolation function to use if the value given is an array of numbers.
      • 'linear', 'bezier', 'catmull' (or 'catmullrom')

    Note

    Tween task will not manipulate any property that begins with an underscore.

    "},{"location":"tween/#ease-equations","title":"Ease equations","text":"
    • Power0 : Linear
    • Power1 : Quadratic.Out
    • Power2 : Cubic.Out
    • Power3 : Quartic.Out
    • Power4 : Quintic.Out
    • Linear
    • Quad : Quadratic.Out
    • Cubic : Cubic.Out
    • Quart : Quartic.Out
    • Quint : Quintic.Out
    • Sine : Sine.Out
    • Expo : Expo.Out
    • Circ : Circular.Out
    • Elastic : Elastic.Out
    • Back : Back.Out
    • Bounce : Bounce.Out
    • Stepped
    • Quad.easeIn
    • Cubic.easeIn
    • Quart.easeIn
    • Quint.easeIn
    • Sine.easeIn
    • Expo.easeIn
    • Circ.easeIn
    • Back.easeIn
    • Bounce.easeIn
    • Quad.easeOut
    • Cubic.easeOut
    • Quart.easeOut
    • Quint.easeOut
    • Sine.easeOut
    • Expo.easeOut
    • Circ.easeOut
    • Back.easeOut
    • Bounce.easeOut
    • Quad.easeInOut
    • Cubic.easeInOut
    • Quart.easeInOut
    • Quint.easeInOut
    • Sine.easeInOut
    • Expo.easeInOut
    • Circ.easeInOut
    • Back.easeInOut
    • Bounce.easeInOut

    Demo

    "},{"location":"tween/#pause-resume-task","title":"Pause / Resume task","text":"
    tween.pause();\n
    tween.resume();\n
    "},{"location":"tween/#stop-task","title":"Stop task","text":"
    tween.complete();\n
    tween.stop();\n

    Won't invoke onComplete callback ('complete' event)

    "},{"location":"tween/#play-task","title":"Play task","text":"
    tween.play();\n
    "},{"location":"tween/#restart-task","title":"Restart task","text":"
    tween.restart();\n
    "},{"location":"tween/#seek","title":"Seek","text":"
    tween.seek(amount);\n// tween.seek(amount, delta, emit);\n
    • amount : The number of milliseconds to seek into the Tween from the beginning.
    • delta : The size of each step when seeking through the Tween. Default value is 16.6 (1000/60)
    • emit : While seeking, should the Tween emit any of its events or callbacks? The default is false.
    "},{"location":"tween/#remove-task","title":"Remove task","text":"

    Removes this Tween from the TweenManager

    tween.remove();\n
    "},{"location":"tween/#destroy-task","title":"Destroy task","text":"

    Free tween task from memory

    tween.destroy();\n

    Note

    A Tween that has been destroyed cannot ever be played or used again.

    "},{"location":"tween/#get-tweens","title":"Get tweens","text":"
    • Tweens of a target
      var tweens = scene.tweens.getTweensOf(target);\n// var tweens = scene.tweens.getTweensOf(target, includePending);\n
      • tweens : Array of tweens, or timelines.
      • includePending : Set true to search pending tweens.
    • All tweens
      var tweens = scene.tweens.getTweens();\n
    "},{"location":"tween/#destroy-task-of-a-target","title":"Destroy task of a target","text":"
    scene.tweens.killTweensOf(target);\n
    • target : The target to kill the tweens of. Provide an array to use multiple targets.
    "},{"location":"tween/#time-scale","title":"Time-scale","text":"
    tween.setTimeScale(v);\n// tween.timeScale = timescale;\n
    var timeScale = tween.getTimeScale();\n// var timeScale = tween.timeScale;\n
    "},{"location":"tween/#global-time-scale","title":"Global time-scale","text":"
    var timeScale = scene.tweens.timeScale;\n
    scene.tweens.timeScale = timescale;\n
    "},{"location":"tween/#events","title":"Events","text":"
    • Tween becomes active within the Tween Manager.
      tween.on('active', function(tween, targets){\n\n}, scope);\n
    • Tween completes or is stopped.
      tween.on('complete', function(tween, targets){\n\n}, scope);\n
    • A tween loops, after any loop delay expires.
      tween.on('loop', function(tween, targets){\n\n}, scope);\n
    • A tween property repeats, after any repeat delay expires.
      tween.on('repeat', function(tween, key, target){\n\n}, scope);\n
    • A tween starts.
      tween.on('start', function(tween, targets){\n\n}, scope);\n
    • A tween property updates.
      tween.on('update', function(tween, key, target, current, previous){\n\n}, scope);\n
      • tween : A reference to the Tween instance that emitted the event.
      • key : The property that was updated, i.e. x or scale.
      • target : The target object that was updated. Usually a Game Object, but can be of any type.
      • current : The current value of the property that was tweened.
      • previous : The previous value of the property that was tweened, prior to this update.
    • A tween property pause.
      tween.on('pause', function(tween, key, target){\n\n}, scope);\n
    • A tween property resume.
      tween.on('resume', function(tween, key, target){\n\n}, scope);\n
    • A tween property yoyos.
      tween.on('yoyo', function(tween, key, target){\n\n}, scope);\n
    • A tween stopped.
      tween.on('stop', function(tween, targets){\n\n}, scope);\n
    "},{"location":"tween/#set-callbacks","title":"Set callbacks","text":"
    tween.setCallback(type, callback, param);\n
    • type :
      • 'onActive' : When the Tween is first created it moves to an 'active' state when added to the Tween Manager. 'Active' does not mean 'playing'.
      • 'onStart' : When the Tween starts playing after a delayed or paused state. This will happen at the same time as onActive if the tween has no delay and isn't paused.
      • 'onLoop' : When a Tween loops, if it has been set to do so. This happens after the loopDelay expires, if set.
      • 'onComplete' : When the Tween finishes playback fully. Never invoked if the Tween is set to repeat infinitely.
      • 'onStop' : Invoked only if the Tween.stop method is called.
      • 'onPause' : Invoked only if the Tween.pause method is called. Not invoked if the Tween Manager is paused.
      • 'onResume' : Invoked only if the Tween.resume method is called. Not invoked if the Tween Manager is resumed.
      • 'onYoyo' : When a TweenData starts a yoyo. This happens after the hold delay expires, if set.
      • 'onRepeat' : When a TweenData repeats playback. This happens after the repeatDelay expires, if set.
      • 'onUpdate' : When a TweenData updates a property on a source target during playback.
    • callback :
      • 'onRepeat', 'onUpdate', 'onYoyo'
        function(tween, targets, key, current, previous, param) {\n\n}\n
      • 'onActive', 'onLoop', 'onPause', 'onResume', 'onComplete', 'onStart', 'onStop',
        function(tween, targets, param) {\n\n}\n
    "},{"location":"tween/#state","title":"State","text":"
    • Is playing
      var isPlaying = tween.isPlaying();\n
    • Is paused
      var isPaused = tween.isPaused();\n
    • Is actively and not just in a delayed state
      var hasStarted = tween.hasStarted;\n
    "},{"location":"tween/#custom-ease-function","title":"Custom ease function","text":"
    var tween = scene.tweens.add({\ntargets: gameObject,\n// ...\nease: function (t) {  // t: 0~1\nreturn value;     // value: 0~1\n},\n// ...\n});\n
    "},{"location":"tween/#has-target","title":"Has target","text":"
    var hasTarget = tween.hasTarget(gameObject);\n
    "},{"location":"tween/#tween-value","title":"Tween value","text":"
    • Create tween task
      var tween = scene.tweens.addCounter({\nfrom: 0,\nto: 1,\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false,\nonUpdate(tween, targets, key, current, previous, param) {\n// var value = current;\n// var value = tween.getValue();\n}\n});\n
      • More config parameters...
    • Get value
      var value = tween.getValue();\n
    "},{"location":"tween/#chain","title":"Chain","text":""},{"location":"tween/#create-chain","title":"Create chain","text":"
    var chain = scene.tweens.chain({\ntargets: null,\ntweens: [\n{\n// targets: gameObject,\nalpha: 1,            ease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false\n},        // ...\n],\n\ndelay: 0,\ncompleteDelay: 0,\nloop: 0,  // repeat: 0,\nrepeatDelay: 0,\npaused: false,\npersist: true,\n// callbackScope: this,\n})\n
    • targets, or tweenConfig.targets
    • tweens : Array of tween config
    "},{"location":"tween/#pause-resume-chain","title":"Pause / Resume chain","text":"
    chain.pause();\n
    chain.resume();\n
    "},{"location":"tween/#restart-chain","title":"Restart chain","text":"
    chain.restart();\n
    "},{"location":"tween/#add-tween-task","title":"Add tween task","text":"
    chain.add({\ntargets: gameObject,\nalpha: 1,\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false\n})\n

    or

    chain.add([tweenConfig0, tweenConfig1, ...]);\n
    "},{"location":"tween/#remove-tween-task","title":"Remove tween task","text":"
    chain.remove(tweenTask);\n
    "},{"location":"tween/#has-target_1","title":"Has target","text":"
    var hasTarget = chain.hasTarget(gameObject);\n
    "},{"location":"tween/#flow-chart","title":"Flow chart","text":"
    graph TB\n\nStart((Start)) --> CallbackOnStart\nCallbackOnStart>\"Callback: onStart\"] --> ActiveDelay((\"delay\"))\nActiveDelay --> DurationForward\n\nDurationForward((\"Tween forward<br>Callback: onUpdate<br>(duration)\")) --> Hold[\"hold\"]\nHold((hold)) --> IsYoyo{Is yoyo}\nIsYoyo --> |Yes| CallbackOnYoyo>\"Callback: onYoyo\"]\nCallbackOnYoyo --> DurationBackward((\"Tween backword<br>Callback: onUpdate<br>(duration)\"))\nDurationBackward --> IsRepeat{\"Repeat count > 0\"}\nIsYoyo --> |No| IsRepeat\nIsRepeat --> |Yes| CallbackOnRepeat>\"Callback: onRepeat\"]\nCallbackOnRepeat --> RepeatDelay((\"repeatDelay\"))\nRepeatDelay --> DurationForward\n\nIsRepeat --> |No| IsLoop{\"Loop count > 0\"}\n\nIsLoop --> |Yes| CallbackOnLoop\nCallbackOnLoop>\"Callback: onLoop\"] --> LoopDelay((\"loopDelay\"))\nLoopDelay --> DurationForward\n\nIsLoop --> |No| CompleteDelay\nCompleteDelay((\"completeDelay\")) --> CallbackOnComplete>\"Callback: onComplete\"]\nCallbackOnComplete --> End((End))
    "},{"location":"tween/#tween-data","title":"Tween data","text":"
    • tween.data : An array of TweenData objects, each containing a unique property and target being tweened.
      • tween.data[i].key : The property of the target to tween.
      • tween.data[i].start, tween.data[i].end, tween.data[i].current : Ease Value Data.
    "},{"location":"ui-badgelabel/","title":"Badge label","text":""},{"location":"ui-badgelabel/#introduction","title":"Introduction","text":"

    A container with badges above a main item.

    • Author: Rex
    • Game object
    "},{"location":"ui-badgelabel/#live-demos","title":"Live demos","text":"
    • Badge
    "},{"location":"ui-badgelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-badgelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-badgelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add badge-label object
      var badgeLabel = scene.rexUI.add.badgeLabel(config);\n
    "},{"location":"ui-badgelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add badge-label object
      var badgeLabel = scene.rexUI.add.badgeLabel(config);\n
    "},{"location":"ui-badgelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { BadgeLabel } from 'phaser3-rex-plugins/templates/ui/uiComponents.js';\n
    • Add badge-label object
      var badgeLabel = new BadgeLabel(scene, config);\nscene.add.existing(badgeLabel);\n
    "},{"location":"ui-badgelabel/#add-badgelabel-object","title":"Add badgeLabel object","text":"
    var badgeLabel = scene.rexUI.add.badgeLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\nmain: mainItemGameObject,\n\nleftTop: leftTopBadgeGameObject,\ncenterTop: centerTopBadgeGameObject,\nrightTop: rightTopBadgeGameObject,\nleftCenter: leftCenterBadgeGameObject,\ncenter: centerBadgeGameObject,\nrightCenter: rightCenterBadgeGameObject,\nleftBottom: leftBottomBadgeGameObject,\ncenterBottom: centerBottomBadgeGameObject,\nrightBottom: rightBottomBadgeGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of badgeLabel.
    • main : Game object of main item, optional.
    • leftTop : Badge game object at leftTop side, optional.
    • centerTop : Badge game object at centerTop side, optional.
    • rightTop : Badge game object at rightTop side, optional.
    • leftCenter : Badge game object at leftCenter side, optional.
    • center : Badge game object at center side, optional.
    • rightCenter : Badge game object at rightCenter side, optional.
    • leftBottom : Badge game object at leftBottom side, optional.
    • centerBottom : Badge game object at centerBottom side, optional.
    • rightBottom : Badge game object at rightBottom side, optional.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
        • Positive number : Indent badge game objects inside background.
        • Negative number : Exceed badge game objects out of background.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-badgelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyBadgeLabel extends RexPlugins.UI.BadgeLabel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var badgeLabel = new MyBadgeLabel(scene, config);\n
    "},{"location":"ui-badgelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    badgeLabel.layout();\n

    See also - dirty

    "},{"location":"ui-badgelabel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = badgeLabel.getElement('background');\n
      • Main item game object
        var item = badgeLabel.getElement('main');\n
      • LeftTop badge game object
        var badge = badgeLabel.getElement('leftTop');\n
      • CenterTop badge game object
        var badge = badgeLabel.getElement('centerTop');\n
      • RightTop badge game object
        var badge = badgeLabel.getElement('rightTop');\n
      • LeftCenter badge game object
        var badge = badgeLabel.getElement('leftCenter');\n
      • Center badge game object
        var badge = badgeLabel.getElement('center');\n
      • RightCenter badge game object
        var badge = badgeLabel.getElement('rightCenter');\n
      • LeftBottom badge game object
        var badge = badgeLabel.getElement('leftBottom');\n
      • CenterBottom badge game object
        var badge = badgeLabel.getElement('centerBottom');\n
      • RightBottom badge game object
        var badge = badgeLabel.getElement('rightBottom');\n
    • Get by name
      var gameObject = badgeLabel.getElement('#' + name);\n// var gameObject = badgeLabel.getElement('#' + name, recursive);\n
      or
      var gameObject = badgeLabel.getByName(name);\n// var gameObject = badgeLabel.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-badgelabel/#other-properties","title":"Other properties","text":"

    See overlap sizer object, base sizer object, container-lite.

    "},{"location":"ui-basesizer/","title":"Base sizer","text":""},{"location":"ui-basesizer/#introduction","title":"Introduction","text":"

    Base class of all ui plugins.

    • Author: Rex
    "},{"location":"ui-basesizer/#usage","title":"Usage","text":""},{"location":"ui-basesizer/#background","title":"Background","text":"
    sizer.addBackground(gameObject);\n// sizer.addBackground(gameObject, key);\n// sizer.addBackground(gameObject, paddingConfig, key);\n
    • gameObject : Background game object will be resized after sizer.layout() method.
      • Round rectangle game object
        var gameObject = scene.rexUI.add.roundRectangle(x, y, width, height, radius, fillColor);\n
      • Nine-slice game object
        var gameObject = scene.add.nineslice(x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n
        or
        var gameObject = scene.make.nineslice({\nkey: key, frame: frameName,\nleftWidth: 0, rightWidth: 0,\ntopHeight: 0, bottomHeight: 0\n});\n
      • Nine-patch game object
        var gameObject = scene.rexUI.add.ninePatch(x, y, width, height, key, columns, rows, config);\n
      • Custom game object which has resize(width, height) method.
        • Display width, display height will be changed if this background game object does not have resize method.
    • paddingConfig : Add space between bounds. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • key : A string key. Get background game object back via
      var child = sizer.getElement(key);\n

    A sizer can have more than one background. i.e. user can invoke sizer.addBackground(gameObject) many times.

    "},{"location":"ui-basesizer/#remove-background","title":"Remove background","text":"
    • Remove background child
      sizer.removeBackground(gameObject);\n
    • Remove background child and destroy it
      sizer.removeBackground(gameObject, true);\n
    • Remove all background children
      sizer.removeAllBackgrounds();\n
    • Remove all background children and destroy them
      sizer.removeAllBackgrounds(true);\n
    "},{"location":"ui-basesizer/#depth-of-background","title":"Depth of background","text":"

    Send this background child to bottom of sizer.

    sizer.sendChildToBack(gameObject);\n
    "},{"location":"ui-basesizer/#minimum-size","title":"Minimum size","text":"
    • Get
      var minWidth = sizer.minWidth;\nvar minHeight = sizer.minHeight;\n
    • Set
      sizer.setMinSize(width, height);\n
      or
      sizer.setMinWidth(width);\nsizer.setMinHeight(height);\n

    Resize top-most sizer

    sizer.setMinSize(width, height).layout()\n
    "},{"location":"ui-basesizer/#dirty","title":"Dirty","text":"

    Don't layout this sizer if sizer.dirty is false. i.e. Size of this sizer won't be changed, but won't layout children neither.

    Default value is true.

    • Get
      var dirty = sizer.dirty;\n
    • Set
      sizer.setDirty();\n// sizer.setDirty(true);\n
      or
      sizer.dirty = true;\n
    • Clear
      sizer.setDirty(false);\n
      or
      sizer.dirty = false;\n
    "},{"location":"ui-basesizer/#bounds-of-sizer","title":"Bounds of sizer","text":"
    • Get
      var leftBound = sizer.left;\nvar rightBound = sizer.right;\nvar topBound = sizer.top;\nvar bottomBound = sizer.bottom;\nvar centerX = sizer.centerX;\nvar centerY = sizer.centerY;\n
    • Set
      sizer.left = leftBound;\nsizer.right = rightBound;\nsizer.top = topBound;\nsizer.bottom = bottomBound;\nsizer.centerX = centerXBound;\nsizer.centerY = centerYBound;\n
      or
      sizer.alignLeft(leftBound);\nsizer.alignRight(rightBound);\nsizer.alignTop(topBound);\nsizer.alignBottom(bottomBound);\nsizer.alignCenterX(centerXBound);\nsizer.alignCenterY(centerYBound);\n
    "},{"location":"ui-basesizer/#size-of-sizer","title":"Size of sizer","text":"
    • Size
      var width = sizer.width;\nvar height = sizer.height;\n
    • Display size
      var displayWidth = sizer.displayWidth;\nvar displayHeight = sizer.displayHeight;\n
    • Inner size
      var innerWidth = sizer.innerWidth;\nvar innerHeight = sizer.innerHeight;\n
    • Minimum size
      var minWidth = sizer.minWidth;\nvar minHeight = sizer.minHeight;\n
    • Minimum inner size
      var minInnerWidth = sizer.minInnerWidth;\nvar minInnerHeight = sizer.minInnerHeight;\n
    "},{"location":"ui-basesizer/#push-into-bounds","title":"Push into bounds","text":"

    Align sizer to bound if overlapping it.

    sizer.pushIntoBounds();\n

    or

    sizer.pushIntoBounds(bounds);\n
    • bounds : Bounds in rectangle object.
    "},{"location":"ui-basesizer/#scale","title":"Scale","text":"
    • Scale up from 0 to current scale of game object.
      • Pop-up width and height
        sizer\n//.setScale(scaleX, scaleY)\n.popUp(duration);\n\n// sizer.popUp(duration, undefined, ease);\n
        or
        sizer\n//.setScale(scaleX, scaleY)\n.popUpPromise(duration)\n.then(function() {\n// ....\n})\n
        • ease : Ease function, default is 'Cubic'.
      • Pop-up width only
        sizer\n//.setScaleX(scaleX)\n.popUp(duration, 'x');\n\n// sizer.popUp(duration, 'x', ease);\n
        or
        sizer\n//.setScaleX(scaleX)\n.popUpPromise(duration, 'x')\n.then(function() {\n// ....\n})\n
      • Pop-up height only
        sizer\n//.setScaleY(scaleY)\n.popUp(duration, 'y');\n\n// sizer.popUp(duration, 'y', ease);\n
        or
        sizer\n//.setScaleY(scaleY)\n.popUpPromise(duration, 'y')\n.then(function() {\n// ....\n})\n
      • Pop-up via config
        sizer\n//.setScale(scaleX, scaleY)\n.popUp({\nduration: undefined,\norientation: undefined,\nease: undefined,\n})\n
        or
        sizer\n//.setScale(scaleX, scaleY)\n.popUpPromise(config)\n.then(function() {\n// ....\n})\n
        • orientation : undefined, x, or y
    • Scale-down destroy
      • Scale-down width and height
        sizer.scaleDownDestroy(duration);\n// sizer.scaleDownDestroy(duration, undefined, ease);\n
        or
        sizer.scaleDownDestroyPromise(duration)\n.then(function() {\n// ....\n})\n
        • ease : Ease function, default is 'Linear'.
      • Scale-down width only
        sizer.scaleDownDestroy(duration, 'x');\n// sizer.scaleDownDestroy(duration, 'x', ease);\n
        or
        sizer.scaleDownDestroyPromise(duration, 'x');\n.then(function() {\n// ....\n})\n
      • Scale-down height only
        sizer.scaleDownDestroy(duration, 'y');\n// sizer.scaleDownDestroy(duration, 'y', ease);\n
        or
        sizer.scaleDownDestroyPromise(duration, 'y')\n.then(function() {\n// ....\n})\n
    • Scale-down without destroy
      • Scale-down width and height
        sizer.scaleDown(duration);\n// sizer.scaleDown(duration, undefined, ease);\n
        or
        sizer.scaleDownPromise(duration, undefined, ease)\n.then(function() {\n// ....\n})\n
      • Scale-down width only
        sizer.scaleDowny(duration, 'x');\n// sizer.scaleDowny(duration, 'x', ease);\n
        or
        sizer.scaleDownPromise(duration, 'x', ease)\n.then(function() {\n// ....\n})\n
      • Scale-down height only
        sizer.scaleDown(duration, 'y');\n// sizer.scaleDown(duration, 'y', ease);\n
        or
        sizer.scaleDownPromise(duration, 'y', ease)\n.then(function() {\n// ....\n})\n
    • Scale up/down, then scale back (yoyo)
      • Scale up/down, then scale back width and height
        sizer\n//.setScale(scaleX, scaleY)\n.scaleYoyo(duration, peakValue);\n\n// sizer.scaleYoyo(duration, peakValue, repeat, undefined, ease);\n
        or
        sizer\n//.setScale(scaleX, scaleY)\n.scaleYoyoPromise(duration, peakValue, repeat)\n.then(function() {\n// ....\n})\n
        • peakValue : Scale to this peak value, then scale back
        • repeat : Yoyo repeat, default value is 0.
        • ease : Ease function, default is 'Cubic'.
      • Scale up/down, then scale back width only
        sizer\n//.setScaleX(scaleX)\n.scaleYoyo(duration, peakValue, 0, 'x');\n\n// sizer.popUp(duration, peakValue, repeat, 'x', ease);\n
        or
        sizer\n//.setScaleX(scaleX)\n.scaleYoyoPromise(duration, peakValue, repeat, 'x')\n.then(function() {\n// ....\n})\n
      • Scale up/down, then scale back height only
        sizer\n//.setScaleY(scaleY)\n.scaleYoyo(duration, peakValue, 0, 'y');\n\n// sizer.popUp(duration, peakValue, repeat, 'y', ease);\n
        or
        sizer\n//.setScaleY(scaleY)\n.scaleYoyoPromise(duration, peakValue, repeat, 'y')\n.then(function() {\n// ....\n})\n
      • Scale up/down via config
        sizer\n//.setScale(scaleX, scaleY)\n.scaleYoyo({\nduration: undefined,\npeakValue: 1.2,\nrepeat: 0,\norientation: undefined,\nease: undefined,\n})\n
        or
        sizer\n//.setScale(scaleX, scaleY)\n.scaleYoyoPromise(config)\n.then(function() {\n// ....\n})\n
        • orientation : undefined, x, or y
    • Events
      • Pop-up complete
        sizer.on('popup.complete', function(sizer) { });\n
      • Scale-down, scale-down destroy complete
        sizer.on('scaledown.complete', function(sizer) { });\n
      • Scale up/down, then scale back (yoyo)
        sizer.on('scaleyoyo.complete', function(sizer) { });\n
    "},{"location":"ui-basesizer/#fade","title":"Fade","text":"
    • Fade-in
      sizer.fadeIn(duration);\n
      or
      sizer.fadeIn(duration, endAlpha);\n
      or
      sizer.fadeIn(duration, {start:0, end:1});\n
      or
      sizer.fadeInPromise(duration, endAlpha)\n.then(function(){\n// ...\n})\n
      or
      sizer.fadeInPromise(duration, {start:0, end:1})\n.then(function(){\n// ...\n})\n
    • Fade-out destroy
      sizer.fadeOutDestroy(duration);\n
      or
      sizer.fadeOutDestroyPromise(duration)\n.then(function(){\n// ...\n})\n
    • Fade-out without destroy
      sizer.fadeOut(duration);\n
      or
      sizer.fadeOutPromise(duration)\n.then(function(){\n// ...\n})\n
    • Events
      • Fade-in complete
        sizer.on('fadein.complete', function(sizer) { });\n
      • Fade-out, fade-out destroy complete
        sizer.on('fadeout.complete', function(sizer) { });\n
    "},{"location":"ui-basesizer/#ease-move","title":"Ease move","text":"
    • Move from
      sizer.moveFrom(duration, x, y);\n// sizer.moveFrom(duration, x, y, ease);\n// sizer.moveFrom({x, y, duration, ease});\n// sizer.moveFrom({x, y, speed, ease});\n
      or
      sizer\n.moveFromPromise(duration, x, y, ease)\n// .moveFromPromise({x, y, duration, ease})\n// .moveFromPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
      • x, y : Start position.
        • Number : Start position x/y.
        • String(+=300) : Related position of current position x/y.
        • undefined : Current position x/y.
      • speed : Get duration according to speed and distance between current sizer position to {x, y}
      • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • Move-from destroy
      sizer.moveFromDestroy(duration, x, y);\n// sizer.moveFrom(duration, x, y, ease);\n// sizer.moveFrom({x, y, duration, ease});\n// sizer.moveFrom({x, y, speed, ease});\n
      or
      sizer\n.moveFromDestroyPromise(duration, x, y, ease)\n// .moveFromDestroyPromise({x, y, duration, ease})\n// .moveFromDestroyPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
    • Move to
      sizer.moveTo(duration, x, y);\n// sizer.moveTo(duration, x, y, ease);\n// sizer.moveTo({x, y, duration, ease});\n// sizer.moveTo({x, y, speed, ease});\n
      or
      sizer\n.moveToPromise(duration, x, y, ease)\n// .moveToPromise({x, y, duration, ease})\n// .moveToPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
      • x, y : End position.
        • Number : End position x/y.
        • String(+=300) : Related position of current position x/y.
        • undefined : Current position x/y.
      • speed : Get duration according to speed and distance between current sizer position to {x, y}
      • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • Move-to destroy
      sizer.moveToDestroy(duration, x, y);\n// sizer.moveTo(duration, x, y, ease);\n// sizer.moveTo({x, y, duration, ease});\n// sizer.moveTo({x, y, speed, ease});\n
      or
      sizer\n.moveToDestroyPromise(duration, x, y, ease)\n// .moveToDestroyPromise({x, y, duration, ease})\n// .moveToDestroyPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
    • Move-stop
      sizer.moveStop();\n// sizer.moveStop(true);  // Set to end position\n
    • Events
      • Move-from complete
        sizer.on('movefrom.complete', function(sizer) { });\n
      • Move-to complete
        sizer.on('moveto.complete', function(sizer) { });\n
    "},{"location":"ui-basesizer/#shake","title":"Shake","text":"
    • Start
      sizer.shake(duration);\n// sizer.shake(duration, magnitude);\n
      or
      sizer.shakePromise(duration, magnitude)\n.then(function(){\n// ...\n})\n
    • Events
      • Shake complete
        sizer.on('shake.complete', function(sizer) { });\n
    "},{"location":"ui-basesizer/#ease-data","title":"Ease data","text":"
    • Start
      sizer.easeDataTo(key, value, duration);\n// sizer.easeDataTo(key, value, duration, ease);\n// sizer.easeDataTo({ key, value, duration, ease });\n// sizer.easeDataTo({ key, value, speed, ease });\n
      or
      sizer.easeDataToPromise(key, value, duration, ease)\n.then(function(){\n// ...\n})\n
    • Stop
      sizer.stopEaseData(key);           // Set to end value\n// sizer.stopEaseData(key, false); // Stop at current value\n
      or
      sizer.stopAllEaseData();           // Set to end value\n// sizer.stopAllEaseData(false);   // Stop at current value\n
    • Events
      • Easing complete
        sizer.on('easedata.' + key + '.complete', function(sizer) { });\n
        sizer.on('easedata.complete', function(key, sizer) { });\n
    "},{"location":"ui-basesizer/#delay-call","title":"Delay call","text":"
    sizer.delayCall(delay, callback, scope);\n

    Timer will be removed when destroying game object.

    "},{"location":"ui-basesizer/#modal","title":"Modal","text":"
    1. Assign sizer.onCreateModalBehavior callback, or register events to close modal sizer directly.
      • onCreateModalBehavior :
        sizer.onCreateModalBehavior = function(sizer, config) {\n// ...\nsizer.modalClose(data);\n}\n
        • config : Passed from sizer.modal(config)
      • Close modal sizer
        sizer.modalClose(data);\n
    2. Pop this modal sizer
      sizer.modal(onClose);  // Use default modal config\n
      or
      sizer.modal({\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0,\n// transitOut: 0,\n\n// destroy: true\n}, onClose);\n
      or
      sizer\n.modalPromise(config)\n.then(function(data){\n\n})\n
      • config : See Modal behavior
      • onClose : Callback when closing modal dialog
        function(data) {      }\n
        • data : Object passed from sizer.modalClose(data).
    "},{"location":"ui-basesizer/#set-properties-of-child","title":"Set properties of child","text":"
    sizer.setChildPosition(child, x, y);\nsizer.setChildRotation(child, rotation);\nsizer.setChildScale(child, scaleX, scaleY);\nsizer.setChildDisplaySize(child, width, height);\nsizer.setChildVisible(child, visible);\nsizer.setChildAlpha(child, alpha);\n
    "},{"location":"ui-basesizer/#depth","title":"Depth","text":"
    • Get depth of sizer
      var depth = sizer.depth;\n
    • Set depth of sizer
      sizer.setDepth(value, true);\n// sizer.depth = depth;\n
    • Set depth of sizer and all children
      sizer.setDepth(value);\n
    • Bring this sizer and its children to top
      sizer.bringToTop();\n
    • Swap depth with another sizer
      sizerA.swapDepth(sizerB);\n
    • Increase of sizer and all children
      sizer.incDepth(value);\n
    • Move game object below this sizer and all children
      sizer.moveDepthBelow(gameObject);\n
    • Move game object above this sizer and all children
      sizer.moveDepthAbove(gameObject);\n
    • Bring a child of this sizer to top
      sizer.bringChildToTop(gameObject);\n
    • Send a child of this sizer to bottom
      sizer.sendChildToBack(gameObject);\n
    "},{"location":"ui-basesizer/#scroll-factor","title":"Scroll factor","text":"
    • Set scroll factor to children
      sizer.setScrollFactor(x, y);\n
    "},{"location":"ui-basesizer/#change-origin","title":"Change origin","text":"
    sizer.changeOrigin(originX, originY);\n

    This method also will reset all local state of children.

    "},{"location":"ui-basesizer/#destroy","title":"Destroy","text":"
    sizer.destroy();\n
    "},{"location":"ui-basesizer/#drag-sizer","title":"Drag sizer","text":"
    • Drag top-most sizer by child
      • Enable
        sizer.setDraggable(child);\n// sizer.setDraggable(child, true);\n
        or
        sizer.setDraggable(elementName);\n// sizer.setDraggable(elementName, true);\n
      • Disable
        sizer.setDraggable(child, false);\n
        or
        sizer.setDraggable(elementName, false);\n
    • Drag top-most sizer by this sizer
      • Enable
        sizer.setDraggable();\n// sizer.setDraggable(true);\n
      • Disalbe
        sizer.setDraggable(false);\n
    • Drag target sizer by child
      • Enable
        sizer.setDraggable(child, targetSizer);\n// sizer.setDraggable(child, true, targetSizer);\n
        or
        sizer.setDraggable(elementName);\n// sizer.setDraggable(elementName, true, targetSizer);\n
      • Disable
        sizer.setDraggable(child, false);\n
        or
        sizer.setDraggable(elementName, false);\n
    • Drag target config
      sizer.setDraggable({\nsensor: child, // or elementName\ntarget: undefined, // or a parentSizer\ndraggable: true\n})\n
      • sensor : A game object or a string
      • target
        • undefined : Top-most sizer
        • A game object : A parent sizer
    "},{"location":"ui-basesizer/#events","title":"Events","text":"
    • Fire 'sizer.drag' on target sizer when dragging
      targetSizer.on('sizer.drag', function(pointer, dragX, dragY) {\n\n})\n
    • Fire 'sizer.dragstart' on target sizer when dragging
      targetSizer.on('sizer.dragstart', function(pointer, dragX, dragY) {\n\n})\n
    • Fire 'sizer.dragend' on target sizer when dragging
      targetSizer.on('sizer.dragend', function(pointer, dragX, dragY, dropped) {\n\n})\n
    • Fire 'sizer.drop' on target sizer when dropped
      targetSizer.on('sizer.drop', function(pointer, dropZone) {\n\n})\n
    "},{"location":"ui-basesizer/#click","title":"Click","text":"
    • Add click event
      sizer.onClick(callback, scope);\n// sizer.onClick(callback, scope, config);\n
      • config : See Button
      • callback :
        function(button, gameObject, pointer, event) {\n\n}\n
        • button : Button behavior.
    • Turn off click event
      sizer.offClick(callback, scope);\n
    • Enable click event
      sizer.enableClick();\n
    • Disable click event
      sizer.disableClick();\n

    Equal to

    var click = scene.rexUI.add.click(sizer, config);\nclick.on('click', callback, scope);\n
    "},{"location":"ui-basesizer/#click-child","title":"Click child","text":"
    • Add click event
      sizer.onClick(child, callback, scope);\n// sizer.onClick(child, callback, scope, config);\n
    • Turn off click event
      sizer.offClick(child, callback, scope);\n
    • Enable click event
      sizer.enableClick(child);\n
    • Disable click event
      sizer.disableClick(child);\n
    "},{"location":"ui-basesizer/#click-outside","title":"Click outside","text":"
    • Add click-outside event
      sizer.onClickOutside(callback, scope);\n// sizer.onClickOutside(callback, scope, config);\n
      • config : See ClickOutside
      • callback :
        function(clickOutside, gameObject, pointer) {\n\n}\n
        • clickOutside : ClickOutside behavior.
    • Turn off click-outside event
      sizer.offClickOutside(callback, scope);\n
    • Enable click-outside event
      sizer.enableClickOutside();\n
    • Disable click-outside event
      sizer.disableClickOutside();\n

    Equal to

    var clickOutside = scene.rexUI.add.clickOutside(sizer, config);\nclickOutside.on('clickoutside', callback, scope);\n
    "},{"location":"ui-basesizer/#click-outside-of-child","title":"Click outside of child","text":"
    • Add click-outside event
      sizer.onClickOutside(child, callback, scope);\n// sizer.onClickOutside(child, callback, scope, config);\n
      • config : See ClickOutside
      • callback :
        function(clickOutside, gameObject, pointer) {\n\n}\n
        • clickOutside : ClickOutside behavior.
    • Turn off click-outside event
      sizer.offClickOutside(child, callback, scope);\n
    • Enable click-outside event
      sizer.enableClickOutside(child);\n
    • Disable click-outside event
      sizer.disableClickOutside(child);\n
    "},{"location":"ui-basesizer/#is-pointer-in-bounds","title":"Is pointer in bounds","text":"
    • Is current sizer clicking
      var isClicked = sizer.isPointerInBounds();\n
    • Is a child clicking
      var isClicked = sizer.isPointerInBounds(child);\n
      or
      var isClicked = sizer.isPointerInBounds(elementName);\n
      • child : Game object of child
      • elementName : Element name for retrieveing child game object.
    "},{"location":"ui-basesizer/#in-touching","title":"In touching","text":"

    Invoke callbeack if pointer is inside hitarea every tick.

    • Add in-touching event
      sizer.onTouching(callback, scope);\n// sizer.onTouching(callback, scope, config);\n
    • Turn off in-touching event
      sizer.offTouching(callback, scope);\n
    • Add touching-end event
      sizer.onTouchingEnd(callback, scope);\n// sizer.onTouchingEnd(callback, scope, config);\n
    • Turn off touching-end event
      sizer.offTouchingEnd(callback, scope);\n
    • Enable in-touching event
      sizer.enableTouching();\n
    • Disable in-touching event
      sizer.disableTouching();\n

    Equal to

    var inTouching = scene.rexUI.add.inTouching(sizer, config);\ninTouching.on('intouch', callback, scope);\n
    "},{"location":"ui-basesizer/#in-touching-child","title":"In touching child","text":"
    • Add in-touching event
      sizer.onTouching(child, callback, scope);\n// sizer.onClick(child, callback, scope, config);\n
    • Turn off in-touching event
      sizer.offTouching(child, callback, scope);\n
    • Enable in-touching event
      sizer.enableTouching(child);\n
    • Disable in-touching event
      sizer.disableTouching(child);\n
    "},{"location":"ui-basesizer/#set-children-interactive","title":"Set children interactive","text":"

    Applies click, tap, press, swipe behaviors on this sizer, to detect input events of children.

    sizer.setChildrenInteractive({\n// dropZone: false,\n\n// down: undefined,\n// up: undefined,\n// over: undefined,\n\n// click: {mode: 'release', clickInterval: 100},\n\n// press: {time: 251, threshold: 9},\n\n// tap: {time: 250, tapInterval: 200, threshold: 9, tapOffset: 10, \n//       taps: undefined, minTaps: undefined, maxTaps: undefined,},\n\n// swipe: {threshold: 10, velocityThreshold: 1000, dir: '8dir'},\n\n// inputEventPrefix: 'child.',\n})\n
    • dropZone :
      • true : Enable drop Zone on this sizer.
      • false : Do nothing.
    • down :
      • false : Don't fire (pointer-) down events
    • up :
      • false : Don't fire (pointer-) up events
    • over :
      • false : Don't fire (pointer-) over/out events
    • click : Configuration of Button behavior.
      • false : Don't install Button behavior.
    • press : Configuration of Press behavior.
      • false : Don't install Press behavior.
    • tap : Configuration of Tap behavior.
      • false : Don't install Tap behavior.
    • swipe : Configuration of Swipe behavior.
      • false : Don't install Swipe behavior.
    • inputEventPrefix : Prefix string of each event, default is 'child.'.

    Note

    Input behaviors are installed to this Sizer game object, not each child. And it assumes that all children are not overlapped. Use Button if user needs to enable/disable input behaviors of each child individually.

    "},{"location":"ui-basesizer/#events_1","title":"Events","text":"
    • Pointer-down
      sizer.on('child.down', function(child, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-up
      sizer.on('child.up', function(child, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-over
      sizer.on('child.over', function(child, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-out
      sizer.on('child.out', function(child, pointer, event) {\n// ...\n}, scope);\n
    • Click
      sizer.on('child.click', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Triggered child game object.
      • pointer : Pointer object.
    • Press
      sizer.on('child.pressstart', function(child, pointer) { // ...\n}, scope);\n
      sizer.on('child.pressend', function(child, pointer) { // ...\n}, scope);\n
    • Tap
      sizer.on(tapEventName, function(child, pointer, tap) { // ...\n}, scope);\n
      • tapEventName : 'child.tap', 'child.1tap', 'child.2tap', 'child.3tap', etc ...
      • tap : Tap object.
        • tap.tapsCount : Taps count.
    • Swipe
      sizer.on(swipeEventName, function(child, pointer, swipe) { // ...\n}, scope);\n
      • swipeEventName : 'child.swipe', 'child.swipeleft', 'child.swiperight', 'child.swipeup', 'child.swipedown'.
      • swipe : Swipe object.
        • swipe.left, swipe.right, swipe.up, swipe.down : Swipe direction states.
    "},{"location":"ui-basesizer/#bind-event","title":"Bind event","text":"
    • Bind event
      sizer.bindEvent(eventEmitter, eventName, callback, scope);\n
    • Bind scene's 'preupdate' event
      sizer.bindScenePreupdateEvent(callback, scope);\n
    • Bind scene's 'update' event
      sizer.bindSceneUpdateEvent(callback, scope);\n
    • Bind scene's 'postupdate' event
      sizer.bindScenePostupdateEvent(callback, scope);\n
    • Bind scene's 'render' event
      sizer.bindSceneRenderEvent(callback, scope);\n
    • Bind scene's 'pause' event
      sizer.bindScenePauseEvent(callback, scope);\n
    • Bind scene's 'resume' event
      sizer.bindSceneResumeEvent(callback, scope);\n
    • Bind scene's 'sleep' event
      sizer.bindSceneSleepEvent(callback, scope);\n
    • Bind scene's 'wake' event
      sizer.bindSceneWakeEvent(callback, scope);\n
    • Bind scene's 'shutdown' event
      sizer.bindSceneShutdownEvent(callback, scope);\n

    Will remove this event from eventEmitter when destroying sizer.

    "},{"location":"ui-basesizer/#pin-game-object","title":"Pin game object","text":"
    sizer.pin(gameObject);\n

    or

    sizer.pinLocal(gameObject);\n

    Note

    Method sizer.add is override in each sizer class usually.

    "},{"location":"ui-basesizer/#un-pin-game-object","title":"Un-pin game object","text":"
    sizer.unpin(child);\n// sizer.unpin(child, destroyChild);\n
    • destroyChild : Set true to destroy child. Default is false.

    Note

    Method sizer.remove is override in each sizer class usually.

    "},{"location":"ui-basesizer/#draw-bounds","title":"Draw bounds","text":"
    • Draw bounds of shown game object on a graphics game object
      sizer.drawBounds(graphics);\n// sizer.drawBounds(graphics, color);\n
      • graphics : Graphics game object
      • color : Default value is 0xffffff
    • Draw bounds of shown game object, and display name of child
      sizer.drawBounds(graphics, {\n// color: 0xffffff,\n// lineWidth: 2,\n\n// name: false, \n// name: true, \n// name: {\n//     createTextCallback: function(scene) {\n//         return scene.add.text(0, 0, '');\n//     },\n//     createTextCallbackScope: undefined,\n//     align: 'left-top'\n// }\n});\n
      • graphics : Graphics game object
      • color : Default value is 0xffffff.
      • lineWidth : Default value is 1.
      • name :
        • false : Don't display child name, default value
        • true : Display child name with default text game object, aligned at left-top of child bounds.
        • Plain object :
          • name.createTextCallback : Callback of creating customized text game object for child name
            function(scene, child, childBoundsRect) {\n// return scene.add.text(0, 0, ''); \n}\n
          • name.createTextCallbackScope : Callback scope of name.createTextCallback, default is undefined
          • name.align :
            • 'left-top', or Phaser.Display.Align.TOP_LEFT : Align text game object at left-top. Default value
            • 'center', or Phaser.Display.Align.CENTER : Align text game object at center
            • 'left', or Phaser.Display.Align.LEFT_CENTER : Align text game object at left-center
            • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align text game object at right-center
            • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game text object at top-center
            • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game text object at bottom-center
            • 'left-bottom', or Phaser.Display.Align.BOTTOM_LEFT : Align text game object at left-bottom
            • 'right-top', or Phaser.Display.Align.TOP_RIGHT : Align text game object at right-top
            • 'right-bottom', or Phaser.Display.Align.BOTTOM_RIGHT : Align text game object at right-bottom
      • Text game objects of these children's name will be attached on graphics game object, graphics.clear(), or graphics.destroy() will also destroy these text game objects
    "},{"location":"ui-basesizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-basesizer/#padding","title":"Padding","text":"
    • Set inner padding, will indent children position.
      • Set inner padding via config
        sizer.setInnerPadding({\nleft: leftPadding, right: rightPadding,\ntop: topPadding,\nbottom: bottomPadding\n});\n
      • Set inner padding via single number
        sizer.setInnerPadding(value);\n
      • Set specific inner padding
        sizer.setInnerPadding(key, value);\n
        • key : 'left', 'right', 'top', 'bottom'
    • Get inner padding
      • Get inner padding values
        var innerPadding = sizer.getInnerPadding();\n
      • Get specific inner padding
        var value = sizer.getInnerPadding(key);\n
        • key : 'left', 'right', 'top', 'bottom'
    • Set outer padding, which is equal to padding parameter when adding this sizer to parent sizer.
      • Set outer padding via config
        sizer.setOuterPadding({\nleft: leftPadding, right: rightPadding,\ntop: topPadding,\nbottom: bottomPadding\n});\n
      • Set outer padding via single number
        sizer.setOuterPadding(value);\n
      • Set specific outer padding
        sizer.setOuterPadding(key, value);\n
        • key : 'left', 'right', 'top', 'bottom'
    • Get outer padding
      • Get outer padding values
        var outerPadding = sizer.getOuterPadding();\n
      • Get specific outer padding
        var value = sizer.getOuterPadding(key);\n
        • key : 'left', 'right', 'top', 'bottom'
    • Set outer padding of child, which is equal to padding parameter when adding this sizer to parent sizer.
      • Set outer padding via config
        sizer.setChildOuterPadding(\nchild,\n{\nleft: leftPadding, right: rightPadding,\ntop: topPadding,\nbottom: bottomPadding\n}\n);\n
        • child : A string key or game object.
      • Set outer padding via single number
        sizer.setChildOuterPadding(child, value);\n
        • child : A string key or game object.
      • Set specific outer padding
        sizer.setChildOuterPadding(child, key, value);\n
        • child : A string key or game object.
        • key : 'left', 'right', 'top', 'bottom'
    • Get outer padding of child
      • Get outer padding values
        var outerPadding = sizer.getChildOuterPadding(child);\n
        • child : A string key or game object.
      • Get specific outer padding
        var value = sizer.getChildOuterPadding(child, key);\n
        • child : A string key or game object.
        • key : 'left', 'right', 'top', 'bottom'
    "},{"location":"ui-basesizer/#anchor","title":"Anchor","text":"
    sizer.setAnchor({\n// left: '0%+0',\n// right: '0%+0',\n// centerX: '0%+0',\n// x: '0%+0',\n\n// top: '0%+0',\n// bottom: '0%+0',\n// centerY: '0%+0',\n// y: '0%+0'\n})\n
    • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0~100
        • 'left'(=0%), 'center'(=50%), 'right'(=100%)
        • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
      • Offset : '+n', or '-n'

    For example, anchor game object's left bound to viewport's left+10, and centerY to viewport's center :

    {\nleft: 'left+10',\ncenterY: 'center'\n}\n
    "},{"location":"ui-basesizer/#get-child","title":"Get child","text":"
    • Get child by specific key
      1. Add child
        sizer.addChildrenMap(key, child);\n
        • Remove children map :
          sizer.removeChildrenMap(key);\n
          or
          sizer.removeChildrenMap(child);\n
      2. Get child
        var child = sizer.getElement(key);\n
    • Get child by name
      var child = sizer.getByName(name);\n// var child = sizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-basesizer/#get-parent","title":"Get parent","text":"
    • Get parent sizer
      var parentSizer = sizer.getParentSizer();\n
    • Get ancestor sizer matched given name
      var parentSizer = sizer.getParentSizer(name);\n
    • Get topmost sizer
      var topmostSizer = sizer.getTopmostSizer();\n
    "},{"location":"ui-basesizer/#has-parentchild","title":"Has parent/child","text":"
    • Has parent
      var hasParent = sizer.hasParentSizer(parentGameObject);\n
    • Has child
      var hasChild = sizer.hasParentSizer(childGameObject);\n
    "},{"location":"ui-basesizer/#is-in-touching","title":"Is in touching","text":"
    • Is this sizer in touching?
      var isTouching = sizer.isInTouching();\n
    • Is child of this sizer in touching?
      var isTouching = sizer.isInTouching(child);\n
      or
      var isTouching = sizer.isInTouching(childKey);\n
      • child : Child game object.
      • childKey : Get child game object back via sizer.getElement(childKey). See also sizer.addChildrenMap(key, child)
    "},{"location":"ui-basesizer/#change-properties-of-child","title":"Change properties of child","text":"
    • Set property of child from sizer
    • Set property of child, then reset local state of child
    • Tween local state of child
    "},{"location":"ui-basesizer/#add-to-container","title":"Add to container","text":"
    • Add to built-in container
      p3Container.add(sizer);\n
      or
      sizer.addToContainer(p3Container);\n
      • container : Container game object.
    • Add to Layer
      sizer.addToLayer(layer);\n
      • layer : Layer game object.

    Note

    container.add(sizer), or layer.add(sizer) won't add children of sizer.

    "},{"location":"ui-basesizer/#layer","title":"Layer","text":"

    A sizer can have a layer. Current children and new children will draw on this layer, instead of display list of scene.

    • Enable layer. Do nothing if layer is existed.
      sizer.enableLayer();\n
    • Get layer game object. Will enable layer if layer is not existed.
      var layer = sizer.getLayer();\n
    "},{"location":"ui-basesizer/#shader-effects","title":"Shader effects","text":"

    Apply post-fx pipeline on layer of sizer.

    "},{"location":"ui-basesizer/#snapshot","title":"Snapshot","text":"
    • Draw all visible children on a render-texture.
      var renderTexture = container.snapshot({\nrenderTexture: undefined,\npadding: 0\n});\n
      • renderTexture : Draw on this render-texture
        • undefined : Create a new render-texture
      • padding :
        • 0 : No extra padding space. Default value.
        • A number : Add extra padding space around this render-texture.
    • Draw all visible children on a texture
      container.snapshot({\npadding: 0,\nsaveTexture: textureKey\n});\n
      • saveTexture : Save render result to texture manager.
    "},{"location":"ui-basesizer/#layout-children","title":"Layout children","text":"

    Note

    Enable sizer events by set sizerEvents to true in config.

    • Fire 'sizer.postlayout' event to all children after layout.
      child.on('sizer.postlayout', function(child, sizer){\nvar prevState = sizer.getChildPrevState(child);\n})\n
      • prevState : Properties before layout.
        • prevState.x, prevState.y : Child position before layout.
        • prevState.width, prevState.height, prevState.displayWidth, prevState.displayHeight, prevState.scaleX, prevState.scaleY : Child size before layout.
    • Fire 'postlayout' event.
      sizer.on('postlayout', function(children, sizer) {\nfor(var i=0, cnt=children.length; i<cnt; i++) {\nvar prevState = sizer.getChildPrevState(children[i]);\n// ...\n}\n})\n
    "},{"location":"ui-basesizer/#remove-child","title":"Remove child","text":"

    Note

    Enable sizer events by set sizerEvents to true in config.

    • Fire 'sizer.remove' event to removed without destroyed child.
      child.on('sizer.remove', function(child, sizer){\n\n})\n
    • Fire 'remove' event.
      sizer.on('remove', function(child, sizer){\n\n})\n
    "},{"location":"ui-basesizer/#add-child","title":"Add child","text":"

    Note

    Enable sizer events by set sizerEvents to true in config.

    • Fire 'sizer.add' event to added child.
      child.on('sizer.add', function(child, sizer){\n\n})\n
    • Fire 'add' event.
      sizer.on('add', function(child, sizer){\n\n})\n
    "},{"location":"ui-basesizer/#broadcast-event","title":"Broadcast event","text":"

    Fire event to sizer itself and all children

    sizer.broadcastEvent(eventName, parameter0, parameter1, ...);\n

    Receive event

    child.on(eventName, function(parameter0, parameter1, ...) {\n\n}, scope);\n
    "},{"location":"ui-basesizer/#other-properties","title":"Other properties","text":"

    This game object inherits from ContainerLite.

    "},{"location":"ui-buttons/","title":"Buttons","text":""},{"location":"ui-buttons/#introduction","title":"Introduction","text":"

    A container with a group of buttons.

    • Author: Rex
    • Game object
    "},{"location":"ui-buttons/#live-demos","title":"Live demos","text":"
    • Buttons with header and footer
    • Expand
    • Space
    • Checkboxes/radio
    • CustomProgress background
    • Popup each button
    "},{"location":"ui-buttons/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-buttons/#install-plugin","title":"Install plugin","text":""},{"location":"ui-buttons/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add buttons object
      var buttons = scene.rexUI.add.buttons(config);\n
    "},{"location":"ui-buttons/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add buttons object
      var buttons = scene.rexUI.add.buttons(config);\n
    "},{"location":"ui-buttons/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Buttons } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add buttons object
      var buttons = new Buttons(scene, config);\nscene.add.existing(buttons);\n
    "},{"location":"ui-buttons/#add-buttons-object","title":"Add Buttons object","text":"
    var buttons = scene.rexUI.add.buttons({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n// buttonsType: undefined,\n\n// Elements\n// background: backgroundGameObject,\n\nbuttons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\nexpand: false,\nalign: undefined,\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\n// space: 0,   // deprecated \n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n// eventEmitter: this,\n// groupName: undefined,\n\n// setValueCallback: undefined,  // or setButtonStateCallback: undefined\n// setValueCallbackScope: undefined  // or setButtonStateCallbackScope: undefined\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Main orientation of button game objects.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange button game objects from left ot right.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange button game objects from top to bottom.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • buttonsType : Type/behavior of these buttons.
      • undefined : No extra behavior, default value.
      • 'checkboxes' : Set these buttons to checkboxes.
      • 'radio' : Set these buttons to radio.
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • buttons : Array of button game objects, or Space (scene.rexUI.add.space()).
    • expand : Set true to expand width, or height of buton game objects.
    • align : Note: Add Space (scene.rexUI.add.space()) into buttons parameter to have more flexible alignment style. Alignment of these button game objects. Only valid when expand is false.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • space :
      • An object: Padding of button game objects.
        • space.top, space.bottom, space.left, space.right : Padding around bottons.
        • space.item : Space between 2 button game objects.
      • A number: Deprecated, space between 2 button game objects.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • eventEmitter : Dispatch buttons' touch events to other game object, default is this buttons game object.
    • groupName : Optional group name for argument of touch events.
    • setValueCallback, or setButtonStateCallback : Callback to set value of a button.
      • undefined : No callback, default value.
      • A function object.
        function(button, value, previousValue) {\n// ...\n}\n
        • button : Button game object.
        • value: true, or false.
        • previousValue : true, or false.
    "},{"location":"ui-buttons/#custom-class","title":"Custom class","text":"
    • Define class
      class MyButtons extends RexPlugins.UI.Buttons {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var buttons = new MyButtons(scene, config);\n
    "},{"location":"ui-buttons/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    buttons.layout();\n

    See also - dirty

    "},{"location":"ui-buttons/#other-properties","title":"Other properties","text":"

    See sizer object

    "},{"location":"ui-buttons/#events","title":"Events","text":"
    • Click button
      buttons.on('button.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.click', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      • groupName : Optional group name.
      • button : Triggered button game object.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over button
      buttons.on('button.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.over', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-out button
      buttons.on('button.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.out', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-down button
      buttons.on('button.down', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.down', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-up button
      buttons.on('button.up', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.up', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Enable button's input
      buttons.on('button.enable', function(button, index) {\n// ...\n}, scope);\n
      or
      buttons.on('button.enable', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Disable button's input
      buttons.on('button.disable', function(button, index) {\n// ...\n}, scope);\n
      or
      buttons.on('button.disable', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    "},{"location":"ui-buttons/#emit-button-click-event","title":"Emit button click event","text":"
    buttons.emitButtonClick(index);\n
    • index : Index of triggered button game object, or a button game object.
    "},{"location":"ui-buttons/#enabledisable-input-of-button","title":"Enable/disable input of button","text":"
    • Enable a button's input
      buttons.setButtonEnable(index);\n// buttons.setButtonEnable(index, true);\n
      • index : Index of triggered button game object, or a button game object.
    • Enable all buttons' input
      buttons.setButtonEnable();\n// buttons.setButtonEnable(true);\n
    • Disable
      buttons.setButtonEnable(index, true);\n
      • index : Index of triggered button game object, or a button game object.
    • Disable all buttons' input
      buttons.setButtonEnable(false);\n
    • Toggle
      buttons.toggleButtonEnable(index);\n
    • Toggle all buttons's input
      buttons.toggleButtonEnable();\n
    • Get button's input enable
      var enabled = bottons.getButtonEnable(index);\n
    "},{"location":"ui-buttons/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = buttons.getElement('background');\n
      • Button game objects
        var buttonObjects = buttons.getElement('buttons');\n
        or
        var buttonObject = buttons.getButton(index);\n
        or
        var buttonObjects = buttons.getElement('buttons[0]'); // First button\n
    • Get by name
      var gameObject = buttons.getElement('#' + name);\n// var gameObject = buttons.getElement('#' + name, recursive);\n
      or
      var gameObject = buttons.getByName(name);\n// var gameObject = buttons.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-buttons/#add-child","title":"Add child","text":"
    • Add button child
      buttons.addButton(gameObject)\n
      • gameObject : A game object, or an array of game objects.
    • Add non-button child, see sizer.add() method.
      buttons.add(gameObject,\n{\nproportion: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,\nkey: undefined,\nindex: undefined,\nminWidth: undefined,\nminHeight: undefined\n}\n)\n
    "},{"location":"ui-buttons/#remove-child","title":"Remove child","text":"
    • Remove button child
      buttons.removeButton(gameObject, destroyChild);\n
      • gameObject :
        • Game object, or array of game objects : Button game object.
        • A number, or array of numbers : Index of button game object.
        • A string, or array of strings : Name of button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove all buttton children
      buttons.clearButtons(destroyChild);\n
      • destroyChild : Set true to destroy button game objects.
    • Remove a button or non-button child, see sizer.remove() method.
      buttons.remove(gameObject, destroyChild);\n
    • Remove all button or non-button children, see sizer.remove() method.
      buttons.removeAll(destroyChild);\n
    "},{"location":"ui-buttons/#showhide-button","title":"Show/hide button","text":"

    Hidden elements won't be counted when layouting. Call buttons.layout(), or topSizer.layout() after show/hide any button.

    • Show button
      buttons.showButton(index);\n
      • index : A number index, or a button game object.
    • Hide button.
      buttons.hideButton(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-buttons/#for-each-button","title":"For each button","text":"
    buttons.forEachButtton(callback, scope);\n
    • callback :
      function(button, index, buttonArray) {\n// ...\n}\n
    "},{"location":"ui-buttons/#checkboxesradio","title":"Checkboxes/radio","text":"
    • Configure buttons to checkboxes/radio
      var buttons = scene.rexUI.add.buttons({\nbuttons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\nbuttonsType: 'checkboxes', // or 'radio'\nsetValueCallback: function(button, value, previousValue) {\n// ...\n}, // or setButtonStateCallback\n});\n
      • buttons : Array of button game objects.
        • Property name of each button game object will be used as a key in buttons.data
      • buttonsType : Set type to 'checkboxes', or 'radio'.
      • setValueCallback or setButtonStateCallback : Callback to set value of a button.
        function(button, value) {\n// ...\n}\n
        • button : Button game object.
        • value: true, or false.
        • previousValue : true, or false.
        • Also trigger 'button.statechange' event.
      • State of a button : Stored in buttons.data
      • Get states of all buttons :
        var states = buttons.getAllButtonsState();  // { key: boolean }\n
      • Clear states of all button :
        buttons.clearAllButtonsState();\n
        • Will trigger setValueCallback and 'button.statechange' event.
    "},{"location":"ui-buttons/#checkboxes","title":"Checkboxes","text":"
    • Read state
      var state = buttons.getButtonState(key);\n
      • key : name property of a button game object. (i.e. button.name)
      • state : true, or false
    • Set state
      buttons.setButtonState(key, state);\n
      • key : name property of a button game object. (i.e. button.name)
      • state : true, or false
    "},{"location":"ui-buttons/#radio","title":"Radio","text":"
    • Read state
      var value = buttons.getSelectedButtonName();\n
      or
      var value = buttons.value;\n
      • value : name property of a button game object. (i.e. button.name)
    • Set state
      buttons.setSelectedButtonName(key);\n
      or
      buttons.value = key;\n
      • key : name property of a button game object. (i.e. button.name)
    "},{"location":"ui-buttons/#events_1","title":"Events","text":"
    • On button state changed. For Checkboxes/radio
      buttons.on('button.statechange', function(button, index, value, previousValue) {\n// ...\n}, scope);\n
      or
      buttons.on('button.statechange', function(button, groupName, index, value, previousValue) {\n// ...\n}, scope);\n
      • Can be used to replace setValueCallback.
    "},{"location":"ui-chart/","title":"Chart","text":""},{"location":"ui-chart/#introduction","title":"Introduction","text":"

    Draw chart on canvas.

    • Author: Rex
    • Game object
    "},{"location":"ui-chart/#live-demos","title":"Live demos","text":"
    • Radar chart
    "},{"location":"ui-chart/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-chart/#install-plugin","title":"Install plugin","text":""},{"location":"ui-chart/#install-chartjs","title":"Install chart.js","text":"

    Chart.js is not included in rexUI, installs it before creating any chart.

    scene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/chart.min.js');\n
    or
    scene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js');\n

    "},{"location":"ui-chart/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');\nscene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add chart object
      var chart = scene.rexUI.add.chart(config);\n
    "},{"location":"ui-chart/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add chart object
      var chart = scene.rexUI.add.chart(config);\n
    "},{"location":"ui-chart/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Chart } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add chart object
      var chart = new Chart(scene, config);\nscene.add.existing(chart);\n
    "},{"location":"ui-chart/#add-chart-object","title":"Add chart object","text":"
    var chart = scene.rexUI.add.chart(x, y, width, height, config);\n
    • x, y : Position of this object.
    • width, height : Canvas size.
    • config : Configuration for creating chart.
      • Set undefined to not create chart at beginning.
    "},{"location":"ui-chart/#custom-class","title":"Custom class","text":"
    • Define class
      class MyChart extends RexPlugins.UI.Chart {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var chart = new MyChart(scene, x, y, width, height, config);\n
    "},{"location":"ui-chart/#create-chart","title":"Create chart","text":"

    Create chart (if not creating at beginning).

    chart.setChart(config);\n
    • config : Configuration for creating chart.
    "},{"location":"ui-chart/#chart-data","title":"Chart data","text":"
    • Get dataset
      var dataset = chart.getChartDataset(datasetIndex);\n
      • datasetIndex : Index number or label string.
    • Get data
      var data = chart.getChartData(datasetIndex, dataIndex);\n
      • datasetIndex : Index number or label string.
      • dataIndex : Index number or label string.
    • Set
      chart.setChartData(datasetIndex, dataIndex, value).updateChart();\n
      • datasetIndex : Index number or label string.
      • dataIndex : Index number or label string.
    "},{"location":"ui-chart/#manipulate-chart-object","title":"Manipulate chart object","text":"
    1. Get chart object
      var chart = chart.chart;\n
    2. Set properties of chart
      • Array of dataset
        var datasets = chart.data.datasets;\n
        • Label of dataset
          var label = chart.data.datasets[i].label;\n
      • Labels
        var labels = chart.data.labels;\n
      • Set chart data
        chart.data.datasets[datasetIndex].data[dataIndex] = value;\n
    3. Update chart
      chart.update();\n
    "},{"location":"ui-colorcomponents/","title":"Color components","text":""},{"location":"ui-colorcomponents/#introduction","title":"Introduction","text":"

    Edit color value by RGB, or HSV input fields. Clicking fist label can switch color format between RGB and HSV

    • Author: Rex
    • Game object
    "},{"location":"ui-colorcomponents/#live-demos","title":"Live demos","text":"
    • Color components
    "},{"location":"ui-colorcomponents/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-colorcomponents/#install-plugin","title":"Install plugin","text":""},{"location":"ui-colorcomponents/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add color-components object
      var colorComponents = scene.rexUI.add.colorComponents(config);\n
    "},{"location":"ui-colorcomponents/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add color-components object
      var colorComponents = scene.rexUI.add.colorComponents(config);\n
    "},{"location":"ui-colorcomponents/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ColorComponents } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add color-components object
      var colorComponents = new ColorComponents(scene, config);\nscene.add.existing(colorComponents);\n
    "},{"location":"ui-colorcomponents/#add-colorcomponents-object","title":"Add colorComponents object","text":"
    var colorComponents = scene.rexUI.add.colorComponents({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nformatLabel: {\nbackground: {\nradius: 0,\ncolor: undefined, alpha: undefined,\nstrokeColor: undefined, strokeAlpha: undefined, strokeWidth: 2\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nalign: 'left',  // 'left'|'center'|'right'|'justify'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n},\n\nspace: {left: 0, right: 0, top: 0, bottom: 0}\n},\n\n// formatLabel: labelGameObject,\n\ninputText: {\nwidth: undefined, height: undefined,\n\npadding: 0,  // {left: 0, right: 0, top: 0, bottom: 0}\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n\n// Style when focus\n// 'focus.color': ...\n// 'focus.color2': ...\n// 'focus.stroke': ...\n},\nfocusStyle: undefined,\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0,\n\n// Style when cursor move on\n// 'cursor.color': ...\n// 'cursor.backgroundColor': ...\n// 'cursor.xxx': ...\n},\ncursorStyle: undefined,\n\nwrap: {\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n},\nlineHeight: undefined,\nmaxLines: undefined,\nwrapWidth: undefined,\nletterSpacing: 0,\nhAlign: 0,\nvAlign: 'center',  // For single line text input\ncharWrap: true,    // For single line text input\n},\n\n// enterClose: true,\n// readOnly: false,\n\n// Callbacks\n// onOpen: function (textObject, hiddenInputText) {\n// },\n\n// onClose: function (textObject, hiddenInputText) {\n// },\n\n// onUpdate: function (text, textObject, hiddenInputText) {\n//     return text;\n// },   \n\n// onAddChar: function(child, index, canvasInput) {\n//    child.modifyStyle({...})\n// },\n\n// onCursorOut: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// onCursorIn: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n},\n\n// inputText0: canvasInputGameObject,\n// inputText1: canvasInputGameObject,\n// inputText2: canvasInputGameObject,\n\n// proportion: { formatLabel: 0 },\n\nvaluechangeCallback: function(newValue, oldValue, knob) {\n},\nvaluechangeCallbackScope: undefined,\n\nvalue: 0xffffff,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\nitem: 0\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,    \n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of colorComponents.
    • formatLabel : Clicking this label can switch color format between RGB and HSV
      • A label game object, or a text game object.
      • A plain object
        {\nbackground: {\nradius: 0,\ncolor: undefined, alpha: undefined,\nstrokeColor: undefined, strokeAlpha: undefined, strokeWidth: 2\n},\n\ntext: textStyle,\n\nspace: {left: 0, right: 0, top: 0, bottom: 0}\n}\n
        • formatLable.background : Parameters to create round rectangle game object.
        • formatLable.text : Text style to create [text.md] game object.
        • formatLabel.space : Padding space around format label.
    • inputText : Configuration of canvasInput
    • inputText0, inputText1, inputText2 : 3 canvas input game objects if parameter inputText is not given.
    • proportion :
      • proportion.formatLabel : Default value is 0.
    • valuechangeCallback : callback function when value changed.
    • value : Initial color value (0 ~ 0xffffff).
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between swatch and inputText.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-colorcomponents/#custom-class","title":"Custom class","text":"
    • Define class
      class MyColorComponents extends RexPlugins.UI.ColorComponents {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var colorComponents = new MyColorComponents(scene, config);\n
    "},{"location":"ui-colorcomponents/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    colorComponents.layout();\n

    See also - dirty

    "},{"location":"ui-colorcomponents/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = colorComponents.getElement('background');\n
      • Format-label game object
        var icon = colorComponents.getElement('formatLabel');\n
      • Color component input text game objects
        var textObjects = colorComponents.getElement('components');\n
        • textObjects : An arrray with 3 canvas input game objects.
    • Get by name
      var gameObject = colorComponents.getElement('#' + name);\n// var gameObject = colorComponents.getElement('#' + name, recursive);\n
      or
      var gameObject = colorComponents.getByName(name);\n// var gameObject = colorComponents.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-colorcomponents/#value","title":"Value","text":"

    Change value will also change the position of marker on H-palette and SV-palette

    • Get color value
      var value = colorComponents.value;\n// var value = colorComponents.color;\n
    • Set color value
      colorComponents.setValue(value);\n// colorComponents.setColor(value);\n
      or
      colorComponents.value = value;\ncolorComponents.color = value;\n
    "},{"location":"ui-colorcomponents/#events","title":"Events","text":"
    • On value changed
      colorComponents.on('valuechange', function(newValue, oldValue, colorComponents){\n//\n}, scope);\n
    "},{"location":"ui-colorcomponents/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-colorinput/","title":"Color input","text":""},{"location":"ui-colorinput/#introduction","title":"Introduction","text":"

    Color number (0x0~0xffffff) or color string ('#000000'~'#ffffff', or 'red') input field.

    • Author: Rex
    • Game object
    "},{"location":"ui-colorinput/#live-demos","title":"Live demos","text":"
    • Color input
    "},{"location":"ui-colorinput/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-colorinput/#install-plugin","title":"Install plugin","text":""},{"location":"ui-colorinput/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add color-input object
      var colorInput = scene.rexUI.add.colorInput(config);\n
    "},{"location":"ui-colorinput/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add color-input object
      var colorInput = scene.rexUI.add.colorInput(config);\n
    "},{"location":"ui-colorinput/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ColorInput } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add color-input object
      var colorInput = new ColorInput(scene, config);\nscene.add.existing(colorInput);\n
    "},{"location":"ui-colorinput/#add-colorinput-object","title":"Add colorInput object","text":"
    var colorInput = scene.rexUI.add.colorInput({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nswatch: undefined,\n// swatch: { shape: 'circle' },\n// swatch: { size: 30 },\n// swatch: swatchGameObject,\n// swatch: false,\n\n// swatchSize: undefined,  // or swatch: { size }\n// squareExpandSwatch: true,\n\ninputText: inputTextConfig,\n// inputText: false,\n\ncolorPicker : {\nwidth: 160, height: 170,\n\nbackground: {\nradius: 0,\ncolor: undefined, alpha: undefined,\nstrokeColor: undefined, strokeAlpha: undefined, strokeWidth: 2\n},\n// createBackgroundCallback: function(scene) {\n//     return gameObject;\n// }\n\n// hPalettePosition: 'bottom',\n\n// space: { left: 10, right: 10, top: 10, bottom: 10, item: 8 }\n},\n\ncolorComponents: {\n// height: undefined,\n\n// formatLabel: undefined,\n\n// inputText: undefined,\n\n// space: { item: 8 }\n},\n// colorComponents: false,\n\nvaluechangeCallback: function(newValue, oldValue, colorInput) {\n},\nvaluechangeCallbackScope: undefined,\n\nvalue: 0xffffff,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\ntext: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,    \n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of colorInput.
    • swatch : Display color value on a square, circle shape, or an image game object with tint.
      • undefein : A square swatch. Default game object.
      • A plain object : A circle, or a round square swatch.
        { shape: 'circle' }\n
        or
        { radius: 10 }\n
        or
        { radius: 10, size: 30 }\n
        • shape : (Round-) Rectangle or circle
          • 0, or 'rectangle' : (Round-) Rectangle shape.
          • 1, or 'circle' : Circle shape.
        • radius : Radius of round rectangle.
        • size : Size of swatch. Equal to swatchSize parameter.
      • An Image or Sprite game object : Tint this game object for displaying color value.
      • false : No swatch game object.
    • swatchSize :
      • A number : Size of swatch.
      • undefined : Expand size to fit inner height of color input. Default behavior.
    • squareExpandSwatch
      • true : Expand size to fit inner height of color input. Default behavior if swatchSize is set to undefined, or not given
      • false : Keep current size of swatch.
    • inputText : Configuration of canvasInput
    • colorPicker : Configuration of a drop-down color picker, triggered by clicking swatch.
      • colorPicker.width, colorPicker.height : Sizer of color picker. Default value is 180x170
      • colorPicker.background : Parameters to create round rectangle game object, optional.
      • colorPicker.createBackgroundCallback : Callback to create background game object, optional.
        function(scene) {\nreturn gameObject;\n}\n
      • colorPicker.hPalettePosition : Position of h-palette.
        • 'bottom' or 0 : Place h-palette at bottom side of sv-palette.
        • 'left' or 1 : Place h-palette at left side of sv-palette.
        • 'top' or 2 : Place h-palette at top side of sv-palette.
        • 'right' or 3 : Place h-palette at right side of sv-palette.
      • colorPicker.space : Padding space around color picker. Default value is
        { left: 10, right: 10, top: 10, bottom: 10, item: 8 }\n
      • false : No color picker.
    • colorComponents : Configuration of color components inside the drop down color picker.
      • colorComponents.height : Height of color components.
      • colorComponents.formatLabel : Clicking this label can switch color format between RGB and HSV
        • undefined : Will create a label with default text game object.
        • A plain object
          {\nbackground: {\nradius: 0,\ncolor: undefined, alpha: undefined,\nstrokeColor: undefined, strokeAlpha: undefined, strokeWidth: 2\n},\n\ntext: textStyle,\n\nspace: {left: 0, right: 0, top: 0, bottom: 0}\n}            
      • colorComponents.inputText : Configuration of canvasInput used in this color components. Will use inputText of color input if this parameter is not given.
      • colorComponents.space : Padding space around color components. Default value is
        { item: 8 }\n
      • false : No color components.
    • valuechangeCallback : callback function when value changed.
    • value : Initial color value (0 ~ 0xffffff).
      • Number : 0 ~ 0xffffff
      • String :
        • 0x0~0xffffff
        • '#000000'~'#ffffff'
        • 'red'
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between swatch and inputText.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-colorinput/#custom-class","title":"Custom class","text":"
    • Define class
      class MyColorInput extends RexPlugins.UI.ColorInput {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var colorInput = new MyColorInput(scene, config);\n
    "},{"location":"ui-colorinput/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    colorInput.layout();\n

    See also - dirty

    "},{"location":"ui-colorinput/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = colorInput.getElement('background');\n
      • Swatch game object
        var icon = colorInput.getElement('swatch');\n
      • Input text game object
        var textObject = colorInput.getElement('inputText');\n
    • Get by name
      var gameObject = colorInput.getElement('#' + name);\n// var gameObject = colorInput.getElement('#' + name, recursive);\n
      or
      var gameObject = colorInput.getByName(name);\n// var gameObject = colorInput.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-colorinput/#value","title":"Value","text":"

    Change value will also change the position of marker on H-palette and SV-palette

    • Get color value
      var value = colorInput.value;\n// var value = colorInput.color;\n
    • Set color value
      colorInput.setValue(value);\n// colorInput.setColor(value);\n
      or
      colorInput.value = value;\ncolorInput.color = value;\n
    "},{"location":"ui-colorinput/#events","title":"Events","text":"
    • On value changed
      colorInput.on('valuechange', function(newValue, oldValue, colorInput){\n//\n}, scope);\n
    "},{"location":"ui-colorinput/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-colorpicker/","title":"Color picker","text":""},{"location":"ui-colorpicker/#introduction","title":"Introduction","text":"

    Pick color value from H and SV palettes.

    • Author: Rex
    • Game object
    "},{"location":"ui-colorpicker/#live-demos","title":"Live demos","text":"
    • Color picker
    "},{"location":"ui-colorpicker/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-colorpicker/#install-plugin","title":"Install plugin","text":""},{"location":"ui-colorpicker/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add color-picker object
      var colorPicker = scene.rexUI.add.colorPicker(config);\n
    "},{"location":"ui-colorpicker/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add color-picker object
      var colorPicker = scene.rexUI.add.colorPicker(config);\n
    "},{"location":"ui-colorpicker/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ColorPicker } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add color-picker object
      var colorPicker = new ColorPicker(scene, config);\nscene.add.existing(colorPicker);\n
    "},{"location":"ui-colorpicker/#add-colorpicker-object","title":"Add colorPicker object","text":"
    var colorPicker = scene.rexUI.add.colorPicker({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nhPalette: {\nposition: 'bottom',\nsize: 10,\nwidth: undefined,\nheight: undefined,       },\n\nsvPalette: {\nwidth: undefined,\nheight: undefined,\n},\n\nvaluechangeCallback: function(newValue, oldValue, knob) {\n},\nvaluechangeCallbackScope: undefined,\n\nvalue: 0xffffff,\n\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,    \n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of colorPicker.
    • hPalette : Configuration of h-palette. H-palette is rendered on a canvas game object.
      • hPalette.position : Position of h-palette.
        • 'bottom' or 0 : Place h-palette at bottom side of sv-palette.
        • 'left' or 1 : Place h-palette at left side of sv-palette.
        • 'top' or 2 : Place h-palette at top side of sv-palette.
        • 'right' or 3 : Place h-palette at right side of sv-palette.
      • hPalette.size : Width (if position of h-palette is at left or right side) or height (if position of h-palette is at top or bottom side) of h-palette.
      • hPalette.width : Width (if position of h-palette is at left or right side) of h-palette.
      • hPalette.height : Height (if position of h-palette is at top or bottom side) of h-palette.
    • svPalette : Configuration of sv-palette. SV-palette is rendered on a canvas game object.
      • svPalette.width : Width of sv-palette.
      • svPalette.height : Height of sv-palette.
    • valuechangeCallback : callback function when value changed.
    • value : Initial color value (0 ~ 0xffffff).
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between sv-palette and h-palette.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-colorpicker/#custom-class","title":"Custom class","text":"
    • Define class
      class MyColorPicker extends RexPlugins.UI.ColorPicker {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var colorPicker = new MyColorPicker(scene, config);\n
    "},{"location":"ui-colorpicker/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    colorPicker.layout();\n

    See also - dirty

    "},{"location":"ui-colorpicker/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = colorPicker.getElement('background');\n
      • H-palette game object
        var icon = colorPicker.getElement('hPalette');\n
      • SV-palette game object
        var textObject = colorPicker.getElement('svPalette');\n
    • Get by name
      var gameObject = colorPicker.getElement('#' + name);\n// var gameObject = colorPicker.getElement('#' + name, recursive);\n
      or
      var gameObject = colorPicker.getByName(name);\n// var gameObject = colorPicker.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-colorpicker/#value","title":"Value","text":"

    Change value will also change the position of marker on H-palette and SV-palette

    • Get color value
      var value = colorPicker.value;\n// var value = colorPicker.color;\n
    • Set color value
      colorPicker.setValue(value);\n// colorPicker.setColor(value);\n
      or
      colorPicker.value = value;\ncolorPicker.color = value;\n
    "},{"location":"ui-colorpicker/#events","title":"Events","text":"
    • On value changed
      colorPicker.on('valuechange', function(newValue, oldValue, colorPicker){\n//\n}, scope);\n
    "},{"location":"ui-colorpicker/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-confirmaction/","title":"Confirm action","text":""},{"location":"ui-confirmaction/#introduction","title":"Introduction","text":"

    Create a modal confirm dialog temporary, invoke callback after clicking button.

    • Author: Rex
    • Method
    "},{"location":"ui-confirmaction/#live-demos","title":"Live demos","text":"
    • Confirm action
    "},{"location":"ui-confirmaction/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-confirmaction/#install-plugin","title":"Install plugin","text":""},{"location":"ui-confirmaction/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Run confirm action
      var dialog = scene.rexUI.confirmAction(scene, config);\n
      • dialog : Confirm dialog will be destroy after clicking any button.
    "},{"location":"ui-confirmaction/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Run confirm action
      var dialog = scene.rexUI.confirmAction(scene, config)\n
      • dialog : Confirm dialog will be destroy after clicking any button.
    "},{"location":"ui-confirmaction/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ConfirmAction } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Run confirm action
      var dialog = ConfirmAction(scene, config)\n
      • dialog : Confirm dialog will be destroy after clicking any button.
    "},{"location":"ui-confirmaction/#run-confirm-action","title":"Run confirm action","text":"
    var dialog = scene.rexUI.confirmAction(scene, {    style: confirmDialogConfig\n\ncontent: confirmDialogResetChoiceDisplayContentConfig,\n\n// modal: confirmDialogModalConfig,\n\n// onCreateDialog: function(dialog) { },\n\nconfirm: function() {},\n// confirmScope: \n// confirmButtonIndex: 0,\n\n// cancel: function() {},\n// cancelScope: \n// cancelButtonIndex: 1,\n})\n
    • Build confirm dialog
      • style : Config parameter of Confirm dialog
      • content : Content strings of title, content, button.
      • modal : Config parameter of modal method
      • onCreateDialog : Callback invoking after creating dialog.
        function(dialog) {\n\n}\n
    • Callbacks
      • confirm, confirmScope : Callback invoking when click confirm/OK button of Confirm dialog
      • confirmButtonIndex : Index of confirm/OK button on Confirm dialog. Default value is 0.
      • cancel, cancelScope : Callback invoking when click cancel/cancel button of Confirm dialog
      • cancelButtonIndex : Index of cancel/cancel button on Confirm dialog. Default value is 1.
    • dialog : Confirm dialog will be destroy after clicking any button.
    "},{"location":"ui-confirmactionbutton/","title":"Confirm action button","text":""},{"location":"ui-confirmactionbutton/#introduction","title":"Introduction","text":"

    Click this label to invoke ConfirmAction. It will create a modal confirm dialog temporary, invoke callback after clicking button.

    • Author: Rex
    • Game object
    "},{"location":"ui-confirmactionbutton/#live-demos","title":"Live demos","text":"
    • Open page
    "},{"location":"ui-confirmactionbutton/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-confirmactionbutton/#install-plugin","title":"Install plugin","text":""},{"location":"ui-confirmactionbutton/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add button object
      var button = scene.rexUI.add.confirmActionButton(config);\n
    "},{"location":"ui-confirmactionbutton/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add button object
      var button = scene.rexUI.add.confirmActionButton(config);\n
    "},{"location":"ui-confirmactionbutton/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ConfirmActionButton } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add button object
      var button = new ConfirmActionButton(scene, config);\nscene.add.existing(button);\n
    "},{"location":"ui-confirmactionbutton/#add-button-object","title":"Add button object","text":"
    var button = scene.rexUI.confirmActionButton({\n// Parameters of Label\n\n\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\nicon: iconGameObject,\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\n\naction: actionGameObject,\n// actionMask: false,\n// squareFitAction: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nalign: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0, iconLeft: 0, iconRight: 0,\n\ntext: 0,\nactionTop: 0, actionBottom: 0, actionLeft: 0, actionRight: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n\n// Parameter of building confirm dialog\nconfirmDialog: {\nstyle: confirmDialogConfig\n// content: confirmDialogResetChoiceDisplayContentConfig,\n// modal: confirmDialogModalConfig,\n// onCreateDialog: function(dialog) { },\n\n// confirmButtonIndex: 0,\n// cancelButtonIndex: 1,\n\n},\n\n// Callbacks\nconfirm: function() {},\n// confirmScope:\n\n// cancel: function() {},\n// cancelScope: \n});\n
    • Parameters of Label...
    • Parameter of building confirm dialog
      • confirmDialog.style : Config parameter of Confirm dialog
      • confirmDialog.content : Content strings of title, content, button. Can assign this value later.
      • confirmDialog.modal : Config parameter of modal method
      • confirmDialog.onCreateDialog : Callback invoking after creating dialog.
        function(dialog) {\n\n}\n
      • confirmDialog.confirmButtonIndex : Index of confirm/OK button on Confirm dialog. Default value is 0.
      • confirmDialog.cancelButtonIndex : Index of cancel/cancel button on Confirm dialog. Default value is 1.
    • Callbacks
      • confirm, confirmScope : Callback invoking when click confirm/OK button of Confirm dialog
      • cancel, cancelScope : Callback invoking when click cancel/cancel button of Confirm dialog

    Destroy confirm dialog after clicking confirm/OK, or cancel/cancel button.

    "},{"location":"ui-confirmactionbutton/#custom-class","title":"Custom class","text":"
    • Define class
      class MyButton extends RexPlugins.UI.ConfirmActionButton {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var button = new MyButton(scene, config);\n
    "},{"location":"ui-confirmactionbutton/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    button.layout();\n

    See also - dirty

    "},{"location":"ui-confirmactionbutton/#get-element","title":"Get element","text":"

    See Get element

    "},{"location":"ui-confirmactionbutton/#set-callbacks","title":"Set callbacks","text":"
    • Callback after clicking confirm/OK button of confirm dialog
      button.setConfirmCallback(callback);\n// button.setConfirmCallback(callback, scope);\n
      • callback : Any function object
        function() {\n\n}\n
    • Callback after clicking cancel/cancel button of confirm dialog
      button.setCancelCallback(callback);\n// button.setCancelCallback(callback, scope);\n
      • callback : Any function object
        function() {\n\n}\n
    "},{"location":"ui-confirmactionbutton/#set-display-content-of-confirm-dialog","title":"Set display content of confirm dialog","text":"
    button.setConfirmDialogContent({\ntitle: '',\ncontent: '',\nbuttonA: '',\nbuttonB: '',\n});\n

    or

    button.setConfirmDialogContent({\ntitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\ncontent: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbuttonA: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbuttonB: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nchoices: [\n{\ntext: '', value: undefined,\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n},        // ...\n]\n});\n
    • title, content,buttonA, buttonB : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
    • choices : Array of display content
      • A string : Set text of simple lable, also use this string as option value.
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
        • Property value : Option value.
    "},{"location":"ui-confirmactionbutton/#set-style-of-confirm-dialog","title":"Set style of confirm dialog","text":"
    button.setConfitmDialogStyle(style);\n
    • style : See Config parameter of Confirm dialog
    "},{"location":"ui-confirmactionbutton/#set-configuration-of-confirm-dialogs-modal-behavior","title":"Set configuration of confirm dialog's modal behavior","text":"
    button.setConfitmDialogModalConfig(config);\n
    • config : See Config parameter of modal method
    "},{"location":"ui-confirmactionbutton/#disalbe-confirm-dialog","title":"Disalbe confirm dialog","text":"

    Run confirm callback directly without confirm dialog.

    button.setConfirmDialogEnable(false);\n
    "},{"location":"ui-confirmactionbutton/#other-properties","title":"Other properties","text":"

    See label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-confirmdialog/","title":"Confirm dialog","text":""},{"location":"ui-confirmdialog/#introduction","title":"Introduction","text":"

    Using json style to create confirm dialog, composed of simple-label title, simple-label content, with simple-label 0, 1, or 2 action button(s).

    • Author: Rex
    • Game object
    "},{"location":"ui-confirmdialog/#live-demos","title":"Live demos","text":"
    • Yes-no buttons
    • Ok button
    • Any-touch closing
    • TextArea content
    • Radio-choices
    "},{"location":"ui-confirmdialog/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-confirmdialog/#install-plugin","title":"Install plugin","text":""},{"location":"ui-confirmdialog/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add dialog object
      var dialog = scene.rexUI.add.confirmDialog(style).resetDisplayContent(config);\n// var dialog = scene.rexUI.add.confirmDialog(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-confirmdialog/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dialog object
      var dialog = scene.rexUI.add.confirmDialog(style).resetDisplayContent(config);\n// var dialog = scene.rexUI.add.confirmDialog(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-confirmdialog/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ConfirmDialog } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dialog object
      var dialog = new ConfirmDialog(scene, config);\n// var dialog = new ConfirmDialog(scene, config, creators);\nscene.add.existing(dialog);\ndialog.resetDisplayContent(config);\n
    "},{"location":"ui-confirmdialog/#add-dialog-object","title":"Add dialog object","text":"
    var dialog = scene.rexUI.add.confirmDialog({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundStyle,\n// background: null,\n\ntitle: titleStyle,  // SimpleLabelConfig\n// title: null,\n\ncontent: contentStyle, // SimpleLabelConfig, or TextAreaStyle\n// content: null,\n\nbuttonMode: 0,  // 0|1|2\n\nbutton: SimpleLabelConfig,\n// buttonA: SimpleLabelConfig\n// buttonB: SimpleLabelConfig\n\n// choice: SimpleLabelConfig,\n// choicesType\n// choicesWidth: undefined,\n// choicesHeight: undefined,\n\n// Space\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntitle: 0,\ntitleLeft: 0,\ntitleRight: 0,\n\ncontent: 0,\ncontentLeft: 0,\ncontentRight: 0,\n\nactionsLeft: 0,\nactionsRight: 0,\naction: 0,\n\nchoices: 0,\nchoicesLeft: 0,\nchoicesRight: 0,\nchoice: 0,\nchoiceLine: 0,\nchoiceColumn: 0, choiceRow: 0,\nchoicesBackgroundLeft: 0,\nchoicesBackgroundRight: 0,\nchoicesBackgroundTop: 0,\nchoicesBackgroundBottom: 0,\n},\n\nproportion: {\ntitle: 0,\ncontent: 0,\nactions: 0,\nchoices: 0,\n},\n\nexpand: {\ntitle: true,\ncontent: true,\nactions: false,\nchoices: true,\n},\n\nalign: {\ntitle: 'center',\ncontent: 'center',\nactions: 'center',\nchoices: 'center',\n},\n\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\nmodal: {\ncover: {\ncolor: 0x0,\nalpha: 0.8,\ntransitIn: function(gameObject, duration) { },\ntransitOut: function(gameObject, duration) { },\n},\n// cover: false, \n\n// When to close modal dialog?\ntouchOutsideClose: false,\nanyTouchClose: false,\ntimeOutClose: false,\nmanualClose: false,\n\nduration: {\nin: 200,\nhold: 2000,\nout: 200\n}\n\ntransitIn: 0,\ntransitOut: 0,\n\ndestroy: true,\n\ndefaultBehavior: true,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n// confirmButtonIndex: 0,\n// cancelButtonIndex: 1,\n\n}, creators);\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • title :
      • Styles of simple-label
      • null : Don't create any game object.
    • content :
      • Styles of simple-label : Create Label as content element.
      • Style of TextArea : Create TextArea as content element.
      • null : Don't create any game object.
    • buttonMode : 0, 1, or 2
      • 0 : No action button, any touch can close modal dialog
      • 1, 2 : Dialog with 1 or 2 action buttons, clicking any action button to close modal dialog.
    • button, buttonA, buttonB, choice :
      • Styles of simple-label, optional.
    • choicesType : Sizer type (Buttons/FixWidthButtons/GridButtons) and behavior (''/'radio'/'checkboxes') of choice buttons.
      • undefined, '', or 'y' : Buttons in vertical/horizontal without any extra behavior, default behavior.
      • 'radio', or 'x-radio' : Buttons in vertical/horizontal, with radio behavior.
        • Name of selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName().
      • 'checkboxes', or 'x-checkboxes' : Buttons in vertical/horizontal, with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
      • 'wrap' : FixWidthButtons without any extra behavior, default behavior.
      • 'wrap-radio' : FixWidthButtons with radio behavior.
        • Name of Selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName()
      • 'wrap-checkboxes' : FixWidthButtons with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
    • choicesWidth, choicesHeight : Minimum width, minimum height of choices.
      • Must assign choicesHeight value if using GridButtons choices.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.title : Space between title game object and below game object.
      • space.titleLeft, space.titleRight : Extra left/right padding of title game object.
      • space.content : Space between content game object and below game object.
      • space.contentLeft, space.contentRight : Extra left/right padding of content game object.
      • space.action : Space between each action-button game objects.
    • proportion : Keep height of element, or expand height of element.
      • proportion.title : Set to 1 to expand height of title. Default is 0.
      • proportion.content : Set to 1 to expand height of content. Default is 0.
      • proportion.actions : Set to 1 to expand height of actions. Default is 0.
    • expand : Expand width of element
      • expand.title : Set true to expand width of title game object. Default is true.
      • expand.content : Set true to expand width of content game object. Default is true.
      • expand.actions : Set true to expand width of actions game object. Default is false.
    • align : Align element
      • align.title
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value. Will add Spaces at right and left sides.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center. Will add a Space at right side.
      • align.content : Align content game object to 'left'/'center'/'right', if expand.content is false.
      • align.actions : Align action game objects to 'left'/'center'/'right', if expand.actions is false.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • modal : Configuration of modal, See Modal behavior.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false..
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • confirmButtonIndex, cancelButtonIndex : Button index for firing 'confirm', 'cancel' events. Default values are 0, 1.
    • creators : Callbacks for creating components.
      {\nbackground: undefined,\ntitle: undefined,\ncontent: undefined,\nbutton: undefined,\nbuttonA: undefined,\nbuttonB: undefined,\n}\n
      • creators.background : Callback to create background of dialog. Default behavior is creating a round-rectangle-shape.
        function(scene, config)  {\nreturn gameObject;\n}\n
      • creators.title, creators.content, creators.button, creators.buttonA, creators.buttonB : Creators of simple-label, included these properties
        {\nbackground: undefined,\ntext: undefined,\nicon: undefined,\naction: undefined,\n}\n
    "},{"location":"ui-confirmdialog/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDialog extends RexPlugins.UI.ConfirmDialog {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dialog = new MyDialog(scene, config, creators);\n
    "},{"location":"ui-confirmdialog/#reset-display-content","title":"Reset display content","text":"
    dialog.resetDisplayContent({\ntitle: '',\ncontent: '',\nbuttonA: '',\nbuttonB: '',\n});\n

    or

    dialog.resetDisplayContent({\ntitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\ncontent: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbuttonA: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbuttonB: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nchoices: [\n{\ntext: '', value: undefined,\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n},        // ...\n]\n});\n
    • title, content : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
      • null : Hide title or content element.
    • buttonA, buttonB : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
    • choices : Array of display content
      • A string : Set text of simple lable, also use this string as option value.
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
        • Property value : Option value.

    Run dialog.layout() after this method, to layout children again.

    "},{"location":"ui-confirmdialog/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    dialog.layout();\n

    See also - dirty

    "},{"location":"ui-confirmdialog/#modal","title":"Modal","text":"

    Pop this dialog as modal dialog, close this modal dialog under these conditions :

    • Clicking any action button.
    • Clicking any choice button and no action button on dialog.
    dialog.modal(onClose);  // Use default modal config\n

    or

    dialog.modal({\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0,\n// transitOut: 0,\n\n// destroy: true\n}, onClose);\n

    or

    dialog\n.modalPromise(config)\n.then(function(data){\n\n})\n
    • config : See Modal behavior
      • config.defaultBehavior :
        • undefined, or true : Will close modal dialog when clicking any action button.
        • false : Disable default behavior.
    • onClose : Callback when closing modal dialog
      function(data) {\n// var index = data.index;\n// var text = data.text;\n// var value = data.value;\n// var button = data.button;\n// var dialog = data.dialog;\n}\n
      • data : Contains these properties
        • data.index : Index of clicking action button
        • data.text : button.text, this property is valided if button game object is a label.
        • data.value :
          • A single value : Return selected value, if choicesType is 'radio'
          • A dictionary contains {value: boolean} : Return selected values, if choicesType is 'checkboxes'
          • undefined : Default value
        • data.button : Clicked button game object.
        • data.dialog : This dialog game object.
    "},{"location":"ui-confirmdialog/#button-index","title":"Button index","text":"
    • Confirm button
      • Get
        var confirmButtonIndex = dialog.confirmButtonIndex;\n
      • Set
        dialog.setConfirmButtonIndex(index);\n// dialog.confirmButtonIndex = index;\n
    • Cancel button
      • Get
        var cancelButtonIndex = dialog.cancelButtonIndex;\n
      • Set
        dialog.setCancelButtonIndex(index);\n// dialog.cancelButtonIndex = index;\n
    "},{"location":"ui-confirmdialog/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = dialog.getElement('background');\n
      • Title game object
        var title = dialog.getElement('title');\n
      • Content game object
        var content = dialog.getElement('content');\n
      • Buttons game object
        var buttonA = dialog.getElement('buttonA');\nvar buttonB = dialog.getElement('buttonB');\n
    • Get by name
      var gameObject = dialog.getElement('#' + name);\n// var gameObject = dialog.getElement('#' + name, recursive);\n
      or
      var gameObject = dialog.getByName(name);\n// var gameObject = dialog.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-confirmdialog/#other-properties","title":"Other properties","text":"

    See dialog, sizer object, base sizer object, container-lite.

    "},{"location":"ui-confirmdialog/#events","title":"Events","text":"
    • Click confirm button
      dialog.on('confirm', function (data) {\n// var index = data.index;\n// var text = data.text;\n// var value = data.value;\n// var button = data.button;\n// var dialog = data.dialog;\n}, scope);\n
      • data : See modal
    • Click cancel button
      dialog.on('cancel', function (data) {\n// var index = data.index;\n// var text = data.text;\n// var value = data.value;\n// var button = data.button;\n// var dialog = data.dialog;\n}, scope);\n
      • data : See modal
    "},{"location":"ui-dialog/","title":"Dialog","text":""},{"location":"ui-dialog/#introduction","title":"Introduction","text":"

    A container with a title, content, buttons and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-dialog/#live-demos","title":"Live demos","text":"
    • Dialog
    • Yes-no dialog
    • Action buttons with Space
    • Radio choices dialog
    • Horizontal-radio choices dialog
    • Wrap-radio choices dialog
    • Wrap-checkboxes choices dialog
    • Grid-checkboxes choices dialog
    • Popup/scaledown
      • Pop-up dialog
    • Ease-in, ease-out
    • Show/hide buttons
    • Add button
    • Wrap label
    • Modal dialog
    • Content sizer
    "},{"location":"ui-dialog/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-dialog/#install-plugin","title":"Install plugin","text":""},{"location":"ui-dialog/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add dialog object
      var dialog = scene.rexUI.add.dialog(config);\n
    "},{"location":"ui-dialog/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dialog object
      var dialog = scene.rexUI.add.dialog(config);\n
    "},{"location":"ui-dialog/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Dialog } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dialog object
      var dialog = new Dialog(scene, config);\nscene.add.existing(dialog);\n
    "},{"location":"ui-dialog/#add-dialog-object","title":"Add dialog object","text":"
    var dialog = scene.rexUI.add.dialog({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundGameObject,\n\ntitle: titleGameObject,\n\ntoolbarBackground: toolbarBackgroundGameObject,\ntoolbar: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\nleftToolbarBackground: leftToolbarBackgroundGameObject,\nleftToolbar: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\ncontent: contentGameObject,\n\ndescription: descriptionGameObject,\n\nchoicesType: '',\n// choicesWidth: undefined,\n// choicesHeight: undefined,  // Used when choicesType is `'grid'`, `'grid-radio'`, or `'grid-checkboxes'`\nchoicesBackground: choicesBackgroundGameObject,\nchoices: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\nactionsBackground: actionsBackgroundGameObject,\nactions: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\n// Space\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntitle: 0,\ntitleLeft: 0,\ntitleRight: 0,\ntitleTop: 0,\n\ntoolbarItem: 0,\nleftToolbarItem: 0,\n\ncontent: 0,\ncontentLeft: 0,\ncontentRight: 0,\n\ndescription: 0,\ndescriptionLeft: 0,\ndescriptionRight: 0\n\nchoices: 0,\nchoicesLeft: 0,\nchoicesRight: 0,\n\n// choiceLine: 0,   // Used when choicesType is `'wrap'`, `'wrap-radio'`, or `'wrap-checkboxes'`\n// choiceColumn: 0, // Used when choicesType is `'grid'`, `'grid-radio'`, or `'grid-checkboxes'`\n// choiceRow: 0,    // Used when choicesType is `'grid'`, `'grid-radio'`, or `'grid-checkboxes'`\nchoicesBackgroundLeft: 0,\nchoicesBackgroundRight: 0,\nchoicesBackgroundTop: 0,\nchoicesBackgroundBottom: 0,\n\naction: 0,\nactionsLeft: 0,\nactionsRight: 0,\nactionsBottom: 0,\n\n},\n\nproportion: {\ntitle: 0,\ncontent: 0,\ndescription: 0,\nchoices: 0,\nactions: 0,\n},\n\nexpand: {\ntitle: true,\ncontent: true,\ndescription: true,\nchoices: true,\nactions: false,\n},\n\nalign: {\ntitle: 'center',\ncontent: 'center',\ndescription: 'center',\nchoices: 'center',\nactions: 'center',\n},\n\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n}\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of dialog.
    • title : Game object of title, optional.
    • toolbar : Array of Game objects for toolbar-buttons group which arranged from left to right, optional.
      • [] : Assign an empty array if user will add button later.
    • toolbarBackground : Game object of toolbar buttons background, optional. This background game object will be resized to fit the size of dialog.
    • leftToolbar : Array of Game objects for left-toolbar-buttons group which arranged from left to right, optional.
      • [] : Assign an empty array if user will add button later.
    • leftToolbarBackground : Game object of leftToolbar buttons background, optional. This background game object will be resized to fit the size of dialog.
    • content : Game object of content, optional.
    • description : Game object of description, optional.
    • choices : Array of Game objects for choice-buttons group which arranged from top to bottom, optional.
      • Array of Game objects, for Buttons/FixWidthButtons choices.
        • [] : Assign an empty array if user will add button later.
      • 2d Array of Game objects, for GridButtons choices..
    • choicesBackground : Game object of choices buttons background, optional. This background game object will be resized to fit the size of dialog.
    • choicesType : Sizer type (Buttons/FixWidthButtons/GridButtons) and behavior (''/'radio'/'checkboxes') of choice buttons.
      • undefined, 'x', or 'y' : Buttons in vertical/horizontal without any extra behavior, default behavior.
      • 'radio', or 'x-radio' : Buttons in vertical/horizontal, with radio behavior.
        • Name of selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName().
      • 'checkboxes', or 'x-checkboxes' : Buttons in vertical/horizontal, with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
      • 'wrap' : FixWidthButtons without any extra behavior, default behavior.
      • 'wrap-radio' : FixWidthButtons with radio behavior.
        • Name of Selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName()
      • 'wrap-checkboxes' : FixWidthButtons with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
      • 'grid' : GridButtons without any extra behavior, default behavior.
      • 'grid-radio' : GridButtons with radio behavior.
        • Name of Selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName()
      • 'grid-checkboxes' : GridButtons with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
    • choicesWidth, choicesHeight : Minimum width, minimum height of choices.
      • Must assign choicesHeight value if using GridButtons choices.
    • actions : Array of Game objects, or Space (scene.rexUI.add.space()) for action-buttons group which arranged from left to right, optional.
      • [] : Assign an empty array if user will add button later.
    • choicesBackground : Game object of choices buttons background, optional. This background game object will be resized to fit the size of dialog.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.title : Space between title game object and below game object.
      • space.titleLeft, space.titleRight : Extra left/right padding of title game object.
      • space.content : Space between content game object and below game object.
      • space.contentLeft, space.contentRight : Extra left/right padding of content game object.
      • space.description : Space between description game object and below game object.
      • space.descriptionLeft, space.descriptionRight : Extra left/right padding of description game object.
      • space.choices : Space between last choice-button and below game object.
      • space.choicesLeft, space.choicesRight : Extra left/right padding of choice buttons.
      • space.actionsLeft, space.actionsRight : Extra left/right padding of actions buttons.
      • space.toolbarItem : Space between each toolbar item game objects.
      • space.leftToolbarItem : Space between each left-toolbar item game objects.
      • space.choice : Space between each choice-button game objects.
      • space.choicesBackgroundLeft, space.choicesBackgroundRight, space.choicesBackgroundTop, space.choicesBackgroundBottom : Padding space around choices-background.
      • space.action : Space between each action-button game objects.
    • proportion : Keep height of element, or expand height of element.
      • proportion.title : Set to 1 to expand height of title. Default is 0.
      • proportion.content : Set to 1 to expand height of content. Default is 0.
      • proportion.description : Set to 1 to expand height of description. Default is 0.
      • proportion.choices : Set to 1 to expand height of choices. Default is 0.
      • proportion.actions : Set to 1 to expand height of actions. Default is 0.
    • expand : Expand width of element
      • expand.title : Set true to expand width of title game object. Default is true.
      • expand.content : Set true to expand width of content game object. Default is true.
      • expand.description : Set true to expand width of description game object. Default is true.
      • expand.choices : Set true to expand width of choices game object. Default is true.
      • expand.actions : Set true to expand width of actions game object. Default is false.
    • align : Align element
      • align.title
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value. Will add Spaces at right and left sides.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center. Will add a Space at right side.
      • align.content : Align content game object to 'left'/'center'/'right', if expand.content is false.
      • align.description : Align description game object to 'left'/'center'/'right', if expand.description is false.
      • align.choices : Align choices game object to 'left'/'center'/'right', if expand.choices is false.
      • align.actions : Align action game objects to 'left'/'center'/'right', if expand.actions is false.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false..
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-dialog/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDialog extends RexPlugins.UI.Dialog {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dialog = new MyDialog(scene, config);\n
    "},{"location":"ui-dialog/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    dialog.layout();\n

    See also - dirty

    "},{"location":"ui-dialog/#modal","title":"Modal","text":"

    Pop this dialog as modal dialog, clicking any action button to close this modal dialog.

    dialog.modal({\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0, // 0|'popUp'|1|'fadeIn'\n// transitIn: function(gameObject, duration) { },\n\n// transitOut: 0, // 0|'scaleDown'|1|'fadeOut'\n// transitOut: function(gameObject, duration) { },\n\n// destroy: true,\n\n// defaultBehavior: true,\n});\n// dialog.modal(config, onClose);\n

    or

    dialog\n.modalPromise(config)\n.then(function(data){\n\n})\n
    • config : See Modal behavior
      • config.defaultBehavior :
        • undefined, or true : Will close modal dialog when clicking any action button.
        • false : Disable default behavior. User has to invoke dialog.modalClose(data) manually.
    • onClose : Callback when closing modal dialog
      function(data) {\n// var index = data.index;\n// var text = data.text;\n// var button = data.button;\n// var dialog = data.dialog;\n}\n
      • data : Contains these properties
        • data.index : Index of clicking action button
        • data.text : button.text, this property is valided if button game object is a label.
        • data.button : Clicked button game object.
        • data.dialog : This dialog game object.
    "},{"location":"ui-dialog/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-dialog/#events","title":"Events","text":"
    • Click button
      dialog.on('button.click', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'choices', 'actions', or 'toolbar', 'leftToolbar'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over button
      dialog.on('button.over', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object
      • groupName : 'choices', 'actions', 'toolbar', or 'leftToolbar'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-out button
      dialog.on('button.out', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'choices', 'actions', 'toolbar', or 'leftToolbar'
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Enable button's input
      dialog.on('button.enable', function(button, groupName, index) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.enable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.enable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.enable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.enable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'choices', 'actions', 'toolbar', or 'leftToolbar'
      • index : Index of triggered button game object.
    • Disable button's input
      dialog.on('button.disable', function(button, groupName, index) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.disable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.disable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.disable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.disable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'choices', 'actions', 'toolbar', or 'leftToolbar'
      • index : Index of triggered button game object.
    "},{"location":"ui-dialog/#emit-button-click-event","title":"Emit button click event","text":"
    • Emit choice/action/toolbar/left-toolbar button's click event
      dialog.emitChoiceClick(index);\ndialog.emitActionClick(index);\ndialog.emitToolbarClick(index);\ndialog.emitLeftToolbarClick(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-dialog/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = dialog.getElement('background');\n
      • Title game object
        var title = dialog.getElement('title');\n
      • Content game object
        var content = dialog.getElement('content');\n
      • Description game object
        var description = dialog.getElement('description');\n
      • Choice button game object
        var buttons = dialog.getElement('choices');\n
        or
        var button = dialog.getChoice(index);\n
        or
        var button = dialog.getElement('choices[' + index + ']');\n
      • Action button game object
        var buttons = dialog.getElement('actions');\n
        or
        var button = dialog.getAction(index);\n
        or
        var button = dialog.getElement('actions[' + index + ']');\n
      • Toolbar button game object
        var buttons = dialog.getElement('toolbar');\n
        or
        var button = dialog.getToolbar(index);\n
        or
        var button = dialog.getElement('toolbar[' + index + ']');\n
      • Left-toolbar button game object
        var buttons = dialog.getElement('leftToolbar');\n
        or
        var button = dialog.getLeftToolbar(index);\n
        or
        var button = dialog.getElement('leftToolbar[' + index + ']');\n
    • Get by name
      var gameObject = dialog.getElement('#' + name);\n// var gameObject = dialog.getElement('#' + name, recursive);\n
      or
      var gameObject = dialog.getByName(name);\n// var gameObject = dialog.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-dialog/#add-button","title":"Add button","text":"

    Add choice/action/toolbar/left-toolbar button

    dialog.addChoice(gameObject);\ndialog.addAction(gameObject);\ndialog.addToolbar(gameObject);\ndialog.addLeftToolbar(gameObject);\n
    • gameObject : A game object, or an array of game objects.
    "},{"location":"ui-dialog/#remove-button","title":"Remove button","text":"
    • Remove a choice/action/toolbar/left-toolbar button
      dialog.removeChoice(index, destroyChild);\ndialog.removeAction(index, destroyChild);\ndialog.removeToolbar(index, destroyChild);\ndialog.removeLeftToolbar(index, destroyChild);\n
      • index : A number index, a string name, or a button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove all choice/action/toolbar/left-toolbar buttons
      dialog.clearChoices(destroyChild);\ndialog.clearActions(destroyChild);\ndialog.clearToolbar(destroyChild);\ndialog.clearLeftToolbar(destroyChild);\n
      • destroyChild : Set true to destroy button game object.
    "},{"location":"ui-dialog/#enabledisable-input-of-button","title":"Enable/disable input of button","text":"
    • Enable choice/action/toolbar/left-toolbar button
      dialog.setChoiceEnable(index);\ndialog.setActionEnable(index);\ndialog.setToolbarEnable(index);\ndialog.setLeftToolbarEnable(index);\n
      • index : A number index, or a button game object.
    • Enable all buttons
      dialog.setAllButtonsEnable();\n
    • Disable choice/action/toolbar/left-toolbar button's input
      dialog.setChoiceEnable(index, false);\ndialog.setActionEnable(index, false);\ndialog.setToolbarEnable(index, false);\ndialog.setLeftToolbarEnable(index, false);\n
      • index : A number index, or a button game object.
    • Disable all buttons
      dialog.setAllButtonsEnable(false);\n
    • Toggle choice/action/toolbar/left-toolbar button's input
      dialog.toggleChoiceEnable(index);\ndialog.toggleActionEnable(index);\ndialog.toggleToolbarEnable(index);\ndialog.toggleLeftToolbarEnable(index);\n
      • index : A number index, or a button game object.
    • Get choice/action/toolbar/left-toolbar button's input enable
      var enabled = dialog.getChoiceEnable(index);\nvar enabled = dialog.getActionEnable(index);\nvar enabled = dialog.getToolbarEnable(index);\nvar enabled = dialog.getLeftToolbarEnable(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-dialog/#showhide-button","title":"Show/hide button","text":"

    Hidden elements won't be counted when layouting. Call dialog.layout(), or topSizer.layout() after show/hide any button.

    • Show choice/action/toolbar/left-toolbar button
      dialog.showChoice(index);\ndialog.showAction(index);\ndialog.showToolbar(index);\ndialog.showLeftToolbar(index);\n
      • index : A number index, a string name, or a button game object.
    • Hide choice/action/toolbar/left-toolbar button.
      dialog.hideChoice(index);\ndialog.hideAction(index);\ndialog.hideToolbar(index);\ndialog.hideLeftToolbar(index);\n
      • index : A number index, a string name, or a button game object.
    "},{"location":"ui-dialog/#for-each-button","title":"For each button","text":"
    dialog.forEachChoice(callback, scope);\ndialog.forEachAction(callback, scope);\ndialog.forEachToolbar(callback, scope);\ndialog.forEachLeftToolbar(callback, scope);\n
    • callback :
      function(button, index, buttons) {\n// ...\n}\n
    "},{"location":"ui-dialog/#state-of-choices-buttons","title":"State of choices buttons","text":""},{"location":"ui-dialog/#radio","title":"Radio","text":"
    • Read state
      var value = dialog.getChoicesSelectedButtonName();\n
    • Set state
      dialog.setChoicesSelectedButtonName(name);\n
    "},{"location":"ui-dialog/#checkboxes","title":"Checkboxes","text":"
    • Read states
      var states = dialog.getChoicesButtonStates();\n
      • states : {name: boolean}
    • Set state
      dialog.setChoicesButtonState(name, state);\n
      • name : Name of button game object
      • state : Set true if button is selected
    • Clear all states to false
      dialog.clearChoicesButtonStates();\n
    "},{"location":"ui-dialog/#events_1","title":"Events","text":"
    • On button state changed. For Checkboxes/radio
      dialog.on('button.statechange', function(button, groupName, index, value, previousValue) {\n// ...\n}, scope);\n
      • Can be used to replace setValueCallback.
    "},{"location":"ui-dropdownlist/","title":"Drop down list","text":""},{"location":"ui-dropdownlist/#introduction","title":"Introduction","text":"

    A label can open a drop-down list panel.

    • Author: Rex
    • Game object
    "},{"location":"ui-dropdownlist/#live-demos","title":"Live demos","text":"
    • Drop-down list
    • Drop-down wrap-list
    • Custom transit
    • Align to right side
    • Cursor select
    • Drop-down scrollable-list
    "},{"location":"ui-dropdownlist/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-dropdownlist/#install-plugin","title":"Install plugin","text":""},{"location":"ui-dropdownlist/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add drop-down list object
      var dropDownList = scene.rexUI.add.dropDownList(config);\n
    "},{"location":"ui-dropdownlist/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add drop-down list object
      var dropDownList = scene.rexUI.add.dropDownList(config);\n
    "},{"location":"ui-dropdownlist/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { DropDownList } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dropDownList object
      var dropDownList = new DropDownList(scene, config);\nscene.add.existing(dropDownList);\n
    "},{"location":"ui-dropdownlist/#add-drop-down-list-object","title":"Add drop-down list object","text":"
    var dropDownList = scene.rexUI.add.dropDownList({\noptions: [\noption0,\noption1,\n// ...\n],\n\nlist: {\n// createBackgroundCallback: function(scene) {\n//     // this : dropDownList\n//     return gameObject;\n// },\n\ncreateButtonCallback: function(scene, option, index, options) {\n// this : dropDownList\nreturn gameObject;\n},\n\n// createTrackCallback: function(scene) {\n//     // this : dropDownList\n//     return gameObject;\n// },\n\n// createThumbCallback: function(scene) {\n//     // this : dropDownList\n//     return gameObject;\n// },\n\nmouseWheelScroller: undefined,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\nonButtonClick: function(button, index, pointer, event) {\n// this : dropDownList\n},\n\n// onButtonOver: function(button, index, pointer, event) {\n//     // this : dropDownList\n// },\n\n// onButtonOut: function(button, index, pointer, event) {\n//     // this : dropDownList\n// },\n\n// easeIn: 500,\n// transitIn: undefined,\n// transitIn: function(listPanel, duration) {  },\n\n// easeOut: 100,\n// transitOut: undefined,\n// transitOut: function(listPanel, duration) {  },\n\n// wrap: false,\n// maxHeight: undefined,\n// width: undefined, \n// height: undefined,\n// alignParent: 'text',\n// alignSide: '',\n// expandDirection: 0,\n// bounds: undefined,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0, item: 0,\n//     line: 0\n// },\n\n// draggable: false\n},\n\nsetValueCallback: function(dropDownList, value, previousValue) {\n\n},\nsetValueCallbackScope: undefined,\nvalue: undefined,\n\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\naction: actionGameObject,\nactionMask: false,\nalign: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\ntext: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • options : Array of strings, or objects.
    • list : Configuration of list panel.
      • list.createBackgroundCallback : Create background of list panel
        function(scene) {\n// this : dropDownList\nreturn gameObject;\n}\n
      • list.createButtonCallback : Create option button of list panel
        function(scene, option, index, options) {\n// this : dropDownList\nreturn gameObject;\n}\n
      • list.createTrackCallback : Create slider's track of list panel, optional.
        function(scene) {\n// this : dropDownList\nreturn gameObject;\n}\n
      • list.createThumbCallback : Create slider's thumb of list panel, optional.
        function(scene) {\n// this : dropDownList\nreturn gameObject;\n}\n
      • list.mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
        • list.mouseWheelScroller.focus :
          • false, or 0 : Without checking if cursor is over game object or not.
          • true, or 1 : Cursor is inside the rectangle bounds of game object. Default behavior.
          • 2 : Cursor is over game object.
        • list.mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
        • Set to false to skip creating mouse-wheel-scroller. Default behavior.
      • list.onButtonClick : Callback when clicking a button
        function(button, index, pointer, event) {\n// this : dropDownList\n}\n
      • list.onButtonOver : Callback when pointer over a button
        function(button, index, pointer, event) {\n// this : dropDownList\n}\n
      • list.onButtonOut : Callback when pointer out a button
        function(button, index, pointer, event) {\n// this : dropDownList\n}\n
      • list.easeIn : Pop-up duration in ms. Default value is 500.
      • list.transitIn : Tween behavior of opening list panel.
        • undefined : Expand list panel by pop-up, default behavior.
        • Custom callback
          function(listPanel, duration) {\n\n}\n
      • list.easeOut : Scale-down duration in ms. Default value is 100.
      • list.transitOut : Tween behavior of closing list panel.
        • undefined : Closing list panel by scale-down, default behavior.
        • Custom callback
          function(listPanel, duration) {\n\n}\n
      • list.wrap : Layout mode of buttons
        • true : fixwidth-sizer layout.
        • false : sizer layout. Default behavior.
      • list.maxHeight : If height of button list is larger than this maxHeight, put this button list into scrollable panel.
        • undefined, or 0 : Ignore this behavior.
        • > 0 and list.createThumbCallback parameter is given : If height of button list is larger than this maxHeight, put this button list into scrollable panel.
      • list.width : Minimum width.
        • undefined : Minimum width of panel will equal to width of parent label. Default value.
        • A number : Width of panel. Required fields when list.wrap is true.
      • list.height : Minimum height.
        • undefined : Create button list or wrap button list. Default value.
        • > 0 and list.createThumbCallback parameter is given : Create scrollable button list or wrap button list.
      • list.alignParent : Align x position to label.
        • 'icon' : Align x position to icon game object of parent label.
        • 'text' : Align x position to text game object of parent label. Default behavior
        • 'label', or null : Align x position to parent label.
      • list.alignSide : Align list to label's left or right side.
        • undefined, or 'left' : Align list's left side to label's left side. Default behavior.
        • 'right : Align list's right side to label's right side. Default behavior.
      • list.expandDirection :
        • 0, 'down' : Expand list down. i.e. list panel will put below parent label.
        • 1, 'up' : Expand list up. i.e. list panel will put above parent label.
      • list.bounds : Put list panel below parent label if bottom of list panel is inside bounds (Rectangle)
        • undefined : Use viewport as bounds
        • Rectangle
      • list.space : space properties of list panel.
        • left, right, top, bottom, item : For sizer layout. (list.wrap is false)
        • left, right, top, bottom, item, line : For fixwidth-sizer layout. (list.wrap is true)
      • list.draggable : Set true to drag top-most object.
    • value, setValueCallback, setValueCallbackScope : See value
      function(dropDownList, value, previousValue) {\n\n}\n
    • Properties of Label
      • x, y : Position of this object, it is valid when this object is the top object.
      • anchor : See anchor.
        • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
          • Percentage of visible width/height : 'p%', p: 0 ~ 100.
            • 'left'(=0%), 'center'(=50%), 'right'(=100%)
            • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
          • Offset : '+n', or '-n'.
        • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
          • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • Padding : '+n', or '-n'.
        • onResizeCallback : A default resize callback will be assigned interanlly.
      • width, height : Minimum width, minimum height.
      • orientation :
        • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
        • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
      • rtl :
        • true : Layout children from right to left.
        • false : Layout children from left to right. Default behavior.
      • background : Game object of background, optional. This background game object will be resized to fit the size of label.
      • icon : Game object of icon, optional.
      • iconMask : Set true to add a circle mask on icon game object.
        • Phaser 3 engine does not support nested mask, uses circle mask image instead.
      • text : Game object of text, optional.
      • expandTextWidth : Set true to expand width of text object.
      • expandTextHeight : Set true to expand height of text object.
      • action : Game object of action icon, optional.
      • actionMask : Set true to add a circle mask on action icon game object.
        • Phaser 3 engine does not support nested mask, uses circle mask image instead.
      • align : Alignment of icon, text, action-icon game objects.
        • undefined, or 'left', or 'top' : Align game objects at left, or top.
        • 'center' : Align game objects at center.
        • 'right', or 'bottom' : Align game objects at right, or bottom.
      • space : Pads spaces.
        • space.left, space.right, space.top, space.bottom : Space of bounds.
        • space.icon : Space between icon game object and text game object.
        • space.text : Space between text game object and action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-dropdownlist/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDropDownList extends RexPlugins.UI.DropDownList {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dropDownList = new MyDropDownList(scene, config);\n
    "},{"location":"ui-dropdownlist/#options","title":"Options","text":"
    • Set
      dropDownList.setOptions(options);\n
      or
      dropDownList.options = options;\n
      • options : Array of strings, or objects.
    • Get
      var options = dropDownList.options;\n
    "},{"location":"ui-dropdownlist/#clicking","title":"Clicking","text":"
    • Enable
      dropDownList.enableClick();\n
    • Disable
      dropDownList.disableClick();\n
    • Register another clicking callback
      dropDownList.onClick(callback, scope);\n
    "},{"location":"ui-dropdownlist/#emit-button-click-event","title":"Emit button click event","text":"
    dropDownList.emitButtonClick(index);\n// dropDownList.emitButtonClick();\n
    • index : Index of button/option.
      • undefined : Click current focus (over) button.

    Will fire 'button.click' event

    dropDownList.on('button.click', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
    • listPanel : listPanel, or undefined if list is not created.
    • button : Button game object, or option if list is not created.
    • pointer : undefined
    • event : undefined

    This method won't close list panel.

    "},{"location":"ui-dropdownlist/#emit-button-over-event","title":"Emit button over event","text":"
    dropDownList.emitButtonOver(index);\n
    • index : Index of button/option.

    or

    dropDownList.focusNextButton();\ndropDownList.focusPrevButton();\n

    Will fire 'button.out', 'button.over' event

    dropDownList.on('button.out', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
    dropDownList.on('button.over', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n

    • listPanel : listPanel, or undefined if list is not created.
    • button : Button game object, or option if list is not created.
    • pointer : undefined
    • event : undefined
    "},{"location":"ui-dropdownlist/#value","title":"Value","text":"
    • Set value under list.onButtonClick callback.
      dropDownList.setValue(value);\n
      or
      dropDownList.value = value;\n
      • When value changing
        • Will invoke setValueCallback
          function(dropDownList, value, previousValue) {\n\n}\n
        • Will fire 'valuechange' event
    • Get
      var value = dropDownList.value;\n
    "},{"location":"ui-dropdownlist/#openclose-list-panel","title":"Open/close list panel","text":""},{"location":"ui-dropdownlist/#open-list-panel","title":"Open list panel","text":"
    • Click parent label to open (create and pop-up) list panel.
    • Or invoke this method dropDownList.openListPanel().
    "},{"location":"ui-dropdownlist/#close-list-panel","title":"Close list panel","text":"
    • When list panel is opened, click any where will close (scale-down then destroy) this list panel.
    • Or invoke this method dropDownList.closeListPanel().
    "},{"location":"ui-dropdownlist/#toggle-list-panel","title":"Toggle list panel","text":"
    dropDownList.toggleListPanel();\n
    "},{"location":"ui-dropdownlist/#is-list-opened","title":"Is list opened","text":"
    var isOpened = dropDownList.isOpened;\n
    "},{"location":"ui-dropdownlist/#other-properties","title":"Other properties","text":"

    See label object, sizer object, base sizer object, container-lite.

    "},{"location":"ui-dropdownlist/#events","title":"Events","text":"
    • Open list
      dropDownList.on('list.open', function(dropDownList, listPanel) {\n\n})\n
    • Close list
      dropDownList.on('list.close', function(dropDownList, listPanel) {\n\n})\n
    • Click button
      dropDownList.on('button.click', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button on list panel.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Over button
      dropDownList.on('button.over', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button on list panel.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Out button
      dropDownList.on('button.out', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button on list panel.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • On value changing
      dropDownList.on('valuechange', function(dropDownList, value, previousValue) {\n// ...\n}, scope);\n
    "},{"location":"ui-expbar/","title":"Exp bar","text":""},{"location":"ui-expbar/#introduction","title":"Introduction","text":"

    Disply experience bar on NameValueLabel.

    • Author: Rex
    • Game object
    "},{"location":"ui-expbar/#live-demos","title":"Live demos","text":"
    • Exp bar
    • Custom bar
    "},{"location":"ui-expbar/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-expbar/#install-plugin","title":"Install plugin","text":""},{"location":"ui-expbar/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add expBar object
      var expBar = scene.rexUI.add.expBar(config);\n
    "},{"location":"ui-expbar/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add expBar object
      var expBar = scene.rexUI.add.expBar(config);\n
    "},{"location":"ui-expbar/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ExpBar } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add expBar object
      var expBar = new ExpBar(scene, config);\nscene.add.existing(expBar);\n
    "},{"location":"ui-expbar/#add-expbar-object","title":"Add expBar object","text":"
    var expBar = scene.rexUI.add.expBar({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\n\nnameText: nameTextGameObject,\nvalueText: valueTextGameObject,\n// valueTextFormatCallback: function(value, min, max) {\n//     return `${value}/${max}`;\n// },\n// valueTextFormatCallback: null,\n\n// barShape: 'line',   // 'line', or 'circle'\n\n// line bar\nbar: {\ntrackColor: undefined,\ntrackThickness: 2,\ntrackStrokeColor: undefined,\nbarColor: undefined,\nbarColor2: undefined,\n\nskewX: 0,\n\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'linear'\n},\n}, // circle bar\n/*\n    bar: {\n        barColor: undefined,\n        barColor2: undefined,\n        trackColor: undefined,\n        centerColor: undefined,\n        thickness: 0.2,\n        startAngle: Phaser.Math.DegToRad(270),\n        endAngle: Phaser.Math.DegToRad(270+360),\n        anticlockwise: false,\n    }\n    */\n\n// bar: CustomProgressGameObject,\n\n// bar: undefined,\n\naction: actionGameObject,\nactionMask: false,\n\nalign: {        text: 'bottom',  // 'top', 'center', 'bottom'\n},\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0,\nname: 0, value: 0,\nbar:0, barBottom: 0, barLeft: 0, barRight: 0,\ntext: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// easeDuration: 1000,\n\nlevelCounter: {\ntable: function(level) { return level * 100; },\n// table: [0, 100, 200, 300,],        \n// maxLevel: -1,        \n// exp: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of expBar.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • nameText : Game object of nameText.
      • OriginX of nameText will be set to 0.
      • Empty text will be set to a space character ' '. To preserve height of this text game object.
    • valueText : Game object of valueText.
      • OriginX of nameText will be set to 1.
      • Empty text will be set to a space character ' '. To preserve height of this text game object.
    • valueTextFormatCallback : Callback to return a string set to valueText game object when invokeing label.setValue(value, min, max) method.
      • A callback
        function(value, min, max) {\nreturn `${value}/${max}`;\n}\n
      • null, or false : Don't set valueText game object.
    • barShape : 'line' or 'circle'.
    • bar : Game object of bar, or config of horizontal line progress bar, or config of circular progress bar or undefined.
      • Config of horizontal line progress bar
        • bar.trackColor : Fill color of bar's track, in number or css string value.
        • bar.trackStrokeColor : Stroke color of bar's track, in number or css string value.
        • bar.trackThickness : Stroke line width of bar's track.
        • bar.barColor, bar.barColor2 : Fill color of bar, in number or css string value. Assign gradient start color by barColor2.
        • bar.skewX : Horizontal skew of track and bar.
        • bar.rtl :
          • false : Bar starts from left side. Default behavior.
          • true : Bar starts from right side.
      • Config of circular progress bar
        • bar.shape : 'circle'
        • bar.barColor, bar.barColor2 : Fill color of circular bar, in number or css string value. Assign gradient start color by barColor2.
        • bar.trackColor : Color of circular track, in number or css string value.
        • bar.centerColor : Color of center circle, in number or css string value.
        • bar.thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
        • bar.startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
        • bar.endAngle : End angle of circular bar, in radians. Default value is 270+360 degrees.
        • bar.anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
      • (CustomProgress) Game object.
      • undefined : No bar game object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • align :
      • align.text : Alignment of nameText, valueText game objects.
        • 'top', 'center', or 'bottom'. Default value is 'bottom'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom : Space around icon game object.
      • space.name : Left space of nameText game object.
      • space.value : Right space of valueText game object.
      • space.bar, space.barLeft, space.barRight, space.barBottom : Space around bar game object.
      • space.text : Space between text game object and action icon game object.
      • space.actionTop, space.actionBottom : Space around action game object.
    • easeDuration : Total duration of easing value from level-start to level-end. Default value is 1000 ms.
    • levelCounter : Config of level-counter
      • levelCounter.table : Level table, return experience value from level value. Level value starts from 0.
        • A callback
          function(level) {\nreturn experience;\n}\n
        • A number array : Experience value of each level.
      • levelCounter.maxLevel :
        • undefined : Default value
          • No upper limit for callback level table.
          • (table.length - 1) for number array level table.
        • A number : Maximum level value
      • levelCounter.exp : Initial experience value. Default value is 0.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-expbar/#custom-class","title":"Custom class","text":"
    • Define class
      class MyExpBar extends RexPlugins.UI.ExpBar {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var expBar = new MyExpBar(scene, config);\n
    "},{"location":"ui-expbar/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    expBar.layout();\n

    See also - dirty

    "},{"location":"ui-expbar/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = expBar.getElement('background');\n
      • Icon game object
        var icon = expBar.getElement('icon');\n
      • NameText game object
        var nameTextObject = expBar.getElement('name');\n
      • ValueText game object
        var valueTextObject = expBar.getElement('value');\n
      • Bar game object
        var textObject = expBar.getElement('bar');\n
      • Action icon game object
        var action = expBar.getElement('action');\n
    • Get by name
      var gameObject = expBar.getElement('#' + name);\n// var gameObject = expBar.getElement('#' + name, recursive);\n
      or
      var gameObject = expBar.getByName(name);\n// var gameObject = expBar.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-expbar/#accumulate-experience","title":"Accumulate experience","text":"
    • Accumulate experience
      expBar.gainExp(incExp);\n// expBar.exp += incExp;\n
      • Will fire 'levelup' event
    • Reset experience value
      expBar.resetExp(exp);\n
      • Won't fire 'levelup' event.
    • Force level up
      expBar.setLevel(level);\n
      • Will fire 'levelup' event
    "},{"location":"ui-expbar/#level-and-experience","title":"Level and experience","text":"
    • Get current experience
      var exp = expBar.getExp();\n// var exp = expBar.exp;\n
    • Get current level
      var level = expBar.getLevel();\n// var level = expBar.level;\n
    • Get current required experience to next level
      var exp = expBar.requiredExp;\n
    • Get experience of level
      var exp = expBar.getExp(level);\n
    • Get level from experience
      var level = expBar.getLevel(exp);\n
    • Get required experience to level
      var exp = expBar.getRequiredExpToNextLevel(level);\n// var exp = expBar.getRequiredExpToNextLevel(level, exp);\n
    "},{"location":"ui-expbar/#events","title":"Events","text":"
    • Easing starting of Level-up
      expBar.on('levelup.start', function(level, fromExp, toExp){        }, scope);\n
      • level : Current level
    • Easing end of Level-up
      expBar.on('levelup.end', function(level, fromExp, toExp){        }, scope);\n
      • level : Current level
    • Total easing of Level-up complete
      expBar.on('levelup.complete', function(level){        }, scope);\n
      • level : Current level
    "},{"location":"ui-expbar/#other-properties","title":"Other properties","text":"

    See NameValueLabel, sizer object, base sizer object, container-lite.

    "},{"location":"ui-fileselectorbutton/","title":"File selector button","text":""},{"location":"ui-fileselectorbutton/#introduction","title":"Introduction","text":"

    A transparent file chooser button (<input type=\"file\">) above a Label.

    • Author: Rex
    • Game object, DOM Game object
    "},{"location":"ui-fileselectorbutton/#live-demos","title":"Live demos","text":"
    • File selector button
    "},{"location":"ui-fileselectorbutton/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-fileselectorbutton/#install-plugin","title":"Install plugin","text":""},{"location":"ui-fileselectorbutton/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add file selector button object
      var button = scene.add.fileSelectorButton(config);\n
    "},{"location":"ui-fileselectorbutton/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FileChooserPlugin from 'phaser3-rex-plugins/plugins/filechooser-plugin.js';\nvar config = {    parent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add file selector button object
      var button = scene.add.fileSelectorButton(config);\n
    "},{"location":"ui-fileselectorbutton/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { FileSelectorButton } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add file chooser object
      var button = new FileSelectorButton(scene, config);\nscene.add.existing(button);\n
    "},{"location":"ui-fileselectorbutton/#add-file-chooser-object","title":"Add file chooser object","text":"
    var button = scene.add.fileSelectorButton({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\nicon: iconGameObject,\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\n\naction: actionGameObject,\n// actionMask: false,\n// squareFitAction: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nalign: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\ntext: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n// accept: '',\n// multiple: false,\n});\n// var fileChooser = scene.add.fileSelectorButton(x, y, width, height, config);\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitIcon :
      • true : Resize icon size to square to fit label height/width.
      • false : Ignore this feature. Default behavior.
    • iconSize : Set display size of icon game object to iconSizexiconSize
    • iconWidth : Set display width of icon game object to iconWidth.
      • If iconHeight is undefined, set scaleY of icon game object to scaleX of icon game object, to keep size ratio.
    • iconHeight : Set display height of icon game object to iconHeight.
      • If iconWidth is undefined, set scaleX of icon game object to scaleY of icon game object, to keep size ratio.
    • text : Game object of text, optional.
    • expandTextWidth :
      • false : Keep width of text to original size. Default behavior.
      • true : Expand width of text object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
    • expandTextHeight : Set true to expand height of text object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitAction :
      • true : Resize action icon size to square to fit label height/width.
      • false : Ignore this feature. Default behavior.
    • actionSize : Set display size of action game object to actionSizexactionSize
    • actionWidth : Set display width of action game object to actionWidth.
      • If actionHeight is undefined, set scaleY of action game object to scaleX of action game object, to keep size ratio.
    • actionHeight : Set display height of action game object to actionHeight.
      • If actionWidth is undefined, set scaleX of action game object to scaleY of action game object, to keep size ratio.
    • align : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.text : Space between text game object and action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    • multiple : Set true to select multiple files.
    "},{"location":"ui-fileselectorbutton/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFileSelectorButton extends RexPlugins.UI.FileSelectorButton {\nconstructor(scene, config) {\nsuper(scene, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var button = new MyFileSelectorButton(scene, config);\n
    "},{"location":"ui-fileselectorbutton/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-fileselectorbutton/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = label.getElement('background');\n
      • Icon game object
        var icon = label.getElement('icon');\n
      • Text game object
        var textObject = label.getElement('text');\n
      • Action icon game object
        var action = label.getElement('action');\n
      • File chooser game object
        var fileChooser = label.getElement('fileChooser');\n
    • Get by name
      var gameObject = label.getElement('#' + name);\n// var gameObject = label.getElement('#' + name, recursive);\n
      or
      var gameObject = label.getByName(name);\n// var gameObject = label.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-fileselectorbutton/#selected-files","title":"Selected files","text":"
    var files = fileChooser.files;\n
    • files : Array of file object.
    "},{"location":"ui-fileselectorbutton/#set-accept-filter","title":"Set accept filter","text":"
    fileChooser.setAccept(accept);\n
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    "},{"location":"ui-fileselectorbutton/#multiple-files","title":"Multiple files","text":"
    • Enable
      fileChooser.setMultiple();\n
    • Disable
      fileChooser.setMultiple(false);\n
    "},{"location":"ui-fileselectorbutton/#events","title":"Events","text":"
    • Selected file(s) changed
      button.on('select', function(files, button) {        var file = files[0];\nvar url = URL.createObjectURL(file);\n// ...\n})\n
    "},{"location":"ui-fileselectorbutton/#load-file-to-cache","title":"Load file to cache","text":"
    fileChooser.loadFile(file, loaderType, key);\n// fileChooser.loadFile(file, loaderType, key, cahceType);\n

    or

    fileChooser.loadFilePromise(file, loaderType, key, cahceType)\n.then(function(content) {\n\n})\n
    • file : File object, see Events
    • loaderType : image, text, binary, ... See Loader
    • key : Unique string key.
    • cahceType :
      • undefined : Use default value.
    • content : Content of file.
    "},{"location":"ui-fileselectorbutton/#create-object-url","title":"Create object URL","text":"
    • Create object url
      var objectURL = URL.createObjectURL(file);\n
    • Release object url
      URL.createObjectURL(objectURL);\n
    "},{"location":"ui-fileselectorbutton/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"ui-fileselectorbutton/#other-properties","title":"Other properties","text":"

    See label object, sizer object, base sizer object, container-lite.

    "},{"location":"ui-fixwidthbuttons/","title":"Fix-width buttons","text":""},{"location":"ui-fixwidthbuttons/#introduction","title":"Introduction","text":"

    A container with a group of fix-width buttons.

    • Author: Rex
    • Game object
    "},{"location":"ui-fixwidthbuttons/#live-demos","title":"Live demos","text":"
    • Checkboxes/radio
    • Indent left
    • Indent top
    "},{"location":"ui-fixwidthbuttons/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-fixwidthbuttons/#install-plugin","title":"Install plugin","text":""},{"location":"ui-fixwidthbuttons/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add fix-Width buttons object
      var buttons = scene.rexUI.add.fixWidthButtons(config);\n
    "},{"location":"ui-fixwidthbuttons/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add fix-Width buttons object
      var buttons = scene.rexUI.add.fixWidthButtons(config);\n
    "},{"location":"ui-fixwidthbuttons/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { FixWidthButtons } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add fix-Width buttons object
      var buttons = new FixWidthButtons(scene, config);\nscene.add.existing(buttons);\n
    "},{"location":"ui-fixwidthbuttons/#add-buttons-object","title":"Add Buttons object","text":"
    var buttons = scene.rexUI.add.fixWidthButtons({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\n// background: backgroundGameObject,\n\nbuttons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n// rtl: false,\nalign: 0,\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\n// space: 0,\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0,\n//     item: 0, line: 0,\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n// eventEmitter: this,\n// groupName: undefined,\n\n// buttonsType: undefined,\n// setValueCallback: undefined,  // or setButtonStateCallback: undefined\n// setValueCallbackScope: undefined  // or setButtonStateCallbackScope: undefined\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • buttons : 1d/2d array of button game objects.
    • align : Align children of a line.
      • 0, 'left' : Align children of a line to left/top side.
      • 1, 'right' : Align children of a line to right/bottom side.
      • 2, 'center' : Align children of a line to ceter.
      • 3, 'justify', 'justify-left' : If remainder space is less or equal than 25%, then justify children. Else align children to left/top side.
      • 4, 'justify-right' : If remainder space is less or equal than 25%, then justify children. Else align children to right/bottom side.
      • 5, 'justify-cneter' : If remainder space is less or equal than 25%, then justify children. Else align children to center.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • space :
      • A number: Space between 2 button game objects.
      • An object: Padding of button game objects.
        • space.left, space.right, space.top, space.bottom : Space of bounds.
        • space.item : Space betwen each child of a line.
        • space.line : Space between each line.
        • space.indentLeftOdd, space.indentLeftEven : Indent at each odd/even line.
        • space.indentTopOdd, space.indentTopEven : Indent at each odd/even item.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • eventEmitter : Dispatch buttons' touch events to other game obhect, default is this buttons game object.
    • groupName : Optional group name for argument of touch events.
    • buttonsType : Type/behavior of these buttons.
      • undefined : No extra behavior, default value.
      • 'checkboxes' : Set these buttons to checkboxes.
      • 'radio' : Set these buttons to radio.
    • setValueCallback or setButtonStateCallback : Callback to set value of a button.
      • undefined : No callback, default value.
      • A function object.
        function(button, value, previousValue) {\n// ...\n}\n
        • button : Button game object.
        • value: true, or false.
        • previousValue : true, or false.
    "},{"location":"ui-fixwidthbuttons/#custom-class","title":"Custom class","text":"
    • Define class
      class MyButtons extends RexPlugins.UI.FixWidthButtons {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var buttons = new MyButtons(scene, config);\n
    "},{"location":"ui-fixwidthbuttons/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    buttons.layout();\n

    See also - dirty

    "},{"location":"ui-fixwidthbuttons/#other-properties","title":"Other properties","text":"

    See sizer object

    "},{"location":"ui-fixwidthbuttons/#events","title":"Events","text":"
    • Click button
      buttons.on('button.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.click', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      • groupName : Optional group name.
      • button : Triggered button game object.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over button
      buttons.on('button.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.over', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-out button
      buttons.on('button.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.out', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Enable button's input
      buttons.on('button.enable', function(button, index) {\n// ...\n}, scope);\n
      or
      buttons.on('button.enable', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Disable button's input
      buttons.on('button.disalbe', function(button, index) {\n// ...\n}, scope);\n
      or
      buttons.on('button.disalbe', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    "},{"location":"ui-fixwidthbuttons/#emit-button-click-event","title":"Emit button click event","text":"
    buttons.emitButtonClick(index);\n
    • index : Index of triggered button game object, or a button game object.
    "},{"location":"ui-fixwidthbuttons/#enabledisable-input-of-button","title":"Enable/disable input of button","text":"
    • Enable a button's input
      buttons.setButtonEnable(index);\n// buttons.setButtonEnable(index, true);\n
      • index : Index of triggered button game object, or a button game object.
    • Enable all buttons' input
      buttons.setButtonEnable();\n// buttons.setButtonEnable(true);\n
    • Disable
      buttons.setButtonEnable(index, true);\n
      • index : Index of triggered button game object, or a button game object.
    • Disable all buttons' input
      buttons.setButtonEnable(false);\n
    • Toggle
      buttons.toggleButtonEnable(index);\n
    • Toggle all buttons's input
      buttons.toggleButtonEnable();\n
    • Get button's input enable
      var enabled = bottons.getButtonEnable(index);\n
    "},{"location":"ui-fixwidthbuttons/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = buttons.getElement('background');\n
      • Button game objects
        var buttonObjects = buttons.getElement('buttons');\n
        or
        var buttonObject = buttons.getButton(index);\n
        or
        var buttonObjects = buttons.getElement('buttons[0]'); // First button\n
    • Get by name
      var gameObject = buttons.getElement('#' + name);\n// var gameObject = buttons.getElement('#' + name, recursive);\n
      or
      var gameObject = buttons.getByName(name);\n// var gameObject = buttons.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-fixwidthbuttons/#add-child","title":"Add child","text":"
    • Add button child
      buttons.addButton(gameObject)\n
      • gameObject : A game object, or an array of game objects.
    • Add non-button child, see fixWidthSizer.add() method.
      buttons.add(gameObject,\n{\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nkey: undefined,\nindex: undefined\n}\n)\n
    "},{"location":"ui-fixwidthbuttons/#remove-child","title":"Remove child","text":"
    • Remove button child
      buttons.removeButton(gameObject, destroyChild);\n
      • gameObject :
        • Game object, or array of game objects : Button game object.
        • A number, or array of numbers : Index of button game object.
        • A string, or array of strings : Name of button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove all buttton children
      buttons.clearButtons(destroyChild);\n
      • destroyChild : Set true to destroy button game objects.
    • Remove a button or non-button child, see fixWidthSizer.remove() method.
      buttons.remove(gameObject, destroyChild);\n
    • Remove all button or non-button children, see fixWidthSizer.remove() method.
      buttons.removeAll(destroyChild);\n
    "},{"location":"ui-fixwidthbuttons/#showhide-button","title":"Show/hide button","text":"

    The same as for each button of buttons.

    "},{"location":"ui-fixwidthbuttons/#for-each-button","title":"For each button","text":"

    The same as for each button of buttons.

    "},{"location":"ui-fixwidthbuttons/#checkboxesradio","title":"Checkboxes/radio","text":"

    The same as checkboxes/radio of buttons.

    "},{"location":"ui-fixwidthsizer/","title":"Fix-width sizer","text":""},{"location":"ui-fixwidthsizer/#introduction","title":"Introduction","text":"

    Layout children game objects into lines.

    • Author: Rex
    • Game object
    "},{"location":"ui-fixwidthsizer/#live-demos","title":"Live demos","text":"
    • Fix-width sizer
    • Scrollable, fix-width sizer
    • Indent
    • Drag-drop item
    • Set children interactive
    • vertical & horizontal
    "},{"location":"ui-fixwidthsizer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-fixwidthsizer/#install-plugin","title":"Install plugin","text":""},{"location":"ui-fixwidthsizer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add sizer object
      var sizer = scene.rexUI.add.fixWidthSizer(config);\n
    "},{"location":"ui-fixwidthsizer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sizer object
      var sizer = scene.rexUI.add.fixWidthSizer(config);\n
    "},{"location":"ui-fixwidthsizer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { FixWidthSizer } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add sizer object
      var sizer = new FixWidthSizer(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-fixwidthsizer/#add-sizer-object","title":"Add sizer object","text":"
    var sizer = scene.rexUI.add.fixWidthSizer({\n// x: 0,\n// y: 0,\n// anchor: undefined,    \n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// orientation: 0,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0,\n//     item: 0, line: 0, \n//     indentLeftOdd: 0, indentLeftEven: 0,\n// },\n\n// rtl: false,\n// align: 0,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.fixWidthSizer(x, y, {\n// width: 2,\n// height: 2\n// orientation: 0,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0,\n//     item: 0, line: 0,\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// rtl: false,\n// align: 0,\n\n// name: '',\n// draggable: false\n});\n

    or

    var sizer = scene.rexUI.add.fixWidthSizer(x, y, width, height, {\n// orientation: 0,\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0,\n//     item: 0, line: 0\n// },\n\n// rtl: false,\n// align: 0,\n\n// name: '',\n// draggable: false\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Orientation of the sizer.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right. Default value is 0.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space betwen each child of a line.
      • space.line : Space between each line.
      • space.indentLeftOdd, space.indentLeftEven : Indent at each odd/even line.
      • space.indentTopOdd, space.indentTopEven : Indent at each odd/even item.
    • rtl : Order of children in each line.
      • false : Place children from left-to-right/top-to-bottom, default value.
      • true : Place children from right-to-left/bottom-to-top.
    • align : Align children of a line.
      • 0, 'left' : Align children of a line to left/top side.
      • 1, 'right' : Align children of a line to right/bottom side.
      • 2, 'center' : Align children of a line to ceter.
      • 3, 'justify', 'justify-left' : If remainder space is less or equal than 25%, then justify children. Else align children to left/top side.
      • 4, 'justify-right' : If remainder space is less or equal than 25%, then justify children. Else align children to right/bottom side.
      • 5, 'justify-cneter' : If remainder space is less or equal than 25%, then justify children. Else align children to center.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-fixwidthsizer/#custom-class","title":"Custom class","text":"
    • Define class
      class MySizer extends RexPlugins.UI.FixWidthSizer {\nconstructor(scene, x, y, minWidth, minHeight, orientation, space, config) {\nsuper(scene, x, y, minWidth, minHeight, orientation, space, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var sizer = new MySizer(scene, x, y, minWidth, minHeight, orientation, space, config);\n
    "},{"location":"ui-fixwidthsizer/#add-background","title":"Add background","text":"
    sizer.addBackground(child);\n

    or

    sizer.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    "},{"location":"ui-fixwidthsizer/#add-child","title":"Add child","text":"

    Add a game obejct to sizer

    sizer.add(child);\n

    or

    sizer.add(child,\n{\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nkey: undefined,\nindex: undefined,\noffsetX: 0,\noffsetY: 0,\noffsetOriginX: 0,\noffsetOriginY: 0,\n}\n);\n

    or

    sizer.add(child, padding, key, index);\n
    • child : A game object
    • padding : Add space between bounds. Default is 0.
      • A number for left/right/top/bottom bounds
      • Or a plain object
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
      • items : Reserved key, for all children item.
    • offsetX, offsetOriginX : Apply offset offsetX + offsetOriginY * width to x coordinate after alignment.
    • offsetY, offsetOriginY : Apply offset offsetY + offsetOriginY * height to y coordinate after alignment.
    • index : Insert child to.
      • undefined : Insert child at last.
    "},{"location":"ui-fixwidthsizer/#add-multiple","title":"Add multiple","text":"
    sizer.add(gameObjects, config);\n
    • gameObjects : Array of child game objects
    • config : See config of add-child
    "},{"location":"ui-fixwidthsizer/#insert-child","title":"Insert child","text":"
    sizer.insert(index, child, {\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nkey: undefined,\n}\n);\n

    or

    sizer.insert(index, child, padding, key);\n
    "},{"location":"ui-fixwidthsizer/#insert-at-position","title":"Insert at position","text":"
    sizer.insertAtPosition(x, y, child, {\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nkey: undefined,\n}\n);\n

    or

    sizer.insertAtPosition(x, y, index, child, padding, key);\n
    "},{"location":"ui-fixwidthsizer/#add-new-line","title":"Add new line","text":"
    sizer.addNewLine();\n
    "},{"location":"ui-fixwidthsizer/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    sizer.layout();\n

    See also - dirty

    "},{"location":"ui-fixwidthsizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-fixwidthsizer/#remove-child","title":"Remove child","text":"
    • Remove a child
      sizer.remove(child);\n
    • Remove and destroy a child
      sizer.remove(child, true);\n
    • Remove all children
      sizer.removeAll();\n
    • Remove and destroy all children
      sizer.removeAll(true);\n
    • Remove all children and backgrounds
      sizer.clear();\n
    • Remove and destroy all children and backgrounds
      sizer.clear(true);\n
    • Remove from parent sizer
      sizer.removeFromParentSizer();\n
    "},{"location":"ui-fixwidthsizer/#sort-children","title":"Sort children","text":"
    • Sort by data
      sizer.sortChildrenByData(key, descending).layout();\n
      • key : Data key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by property of child
      sizer.sortChildrenByProperty(key, descending).layout();\n
      • key : Property key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by callback
      sizer.sortChildren(function(childA, childB){\n// var valueA = childA.getData(key);\n// var valueB = childB.getData(key);\n// return valueB - valueA\n}).layout();\n
      • childA, childB : 2 children of this size
    "},{"location":"ui-fixwidthsizer/#get-element","title":"Get element","text":"
    • Get element
      • All children items
        var items = sizer.getElement('items');\n
    • Get by name
      var gameObject = sizer.getElement('#' + name);\n// var gameObject = sizer.getElement('#' + name, recursive);\n
      or
      var gameObject = sizer.getByName(name);\n// var gameObject = sizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-fixwidthsizer/#get-child-index","title":"Get child index","text":"
    var index = sizer.getChildIndex(child);\n
    • index : A number, or null.
    "},{"location":"ui-fixwidthsizer/#other-properties","title":"Other properties","text":"

    See base-sizer object.

    "},{"location":"ui-folder/","title":"Folder","text":""},{"location":"ui-folder/#introduction","title":"Introduction","text":"

    A container with a title, foldable child, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-folder/#live-demos","title":"Live demos","text":"
    • Scrollable folders
    • Draggable folder
    • Nested folders
    "},{"location":"ui-folder/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-folder/#install-plugin","title":"Install plugin","text":""},{"location":"ui-folder/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add folder object
      var folder = scene.rexUI.add.folder(config);\n
    "},{"location":"ui-folder/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add folder object
      var folder = scene.rexUI.add.folder(config);\n
    "},{"location":"ui-folder/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Folder } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add folder object
      var folder = new Folder(scene, config);\nscene.add.existing(folder);\n
    "},{"location":"ui-folder/#add-folder-object","title":"Add folder object","text":"
    var folder = scene.rexUI.add.folder({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\ntitle: titleGameObject,    child: childGameObject,\n// customChildOrigin: false,\n\ntoggleByTarget: undefined,\ntoggleClickConfig: {\nmode:'pointerup',\nclickInterval: 100,\nthreshold: undefined,\n},\n\nalign: {\ntitle: 'left',\nchild: 'left',\n},\n\nexpand: {\ntitle: true,\nchild: true,\n},\n\nspace: { left: 0, right:0, top:0, bottom:0, item:0,\n\ntitleLeft: 0, titleRight: 0, titleTop: 0, titleBottom: 0,\nchildLeft: 0, childRight: 0, childTop: 0, childBottom: 0,\n},\n\ntransition: {\nduration: 200,\nexpandCallback: undefined,\ncollapseCallback: undefined,\n},\n\nreLayoutTarget: undefined,\n\nonExpandStart: undefined,\nonExpandComplete: undefined,\nonCollapseStart: undefined,\nonCollapseComplete: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nitem: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of folder.
    • title : Game object of title, required.
    • child : Game object of child, required.
    • customChildOrigin :
      • false : Set origin of child to 0, or 1 (if rtl is set to true). Default behavior.
      • true : Don't change origin of child.
    • toggleByTarget : Toggle expanding/collapsing by clicking this target game object
      • undefined : Toggle by clicking title game object.
    • toggleClickConfig : Configuration of clicking behavior
      • undefined : Use default configuration.
    • align.title, align.child : Alignment of title, child game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top. Default behavior.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • expand.title, expand.child : Expand width/height of title, child game objects.
      • true : Expand width/heigh. Default behavior.
      • false : Use origin width/height.
    • transition : Configuration of expanding/collapsing transition.
      • transition.duration : Duration of expanding/collapsing transition.
      • transition.expandCallback : Callback invoked when expading child. Default behavior is scale-up.
      • transition.collapseCallback : Callback invoked when collapsing child. Default behavior is scale-down.
    • reLayoutTarget : Layout topmost sizer when expanding/collapsing start.
      • undefined : Topmost sizer will be layouted again. Default behavior.
      • A sizer : Layout this sizer.
    • onExpandStart : Callback invoked when expanding start. Register this callback on 'expand.start' event.
      function(folder) {  }\n
    • onExpandComplete : Callback invoked when expanding complete. Register this callback on 'expand.complete' event.
      function(folder) {  }\n
    • onCollapseStart : Callback invoked when collapsing start. Register this callback on 'collapse.start' event.
      function(folder) {  }\n
    • onCollapseComplete : Callback invoked when collapsing complete. Register this callback on 'collapse.complete' event.
      function(folder) {  }\n
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.text : Space between text game object and action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-folder/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFolder extends RexPlugins.UI.Folder {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var folder = new MyFolder(scene, config);\n
    "},{"location":"ui-folder/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    folder.layout();\n

    See also - dirty

    Note

    Layout topmost sizer when expanding/collapsing start.

    "},{"location":"ui-folder/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = folder.getElement('background');\n
      • Title game object
        var title = folder.getElement('title');\n
      • Child game object
        var child = folder.getElement('child');\n
    • Get by name
      var gameObject = folder.getElement('#' + name);\n// var gameObject = folder.getElement('#' + name, recursive);\n
      or
      var gameObject = folder.getByName(name);\n// var gameObject = folder.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-folder/#expandcollapse","title":"Expand/collapse","text":"
    • Expand, will re-layout from topmost sizer
      folder.expand();\n// folder.expand(duration);\n
      folder.expand(0);  // Immediately, won't invoke expandCallback\n
    • Collapse, will re-layout from topmost sizer
      folder.collapse();\n// folder.collapse(duration);\n
      folder.collapse(0);  // Immediately, won't invoke collapseCallback\n
    • Toggle, will re-layout from topmost sizer
      folder.toggle();\n// folder.toggle(duration);\n
      folder.toggle(0);  // Immediately, won't invoke expandCallback/collapseCallback\n
    • Set expanded state without re-layouting
      folder.setExpandedState(expanded);  // true, or false\n
    • Get expanded state
      var expanded = folder.expanded;\n
      • expanded : Initial value is undefined
    "},{"location":"ui-folder/#transition-callbacks","title":"Transition callbacks","text":"
    • Set transition callbacks
      folder.setExpandCallback(callback);\nfolder.setCollapseCallback(callback);\n
      • callback :
        function(gameObject, duration) {\n}\n
        • gameObject : Child game object
    • Transition duration
      • Set
        folder.setTransitionDuration(duration);\n
      • Get
        var duration = folder.transitionDuration;\n
    "},{"location":"ui-folder/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-folder/#events","title":"Events","text":"
    • On expand-start
      folder.on('expand.start', function(folder){\n\n})\n
      title.on('folder.expand', function(folder){\n\n})\n
      child.on('folder.expand', function(folder){\n\n})\n
    • On expand-complete
      folder.on('expand.complete', function(folder){\n\n})\n
    • On collapse-start
      folder.on('collapse.start', function(folder){\n\n})\n
      title.on('folder.collapse', function(folder){\n\n})\n
      child.on('folder.collapse', function(folder){\n\n})\n
    • On collapse-complete
      folder.on('collapse.complete', function(folder){\n\n})\n
    "},{"location":"ui-gridbuttons/","title":"Grid buttons","text":""},{"location":"ui-gridbuttons/#introduction","title":"Introduction","text":"

    A container with a group of buttons in grids.

    • Author: Rex
    • Game object
    "},{"location":"ui-gridbuttons/#live-demos","title":"Live demos","text":"
    • Number pad
    • Checkboxes/radio
    "},{"location":"ui-gridbuttons/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-gridbuttons/#install-plugin","title":"Install plugin","text":""},{"location":"ui-gridbuttons/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add buttons object
      var buttons = scene.rexUI.add.gridButtons(config);\n
    "},{"location":"ui-gridbuttons/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add buttons object
      var buttons = scene.rexUI.add.gridButtons(config);\n
    "},{"location":"ui-gridbuttons/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { GridButtons } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add buttons object
      var buttons = new GridButtons(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-gridbuttons/#add-grid-sizer-object","title":"Add grid sizer object","text":"
    var buttons = scene.rexUI.add.gridButtons({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\n// background: backgroundGameObject,\n\nbuttons: [\n[buttonGameObject, buttonGameObject, buttonGameObject, ...],\n[buttonGameObject, buttonGameObject, buttonGameObject, ...],\n[buttonGameObject, buttonGameObject, buttonGameObject, ...],\n...\n],\n// row: 0, \n// column: 0,   // col: 0\n// createCellContainerCallback: function(scene, x, y) {\n//       return cellContainer;\n// },    \nexpand: true,\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0     // [0, 0, 0]\n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n// eventEmitter: this,\n// groupName: undefined,\n\n// buttonsType: undefined,\n// setValueCallback: undefined,  // or setButtonStateCallback: undefined\n// setValueCallbackScope: undefined  // or setButtonStateCallbackScope: undefined\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width : Minimum width. i.e. Width of this gridButtons will larger then this value.
    • height : Minimum height. i.e. Hieght of this gridButtons will larger then this value.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • buttons : 2d array of button game objects, or create buttons via row, column(or col), and createCellContainerCallback.
    • createCellContainerCallback : Callback to create buttons.
      function(scene, x, y) {\nreturn cellContainer;\n}\n
    • expand : Set true to expand width and height of buton game objects.
    • space : Space around this sizer, and space between columns/rows
      • space.left, space.right, space.top, space.bottom : Space around this sizer.
      • space.column : Space between 2 columns
        • A number
        • A number array
      • space.row : Space between 2 rows
        • A number
        • A number array
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • eventEmitter : Dispatch buttons' touch events to other game object, default is this buttons game object.
    • groupName : Optional group name for argument of touch events.
    • buttonsType : Type/behavior of these buttons.
      • undefined : No extra behavior, default value.
      • 'checkboxes' : Set these buttons to checkboxes.
      • 'radio' : Set these buttons to radio.
    • setValueCallback or setButtonStateCallback : Callback to set value of a button.
      • undefined : No callback, default value.
      • A function object.
        function(button, value, previousValue) {\n// ...\n}\n
        • button : Button game object.
        • value: true, or false.
        • previousValue : true, or false.
    "},{"location":"ui-gridbuttons/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGridButtons extends RexPlugins.UI.GridButtons {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var buttons = new MyGridButtons(scene, config);\n
    "},{"location":"ui-gridbuttons/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    buttons.layout();\n

    See also - dirty

    "},{"location":"ui-gridbuttons/#other-properties","title":"Other properties","text":"

    See grid sizer object.

    "},{"location":"ui-gridbuttons/#events","title":"Events","text":"

    The same as events of buttons.

    "},{"location":"ui-gridbuttons/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = buttons.getElement('background');\n
      • Button game objects
        var buttonObjects = buttons.getElement('buttons');\n
        or
        var buttonObject = buttons.getButton(index);\n
        or
        var buttonObjects = buttons.getElement('buttons[0]'); // First button\n
    • Get by name
      var gameObject = buttons.getElement('#' + name);\n// var gameObject = buttons.getElement('#' + name, recursive);\n
      or
      var gameObject = buttons.getByName(name);\n// var gameObject = buttons.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-gridbuttons/#showhide-button","title":"Show/hide button","text":"

    The same as for each button of buttons.

    "},{"location":"ui-gridbuttons/#for-each-button","title":"For each button","text":"

    The same as for each button of buttons.

    "},{"location":"ui-gridbuttons/#checkboxesradio","title":"Checkboxes/radio","text":"

    The same as checkboxes/radio of buttons.

    "},{"location":"ui-gridsizer/","title":"Grid sizer","text":""},{"location":"ui-gridsizer/#introduction","title":"Introduction","text":"

    Layout children game objects in grids.

    • Author: Rex
    • Game object
    "},{"location":"ui-gridsizer/#live-demos","title":"Live demos","text":"
    • Create cell-containers
    • Scrollable grids
    • Add new row
    • Add new column
    • Full viewport
    • Set children interactive
    • Destroy cell
    • Reset grid
    "},{"location":"ui-gridsizer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-gridsizer/#install-plugin","title":"Install plugin","text":""},{"location":"ui-gridsizer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add sizer object
      var sizer = scene.rexUI.add.gridSizer(config);\n
    "},{"location":"ui-gridsizer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sizer object
      var sizer = scene.rexUI.add.gridSizer(config);\n
    "},{"location":"ui-gridsizer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { GridSizer } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add sizer object
      var sizer = new GridSizer(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-gridsizer/#add-grid-sizer-object","title":"Add grid sizer object","text":"
    var gridSizer = scene.rexUI.add.gridSizer({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\ncolumn: 0,  // col: 0\nrow: 0,\n// columnProportions: undefined,\n// rowProportions: undefined,\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0,    // [0, 0, 0]\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// createCellContainerCallback: function(scene, x, y, config) {\n//     config.expand = true;\n//     return cellContainer;\n// },\n\n// name: '',\n// draggable: false\n});\n

    or

    var gridSizer = scene.rexUI.add.gridSizer(x, y, {\ncolumn: 0,  // col: 0\nrow: 0,\n// columnProportions: undefined,\n// rowProportions: undefined,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0,    // [0, 0, 0]\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// createCellContainerCallback: function(scene, x, y, config) {\n//     config.expand = true;\n//     return cellContainer;\n// },\n\n// width: undefined,\n// height: undefined\n});\n

    or

    var gridSizer = scene.rexUI.add.gridSizer(x, y, width, height, {\ncolumn: 0,   // col: 0\nrow: 0,\n// columnProportions: undefined,\n// rowProportions: undefined,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0,    // [0, 0, 0]\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// createCellContainerCallback: function(scene, x, y, config) {\n//     config.expand = true;\n//     return cellContainer;\n// },\n});\n

    or

    var gridSizer = scene.rexUI.add.gridSizer(x, y, width, height, column, row, {\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0,    // [0, 0, 0]\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// createCellContainerCallback: function(scene, x, y, config, gridSizer) {\n//     config.expand = true;\n//     return cellContainer;\n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width : Minimum width. i.e. Width of this gridSizer will larger then this value.
    • height : Minimum height. i.e. Hieght of this gridSizer will larger then this value.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • column, or col : Amount of column grids.
    • row : Amount of row grids.
    • columnProportions, rowProportions : Proportion of each column/row.
      • Number : Apply this number proportion to each column/row
      • Number array : Apply proportion of column/row through elements of this number array.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.column : Space between 2 columns
        • A number
        • A number array
      • space.row : Space between 2 rows
        • A number
        • A number array
      • space.indentLeftOdd, space.indentLeftEven : Indent at each odd/even row.
      • space.indentTopOdd, space.indentTopEven : Indent at each odd/even column.
    • createCellContainerCallback : Callback to create container(sizer) of each cell.
      function(scene, x, y, config) {\nreturn cellContainer;\n}\n
      • x, y : Column, row index of this cell.
      • config : Config of adding child
        config.align = 'center';\nconfig.padding = {left: 0, right: 0, top: 0, bottom: 0};\nconfig.expand = false;\nconfig.key = undefined;\n
      • cellContainer : Return a game object for this cell.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-gridsizer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGridSizer extends RexPlugins.UI.GridSizer {\nconstructor(scene, x, y, minWidth, minHeight, column, row) {\nsuper(scene, x, y, minWidth, minHeight, column, row);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var gridSizer = new MyGridSizer(scene, x, y, minWidth, minHeight, column, row);\n
    "},{"location":"ui-gridsizer/#add-background","title":"Add background","text":"
    gridSizer.addBackground(child);\n

    or

    gridSizer.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    "},{"location":"ui-gridsizer/#add-child","title":"Add child","text":"

    Add a game obejct to grid sizer

    gridSizer.add(child, column, row);\n

    or

    gridSizer.add(child,\n{\ncolumn: 0,\nrow: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,        // expand: {width, height}\nkey: undefined,\noffsetX: 0,\noffsetY: 0,\noffsetOriginX: 0,\noffsetOriginY: 0,\n}\n);\n

    or

    gridSizer.add(child, column, row, align, padding, expand, key);\n
    • child : A game object
    • column, row : Index of grid to add.
      • column and row are numbers : Insert game object to cell (column, row).
        • Do nothing if that cell has item already.
      • column and row are undefined : Search each column, each row to find an empty cell for inserting.
        • Add an new row (gridSizer.addEmptyRow()) if last row was full, then find an empty cell in new row.
      • column is undefined, and row is true : Search each row, each column to find an empty cell for inserting.
        • Add an new column (gridSizer.addEmptyColumn()) if last column was full, then find an empty cell in new column.
      • column is a number, and row is undefined : Search each row of column column to find an empty cell for inserting.
        • Add an new row (gridSizer.addEmptyRow()) if last row was full, then find an empty cell in new row.
      • column is undefined and row is a number : Search each column of row row to find an empty cell for inserting.
        • Add an new column (gridSizer.addEmptyColumn()) if last column was full, then find an empty cell in new column.
    • align :
      • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
      • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
      • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center.
      • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center.
    • padding : Add space between bounds. Default is 0.
      • A number for left/right/top/bottom bounds
      • Or a plain object
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • expand :
      • Boolean value
        • true : Expand width and height of child. Default value.
        • false : Don't expand width or height of child.
      • A plain object
        • {width: true} : Only expand width of child.
        • {height: true} : only expand height of child.
        • {width: true, height: true} : Expand width and height of child.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    • offsetX, offsetOriginX : Apply offset offsetX + offsetOriginY * width to x coordinate after alignment.
    • offsetY, offsetOriginY : Apply offset offsetY + offsetOriginY * height to y coordinate after alignment.
    "},{"location":"ui-gridsizer/#add-multiple","title":"Add multiple","text":"
    sizer.add(gameObjects, config);\n
    • gameObjects : Array of child game objects
    • config : See config of add-child
    "},{"location":"ui-gridsizer/#insert-empty-rowcolumn","title":"Insert empty row/column","text":"
    • Insert an empty row
      gridSizer.insertEmptyRow(rowIndex);\n// gridSizer.insertEmptyRow(rowIndex, proportion, space);\n
      • proportion : Proportion of this new row.
        • undefined : Use proportion of 1st row as default value.
      • space : Space between this new row and previous row.
        • undefined : Use space of 1st row as default value.
    • Add an empty row
      gridSizer.addEmptyRow();\n// gridSizer.addEmptyRow(rowIndex, proportion, space);\n
    • Insert an empty column
      gridSizer.insertEmptyColumn(colIndex);\n// gridSizer.insertEmptyColumn(colIndex, proportion, space);\n
      • proportion : Proportion of this new column.
        • undefined : Use proportion of 1st column as default value.
      • space : Space between this new column and previous column.
        • undefined : Use space of 1st column as default value.
    • Add an empty row
      gridSizer.addEmptyColumn();\n// gridSizer.addEmptyColumn(colIndex, proportion, space);\n
    "},{"location":"ui-gridsizer/#proportion","title":"Proportion","text":"

    Set proportion of each column or row via

    gridSizer.setColumnProportion(columnIndex, proportion);\ngridSizer.setRowProportion(rowIndex, proportion);\n
    "},{"location":"ui-gridsizer/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    gridSizer.layout();\n

    See also - dirty

    "},{"location":"ui-gridsizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-gridsizer/#grid-index-child","title":"Grid index <-> child","text":"
    • Grid index -> child
      var child = gridSizer.getChildAt(columnIndex, rowIndex);\n
    • Child -> grid index
      var gridIndex = gridSizer.childToGridIndex(child);\n// var gridIndex = gridSizer.childToGridIndex(child, out);\n
      • gridIndex : {x, y}, or null if child is not belong this sizer.
    "},{"location":"ui-gridsizer/#remove-child","title":"Remove child","text":"
    • Remove a child
      gridSizer.remove(child);\n
      or
      gridSizer.removeAt(columnIndex, rowIndex);\n
    • Remove and destroy a child
      gridSizer.remove(child, true);\n
      or
      gridSizer.removeAt(columnIndex, rowIndex, true);\n
    • Remove all children
      gridSizer.removeAll();\n
    • Remove and destroy all children
      gridSizer.removeAll(true);\n
    • Remove all children and backgrounds
      gridSizer.clear();\n
    • Remove and destroy all children and backgrounds
      gridSizer.clear(true);\n
    • Remove from parent sizer
      sizer.removeFromParentSizer();\n
    "},{"location":"ui-gridsizer/#sort-children","title":"Sort children","text":"
    • Sort by data
      gridSizer.sortChildrenByData(key, descending).layout();\n
      • key : Data key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by property of child
      gridSizer.sortChildrenByProperty(key, descending).layout();\n
      • key : Property key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by callback
      gridSizer.sortChildren(function(childA, childB){\n// var valueA = childA.getData(key);\n// var valueB = childB.getData(key);\n// return valueB - valueA\n}).layout();\n
      • childA, childB : 2 children of this size
    "},{"location":"ui-gridsizer/#grid-size","title":"Grid size","text":"
    • Amount of column
      var columnCount = gridSizer.columnCount;\n
    • Amount of row
      var rowCount = gridSizer.rowCount;\n
    • Amount of grid = columnCount * rowCount
      var gridCount = gridSizer.gridCount;\n
    "},{"location":"ui-gridsizer/#get-element","title":"Get element","text":"
    • Get element
      • All children items
        var items = gridSizer.getElement('items');\n
    • Get by name
      var gameObject = gridSizer.getElement('#' + name);\n// var gameObject = gridSizer.getElement('#' + name, recursive);\n
      or
      var gameObject = gridSizer.getByName(name);\n// var gameObject = gridSizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-gridsizer/#get-child-index","title":"Get child index","text":"
    var index = sizer.getChildIndex(child);\n
    • index : A number, or null.
    "},{"location":"ui-gridsizer/#reset-grid","title":"Reset grid","text":"
    sizer.resetGrid(column, row, columnProportions, rowProportions, space);\n
    • column : Amount of column grids.
    • row : Amount of row grids.
    • columnProportions, rowProportions : Proportion of each column/row.
      • Number : Apply this number proportion to each column/row
      • Number array : Apply proportion of column/row through elements of this number array.
    • space :
      • space.column : Space between 2 columns
        • A number
        • A number array
      • space.row : Space between 2 rows
        • A number
        • A number array

    Note

    Children game objects will be removed without destroyed.

    Note

    Will invoke createCellContainerCallback to create cellContainer of each cell.

    "},{"location":"ui-gridsizer/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-gridtable/","title":"Grid table","text":""},{"location":"ui-gridtable/#introduction","title":"Introduction","text":"

    A container with a grid table, slider, and scroller.

    • Author: Rex
    • Game object
    "},{"location":"ui-gridtable/#live-demos","title":"Live demos","text":"
    • Grid table
    • Varying cell size
    • Messages
      • Demo 1
      • Demo 2
      • Demo 3
    • Sizer cell:
      • Demo 1
      • Demo 2
    • Click child of cell
    • Two sliders
    • Separator
    • Modal
    • Fixed cell size
    • Drag item
    • Layer + mask padding
    • Fade-out-destroy cell
    • Custom mask
    "},{"location":"ui-gridtable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-gridtable/#install-plugin","title":"Install plugin","text":""},{"location":"ui-gridtable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add table object
      var table = scene.rexUI.add.gridTable(config);\n
    "},{"location":"ui-gridtable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add table object
      var table = scene.rexUI.add.gridTable(config);\n
    "},{"location":"ui-gridtable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { GridTable } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add table object
      var table = new GridTable(scene, config);\nscene.add.existing(table);\n
    "},{"location":"ui-gridtable/#add-table-object","title":"Add table object","text":"
    var table = scene.rexUI.add.gridTable({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// scrollMode: 0,\n\n// Elements\nbackground: backgroundGameObject,\n\ntable: {\nwidth: undefined,\nheight: undefined,\n\ncellWidth: undefined,\ncellHeight: undefined,\ncolumns: 1,\n// rows: 1,\n// fixedCellSize: false,\n\nmask: {\npadding: 0,\n// updateMode: 0,\n},\n// enableLayer: false,\ninteractive: true,\nreuseCellContainer: false,\n\n// click: undefined,\n// tap: undefined,\n// press: undefined,\n// swipe: undefined,\n},\n\nslider: {\n// background: sliderBackgroundGameObject,\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n\n// buttons: {\n//     top: topButtonGameObject, bottom: bottomButtonGameObject,\n//     left: leftButtonGameObject, right: rightButtonGameObject,\n//     step: 0.01,\n// }\n},\n\n// sliderX: {...},\n// sliderY: {...},\n\n// scroller: {\n//     threshold: 10,\n//     slidingDeceleration: 5000,\n//     backDeceleration: 2000,\n//     pointerOutRelease: true,\n//     rectBoundsInteractive: true,\n//     dragRate: 1,\n// },\n\n// scrollerX: {...},\n// scrollerY: {...},\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// }.\n\n// mouseWheelScrollerX: {...},\n// mouseWheelScrollerY: {...},\n\nclampChildOY: false,\n\nheader: headerGameObject,\nfooter: footerGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntable: 0,\n// table: {\n//    top: 0,\n//    bottom: 0,\n//    left: 0,\n//    right: 0,\n//},\n\nslider: 0,\n// slider: {\n//     top: 0,\n//     bottom: 0,\n//     left: 0,\n//     right: 0,\n// },\n// sliderX: 0,\n// sliderY: 0,\n\nheader: 0,\nfooter: 0,\n},\n\nexpand: {\nheader: true,\nfooter: true,\n},\n\nalign: {\nheader: 'center',\nfooter: 'center',\n},\n\ncreateCellContainerCallback: function(cell, cellContainer) {\nvar scene = cell.scene,\nwidth = cell.width,\nheight = cell.height,\nitem = cell.item,\nitems = cell.items,\nindex = cell.index;\nif (cellContainer === null) { // No reusable cell container, create a new one\n// cellContainer = scene.rexUI.add.label();\n}\n// Set child properties of cell container ...\n\n// cell.setCellContainerAlign();  // Set alignment of cellContainer\n\nreturn cellContainer; // or null\n},\n\nitems: [],\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
      • Set width to undefined, and table.width is not undefined, will count width via table + slider.
      • Set height to undefined, and table.height is not undefined, will count height via table + slider.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • scrollMode : Scroll panel vertically, or horizontally.
      • 0, 'vertical', or 'v', 'y' : Scroll panel vertically. Default value.
      • 1, 'horizontal', or 'h'. 'x' : Scroll panel horizontally.
      • 2, or 'xy' : Two-sliders mode, scroll panel vertically and horizontally.
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • table : Configuration of grid table core.
      • table.width : Width of table, in pixels.
        • Set to undefined to expand table width to fit this grid table object.
      • table.height : Height of table, in pixels.
        • Set to undefined to expand table height to fit this grid table object.
      • table.cellHeight : Default height of each cell.
        • Necessary field in vertical scrollMode.
        • undefined : Expand cell height to fit table height, in horizontal scrollMode.
      • table.cellWidth : Width of each cell.
        • Necessary field in horizontal scrollMode.
        • undefined : Expand cell width to fit table width, in vertical scrollMode.
      • table.columns : Columns count of each row. Can be used in vertical or horizontal scroll mode.
      • table.rows : Rows count of each column. Can be used in horizontal scroll mode.
      • table.fixedCellSize : Assign columns according to cellWidth (if scrollMode is 0) or cellHeight (if scrollMode is 1) , when initialize and resizing. \u3000\u3000 - false : Ignore this parameter. Default behavior.
        • true : Set columns according to cellWidth/cellHeight.
      • table.mask : A rectangle mask of cells
        • table.mask.padding : Extra left/right/top/bottom padding spacing of this rectangle mask. Default value is 0.
        • table.mask.updateMode : When to update cells mask
          • 0, or update : Apply mask to cell container only when table.updateTable() is invoked. Default behavior.
          • 1, or everyTick : Apply mask to cell container every tick. Use this mode if game objects of cell are moved after table.updateTable() and still been masked.
        • false : No mask.
      • table.enableLayer :
        • false : Add cell game objects into scene's display list. Default behavior.
        • true : Add cell game objects into an internal layer game object. See also.
      • table.reuseCellContainer :
        • true : Reuse cell container when creating new cell container.
        • false : Destory cell container when cell is invisible, create new cell container when cell is visible. Default behavior.
      • table.interactive : Set true to install touch events (tap/press/over/out/click). Default value is true.
      • table.click : Configuration of cell-click behavior, if table.interactive is true.
        • undefined : Use default click behavior.
      • table.tap : Configuration of cell-tap behavior, if table.interactive is true.
        • undefined : Use default tap behavior.
      • table.press : Configuration of cell-press behavior, if table.interactive is true.
        • undefined : Use default press behavior.
      • table.swipe : Configuration of cell-swipe behavior, if table.interactive is true.
        • undefined : Use default swipe behavior.
    • slider : Componments of slider, optional.
      • slider.background : Game object of slider background, optional.
      • slider.track : Game object of track.
      • slider.thumb : Game object of thumb.
      • slider.input :
        • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.position : Position of this slider.
        • 0, 'right', 'bottom' : Slider at right/bottom side. Default value.
        • 1, 'left', 'top' : Slider at left/top side.
      • slider.hideUnscrollableSlider :
        • false : Slider is always visible no matter it is scrollable or not. Default behavior.
        • true : Set slider to invisible if it is unscrollable.
      • slider.disableUnscrollableDrag :
        • false : Scroller is always enale no matter it is scrollable or not. Default behavior.
        • true : Set scroller to disable if it is unscrollable.
      • slider.adaptThumbSize :
        • false : Don't adjust height/width of thumb. Default behavior.
        • true : Adjust height/width of thumb according to ratio of visible child.
          • Minimum height/width of thumb = slider.minThumbSize. If content is larger then a page.
          • Maximum height/width of thumb = height/width of slider.track. If content is less then a page.
      • slider.minThumbSize : Minimum height/width of thumb used in slider.adaptThumbSize mode.
      • slider.buttons : Press button to scroll content in each tick.
        • slider.buttons.top, slider.buttons.bottom : Top and bottom buttons.
        • slider.buttons.left, slider.buttons.right : Left and right buttons
        • slider.buttons.step : Scrolling step in each tick. Default value is 0.01.
      • Set to false to skip creating slider.
    • sliderX, sliderY : Componments of sliderX and sliderY, for two-sliders mode.
    • scroller : Configuration of scroller behavior.
      • scroller.threshold : Minimal movement to scroll. Set 0 to scroll immediately.
      • scroller.slidingDeceleration : Deceleration of slow down when dragging released.
        • Set false to disable it.
      • scroller.backDeceleration : Deceleration of pull back when out of bounds.
        • Set false to disable it.
      • scroller.pointerOutRelease : Set to true to release input control when pointer out of gameObject.
      • scroller.rectBoundsInteractive :
        • false : Detect scrolling by game object's touch input.
        • true : Detect scrolling by rectangle bounds of game object. Default behavior.
      • scroller.dragRate : Rate of dragging distance/dragging speed. Default value is 1.
      • Set to false to skip creating scroller.
    • scrollerX, scrollerY : Configuration of scrollerX, scrollerY behavior, for two-sliders mode.
    • mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
      • mouseWheelScroller.focus :
        • false, or 0 : Without checking if cursor is over game object or not.
        • true, or 1 : Cursor is inside the rectangle bounds of game object. Default behavior.
        • 2 : Cursor is over game object.
      • mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
      • Set to false to skip creating mouse-wheel-scroller. Default behavior.
    • mouseWheelScrollerX, mouseWheelScrollerY : Configuration of mouse-wheel-scrollerX, or mouse-wheel-scrollerY behavior, for two-sliders mode.
    • clampChildOY : Set true to clamp scrolling.
    • createCellContainerCallback : Callback to return a container object, or null of each visible cell.
      • Properties of cell parameter
        • cell.scene : Scene of this grid table object.
        • cell.width : Width of this cell, in pixels.
        • cell.height : Height of this cell, in pixels.
        • cell.item : Item of this cell to display.
        • cell.items : Array of item data for each cell, equal to items parameter.
        • cell.index : Index of this cell.
      • Alignment of cellContainer :
        cell.setCellContainerAlign(align);\n
        • align :
          • undefined : Set position of cellContainer to left-top of cell space. Default behavior.
          • 'center', or Phaser.Display.Align.CENTER : Align game object at center of cell space.
          • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center of cell space.
          • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center of cell space.
          • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center of cell space.
          • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center of cell space.
      • If cell.align is undefined (default value), Origin of returned cell container will be set to (0, 0)
      • cellContainer : Cell container picked from object pool for reusing. Set reuseCellContainer to true to enable this feature.
        • null : No cell container available.
        • Game object : Reusable cell container.
    • header : Game object of header, optional.
    • footer : Game object of footer, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.table :
        • A number: Space between table object and slider object.
        • An object: Padding of table object.
          • If scrollMode is 0 (vertical) :
            • space.table.top, space.table.bottom : Top, bottom padding space of table object.
            • space.table.right : Space between table object and slider object.
          • If scrollMode is 1 (horizontal) :
            • space.table.left, space.table.right : Left, right padding space of table object.
            • space.table.bottom : Space between table object and slider object.
      • space.slider :
        • 0 : No space around slider.
        • space.slider.left, space.slider.right, space.slider.top, space.slider.bottom : Space around slider.
      • space.sliderX, space.sliderX : Space configuration of sliderX, sliderX, for two-sliders mode.
        • 0 : No space around slider.
      • space.header : Space between header and table.
      • space.footer : Space between footer and table.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width or height of header game object.
      • expand.footer : Set true to expand width or height of footer game object.
    • align : Align element
      • align.header
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • align.footer
    • items : Array of item data for each cell.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    "},{"location":"ui-gridtable/#scroll-mode","title":"Scroll mode","text":"

    If scrollMode parameter is not given :

    • Set scrollMode to 2, if configuration has sliderX, sliderY, or scrollerX, scrollerY parameters.
    • Set scrollMode to 0, if configuration has sliderY, or scrollerY parameters.
    • Set scrollMode to 1, if configuration has sliderX, or scrollerX parameters.
    "},{"location":"ui-gridtable/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGridTable extends RexPlugins.UI.GridTable {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var table = new MyGridTable(scene, config);\n
    "},{"location":"ui-gridtable/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    table.layout();\n

    See also - dirty

    "},{"location":"ui-gridtable/#items","title":"Items","text":"
    • Set
      table.setItems(items);\n
      • items : Array of item data for each cell.
      • This method will update each visible cell of grid table.
    • Clear all items
      table.setItems();\n
    • Get
      var items = table.items;\n
    • Add item
      Phaser.Utils.Array.Add(table.items, item);\ntable.refresh();\n
    • Insert item
      Phaser.Utils.Array.AddAt(table.items, item, index);\ntable.refresh();\n
    • Remove item
      Phaser.Utils.Array.Remove(table.items, item);\ntable.refresh();\n
    • Remove item at index
      Phaser.Utils.Array.RemoveAt(table.items, index);\ntable.refresh();\n
    • Remove items between indexes
      Phaser.Utils.Array.RemoveBetween(table.items, startIndex, endIndex);\ntable.refresh();\n
    • Remove random item
      Phaser.Utils.Array.RemoveRandomElement(table.items);\ntable.refresh();\n
    "},{"location":"ui-gridtable/#cell-container","title":"Cell container","text":"
    • Get
      var container = table.getCellContainer(cellIndex);\n
    "},{"location":"ui-gridtable/#reset-size-of-all-cells","title":"Reset size of all cells","text":"
    table.resetAllCellsSize(width, height);\n
    "},{"location":"ui-gridtable/#scroll-content","title":"Scroll content","text":"
    • Set
      table.childOY = oy;\n// table.setChildOY(oy);\n
    • Set and clamp
      table.setChildOY(oy, true);\n
    • Add
      table.addChildOY(oy);\n
    • Add and clamp
      table.addChildOY(oy, true);\n
    • Get
      var childOY = table.childOY;\n
    • Top OY
      var topOY = table.topChildOY;\n
    • Bottom OY
      var bottomOY = table.bottomChildOY;\n
    • Is overflow (height of content is larger than display height)
      var isOverflow = textArea.isOverflow;\n
    "},{"location":"ui-gridtable/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      table.t = t;  // t: 0~1\n// table.setT(t);  \n
    • Set and clamp
      table.setT(t, true);\n
    • Get
      var t = table.t;\n
    "},{"location":"ui-gridtable/#scroll-to-topbottom","title":"Scroll to top/bottom","text":"
    • Scroll to top
      table.scrollToTop();\n
      • Equal to table.t = 0;
    • Scroll to bottom
      table.scrollToBottom();\n
      • Equal to table.t = 1;
    "},{"location":"ui-gridtable/#scroll-to-row","title":"Scroll to row","text":"
    • Scroll to next row
      table.scrollToNextRow();\n
    • Scroll to next n row
      table.scrollToNextRow(n);\n
    • Scroll to row
      table.scrollToRow(rowIndex);\n
    • Get current row index
      var rowIndex = table.startRowIndex;\n
    "},{"location":"ui-gridtable/#enabledisable-scrolling","title":"Enable/disable scrolling","text":"
    • Slider
      • Set enable state
        table.setSliderEnable(enabled);\n
        or
        table.sliderEnable = enabled;\n
      • Get enable state
        var enable = table.sliderEnable;\n
    • Scroller
      • Set enable state
        table.setScrollerEnable(enabled);\n
        or
        table.scrollerEnable = enabled;\n
      • Get enable state
        var enable = table.scrollerEnable;\n
    • Mouse-Wheel-Scroller
      • Set enable state
        table.setMouseWheelScrollerEnable(enabled);\n
        or
        table.mouseWheelScrollerEnable = enabled;\n
      • Get enable state
        var enable = table.mouseWheelScrollerEnable;\n
    "},{"location":"ui-gridtable/#refresh-table-cells","title":"Refresh table cells","text":"
    • Refresh all visible cells
      table.refresh();\n
      • Equal to table.setItems(table.items).
    • Update a visible cell
      table.updateVisibleCell(cellIndex);\n
    "},{"location":"ui-gridtable/#table-size","title":"Table size","text":"
    • Table width
      var tableWidth = table.getElement('table').tableWidth;\n
    • Table height
      var tableHeight = table.getElement('table').tableHeight;\n
    "},{"location":"ui-gridtable/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-gridtable/#events","title":"Events","text":"
    • Pointer-down cell
      table.on('cell.down', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-up cell
      table.on('cell.up', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over cell
      table.on('cell.over', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-out cell
      table.on('cell.out', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Click cell
      table.on('cell.click', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Tap cell
      table.on(tapEventName, function(cellContainer, cellIndex, pointer) {\n// ...\n}, scope);\n
      • tapEventName : 'cell.1tap', 'cell.2tap', 'cell.3tap', etc ...
      • cellContainer : Container game object of triggered cell.
      • cellIndex : Index of triggered cell.
    • Press cell
      table.on(`cell.pressstart`, function(cellContainer, cellIndex, pointer) {\n// ...\n}, scope);\n
      table.on(`cell.pressend`, function(cellContainer, cellIndex, pointer) {\n// ...\n}, scope);\n
    • Swipe cell
      table.on(swipeEventName, function(cellContainer, cellIndex, pointer) {\n// ...\n}, scope);\n
      • swipeEventName : 'cell.swipeleft', 'cell.swiperight', 'cell.swipeup', 'cell.swipedown'.
    • Scroll table
      table.on('scroll', function(table) {\n// ...\n})\n
    • Slider
      • Slider drag start
        table.getElement('slider').on('inputstart', function(panel) {\n// ...\n})\n
      • Slider drag end
        table.getElement('slider').on('inputend', function(panel) {\n// ...\n})\n
    • Scroller
      • Scroller drag start
        table.getElement('scroller').on('dragstart', function(panel) {\n// ...\n})\n
      • Scroller drag end
        table.getElement('scroller').on('dragend', function(panel) {\n// ...\n})\n
    "},{"location":"ui-gridtable/#interactive-with-child-of-cell","title":"Interactive with child of cell","text":"
    table.on('cell.click', function(cellContainer, cellIndex, pointer, event) {\nvar child;\n// child = cellContainer.getElement(...);\nif (cellContainer.isPointerInBounds(child)) {\n// Pointer on this child\n}\n}, scope);\n

    Reference of isPointerInBounds method

    "},{"location":"ui-gridtable/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = table.getElement('background');\n
      • Grid table
        var tableBody = table.getElement('table');\n
      • Layer of gridtable, assigned at config table.mask.layer.
        var layer = table.getElement('tableLayer');\n
      • Slider
        • Track
          var track = table.getElement('slider.track');\n
        • Thumb
          var thumb = table.getElement('slider.thumb');\n
      • Scroller
        var scroller = table.getElement('scroller');\n
      • Header game object
        var tableBody = table.getElement('header');\n
      • Footer game object
        var tableBody = table.getElement('footer');\n
    • Get by name
      var gameObject = table.getElement('#' + name);\n// var gameObject = table.getElement('#' + name, recursive);\n
      or
      var gameObject = table.getByName(name);\n// var gameObject = table.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-holygrail/","title":"Holy grail","text":""},{"location":"ui-holygrail/#introduction","title":"Introduction","text":"

    Layout elements in Holy grail style.

    • Author: Rex
    • Game object
    "},{"location":"ui-holygrail/#live-demos","title":"Live demos","text":"
    • Simple
    • Align
    • Layout modes
    • Change layout mode
    "},{"location":"ui-holygrail/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-holygrail/#install-plugin","title":"Install plugin","text":""},{"location":"ui-holygrail/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add holy-grail object
      var holyGrail = scene.rexUI.add.holyGrail(config);\n
    "},{"location":"ui-holygrail/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add holy-grail object
      var holyGrail = scene.rexUI.add.holyGrail(config);\n
    "},{"location":"ui-holygrail/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { HolyGrail } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add holy-grail object
      var holyGrail = new HolyGrail(scene, config);\nscene.add.existing(holyGrail);\n
    "},{"location":"ui-holygrail/#add-holygrail-object","title":"Add holyGrail object","text":"
    var holyGrail = scene.rexUI.add.holyGrail({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\n// Elements\nbackground: backgroundGameObject,\n\nheader: headerGameObject,\n\nleftSide: leftSideGameObject,\n\ncontent: contentGameObject,\n\nrightSide: rightSideGameObject,\n\nfooter: footerGameObject,\n\n// Space\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nheader: 0,  // {left, right, top, bottom}\nfooter: 0,  // {left, right, top, bottom}\nleftSide: 0, // {left, right, top, bottom}\nrightSide: 0, // {left, right, top, bottom}\n},\n\n// proportion: {\n//     header: 0,\n//     footer: 0,\n//     leftSide: 0,\n//     rightSide: 0,\n//     content: 1,\n// },\n\n// expand: {\n//     header: true,\n//     footer: true,\n//     leftSide: true,\n//     rightSide: true,\n//     content: false,\n// },\n\n// align: {\n//     header: 'center',\n//     footer: 'center',\n//     leftSide: 'center',\n//     rightSide: 'center',\n//     content: 'center',\n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • layoutMode : Expand left side, right side to bottom row.
      • 0, or 'FFF' : Bottom row is footer. Default behavior
      • 1, or 'LFF' : Left side will expand down to bottom row.
      • 2, or 'FFR' : Right side will expand down to bottom row.
      • 3, or 'LFR' : Left side and right side will expand down to bottom row.
    • background : Game object of background, optional. This background game object will be resized to fit the size of holyGrail.
    • header : Game object of header, optional.
      • Will fixed height (proportion=0) and expand width (expand=true) width default setting.
    • leftSide : Game object of leftSide, optional.
      • Will fixed width (proportion=0) and expand height (expand=true) width default setting.
    • content : Game object of content, optional.
      • Will expand width (proportion=1) and expand height (expand=true) width default setting.
    • rightSide : Game object of rightSide, optional.
      • Will fixed width (proportion=0) and expand height (expand=true) width default setting.
    • footer : Game object of footer, optional.
      • Will fixed height (proportion=0) and expand width (expand=true) width default setting.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.header :
        • A number : Space between header game object and below game object, equal to {bottom}
        • {left, right, top, bottom} : Padding values of header game object.
      • space.footer
        • A number : Space between footer game object and above game object, equal to {top}
        • {left, right, top, bottom} : Padding values of footer game object.
      • space.leftSide :
        • A number : Space between leftSide game object and content game object, equal to {right}
        • {left, right, top, bottom} : Padding values of leftSide game object.
      • space.rightSide :
        • A number : Space between rightSide game object and content game object, equal to {left}
        • {left, right, top, bottom} : Padding values of rightSide game object.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width of header game object. Default is true.
      • expand.footer : Set true to expand width of footer game object. Default is true.
      • expand.leftSide : Set true to expand height of leftSide game object. Default is true.
      • expand.rightSide : Set true to expand height of rightSide game object. Default is true.
      • expand.content : Set true to expand height of content game object. Default is true.
    • proportion : Fixed width or height of element
      • proportion.header :
        • 0 : Fixed height. Default behavior.
        • 1, or other numbers : Expand height.
      • proportion.footer :
        • 0 : Fixed height. Default behavior.
        • 1, or other numbers : Expand height.
      • proportion.leftSide :
        • 0 : Fixed width. Default behavior.
        • 1, or other numbers : Expand width.
      • proportion.rightSide :
        • 0 : Fixed width. Default behavior.
        • 1, or other numbers : Expand width.
      • proportion.content :
        • 0 : Fixed width.
        • 1, or other numbers : Expand width. Default value is 1.
    • align : Align element
      • align.header
      • align.footer
      • align.leftSide
      • align.rightSide
      • align.content
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false..
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-holygrail/#custom-class","title":"Custom class","text":"
    • Define class
      class MyHolyGrail extends RexPlugins.UI.HolyGrail {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var holyGrail = new MyHolyGrail(scene, config);\n
    "},{"location":"ui-holygrail/#layout-modes","title":"Layout modes","text":""},{"location":"ui-holygrail/#mode-0","title":"Mode 0","text":"

    Bottom row is footer. Default behavior.

    Header Left side Content Right side Footer"},{"location":"ui-holygrail/#mode-1","title":"Mode 1","text":"

    Left side will expand down to bottom row.

    Header Left side Content Right side Footer"},{"location":"ui-holygrail/#mode-2","title":"Mode 2","text":"

    Right side will expand down to bottom row.

    Header Left side Content Right side Footer"},{"location":"ui-holygrail/#mode-3","title":"Mode 3","text":"

    Left side and right side will expand down to bottom row.

    Header Left side Content Right side Footer"},{"location":"ui-holygrail/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    holyGrail.layout();\n

    See also - dirty

    "},{"location":"ui-holygrail/#re-build","title":"Re-build","text":"

    Destroy current elements then add elements with new config.

    holyGrail\n.build({\n// Elements\nbackground: backgroundGameObject,\n\nheader: headerGameObject,\n\nleftSide: leftSideGameObject,\n\ncontent: contentGameObject,\n\nrightSide: rightSideGameObject,\n\nfooter: footerGameObject,\n\nlayoutMode: 0,\n\n// Space\nspace: {        header: 0,  // {left, right, top, bottom}\nfooter: 0,  // {left, right, top, bottom}\nleftSide: 0, // {left, right, top, bottom}\nrightSide: 0, // {left, right, top, bottom}\n},\n\n// proportion: {\n//     header: 0,\n//     footer: 0,\n//     leftSide: 0,\n//     rightSide: 0,\n//     content: 1,\n// },\n\n// expand: {\n//     header: true,\n//     footer: true,\n//     leftSide: true,\n//     rightSide: true,\n//     content: false,\n// },\n\n// align: {\n//     header: 'center',\n//     footer: 'center',\n//     leftSide: 'center',\n//     rightSide: 'center',\n//     content: 'center',\n// },\n})\n.layout()\n
    "},{"location":"ui-holygrail/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-holygrail/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = holyGrail.getElement('background');\n
      • Header game object
        var header = holyGrail.getElement('header');\n
      • Left-side game object
        var leftSide = holyGrail.getElement('leftSide');\n
      • Content game object
        var content = holyGrail.getElement('content');\n
      • Right-side game object
        var rightSide = holyGrail.getElement('rightSide');\n
      • Footer game object
        var footer = holyGrail.getElement('footer');\n
    • Get by name
      var gameObject = holyGrail.getElement('#' + name);\n// var gameObject = holyGrail.getElement('#' + name, recursive);\n
      or
      var gameObject = holyGrail.getByName(name);\n// var gameObject = holyGrail.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-imageinputlabel/","title":"Image input label","text":""},{"location":"ui-imageinputlabel/#introduction","title":"Introduction","text":"

    A container with a canvas icon, text, and background. Click icon to popup a (image) file chooser dialog, display selected image on canvas.

    • Author: Rex
    • Game object
    "},{"location":"ui-imageinputlabel/#live-demos","title":"Live demos","text":"
    • Save texture
    "},{"location":"ui-imageinputlabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-imageinputlabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-imageinputlabel/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add image-input label object
      var imageInputLabel = scene.rexUI.add.imageInputLabel(config);\n
    "},{"location":"ui-imageinputlabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin, enable dom element in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\nparent: divId,\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Add image-input label object
      var imageInputLabel = scene.rexUI.add.imageInputLabel(config);\n
    "},{"location":"ui-imageinputlabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { ImageInputLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add image-input label object
      var imageInputLabel = new ImageInputLabel(scene, config);\nscene.add.existing(imageInputLabel);\n
    "},{"location":"ui-imageinputlabel/#add-imageinputlabel-object","title":"Add imageInputLabel object","text":"
    var imageInputLabel = scene.rexUI.add.imageInputLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\ncanvas: {\n// width: 128, \n// height: 128,\n// fill: undefined,\n\n// key: undefined, \n// frame: undefined,        \n},\n\n// scaleUpIcon: false,\n\niconBackground: iconBackgroundGameObject,    // squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\n\naction: actionGameObject,\n// actionMask: false,\n// squareFitAction: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nalign: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0, iconLeft: 0, iconRight: 0,\n\ntext: 0,\nactionTop: 0, actionBottom: 0, actionLeft: 0, actionRight: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n// clickTarget: undefined,\n// domButton: true,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of imageInputLabel.
    • canvas : Parameters of creating canvas game object.
      • canvas.width, canvas.height, canvas.fill : Create canvas with size (canvas.width x canvas.height), filling by color canvas.fill.
      • canvas.key, canvas.frame : Create canvas then paste texture canvas.key, canvas.frame.
    • iconBackground : Game object of iconBackground, optional.
      • icon game object will be created internally by imageBox with canvas.
    • squareFitIcon :
      • true : Resize icon size to square to fit imageInputLabel height/width.
        • Can't work wit expandTextWidth: true
      • false : Ignore this feature. Default behavior.
    • iconSize : Set display size of icon game object to iconSizexiconSize
    • iconWidth : Set display width of icon game object to iconWidth.
      • If iconHeight is undefined, set scaleY of icon game object to scaleX of icon game object, to keep size ratio.
    • iconHeight : Set display height of icon game object to iconHeight.
      • If iconWidth is undefined, set scaleX of icon game object to scaleY of icon game object, to keep size ratio.
    • scaleUpIcon :
      • true : Scale-up canvas game object if its size is smaller than icon (imageBox).
      • false : Keep current size when its size is smaller than icon (imageBox). Default behavior.
    • text : Game object of text, optional.
    • expandTextWidth :
      • false : Keep width of text to original size. Default behavior.
      • true : Expand width of text object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
        • Can't work with squareFitIcon: true.
    • expandTextHeight : Set true to expand height of text object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitAction :
      • true : Resize action icon size to square to fit imageInputLabel height/width.
      • false : Ignore this feature. Default behavior.
    • actionSize : Set display size of action game object to actionSizexactionSize
    • actionWidth : Set display width of action game object to actionWidth.
      • If actionHeight is undefined, set scaleY of action game object to scaleX of action game object, to keep size ratio.
    • actionHeight : Set display height of action game object to actionHeight.
      • If actionWidth is undefined, set scaleX of action game object to scaleY of action game object, to keep size ratio.
    • align : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom, space.iconLeft, space.iconRight : Space around icon game object.
      • space.text : Space between text game object and action icon game object.
      • space.actionTop, space.actionBottom, space.actionLeft, space.actionRight : Space around action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • clickTarget : Click target to open file chooser dialog
      • A string, 'icon', 'text', 'action', 'background' : Click icon, text, action, background game object to open file chooser dialog.
      • undefined : Click this ImageInputLabel game object to open file chooser dialog. Default behavior.
      • null, false : No clickTarget. Open file chooser dialog manually under a touch event.
    • domButton :
      • true : Put DOM buttom above clickTarget, to receive click event.
      • false : Add click event at clickTarget.
        • This mode won't work at ios
    "},{"location":"ui-imageinputlabel/#expand-size-of-text","title":"Expand size of text","text":"

    Expand width/height of text when expandTextWidth/expandTextHeight is true

    To resize text object, text object should have resize method. For example

    class MyText extends Phaser.GameObjects.Text {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\nscene.add.existing(this);\n}\nresize(width, height) {\nthis.setFixedSize(width, height);\nreturn this;\n}\n}\n

    Or uses bbcode text object, tag text object, canvasInput object.

    "},{"location":"ui-imageinputlabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLabel extends RexPlugins.UI.ImageInputLabel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var imageInputLabel = new MyLabel(scene, config);\n
    "},{"location":"ui-imageinputlabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    imageInputLabel.layout();\n

    See also - dirty

    "},{"location":"ui-imageinputlabel/#open-file-chooser-dialog","title":"Open file chooser dialog","text":"

    Failure

    This method can't run at ios.

    Note

    Open a file chooser dialog under any touch event. i.e. User can't open file chooser dialog directly.

    imageInputLabel.openPromise()\n.then(function(file){\n})\n
    • file : File object
    imageInputLabel.open()\n
    "},{"location":"ui-imageinputlabel/#enable-clicking-open","title":"Enable clicking-open","text":"
    • Enable
      imageInputLabel.setClickOpenEnable();\n// imageInputLabel.setClickOpenEnable(true);\n
    • Disable
      imageInputLabel.setClickOpenEnable(false)\n
    "},{"location":"ui-imageinputlabel/#save-texture","title":"Save texture","text":"

    Save image on canvas into texture manager.

    imageInputLabel.saveTexture(key);\n
    "},{"location":"ui-imageinputlabel/#events","title":"Events","text":"
    • Select file
      imageInputLabel.on('select', function(file, imageInputLabel) {\n\n})\n
      • file : File object
    "},{"location":"ui-imageinputlabel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = imageInputLabel.getElement('background');\n
      • Canvas game object (a canvas game object created internally)
        var canvas = imageInputLabel.getElement('canvas');\n
      • Icon background game object
        var iconBackground = imageInputLabel.getElement('iconBackground');\n
      • Icon game object (an imageBox game object created internally)
        var imageBox = imageInputLabel.getElement('icon');\n
      • Text game object
        var textObject = imageInputLabel.getElement('text');\n
      • Action icon game object
        var action = imageInputLabel.getElement('action');\n
      • File chooser game object, if domButton is set to true
        var fileChooser = imageInputLabel.getElement('fileChooser');\n
    • Get by name
      var gameObject = imageInputLabel.getElement('#' + name);\n// var gameObject = imageInputLabel.getElement('#' + name, recursive);\n
      or
      var gameObject = imageInputLabel.getByName(name);\n// var gameObject = imageInputLabel.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-imageinputlabel/#other-properties","title":"Other properties","text":"

    See label), sizer object, base sizer object, container-lite.

    "},{"location":"ui-knob/","title":"Knob","text":""},{"location":"ui-knob/#introduction","title":"Introduction","text":"

    A knob button based on circular progress shape.

    • Author: Rex
    • Game object
    "},{"location":"ui-knob/#live-demos","title":"Live demos","text":"
    • Knob
    "},{"location":"ui-knob/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-knob/#install-plugin","title":"Install plugin","text":""},{"location":"ui-knob/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add knob object
      var knob = scene.rexUI.add.knob(config);\n
    "},{"location":"ui-knob/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add knob object
      var knob = scene.rexUI.add.knob(config);\n
    "},{"location":"ui-knob/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Knob } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add knob object
      var knob = new Knob(scene, config);\nscene.add.existing(knob);\n
    "},{"location":"ui-knob/#add-knob-object","title":"Add knob object","text":"
    var knob = scene.rexUI.add.knob({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nbarColor: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nanticlockwise: false,\n// iterations: 128,\nknobDepth: 0,\n\ntext: undefined,\ntextFormatCallback: undefined,\ntextFormatCallbackScope: undefined,\n\ninput: 'pan',\n\nvalue: 0,\ngap: undefined,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, knob) {\n},\nvaluechangeCallbackScope: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n\nenable: true,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of knob.
    • barColor : Color of circular bar, in number or css string value.
    • trackColor : Color of circular track, in number or css string value.
    • centerColor : Color of center circle, in number or css string value.
    • thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
    • startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
    • anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
    • iterations : Iterations of curve, set larger value to get more smooth rendering result. Default value is 128.
    • knobDepth : Depth of knob (circular progress). Default value is 0.
    • text : Label, Text, BBCodeText, or TagText, which has setText(text) method, optional.
      • Don't set textColor, textStrokeColor if text parameter is provided.
      • Depth of text object ought to larger than knob (circular progress), to put text object in front of knob.
    • Display text :
      • textColor : Color of display text. Default is undefined.
      • textStrokeColor, textStrokeThickness : Stroke color, stroke line width of display text. Default is undefined.
      • textSize, textFamily, textStyle : Size, family, style of display text.
    • textFormatCallback, textFormatCallbackScope : Formating callback of display text. ex:
      function(value) {\nreturn Math.floor(value * 100).toString();\n}\n
      Default value is undefined.
    • input :
      • 'pan', 'drag', or 0 : Control knob by panning circular progress. Default setting.
      • 'click', or 1 : Control knob by touching circular progress.
      • 'none', or -1 : Disable knob controlling.
    • value : Initial value (0 ~ 1).
    • gap : Snap a value to nearest grid slice, using rounding.
      • undefined : Disalbe this feature.
    • easeValue : Easing value when input is 'click'.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • valuechangeCallback : callback function when value changed.
    • enable : Set false to disable controlling.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-knob/#custom-class","title":"Custom class","text":"
    • Define class
      class MyKnob extends RexPlugins.UI.Knob {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var knob = new MyKnob(scene, config);\n
    "},{"location":"ui-knob/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    knob.layout();\n

    See also - dirty

    "},{"location":"ui-knob/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = knob.getElement('background');\n
      • Circular progress game object
        var circularProgress = knob.getElement('knob');\n
      • Text game object
        var text = knob.getElement('text');\n
    • Get by name
      var gameObject = knob.getElement('#' + name);\n// var gameObject = knob.getElement('#' + name, recursive);\n
      or
      var gameObject = knob.getByName(name);\n// var gameObject = knob.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-knob/#enable","title":"Enable","text":"
    • Get
      var enable = knob.enable;\n
    • Set
      knob.setEanble(enable);\n
      or
      knob.enable = enable;\n
    "},{"location":"ui-knob/#value","title":"Value","text":"

    Change value will also change the position of knob thumb and width of knob indicator.

    • Get value
      var value = knob.getValue(min, max); // value : min ~ max\n
      or
      var value = knob.getValue(); // value: 0 ~ 1\n
      or
      var value = knob.value; // value: 0 ~ 1\n
    • Set value
      knob.setValue(value, min, max); // value: min ~ max\n
      or
      knob.setValue(value); // value: 0 ~ 1\n
      or
      knob.value = value; // value: 0 ~ 1\n
    • Increase value
      knob.addValue(inc, min, max); // inc: min ~ max\n
      or
      knob.addValue(inc); // inc: 0 ~ 1\n
      or
      knob.value += inc; // inc: 0 ~ 1\n
    "},{"location":"ui-knob/#ease-value","title":"Ease value","text":"
    • Ease value to
      knob.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      knob.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      knob.stopEaseValue();\n
    • Set ease duration
      knob.setEaseValueDuration(duration);\n
    • Set ease function
      knob.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"ui-knob/#other-properties","title":"Other properties","text":"

    See overlap sizer object, base sizer object, container-lite.

    "},{"location":"ui-knob/#events","title":"Events","text":"
    • On value changed
      knob.on('valuechange', function(newValue, oldValue, knob){\n//\n}, scope);\n
    "},{"location":"ui-label/","title":"Label","text":""},{"location":"ui-label/#introduction","title":"Introduction","text":"

    A container with an icon, text, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-label/#live-demos","title":"Live demos","text":"
    • Align
    • Add to layer
    • Text wrap in horizontal label
    • Text wrap in vertical label
    • Adjust text font size
    • Square fit icon
    • Icon size
    "},{"location":"ui-label/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-label/#install-plugin","title":"Install plugin","text":""},{"location":"ui-label/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.label(config);\n
    "},{"location":"ui-label/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.label(config);\n
    "},{"location":"ui-label/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Label } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new Label(scene, config);\nscene.add.existing(label);\n
    "},{"location":"ui-label/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.label({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\nicon: iconGameObject,\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textGameObject,\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\naction: actionGameObject,\n// actionMask: false,\n// squareFitAction: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nalign: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0, iconLeft: 0, iconRight: 0,\n\ntext: 0,\nactionTop: 0, actionBottom: 0, actionLeft: 0, actionRight: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitIcon :
      • true : Resize icon size to square to fit label height/width.
        • Can't work wit expandTextWidth: true
      • false : Ignore this feature. Default behavior.
    • iconSize : Set display size of icon game object to iconSizexiconSize
    • iconWidth : Set display width of icon game object to iconWidth.
      • If iconHeight is undefined, set scaleY of icon game object to scaleX of icon game object, to keep size ratio.
    • iconHeight : Set display height of icon game object to iconHeight.
      • If iconWidth is undefined, set scaleX of icon game object to scaleY of icon game object, to keep size ratio.
    • text : Game object of text, optional.
    • wrapText : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
        • Text-width will be expanding.
      • 2, 'char' : Character WrapExpandText.
        • Text-width will be expanding.
    • adjustTextFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapText: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.
    • expandTextWidth :
      • false : Keep width of text to original size. Default behavior.
      • true : Expand width of text object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
        • Can't work with squareFitIcon: true.
    • expandTextHeight : Set true to expand height of text object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitAction :
      • true : Resize action icon size to square to fit label height/width.
      • false : Ignore this feature. Default behavior.
    • actionSize : Set display size of action game object to actionSizexactionSize
    • actionWidth : Set display width of action game object to actionWidth.
      • If actionHeight is undefined, set scaleY of action game object to scaleX of action game object, to keep size ratio.
    • actionHeight : Set display height of action game object to actionHeight.
      • If actionWidth is undefined, set scaleX of action game object to scaleY of action game object, to keep size ratio.
    • align : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom, space.iconLeft, space.iconRight : Space around icon game object.
      • space.text : Space between text game object and action icon game object.
      • space.actionTop, space.actionBottom, space.actionLeft, space.actionRight : Space around action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-label/#expand-size-of-text","title":"Expand size of text","text":"

    Expand width/height of text when expandTextWidth/expandTextHeight is true

    To resize text object, text object should have resize method. For example

    class MyText extends Phaser.GameObjects.Text {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\nscene.add.existing(this);\n}\nresize(width, height) {\nthis.setFixedSize(width, height);\nreturn this;\n}\n}\n

    Or uses bbcode text object, tag text object, or canvasInput object.

    "},{"location":"ui-label/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLabel extends RexPlugins.UI.Label {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyLabel(scene, config);\n
    "},{"location":"ui-label/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-label/#change-childrens-align-mode","title":"Change children's align mode","text":"
    label\n.setChildrenAlignMode(mode)\n.layout();\n
    • mode : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
        • Remove first and last space children.
      • 'center' : Align game objects at center.
        • Add two spaces as first and last children.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
        • Add space as first child.
    "},{"location":"ui-label/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = label.getElement('background');\n
      • Icon game object
        var icon = label.getElement('icon');\n
      • Text game object
        var textObject = label.getElement('text');\n
      • Action icon game object
        var action = label.getElement('action');\n
    • Get by name
      var gameObject = label.getElement('#' + name);\n// var gameObject = label.getElement('#' + name, recursive);\n
      or
      var gameObject = label.getByName(name);\n// var gameObject = label.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-label/#text","title":"Text","text":"
    • Get text string
      var s = label.text;\n
    • Set text string
      label.setText(s);\n
      or
      label.text = s;\n
    • Append text string
      label.appendText(text);\n// label.text += '\\n' + text;\n
      or
      label.appendText(text, false);\n// label.text += text;\n
    "},{"location":"ui-label/#icon-texture","title":"Icon texture","text":"
    • Set texture
      label.setTexture(key);\n// label.setTexture(key, frame);\n
    • Set texture via texture object
      label.setTexture(texture);\n// label.setTexture(texture, frame);\n
    • Get texture, frame
      var texture = label.texture;\nvar frame = label.frame;\n
    • Get texture key, frame name
      var textureKey = label.texture.key;\nvar frameName = label.frame.name;\n
    "},{"location":"ui-label/#reset-display-content","title":"Reset display content","text":"
    label.resetDisplayContent({\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n})\n

    or

    label.resetDisplayContent(text);\n
    • text : Set text string.
    • icon, iconFrame
      • A string : Set texture of icon game object.
      • undefined, or null : Hide icon game object.
      • true : Show icon game object without change its texture.
    • iconSize : Set display size of icon game object.
    • action, actionFrame
      • A string : Set texture of icon game object.
      • undefined, or null : Hide action game object.
      • true : Show action game object without change its texture.
    • actionSize : Set display size of action game object.

    Run label.layout() after this method, to layout children again.

    "},{"location":"ui-label/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-menu/","title":"Menu","text":""},{"location":"ui-menu/#introduction","title":"Introduction","text":"

    A container with buttons and sub-menu.

    • Author: Rex
    • Game object
    "},{"location":"ui-menu/#live-demos","title":"Live demos","text":"
    • Pop-up menu
    • Static menu
    • Drop-down list
    • Expand, collapse
    • Custom transit
    "},{"location":"ui-menu/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-menu/#install-plugin","title":"Install plugin","text":""},{"location":"ui-menu/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add menu object
      var menu = scene.rexUI.add.menu(config);\n
    "},{"location":"ui-menu/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add menu object
      var menu = scene.rexUI.add.menu(config);\n
    "},{"location":"ui-menu/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Menu } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add menu object
      var menu = new Menu(scene, config);\nscene.add.existing(menu);\n
    "},{"location":"ui-menu/#add-menu-object","title":"Add menu object","text":"
    var menu = scene.rexUI.add.menu({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n\n// popup: true,\n// orientation: 1,\n// subMenuSide: undefined,\nitems: [],\n\ncreateBackgroundCallback: function(items) {\nvar scene = items.scene;\n// background = ...\nreturn background;\n},\ncreateBackgroundCallbackScope: undefined,\n\ncreateButtonCallback: function(item, index, items) {\nvar scene = item.scene;\n// var isFirstButton = (index === 0);\n// var isLastButton = (index === (items.length - 1));\n// container = ...\nreturn container;\n},\ncreateButtonCallbackScope: undefined,\n\neaseIn: 0,\n// easeIn: {\n//     duration: 500,\n//     orientation: undefined,\n//     ease: 'Cubic'\n// },\ntransitIn: undefined,\n// transitIn: function(menu, duration) {  },\n\neaseOut: 0,\n// easeOut: {\n//     duration: 100,\n//     orientation: undefined,\n//     ease: 'Linear'\n// },\ntransitOut: undefined,\n// transitOut: function(menu, duration) {  },\n\n// expandEvent: 'button.click',\n\n// pointerDownOutsideCollapsing: true,\n\n// childrenKey: 'children',\n\nname: '',\n// draggable: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • popup :
      • true : Pop-up menu, will layout automatically, push inside viewport. Default behavior.
      • false : Static menu, can put into another sizer, won't layout automatically.
    • orientation : Main orientation of the menu, default is 1 (top to bottom)
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange buttons from left ot right.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange buttons from top to bottom.
    • items : Array of item data for each button. Each item has
      • children : An array of items for sub-menu, optional. Can change by childrenKey parameter.
      • Other custom properties
    • createBackgroundCallback : Callback to return container object of menu's bckground.
      • Properties of items parameter
        • items.scene : Scene of this menu object.
    • createButtonCallback : Callback to return container object of each item.
      • Properties of item parameter
        • item.scene : Scene of this menu object.
        • Other custom properties
    • easeIn : Duration of expanding menu.
      • A number : Duration of ease, in milliseconds.
      • An object :
        • easeIn.duration : Duration of ease, in milliseconds.
        • easeIn.ease : Ease function, default is 'Cubic'
        • easeIn.orientation : Orientation of ease.
          • undefined : The same orientation with menu's orientation.
          • 'h', 'x', or 0 : Pop-up menu horizontally.
          • 'v', 'y', or 1 : Pop-up menu vertically.
    • transitIn : Tween behavior of expanding menu.
      • undefined : Expand menu by pop-up, default behavior.
      • Custom callback
        function(menu, duration) {\n\n}\n
    • easeOut : Duration of collapsing menu
      • A number : Duration of ease, in milliseconds.
      • An object :
        • easeOut.duration : Duration of ease, in milliseconds.
        • easeOut.ease : Ease function, default is 'Linear'
        • easeOut.orientation : Orientation of ease.
          • undefined : The same orientation with menu's orientation.
          • 'h', 'x', or 0 : Scale-down menu horizontally.
          • 'v', 'y', or 1 : Scale-down menu vertically.
    • transitOut : Tween behavior of collapsing menu.
      • undefined : Collapse menu by scale-down, default behavior.
      • Custom callback
        function(menu, duration) {\n\n}\n
    • expandEvent : Event name of expanding sub-menu.
      • 'button.click' : Default value
      • 'button.over'
    • pointerDownOutsideCollapsing :
      • true : Collapse all menus (popup:true), or sub-menus (popup:false) when pointer-down outside of all menus. Default behavior.
      • false : Ignore pointer-down outside detection.
    • childrenKey : Key of sub-menu in element of items.
      • children : Default value.
    • subMenuSide : Side of sub-menu
      • undefined : Determine side of sub-menu automatically.
      • 'right', or 0 : Put sub-menu at right side. Used with orientation is set to y.
      • 'left', or 2 : Put sub-menu at left side. Used with orientation is set to y.
      • 'up', or 3 : Put sub-menu at up side. Used with orientation is set to x.
      • 'down', or 1 : Put sub-menu at down side. Used with orientation is set to x.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    "},{"location":"ui-menu/#custom-class","title":"Custom class","text":"
    • Define class
      class MyMenu extends RexPlugins.UI.Menu {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var menu = new MyMenu(scene, config);\n
    "},{"location":"ui-menu/#collapse","title":"Collapse","text":"
    • Collapse menu
      menu.collapse();\n
    • Collapse sub-menu
      menu.collapseSubMenu();\n
    "},{"location":"ui-menu/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-menu/#events","title":"Events","text":"
    • Click button
      menu.on('button.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over button
      menu.on('button.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-out button
      menu.on('button.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Expand(Pop-up start) sub-menu
      menu.on('expand', function(subMenu, parentButton) {\n// ....\n}, scope)\n
      • subMenu : Sub-menu.
      • parentButton : Game object of triggered button.
      • rootMenu : Root-menu
    • Pop-up root-menu, or sub-menu completely
      menu.on('popup.complete', function(menu) {\n// ....\n}, scope)\n
      • menu : Root-menu, or sub-menu
    • Collapse(Scale-down starting) root-menu, or sub-menu
      menu.on('collapse', function(subMenu, parentButton, rootMenu) {\n// ....\n}, scope)\n
      • subMenu : Sub-menu.
      • parentButton : Game object of triggered button.
      • rootMenu : Root-menu
    • Scale-down root-menu completely
      menu.on('scaledown.complete', function(rootMenu) {\n// ....\n}, scope)\n
      • rootMenu : Root-menu
    "},{"location":"ui-nameinputdialog/","title":"Name input dialog","text":""},{"location":"ui-nameinputdialog/#introduction","title":"Introduction","text":"

    Enter first name and last name via a dialog.

    • Author: Rex
    • Game object
    "},{"location":"ui-nameinputdialog/#live-demos","title":"Live demos","text":"
    • Horizontal-layout
    • Vertical-layout
    "},{"location":"ui-nameinputdialog/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-nameinputdialog/#install-plugin","title":"Install plugin","text":""},{"location":"ui-nameinputdialog/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add dialog object
      var dialog = scene.rexUI.add.nameInputDialog(style).resetDisplayContent(config);\n// var dialog = scene.rexUI.add.nameInputDialog(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-nameinputdialog/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dialog object
      var dialog = scene.rexUI.add.nameInputDialog(style).resetDisplayContent(config);\n// var dialog = scene.rexUI.add.nameInputDialog(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-nameinputdialog/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { NameInputDialog } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dialog object
      var dialog = new NameInputDialog(scene, config);\n// var dialog = new NameInputDialog(scene, config, creators);\nscene.add.existing(dialog);\ndialog.resetDisplayContent(config);\n
    "},{"location":"ui-nameinputdialog/#add-dialog-object","title":"Add dialog object","text":"
    var dialog = scene.rexUI.add.nameInputDialog({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundStyle,\n// background: null,\n\ntitle: titleStyle,  // SimpleLabelConfig\n// title: null,\n\nfirstNameTitle: titleStyle,  // SimpleLabelConfig\n// firstNameTitle: null,\n\nfirstNameInput: inputTextStyle, // CanvasInputTextConfig\n\nlastNameTitle: titleStyle,  // SimpleLabelConfig\n// firstNameTitle: null,\n\nlastNameInput: inputTextStyle, // CanvasInputTextConfig\n\ncontent: contentStyle, // SimpleLabelConfig, or TextAreaStyle\n// content: null,\n\nbutton: SimpleLabelConfig,\n\n// Space\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntitle: 0,\ntitleLeft: 0,\ntitleRight: 0,\n\nnames: 0,\nnamesLeft: 0,\nnamesRight: 0,\nfirstName: 0,\nfirstNameTitle: 0,\nlastNamTitle: 0,\n\nactionsLeft: 0,\nactionsRight: 0,\naction: 0,\n},\n\nproportion: {\ntitle: 0,\nactions: 0,\n},\n\nexpand: {\ntitle: true,\nactions: false,\n},\n\nalign: {\ntitle: 'center',\nactions: 'center',\n},\n\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\nmodal: {\ncover: {\ncolor: 0x0,\nalpha: 0.8,\ntransitIn: function(gameObject, duration) { },\ntransitOut: function(gameObject, duration) { },\n},\n// cover: false, \n\n// When to close modal dialog?\ntouchOutsideClose: false,\nanyTouchClose: false,\ntimeOutClose: false,\nmanualClose: false,\n\nduration: {\nin: 200,\nhold: 2000,\nout: 200\n}\n\ntransitIn: 0,\ntransitOut: 0,\n\ndestroy: true,\n\ndefaultBehavior: true,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n// nameInputButtonIndex: 0,\n// cancelButtonIndex: 1,\n\n}, creators);\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • title, firstNameTitle, lastNameTitle :
      • Styles of simple-label
      • null : Don't create any game object.
    • firstNameInput, lastNameInput :
      • Styles of canvas-input
    • button :
      • Styles of simple-label, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.title : Space between title game object and below game object.
      • space.titleLeft, space.titleRight : Extra left/right padding of title game object.
      • space.names : Space between names and action buttons.
      • space.namesLeft, space.namesRight : Extra left/right padding of names.
      • space.firstName : Space between first name and last name.
      • space.firstNameTitle : Space between firstNameTitle and firstNameInput.
      • space.lastNameTitle : Space between lastNameTitle and lastNameInput.
      • space.action : Space between each action-button game objects.
    • proportion : Keep height of element, or expand height of element.
      • proportion.title : Set to 1 to expand height of title. Default is 0.
      • proportion.actions : Set to 1 to expand height of actions. Default is 0.
    • expand : Expand width of element
      • expand.title : Set true to expand width of title game object. Default is true.
      • expand.actions : Set true to expand width of actions game object. Default is false.
    • align : Align element
      • align.title
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value. Will add Spaces at right and left sides.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center. Will add a Space at right side.
      • align.actions : Align action game objects to 'left'/'center'/'right', if expand.actions is false.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • modal : Configuration of modal, See Modal behavior.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false..
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • nameInputButtonIndex, cancelButtonIndex : Button index for firing 'nameInput', 'cancel' events. Default values are 0, 1.
    • creators : Callbacks for creating components.
      {\nbackground: undefined,\ntitle: undefined,\nfirstNameTitle: undefined,\nlastNameTitle: undefined,\nbutton: undefined,\n}\n
      • creators.background : Callback to create background of dialog. Default behavior is creating a round-rectangle-shape.
        function(scene, config)  {\nreturn gameObject;\n}\n
      • creators.title, creators.firstNameTitle, creators.lastNameTitle, creators.button : Creators of simple-label, included these properties
        {\nbackground: undefined,\ntext: undefined,\nicon: undefined,\naction: undefined,\n}\n
    "},{"location":"ui-nameinputdialog/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDialog extends RexPlugins.UI.NameInputDialog {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dialog = new MyDialog(scene, config, creators);\n
    "},{"location":"ui-nameinputdialog/#reset-display-content","title":"Reset display content","text":"
    dialog.resetDisplayContent({\ntitle: '',\nfirstNameTitle: '',\nlastNameTitle: '',\nbutton: '',\n\nfirstName: '',\nlastName: '',\n});\n

    or

    dialog.resetDisplayContent({\ntitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nfirstNameTitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nlastNameTitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbutton: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nfirstName: '',\n\nlastName: ''\n});\n
    • title, firstNameTitle, lastNameTitle : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
      • null : Hide title or firstNameTitle, lastNameTitle element.
    • button : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
    • firstName, lastNmae : A string

    Run dialog.layout() after this method, to layout children again.

    "},{"location":"ui-nameinputdialog/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    dialog.layout();\n

    See also - dirty

    "},{"location":"ui-nameinputdialog/#modal","title":"Modal","text":"

    Pop this dialog as modal dialog, close this modal dialog when clicking action button.

    dialog.modal(onClose);  // Use default modal config\n

    or

    dialog.modal({\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0,\n// transitOut: 0,\n\n// destroy: true\n}, onClose);\n

    or

    dialog\n.modalPromise(config)\n.then(function(data){\nvar firstName = data.firstName;\nvar lastName = data.lastName;\n})\n
    • config : See Modal behavior
      • config.defaultBehavior :
        • undefined, or true : Will close modal dialog when clicking any action button.
        • false : Disable default behavior.
    • onClose : Callback when closing modal dialog
      function(data) {\nvar firstName = data.firstName;\nvar lastName = data.lastName;\n}\n
      • data : Contains these properties
        • data.firstName : Enter string of firstNameInput.
        • data.lastName : Enter string of lastNameInput.
    "},{"location":"ui-nameinputdialog/#names-input","title":"Names input","text":"
    • First name
      • Get
        var firstName = dialog.firstName;\n
      • Set
        dialog.setFirstName(value);\n// data.firstName = value;\n
    • Last name
      • Get
        var lastName = dialog.lastName;\n
      • Set
        dialog.setLastName(value);\n// data.lastName = value;\n
    "},{"location":"ui-nameinputdialog/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = dialog.getElement('background');\n
      • Title game object
        var title = dialog.getElement('title');\n
      • FirstName-title game object
        var firstNameTitle = dialog.getElement('firstNameTitle');\n
      • FirstName-input game object
        var firstNameInput = dialog.getElement('firstNameInput');\n
      • LastName-title game object
        var lastNameTitle = dialog.getElement('lastNameTitle');\n
      • LastName-input game object
        var lastNameInput = dialog.getElement('lastNameInput');\n
      • Button game object
        var button = dialog.getElement('button');\n
    • Get by name
      var gameObject = dialog.getElement('#' + name);\n// var gameObject = dialog.getElement('#' + name, recursive);\n
      or
      var gameObject = dialog.getByName(name);\n// var gameObject = dialog.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-nameinputdialog/#other-properties","title":"Other properties","text":"

    See dialog, sizer object, base sizer object, container-lite.

    "},{"location":"ui-nameinputdialog/#events","title":"Events","text":"
    • Click confirm button
      dialog.on('confirm', function (data) {\nvar firstName = data.firstName;\nvar lastName = data.lastName;\n}, scope);\n
      • data : See modal
    "},{"location":"ui-namevaluelabel/","title":"Name value label","text":""},{"location":"ui-namevaluelabel/#introduction","title":"Introduction","text":"

    A container with name text, value text in a row, with a horizontal line progress bar, and an icon, background.

    • Author: Rex
    • Game object
    "},{"location":"ui-namevaluelabel/#live-demos","title":"Live demos","text":"
    • Name-value label
    • Custom bar
    "},{"location":"ui-namevaluelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-namevaluelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-namevaluelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.nameValueLabel(config);\n
    "},{"location":"ui-namevaluelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.nameValueLabel(config);\n
    "},{"location":"ui-namevaluelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { NameValueLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new NameValueLabel(scene, config);\nscene.add.existing(label);\n
    "},{"location":"ui-namevaluelabel/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.nameValueLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\n\nnameText: nameTextGameObject,\nvalueText: valueTextGameObject,\n// valueTextFormatCallback: function(value, min, max) {\n//     return `${value}/${max}`;\n// },\n// valueTextFormatCallback: null,\n\n// barShape: 'line',   // 'line', or 'circle'\n\n// line bar\nbar: {        trackColor: undefined,\ntrackThickness: 2,\ntrackStrokeColor: undefined,\nbarColor: undefined,\nbarColor2: undefined,\n\nskewX: 0,\n\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'linear'\n},\n}, // circle bar\n/*\n    bar: {\n        barColor: undefined,\n        barColor2: undefined,\n        trackColor: undefined,\n        centerColor: undefined,\n        thickness: 0.2,\n        startAngle: Phaser.Math.DegToRad(270),\n        endAngle: Phaser.Math.DegToRad(270+360),\n        anticlockwise: false,\n    }\n    */\n\n// bar: CustomProgressGameObject,\n\n// bar: undefined,\n\naction: actionGameObject,\nactionMask: false,\n\nalign: {        text: 'bottom',  // 'top', 'center', 'bottom'\n},\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0,\nname: 0, value: 0,\nbar:0, barBottom: 0, barLeft: 0, barRight: 0,\ntext: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • nameText : Game object of nameText.
      • OriginX of nameText will be set to 0.
      • Empty text will be set to a space character ' '. To preserve height of this text game object.
    • valueText : Game object of valueText.
      • OriginX of nameText will be set to 1.
      • Empty text will be set to a space character ' '. To preserve height of this text game object.
    • valueTextFormatCallback : Callback to return a string set to valueText game object when invokeing label.setValue(value, min, max) method.
      • A callback
        function(value, min, max) {\nreturn `${value}/${max}`;\n}\n
      • null, or false : Don't set valueText game object.
    • barShape : 'line' or 'circle'.
    • bar : Game object of bar, or config of horizontal line progress bar, or config of circular progress bar or undefined.
      • Config of horizontal line progress bar
        • bar.trackColor : Fill color of bar's track, in number or css string value.
        • bar.trackStrokeColor : Stroke color of bar's track, in number or css string value.
        • bar.trackThickness : Stroke line width of bar's track.
        • bar.barColor, bar.barColor2 : Fill color of bar, in number or css string value. Assign gradient start color by barColor2.
        • bar.skewX : Horizontal skew of track and bar.
        • bar.rtl :
          • false : Bar starts from left side. Default behavior.
          • true : Bar starts from right side.
      • Config of circular progress bar
        • bar.barColor, bar.barColor2 : Fill color of circular bar, in number or css string value. Assign gradient start color by barColor2.
        • bar.trackColor : Color of circular track, in number or css string value.
        • bar.centerColor : Color of center circle, in number or css string value.
        • bar.thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
        • bar.startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
        • bar.endAngle : End angle of circular bar, in radians. Default value is 270+360 degrees.
        • bar.anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
      • (CustomProgress) Game object.
      • undefined : No bar game object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • align :
      • align.text : Alignment of nameText, valueText game objects.
        • 'top', 'center', or 'bottom'. Default value is 'bottom'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom : Space around icon game object.
      • space.name : Left space of nameText game object.
      • space.value : Right space of valueText game object.
      • space.bar, space.barLeft, space.barRight, space.barBottom : Space around bar game object.
      • space.text : Space between text game object and action icon game object.
      • space.actionTop, space.actionBottom : Space around action game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-namevaluelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNameValueLabel extends RexPlugins.UI.NameValueLabel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyNameValueLabel(scene, config);\n
    "},{"location":"ui-namevaluelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-namevaluelabel/#name-text","title":"Name text","text":"
    • Get nameText string
      var s = label.nameText;\n
    • Set nameText string
      label.setNameText(s);\n
      or
      label.nameText = s;\n
    "},{"location":"ui-namevaluelabel/#value-text","title":"Value text","text":"
    • Get valueText string
      var s = label.valueText;\n
    • Set valueText string
      label.setValueText(s);\n
      or
      label.valueText = s;\n
    "},{"location":"ui-namevaluelabel/#bar","title":"Bar","text":"
    • Get bar value
      var s = label.barValue;\n
    • Set bar value
      label.setBarValue(value);  // 0~1\n
      or
      label.setBarValue(value, min, max);  // min~max\n
      or
      label.barValue = t;  // 0~1\n
    • Ease bar value
      label.easeBarValueTo(value);  // 0~1\n
      or
      label.easeBarValueTo(value, min, max);    // min~max\n
    "},{"location":"ui-namevaluelabel/#icon-texture","title":"Icon texture","text":"
    • Set texture
      label.setTexture(key);\n// label.setTexture(key, frame);\n
    • Set texture via texture object
      label.setTexture(texture);\n// label.setTexture(texture, frame);\n
    • Get texture, frame.
      var texture = label.texture;\nvar frame = label.frame;\n
    • Get texture key, frame name.
      var textureKey = label.texture.key;\nvar frameName = label.frame.name;\n
    "},{"location":"ui-namevaluelabel/#set-value","title":"Set value","text":"
    • Set valueText game object and bar game object.
      label.setValue(value, min, max);\n// label.setValue(value);  // min, max are not changed\n
      or
      label.setValue(value);  // min, max are not changed\n
      Will invoke valueTextFormatCallback callback.
    • Ease valueText game object and bar game object.
      label\n.setEaseValueDuration(duration)\n.easeValueTo(value, min, max);\n
      or
      label\n.setEaseValueDuration(duration)\n.easeValueTo(value);  // min, max are not changed\n
      Will invoke valueTextFormatCallback callback.
    • Get values
      var value = label.value;\nvar max = label.maxValue;\nvar min = label.minValue;\n
      • value will ease during label.easeValueTo() task.
    "},{"location":"ui-namevaluelabel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = label.getElement('background');\n
      • Icon game object
        var icon = label.getElement('icon');\n
      • NameText game object
        var nameTextObject = label.getElement('name');\n
      • ValueText game object
        var valueTextObject = label.getElement('value');\n
      • Bar game object
        var textObject = label.getElement('bar');\n
      • Action icon game object
        var action = label.getElement('action');\n
    • Get by name
      var gameObject = label.getElement('#' + name);\n// var gameObject = label.getElement('#' + name, recursive);\n
      or
      var gameObject = label.getByName(name);\n// var gameObject = label.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-namevaluelabel/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-numberbar/","title":"Number bar","text":""},{"location":"ui-numberbar/#introduction","title":"Introduction","text":"

    A container with an icon, slider, text, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-numberbar/#live-demos","title":"Live demos","text":"
    • Number bar
    • Color picker
    • Video player
    "},{"location":"ui-numberbar/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-numberbar/#install-plugin","title":"Install plugin","text":""},{"location":"ui-numberbar/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin(\n\"rexuiplugin\",\n\"https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js\",\n\"rexUI\",\n\"rexUI\"\n);\n
    • Add number bar object
      var numberBar = scene.rexUI.add.numberBar(config);\n
    "},{"location":"ui-numberbar/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from \"phaser3-rex-plugins/templates/ui/ui-plugin.js\";\nvar config = {\n// ...\nplugins: {\nscene: [\n{\nkey: \"rexUI\",\nplugin: UIPlugin,\nmapping: \"rexUI\",\n},\n// ...\n],\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add number bar object
      var numberBar = scene.rexUI.add.numberBar(config);\n
    "},{"location":"ui-numberbar/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { NumberBar } from \"phaser3-rex-plugins/templates/ui/ui-components.js\";\n
    • Add number bar object
      var sizer = new NumberBar(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-numberbar/#add-number-bar-object","title":"Add number bar object","text":"
    var numberBar = scene.rexUI.add.numberBar({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\nslider: {\nbackground: backgroundGameObject,\n/* \n        background: { \n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */    indicator: indicatorGameObject,\n/* \n        indicator: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\ninput: 'drag',\ngap: undefined,        easeValue: {\nduration: 0,\nease: 'Linear'\n},\n}\ntext: textGameObject,\n\nvaluechangeCallback: function(newValue, oldValue, numberBar) {\n// numberBar.text = Math.round(Phaser.Math.Linear(0, 100, newValue));\n}\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\nslider: 0,\n},\n\nenable: true,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of numberBar.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
    • slider : Slider game object which composed of
      • slider.width : Fixed width of slider, optional. Width of slider will be extended if this value is not set.
      • slider.background :
        • Game object of background, optional. This background game object will be resized to fit the size of slider.
        • A plain object to create round rectangle shape
          { radius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.track :
        • Game object of track, optional. This track game object will be resized to fit the size of slider, with space.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.indicator :
        • Game object of indicator, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.thumb :
        • Game object of thumb, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.input :
        • 'pan', 'drag', or 0 : Control knob by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.gap : Snap a value to nearest grid slice, using rounding.
        • undefined : Disable this feature.
      • slider.easeValue : Easing value when input is 'click'.
        • slider.easeValue.duration : Duration of value easing, default is 0 (no easing).
        • slider.easeValue.ease : Ease function, default is 'Linear'.
    • text : Game object of text, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds
      • space.icon : Space between icon game object and text game object.
      • space.slider : Space between slider game object and text game object.
    • valuechangeCallback : callback function when value changed.
    • enable : Set false to disable controlling.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-numberbar/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNumberBar extends RexPlugins.UI.NumberBar {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var numberBar = new MyNumberBar(scene, config);\n
    "},{"location":"ui-numberbar/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    numberBar.layout();\n

    See also - dirty

    "},{"location":"ui-numberbar/#get-element","title":"Get element","text":"
    • Get element
    • Background game object
      var background = numberBar.getElement(\"background\");\n
    • Icon game object
      var icon = numberBar.getElement(\"icon\");\n
    • Slider game object
      • Slider background
        var sliderBackground = numberBar.getElement(\"slider.background\");\n
      • Slider track
        var sliderTrack = numberBar.getElement(\"slider.track\");\n
      • Slider indicator
        var sliderIndicator = numberBar.getElement(\"slider.indicator\");\n
      • Slider thumb
        var sliderThumb = numberBar.getElement(\"slider.thumb\");\n
    • Text game object
      var textObject = numberBar.getElement(\"text\");\n
    • Get by name
      var gameObject = numberBar.getElement(\"#\" + name);\n// var gameObject = numberBar.getElement('#' + name, recursive);\n
      or
      var gameObject = numberBar.getByName(\"#\" + name);\n// var gameObject = numberBar.getByName(name, recursive);\n
    • recursive : Set true to search all children recursively.
    "},{"location":"ui-numberbar/#enable","title":"Enable","text":"
    • Get
      var enable = numberBar.enable;\n
    • Set
      numberBar.setEanble(enable);\n
      or
      numberBar.enable = enable;\n
    "},{"location":"ui-numberbar/#value","title":"Value","text":"

    Change value will also change the position of slider thumb and width of slider indicator.

    • Get value
      var value = numberBar.getValue(min, max); // value : min ~ max\n
      or
      var value = numberBar.getValue(); // value: 0 ~ 1\n
      or
      var value = numberBar.value; // value: 0 ~ 1\n
    • Set value
      numberBar.setValue(value, min, max); // value: min ~ max\n
      or
      numberBar.setValue(value); // value: 0 ~ 1\n
      or
      numberBar.value = value; // value: 0 ~ 1\n
    • Increase value
      numberBar.addValue(inc, min, max); // inc: min ~ max\n
      or
      numberBar.addValue(inc); // inc: 0 ~ 1\n
      or
      numberBar.value += inc; // inc: 0 ~ 1\n
    "},{"location":"ui-numberbar/#ease-value","title":"Ease value","text":"
    • Ease value to
      numberBar.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      numberBar.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      numberBar.stopEaseValue();\n
    • Set ease duration
      numberBar.setEaseValueDuration(duration);\n
    • Set ease function
      numberBar.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"ui-numberbar/#text","title":"Text","text":"
    • Get text string
      var s = numberBar.text;\n
    • Set text string
      numberBar.setText(s);\n
      or
      numberBar.text = s;\n
    "},{"location":"ui-numberbar/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-numberbar/#events","title":"Events","text":"
    • On value changed
      numberBar.on('valuechange', function (newValue, oldValue, numberBar) {\n// numberBar.text = Math.round(Phaser.Math.Linear(0, 100, newValue));\n}, scope);\n
    • On input start
      numberBar.on('inputstart', function(pointer) {\n\n}, scope);\n
    • On input end
      numberBar.on('inputend', function(pointer) {\n\n}, scope);\n
    "},{"location":"ui-overlapsizer/","title":"Overlap sizer","text":""},{"location":"ui-overlapsizer/#introduction","title":"Introduction","text":"

    Layout children game objects overlapped.

    • Author: Rex
    • Game object
    "},{"location":"ui-overlapsizer/#live-demos","title":"Live demos","text":"
    • Overlap
    • Aspect ratio
    • Fit viewport
    "},{"location":"ui-overlapsizer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-overlapsizer/#install-plugin","title":"Install plugin","text":""},{"location":"ui-overlapsizer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add sizer object
      var sizer = scene.rexUI.add.overlapSizer(config);\n
    "},{"location":"ui-overlapsizer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sizer object
      var sizer = scene.rexUI.add.overlapSizer(config);\n
    "},{"location":"ui-overlapsizer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { OverlapSizer } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add sizer object
      var sizer = new OverlapSizer(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-overlapsizer/#add-sizer-object","title":"Add sizer object","text":"
    var sizer = scene.rexUI.add.overlapSizer({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,    \n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.overlapSizer(x, y, {\n// width: undefined,\n// height: undefined,\n// anchor: undefined,    \n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.overlapSizer(x, y, width, height, {\n// anchor: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-overlapsizer/#custom-class","title":"Custom class","text":"
    • Define class
      class MySizer extends RexPlugins.UI.OverlapSizer {\nconstructor(scene, x, y, minWidth, minHeight, config) {\nsuper(scene, x, y, minWidth, minHeight, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var sizer = new MySizer(scene, x, y, minWidth, minHeight, config);\n
    "},{"location":"ui-overlapsizer/#add-background","title":"Add background","text":"
    sizer.addBackground(child);\n

    or

    sizer.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
      • items is a reserved key, which is used to store all children.
    "},{"location":"ui-overlapsizer/#add-child","title":"Add child","text":"

    Add a game obejct to sizer

    sizer.add(child);\n

    or

    sizer.add(child,\n{\nkey: undefined,\nalign: 'center',     offsetX: 0,\noffsetY: 0,\noffsetOriginX: 0,\noffsetOriginY: 0,\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: true,        // expand: {width, height}\nminWidth: undefined,\nminHeight: undefined,\naspectRatio: 0,\n}\n);\n

    or

    sizer.add(child, key, align, padding, expand, minWidth, minHeight, offsetX, offsetY);\n
    • child : A game object.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Use current timestamp as key.
      • items is a reserved key, which is used to store all children.
    • align :
      • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
      • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
      • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center.
      • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center.
      • 'left-top' , or Phaser.Display.Align.TOP_LEFT : Align game object at left-top.
      • 'left-center' , or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
      • 'left-bottom' , or Phaser.Display.Align.BOTTOM_LEFT : Align game object at left-bottom.
      • 'center-top' , or Phaser.Display.Align.TOP_CENTER : Align game object at center-top.
      • 'center-center' , or Phaser.Display.Align.CENTER : Align game object at center-center.
      • 'center-bottom' , or Phaser.Display.Align.BOTTOM_CENTER : Align game object at center-bottom.
      • 'right-top' , or Phaser.Display.Align.TOP_RIGHT : Align game object at right-top.
      • 'right-center' , or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • 'right-bottom' , or Phaser.Display.Align.BOTTOM_RIGHT : Align game object at right-bottom.
    • offsetX, offsetOriginX : Apply offset offsetX + offsetOriginY * width to x coordinate after alignment.
    • offsetY, offsetOriginY : Apply offset offsetY + offsetOriginY * height to y coordinate after alignment.
    • padding : Extra padded space. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • expand :
      • Boolean value
        • true : Expand width and height of child. Default value.
        • false : Don't expand width or height of child.
      • A plain object
        • {width: true} : Only expand width of child.
        • {height: true} : only expand height of child.
        • {width: true, height: true} : Expand width and height of child.
    • minWidth : Minimum width of normal (non-sizer) game object, used when expand width mode. Default value is current display width.
    • minHeight : Minimum height of normal (non-sizer) game object, used when expand height mode. Default value is current display height.
    • aspectRatio : Keep aspect ratio after layout.
      • 0 : Don't keep aspect ratio. Default behavior.
      • true : Keep aspect ratio via current size.
      • A number : Keep aspect ratio via given value.
    "},{"location":"ui-overlapsizer/#add-multiple","title":"Add multiple","text":"
    sizer.add(gameObjects, config);\n
    • gameObjects : Array of child game objects
    • config : See config of add-child
    "},{"location":"ui-overlapsizer/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    sizer.layout();\n

    See also - dirty

    "},{"location":"ui-overlapsizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-overlapsizer/#remove-child","title":"Remove child","text":"
    • Remove a child
      sizer.remove(child);\n
      or
      sizer.remove(key);\n
    • Remove and destroy a child
      sizer.remove(child, true);\n
      or
      sizer.remove(key, true);\n
    • Remove all children
      sizer.removeAll();\n
    • Remove and destroy all children
      sizer.removeAll(true);\n
    • Remove all children and backgrounds
      sizer.clear();\n
    • Remove and destroy all children and backgrounds
      sizer.clear(true);\n
    • Remove from parent sizer
      sizer.removeFromParentSizer();\n
    "},{"location":"ui-overlapsizer/#get-element","title":"Get element","text":"
    • Get element
    • A child
      var item = sizer.getElement(key);\n
      or
      var item = sizer.getElement('items[' + key + ']');\n
      • All children items
        var items = sizer.getElement('items');\n
    • Get by name
      var gameObject = sizer.getElement('#' + name);\n// var gameObject = sizer.getElement('#' + name, recursive);\n
      or
      var gameObject = sizer.getByName(name);\n// var gameObject = sizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-overlapsizer/#get-child-index","title":"Get child index","text":"
    var index = sizer.getChildIndex(child);\n
    • index : A number, string, or null.
    "},{"location":"ui-overlapsizer/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-overview/","title":"Overview","text":""},{"location":"ui-overview/#install-ui-plugins","title":"Install ui plugins","text":""},{"location":"ui-overview/#install-from-minify-file","title":"Install from minify file","text":"
    1. Download minify file (link).
    2. Install ui plugin in preload stage
      scene.load.scenePlugin({\nkey: 'rexuiplugin',\nurl: filePath,\nsceneKey: 'rexUI'\n});\n
      • key : Must be 'rexuiplugin'
    "},{"location":"ui-overview/#install-from-npm-package","title":"Install from npm package","text":"
    1. Install rex plugins
      npm i phaser3-rex-plugins\n
    2. Install ui plugin in configuration of game
      import RexUIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\n\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: RexUIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"ui-overview/#using-typescript-declaration-file","title":"Using typescript declaration file","text":"
    import 'phaser';\nimport RexUIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\ndeclare module 'phaser' {\ninterface Scene {\nrexUI: RexUIPlugin;\n}\n}\n

    or

    import RexUIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\n\nclass Game extends Phaser.Scene {\nrexUI: RexUIPlugin;  // Declare scene property 'rexUI' as RexUIPlugin type\n\ncreate() {\nvar sizer = this.rexUI.add.sizer({\n// ...\n})\n}\n}\n\nvar game = new Phaser.Game({\nscene: Game,\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: RexUIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n});\n
    • 'phaser3-rex-plugins/templates/ui/ui-plugin' : Factories of rexUI components.
    • 'phaser3-rex-plugins/templates/ui/ui-components' : Class of rexUI components.
      import { Sizer } from 'phaser3-rex-plugins/templates/ui/ui-components';\n

    See this example

    "},{"location":"ui-overview/#list-of-ui-plugins","title":"List of ui plugins","text":""},{"location":"ui-overview/#ui-components","title":"UI components","text":"
    1. Badge label: A container with badges above a main item.
    2. Buttons: A container with a group of buttons.
    3. Color componets: Edit color value by RGB, or HSV input fields.
    4. Color input: Color number or color string input field.
    5. Color picker: Pick color value from H and SV palettes.
    6. Confirm action button: Create a modal confirm dialog temporary, invoke callback after clicking button.
    7. Confirm dialog: Using json style to create confirm dialog.
    8. Dialog: A container with a title, content, buttons and background.
    9. Drop down list: A label can open a drop-down list panel.
    10. Exp bar: Disply experience bar on NameValueLabel.
    11. File selector button: A transparent file chooser button above a Label.
    12. Fix-width-buttons: A container with a group of fix-width buttons.
    13. Fix-width-sizer: Layout children game objects into lines.
    14. Folder: A container with a title, foldable child, and background.
    15. Grid-buttons: A container with a group of buttons in grids.
    16. Grid-sizer: Layout children game objects in grids.
    17. Grid-table: A container with a grid table, slider, and scroller.
    18. Holy grail: Layout elements in Holy grail style.
    19. Knob: A knob button based on circular progress.
    20. Label: A container with an icon, text, and background.
    21. Menu: A container with buttons and sub-menu.
    22. Name-input dialog: Enter first name and last name via a dialog.
    23. Name-value label: A container with name text, value text in a row, with a horizontal line progress bar, and an icon, background.
    24. Image input label: A container with a canvas icon, text, and background. Click icon to popup a (image) file chooser dialog, display selected image on canvas.
    25. Number-bar: A container with an icon, slider, text, and background.
    26. Overlap sizer: Layout children game objects overlapped.
    27. Pages: A container with pages, only current page is visible.
    28. Perspective card: A container with front and back faces.
    29. Scroll-able panel: A container with a panel, slider, and scroller.
    30. Simple drop down list: Using plain object to create drop down list.
    31. Simple label: Using json style to create label.
    32. Simple title label: Using json style to create title label.
    33. Simple text box: Using json style to create text box.
    34. Sizer: Layout children game objects.
    35. Slider: A container with a track, indicator, thumb and background.
    36. Split panels: A container with left(top) panel, right(bottom) panel, splitter, and background. Drag splitter to resize with left(top) panel, right(bottom) panel.
    37. Tab-pages: A container with tabs and pages, only current page is visible.
    38. Tabs: A container with 4 groups of buttons around a center panel.
    39. TextArea: A container with a text, slider, and scroller.
    40. TextAreaInput: A container with a canvasInput, and slider.
    41. Textbox: A container with an icon, (typing and paging) text, and background.
    42. Title label: A container with title, text in two rows, and an icon, background.
    43. Toast: Show text message for a short while.
    44. Toast queue: Queue messages for a short while.
    45. Trees: A container with trees and leaf-nodes.
    46. Tweaker: Fine-tuning properties of target object.

    Scroll-able table

    There are 3 kinds of scroll-able tables :

    • Grid-table only creates visible objects. It is suitable for large table.
    • Grid-sizer adds all objects. Put this grid-sizer into scroll-able panel to have a scroll-able table.
    • Fixwidth-sizer adds all objects. Put this fixwidth-sizer into scroll-able panel to have a scroll-able table.
    "},{"location":"ui-overview/#basic-container","title":"Basic container","text":"
    1. ContainerLite: Control the position and angle of children game objects.
      var container = scene.rexUI.add.container(x, y);\n
      or
      class MyContainer extends RexPlugins.UI.Container {\nconstructor(scene, x, y, width, height, children) {\nsuper(scene, x, y, width, height, children);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#background-objects","title":"Background objects","text":"
    1. Round-rectangle: Round rectangle shape.
      var shape = scene.rexUI.add.roundRectangle(x, y, width, height, radius, fillColor);\n
      or
      class MyRoundRectangle extends RexPlugins.UI.RoundRectangle {\nconstructor(scene, x, y, width, height, radius, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, radius, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. Nine-patch: Stretchable imaage.
      var ninePatch = scene.rexUI.add.ninePatch(x, y, width, height, key, columns, rows, config);\n
      var ninePatch = scene.rexUI.add.ninePatch2(x, y, width, height, key, columns, rows, config);\n
      or
      class MyNinePatch extends RexPlugins.UI.NinePatch {\nconstructor(scene, x, y, width, height, key, columns, rows, config) {\nsuper(scene, x, y, width, height, key, columns, rows, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
      class MyNinePatch extends RexPlugins.UI.NinePatch2 {\nconstructor(scene, x, y, width, height, key, columns, rows, config) {\nsuper(scene, x, y, width, height, key, columns, rows, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    3. Quad shape: Quad shape, offsets can be given on four vertices, and additional points can be added on the four sides.
      var quad = scene.rexUI.add.quadShapes(x, y, width, height, fillColor, fillAlpha);\n
      or
      class MyQuadShape extends RexPlugins.UI.QuadShape {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    4. Custom shapes: Custom shapes on shape.
      var customShapes = scene.rexUI.add.customShapes(x, y, width, height, config);\n
      or
      class MyCustomShapes extends RexPlugins.UI.CustomShapes {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    5. Custom progress: Custom progress on shape.
      var customProgress = scene.rexUI.add.customProgress(x, y, width, height, config);\n
      or
      class MyCustomProgress extends RexPlugins.UI.CustomProgress {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}    
    6. Canvas-round-rectangle: Round rectangle on canvas.
      var shape = scene.rexUI.add.roundRectangleCanvas(x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
      or
      class MyRoundRectangleCanvas extends RexPlugins.UI.RoundRectangleCanvas {\nconstructor(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient) {\nsuper(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    7. Cover: Rectangle shape covered full window, and block all touch events.
      var shape = scene.rexUI.add.cover(config);\n
      or
      class MyCover extends RexPlugins.UI.Cover {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#canvasshape-objects","title":"Canvas/Shape objects","text":"
    1. Canvas: Drawing on canvas.
      var canvas = scene.rexUI.add.canvas(x, y, width, height);\n// var canvas = scene.rexUI.add.canvas(x, y, width, height);\n
      or
      class MyCanvas extends RexPlugins.UI.Canvas {\nconstructor(scene, x, y, width, height) {\nsuper(scene, x, y, width, height);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. Circle mask image: Load a texture, then apply a circle mask.
      var image = scene.rexUI.add.circleMaskImage(x, y, key, frame, config);\n
      or
      class MyImage extends RexPlugins.UI.CircleMaskImage {\nconstructor(scene, x, y, key, frame, config) {\nsuper(scene, x, y, key, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    3. Alpha mask image: Load a texture, then apply an alpha mask from another texture.
      var image = scene.rexUI.add.alphaMaskImage(x, y, key, frame, config);\n
      or
      class MyImage extends RexPlugins.UI.AlphaMaskImage {\nconstructor(scene, x, y, key, frame, config) {\nsuper(scene, x, y, key, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    4. Circular progress shape: Circular progress bar shape.
      var circularProgress = scene.rexUI.add.circularProgress(x, y, radius, barColor, value, config);\n
      or
      class MyCircularProgress extends RexPlugins.UI.CircularProgress {\nconstructor(scene, x, y, radius, barColor, value, config) {\nsuper(scene, x, y, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    5. Circular progress canvas: Circular progress bar on canvas
      var circularProgress = scene.rexUI.add.circularProgressCanvas(x, y, radius, barColor, value, config);\n
      or
      class MyCircularProgress extends RexPlugins.UI.CircularProgressCanvas {\nconstructor(scene, x, y, radius, barColor, value, config) {\nsuper(scene, x, y, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    6. Line progress shape: Horizontal line progress bar shape.
      var lineProgress = scene.rexUI.add.lineProgress(x, y, width, height, barColor, value, config);\n
      or
      class MyLineProgress extends RexPlugins.UI.LinerProgress {\nconstructor(scene, x, y, width, height, barColor, value, config) {\nsuper(scene, x, y, width, height, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    7. Round rectangle progress shape: Horizontal or vertical round rectangle progress bar shape.
      var roundRectangleProgress = scene.rexUI.add.roundrectangleProgress(x, y, width, height, radius, barColor, value, config);\n
      or
      class MyRoundRectangleProgress extends RexPlugins.UI.RoundRectangleProgress {\nconstructor(scene, x, y, width, height, radius, barColor, value, config) {\nsuper(scene, x, y, width, height, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    8. Line progress canvas: Horizontal line progress bar filled with gradient color on canvas.
      var lineProgress = scene.rexUI.add.lineProgressCanvas(x, y, width, height, barColor, value, config);\n
      or
      class MyLineProgress extends RexPlugins.UI.LinerProgressCanvas {\nconstructor(scene, x, y, width, height, barColor, value, config) {\nsuper(scene, x, y, width, height, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    9. Checkbox: Checkbox input with drawing checker path animation.
      var checkbox = scene.rexUI.add.checkbox(x, y, width, height, color, config);\n
      or
      class MyCheckbox extends RexPlugins.UI.Checkbox {\nconstructor(scene, x, y, width, height, color, config) {\nsuper(scene, x, y, width, height, color, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    10. Toggle switch: Toggle-switch input.
      var toggleSwitch = scene.rexUI.add.toggleSwitch(x, y, width, height, color, config);\n
      or
      class MyToggleSwitch extends RexPlugins.UI.ToggleSwitch {\nconstructor(scene, x, y, width, height, color, config) {\nsuper(scene, x, y, width, height, color, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    11. Triangle: Trangle shape inside a rectangle bounds.
      var triangle = scene.rexUI.add.triangle(x, y, width, height, fillColor, fillAlpha);\n
      or
      class MyTriangle extends RexPlugins.UI.Triangle {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    12. AIO-spinner
      var spinner = scene.rexUI.add.aioSpinner(config);\n
      or
      class MySpinner extends RexPlugins.UI.AIOSpinner {\nconstructor(scene, configa) {\nsuper(scene, configa);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    13. Chart: Draw chart on canvas.
    "},{"location":"ui-overview/#colored-text-objects","title":"Colored text objects","text":"
    1. BBCode text: Drawing text with BBCode protocol.
      var txt = scene.rexUI.add.BBCodeText(x, y, text, style);\n
      or
      class MyText extends RexPlugins.UI.BBCodeText {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. Tag text: Displays text with multi-color, font face, or font size with tags.
      var txt = scene.rexUI.add.tagText(x, y, text, style);\n
      or
      class MyText extends RexPlugins.UI.TagText {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    3. Dynamic text: Control position, angle of each character drawn on a canvas.
      var txt = scene.rexUI.add.dynamicText(config);\n
      or
      class MyText extends RexPlugins.UI.DynamicText {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    4. Text player: Typing characters on dynamic text, waiting click or key enter, play sound effect or backgroun music.
      var txt = scene.rexUI.add.textPlayer(config);\n
      or
      class MyText extends RexPlugins.UI.TextPlayer {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    5. Canvas input: An invisible Input DOM element to receive character input and display on DynamicText.
      var txt = scene.rexUI.add.canvasInput(config);\n
      or
      class MyText extends RexPlugins.UI.CanvasInput {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#behaviors-of-text","title":"Behaviors of text","text":"
    1. Hidden text edit: Create an invisible Input DOM element to edit string content.
      var hiddenEdit = this.rexUI.add.hiddenEdit(textObject, config);\n
      • textObject : text, bbocodetext, tagtext, or label.
    2. Text edit: Create an input text object above a text object to edit string content.
      scene.rexUI.edit(textObject, config);\n// scene.rexUI.edit(textObject, config, onClose);\n
    3. Wrap-expand text
      var textObject = scene.rexUI.wrapExpandText(textObject);\n// var textObject = scene.rexUI.wrapExpandText(textObject, minWidth);\n
      • textObject :
        • Text object, bbcode text object, tag text object,
        • Bitmap text object
        • Dynamic text object, With default wrap configuration, ex:
          {\nlineHeight: 24,\npadding: {bottom: 12}\n}\n
    4. Font-size-expand text
      var textObject = scene.rexUI.fontSizeExpandText(textObject);    
      or
      var textObject = scene.rexUI.fontSizeExpandText(textObject, {\nfitHeight: true\n});\n
      • textObject :
        • Text object, bbcode text object, tag text object, bitmap text game object
      • fitHeight :
        • false : Set font size to fit width only. Default behavior.
        • true : Set font size to fit width and height.
    5. Set font-size to fit width
      var textObject = scene.rexUI.setFontSizeFitToWidth(textObject, width);\n
      • textObject :
        • Text object, bbcode text object, tag text object, bitmap text game object
    6. Text typing
      var textTyping = scene.rexUI.add.textTyping(textObject, config);\n
    7. Text page
      var textPage = scene.rexUI.add.textPage(textObject, config);\n
    "},{"location":"ui-overview/#scaled-image","title":"Scaled image","text":"
    1. Image box: Keep aspect ratio of image game object after scale-down resizing.
      var image = scene.rexUI.add.imageBox(x, y, texture, frame, config);\n
      or
      class MyImageBox extends RexPlugins.UI.ImageBox {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#transition-image","title":"Transition image","text":"
    1. Transition image: Transit texture to another one.
      var image = scene.rexUI.add.transitionImage(x, y, texture, frame, config);\n
      or
      class MyTransitionImage extends RexPlugins.UI.TransitionImage {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. Transition image pack: Transit texture to another one, with some pre-build effects, extended from TransitionImage.
      var image = scene.rexUI.add.transitionImagePack(x, y, texture, frame, config);\n
      or
      class MyTransitionImagePack extends RexPlugins.UI.TransitionImagePack {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#dom-game-objects","title":"Dom game objects","text":"
    1. Input text: Input DOM element.
      var inputText = scene.rexUI.add.inputText(config);\n
      or
      class MyInputText extends RexPlugins.UI.InputText {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. File chooser: Create a transparent file chooser button (<input type=\"file\">).
      var fileChooser = scene.rexUI.add.fileChooser(config);\n
      or
      class MyFileChooser extends RexPlugins.UI.FileChooser {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    3. File drop zone: Create a div element for dropping file(s).
      var fileDropZone = scene.rexUI.add.fileDropZone(config);\n
      or
      class MyFileDropZpne extends RexPlugins.UI.FileDropZpne {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#layer-manager","title":"Layer manager","text":"

    Layer manager : A dictionary to store Layer game objects.

    var layerManager = scene.rexUI.add.layerManager({\n// layers: ['layer0', 'layer1', ...]\n});\n\n// layerManager.addToLayer(name, gameObject);\n
    "},{"location":"ui-overview/#touch-input","title":"Touch input","text":"
    1. Click: Fires 'click' event when touch releasd after pressed.
      var click = scene.rexUI.add.click(gameObject, config);\n
      or
      var click = new RexPlugins.UI.Click(gameObject, config);\n
    2. Click-Outside: Fires 'clickoutside' event when pointer-down or pointer-up outside of game object.
      var clickOutside = scene.rexUI.add.clickOutside(gameObject, config);\n
      or
      var clickOutside = new RexPlugins.UI.ClickOutside(gameObject, config);\n
    3. In touching: Fires 'intouch' event every tick when pressing on a game object.
      var inTouching = scene.rexUI.add.inTouching(gameObject, config);\n
      or
      var inTouching = new RexPlugins.UI.inTouching(gameObject, config);\n
    4. Tap: Get tap/multi-taps events of a game object.
      var tap = scene.rexUI.add.tap(gameObject, config);\n
      or
      var tap = new RexPlugins.UI.Tap(gameObject, config);\n
    5. Press: Get press events of a game object.
      var press = scene.rexUI.add.press(gameObject, config);\n
      or
      var press = new RexPlugins.UI.Press(gameObject, config);\n
    6. Swipe: Get swipe events of a game object.
      var swipe = scene.rexUI.add.swipe(gameObject, config);\n
      or
      var swipe = new RexPlugins.UI.Swipe(gameObject, config);\n
    7. Pan: Get pan events of a game object.
      var pan = scene.rexUI.add.pan(gameObject, config);\n
      or
      var pan = new RexPlugins.UI.Pan(gameObject, config);\n
    8. Pinch: Get scale factor from 2 dragging touch pointers.
      var pinch = scene.rexUI.add.pinch(config);\n
      or
      var pinch = new RexPlugins.UI.Pinch(config);\n
    9. Rotste: Get spin angle from 2 dragging touch pointers.
      var rotate = scene.rexUI.add.rotate(config);\n
      or
      var rotate = new RexPlugins.UI.Rotate(config);\n
    10. Touch event stop: Stop touch events propagation.
      var touchEventStop = scene.rexUI.add.touchEventStop(gameObject, config);\n
      or
      var touchEventStop = new RexPlugins.UI.TouchEventStop(gameObject, config);\n
    "},{"location":"ui-overview/#behaviors","title":"Behaviors","text":"
    1. Confirm action : Create a modal confirm dialog temporary, invoke callback after clicking button.
      scene.rexUI.confirmAction(scene, config)\n.then(function(data){ })\n
    2. Modal promise : Modal behavior wrapped into promise.
      scene.rexUI.modalPromise(gameObject, config)\n.then(function(closeEventData){ })\n
      • Close modal dialog:
        scene.rexUI.modalClose(gameObject);\n// scene.rexUI.modalClose(gameObject, closeEventData);\n
        or
        gameObject.emit('modal.requestClose');\n// gameObject.emit('modal.requestClose', closeEventData);\n
        • Fire 'modal.requestClose' event on game object, which will invoke modal.requestClose() method. After closing dialog, resolve part of promise will be triggered.
    3. Flip: Flip game object to another face by scaling width/height.
      var flip = scene.rexUI.add.flip(gameObject, config);\n
      or
      var flip = new RexPlugins.UI.Flip(gameObject, config);\n
    4. Fade in, fade out destroy
      scene.rexUI.fadeIn(gameObject, duration);\n// scene.rexUI.fadeIn(gameObject, duration, alpha);\n
      scene.rexUI.fadeOutDestroy(gameObject, duration);\n
    5. Ease-move to, ease-move from
      scene.rexUI.easeMoveTo(gameObject, duration, x, y);\n// scene.rexUI.easeMoveTo(gameObject, duration, x, y, ease);\n
      scene.rexUI.easeMoveFrom(gameObject, duration, x, y);\n// scene.rexUI.easeMoveFrom(gameObject, duration, x, y, ease);\n
    6. Shake
      scene.rexUI.shake(gameObject, config);\n
    7. Perspective: Snapshot children of containerlite, to a perspective render texture.
      var perspective = scene.rexUI.add.perspective(gameObject, config);\n
      or
      var perspective = new RexPlugins.UI.Perspective(gameObject, config);\n
    8. Skew: Snapshot children of containerlite, to a skew render texture.
      var skew = scene.rexUI.add.skew(gameObject, config);\n
      or
      var skew = new RexPlugins.UI.Skew(gameObject, config);\n
    "},{"location":"ui-overview/#helper-methods","title":"Helper methods","text":""},{"location":"ui-overview/#get-parent","title":"Get parent","text":"
    • Get parent sizer
      var parentSizer = scene.rexUI.getParentSizer(gameObject);\n
      • gameObject : Any game object added to sizer.
    • Get ancestor sizer matched given name
      var parentSizer = scene.rexUI.getParentSizer(gameObject, name);\n
      • gameObject : Any game object added to sizer.
      • name : Name string.
    • Get topmost sizer
      var topmostSizer = scene.rexUI.getTopmostSizer(gameObject);\n
      • gameObject : Any game object added to sizer.
    "},{"location":"ui-overview/#remove-from-parent","title":"Remove from parent","text":"
    scene.rexUI.removeFromParent(gameObject);\n
    "},{"location":"ui-overview/#showhide","title":"Show/hide","text":"
    • Show
      scene.rexUI.show(gameObject);\nscene.rexUI.getTopmostSizer(gameObject).layout();\n
    • Hide
      scene.rexUI.hide(gameObject);\nscene.rexUI.getTopmostSizer(gameObject).layout();\n
    • Is shown
      var isShown = scene.rexUI.isShown(gameObject);\n
    "},{"location":"ui-overview/#is-pointer-in-bounds","title":"Is pointer in bounds","text":"
    var isInBounds = scene.rexUI.isInTouching(gameObject);\n// var isInBounds = scene.rexUI.isInTouching(gameObject, pointer);\n
    "},{"location":"ui-overview/#event-promise","title":"Event promise","text":"
    • Get event promise
      var promise = scene.rexUI.waitEvent(eventEmitter, eventName)\n.then(function() {\n\n})\n
      • eventEmitter : Any kind of event emitter. for example, game object, or tween task, or scene event
    • Get complete event promise
      var promise = scene.rexUI.waitComplete(eventEmitter)\n.then(function() {\n\n})\n
      • eventEmitter : Event emitter which will fire 'complete' event, for example, tween task.
    • Delay time promise
      var promise = scene.rexUI.delayPromise(time)\n.then(function() {\n\n})\n
    "},{"location":"ui-overview/#view-port","title":"View port","text":"

    View port is a rectangle of current visible area.

    var viewport = scene.rexUI.viewport;\n

    Which will be changed after resizing

    scene.scale.on('resize', function() {\nvar viewport = scene.rexUI.viewport;\n/*\n    sizer\n        .setPosition(viewport.centerX, viewport.centerY)\n        .setMinSize(viewport.width, viewport.height)\n        .layout();\n    */\n});\n
    "},{"location":"ui-overview/#demos","title":"Demos","text":"
    • Dialog
      • Yes/No
      • Choice
      • Pop-up
    • Text input
      • Text edit
      • Hidden text edit
      • Canvas input
    • Menu
    • Text-box
    • Text-area
    • Number bar
    • Grid table
    • Tabs
      • Tabs-tables
    • Scroll-able panel
    • Pages
    • Fix-width sizer
    • Chart
    • Video player
    • Anchor
    • Round-rectangle
    "},{"location":"ui-pages/","title":"Pages","text":""},{"location":"ui-pages/#introduction","title":"Introduction","text":"

    A container with pages, only current page is visible.

    • Author: Rex
    • Game object
    "},{"location":"ui-pages/#live-demos","title":"Live demos","text":"
    • Pages
    • Tabpage
    "},{"location":"ui-pages/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-pages/#install-plugin","title":"Install plugin","text":""},{"location":"ui-pages/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add pages object
      var pages = scene.rexUI.add.pages(config);\n
    "},{"location":"ui-pages/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add pages object
      var pages = scene.rexUI.add.pages(config);\n
    "},{"location":"ui-pages/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Pages } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add pages object
      var pages = new Pages(scene, config);\nscene.add.existing(pages);\n
    "},{"location":"ui-pages/#add-pages-object","title":"Add pages object","text":"
    var pages = scene.rexUI.add.pages({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0 },\n// swapMode: 0,\n// fadeIn: 0,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • swapMode : Set to invisible or destroy swapped page.
      • 0, 'invisible' : Set swapped page to invisible.
      • 1, 'destroy' : Destroy swapped page.
    • fadeIn : Fade-in duration of current page.
      • 0 : No fade-in effect. Default behavior.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-pages/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPages extends RexPlugins.UI.Pages {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var pages = new MyPages(scene, config);\n
    "},{"location":"ui-pages/#add-background","title":"Add background","text":"
    pages.addBackground(child);\n

    or

    pages.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    "},{"location":"ui-pages/#add-page","title":"Add page","text":"
    pages.addPage(child, key, align, padding, expand);\n// pages.add(child, key, align, padding, expand);\n

    or

    pages.addPage(child, {\nkey: 0,\nalign: Phaser.Display.Align.TOP_LEFT,\npadding: {left: 0, right: 0, top: 0, bottom: 0}, expand: true\n}\n);\n// pages.add(child, config);\n
    • child : A game object.
    • key : Unique name of this page.
    • align :
      • 'left-top', or Phaser.Display.Align.TOP_LEFT : Align game object at left-top. Default value.
      • 'left-center', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
      • 'left-bottom', or Phaser.Display.Align.LEFT_BOTTOM : Align game object at left-bottom.
      • 'center-top', or Phaser.Display.Align.TOP_CENTER : Align game object at center-top.
      • 'center-center', or Phaser.Display.Align.CENTER : Align game object at center-center.
      • 'center-bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at center-bottom.
      • 'right-top', or Phaser.Display.Align.TOP_RIGHT : Align game object at right-top.
      • 'right-center', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • 'right-bottom', or Phaser.Display.Align.RIGHT_BOTTOM : Align game object at right-bottom.
    • padding : Add space between bounds. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • expand : Expand width and height of the page.
      • true : Expand width and height.
      • false : Don't expand width or height.
      • A plain object, to expand width or height
        {\nwidth: true,\nheight: true\n}\n
        • expand.width : Expand width.
        • expand.height : Expand height.
    "},{"location":"ui-pages/#swap-to-page","title":"Swap to page","text":"
    pages.swapPage(key);\n// pages.swapPage(key, fadeInDuration);\n
    • key : Unique name of this page.

    Note

    This method will run pages.layout() to arrange position of current page.

    "},{"location":"ui-pages/#page-name","title":"Page name","text":"
    • Current page name

      var pageName = pages.currentKey;\n

    • Previous page name

      var pageName = pages.previousKey;\n

    • Name of all pages
      var names = pages.keys;\n
    "},{"location":"ui-pages/#page-object","title":"Page object","text":"
    • Get page object
      var pageObject = pages.getPage(key);\n
      • pageObject : A game object or null.
    • Current page object
      var pageObject = pages.currentPage;\n
    • Previous page object
      var pageObject = pages.previousPage;\n
    "},{"location":"ui-pages/#fade-in-duration","title":"Fade in duration","text":"
    pages.setFadeInDuration(duration);\n
    • 0 : No fade-in effect.
    "},{"location":"ui-pages/#get-element","title":"Get element","text":"
    • Get element
      • All page game objects
        var gameObjects = pages.getElement('items');\n
    • Get by name
      var gameObject = pages.getElement('#' + name);\n// var gameObject = pages.getElement('#' + name, recursive);\n
      or
      var gameObject = pages.getByName(name);\n// var gameObject = pages.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-pages/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-pages/#events","title":"Events","text":"
    • Set page invisible, triggered when page is swapped out.
      pages.on('pageinvisible', function(pageObject, key, pages) {\n// ...\n}, scope);\n
      • pageObject : Game object of page.
      • key : Page name.
      • pages : Pages object
    • Set page visible, triggered when page is shown.
      pages.on('pagevisible', function(pageObject, key, pages) {\n// ...\n}, scope);\n
      • pageObject : Game object of page.
      • key : Page name.
      • pages : Pages object
    "},{"location":"ui-perspectivecard/","title":"Perspective card","text":""},{"location":"ui-perspectivecard/#introduction","title":"Introduction","text":"

    A container with front and back faces.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"ui-perspectivecard/#live-demos","title":"Live demos","text":"
    • Flip
    • Rotation
    "},{"location":"ui-perspectivecard/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-perspectivecard/#install-plugin","title":"Install plugin","text":""},{"location":"ui-perspectivecard/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add card object
      var card = scene.rexUI.add.perspectiveCard(config);\n
    "},{"location":"ui-perspectivecard/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add card object
      var card = scene.rexUI.add.perspectiveCard(config);\n
    "},{"location":"ui-perspectivecard/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveCard } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add card object
      var card = new PerspectiveCard(scene, config);\nscene.add.existing(card);\n
    "},{"location":"ui-perspectivecard/#add-card-object","title":"Add card object","text":"
    var sizer = scene.rexUI.add.perspectiveCard({    // x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nback: backGameObject,\nfront: frontGameObject,\n// face: 0,\n// orientation: 0,\n// snapshotPadding: 0,\n\n// flip : {\n//     frontToBack: 0,\n//     backToFront: 1,\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n\n// space: { left: 0, right:0, top:0, bottom:0 },\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • front, back : Any game object for front or back face.
    • face : Show front or back face.
      • 'front', or 0 : Show front face.
      • 'back', or 1 : Show back face.
    • orientation : Flipping orientation.
      • 'horizontal','h', 'x', or 0 : Flipping left-to-right, or right-to-left.
      • 'vertical','v', 'y', or 1 : Flipping top-to-bottom, or bottom-to-top.
    • snapshotPadding : Padding around face when taking a snapshot of a face.
    • flip : Configuration of flipping behavior.
      • flip.frontToBack, flip.backToFront : Flipping direction.
        • 'right', 'left-to-right', or 0 : Flipping from right to left.
        • 'left', 'right-to-left', or 1 : Flipping from left to right.
      • flip.duration : Duration of flipping, in millisecond.
      • flip.delay : Initial delay.
      • flip.ease : Ease function. Default value is 'Cubic'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-perspectivecard/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveCard extends PerspectiveCard {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var card = new MyPerspectiveCard(scene, config);\n
    "},{"location":"ui-perspectivecard/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    card.layout();\n

    See also - dirty

    "},{"location":"ui-perspectivecard/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = card.getElement('background');\n
      • Front face game object
        var frontFace = card.getElement('front');\n
      • Back face game object
        var backFace = card.getElement('back');\n
    • Get by name
      var gameObject = card.getElement('#' + name);\n// var gameObject = card.getElement('#' + name, recursive);\n
      or
      var gameObject = card.getByName(name);\n// var gameObject = card.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-perspectivecard/#face","title":"Face","text":"
    • Get
      var face = card.face;\n
      • face:
        • 0 : Show front face.
        • 1 : Show back face.
    • Set
      card.setFace(face)\n
      • face
        • 'front', or 0 : Show front face.
        • 'back', or 1 : Show back face.
    • Toggle
      card.toggleFace()\n
    "},{"location":"ui-perspectivecard/#face-instances","title":"Face instances","text":"
    • Front face
      var frontFace = card.frontFace;\n// var frontFace = card.faces.front;\n
    • Back face
      var backFace = card.backFace;\n// var backFace = card.faces.back;\n
    "},{"location":"ui-perspectivecard/#flip-behavior","title":"Flip behavior","text":""},{"location":"ui-perspectivecard/#start-flipping","title":"Start flipping","text":"
    card.flip.flip();\n// card.flip.flip(duration, repeat);\n
    • duration : Overwrite default duration value.
    • repeat : Number of flipping time (repeat + 1) during duration. Default value is 0.

    or

    • Flip-right
      card.flip.flipRight();\n// card.flip.flipRight(duration, repeat);\n
    • Flip-left
      card.flip.flipLeft();\n// card.flip.flipLeft(duration, repeat);\n

    Note

    • When flipping start:
      • Snapshot face game objects to perspective-card mesh
      • Set face game objects to invisible, and perspective-card mesh to visible
    • When flipping complete:
      • Revert visible of Face game objects and perspective-card mesh
    "},{"location":"ui-perspectivecard/#stop-flipping","title":"Stop flipping","text":"
    card.flip.stop();\n
    "},{"location":"ui-perspectivecard/#set-duration","title":"Set duration","text":"
    card.flip.setDuration(duration);\n// card.flip.duration = duration;\n
    "},{"location":"ui-perspectivecard/#set-ease","title":"Set ease","text":"
    card.flip.setEase(ease);\n// card.flip.ease = ease;\n
    "},{"location":"ui-perspectivecard/#events","title":"Events","text":"
    • On flipping start
      card.flip.on('start', function(){\n// ...\n});\n
    • On flipping complete
      card.flip.on('complete', function(){\n// ...\n});\n
    "},{"location":"ui-perspectivecard/#status","title":"Status","text":"
    • Is flipping
      var isRunning = card.flip.isRunning;\n
    "},{"location":"ui-perspectivecard/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleX = card.angleX; // Angle in degrees\nvar angleY = card.angleY; // Angle in degrees\nvar angleZ = card.angleZ; // Angle in degrees\n
      or
      var rotationX = card.rotationX; // Angle in radians\nvar rotationY = card.rotationY; // Angle in radians\nvar rotationZ = card.rotationZ; // Angle in radians\n
    • Set rotation angle
      card.angleX = angleX; // Angle in degrees\ncard.angleY = angleY; // Angle in degrees\ncard.angleZ = angleZ; // Angle in degrees\n
      or
      card.rotationX = rotationX; // Angle in radians\ncard.rotationY = rotationY; // Angle in radians\ncard.rotationZ = rotationZ; // Angle in radians\n

    Warning

    Can't be used with flipping mode.

    "},{"location":"ui-perspectivecard/#other-properties","title":"Other properties","text":"

    See overlapSizer.

    "},{"location":"ui-scrollablepanel/","title":"Scroll-able panel","text":""},{"location":"ui-scrollablepanel/#introduction","title":"Introduction","text":"

    A container with a panel, slider, and scroller.

    • Author: Rex
    • Game object
    "},{"location":"ui-scrollablepanel/#live-demos","title":"Live demos","text":"
    • Scroll-able panel + grid sizer
    • Scroll-able panel + table by fix-width sizer
    • Scroll-able panel + fix-width sizer
    • Scroll-able panel + built-in container
      • Container panel
      • Container child
    • Button click
    • Dropdown, scrollable list
    • Add child
    • Scroll to child
    • Drag item
    • Destroy
    • XY sliders
    • Min-width panel
    • Drag, resize panel
      • Single scroller
      • ScrollerX, scrollerY
    • Drag&drop items between panels :
      • With scroller
      • Without scroller
    • Nested scroll-able panel
    • Typing on Label
    "},{"location":"ui-scrollablepanel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-scrollablepanel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-scrollablepanel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add scrollable-panel object
      var panel = scene.rexUI.add.scrollablePanel(config);\n
    "},{"location":"ui-scrollablepanel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add scrollable-panel object
      var panel = scene.rexUI.add.scrollablePanel(config);\n
    "},{"location":"ui-scrollablepanel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ScrollablePanel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add scrollable-panel object
      var panel = new ScrollablePanel(scene, config);\nscene.add.existing(panel);\n
    "},{"location":"ui-scrollablepanel/#add-scroll-able-panel-object","title":"Add scroll-able panel object","text":"
    var panel = scene.rexUI.add.scrollablePanel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// scrollMode: 0,\n\n// Elements\nbackground: backgroundGameObject,\n\npanel: {\nchild: panelGameObject,\nmask: {\npadding: 0, // or {left, right, top, bottom}\n// updateMode: 0,\n}\n}.\n\nslider: {\n// background: sliderBackgroundGameObject,\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n\n// buttons: {\n//     top: topButtonGameObject, \n//     bottom: bottomButtonGameObject,\n//     left: leftButtonGameObject, \n//     right: rightButtonGameObject,\n//     step: 0.01,\n// }\n},\n\n// sliderX: {...},\n// sliderY: {...},\n\n// scrollDetectionMode: 0,\n\n// scroller: {\n//     threshold: 10,\n//     slidingDeceleration: 5000,\n//     backDeceleration: 2000,\n//     pointerOutRelease: true,\n//     rectBoundsInteractive: true,\n//     dragRate: 1,\n// },\n\n// scrollerX: {...},\n// scrollerY: {...},\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\n// mouseWheelScrollerX: {...},\n// mouseWheelScrollerY: {...},\n\nclampChildOY: false,\n// clampChildOX: false,\n\nheader: headerGameObject,\nfooter: footerGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\npanel: 0,\n// panel: {\n//    top: 0,\n//    bottom: 0,\n//    left: 0,\n//    right: 0,\n//},\n\nslider: 0,\n// slider: {\n//     top: 0,\n//     bottom: 0,\n//     left: 0,\n//     right: 0,\n// },\n// sliderX: 0,\n// sliderY: 0,\n\nheader: 0,\nfooter: 0,\n},\n\nexpand: {\nheader: true,\nfooter: true,\npanel: true,\n},\n\nalign: {\nheader: 'center',\nfooter: 'center',\npanel: 'center',\n},\n\n// name: '',\n// draggable: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • scrollMode : Scroll panel vertically, or horizontally.
      • 0, 'vertical', or 'v', 'y' : Scroll panel vertically. Default value.
      • 1, 'horizontal', or 'h'. 'x' : Scroll panel horizontally.
      • 2, or 'xy' : Two-sliders mode, scroll panel vertically and horizontally.
    • background : Game object of background, optional. This background game object will be resized to fit the size of scroll-able panel.
    • panel : Configuration of panel game object.
      • panel.child : Panel game object.
      • panel.mask : Configuration of panel's mask.
        • panel.mask.padding :
          • A number : Extra left/right/top/bottom padding spacing of this rectangle mask. Default value is 0.
          • A plain object {left, right, top, bottom}
        • panel.mask.updateMode : When to update mask
          • 0, or 'update' : Apply mask only when scrolling. Default behavior.
          • 1, or 'everyTick' : Apply mask every tick. Use this mode if children game objects of panel are moved after scrolling and still been masked.
        • false : No mask
    • slider : Componments of slider, optional.
      • slider.background :
        • Game object of background, optional. This background game object will be resized to fit the size of slider.
        • A plain object to create round rectangle shape
          { radius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.track :
        • Game object of track, optional. This track game object will be resized to fit the size of slider, with space.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.indicator :
        • Game object of indicator, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.thumb :
        • Game object of thumb, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.input :
        • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.position : Position of this slider.
        • 0, 'right', 'bottom' : Slider at right/bottom side. Default value.
        • 1, 'left', 'top' : Slider at left/top side.
      • slider.hideUnscrollableSlider :
        • false : Slider is always visible no matter it is scrollable or not. Default behavior.
        • true : Set slider to invisible if it is unscrollable.
      • slider.disableUnscrollableDrag :
        • false : Scroller is always enale no matter it is scrollable or not. Default behavior.
        • true : Set scroller to disable if it is unscrollable.
      • slider.adaptThumbSize :
        • false : Don't adjust height/width of thumb. Default behavior.
        • true : Adjust height/width of thumb according to ratio of visible child.
          • Minimum height/width of thumb = slider.minThumbSize. If content is larger then a page.
          • Maximum height/width of thumb = height/width of slider.track. If content is less then a page.
      • slider.minThumbSize : Minimum height/width of thumb used in slider.adaptThumbSize mode.
      • slider.buttons : Press button to scroll content in each tick.
        • slider.buttons.top, slider.buttons.bottom : Top and bottom buttons.
        • slider.buttons.left, slider.buttons.right : Left and right buttons
        • slider.buttons.step : Scrolling step in each tick. Default value is 0.01.
      • Set to false to skip creating slider.
    • sliderX, sliderY : Componments of sliderX and sliderY, for two-sliders mode.
    • scrollDetectionMode :
      • 0 : Dectct drag-scrolling, mouse-wheel-scrolling by game object's touch event. Default behavior.
      • 1 : Dectct drag-scrolling, mouse-wheel-scrolling by rectangle bounds.
    • scroller : Configuration of scroller behavior.
      • scroller.threshold : Minimal movement to scroll. Set 0 to scroll immediately.
      • scroller.slidingDeceleration : Deceleration of slow down when dragging released.
        • Set false to disable it.
      • scroller.backDeceleration : Deceleration of pull back when out of bounds.
        • Set false to disable it.
      • scroller.pointerOutRelease : Set to true to release input control when pointer out of gameObject.
      • scroller.rectBoundsInteractive :
        • false : Detect scrolling by game object's touch input.
        • true : Detect scrolling by rectangle bounds of game object. Default behavior.
      • scroller.dragRate : Rate of dragging distance/dragging speed. Default value is 1.
      • Set to false to skip creating scroller.
    • scrollerX, scrollerY : Configuration of scrollerX, scrollerY behavior, for two-sliders mode.
    • mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
      • mouseWheelScroller.focus :
        • false, or 0 : Without checking if cursor is over game object or not.
        • true, or 1 : Cursor is inside the rectangle bounds of game object. Default behavior.
        • 2 : Cursor is over game object.
      • mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
      • Set to false to skip creating mouse-wheel-scroller. Default behavior.
    • mouseWheelScrollerX, mouseWheelScrollerY : Configuration of mouse-wheel-scrollerX, or mouse-wheel-scrollerY behavior, for two-sliders mode.
    • clampChildOY : Set true to clamp scrolling.
    • clampChildOX : Set true to clamp scrolling, for two-sliders mode.
    • header : Game object of header, optional.
    • footer : Game object of footer, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.panel :
        • A number: Space between panel object and slider object.
        • An object: Padding of panel object.
          • If scrollMode is 0 (vertical) :
            • space.panel.top, space.panel.bottom : Top, bottom padding space of panel object.
            • space.panel.right : Space between panel object and slider object.
          • If scrollMode is 1 (horizontal) :
            • space.panel.left, space.panel.right : Left, right padding space of panel object.
            • space.panel.bottom : Space between panel object and slider object.
          • If two-sliders mode (scrollMode is 2):
            • space.panel.top, space.panel.bottom, space.panel.left, space.panel.right : Top, bottom, left, right padding space of panel object.
      • space.slider :
        • 0 : No space around slider.
        • space.slider.left, space.slider.right, space.slider.top, space.slider.bottom : Space around slider.
      • space.sliderX, space.sliderX : Space configuration of sliderX, sliderX, for two-sliders mode.
        • 0 : No space around slider.
      • space.header : Space between header and panel.
      • space.footer : Space between footer and panel.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width or height of header game object. Default value is true.
      • expand.footer : Set true to expand width or height of footer game object. Default value is true.
      • expand.panel : Set true to expand width or height of panel game object. Default value is true.
    • align : Align element
      • align.header
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • 'top', or Phaser.Display.Align.ALIGN.TOP_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.ALIGN.BOTTOM_CENTER : Align game object at bottom-center.
      • align.footer
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • 'top', or Phaser.Display.Align.ALIGN.TOP_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.ALIGN.BOTTOM_CENTER : Align game object at bottom-center.
      • align.panel
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • 'top', or Phaser.Display.Align.ALIGN.TOP_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.ALIGN.BOTTOM_CENTER : Align game object at bottom-center.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    "},{"location":"ui-scrollablepanel/#scroll-mode","title":"Scroll mode","text":"

    If scrollMode parameter is not given :

    • Set scrollMode to 2, if configuration has sliderX, sliderY, or scrollerX, scrollerY parameters.
    • Set scrollMode to 0, if configuration has sliderY, or scrollerY parameters.
    • Set scrollMode to 1, if configuration has sliderX, or scrollerX parameters.
    "},{"location":"ui-scrollablepanel/#child-bounds","title":"Child bounds","text":"

    Scrollable panel will mask child if child's bounds (child.getBounds()) is across mask area.

    Bitmaptext game object does not have getBounds method. User can inject it by

    const Components = Phaser.GameObjects.Components;\nPhaser.Class.mixin(\nPhaser.GameObjects.BitmapText,\n[\nComponents.ComputedSize,\nComponents.GetBounds\n]\n);\n
    "},{"location":"ui-scrollablepanel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPanel extends RexPlugins.UI.ScrollablePanel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var panel = new MyPanel(scene, config);\n
    "},{"location":"ui-scrollablepanel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    panel.layout();\n

    See also - dirty

    "},{"location":"ui-scrollablepanel/#scroll-content","title":"Scroll content","text":"
    • Set
      panel.childOY = oy;\n// panel.setChildOY(oy);\n
    • Set and clamp
      panel.setChildOY(oy, true);\n
    • Add
      panel.addChildOY(oy);\n
    • Add and clamp
      panel.addChildOY(oy, true);\n
    • Get
      var childOY = panel.childOY;\n
    • Top OY
      var topOY = panel.topChildOY;\n
    • Bottom OY
      var bottomOY = panel.bottomChildOY;\n
    • Is overflow (height of content is larger than display height)
      var isOverflow = panel.isOverflow;\n
    "},{"location":"ui-scrollablepanel/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      panel.t = t;  // t: 0~1\n// panel.setT(t);  \n
    • Set and clamp
      panel.setT(t, true);\n
    • Get
      var t = panel.t;\n
    "},{"location":"ui-scrollablepanel/#scroll-to-topbottom","title":"Scroll to top/bottom","text":"
    • Scroll to top
      panel.scrollToTop();\n
      • Equal to panel.t = 0;
    • Scroll to bottom
      panel.scrollToBottom();\n
      • Equal to panel.t = 1;
    "},{"location":"ui-scrollablepanel/#scroll-to-child","title":"Scroll to child","text":"
    panel.scrollToChild(child, align);\n
    • align :
      • undefined : Align child to top(left), or bottom(right) of panel. Default value.
      • 'top', 'center', 'bottom' : Align child to top/center/bottom of panel.
      • 'left', 'center', 'right' : Align child to left/center/right of panel.
    "},{"location":"ui-scrollablepanel/#enabledisable-scrolling","title":"Enable/disable scrolling","text":"
    • Slider
      • Set enable state
        panel.setSliderEnable(enabled);\n
        or
        panel.sliderEnable = enabled;\n
      • Get enable state
        var enable = panel.sliderEnable;\n
    • Scroller
      • Set enable state
        panel.setScrollerEnable(enabled);\n
        or
        panel.scrollerEnable = enabled;\n
      • Get enable state
        var enable = panel.scrollerEnable;\n
    • Mouse-Wheel-Scroller
      • Set enable state
        panel.setMouseWheelScrollerEnable(enabled);\n
        or
        panel.mouseWheelScrollerEnable = enabled;\n
      • Get enable state
        var enable = panel.mouseWheelScrollerEnable;\n
    "},{"location":"ui-scrollablepanel/#event","title":"Event","text":"
    • Scroll
      panel.on('scroll', function(panel) {\n// ...\n})\n
    • Slider
      • Slider drag start
        panel.getElement('slider').on('inputstart', function(panel) {\n// ...\n})\n
      • Slider drag end
        panel.getElement('slider').on('inputend', function(panel) {\n// ...\n})\n
    • Scroller
      • Scroller drag start
        panel.getElement('scroller').on('dragstart', function(panel) {\n// ...\n})\n
      • Scroller drag end
        panel.getElement('scroller').on('dragend', function(panel) {\n// ...\n})\n
    "},{"location":"ui-scrollablepanel/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-scrollablepanel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = panel.getElement('background');\n
      • Child-panel game object
        var childPanel = panel.getElement('panel');\n
      • Child-panel mask game object, which is a graphics game object.
        var maskGameObject = panel.getElement('mask');\n
      • Layer of panel, assigned at config panel.mask.layer.
        var layer = panel.getElement('panelLayer');\n
      • Header game object
        var childPanel = panel.getElement('header');\n
      • Footer game object
        var childPanel = panel.getElement('footer');\n
      • Slider
        • Slider top
          var slider = panel.getElement('slider');\n
        • Track
          var track = panel.getElement('slider.track');\n
        • Thumb
          var thumb = panel.getElement('slider.thumb');\n
      • Scroller
        var scroller = panel.getElement('scroller');\n
      • Scrollable-block, registering scroller and children-interactive on it.
        var scrollableBlock = panel.getElement('scrollableBlock');\n
    • Get by name
      var gameObject = panel.getElement('#' + name);\n// var gameObject = panel.getElement('#' + name, recursive);\n
      or
      var gameObject = panel.getByName(name);\n// var gameObject = panel.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-scrollablepanel/#input-events","title":"Input events","text":"

    Two possible solution to register input events to children of scrollable panel.

    "},{"location":"ui-scrollablepanel/#individual-input-events","title":"Individual input events","text":"

    When scene.input.topOnly is true (default value), input events of children elements will block the drag-scrolling of scrollable panel. (Assmue that the children elememts are above scrollable panel)

    • Set scene.input.topOnly to false to enable drag-scrolling and input events of children elememts both.
      • Or Set scrollDetectionMode: 1 in config of constructor, to using rectangle-bounds input detection.
    • Test if pointer is inside the mask of panel via panel.isInTouching('mask'), during input events' callback.
    • To recognize pointer-down and dragging-start, use press's pressstart event.
    "},{"location":"ui-scrollablepanel/#set-children-interactive","title":"Set children interactive","text":"

    Applies click, tap, press, swipe behaviors on this scrollable panel, to detect input events of children.

    panel.setChildrenInteractive({\n// targetMode: 'parent',\ntargets: targetSizers,\n\n// dropZone: false,\n\n// click: {mode: 'release', clickInterval: 100},\n\n// over: undefined,\n\n// press: {time: 251, threshold: 9},\n\n// tap: {time: 250, tapInterval: 200, threshold: 9, tapOffset: 10, \n//       taps: undefined, minTaps: undefined, maxTaps: undefined,},\n\n// swipe: {threshold: 10, velocityThreshold: 1000, dir: '8dir'},\n\n// inputEventPrefix: 'child.',\n})\n
    • targetMode :
      • 'parent' : targetSizers is an array of hit-targrts' parentSizers. Will run hit-test on parentSizers first, then run hit-test on children of parentSizer. Default behavior.
      • 'direct' : targetSizers is an array of hit-targrts. Will run hit-test directly on these hit-targrts.
    • targetSizers : Array of hit-targrts' parentSizers, or array of hit-targrts. See targetMode parameter.
    • dropZone :
      • true : Enable drop Zone on scrollable area.
      • false : Do nothing.

    See Base-sizer/Set children interactive

    "},{"location":"ui-scrollablepanel/#events","title":"Events","text":"

    See Base-sizer/Set children interactive/Events

    "},{"location":"ui-scrollablepanel/#steps-of-building-a-scrollable-panel","title":"Steps of building a scrollable panel","text":"
    1. Build child panel from bottom to top
      • Child panel might be composed of sizers (sizer/fix-width sizer/grid sizer)
      • Return child sizer from method
    2. Build scrollable panel
    3. Add interactive events
    "},{"location":"ui-scrollbar/","title":"Scroll bar","text":""},{"location":"ui-scrollbar/#introduction","title":"Introduction","text":"

    A container with slider, two buttons, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-scrollbar/#live-demos","title":"Live demos","text":"
    • Scroll bar
    "},{"location":"ui-scrollbar/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-scrollbar/#install-plugin","title":"Install plugin","text":""},{"location":"ui-scrollbar/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin(\n\"rexuiplugin\",\n\"https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js\",\n\"rexUI\",\n\"rexUI\"\n);\n
    • Add scroll bar object
      var scrollBar = scene.rexUI.add.scrollBar(config);\n
    "},{"location":"ui-scrollbar/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from \"phaser3-rex-plugins/templates/ui/ui-plugin.js\";\nvar config = {\n// ...\nplugins: {\nscene: [\n{\nkey: \"rexUI\",\nplugin: UIPlugin,\nmapping: \"rexUI\",\n},\n// ...\n],\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add scroll bar object
      var scrollBar = scene.rexUI.add.scrollBar(config);\n
    "},{"location":"ui-scrollbar/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ScrollBar } from \"phaser3-rex-plugins/templates/ui/ui-components.js\";\n
    • Add scroll bar object
      var sizer = new ScrollBar(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-scrollbar/#add-scroll-bar-object","title":"Add scroll bar object","text":"
    var scrollBar = scene.rexUI.add.scrollBar({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\norientation: 0,\n\nbackground: backgroundGameObject,    slider: {\nbackground: backgroundGameObject,\n/* \n        background: { \n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */    indicator: indicatorGameObject,\n/* \n        indicator: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\ninput: 'drag',\ngap: undefined,        easeValue: {\nduration: 0,\nease: 'Linear'\n},\n},\n\nbuttons: {\ntop: topButtonGameObject, bottom: bottomButtonGameObject,\nleft: leftButtonGameObject, right: rightButtonGameObject,\nstep: 0.01,\n}\n\nvaluechangeCallback: function(newValue, oldValue, scrollBar) {\n// scrollBar.text = Math.round(Phaser.Math.Linear(0, 100, newValue));\n}\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\nitem: 0\n},\n\nenable: true,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Main orientation of the sizer.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    • background : Game object of background, optional. This background game object will be resized to fit the size of scrollBar.
    • slider : Slider game object which composed of
      • slider.width : Fixed width of slider, optional. Width of slider will be extended if this value is not set.
      • slider.background :
        • Game object of background, optional. This background game object will be resized to fit the size of slider.
        • A plain object to create round rectangle shape
          { radius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.track :
        • Game object of track, optional. This track game object will be resized to fit the size of slider, with space.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.indicator :
        • Game object of indicator, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.thumb :
        • Game object of thumb, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.input :
        • 'pan', 'drag', or 0 : Control knob by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.gap : Snap a value to nearest grid slice, using rounding.
        • undefined : Disable this feature.
      • slider.easeValue : Easing value when input is 'click'.
        • slider.easeValue.duration : Duration of value easing, default is 0 (no easing).
        • slider.easeValue.ease : Ease function, default is 'Linear'.
    • buttons : Press button to scroll content in each tick.
      • buttons.top, buttons.bottom : Top and bottom buttons.
      • buttons.left, buttons.right : Left and right buttons
      • buttons.step : Scrolling step in each tick. Default value is 0.01.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds
      • space.item : Space between 2 children game objects.
    • valuechangeCallback : callback function when value changed.
    • enable : Set false to disable controlling.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    "},{"location":"ui-scrollbar/#custom-class","title":"Custom class","text":"
    • Define class
      class MyScrollBar extends RexPlugins.UI.ScrollBar {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var scrollBar = new MyScrollBar(scene, config);\n
    "},{"location":"ui-scrollbar/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    scrollBar.layout();\n

    See also - dirty

    "},{"location":"ui-scrollbar/#get-element","title":"Get element","text":"
    • Get element
    • Background game object
      var background = scrollBar.getElement(\"background\");\n
    • Slider game object
      • Slider background
        var sliderBackground = scrollBar.getElement(\"slider.background\");\n
      • Slider track
        var sliderTrack = scrollBar.getElement(\"slider.track\");\n
      • Slider indicator
        var sliderIndicator = scrollBar.getElement(\"slider.indicator\");\n
      • Slider thumb
        var sliderThumb = scrollBar.getElement(\"slider.thumb\");\n
    • Button game objects
      var buttons = scrollBar.getElement(\"buttons\");\n
      • buttons : Array of button game objects.
        • buttons[0] : Left or top button.
        • buttons[1] : Right or bottom button.
    • Get by name
      var gameObject = scrollBar.getElement(\"#\" + name);\n// var gameObject = scrollBar.getElement('#' + name, recursive);\n
      or
      var gameObject = scrollBar.getByName(\"#\" + name);\n// var gameObject = scrollBar.getByName(name, recursive);\n
    • recursive : Set true to search all children recursively.
    "},{"location":"ui-scrollbar/#enable","title":"Enable","text":"
    • Get
      var enable = scrollBar.enable;\n
    • Set
      scrollBar.setEanble(enable);\n
      or
      scrollBar.enable = enable;\n
    "},{"location":"ui-scrollbar/#value","title":"Value","text":"

    Change value will also change the position of slider thumb and width of slider indicator.

    • Get value
      var value = scrollBar.getValue(min, max); // value : min ~ max\n
      or
      var value = scrollBar.getValue(); // value: 0 ~ 1\n
      or
      var value = scrollBar.value; // value: 0 ~ 1\n
    • Set value
      scrollBar.setValue(value, min, max); // value: min ~ max\n
      or
      scrollBar.setValue(value); // value: 0 ~ 1\n
      or
      scrollBar.value = value; // value: 0 ~ 1\n
    • Increase value
      scrollBar.addValue(inc, min, max); // inc: min ~ max\n
      or
      scrollBar.addValue(inc); // inc: 0 ~ 1\n
      or
      scrollBar.value += inc; // inc: 0 ~ 1\n
    "},{"location":"ui-scrollbar/#ease-value","title":"Ease value","text":"
    • Ease value to
      scrollBar.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      scrollBar.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      scrollBar.stopEaseValue();\n
    • Set ease duration
      scrollBar.setEaseValueDuration(duration);\n
    • Set ease function
      scrollBar.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"ui-scrollbar/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-scrollbar/#events","title":"Events","text":"
    • On value changed
      scrollBar.on('valuechange',\nfunction (newValue, oldValue, scrollBar) {\n// scrollBar.text = Math.round(Phaser.Math.Linear(0, 100, newValue));\n},\nscope\n);\n
    • On input start
      scrollBar.on('inputstart', function(pointer) {\n\n}, scope);\n
    • On input end
      scrollBar.on('inputend', function(pointer) {\n\n}, scope);\n
    "},{"location":"ui-simpledropdownlist/","title":"Simple drop down list","text":""},{"location":"ui-simpledropdownlist/#introduction","title":"Introduction","text":"

    Using plain object to create drop down list.

    • Author: Rex
    • Game object
    "},{"location":"ui-simpledropdownlist/#live-demos","title":"Live demos","text":"
    • Drop-down list
    • Drop-down scrollable-list
    "},{"location":"ui-simpledropdownlist/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-simpledropdownlist/#install-plugin","title":"Install plugin","text":""},{"location":"ui-simpledropdownlist/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add drop-down list object
      var dropDownList = scene.rexUI.add.simpleDropDownList(config);\n
    "},{"location":"ui-simpledropdownlist/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add drop-down list object
      var dropDownList = scene.rexUI.add.simpleDropDownList(config);\n
    "},{"location":"ui-simpledropdownlist/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { DropDownList } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dropDownList object
      var dropDownList = new SimpleDropDownList(scene, config);\nscene.add.existing(dropDownList);\n
    "},{"location":"ui-simpledropdownlist/#add-drop-down-list-object","title":"Add drop-down list object","text":"
    var dropDownList = scene.rexUI.add.simpleDropDownList({\nlabel: labelStyle,\nbutton: buttonStyle,\n\ntrack: backgroundStyle,\nthumb: backgroundStyle,\n\nlist: {\n// easeIn: 500,\n// transitIn: undefined,\n// transitIn: function(listPanel, duration) {  },\n\n// easeOut: 100,\n// transitOut: undefined,\n// transitOut: function(listPanel, duration) {  },\n\n// wrap: false,\n// maxHeight: undefined,\n// width: undefined, \n// height: undefined,\n// alignParent: 'text',\n// alignSide: '',\n// expandDirection: 0,\n// bounds: undefined,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0, item: 0,\n//     line: 0\n// },\n\n// draggable: false        \n}\n\n}, creators);\n
    • label :
      • Styles of simple-label
    • button : Use label parameter if button parameter is not given.
      • Styles of simple-label
    • track, thumb :
      • Styles of background
    • list : Configuration of list panel.
      • list.easeIn : Pop-up duration in ms. Default value is 500.
      • list.transitIn : Tween behavior of opening list panel.
        • undefined : Expand list panel by pop-up, default behavior.
        • Custom callback
          function(listPanel, duration) {\n\n}\n
      • list.easeOut : Scale-down duration in ms. Default value is 100.
      • list.transitOut : Tween behavior of closing list panel.
        • undefined : Closing list panel by scale-down, default behavior.
        • Custom callback
          function(listPanel, duration) {\n\n}\n
      • list.wrap :
        • true : fixwidth-sizer layout, a row within buttons.
        • false : sizer layout, a row within a button. Default behavior.
      • list.maxHeight : If height of button list is larger than this maxHeight, put this button list into scrollable panel.
        • undefined, or 0 : Ignore this behavior.
        • > 0 and list.createThumbCallback parameter is given : If height of button list is larger than this maxHeight, put this button list into scrollable panel.
      • list.width : Minimum width.
        • undefined : Minimum width of panel will equal to width of parent label. Default value.
        • A number : Width of panel. Required fields when list.wrap is true.
      • list.height : Minimum height.
        • undefined : Create button list or wrap button list. Default value.
        • > 0 and thumb parameter is given : Create scrollable button list or wrap button list.
      • list.alignParent : Align x position to label.
        • 'icon' : Align x position to icon game object of parent label.
        • 'text' : Align x position to text game object of parent label. Default behavior
        • 'label', or null : Align x position to parent label.
      • list.alignSide : Align list to label's left or right side.
        • undefined, or 'left' : Align list's left side to label's left side. Default behavior.
        • 'right : Align list's right side to label's right side. Default behavior.
      • list.expandDirection :
        • 0, 'down' : Expand list down. i.e. list panel will put below parent label.
        • 1, 'up' : Expand list up. i.e. list panel will put above parent label.
      • list.bounds : Put list panel below parent label if bottom of list panel is inside bounds (Rectangle)
        • undefined : Use viewport as bounds
        • Rectangle
      • list.space : space properties of list panel.
        • left, right, top, bottom, item : For sizer layout. (list.wrap is false)
        • left, right, top, bottom, item, line : For fixwidth-sizer layout. (list.wrap is true)
      • list.draggable : Set true to drag top-most object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-simpledropdownlist/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDropDownList extends RexPlugins.UI.SimpleDropDownList {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dropDownList = new MyDropDownList(scene, config);\n
    "},{"location":"ui-simpledropdownlist/#options","title":"Options","text":"
    • Set
      dropDownList.setOptions(options);\n
      or
      dropDownList.options = options;\n
      • options : Array of strings, or objects contains these properties.
        {\ntext: string,\nvalue: any\n}\n
    • Get
      var options = dropDownList.options;\n
    "},{"location":"ui-simpledropdownlist/#other-properties","title":"Other properties","text":"

    See drop-down list, label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-simpledropdownlist/#events","title":"Events","text":"

    See Events section of drop-down list

    "},{"location":"ui-simplelabel/","title":"Simple label","text":""},{"location":"ui-simplelabel/#introduction","title":"Introduction","text":"

    Using plain object to create label.

    • Author: Rex
    • Game object
    "},{"location":"ui-simplelabel/#live-demos","title":"Live demos","text":"
    • Style
    • Bitmaptext
    • Nine-slice background
    • Bar-rectangle background
    • Wrap text
    • TextArea
    • Buttons
    "},{"location":"ui-simplelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-simplelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-simplelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.simpleLabel(style).resetDisplayContent(config);\n//var label = scene.rexUI.add.simpleLabel(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simplelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.simpleLabel(style).resetDisplayContent(config);\n//var label = scene.rexUI.add.simpleLabel(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simplelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SimpleLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new SimpleLabel(scene, style);\n// var label = new SimpleLabel(scene, style, creators);\nscene.add.existing(label);\nlabel.resetDisplayContent(config)\n
    "},{"location":"ui-simplelabel/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.simpleLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundStyle,\n// background: null,\n\nicon: iconStyle,\n// icon: null,\n\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textStyle,\n// text: null,\n\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\naction: actionStyle,\n// action: null,\n\n// squareFitAction: false,\n// actionMask: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\nalign: undefined,  // 'left' | 'top' | 'right' | 'bottom' | 'center\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • background :
      • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • text :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as text element.
      • null : Don't create any game object.
    • icon, action :
      • Style of Image : Create Image, Nine-slice, or Round-rectangle as image, action element.
      • null : Don't create any game object.
    "},{"location":"ui-simplelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLabel extends RexPlugins.UI.SimpleLabel {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyLabel(scene, config, creators);\n
    "},{"location":"ui-simplelabel/#reset-display-content","title":"Reset display content","text":"

    See label

    "},{"location":"ui-simplelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-simplelabel/#set-state","title":"Set state","text":"

    Override/restore properties of elements.

    "},{"location":"ui-simplelabel/#active-state","title":"Active state","text":"
    • Enable active state
      label.setActiveState();\n// label.setActiveState(true);\n
      • Override properties of background declared in config with prefix 'active.' parameters.
    • Disable active state
      label.setActiveState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simplelabel/#hover-state","title":"Hover state","text":"
    • Enable active state
      label.setHoverState();\n// label.setHoverState(true);\n
      • Override properties of background declared in config with prefix 'hover.' parameters
    • Disable active state
      label.setHoverState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simplelabel/#disable-state","title":"Disable state","text":"
    • Enable disable state
      label.setDisableState();\n// label.setDisableState(true);\n
      • Override properties of background declared in config with prefix 'disable.' parameters
    • Disable disable state
      label.setDisableState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simplelabel/#get-element","title":"Get element","text":"

    See label

    "},{"location":"ui-simplelabel/#other-properties","title":"Other properties","text":"

    See label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-simpletextbox/","title":"Simple text box","text":""},{"location":"ui-simpletextbox/#introduction","title":"Introduction","text":"

    Using plain object to create textBox.

    • Author: Rex
    • Game object
    "},{"location":"ui-simpletextbox/#live-demos","title":"Live demos","text":"
    • Inner sizer
    "},{"location":"ui-simpletextbox/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-simpletextbox/#install-plugin","title":"Install plugin","text":""},{"location":"ui-simpletextbox/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add textBox object
      var textBox = scene.rexUI.add.simpleTextBox(style).resetDisplayContent(config);\n//var textBox = scene.rexUI.add.simpleTextBox(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simpletextbox/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add textBox object
      var textBox = scene.rexUI.add.simpleTextBox(style).resetDisplayContent(config);\n//var textBox = scene.rexUI.add.simpleTextBox(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simpletextbox/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SimpleTextBox } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add textBox object
      var textBox = new SimpleTextBox(scene, style);\n// var textBox = new SimpleTextBox(scene, style, creators);\nscene.add.existing(textBox);\ntextBox.resetDisplayContent(config)\n
    "},{"location":"ui-simpletextbox/#add-textbox-object","title":"Add textBox object","text":"
    var textBox = scene.rexUI.add.simpleTextBox({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\n// rtl: false,\n\nbackground: backgroundStyle,\n// background: null,\n\ninnerBackground: backgroundStyle,\n// innerBackground: null,\n\nicon: iconStyle,\n// icon: null,\n\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntitle: textStyle,\n// title: null,\n// wrapTitle: false,\n// adjustTitleFontSize: false,\n// expandTitleWidth: false,\n// expandTitleHeight: false,\n\ntext: testStyle,\n// text: null,\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\nseparator: separatorStyle,\n// separator: null,\n\naction: actionStyle,\n// action: null,\n\n// squareFitAction: false,\n// actionMask: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\nalign: {\ntitle: 'left',\ntext: 'left',\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ninnerLeft: 0, innerRight: 0, innerTop: 0, innerBottom: 0,\n\ntitle: 0, titleLeft: 0, titleRight: 0,\nicon: 0, iconTop: 0, iconBottom: 0,\ntext: 0, textLeft: 0, textRight: 0,\nseparator: 0, separatorLeft: 0, separatorRight: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// page: { \n//    maxLines: undefined,\n//    pageBreak: '\\f\\n',\n// },\n// typing: { \n//    wrap: false,\n//    speed: 333,    \n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • background, innerBackground :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • title :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as title element.
      • null : Don't create any game object.
    • text :
      • Style of Text : Create Text, BBCodeText, BitmapText as text element.
        • Don't use SimpleLabel, or TextArea as text element.
      • null : Don't create any game object.
    • separator :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as separator element.
      • null : Don't create any game object.
    • icon, action :
      • Style of Image : Create Image, Nine-slice, or Round-rectangle as image, action element.
      • null : Don't create any game object.
    • wrapTitle : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
      • 2, 'char' : Character WrapExpandText.
    • adjustTitleFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapText: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.
    • wrapText : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
      • 2, 'char' : Character WrapExpandText.
    • adjustTextFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapText: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.
    "},{"location":"ui-simpletextbox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextBox extends RexPlugins.UI.SimpleTextBox {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var textBox = new MyTextBox(scene, config, creators);\n
    "},{"location":"ui-simpletextbox/#reset-display-content","title":"Reset display content","text":"

    See title-label

    "},{"location":"ui-simpletextbox/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    textBox.layout();\n

    See also - dirty

    "},{"location":"ui-simpletextbox/#typing","title":"Typing","text":"

    See textBox

    "},{"location":"ui-simpletextbox/#get-element","title":"Get element","text":"

    See textBox

    "},{"location":"ui-simpletextbox/#events","title":"Events","text":"

    See textBox

    "},{"location":"ui-simpletextbox/#other-properties","title":"Other properties","text":"

    See textBox, sizer object, base sizer object, container-lite.

    "},{"location":"ui-simpletitlelabel/","title":"Simple title label","text":""},{"location":"ui-simpletitlelabel/#introduction","title":"Introduction","text":"

    Using plain object to create title-label.

    • Author: Rex
    • Game object
    "},{"location":"ui-simpletitlelabel/#live-demos","title":"Live demos","text":"
    • Style
    "},{"location":"ui-simpletitlelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-simpletitlelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-simpletitlelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.simpleLabel(style).resetDisplayContent(config);\n//var label = scene.rexUI.add.simpleLabel(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simpletitlelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.simpleLabel(style).resetDisplayContent(config);\n//var label = scene.rexUI.add.simpleLabel(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simpletitlelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SimpleTitleLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new SimpleTitleLabel(scene, style);\n// var label = new SimpleTitleLabel(scene, style, creators);\nscene.add.existing(label);\nlabel.resetDisplayContent(config)\n
    "},{"location":"ui-simpletitlelabel/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.simpleLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\n// rtl: false,\n\nbackground: backgroundStyle,\n// background: null,\n\ninnerBackground: backgroundStyle,\n// innerBackground: null,\n\nicon: iconStyle,\n// icon: null,\n\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntitle: textStyle,\n// title: null,\n// wrapTitle: false,\n// adjustTitleFontSize: false,\n// expandTitleWidth: false,\n// expandTitleHeight: false,\n\ntext: testStyle,\n// text: null,\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\nseparator: separatorStyle,\n// separator: null,\n\naction: actionStyle,\n// action: null,\n\n// squareFitAction: false,\n// actionMask: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\nalign: {\ntitle: 'left',\ntext: 'left',\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ninnerLeft: 0, innerRight: 0, innerTop: 0, innerBottom: 0,\n\ntitle: 0, titleLeft: 0, titleRight: 0,\nicon: 0, iconTop: 0, iconBottom: 0,\ntext: 0, textLeft: 0, textRight: 0,\nseparator: 0, separatorLeft: 0, separatorRight: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • background, innerBackground :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • title :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as title element.
      • null : Don't create any game object.
    • text :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as text element.
      • null : Don't create any game object.
    • separator :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as separator element.
      • null : Don't create any game object.
    • icon, action :
      • Style of Image : Create Image, Nine-slice, or Round-rectangle as image, action element.
      • null : Don't create any game object.
    "},{"location":"ui-simpletitlelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLabel extends RexPlugins.UI.SimpleTitleLabel {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyLabel(scene, config, creators);\n
    "},{"location":"ui-simpletitlelabel/#reset-display-content","title":"Reset display content","text":"

    See title-label

    "},{"location":"ui-simpletitlelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-simpletitlelabel/#set-state","title":"Set state","text":"

    Override/restore properties of elements.

    "},{"location":"ui-simpletitlelabel/#active-state","title":"Active state","text":"
    • Enable active state
      label.setActiveState();\n// label.setActiveState(true);\n
      • Override properties of background declared in config with prefix 'active.' parameters.
    • Disable active state
      label.setActiveState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simpletitlelabel/#hover-state","title":"Hover state","text":"
    • Enable active state
      label.setHoverState();\n// label.setHoverState(true);\n
      • Override properties of background declared in config with prefix 'hover.' parameters
    • Disable active state
      label.setHoverState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simpletitlelabel/#disable-state","title":"Disable state","text":"
    • Enable disable state
      label.setDisableState();\n// label.setDisableState(true);\n
      • Override properties of background declared in config with prefix 'disable.' parameters
    • Disable disable state
      label.setDisableState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simpletitlelabel/#get-element","title":"Get element","text":"

    See title-label

    "},{"location":"ui-simpletitlelabel/#other-properties","title":"Other properties","text":"

    See title-label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-sizer/","title":"Sizer","text":""},{"location":"ui-sizer/#introduction","title":"Introduction","text":"

    Layout children game objects.

    It is inspired from wxSizer.

    • Author: Rex
    • Game object
    "},{"location":"ui-sizer/#live-demos","title":"Live demos","text":"
    • Nested sizer
      • Demo 1
      • Demo 2
      • Demo 3
    • Proportion
    • DOM child
    • Set children interactive :
      • Parent mode
      • Direct mode
    • Drag drop child
    • Bring child to top
    • Fit-ratio
    • Sort
    • Add multiple
    "},{"location":"ui-sizer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-sizer/#install-plugin","title":"Install plugin","text":""},{"location":"ui-sizer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add sizer object
      var sizer = scene.rexUI.add.sizer(config);\n
    "},{"location":"ui-sizer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sizer object
      var sizer = scene.rexUI.add.sizer(config);\n
    "},{"location":"ui-sizer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Sizer } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add sizer object
      var sizer = new Sizer(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-sizer/#add-sizer-object","title":"Add sizer object","text":"
    var sizer = scene.rexUI.add.sizer({\norientation: 0,\n// rtl: false,\n// startChildIndex: 0,\n\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.sizer(x, y, {\norientation: 0,\n// rtl: false,\n// startChildIndex: 0,\n\n// width: undefined,\n// height: undefined,\n// anchor: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.sizer(x, y, width, height, {\norientation: 0,\n// rtl: false,\n// startChildIndex: 0,\n// anchor: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.sizer(x, y, width, height, orientation, {\n// rtl: false,\n// startChildIndex: 0,\n// anchor: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0, item:0 }\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Orientation of the sizer.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right. Default value is 0.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    • rtl :
      • false : Layout children from left to right. Default behavior.
      • true : Layout children from right to left.
    • startChildIndex : A number, start index of first layout child. Default value is 0.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between 2 children game objects.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-sizer/#custom-class","title":"Custom class","text":"
    • Define class
      class MySizer extends RexPlugins.UI.Sizer {\nconstructor(scene, x, y, minWidth, minHeight, orientation, config) {\nsuper(scene, x, y, minWidth, minHeight, orientation, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var sizer = new MySizer(scene, x, y, minWidth, minHeight, orientation);\n
    "},{"location":"ui-sizer/#add-background","title":"Add background","text":"
    sizer.addBackground(child);\n

    or

    sizer.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    "},{"location":"ui-sizer/#add-child","title":"Add child","text":"

    Add a game obejct to sizer

    sizer.add(child);\n

    or

    sizer.add(child,\n{\nproportion: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,\nkey: undefined,\nindex: undefined,\nminWidth: undefined,\nminHeight: undefined,\nfitRatio: 0,  // true\noffsetX: 0,\noffsetY: 0,\noffsetOriginX: 0,\noffsetOriginY: 0,\n}\n);\n

    or

    sizer.add(child, proportion, align, padding, expand, key, index);\n// sizer.add(child, proportion, align, padding, expand, key, index);\n
    • child : A game object.
    • proportion :
      • 0, or 'min' : Place next game object closely. Default value.
      • > 0 : Stretch game object via proportion value.
      • null : Don't arrange this child.
    • align :
      • For horizontal orientation sizer :
        • 'center', or Phaser.Display.Align.CENTER : Align game object at vertical-center. Default value.
        • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center.
        • Use addSpace() to align child at horizontal-center.
      • For vertical orientation sizer :
        • 'center', or Phaser.Display.Align.CENTER : Align game object at horizontal-center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • Use addSpace() to align child at vertical-center.
    • padding : Extra padded space. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • expand : Set true to
      • Expand height when orientation is 0 (left-to-right), or
      • Expand width when orientation is 1 (top-to-bottom)
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    • index : Insert child to.
      • undefined : Insert child at last.
    • minWidth : Minimum width of normal (non-sizer) game object, used when orientation is x, and proportion is not 0, or orientation is y, and expand is true
      • Default value is current display width.
    • minHeight : Minimum height of normal (non-sizer) game object, used when orientation is y, and proportion is not 0, or orientation is x, and expand is true
      • Default value is current display height.
    • fitRatio : Resize child to fit sizer height/width before layout children, when proportion is set to 0.
      • 0, or false : Ignore this feature. Default behavior.
      • true : Fit ratio (width/height) from game object's display size.
      • > 0 : Fit ratio (width/height). 1 is square.
    • offsetX, offsetOriginX : Apply offset offsetX + offsetOriginY * width to x coordinate after alignment.
    • offsetY, offsetOriginY : Apply offset offsetY + offsetOriginY * height to y coordinate after alignment.
    "},{"location":"ui-sizer/#add-multiple","title":"Add multiple","text":"
    sizer.add(gameObjects, config);\n
    • gameObjects : Array of child game objects
    • config : See config of add-child
    "},{"location":"ui-sizer/#insert-child","title":"Insert child","text":"
    sizer.insert(index, child, {\nproportion: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,\nkey: undefined,\nminWidth: undefined,\nminHeight: undefined,\nfitRatio: 0,\n}\n);\n

    or

    sizer.insert(index, child, proportion, align, padding, expand, key);\n
    "},{"location":"ui-sizer/#insert-at-position","title":"Insert at position","text":"
    sizer.insertAtPosition(x, y, child, {\nproportion: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,\nkey: undefined,\nminWidth: undefined,\nminHeight: undefined,\nfitRatio: 0,\n}\n);\n

    or

    sizer.insertAtPosition(x, y, index, child, proportion, align, padding, expand, key);\n
    "},{"location":"ui-sizer/#add-space","title":"Add space","text":"
    • Add a stretchable space.
      sizer.addSpace();\n// sizer.addSpace(proportion);\n
    • Insert a stretchable space.
      sizer.insertSpace(index);\n// sizer.insertSpace(index, proportion);\n

    Use cases :

    • Align child at center
      sizer\n.addSpace()\n.add(child)\n.addSpace()\n
    • Align 2 children at left and right side
      sizer\n.add(childLeft)\n.addSpace()\n.add(childRight)\n
    "},{"location":"ui-sizer/#change-childrens-align-mode","title":"Change children's align mode","text":"
    sizer\n.setChildrenAlignMode(mode)\n.layout();\n
    • mode : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
        • Remove first and last space children.
      • 'center' : Align game objects at center.
        • Add two spaces as first and last children.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
        • Add space as first child.
    "},{"location":"ui-sizer/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    sizer.layout();\n

    See also - dirty

    "},{"location":"ui-sizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-sizer/#remove-child","title":"Remove child","text":"
    • Remove a child
      sizer.remove(child);\n
    • Remove and destroy a child
      sizer.remove(child, true);\n
    • Remove all children
      sizer.removeAll();\n
    • Remove and destroy all children
      sizer.removeAll(true);\n
    • Remove all children and backgrounds
      sizer.clear();\n
    • Remove and destroy all children and backgrounds
      sizer.clear(true);\n
    • Remove from parent sizer
      sizer.removeFromParentSizer();\n
    "},{"location":"ui-sizer/#sort-children","title":"Sort children","text":"
    • Sort by data
      sizer.sortChildrenByData(key, descending).layout();\n
      • key : Data key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by property of child
      sizer.sortChildrenByProperty(key, descending).layout();\n
      • key : Property key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by callback
      sizer.sortChildren(function(childA, childB){\n// var valueA = childA.getData(key);\n// var valueB = childB.getData(key);\n// return valueB - valueA\n}).layout();\n
      • childA, childB : 2 children of this size
    "},{"location":"ui-sizer/#get-element","title":"Get element","text":"
    • Get element
      • All children items
        var items = sizer.getElement('items');\n
    • Get by name
      var gameObject = sizer.getElement('#' + name);\n// var gameObject = sizer.getElement('#' + name, recursive);\n
      or
      var gameObject = sizer.getByName(name);\n// var gameObject = sizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-sizer/#get-child-index","title":"Get child index","text":"
    var index = sizer.getChildIndex(child);\n
    • index : A number, or null.
    "},{"location":"ui-sizer/#rtl","title":"RTL","text":"
    • Set rtl in config of constructor
    • Set rtl : sizer.setRTL(enable)
    • Get rtl : var rtl = sizer.rtl
    "},{"location":"ui-sizer/#alignment-of-child","title":"Alignment of child","text":"
    • Set alignment of child in config of adding child
    • Set alignment of child : sizer.setChildAlign(child, align)
      • align :
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center.
    • Get alignment of child : var align = sizer.getChildAlign(child)
    "},{"location":"ui-sizer/#proportion-of-child","title":"Proportion of child","text":"
    • Set proportion of child in config of adding child
    • Set proportion of child : sizer.setChildProportion(child, proportion)
    • Get proportion of child : var align = sizer.getChildProportion(child)
    "},{"location":"ui-sizer/#expand-of-child","title":"Expand of child","text":"
    • Set expand of child in config of adding child
    • Set expand of child : sizer.setChildExpand(child, expand)
    • Get expand of child : var expand = sizer.getChildExpand(child)
    "},{"location":"ui-sizer/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-slider/","title":"Slider","text":""},{"location":"ui-slider/#introduction","title":"Introduction","text":"

    A container with a track, indicator, thumb and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-slider/#live-demos","title":"Live demos","text":"
    • Slider bar
    • Color picker
    • Crop resize
    • Gap
    "},{"location":"ui-slider/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-slider/#install-plugin","title":"Install plugin","text":""},{"location":"ui-slider/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add slider object
      var slider = scene.rexUI.add.slider(config);\n
    "},{"location":"ui-slider/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add slider object
      var slider = scene.rexUI.add.slider(config);\n
    "},{"location":"ui-slider/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Slider } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add slider object
      var slider = new Slider(scene, config);\nscene.add.existing(slider);\n
    "},{"location":"ui-slider/#add-slider-object","title":"Add slider object","text":"
    var slider = scene.rexUI.add.slider({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\nreverseAxis: false,\n\nbackground: backgroundGameObject,\n/* \n    background: { \n        radius: 0, \n        color: undefined, alpha: 1,\n        strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n        shape: undefined\n    }\n    */\n\ntrack: trackGameObject,\n/* \n    track: { \n        width: 1, height: 1,\n        radius: 0, \n        color: undefined, alpha: 1,\n        strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n        shape: undefined\n    }\n    */    indicator: indicatorGameObject,\n/* \n    indicator: { \n        width: 1, height: 1,\n        radius: 0, \n        color: undefined, alpha: 1,\n        strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n        shape: undefined\n    }\n    */\n\nthumb: thumbGameObject,\n/* \n    thumb: { \n        width: 1, height: 1,\n        radius: 0, \n        color: undefined, alpha: 1,\n        strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n        shape: undefined\n    }\n    */\nthumbOffsetX: 0,\nthumbOffsetY: 0,\n\ninput: 'drag',\n\nvalue: 0,\ngap: undefined,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},    valuechangeCallback: function(newValue, oldValue, slider) {\n},\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n\nenable: true,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Horizontal slider.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Vertical slider.
    • reverseAxis :
      • false : Map left/top to 0, and right/bottom to 1. Default behavior.
      • true : Map left/top to 1, and right/bottom to 0.
    • background :
      • Game object of background, optional. This background game object will be resized to fit the size of slider.
      • A plain object to create round rectangle shape
        { radius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
    • track :
      • Game object of track, optional. This track game object will be resized to fit the size of slider, with space.
      • A plain object to create round rectangle shape
        { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
    • indicator :
      • Game object of indicator, optional.
      • A plain object to create round rectangle shape
        { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
    • thumb :
      • Game object of thumb, optional.
      • A plain object to create round rectangle shape
        { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
    • thumbOffsetX, thumbOffsetY : Shift thumb, default value is 0.
    • input :
      • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
      • 'click', or 1 : Control slider by touching track game object.
      • 'none', or -1 : Disable sider controlling.
    • value : Initial value (0 ~ 1).
    • gap : Snap a value to nearest grid slice, using rounding.
      • undefined : Disalbe this feature.
    • easeValue : Easing value when input is 'click'.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, slider) {\n}\n
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • enable : Set false to disable controlling.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-slider/#custom-class","title":"Custom class","text":"
    • Define class
      class MySlider extends RexPlugins.UI.Slider {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var slider = new MySlider(scene, config);\n
    "},{"location":"ui-slider/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    slider.layout();\n

    See also - dirty

    "},{"location":"ui-slider/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = slider.getElement('background');\n
      • Track game object
        var track = slider.getElement('track');\n
      • Indicator game object
        var track = slider.getElement('indicator');\n
      • Thumb track game object
        var action = slider.getElement('thumb');\n
    • Get by name
      var gameObject = slider.getElement('#' + name);\n// var gameObject = slider.getElement('#' + name, recursive);\n
      or
      var gameObject = slider.getByName(name);\n// var gameObject = slider.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-slider/#enable","title":"Enable","text":"
    • Get
      var enable = slider.enable;\n
    • Set
      slider.setEanble(enable);\n
      or
      slider.enable = enable;\n
    "},{"location":"ui-slider/#value","title":"Value","text":"

    Change value will also change the position of slider thumb and width of slider indicator.

    • Get value
      var value = slider.getValue(min, max); // value : min ~ max\n
      or
      var value = slider.getValue(); // value: 0 ~ 1\n
      or
      var value = slider.value; // value: 0 ~ 1\n
    • Set value
      slider.setValue(value, min, max); // value: min ~ max\n
      or
      slider.setValue(value); // value: 0 ~ 1\n
      or
      slider.value = value; // value: 0 ~ 1\n
    • Increase value
      slider.addValue(inc, min, max); // inc: min ~ max\n
      or
      slider.addValue(inc); // inc: 0 ~ 1\n
      or
      slider.value += inc; // inc: 0 ~ 1\n
    "},{"location":"ui-slider/#ease-value","title":"Ease value","text":"
    • Ease value to
      slider.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      slider.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      slider.stopEaseValue();\n
    • Set ease duration
      slider.setEaseValueDuration(duration);\n
    • Set ease function
      slider.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"ui-slider/#gap","title":"Gap","text":"
    • Set
      slider.setGap(gap);  // gap: 0~1\n
      or
      slider.setGap(gap, min, max);  // gap: min~max\n
    • Get
      var gap = slider.gap;  // gap: 0~1\n
    "},{"location":"ui-slider/#events","title":"Events","text":"
    • On value changed
      slider.on('valuechange', function(newValue, oldValue, slider){\n//\n}, scope);\n
    • On input start
      slider.on('inputstart', function(pointer) {\n\n}, scope);\n
    • On input end
      slider.on('inputend', function(pointer) {\n\n}, scope);\n
    "},{"location":"ui-slider/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-splitpanels/","title":"Split panels","text":""},{"location":"ui-splitpanels/#introduction","title":"Introduction","text":"

    A container with left(top) panel, right(bottom) panel, splitter, and background. Drag splitter to resize with left(top) panel, right(bottom) panel.

    • Author: Rex
    • Game object
    "},{"location":"ui-splitpanels/#live-demos","title":"Live demos","text":"
    • Split-panels
    "},{"location":"ui-splitpanels/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-splitpanels/#install-plugin","title":"Install plugin","text":""},{"location":"ui-splitpanels/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add split-panels object
      var splitPanels = scene.rexUI.add.splitPanels(config);\n
    "},{"location":"ui-splitpanels/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add split-panels object
      var splitPanels = scene.rexUI.add.splitPanels(config);\n
    "},{"location":"ui-splitpanels/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SplitPanels } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add split-panels object
      var splitPanels = new SplitPanels(scene, config);\nscene.add.existing(splitPanels);\n
    "},{"location":"ui-splitpanels/#add-split-panels-object","title":"Add split-panels object","text":"
    var splitPanels = scene.rexUI.add.splitPanels({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nleftPanel: leftPanelGameObject,\n// topPanel: topPanelGameObject,\n\nrightPanel: rightPanelGameObject,\n// bottomPanel: topPanelGameObject,\n\nsplitter: splitterGameObject,\n\nminLeftPanelWidth: 0,\nminTopPanelHeight: 0,\n\nminRightPanelWidth: 0,\nminBottomPanelHeight: 0,\n\nsplitRatio: 0.5\n\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0, item: 0,\n\nleftPanelTop: 0, leftPanelBottom: 0, leftPanelLeft: 0, leftPanelRight: 0,\n// topPanelTop: 0, topPanelBottom: 0, topPanelLeft: 0, topPanelRight: 0,\n\nrightPanelTop: 0, rightPanelBottom: 0, rightPanelLeft: 0, rightPanelRight: 0,\n// bottomPanelTop: 0, bottomPanelBottom: 0, bottomPanelLeft: 0, bottomPanelRight: 0,\n\nsplitterPanelTop: 0, splitterPanelBottom: 0, splitterPanelLeft: 0, splitterPanelRight: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • leftPanel(topPanel), rightPanel(bottomPanel) : First and second panel children.
    • splitter : Game object of splitter.
    • minLeftPanelWidth(minTopPanelHeight), minRightPanelWidth(minBottomPanelHeight) : Minimum width/height of first and second children.
      • 0 : Width/height does not have constraint. Default behavior.
    • splitRatio : Position of splitter. 0~1. Default value is 0.5.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between first child and splitter, splitter and second child.
      • space.leftPanelTop(space.topPanelTop), space.leftPanelBottom(space.topPanelBottom), space.leftPanelLeft(space.topPanelLeft), space.leftPanelRight(space.topPanelRight) : Space around first game object.
      • space.rightPanelTop(space.bottomPanelTop), space.rightPanelBottom(space.bottomPanelBottom), space.rightPanelLeft(space.bottomPanelLeft), space.rightPanelRight(space.bottomPanelRight) : Space around second game object.
      • space.splitterTop, space.splitterBottom, space.splitterLeft, space.splitterRight : Space around splitter game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-splitpanels/#custom-class","title":"Custom class","text":"
    • Define class
      class MySplitPanels extends RexPlugins.UI.SplitPanels {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var splitPanels = new MySplitPanels(scene, config);\n
    "},{"location":"ui-splitpanels/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    splitPanels.layout();\n

    See also - dirty

    "},{"location":"ui-splitpanels/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = splitPanels.getElement('background');\n
      • First game object
        var leftPanel = splitPanels.getElement('leftPanel');\n// var topPanel = splitPanels.getElement('topPanel');\n
      • Second game object
        var rightPanel = splitPanels.getElement('rightPanel');\n// var bottomPanel = splitPanels.getElement('bottomPanel');\n
      • Splitter game object
        var splitter = splitPanels.getElement('splitter');\n
    • Get by name
      var gameObject = splitPanels.getElement('#' + name);\n// var gameObject = splitPanels.getElement('#' + name, recursive);\n
      or
      var gameObject = splitPanels.getByName(name);\n// var gameObject = splitPanels.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-splitpanels/#split-ratio","title":"Split ratio","text":"
    • Get
      var splitRatio = splitPanels.splitRatio;\n
    • Set
      splitPanels.setSplitRatio(value);\n
      or
      splitPanels.splitRatio = value;\n
    "},{"location":"ui-splitpanels/#minimum-child-size","title":"Minimum child size","text":"
    • Get
      var minLeftPanelWidth = splitPanels.minLeftPanelWidth;\n// var minTopPanelHeight = splitPanels.minTopPanelHeight;\n\nvar minRightPanelWidth = splitPanels.minRightPanelWidth;\n// var minBottomPanelHeight = splitPanels.minBottomPanelHeight;\n
    • Set
      splitPanels.setMinLeftPanelWidth(value);\n// splitPanels.setMinTopPanelHeight(value);\n\nsplitPanels.setMinRightPanelWidth(value);\n// splitPanels.setMinBottomPanelHeight(value);\n
      or
      splitPanels.minLeftPanelWidth = value;\n// splitPanels.minTopPanelHeight = value;\n\nsplitPanels.minRightPanelWidth = value;\n// splitPanels.minBottomPanelHeight = value;\n
    "},{"location":"ui-splitpanels/#enable","title":"Enable","text":"
    • Get
      var enable = splitPanels.splitterEnable;\n
    • Set
      slider.setSplitterEnable(enable);\n
      or
      slider.splitterEnable = enable;\n
    "},{"location":"ui-splitpanels/#events","title":"Events","text":"
    • On drag splitter start
      splitPanels.on('splitter.dragstart', function(splitter, splitRatio){\n//\n}, scope);\n
    • On drag splitter end
      splitPanels.on('splitter.dragend', function(splitter, splitRatio){\n//\n}, scope);\n
    • On dragging splitter
      splitPanels.on('splitter.drag', function(splitter, splitRatio){\n//\n}, scope);\n
    • On pointer-over splitter
      splitPanels.on('splitter.over', function(splitter, splitRatio){\n//\n}, scope);\n
    • On pointer-out splitter
      splitPanels.on('splitter.out', function(splitter, splitRatio){\n//\n}, scope);\n
    "},{"location":"ui-splitpanels/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-style/","title":"Style","text":""},{"location":"ui-style/#introduction","title":"Introduction","text":"

    Style in plain object for creating image, or text.

    "},{"location":"ui-style/#style-of-background","title":"Style of Background","text":"

    Create Round-rectangle, Nine-slice, Nine-patch, or Image for background.

    • Create Round-rectangle, if style has color, or strokeColor key. Default type of Background.
    • Create Line-progress, if style has bar key.
    • Create Nine-slice, if style has leftWidth key.
    • Create Nine-patch, if style has leftWidth and stretchMode key.
    • Create Image, if style has key key.
    "},{"location":"ui-style/#style-of-image","title":"Style of Image","text":"

    Create Image, Nine-slice, Nine-patch, or Round-rectangle for image.

    • Create Image, if style has key key. Default type of Background.
    • Create Nine-slice, if style has leftWidth key.
    • Create Nine-patch, if style has leftWidth and stretchMode key.
    • Create Round-rectangle, if style has color, or strokeColor key.
    "},{"location":"ui-style/#style-of-text","title":"Style of Text","text":"

    Create Text, BBCodetext, BitmapText, SimpleLabel, or TextArea for text.

    • Text, by style, default type of Text.
    • BBCodetext, by style.
    • BitmapText, by style.
    • SimpleLabel, by style.
    • TextArea, by style.
    "},{"location":"ui-style/#style-of-image-game-object","title":"Style of Image game object","text":"
    {\n// $type: 'image',\n\nkey:\n// frame:\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n\n// effects: true,\n// Style override in active state\n// 'active.key': undefined,\n// 'active.frame': undefined,\n// 'active.tint': undefined,\n// 'active.alpha': undefined,\n// 'active.scale': undefined,\n// 'active.glowColor': null,\n// ...\n\n// Style override in hover state\n// 'hover.key': undefined,\n// 'hover.frame': undefined,\n// 'hover.tint': undefined,\n// 'hover.alpha': undefined,\n// 'hover.scale': undefined,\n// 'hover.glowColor': null,\n// ...\n\n// Style override in disable state\n// 'disable.key': undefined,\n// 'disable.frame': undefined,\n// 'disable.tint': undefined,\n// 'disable.alpha': undefined,\n// 'disable.scale': undefined,\n// 'disable.glowColor': null,\n// ...    \n}\n
    "},{"location":"ui-style/#style-of-nine-slice","title":"Style of Nine-slice","text":"
    {\n// $type: 'nineSlice',\n\nkey: ,\nframe: ,\nleftWidth: , rightWidth: ,\ntopHeight: , bottomHeight: ,\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n// width: 0,\n// height: 0,\n\n// effects: true,\n\n// Style override in active state\n// 'active.key': undefined,\n// 'active.frame': undefined,\n// 'active.tint': undefined,\n// 'active.alpha': undefined,\n// 'active.scale': undefined,\n// 'active.glowColor': null,\n// ...\n\n// Style override in hover state\n// 'hover.key': undefined,\n// 'hover.frame': undefined,\n// 'hover.tint': undefined,\n// 'hover.alpha': undefined,\n// 'hover.scale': undefined,\n// 'hover.glowColor': null,\n// ...\n\n// Style override in disable state\n// 'disable.key': undefined,\n// 'disable.frame': undefined,\n// 'disable.tint': undefined,\n// 'disable.alpha': undefined,\n// 'disable.scale': undefined,\n// 'disable.glowColor': null,\n// ...  \n}\n
    "},{"location":"ui-style/#style-of-nine-patch","title":"Style of Nine-patch","text":"
    {\n// $type: 'nineSlice',\n\nkey: ,\nframe: ,\nleftWidth: , rightWidth: ,\ntopHeight: , bottomHeight: ,\nstretchMode: ,\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n// width: 0,\n// height: 0,\n\n// effects: true,\n\n// Style override in active state\n// 'active.key': undefined,\n// 'active.frame': undefined,\n// 'active.tint': undefined,\n// 'active.alpha': undefined,\n// 'active.scale': undefined,\n// 'active.glowColor': null,\n// ...\n\n// Style override in hover state\n// 'hover.key': undefined,\n// 'hover.frame': undefined,\n// 'hover.tint': undefined,\n// 'hover.alpha': undefined,\n// 'hover.scale': undefined,\n// 'hover.glowColor': null,\n// ...\n\n// Style override in disable state\n// 'disable.key': undefined,\n// 'disable.frame': undefined,\n// 'disable.tint': undefined,\n// 'disable.alpha': undefined,\n// 'disable.scale': undefined,\n// 'disable.glowColor': null,\n// ...  \n}\n
    "},{"location":"ui-style/#style-of-round-rectangle","title":"Style of Round-rectangle","text":"
    {\n// $type: 'roundRectangle',\n\ncolor: 0xffffff,\n// alpha: 1,\n// origin:\n// originX: \n// originY:\nstrokeColor: 0xffffff,\n// strokeAlpha: 1,\n// strokeWidth: 2,\n// radius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n// width: 0,\n// height: 0,\n\n// Style override in active state\n// 'active.color': undefined,\n// 'active.alpha': undefined,\n// 'active.strokeColor': undefined,\n// 'active.strokeAlpha': undefined,\n// 'active.strokeWidth': undefined,\n// 'active.radius': undefined,\n// 'active.xxx': ...\n\n// Style override in hover state\n// 'hover.color': undefined,\n// 'hover.alpha': undefined,\n// 'hover.strokeColor': undefined,\n// 'hover.strokeAlpha': undefined,\n// 'hover.strokeWidth': undefined,\n// 'hover.radius': undefined,\n// 'hover.xxx': ...\n\n// Style override in disable state\n// 'disable.color': undefined,\n// 'disable.alpha': undefined,\n// 'disable.strokeColor': undefined,\n// 'disable.strokeAlpha': undefined,\n// 'disable.strokeWidth': undefined,\n// 'disable.radius': undefined,\n// 'disable.xxx': ...\n}\n
    "},{"location":"ui-style/#style-of-bar-rectangle","title":"Style of bar-rectangle","text":"

    Bar-rectangle = Line-progress

    {\n// $type: 'bar',\n\nbarColor: 0xffffff,\n// easeDuration: 200,\n// ease: 'Quad',\n// rtl: false,\n\n// alpha: 1,\n// origin:\n// originX: \n// originY:\n// color: 0xffffff,\n// strokeColor: 0xffffff,\n// strokeAlpha: 1,\n// strokeWidth: 2,    \n// width: 0,\n// height: 0,\n\n// Style override in active state\n// 'active.barColor': undefined,\n// 'active.color': undefined,\n// 'active.alpha': undefined,\n// 'active.strokeColor': undefined,\n// 'active.strokeAlpha': undefined,\n// 'active.strokeWidth': undefined,\n// 'active.radius': undefined,\n// 'active.xxx': ...\n\n// Style override in hover state\n// 'hover.barColor': undefined,\n// 'hover.color': undefined,\n// 'hover.alpha': undefined,\n// 'hover.strokeColor': undefined,\n// 'hover.strokeAlpha': undefined,\n// 'hover.strokeWidth': undefined,\n// 'hover.radius': undefined,\n// 'hover.xxx': ...,\n// 'hover.bar: true,\n\n// Style override in disable state\n// 'disable.barColor': undefined,\n// 'disable.color': undefined,\n// 'disable.alpha': undefined,\n// 'disable.strokeColor': undefined,\n// 'disable.strokeAlpha': undefined,\n// 'disable.strokeWidth': undefined,\n// 'disable.radius': undefined,\n// 'disable.xxx': ...\n}\n
    "},{"location":"ui-style/#style-of-text-game-object","title":"Style of Text game object","text":"
    {\n// $type: 'text',\n\n// Normal text-style\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nalign: 'left',  // 'left'|'center'|'right'|'justify'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\nrtl: false,\ntestString: '|M\u00c9qgy',\nwordWrap: {\nwidth: null,\ncallback: null,\ncallbackScope: null,\nuseAdvancedWrap: false\n},\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n\n// Style override in active state\n'active.fontFamily': undefined,\n'active.fontSize': undefined,\n'active.fontStyle': undefined,\n'active.backgroundColor': undefined,\n'active.color': undefined,\n'active.fill': undefined,\n'active.stroke': undefined,\n'active.strokeThickness': undefined,\n\n// Style override in hover state\n'hover.fontFamily': undefined,\n'hover.fontSize': undefined,\n'hover.fontStyle': undefined,\n'hover.backgroundColor': undefined,\n'hover.color': undefined,\n'hover.fill': undefined,\n'hover.stroke': undefined,\n'hover.strokeThickness': undefined,\n\n// Style override in disable state\n'disable.fontFamily': undefined,\n'disable.fontSize': undefined,\n'disable.fontStyle': undefined,\n'disable.backgroundColor': undefined,\n'disable.color': undefined,\n'disable.fill': undefined,\n'disable.stroke': undefined,\n'disable.strokeThickness': undefined,\n}\n
    "},{"location":"ui-style/#style-of-bbcodetext","title":"Style of BBCodeText","text":"
    {\n$type: 'bbcodetext', // or 'bbcode'\n\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nalign: 'left',  // 'left'|'center'|'right'|'justify'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\nrtl: false,\ntestString: '|M\u00c9qgy',\nwrap: {\nmode: 'none'     // 0|'none'|1|'word'|2|'char'|'character'|3|'mix'\nwidth: null\n},\n// wordWrap: { width: 0 },   // Compatible with Text game object\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n}\n
    "},{"location":"ui-style/#style-of-bitmaptext","title":"Style of BitmapText","text":"
    {\n// $type: 'bitmaptext',  // or 'bitmap'\n\nfont: '',\nfontSize: undefined,\nalign: undefined,\ntint: undefined,\nletterSpacing: undefined,\nlineSpacing: undefined,\n\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// origin:\n// originX: \n// originY:\n\n// Style override in active state\n'active.font': undefined,\n'active.fontSize': undefined,\n'active.tint': undefined,\n'active.letterSpacing': undefined,\n'active.lineSpacing': undefined,\n\n// Style override in hover state\n'hover.font': undefined,\n'hover.fontSize': undefined,\n'hover.tint': undefined,\n'hover.letterSpacing': undefined,\n'hover.lineSpacing': undefined,\n\n// Style override in disable state\n'disable.font': undefined,\n'disable.fontSize': undefined,\n'disable.tint': undefined,\n'disable.letterSpacing': undefined,\n'disable.lineSpacing': undefined,\n}\n
    "},{"location":"ui-style/#style-of-simplelabel","title":"Style of SimpleLabel","text":"
    {\n$type: 'label',\n\n// width: undefined,\n// height: undefined,\n// origin:\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundStyle,\n\nicon: iconStyle,\n\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: testStyle,\n// wrapText: false,  // false|'word'|'char',\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\naction: actionStyle,\n\n// squareFitAction: false,\n// actionMask: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\nalign: undefined,  // 'left' | 'top' | 'right' | 'bottom' | 'center\n}    
    • background :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • text :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as text element.
      • null : Don't create any game object.
    • icon, action :
      • Style of Image : Create Image, Nine-slice, or Round-rectangle as image, action element.
      • null : Don't create any game object.
    "},{"location":"ui-style/#style-of-textarea","title":"Style of TextArea","text":"

    {\n$type: 'textarea',\n\nspace: { left: 0, right: 0, top: 0, bottom: 0, text: 0, },\n\n// width:\n// height:\n// origin:\n// originX:\n// originY:\n\nbackground: backgroundStyle,\n\ntext: textStyle,\n\n// textWidth: undefined,\n// textHeight: undefined,\n// textMask: false,\n// alwaysScrollable: false,\n\nslider: {\ntrack: backgroundStyle,\n\nthumb: backgroundStyle,\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n},\n// slider: null,\n\n// scroller: {\n//     threshold: 10,\n//     slidingDeceleration: 5000,\n//     backDeceleration: 2000,\n//     pointerOutRelease: true,\n//     dragRate: 1,\n// },\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\nclampChildOY: false,\n}\n
    - background : - Style of Background : Create round-rectangle, nine-slice, or image as background element. - null : Don't create any game object. - text : - Style of Text : Create text, BBCodeText, BitmapText, or SimpleLabel as text element. - null : Don't create any game object. - slider : - slider.track : - Style of Background : Create round-rectangle, nine-slice, or image as track element. - null : Don't create any game object. - slider.thumb : - Style of Background : Create round-rectangle, nine-slice, or image as thumb element. - null : Don't create any game object. - null, or false : Don't create any game object for slider.

    "},{"location":"ui-style/#style-of-canvasinput","title":"Style of CanvasInput","text":"

    CanvasInput

    {\nwidth: undefined, height: undefined,\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n\n// Style when focus\n// 'focus.color': ...\n// 'focus.color2': ...\n// 'focus.stroke': ...\n},\nfocusStyle: undefined,\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0,\n\n// Style when cursor move on\n// 'cursor.color': ...\n// 'cursor.backgroundColor': ...\n// 'cursor.xxx': ...\n},\ncursorStyle: undefined,\n}\n
    "},{"location":"ui-style/#style-of-triangle","title":"Style of triangle","text":"
    {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n
    "},{"location":"ui-tabpages/","title":"Tab pages","text":""},{"location":"ui-tabpages/#introduction","title":"Introduction","text":"

    A container with tabs and pages, only current page is visible.

    • Author: Rex
    • Game object
    "},{"location":"ui-tabpages/#live-demos","title":"Live demos","text":"
    • Tabpage
    "},{"location":"ui-tabpages/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-tabpages/#install-plugin","title":"Install plugin","text":""},{"location":"ui-tabpages/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add tab-pages object
      var tabPages = scene.rexUI.add.tabPages(config);\n
    "},{"location":"ui-tabpages/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tab-pages object
      var tabPages = scene.rexUI.add.tabPages(config);\n
    "},{"location":"ui-tabpages/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TabPages } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add tab-pages object
      var tabPages = new TabPages(scene, config);\nscene.add.existing(tabPages);\n
    "},{"location":"ui-tabpages/#add-tab-pages-object","title":"Add tab-pages object","text":"
    var tabPages = scene.rexUI.add.tabPages({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// background: backgroundGameObject,\n\ntabsPosition: 'top',\n// tabPosition: 'top',\n\nwrapTabs: false,\n\ntabs: {\n// width:\n// height:\n// rtl:\n\n// background: backgroundGameObject,        \nalign:\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\nspace: { left: 0, right:0, top:0, bottom:0, item:0 }\n},\n\npages: {\nspace: { left: 0, right:0, top:0, bottom:0 },\nfadeIn: 0,\n},\n\nexpand: {\ntabs: false,\n},\n\nalign: {\ntabs: 'left',\n},\n\n// space: { left:0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • tabsPosition (or tabPosition) : Put tabs at top, bottom, left, right of pages.
      • 'top', 'bottom', 'left', 'right' : Default value is 'top'.
    • wrapTabs :
      • false : Uses Buttons as Tabs, default behavior.
      • true :
        • Using FixWidthButtons as Tabs, if tabPosition is 'top' or 'bottom'.
        • Using Buttons as Tabs, if tabPosition is 'left' or 'right'
    • tabs : Configuration of tabs, which is a buttons game object.
      • tabs.width, tabs.height : Minimum width, minimum height of tabs, to preserve space if tabs is empty, optional.
      • tabs.rtl :
        • true : Layout buttons from right to left.
        • false : Layout buttons from left to right. Default behavior.
      • tabs.background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
      • tabs.space :
        • tabs.space.top, tabs.space.bottom, tabs.space.left, tabs.space.right : Padding around bottons.
        • tabs.space.item : Space between 2 button game objects.
      • tabs.click: Configuration of button clicking.
        • tabs.click.mode :
          • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
          • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
        • tabs.click.clickInterval : Interval between 2 'click' events, in ms.
    • pages : Configuration of pages
      • pages.space : Pads spaces.
        • pages.space.left, pages.space.right, pages.space.top, pages.space.bottom : Space of bounds.
      • pages.fadeIn : Fade-in duration of current page.
        • 0 : No fade-in effect. Default behavior.
    • expand :
      • expand.tabs : Set true to expand width/height of tabs. Default value is false.
    • align :
      • align.tabs :
        • 'left'. 'right', 'center' : Align tabs to left/right/center side when tabPosition is 'top' or 'bottom'.
        • 'top'. 'bottom', 'center' : Align tabs to top/bottom/center side when tabPosition is 'left' or 'right'.
    • space :
      • An object: Padding of button game objects.
        • space.top, space.bottom, space.left, space.right : Padding around bottons.
        • space.item : Space between tabs and pages.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-tabpages/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTabPages extends RexPlugins.UI.TabPages {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var tabPages = new MyTabPages(scene, config);\n
    "},{"location":"ui-tabpages/#add-page","title":"Add page","text":"

    Add a tab/page to last of tabs/pages.

    tabPages.addPage(key, tabGameObject, pageGameObject).layout();\n

    or

    tabPages.addPage({\n// key: undefined,\ntab: tabGameObject,\npage: pageGameObject\n}).layout();\n
    • key : Unique string name of this page.
      • undefined : Create an UUID for key.
    • tab : A game object, will put it into tabs.
    • page : A game object, will put it into pages.

    Note

    Invoke tabPages.layout() after adding pages.

    "},{"location":"ui-tabpages/#swap-to-page","title":"Swap to page","text":"
    • Swap to related page when clicking tab.
    • Swap to page by key/index
      tabPages.swapPage(key);\n
      tabPages.swapPage(index);\n
      • key : Unique string name of the page.
      • index : Index number in tabs.
    • Swap to first page
      tabPages.swapFirstPage();\n
    • Swap to last page
      tabPages.swapLastPage();\n
    • Swap page without fade-in transition
      tabPages.swapPage(key, 0);\n
      tabPages.swapPage(index, 0);\n
      tabPages.swapFirstPage(0);\n
      tabPages.swapLastPage(0);\n
    "},{"location":"ui-tabpages/#remove-page","title":"Remove page","text":"
    • Remove page
      tabPages.removePage(key);\n
      tabPages.removePage(index);\n
    • Remove and destroy page
      tabPages.removePage(key, true);\n
      tabPages.removePage(index, true);\n
    • Remove all pages
      tabPages.removeAllPages();\n
    • Remove and destroy all pages
      tabPages.removeAllPages(true);\n
    "},{"location":"ui-tabpages/#change-tabs-position","title":"Change tabs position","text":"
    tabPages.setTabPosition(position);\n
    • position : 'top', 'bottom', 'left', 'right'
    "},{"location":"ui-tabpages/#padding-of-tabs","title":"Padding of tabs","text":"
    • Change padding
      tabPages.setTabsPadding(key, value).layout();\n
      or
      tabPages.setTabsPadding({\nleft: leftPadding, right: rightPadding,\ntop: topPadding,\nbottom: bottomPadding\n}).layout();\n
      • key : 'left', 'right', 'top', 'bottom', 'item'
    • Get padding
      var value = tabPages.getTabsPadding(key);\n
      • key : 'left', 'right', 'top', 'bottom', 'item'
    "},{"location":"ui-tabpages/#get-element","title":"Get element","text":"
    • Get element
      • Pages
        var gameObject = tabPages.getElement('pages');\n
      • Tabs, a buttons
        var gameObject = tabPages.getElement('tabs');\n
      • Page by key/index
        var gameObject = tabPages.getPage(key);\n
        var gameObject = tabPages.getPage(index);\n
        • key : Unique string name of the page.
        • index : Index number in tabs.
      • Tab by key/index
        var gameObjects = tabPages.getTab(key);\n
        var gameObjects = tabPages.getTab(index);\n
        • key : Unique string name of the page.
        • index : Index number in tabs.
    • Get by name
      var gameObject = tabPages.getElement('#' + name);\n// var gameObject = pages.getElement('#' + name, recursive);\n
      or
      var gameObject = tabPages.getByName(name);\n// var gameObject = tabPages.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-tabpages/#other-properties","title":"Other properties","text":"

    See sizer, base sizer object, container-lite, Pages, Buttons

    "},{"location":"ui-tabpages/#events","title":"Events","text":"
    • When swapping to a page by clicking tab, or tabPages.swapPage(key)
      pages.on('tab.focus', function(tab, key) {\n// ...\n}, scope);\npages.on('page.focus', function(page, key) {\n// ...\n}, scope);\n
      pages.on('tab.blur', function(tab, key) {\n// ...\n}, scope);\npages.on('page.blur', function(page, key) {\n// ...\n}, scope);    
      • tab : Game object of tab.
      • page : Game object of page.
      • key : Unique string name of the page.
    "},{"location":"ui-tabs/","title":"Tabs","text":""},{"location":"ui-tabs/#introduction","title":"Introduction","text":"

    A container with 4 groups of buttons around a center panel.

    • Author: Rex
    • Game object
    "},{"location":"ui-tabs/#live-demos","title":"Live demos","text":"
    • Tabs
    • Expand buttons
    • Tabs-table
    "},{"location":"ui-tabs/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-tabs/#install-plugin","title":"Install plugin","text":""},{"location":"ui-tabs/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add tabs object
      var tabs = scene.rexUI.add.tabs(config);\n
    "},{"location":"ui-tabs/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tabs object
      var tabs = scene.rexUI.add.tabs(config);\n
    "},{"location":"ui-tabs/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Tabs } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add tabs object
      var tabs = new Tabs(scene, config);\nscene.add.existing(tabs);\n
    "},{"location":"ui-tabs/#add-tabs-object","title":"Add Tabs object","text":"
    var tabs = scene.rexUI.add.tabs({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundGameObject,\npanel: panelGameObject,\n\nleftButtons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\nrightButtons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\ntopButtons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\nbottomButtons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\nleftButtonsBackground: leftButtonsBackgroundGameObject,\nrightButtonsBackground: rightButtonsBackgroundGameObject,\ntopButtonsBackground: topButtonsBackgroundGameObject,\nbottomButtonsBackground: bottomButtonsBackgroundGameObject,\n\nexpand: {\npanel: false,\nleftButtons: false,\nrightButtons: false,\ntopButtons: false,\nbottomButtons: false,\n},\n\nalign: {\nleftButtons: 'top',\nrightButtons: 'top',\ntopButtons: 'left',\nbottomButtons: 'left',\n},\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nleftButtonsOffset: 0,\nrightButtonsOffset: 0,\ntopButtonsOffset: 0,\nbottomButtonsOffset: 0,\n\nleftButton: 0,\nrightButton: 0,\ntopButton: 0,\nbottomButton: 0\n},\n\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n}\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • panel : Game object of center panel.
    • leftButtons, rightButtons, topButtons, bottomButtons : Array of button game object.
      • [] : Assign an empty array if user will add button later.
    • leftButtonsBackground, rightButtonsBackground, topButtonsBackground, bottomButtonsBackground : Game object of leftButtons' background, rightButtons' background, topButtons' background, bottomButtons' background, optional.
    • expand : Expand size of panel or buttons
      • expand.panel : Expand size of panel. Default value is false.
      • expand.leftButtons, expand.rightButtons : Expand height of leftButtons, rightButtons. Default value is false.
      • expand.topButtons, expand.bottomButtons : Expand width of topButtons, bottomButtons. Default value is false.
    • align : Alignment of buttons
      • align.leftButtons, align.rightButtons : 'top', 'bottom', or 'center'. Default value is 'top'.
      • align.topButtons, align.bottomButtons : 'left', 'right', or 'center'. Default value is 'left'.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds
      • space.leftButtonsOffset, space.rightButtonsOffset : Top offset of buttons group.
      • space.topButtonsOffset, space.bottomButtonsOffset : Left offset of buttons group.
      • space.leftButton, space.rightButton, space.topButton, space.bottomButton : Space between 2 button game objects.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-tabs/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTabs extends RexPlugins.UI.Tabs {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var tabs = new MyTabs(scene, config);\n
    "},{"location":"ui-tabs/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    tabs.layout();\n

    See also - dirty

    "},{"location":"ui-tabs/#other-properties","title":"Other properties","text":"

    See grid sizer object, base-sizer object.

    "},{"location":"ui-tabs/#events","title":"Events","text":"
    • Click button
      tabs.on('button.click', function(button, groupName, index, pointer) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
    • Pointer-over button
      tabs.on('button.over', function(button, groupName, index, pointer) {\n// ...\n}, scope);\n
      • button : Triggered button game object
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
    • Pointer-out button
      tabs.on('button.out', function(button, groupName, index, pointer) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
    • Enable button's input
      tabs.on('button.enable', function(button, groupName, index) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
    • Disable button's input
      tabs.on('button.disalbe', function(button, groupName, index) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
    "},{"location":"ui-tabs/#emit-button-click-event","title":"Emit button click event","text":"
    • Emit button click event in a given group
      tabs.emitButtonClick(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Emit left/right/top/bottom button click event
      tabs.emitLeftButtonClick(index);\ntabs.emitRightButtonClick(index);\ntabs.emitTopButtonClick(index);\ntabs.emitBottomButtonClick(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-tabs/#enabledisable-input-of-button","title":"Enable/disable input of button","text":"
    • Enable button input in a given group
      tabs.setButtonEnable(groupName, index);\n// tabs.setButtonEnable(groupName, index, true);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Enable left/right/top/bottom button
      tabs.setLeftButtonEnable(index);\ntabs.setRightButtonEnable(index);\ntabs.setTopButtonEnable(index);\ntabs.setBottomButtonEnable(index);\n
      • index : A number index, or a button game object.
    • Disable button input in a given group
      tabs.setButtonEnable(groupName, index, false);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Disable choice/action/toolbar/left-toolbar button's input
      tabs.setLeftButtonEnable(index, false);\ntabs.setRightButtonEnable(index, false);\ntabs.setTopButtonEnable(index, false);\ntabs.setBottomButtonEnable(index, false);\n
      • index : A number index, or a button game object.
    • Toggle button input in a given group
      tabs.toggleButtonEnable(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Toggle choice/action/toolbar/left-toolbar button's input
      tabs.toggleLeftButtonEnable(index);\ntabs.toggleRightButtonEnable(index);\ntabs.toggleTopButtonEnable(index);\ntabs.toggleBottomButtonEnable(index);\n
      • index : A number index, or a button game object.
    • Get button input enable in a given group
      var enabled = tabs.getButtonEnable(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Get choice/action/toolbar/left-toolbar button's input enable
      var enabled = tabs.getLeftButtonEnable(index);\nvar enabled = tabs.getRightButtonEnable(index);\nvar enabled = tabs.getTopButtonEnable(index);\nvar enabled = tabs.getBottomButtonEnable(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-tabs/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = tabs.getElement('background');\n
      • Panel game object
        var panel = tabs.getElement('panel');\n
      • Buttons
        • Button game object in a group
          var buttons = tabs.getButton(groupName, index)\n
          • groupName : 'left', 'right', 'top', or 'bottom'.
          • index : A number index.
        • Left button game object
          var buttons = tabs.getElement('leftButtons');\n
          or
          var button = tabs.getLeftButton(index);\n
          or
          var buttons = tabs.getElement('leftButtons[0]');\n
          • First button of left buttons.
        • Right button game object
          var buttons = tabs.getElement('rightButtons');\n
          or
          var button = tabs.getRightButton(index);\n
          or
          var buttons = tabs.getElement('rightButtons[0]');\n
          • First button of right buttons.
        • Top button game object
          var buttons = tabs.getElement('topButtons');\n
          or
          var button = tabs.getTopButton(index);\n
          or
          var buttons = tabs.getElement('topButtons[0]');\n
          • First button of top buttons.
        • Bottom button game object
          var buttons = tabs.getElement('bottomButtons');\n
          or
          var button = tabs.getBottomButton(index);\n
          or
          var buttons = tabs.getElement('bottomButtons[0]');\n
          • First button of bottom buttons.
    • Get by name
      var gameObject = tabs.getElement('#' + name);\n// var gameObject = tabs.getElement('#' + name, recursive);\n
      or
      var gameObject = tabs.getByName(name);\n// var gameObject = tabs.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-tabs/#add-button","title":"Add button","text":"
    • Add button in a group
      tabs.addButton(groupName, gameObject);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • gameObject : A game object, or an array of game objects.
    • Add left/right/top/bottom button
      tabs.addLeftButton(gameObject);\ntabs.addRightButton(gameObject);\ntabs.addTopButton(gameObject);\ntabs.addBottomButton(gameObject);\n
      • gameObject : A game object, or an array of game objects.
    "},{"location":"ui-tabs/#remove-button","title":"Remove button","text":"
    • Remove a button from a group
      tabls.removeButton(groupName, index, destroyChild);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, a string name, or a button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove left/right/top/bottom button
      tabs.removeLeftButton(index, destroyChild);\ntabs.removeRightButton(index, destroyChild);\ntabs.removeTopButton(index, destroyChild);\ntabs.removeBottomButton(index, destroyChild);\n
      • index : A number index, a string name, or a button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove all buttons of a group
      tabls.clearButtons(groupName, destroyChild);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • destroyChild : Set true to destroy button game objects.
    • Remove all left/right/top/bottom buttons
      tabs.clearLeftButtons(destroyChild);\ntabs.clearRightButtons(destroyChild);\ntabs.clearTopButtons(destroyChild);\ntabs.clearBottomButtosn(destroyChild);\n
      • destroyChild : Set true to destroy button game objects.
    "},{"location":"ui-tabs/#showhide-button","title":"Show/hide button","text":"

    Hidden elements won't be counted when layouting. Call tabs.layout(), or topSizer.layout() after show/hide any button.

    • Show button in a group
      tabs.showButton(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, a string name, or a button game object.
    • Show left/right/top/bottom button
      tabs.showLeftButton(index);\ntabs.showRightButton(index);\ntabs.showTopButton(index);\ntabs.showBottomButton(index);\n
      • index : A number index, a string name, or a button game object.
    • Hide button in a group
      tabs.hideButton(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, a string name, or a button game object.
    • Hide left/right/top/bottom button.
      tabs.hideLeftButton(index);\ntabs.hideRightButton(index);\ntabs.hideTopButton(index);\ntabs.hideBottomButton(index);\n
      • index : A number index, a string name, or a button game object.
    "},{"location":"ui-tabs/#for-each-button","title":"For each button","text":"
    • For each button in a group
      var enabled = tabs.forEachButton(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • For each button in left/right/top/bottom group
      tabs.forEachLeftButton(callback, scope);\ntabs.forEachRightButton(callback, scope);\ntabs.forEachTopButton(callback, scope);\ntabs.forEachBottomButton(callback, scope);\n
      • callback :
        function(button, index, buttons) {\n// ...\n}\n
    "},{"location":"ui-text-helper/","title":"Ui text helper","text":""},{"location":"ui-text-helper/#introduction","title":"Introduction","text":"

    Some helper methods for Text object, bbcode text object, tag text object, Bitmap text object game objects

    • Author: Rex
    • Methods
    "},{"location":"ui-text-helper/#live-demos","title":"Live demos","text":"
    • Wrap-expand-text
    • Wrap-expand-bitmaptext
    • Fontsize-expand-text
    • Resize Fontsize-expand-text
    "},{"location":"ui-text-helper/#usage","title":"Usage","text":"
    • Wrap-expand-text
    • Fontsize-expand-text
    "},{"location":"ui-text-helper/#wrap-expand-text","title":"Wrap expand text","text":"
    sizer\n.add(\nthis.rexUI.wrapExpandText(this.add.text(0, 0, content)),\n{\n// proportion: 1,\n// expand: true\n}\n)\n
    • proportion: 1 or/and expand: true : Expand width of text
    "},{"location":"ui-text-helper/#fontsize-expand-text","title":"Fontsize expand text","text":"
    sizer\n.add(\nthis.rexUI.fontSizeExpandText(this.add.text(0, 0, content)),\n{\n// proportion: 1,\n// expand: true\n}\n)\n
    • proportion: 1 or/and expand: true : Expand width of text
    "},{"location":"ui-textarea/","title":"Text area","text":""},{"location":"ui-textarea/#introduction","title":"Introduction","text":"

    A container with a text, slider, and scroller.

    • Author: Rex
    • Game object
    "},{"location":"ui-textarea/#live-demos","title":"Live demos","text":"
    • Text-area
    • Bitmap text
    • Hide unscrollable slider
    • Append text
    • Scroll to line
    • Modal dialog
    • Min height
    "},{"location":"ui-textarea/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-textarea/#install-plugin","title":"Install plugin","text":""},{"location":"ui-textarea/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add text-area object
      var textArea = scene.rexUI.add.textArea(config);\n
    "},{"location":"ui-textarea/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-area object
      var textArea = scene.rexUI.add.textArea(config);\n
    "},{"location":"ui-textarea/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TextArea } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add text-area object
      var textArea = new TextArea(scene, config);\nscene.add.existing(textArea);\n
    "},{"location":"ui-textarea/#add-text-area-object","title":"Add text-area object","text":"
    var textArea = scene.rexUI.add.textArea({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundGameObject,\n\ntext: textGameObject,\n// textWidth: undefined,\n// textHeight: undefined,\n// textMask: false,\n// alwaysScrollable: false,\n\nslider: {\n// background: sliderBackgroundGameObject,\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n\n// indicator: indicatorGameObject,\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n\n// buttons: {\n//     top: topButtonGameObject, bottom: bottomButtonGameObject,\n//     left: leftButtonGameObject, right: rightButtonGameObject,\n//     step: 0.01,\n// }\n},\n\n// scroller: {\n//     threshold: 10,\n//     slidingDeceleration: 5000,\n//     backDeceleration: 2000,\n//     pointerOutRelease: true,\n//     rectBoundsInteractive: true,\n//     dragRate: 1,\n// },\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\nclampChildOY: false,\n\nheader: headerGameObject,\nfooter: footerGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntext: 0,\n// text: {\n//    top: 0,\n//    bottom: 0,\n//    left: 0,\n//    right: 0,\n//},\n\nslider: 0,\n// slider: {\n//     top: 0,\n//     bottom: 0,\n//     left: 0,\n//     right: 0,\n// },\n\nheader: 0,\nfooter: 0,\n},\n\nexpand: {\nheader: true,\nfooter: true,\n},\n\nalign: {\nheader: 'center',\nfooter: 'center',\n},\n\ncontent: '',\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of text area.
    • text : Text object, bbcode text object, tag text object, or bitmap text object
    • textWidth : Fixed width of text game object. Set undefined to ignore this feature.
    • textHeight : Fixed height of text game object. Set undefined to ignore this feature.
    • textMask :
      • false : Crop text game object. Default behavior if text game object has setCrop method.
      • true : Apply mask on text to crop text game object. Default behavior if text game object does not have setCrop method (ex. bitmaptext game object).
    • slider : Componments of slider, optional.
      • slider.background : Game object of slider background, optional.
      • slider.track : Game object of track.
      • slider.thumb : Game object of thumb.
      • slider.input :
        • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.position : Position of this slider.
        • 0, 'right', 'bottom' : Slider at right/bottom side. Default value.
        • 1, 'left', 'top' : Slider at left/top side.
      • slider.hideUnscrollableSlider :
        • false : Slider is always visible no matter it is scrollable or not. Default behavior.
        • true : Set slider to invisible if it is unscrollable.
      • slider.disableUnscrollableDrag :
        • false : Scroller is always enale no matter it is scrollable or not. Default behavior.
        • true : Set scroller to disable if it is unscrollable.
      • slider.adaptThumbSize :
        • false : Don't adjust height/width of thumb. Default behavior.
        • true : Adjust height/width of thumb according to ratio of visible child.
          • Minimum height/width of thumb = slider.minThumbSize. If content is larger then a page.
          • Maximum height/width of thumb = height/width of slider.track. If content is less then a page.
      • slider.minThumbSize : Minimum height/width of thumb used in slider.adaptThumbSize mode.
      • slider.buttons : Press button to scroll content in each tick.
        • slider.buttons.top, slider.buttons.bottom : Top and bottom buttons.
        • slider.buttons.left, slider.buttons.right : Left and right buttons
        • slider.buttons.step : Scrolling step in each tick. Default value is 0.01.
      • Set to false to skip creating slider.
    • scroller : Configuration of scroller behavior.
      • scroller.threshold : Minimal movement to scroll. Set 0 to scroll immediately.
      • scroller.slidingDeceleration : Deceleration of slow down when dragging released.
        • Set false to disable it.
      • scroller.backDeceleration : Deceleration of pull back when out of bounds.
        • Set false to disable it.
      • scroller.pointerOutRelease : Set to true to release input control when pointer out of gameObject.
      • scroller.rectBoundsInteractive :
        • false : Detect scrolling by game object's touch input.
        • true : Detect scrolling by rectangle bounds of game object. Default behavior.
      • scroller.dragRate : Rate of dragging distance/dragging speed. Default value is 1.
      • Set to false to skip creating scroller.
    • mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
      • mouseWheelScroller.focus :
        • false, or 0 : Without checking if cursor is over game object or not.
        • true, or 1 : Cursor is inside the rectangle bounds of game object. Default behavior.
        • 2 : Cursor is over game object.
      • mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
      • Set to false to skip creating mouse-wheel-scroller. Default behavior.
    • clampChildOY : Set true to clamp scrolling.
    • alwaysScrollable :
      • false : Can't scroll if content is less then 1 page. Default behavior.
      • true : Can scroll in all cases
    • header : Game object of header, optional.
    • footer : Game object of footer, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.text :
        • A number: Space between text object and slider object.
        • An object: Padding of text object.
          • space.text.top, space.text.bottom : Top, bottom padding space of text object.
          • space.text.right : Space between text object and slider object.
      • space.slider :
        • 0 : No space around slider.
        • space.slider.left, space.slider.right, space.slider.top, space.slider.bottom : Space around slider.
      • space.header : Space between header and text object.
      • space.footer : Space between footer and text object.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width or height of header game object.
      • expand.footer : Set true to expand width or height of footer game object.
    • align : Align element
      • align.header
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • align.footer
    • content : Content of this text area.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-textarea/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextArea extends RexPlugins.UI.TextArea {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var textArea = new MyTextArea(scene, config);\n
    "},{"location":"ui-textarea/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    textArea.layout();\n

    See also - dirty

    "},{"location":"ui-textarea/#content","title":"Content","text":"
    • Set
      textArea.setText(text);\n
    • Append
      textArea.appendText(text);\n
    • Get
      var text = textArea.text;\n
    "},{"location":"ui-textarea/#scroll-content","title":"Scroll content","text":"
    • Scroll down lines
      textArea.scrollLine(lineCount);\n
    • Set
      textArea.childOY = oy;\n// textArea.setChildOY(oy);\n
    • Set and clamp
      textArea.setChildOY(oy, true);\n
    • Add
      textArea.addChildOY(oy);\n
    • Add and clamp
      textArea.addChildOY(oy, true);\n
    • Get
      var childOY = textArea.childOY;\n
    • Top OY
      var topOY = textArea.topChildOY;\n
    • Bottom OY
      var bottomOY = textArea.bottomChildOY;\n
    • Is overflow (height of content is larger than display height)
      var isOverflow = textArea.isOverflow;\n
    "},{"location":"ui-textarea/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      textArea.t = t;  // t: 0~1\n// textArea.setT(t);  \n
    • Set and clamp
      textArea.setT(t, true);\n
    • Get
      var t = textArea.t;\n
    "},{"location":"ui-textarea/#scroll-to-topbottom","title":"Scroll to top/bottom","text":"
    • Scroll to top
      textArea.scrollToTop();\n
      • Equal to textArea.t = 0;
    • Scroll to bottom
      textArea.scrollToBottom();\n
      • Equal to textArea.t = 1;
    "},{"location":"ui-textarea/#scroll-to-line","title":"Scroll to line","text":"
    • Scroll to next line
      textArea.scrollToNextLine();\n
    • Scroll to next n line
      textArea.scrollToNextLine(n);\n
    • Scroll to line
      textArea.scrollToLine(lineIndex);\n
    • Get current line index
      var lineIndex = textArea.lineIndex;\n
    "},{"location":"ui-textarea/#enabledisable-scrolling","title":"Enable/disable scrolling","text":"
    • Slider
      • Set enable state
        textArea.setSliderEnable(enabled);\n
        or
        textArea.sliderEnable = enabled;\n
      • Get enable state
        var enable = textArea.sliderEnable;\n
    • Scroller
      • Set enable state
        textArea.setScrollerEnable(enabled);\n
        or
        textArea.scrollerEnable = enabled;\n
      • Get enable state
        var enable = textArea.scrollerEnable;\n
    • Mouse-Wheel-Scroller
      • Set enable state
        textArea.setMouseWheelScrollerEnable(enabled);\n
        or
        textArea.mouseWheelScrollerEnable = enabled;\n
      • Get enable state
        var enable = textArea.mouseWheelScrollerEnable;\n
    "},{"location":"ui-textarea/#event","title":"Event","text":"
    • Scroll
      textArea.on('scroll', function(textArea) {\n// ...\n})\n
    • Slider
      • Slider drag start
        textArea.getElement('slider').on('inputstart', function(panel) {\n// ...\n})\n
      • Slider drag end
        textArea.getElement('slider').on('inputend', function(panel) {\n// ...\n})\n
    • Scroller
      • Scroller drag start
        textArea.getElement('scroller').on('dragstart', function(panel) {\n// ...\n})\n
      • Scroller drag end
        textArea.getElement('scroller').on('dragend', function(panel) {\n// ...\n})\n
    "},{"location":"ui-textarea/#lines-count","title":"Lines count","text":"
    var linesCount = textArea.linesCount;\n
    "},{"location":"ui-textarea/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-textarea/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = textArea.getElement('background');\n
      • Text game object
        var text = textArea.getElement('text');\n
      • Slider
        • Track
          var track = textArea.getElement('slider.track');\n
        • Thumb
          var thumb = textArea.getElement('slider.thumb');\n
      • Scroller
        var scroller = textArea.getElement('scroller');\n
    • Get by name
      var gameObject = textArea.getElement('#' + name);\n// var gameObject = textArea.getElement('#' + name, recursive);\n
      or
      var gameObject = textArea.getByName(name);\n// var gameObject = textArea.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-textareainput/","title":"Text area input","text":""},{"location":"ui-textareainput/#introduction","title":"Introduction","text":"

    A container with a canvasInput, and slider.

    • Author: Rex
    • Game object
    "},{"location":"ui-textareainput/#live-demos","title":"Live demos","text":"
    • Text-area
    "},{"location":"ui-textareainput/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-textareainput/#install-plugin","title":"Install plugin","text":""},{"location":"ui-textareainput/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add text-area-input object
      var textAreaInput = scene.rexUI.add.textAreaInput(config);\n
    "},{"location":"ui-textareainput/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-area-input object
      var textAreaInput = scene.rexUI.add.textAreaInput(config);\n
    "},{"location":"ui-textareainput/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TextAreaInput } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add text-area-input object
      var textAreaInput = new TextAreaInput(scene, config);\nscene.add.existing(textAreaInput);\n
    "},{"location":"ui-textareainput/#add-text-area-input-object","title":"Add text-area-input object","text":"
    var textAreaInput = scene.rexUI.add.textAreaInput({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundGameObject,\n\ntext: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n\n// Style when focus\n// 'focus.color': ...\n// 'focus.color2': ...\n// 'focus.stroke': ...\n},\nfocusStyle: undefined,\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0,\n\n// Style when cursor move on\n// 'cursor.color': ...\n// 'cursor.backgroundColor': ...\n// 'cursor.xxx': ...\n},\ncursorStyle: undefined,\n\nchildrenInteractive: false,\n\ntext: '',\n\nwrap: {\nlineHeight: undefined,\nuseDefaultLineHeight: true,\nmaxLines: 1,\nwrapWidth: undefined,\nletterSpacing: 0,\nhAlign: 0,\nvAlign: 'center',  // For single line text input\nwrapMode: 'char',  // For single line text input\n},\n\ntextArea: true,\n\n// Parameters of hidden-text-editor   \n// inputType: 'text',  // 'text'|'password'|'textarea'|...                \n\n// readOnly: false,\n// maxLength: undefined,\n// minLength: undefined,\n// selectAll: false,\n\n// enterClose: true,\n\n// Callbacks\n// onOpen: function (textObject, hiddenInputText) {\n// },\n\n// onClose: function (textObject, hiddenInputText) {\n// },\n\n// onUpdate: function (text, textObject, hiddenInputText) {\n//     return text;\n// },\n\n// onAddChar: function(child, index, canvasInput) {\n//    child.modifyStyle({...})\n// },\n\n// onCursorOut: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// onCursorIn: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// parseTextCallback: function(text) {\n//     return text;\n// }.        \n},\n// alwaysScrollable: false,\n\nslider: {\n// background: sliderBackgroundGameObject,\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n\n// indicator: indicatorGameObject,\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n\n// buttons: {\n//     top: topButtonGameObject, bottom: bottomButtonGameObject,\n//     left: leftButtonGameObject, right: rightButtonGameObject,\n//     step: 0.01,\n// }\n},\n\n// scroller: false,  // No scrollor support\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\nclampChildOY: false,\n\nheader: headerGameObject,\nfooter: footerGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntext: 0,\n// text: {\n//    top: 0,\n//    bottom: 0,\n//    left: 0,\n//    right: 0,\n//},\n\nslider: 0,\n// slider: {\n//     top: 0,\n//     bottom: 0,\n//     left: 0,\n//     right: 0,\n// },\n\nheader: 0,\nfooter: 0,\n},\n\nexpand: {\nheader: true,\nfooter: true,\n},\n\nalign: {\nheader: 'center',\nfooter: 'center',\n},\n\ncontent: '',\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of text area.
    • text : Configuration of CanvasInput, or a CanvasInput game object.
    • slider : Componments of slider, optional.
      • slider.background : Game object of slider background, optional.
      • slider.track : Game object of track.
      • slider.thumb : Game object of thumb.
      • slider.input :
        • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.position : Position of this slider.
        • 0, 'right', 'bottom' : Slider at right/bottom side. Default value.
        • 1, 'left', 'top' : Slider at left/top side.
      • slider.hideUnscrollableSlider :
        • false : Slider is always visible no matter it is scrollable or not. Default behavior.
        • true : Set slider to invisible if it is unscrollable.
      • slider.disableUnscrollableDrag :
        • false : Scroller is always enale no matter it is scrollable or not. Default behavior.
        • true : Set scroller to disable if it is unscrollable.
      • slider.adaptThumbSize :
        • false : Don't adjust height/width of thumb. Default behavior.
        • true : Adjust height/width of thumb according to ratio of visible child.
          • Minimum height/width of thumb = slider.minThumbSize. If content is larger then a page.
          • Maximum height/width of thumb = height/width of slider.track. If content is less then a page.
      • slider.minThumbSize : Minimum height/width of thumb used in slider.adaptThumbSize mode.
      • slider.buttons : Press button to scroll content in each tick.
        • slider.buttons.top, slider.buttons.bottom : Top and bottom buttons.
        • slider.buttons.left, slider.buttons.right : Left and right buttons
        • slider.buttons.step : Scrolling step in each tick. Default value is 0.01.
      • Set to false to skip creating slider.
    • scroller : No scroller supported (false).
    • mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
      • mouseWheelScroller.focus :
        • true : Only scrolling when cursor is over textAreaInput. Default behavior.
        • false : Scrolling without checking cursor.
      • mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
      • Set to false to skip creating mouse-wheel-scroller. Default behavior.
    • clampChildOY : Set true to clamp scrolling.
    • alwaysScrollable :
      • false : Can't scroll if content is less then 1 page. Default behavior.
      • true : Can scroll in all cases
    • header : Game object of header, optional.
    • footer : Game object of footer, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.text :
        • A number: Space between text object and slider object.
        • An object: Padding of text object.
          • space.text.top, space.text.bottom : Top, bottom padding space of text object.
          • space.text.right : Space between text object and slider object.
      • space.slider :
        • 0 : No space around slider.
        • space.slider.left, space.slider.right, space.slider.top, space.slider.bottom : Space around slider.
      • space.header : Space between header and text object.
      • space.footer : Space between footer and text object.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width or height of header game object.
      • expand.footer : Set true to expand width or height of footer game object.
    • align : Align element
      • align.header
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • align.footer
    • content : Content of this text area.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-textareainput/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextAreaInput extends RexPlugins.UI.TextAreaInput {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var textAreaInput = new MyTextAreaInput(scene, config);\n
    "},{"location":"ui-textareainput/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    textAreaInput.layout();\n

    See also - dirty

    "},{"location":"ui-textareainput/#content","title":"Content","text":"
    • Set
      textAreaInput.setText(text);\n
    • Append
      textAreaInput.appendText(text);\n
    • Get
      var text = textAreaInput.text;\n
    "},{"location":"ui-textareainput/#scroll-content","title":"Scroll content","text":"
    • Scroll down lines
      textAreaInput.scrollLine(lineCount);\n
    • Set
      textAreaInput.childOY = oy;\n// textAreaInput.setChildOY(oy);\n
    • Set and clamp
      textAreaInput.setChildOY(oy, true);\n
    • Add
      textAreaInput.addChildOY(oy);\n
    • Add and clamp
      textAreaInput.addChildOY(oy, true);\n
    • Get
      var childOY = textAreaInput.childOY;\n
    • Top OY
      var topOY = textAreaInput.topChildOY;\n
    • Bottom OY
      var bottomOY = textAreaInput.bottomChildOY;\n
    • Is overflow (height of content is larger than display height)
      var isOverflow = textAreaInput.isOverflow;\n
    "},{"location":"ui-textareainput/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      textAreaInput.t = t;  // t: 0~1\n// textAreaInput.setT(t);  \n
    • Set and clamp
      textAreaInput.setT(t, true);\n
    • Get
      var t = textAreaInput.t;\n
    "},{"location":"ui-textareainput/#scroll-to-topbottom","title":"Scroll to top/bottom","text":"
    • Scroll to top
      textAreaInput.scrollToTop();\n
      • Equal to textAreaInput.t = 0;
    • Scroll to bottom
      textAreaInput.scrollToBottom();\n
      • Equal to textAreaInput.t = 1;
    "},{"location":"ui-textareainput/#scroll-to-line","title":"Scroll to line","text":"
    • Scroll to next line
      textAreaInput.scrollToNextLine();\n
    • Scroll to next n line
      textAreaInput.scrollToNextLine(n);\n
    • Scroll to line
      textAreaInput.scrollToLine(lineIndex);\n
    • Get current line index
      var lineIndex = textAreaInput.lineIndex;\n
    "},{"location":"ui-textareainput/#enabledisable-scrolling","title":"Enable/disable scrolling","text":"
    • Slider
      • Set enable state
        textAreaInput.setSliderEnable(enabled);\n
        or
        textAreaInput.sliderEnable = enabled;\n
      • Get enable state
        var enable = textAreaInput.sliderEnable;\n
    • Scroller
      • Set enable state
        textAreaInput.setScrollerEnable(enabled);\n
        or
        textAreaInput.scrollerEnable = enabled;\n
      • Get enable state
        var enable = textAreaInput.scrollerEnable;\n
    "},{"location":"ui-textareainput/#read-only","title":"Read only","text":"
    • Enable read only
      textAreaInput.setReadOnly();\n// textAreaInput.setReadOnly(true);\n
      or
      textAreaInput.readOnly = true;\n
    • Disable read only
      textAreaInput.setReadOnly(false);\n
      or
      textAreaInput.readOnly = false;\n
    • Get read only
      var readOnlyEanble = txt.readOnly;\n
    "},{"location":"ui-textareainput/#event","title":"Event","text":"
    • On close text-editor
      textAreaInput.on('close', function(text, textAreaInput) {\n\n})\n
    • Text changed
      textAreaInput.on('textchange', function(text, textAreaInput){\n// ...\n})\n
    • Scroll
      textAreaInput.on('scroll', function(textAreaInput) {\n// ...\n})\n
    • Slider
      • Slider drag start
        textAreaInput.getElement('slider').on('inputstart', function(panel) {\n// ...\n})\n
      • Slider drag end
        textAreaInput.getElement('slider').on('inputend', function(panel) {\n// ...\n})\n
    • Scroller
      • Scroller drag start
        textAreaInput.getElement('scroller').on('dragstart', function(panel) {\n// ...\n})\n
      • Scroller drag end
        textAreaInput.getElement('scroller').on('dragend', function(panel) {\n// ...\n})\n
    "},{"location":"ui-textareainput/#lines-count","title":"Lines count","text":"
    var linesCount = textAreaInput.linesCount;\n
    "},{"location":"ui-textareainput/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-textareainput/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = textAreaInput.getElement('background');\n
      • Text game object
        var text = textAreaInput.getElement('text');\n
      • Slider
        • Track
          var track = textAreaInput.getElement('slider.track');\n
        • Thumb
          var thumb = textAreaInput.getElement('slider.thumb');\n
    • Get by name
      var gameObject = textAreaInput.getElement('#' + name);\n// var gameObject = textAreaInput.getElement('#' + name, recursive);\n
      or
      var gameObject = textAreaInput.getByName(name);\n// var gameObject = textAreaInput.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-textbox/","title":"Text box","text":""},{"location":"ui-textbox/#introduction","title":"Introduction","text":"

    A container with an icon, (typing and paging) text, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-textbox/#live-demos","title":"Live demos","text":"
    • Text box
    • Inner sizer
    • Speech bubble background
    • Bitmap text
    • Page break
    • Show last page
    "},{"location":"ui-textbox/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-textbox/#install-plugin","title":"Install plugin","text":""},{"location":"ui-textbox/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add text-box object
      var textBox = scene.rexUI.add.textBox(config);\n
    "},{"location":"ui-textbox/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-box object
      var textBox = scene.rexUI.add.textBox(config);\n
    "},{"location":"ui-textbox/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TextBox } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add text-box object
      var textBox = new TextBox(scene, config);\nscene.add.existing(textBox);\n
    "},{"location":"ui-textbox/#add-textbox-object","title":"Add textbox object","text":"
    var textBox = scene.rexUI.add.textBox({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\nrtl: false,\n\ntypingMode: 0,\n\nbackground: backgroundGameObject,\n\ninnerBackground: backgroundGameObject,\n\ntitle: titleGameObject,\n\nseparator: separatorGameObject,\n\nicon: iconGameObject,\niconMask: false,\n\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\n\naction: actionGameObject,\nactionMask: false,\n\nalign: {\ntitle: 'left',\ntext: 'left',\nicon: 'center',\naction: 'center'\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ninnerLeft: 0, innerRight: 0, innerTop: 0, innerBottom: 0,\n\ntitle: 0, titleLeft: 0, titleRight: 0,\nicon: 0, iconTop: 0, iconBottom: 0,\ntext: 0, textLeft: 0, textRight: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// page: { \n//    maxLines: undefined,\n//    pageBreak: '\\f\\n',\n// },\n// typing: { \n//    wrap: false,\n//    speed: 333,    \n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • layoutMode :
      • 0 : title, separator, and text will be layout vertically, then layout with icon, action horizontally.
      • 1 : icon, text, and action will be layout horizontally, then layout with title, separator vertically. Default behavior.
    • rtl :
      • false : Layout children (icon, text, action) from left to right. Default behavior.
      • true : Layout children (icon, text, action) from right to left.
    • typingMode :
      • 0, 'page' : Typing content page by page. Default behavior.
      • 1, 'line' : Typing content line by line until finished.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • innerBackground : Game object of background inside innerSizer, optional.
      • In mode 0, innerSizer contains title, separator, and text.
      • In mode 1, innerSizer contains icon, text, and action.
    • title : Game object of title, optional.
    • separator : Game object of separator, optional.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
    • text : Text object, bbcode text object, tag text object, or bitmap text object, required.
      • Max lines and wrapped width
        • Built-in text object : maxLines and wrap width (wordWrap.width).
        • BBcode text object : maxLines and wrap width (wrap.width).
        • Tag text object : maxLines and wrap width (wrap.width).
        • Bitmap text object : Set maxLines at page.maxLines in configuration of page behavior, and wrap width at text.setMaxWidth(width).
      • Fixed width and fixed height
        • Built-in text object : fixedWidth and fixedHeight, set to 0 to disable this feature.
        • BBcode text object : fixedWidth and fixedHeight, set to 0 to disable this feature.
        • Tag text object : fixedWidth and fixedHeight, set to 0 to disable this feature.
    • expandTextWidth :
      • true : Expand fixedWidth and wrapWidth when layout, to change width of text game object to fit this textbox.
    • expandTextHeight :
      • true : Expand fixedHeight when layout, to change height of text game object to fit this textbox.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
    • align : Alignment of title, text, icon, action game objects.
      • align.title, align.text : 'left', 'center', or 'right'. Default vale is 'left'.
      • align.icon, align.action : 'top', 'center', or 'bottom'. Default vale is 'center'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.innerLeft, space.innerRight, space.innerTop, space.innerBottom : Space parameter of inner sizer.
      • space.title : Space between title game object and separator game object.
      • space.titleLeft, space.titleRight : Space at left or right side of title game object.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom : Space around icon game object.
      • space.text : Space between text game object and action icon game object.
      • space.textLeft, space.textRight : Space at left or right side of text game object.
      • space.actionTop, space.actionBottom : Space around action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • page : Configuration of page behavior
      • page.maxLines : Max lines of a page. If not given in text game object.
      • page.pageBreak : Symbol of page-break. Default value is '\\f\\n'.
    • typing : Configuration of type behavior
      • typing.wrap :
        • false : Don't insert \\n, default behavior.
        • true : Insert \\n to wrap content according to style of text, to prevent typing jittering.
      • typing.speed : Typing speed in ms, default value is 333.
    "},{"location":"ui-textbox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextBox extends RexPlugins.UI.TextBox {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var textBox = new MyTextBox(scene, config);\n
    "},{"location":"ui-textbox/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    textBox.layout();\n

    See also - dirty

    "},{"location":"ui-textbox/#typing","title":"Typing","text":"
    • Start typing
      textBox.start(content, typingSpeed);\n
      • content : Content string.
      • speed : Typing speed in ms.
        • undefined : Use previous typing speed.
    • Append and continue typing
      textBox.more(content, typingSpeed);\n
      • content : Content string.
      • speed : Typing speed in ms.
        • undefined : Use previous typing speed.
    • Stop typing
      textBox.stop();\n
      • Will fire 'stop' event.
    • Stop typing and show all text
      textBox.stop(true);\n
      • Will fire 'stop', 'type', 'pageend' event.
    • Stop typing and show all text at last page
      textBox.showLastPage();\n
      • Will fire 'type', 'pageend', 'complete' events.
    • Pause typing
      textBox.pause();\n
      • Will fire 'pause' event.
    • Resume typing
      textBox.resume();\n
      • Will fire 'resume' event.
    • Is typing
      var isTyping = textBox.isTyping;\n
    "},{"location":"ui-textbox/#typing-speed","title":"Typing speed","text":"
    • Change typing speed
      textBox.setTypingSpeed(speed);\n
      • speed : Typing speed in ms.
    • Get typing speed
      var speed = textBox.typingSpeed;\n
    "},{"location":"ui-textbox/#page","title":"Page","text":"
    • Type next page
      textBox.typeNextPage();\n
    • Is page end, after typing complete
      var isPageEnd = textBox.isPageEnd;\n
    • Is last page
      var isLastPage = textBox.isLastPage;\n
    • Is first page
      var isFirstPage = textBox.isFirstPage;\n
    • Current page index
      var pageIndex = textBox.pageIndex;\n
    • Number of pages
      var pageIndex = textBox.pageCount;\n
    "},{"location":"ui-textbox/#icon-texture","title":"Icon texture","text":"
    • Set texture
      textBox.setTexture(key);\n// label.setTexture(key, frame);\n
    • Get texture key, frame name
      var textureKey = textBox.texture.key;\nvar frameName = textBox.frame.name;\n
    "},{"location":"ui-textbox/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = textBox.getElement('background');\n
      • InnerSizer
        var innerSizer = textBox.getElement('innerSizer');\n
        • In mode 0, innerSizer contains title, separator, and text.
        • In mode 1, innerSizer contains icon, text, and action.
      • Background game object inside innerSizer
        var innerBackground = textBox.getElement('innerBackground');\n
      • Title game object
        var textObject = textBox.getElement('title');\n
      • Separator game object
        var textObject = textBox.getElement('separator');\n
      • Icon game object
        var icon = textBox.getElement('icon');\n
      • Text game object
        var textObject = textBox.getElement('text');\n
      • Action icon game object
        var action = textBox.getElement('action');\n
    • Get by name
      var gameObject = textBox.getElement('#' + name);\n// var gameObject = textBox.getElement('#' + name, recursive);\n
      or
      var gameObject = textBox.getByName(name);\n// var gameObject = textBox.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-textbox/#events","title":"Events","text":"
    • On typing start.
      textBox.on('start', function() {\n// ...\n}, scope);\n
    • On changing content of text game object, will also re-layout textbox :
      textBox.on('type', function() {\n// ...\n}, scope);\n
    • On typing a character :
      textBox.on('typechar', function(char) {\n// ...\n}, scope);\n
    • On Typing the last character of current page.
      textBox.on('pageend', function() {\nif (textBox.isLastPage) {\n// ...            \n}\n}, scope);\n
    • On typing all pages complete, equal to 'pageend' event with textBox.isLastPage.
      textBox.on('complete', function() {\n// ...\n}, scope);\n
    • On typing paused by textBox.pause().
      textBox.on('pause', function() {\n// ...\n}, scope);\n
    • On typing resume by textBox.resume().
      textBox.on('resume', function() {\n// ...\n}, scope);\n
    • On typing stop by textBox.stop().
      textBox.on('stop', function() {\n// ...\n}, scope);\n
    "},{"location":"ui-textbox/#other-properties","title":"Other properties","text":"

    See title label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-titlelabel/","title":"Title label","text":""},{"location":"ui-titlelabel/#introduction","title":"Introduction","text":"

    A container with title, text in two rows, and an icon, background.

    • Author: Rex
    • Game object
    "},{"location":"ui-titlelabel/#live-demos","title":"Live demos","text":"
    • Title-label
    • Layout modes
    "},{"location":"ui-titlelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-titlelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-titlelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.titleLabel(config);\n
    "},{"location":"ui-titlelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.titleLabel(config);\n
    "},{"location":"ui-titlelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TitleLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new TitleLabel(scene, config);\nscene.add.existing(label);\n
    "},{"location":"ui-titlelabel/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.titleLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\n// rtl: false,\n\nbackground: backgroundGameObject,\n\ninnerBackground: backgroundGameObject,\n\ntitle: titleGameObject,\n// wrapTitle: false,\n// adjustTitleFontSize: false,\n// expandTitleWidth: false,\n// expandTitleHeight: false,\n\nseparator: separatorGameObject,\n\nicon: iconGameObject,\niconMask: false,\n\ntext: textGameObject,\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\naction: actionGameObject,\nactionMask: false,\n\nalign: {\ntitle: 'left',\ntext: 'left',\nicon: 'center',\naction: 'center'\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ninnerLeft: 0, innerRight: 0, innerTop: 0, innerBottom: 0,\n\ntitle: 0, titleLeft: 0, titleRight: 0,\nicon: 0, iconTop: 0, iconBottom: 0,\ntext: 0, textLeft: 0, textRight: 0,\nseparator: 0, separatorLeft: 0, separatorRight: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • layoutMode :
      • 0 : title, separator, and text will be layout vertically, then layout with icon, action horizontally.
      • 1 : icon, text, and action will be layout horizontally, then layout with title, separator vertically.
    • rtl :
      • false : Layout children (icon, text, action) from left to right. Default behavior.
      • true : Layout children (icon, text, action) from right to left.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • innerBackground : Game object of background inside innerSizer, optional.
      • In mode 0, innerSizer contains title, separator, and text.
      • In mode 1, innerSizer contains icon, text, and action.
    • title : Game object of title, optional.
    • wrapTitle : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
      • 2, 'char' : Character WrapExpandText.
    • adjustTitleFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapTitle: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.
    • expandTitleWidth :
      • false : Keep width of title to original size. Default behavior.
      • true : Expand width of title object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
        • Can't work with squareFitIcon: true.
    • expandTitleHeight : Set true to expand height of title object.
    • separator : Game object of separator, optional.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • text : Game object of text.
    • wrapText : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
      • 2, 'char' : Character WrapExpandText.
    • adjustTextFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapText: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.- expandTextWidth :
      • false : Keep width of text to original size. Default behavior.
      • true : Expand width of text object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
        • Can't work with squareFitIcon: true.
    • expandTextHeight : Set true to expand height of text object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • align : Alignment of title, text, icon, action game objects.
      • align.title, align.text : 'left', 'center', or 'right'. Default vale is 'left'.
      • align.icon, align.action : 'top', 'center', or 'bottom'. Default vale is 'center'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.innerLeft, space.innerRight, space.innerTop, space.innerBottom : Space parameter of inner sizer.
      • space.title : Space between title game object and separator game object.
      • space.titleLeft, space.titleRight : Space at left or right side of title game object.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom : Space around icon game object.
      • space.text : Space between text game object and action icon game object.
      • space.textLeft, space.textRight : Space at left or right side of text game object.
      • space.actionTop, space.actionBottom : Space around action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-titlelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTitleLabel extends RexPlugins.UI.TitleLabel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyTitleLabel(scene, config);\n
    "},{"location":"ui-titlelabel/#layout-modes","title":"Layout modes","text":""},{"location":"ui-titlelabel/#mode-0","title":"Mode 0","text":"

    title, separator, and text will be layout vertically inside innerSizer, then layout with icon, action horizontally.

    Icon Title Action Separator Text"},{"location":"ui-titlelabel/#mode-1","title":"Mode 1","text":"

    icon, text, and action will be layout horizontally inside innerSizer, then layout with title, separator vertically.

    Title Separator Icon Text Action"},{"location":"ui-titlelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-titlelabel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = label.getElement('background');\n
      • InnerSizer
        var innerSizer = label.getElement('innerSizer');\n
        • In mode 0, innerSizer contains title, separator, and text.
        • In mode 1, innerSizer contains icon, text, and action.
      • Background game object inside innerSizer
        var innerBackground = label.getElement('innerBackground');\n
      • Title game object
        var textObject = label.getElement('title');\n
      • Separator game object
        var textObject = label.getElement('separator');\n
      • Icon game object
        var icon = label.getElement('icon');\n
      • Text game object
        var textObject = label.getElement('text');\n
      • Action icon game object
        var action = label.getElement('action');\n
    • Get by name
      var gameObject = label.getElement('#' + name);\n// var gameObject = label.getElement('#' + name, recursive);\n
      or
      var gameObject = label.getByName(name);\n// var gameObject = label.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-titlelabel/#title","title":"Title","text":"
    • Get title string
      var s = label.title;\n
    • Set title string
      label.setTitle(s);\n
      or
      label.title = s;\n
    "},{"location":"ui-titlelabel/#text","title":"Text","text":"
    • Get text string
      var s = label.text;\n
    • Set text string
      label.setText(s);\n
      or
      label.text = s;\n
    "},{"location":"ui-titlelabel/#icon-texture","title":"Icon texture","text":"
    • Set texture
      label.setTexture(key);\n// label.setTexture(key, frame);\n
    • Set texture via texture object
      label.setTexture(texture);\n// label.setTexture(texture, frame);\n
    • Get texture, frame.
      var texture = label.texture;\nvar frame = label.frame;\n
    • Get texture key, frame name.
      var textureKey = label.texture.key;\nvar frameName = label.frame.name;\n
    "},{"location":"ui-titlelabel/#reset-display-content","title":"Reset display content","text":"
    label.resetDisplayContent({\ntitle: '',\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n})\n

    or

    label.resetDisplayContent(text);\n
    • title : Set title's text string.
    • text : Set text string.
    • icon, iconFrame
      • A string : Set texture of icon game object.
      • undefined, or null : Hide icon game object.
      • true : Show icon game object without change its texture.
    • iconSize : Set display size of icon game object.
    • action, actionFrame
      • A string : Set texture of icon game object.
      • undefined, or null : Hide action game object.
      • true : Show action game object without change its texture.
    • actionSize : Set display size of action game object.

    Run label.layout() after this method, to layout children again.

    "},{"location":"ui-titlelabel/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-toast/","title":"Toast","text":""},{"location":"ui-toast/#introduction","title":"Introduction","text":"

    Show text message for a short while.

    • Author: Rex
    • Game object
    "},{"location":"ui-toast/#live-demos","title":"Live demos","text":"
    • Toast
    • Depth
      • Set depth
      • Bring to top
      • Add to layer
    "},{"location":"ui-toast/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-toast/#install-plugin","title":"Install plugin","text":""},{"location":"ui-toast/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add toast object
      var toast = scene.rexUI.add.toast(config);\n
    "},{"location":"ui-toast/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add toast object
      var toast = scene.rexUI.add.toast(config);\n
    "},{"location":"ui-toast/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Toast } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add toast object
      var toast = new Toast(scene, config);\nscene.add.existing(toast);\n
    "},{"location":"ui-toast/#add-toast-object","title":"Add toast object","text":"
    var toast = scene.rexUI.add.toast({\nx: 0,\ny: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\ntext: textGameObject,\naction: actionGameObject,\nactionMask: false,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\ntext: 0,\n},\n\nduration: {\nin: 200,\nhold: 1200,\nout: 200,\n},\n\n// transitIn: 0,\n// transitOut: 0,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • background : Game object of background, optional. This background game object will be resized to fit the size of toast.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
    • text : Game object of text.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds
      • space.icon : Space between icon game object and text game object.
      • space.text : Space between text game object and action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • duration : Duration of displaying message
      • duration.in : Duration of transit-in stage.
      • duration.hold : Duration of hold stage.
      • duration.out : Duration of transit-out stage.
    • transitIn : Transit-in action.
      • 0, or 'popUp' : Pop-up.
      • 1, or 'fadeIn' : Fade-in.
      • A callback : Custom transit-in function
        function(toast, duration) {\n// ...\n}\n
      • false, null : No transitIn.
    • transitOut : Transit-out action.
      • 0, or 'scaleDown' : Scale-down.
      • 1, or 'fadeOut' : Fade-out.
      • A callback : Custom transit-out function
        function(toast, duration) {\n// ...\n}\n
      • false, null : No transitOut.

    Toast object will be invisible at beginning.

    "},{"location":"ui-toast/#custom-class","title":"Custom class","text":"
    • Define class
      class MyToast extends RexPlugins.UI.Toast {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var toast = new MyToast(scene, config);\n
    "},{"location":"ui-toast/#show-message","title":"Show message","text":"
    toast.showMessage(message);\n
    • message : A string, or a callback.
      • A string. Apply this content to text game object.
      • Callback. Invoke this callback to configurate toast object.
        function(toast) {\n// var icon = toast.getElement('icon');\n// var text = toast.getElement('text');\n// var action = toast.getElement('action');\n}\n

    Toast displays message follows these steps : transit-in, hold, transit-out. New message will be pending until toast is back to idle.

    "},{"location":"ui-toast/#clear-messages","title":"Clear messages","text":"
    toast.removeAllMessages();\n
    "},{"location":"ui-toast/#is-showing-message","title":"Is showing message","text":"
    var isShowing = toast.isShowingMessage;\n
    "},{"location":"ui-toast/#display-time","title":"Display time","text":"
    • Transit-in time (duration.in)
      • Get
        var time = toast.transitInTime;\n
      • Set
        toast.setTransitInTime(time);\n
    • Display time (duration.hold)
      • Get
        var time = toast.displayTime;\n
      • Set
        toast.setDisplayTime(time);\n
    • Transit-out time (duration.out)
      • Get
        var time = toast.transitOutTime;\n
      • Set
        toast.setTransitOutTime(time);\n
    "},{"location":"ui-toast/#transit-action","title":"Transit action","text":"
    • Set transit-in action
      toast.setTransitInCallback(callback);\n
      • callback : Transit-in action
        • 0, or 'popUp' : Pop-up.
        • 1, or 'fadeIn' : Fade-in.
        • A callback : Custom transit-in function
          function(toast, duration) {\n// ...\n}\n
    • Set transit-out action
      toast.setTransitOutCallback(callback);\n
      • callback : Transit-out action
        • 0, or 'scaleDown' : Scale-down.
        • 1, or 'fadeOut' : Fade-out.
        • A callback : Custom transit-out function
          function(toast, duration) {\n// ...\n}\n
    "},{"location":"ui-toast/#event","title":"Event","text":"
    • Transit-in
      toast.on('transitin', function(toast, transitInTime) {\n// ...\n})\n
    • Transit-out
      toast.on('transitout', function(toast, transitOutTime) {\n// ...\n})\n
    "},{"location":"ui-toast/#other-properties","title":"Other properties","text":"

    See label object, sizer object, base sizer object, container-lite.

    "},{"location":"ui-toastqueue/","title":"Toast queue","text":""},{"location":"ui-toastqueue/#introduction","title":"Introduction","text":"

    Queue messages for a short while.

    • Author: Rex
    • Game object
    "},{"location":"ui-toastqueue/#live-demos","title":"Live demos","text":"
    • Toast queue
    "},{"location":"ui-toastqueue/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-toastqueue/#install-plugin","title":"Install plugin","text":""},{"location":"ui-toastqueue/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add toast-queue object
      var toastQueue = scene.rexUI.add.toastQueue(config);\n
    "},{"location":"ui-toastqueue/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add toast-queue object
      var toastQueue = scene.rexUI.add.toastQueue(config);\n
    "},{"location":"ui-toastqueue/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ToastQueue } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add toast-queue object
      var toastQueue = new ToastQueue(scene, config);\nscene.add.existing(toastQueue);\n
    "},{"location":"ui-toastqueue/#add-toast-queue-object","title":"Add toast-queue object","text":"
    var toastQueue = scene.rexUI.add.toastQueue({\nx: 0,\ny: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 1,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nitem: 0,\n},\n\ncreateMessageLabelCallback(scene, message, toastQueue) {\n// return gameObject;\n},\n\nqueueDirection: 1, // 'bottom-to-top', or 'top-to-bottom'\n\nduration: {\nin: 200,\nhold: 2000,\nout: 200,\n},\n\n// transitIn: undefined,\n// transitOut: undefined,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between 2 children game objects.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • createMessageLabelCallback : Callback for creating message label game object
      function(scene, message, toastQueue) {\n// \nreturn gameObject;\n}\n
      • message : message parameter passing from showMessage method.
      • toastQueue : This toast-queue game object.
    • queueDirection : Direction of message queue
      • 1, or 'bottom-to-top' : Message queue from bottom to top. Default value.
      • 0, or 'top-to-bottom' : Message queue from top to bottom.
    • duration : Duration of displaying message
      • duration.in : Duration of transit-in stage.
      • duration.hold : Duration of hold stage.
      • duration.out : Duration of transit-out stage.
    • transitIn : Transit-in action.
      • undefined (not gived) : Pop up message label.
      • A callback : Custom transit-in function
        function(messageLabel, duration, toastQueue) {\n// ...\n}\n
      • false, null : No transitOut.
    • transitOut : Transit-out action.
      • undefined (not gived) : Fade out message label.
      • A callback : Custom transit-out function
        function(messageLabel, duration, toastQueue) {\n// ...\n}\n
      • false, null : No transitOut.

    Message Label will be destroyed when

    • Clicking, or
    • Timeout
    "},{"location":"ui-toastqueue/#custom-class","title":"Custom class","text":"
    • Define class
      class MyToastQueue extends RexPlugins.UI.ToastQueue {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var toastQueue = new MyToastQueue(scene, config);\n
    "},{"location":"ui-toastqueue/#show-message","title":"Show message","text":"
    toastQueue.showMessage(message);\n
    • message : A string, or an object. Will pass to createMessageLabelCallback callback.
    "},{"location":"ui-toastqueue/#clear-messages","title":"Clear messages","text":"
    toastQueuetoast.removeAllMessages();\n

    Invoke transition-out of all message labels.

    "},{"location":"ui-toastqueue/#display-time","title":"Display time","text":"
    • Transit-in time (duration.in)
      • Get
        var time = toastQueue.transitInTime;\n
      • Set
        toastQueue.setTransitInTime(time);\n
    • Display time (duration.hold)
      • Get
        var time = toastQueue.displayTime;\n
      • Set
        toastQueue.setDisplayTime(time);\n
    • Transit-out time (duration.out)
      • Get
        var time = toastQueue.transitOutTime;\n
      • Set
        toastQueue.setTransitOutTime(time);\n
    "},{"location":"ui-toastqueue/#transit-action","title":"Transit action","text":"
    • Set transit-in action
      toastQueue.setTransitInCallback(callback);\n
      • callback : Transit-in action
        function(messageLabel, duration, toastQueue) {\n// ...\n}\n
    • Set transit-out action
      toastQueue.setTransitOutCallback(callback);\n
      • callback : Transit-out action
        function(messageLabel, duration, toastQueue) {\n// ...\n}\n
    "},{"location":"ui-toastqueue/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-trees/","title":"Trees","text":""},{"location":"ui-trees/#introduction","title":"Introduction","text":"

    A container with trees and leaf-nodes.

    • Author: Rex
    • Game object
    "},{"location":"ui-trees/#live-demos","title":"Live demos","text":"
    • Tree
    • Display json
    "},{"location":"ui-trees/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-trees/#install-plugin","title":"Install plugin","text":""},{"location":"ui-trees/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add trees object
      var trees = scene.rexUI.add.trees(config);\n
    "},{"location":"ui-trees/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add trees object
      var trees = scene.rexUI.add.trees(config);\n
    "},{"location":"ui-trees/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Trees } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add trees object
      var trees = new Trees(scene, config);\nscene.add.existing(trees);\n
    "},{"location":"ui-trees/#add-instance","title":"Add instance","text":"

    Trees contains tree-node instance, each tree contains tree instance and node instance.

    "},{"location":"ui-trees/#add-trees-object","title":"Add trees object","text":"
    var trees = scene.rexUI.add.trees({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\ntree: {\n// background: function(scene {isLeaf}) { return gameObject; },\n// background: backgroundStyle,\n\n// toggleButton: function(scene, {isLeaf}) {\n//     gameObject\n//         .on('expand.start', function (gameObject) {\n//          })\n//          .on('collapse.start', function (gameObject) {\n//          })\n//     return gameObject;\n// }\n// toggleButton : triangleStyle,\n\n// nodeBackground: function(scene {isLeaf}) { return gameObject; },\n// nodeBackground: backgroundStyle,\n\n// nodeBody: function(scene {isLeaf}) { return gameObject; },\n// nodeBody: simpleLabelStyle,\n\n// transition: {\n//     duration: 200,\n//     expandCallback: undefined,\n//     collapseCallback: undefined,\n// },\n\n// orientation: 'y',\n\n//space: {\n//    indent: 0,\n//    indentLeft: 0, indentRight: 0, indentTop: 0, indentBottom: 0,\n//\n//    nodeLeft: 0, nodeRight: 0, nodeTop: 0, nodeBottom: 0,\n//    toggleButton: 0,\n//},\n\n// align: {\n//     title: 'left',\n//     child: 'left',\n// },\n\n// expand: {\n//     title: true,\n//     child: true,\n// },\n\n// expanded: true,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this trees. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between 2 children game objects.
    • tree : Default configuration of node, optional.
      • tree.background :
        • Callback
          function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
          • isLeaf :
            • false : This node is a tree-node.
            • true : This node is a leaf-node.
        • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
        • undefined : Don't create any game object.
      • tree.toggleButton
        • Callback
          function(scene, {isLeaf}) {\ngameObject\n.on('expand.start', function (gameObject) {\n})\n.on('collapse.start', function (gameObject) {\n})\nreturn gameObject;\n}\n
          • isLeaf :
            • false : This node is a tree-node.
            • true : This node is a leaf-node.
          • Events 'expand.start' and 'collapse.start' will be fired when expanding or collapsing child nodes of this tree.
        • Style of triangle, default behavior.
          {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n
      • tree.nodeBackground
        • Callback
          function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
          • isLeaf :
            • false : This node is a tree-node.
            • true : This node is a leaf-node.
        • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
        • undefined : Don't create any game object.
      • tree.nodeBody
        • Callback
          function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
          • isLeaf :
            • false : This node is a tree-node.
            • true : This node is a leaf-node.
        • Style of simple label : Create Simple-label as node body element. Default behavior.
      • tree.transition : Configuration of expanding/collapsing transition.
        • tree.transition.duration : Duration of expanding/collapsing transition.
        • tree.transition.expandCallback : Callback invoked when expading child. Default behavior is scale-up.
        • tree.transition.collapseCallback : Callback invoked when collapsing child. Default behavior is scale-down.
      • tree.space : Pads spaces of tree.
        • tree.space.indent, tree.space.indentLeft, tree.space.indentRight, tree.space.indentTop, tree.space.indentBottom : Space of node's bounds.
        • tree.space.nodeLeft, tree.space.nodeRight, tree.space.nodeTop, tree.space.nodeBottom : Space of node child's bounds.
        • tree.space.toggleButton : Space between toggle button and next child.
      • tree.align.title, tree.align.child : Alignment of title, child game objects.
        • undefined, or 'left', or 'top' : Align game objects at left, or top. Default behavior.
        • 'center' : Align game objects at center.
        • 'right', or 'bottom' : Align game objects at right, or bottom.
      • tree.expand.title, tree.expand.child : Expand width/height of title, child game objects.
        • true : Expand width/heigh. Default behavior.
        • false : Use origin width/height.
      • tree.expanded :
        • true : Expand this tree node. Default behavior.
        • false : Collapse this tree node.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire trees events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-trees/#add-tree-object","title":"Add tree object","text":"

    var tree = trees.addTree();\n// var tree = trees.addTree(nodeKey);\n
    var subTree = tree.addTree();\n// var subTree = tree.addTree(nodeKey);\n

    or

    var tree = trees.addTree({\n// nodeKey: UUID()\n\n// background: backgroundGameObject,\n// background: function(scene {isLeaf}) { return gameObject; },\n// background: backgroundStyle,\n\ntoggleButton: toggleButtonGameObject,\n// toggleButton: function(scene {isLeaf}) { \n//      gameObject\n//          .on('expand.start', function (gameObject) {\n//           })\n//           .on('collapse.start', function (gameObject) {\n//           })\n//     return gameObject; \n// },\n// toggleButton : triangleStyle,\n\n// nodeBackground: nodeBackgroundGameObject,\n// nodeBackground: function(scene {isLeaf}) { return gameObject; },\n// nodeBackground: backgroundStyle,\n\nnodeBody: nodeBodyGameObject,\n// nodeBody: function(scene {isLeaf}) { return gameObject; },\n// nodeBody: simpleLabelStyle,\n\n// transition: {\n//     duration: 200,\n//     expandCallback: undefined,\n//     collapseCallback: undefined,\n// },\n\n// orientation: 'y',\n\n// space: {\n//     indent: 0,\n//     indentLeft: 0, indentRight: 0, indentTop: 0, indentBottom: 0,\n// \n//     nodeLeft: 0, nodeRight: 0, nodeTop: 0, nodeBottom: 0,\n//     toggleButton: 0,\n// },\n\n// align: {\n//     title: 'left',\n//     child: 'left',\n// },\n\n// expand: {\n//     title: true,\n//     child: true,\n// },\n\n// expanded: true,\n})\n
    var subTree = tree.addTree(config);\n

    • nodeKey : Store reference of this tree instance by this unique string. Get tree back by trees.getTree(nodeKey)
      • An unique string, does not contain .
      • undefined : Create unique string by UUID
    • background :
      • A game object
      • Callback
        function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
        • isLeaf :
          • false : This node is a tree-node.
          • true : This node is a leaf-node.
      • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
      • undefined : Don't create any game object.
    • toggleButton
      • A game object
      • Callback
        function(scene, {isLeaf}) {\ngameObject\n.on('expand.start', function (gameObject) {\n})\n.on('collapse.start', function (gameObject) {\n})\nreturn gameObject;\n}\n
        • isLeaf :
          • false : This node is a tree-node.
          • true : This node is a leaf-node.
        • Events 'expand.start' and 'collapse.start' will be fired when expanding or collapsing child nodes of this tree.
      • Style of triangle, default behavior.
        {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n
    • nodeBackground
      • A game object
      • Callback
        function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
        • isLeaf :
          • false : This node is a tree-node.
          • true : This node is a leaf-node.
      • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
      • undefined : Don't create any game object.
    • nodeBody
      • A game object
      • Callback
        function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
        • isLeaf :
          • false : This node is a tree-node.
          • true : This node is a leaf-node.
      • Style of simple label : Create Simple-label as node body element. Default behavior.
    "},{"location":"ui-trees/#add-node-object","title":"Add node object","text":"
    • Add default node game object
      var node = tree.addNode();\n// var node = tree.addNode(nodeKey);\n
      • nodeKey : Store reference of this tree instance by this unique string. Get tree back by trees.getTree(nodeKey)
        • An unique string, does not contain .
        • undefined : Create unique string by UUID
    • Add custom node game object
      var node = tree.addNode(gameObject);\n// var node = tree.addNode(gameObject, nodeKey);\n
    "},{"location":"ui-trees/#insert-tree-object","title":"Insert tree object","text":"

    var tree = trees.insertTree(index);\n// var tree = trees.insertTree(index, nodeKey);\n// var tree = trees.insertTree(index, config);\n
    var subTree = tree.insertTree(index);\n// var subTree = tree.insertTree(index, nodeKey);\n// var subTree = tree.insertTree(index, config);\n

    "},{"location":"ui-trees/#insert-node-object","title":"Insert node object","text":"
    • Insert default node game object
      var node = tree.insertTree(index);\n// var node = tree.insertTree(index, nodeKey);\n
    • Insert custom node game object
      var node = tree.insertTree(index, gameObject);\n// var node = tree.insertTree(index, gameObject, nodeKey);\n
    "},{"location":"ui-trees/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTrees extends RexPlugins.UI.Trees {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var trees = new MyTrees(scene, config);\n
    "},{"location":"ui-trees/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    trees.layout();\n

    See also - dirty

    Note

    Layout topmost trees when expanding/collapsing start.

    "},{"location":"ui-trees/#expandcollapse-tree","title":"Expand/collapse tree","text":"
    • Expand, will re-layout from topmost trees
      tree.expand();\n// tree.expand(duration);\n
      tree.expand(0);  // Immediately, won't invoke expandCallback\n
    • Collapse, will re-layout from topmost trees
      tree.collapse();\n// tree.collapse(duration);\n
      tree.collapse(0);  // Immediately, won't invoke collapseCallback\n
    • Toggle, will re-layout from topmost trees
      tree.toggle();\n// tree.toggle(duration);\n
      tree.toggle(0);  // Immediately, won't invoke expandCallback/collapseCallback\n
    • Set expanded state without re-layouting
      tree.setExpandedState(expanded);  // true, or false\n
    • Get expanded state
      var expanded = tree.expanded;\n
      • expanded : Initial value is undefined
    "},{"location":"ui-trees/#remove-tree-or-node","title":"Remove tree or node","text":""},{"location":"ui-trees/#remove-tree","title":"Remove tree","text":"
    • Remove tree without destroying
      trees.removeTree(tree);\n
      tree.removeTree(subTree);\n
      tree.removeTree(nodeKey);\n
    • Remove tree and destroying
      trees.removeTree(tree, true);\n
      tree.removeTree(subTree, true);\n
      tree.removeTree(nodeKey, true);\n
    • Remove all trees without destroying
      trees.removeAllNodes();\n
      tree.removeAllNodes();\n
    • Remove all trees and destroying
      trees.removeAllNodes(tree);\n
      tree.removeAllNodes(tree);\n
    "},{"location":"ui-trees/#remove-subtree-or-node","title":"Remove subTree or node","text":"
    • Remove subTree or node without destroying
      tree.removeNode(subTree);\n
      tree.removeNode(node);\n
      tree.removeNode(nodeKey);\n
    • Remove subTree or node and destroying
      trees.removeNode(subTree, true);\n
      tree.removeNode(node, true);\n
      tree.removeNode(nodeKey, true);\n
    • Remove all sub-trees and nodes without destroying
      tree.removeAllNodes();\n
    • Remove all sub-trees and nodes and destroying
      tree.removeAllNodes(tree);\n
    "},{"location":"ui-trees/#get-sub-tree-or-node","title":"Get sub-tree or node","text":"
    • Get sub-tree
      var tree = trees.getTree(nodeKey);\n
      var tree = subTree.getTree(nodeKey);\n
    • Get sub-tree/node
      var tree = trees.getNode(nodeKeys);\n
      var tree = subTree.getNode(nodeKeys);\n
      • nodeKeys : nodeKeys connected by ., e.x. key0.key1.key2...
    • Get all child nodes in this tree
      var nodes = tree.getNodes();\n// var nodes = tree.getNodes(out);\n
    • Get all child nodes including all descendant nodes
      var nodes = tree.getAllNodes();\n// var nodes = tree.getAllNodes(out);\n
    "},{"location":"ui-trees/#get-parent-or-root-tree","title":"Get parent or root tree","text":"
    • Get parent (tree)
      var patent = tree.getTreePatent();\n
      var patent = node.getTreePatent();\n
    • Get root (tree)
      var root = tree.getTreeRoot();\n
      var root = node.getTreeRoot();\n
    "},{"location":"ui-trees/#get-element","title":"Get element","text":"
    • Get element in a tree
      • Background game object
        var background = tree.getElement('background');\n
      • Toggle button game object
        var toggleButton = trees.getElement('toggleButton');\n
      • Node-body game object
        var nodeBody = trees.getElement('nodeBody');\n
      • Children-node list game objects
        var childrenNodes = trees.getElement('childrenNodes');\n
    • Get by name
      var gameObject = trees.getElement('#' + name);\n// var gameObject = trees.getElement('#' + name, recursive);\n
      or
      var gameObject = trees.getByName(name);\n// var gameObject = trees.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-trees/#other-properties","title":"Other properties","text":"

    Trees is extended from trees object, base trees object, container-lite. Tree is extended from folder.

    "},{"location":"ui-trees/#set-children-interactive","title":"Set children interactive","text":"

    Applies click, tap, press, swipe behaviors on this trees, to detect input events of children.

    tree.setChildrenInteractive({\n// dropZone: false,\n\n// click: {mode: 'release', clickInterval: 100},\n\n// over: undefined,\n\n// press: {time: 251, threshold: 9},\n\n// tap: {time: 250, tapInterval: 200, threshold: 9, tapOffset: 10, \n//       taps: undefined, minTaps: undefined, maxTaps: undefined,},\n\n// swipe: {threshold: 10, velocityThreshold: 1000, dir: '8dir'},\n\n// inputEventPrefix: 'child.',\n})\n
    • dropZone :
      • true : Enable drop Zone on scrollable area.
      • false : Do nothing.
    "},{"location":"ui-trees/#events","title":"Events","text":"
    • Pointer-down
      trees.on('child.down', function(child, pointer, event) {        }, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Pointer-up
      trees.on('child.up', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Pointer-over
      trees.on('child.over', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Pointer-out
      trees.on('child.out', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Click
      trees.on('child.click', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
      • pointer : Pointer object.
    • Press
      trees.on('child.pressstart', function(child, pointer, press) { // ...\n}, scope);\n
      trees.on('child.pressend', function(child, pointer, press) { // ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Tap
      trees.on(tapEventName, function(child, pointer, tap) { // ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
      • tapEventName : 'child.tap', 'child.1tap', 'child.2tap', 'child.3tap', etc ...
      • tap : Tap object.
        • tap.tapsCount : Taps count.
    • Swipe
      trees.on(swipeEventName, function(child, pointer, swipe) { // ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
      • swipeEventName : 'child.swipe', 'child.swipeleft', 'child.swiperight', 'child.swipeup', 'child.swipedown'.
      • swipe : Swipe object.
        • swipe.left, swipe.right, swipe.up, swipe.down : Swipe direction states.
    "},{"location":"ui-trees/#events_1","title":"Events","text":"
    • On tree expand-start
      trees.on('expand.start', function(tree){\n\n})\n
    • On tree expand-complete
      trees.on('expand.complete', function(tree){\n\n})\n
    • On tree collapse-start
      trees.on('collapse.start', function(tree){\n\n})\n
    • On tree collapse-complete
      trees.on('collapse.complete', function(tree){\n\n})\n
    "},{"location":"ui-tweaker/","title":"Tweaker","text":""},{"location":"ui-tweaker/#introduction","title":"Introduction","text":"

    Fine-tuning properties of target object. Reference

    • Author: Rex
    • Game object
    "},{"location":"ui-tweaker/#live-demos","title":"Live demos","text":"
    • Tweaker
    • Bind target
    • Horizontal tweaker
    • Columns
    • Wrap
    • Buttons
    • Add rows
    • Edit item
    "},{"location":"ui-tweaker/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-tweaker/#install-plugin","title":"Install plugin","text":""},{"location":"ui-tweaker/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add tweaker object
      var tweaker = scene.rexUI.add.tweaker(config);\n
    "},{"location":"ui-tweaker/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tweaker object
      var tweaker = scene.rexUI.add.tweaker(config);\n
    "},{"location":"ui-tweaker/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Tweaker } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add tweaker object
      var tweaker = new Tweaker(scene, config);\nscene.add.existing(tweaker);\n
    "},{"location":"ui-tweaker/#add-tweaker-object","title":"Add tweaker object","text":"
    var tweaker = scene.rexUI.add.tweaker({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// orientation: 0,\n\n// style: { ... }\nstyles : {\nitemWidth : 0,\nitemHeight: 0,\n\ninputRow: {\nbackground: {\n\n},\n\ntitle: {\n\n},\n\ninputText: {\n\n},\n\ninputTextArea: {\nheight:\n},\n\nlist: {\nlabel: {\n\n},\n\nbutton: {\n\n}\n},\n\nbutton: {\n\n},\n\nslider: {\ntrack: {\n\n},\n\nindicator: {\n\n},\n\nthumb: {\n\n}\n},\n\ncolorInput: {\ncolorPicker: {\n\n},\n\ncolorComponents: {\ninputText: {\n\n}\n}\n},\n\ncheckbox: {\n\n},\n\ntoggleSwitch: {\n\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n}\n},\n\nseparator: {\n\n},\n\nfolder: {\n},\n\ntab: {\n},\n\nscrollable: {\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0, item: 0\n},\n},\n\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Main orientation of the tweaker.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom. Default value is 1.
    • styles, or style : Styles settings of input rows, separator, folder, tab, and scrollable. See Styles chapter for more detail.
      • style.itemWidth : Width of input row, used if orientation is set to 'y'(1).
      • styles.space : Pads spaces.
        • styles.space.left, styles.space.right, styles.space.top, styles.space.bottom : Space of bounds.
        • styles.space.item : Space between 2 input rows.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-tweaker/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTweaker extends RexPlugins.UI.Tweaker {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var tweaker = new MyTweaker(scene, config);\n
    "},{"location":"ui-tweaker/#add-input-row","title":"Add input row","text":"

    An input row can fine-tuning properties of target object.

    "},{"location":"ui-tweaker/#text-input-row","title":"Text input row","text":"

    object[key] is a text value.

    tweaker.addInput(object, key, {    // view: 'string',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n\n// autoUpdate: true,\n// onValidate: undefined,\n// onValueChange: undefined,    \n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'string',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n\n// autoUpdate: true,\n// onValidate: undefined,\n// onValueChange: undefined,    \n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'string', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.
    • autoUpdate :
      • true : Update binding key when user input. Default behavior.
      • false : Use onValueChange to set value of binding key when user input.
    • onValidate :
      • Callback invoked when new value input.
        function(newValue, oldValue, bindingTarget, bindingKey) { return true;\n}\n
        • true : Accept this new value.
        • false : Reject this new value.
      • undefined : Always accept new value changing. Default behavior.
    • onValueChange :
      • Callback invoked when binding value changing.
        function(newValue, oldValue, bindingTarget, bindingKey) { }\n
      • undefined : Ignore this feature. Default value.

    See Style of text input

    "},{"location":"ui-tweaker/#text-area-input-row","title":"Text-Area input row","text":"

    object[key] is a text value.

    tweaker.addInput(object, key, {    view: 'textarea',\n\n// height: undefined,\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n\n// autoUpdate: true,\n// onValidate: undefined,\n// onValueChange: undefined,    \n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\nview: 'textarea',\n\n// height: undefined,\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n\n// autoUpdate: true,\n// onValidate: undefined,\n// onValueChange: undefined,    \n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : 'textarea'.
    • height : Height of this input row.
      • undefined : Use children height.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.
    • autoUpdate :
      • true : Update binding key when user input. Default behavior.
      • false : Use onValueChange to set value of binding key when user input.
    • onValidate :
      • Callback invoked when new value input.
        function(newValue, oldValue, bindingTarget, bindingKey) { return true;\n}\n
        • true : Accept this new value.
        • false : Reject this new value.
      • undefined : Always accept new value changing. Default behavior.
    • onValueChange :
      • Callback invoked when binding value changing.
        function(newValue, oldValue, bindingTarget, bindingKey) { }\n
      • undefined : Ignore this feature. Default value.

    See Style of text-area input

    "},{"location":"ui-tweaker/#text-input-from-list","title":"Text input from list","text":"

    object[key] is a text value.

    tweaker.addInput(object, key, {\n// view: 'list',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0, /* icon: , iconFrame, .. */ },\n{text: text1, value: value1, /* icon: , iconFrame, .. */ },\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'list',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0, /* icon: , iconFrame, .. */ },\n{text: text1, value: value1, /* icon: , iconFrame, .. */ },\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'list', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • options : Option list, each item contains
      • text : Display text.
      • value : Set key to this value.
      • icon, iconFrame, ... : See Reset display content of Label
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of list input

    "},{"location":"ui-tweaker/#text-input-from-buttons","title":"Text input from buttons","text":"

    object[key] is a text value.

    tweaker.addInput(object, key, {\nview: 'buttons',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\nview: 'buttons',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'buttons'.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • options : Option list, each item contains
      • text : Display text.
      • value : Set key to this value.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of buttons input

    "},{"location":"ui-tweaker/#number-input-row","title":"Number input row","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\n// view: 'number',\n// int: undefined,\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'number',\n// int: undefined,\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'number', if bindingTarget is not given.
    • int : Set to true to truncate float number to integer number.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of text input

    "},{"location":"ui-tweaker/#number-input-in-a-range","title":"Number input in a range","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\n// view: 'range',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\nmin: minValue, max: maxValue,\n// step: undefined,\n\n// format: function(value) { return s; },\n// inputTextReadOnly: false,\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'range',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\nmin: minValue, max: maxValue,\n// step: undefined,\n\n// format: function(value) { return s; },\n// inputTextReadOnly: false,\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'range', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • min, max : Minimum, maximun value of range.
    • step : Step/gap of slider, optional.
    • format : Callback to return formatted string for input text field.
      function(value) {\nreturn s;\n}\n
    • inputTextReadOnly :
      • false : Input text field is editable. Default behavior.
      • true : Input text field is read-only.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of range input

    "},{"location":"ui-tweaker/#number-input-in-inc-dec-buttons","title":"Number input in inc-dec buttons","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\nview: 'incdec',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// min: undefined, \n// max: undefined,\n// step: 1,\n\n// format: function(value) { return s; },\n// inputTextReadOnly: false,\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'incdec',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// min: undefined, \n// max: undefined,\n// step: 1,\n\n// format: function(value) { return s; },\n// inputTextReadOnly: false,\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'incdec', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • step : Incremental or decremental value when clicking inc-button, or dec-button
    • min, max : Minimum, maximun value of range, optional.
    • format : Callback to return formatted string for input text field.
      function(value) {\nreturn s;\n}\n
    • inputTextReadOnly :
      • false : Input text field is editable. Default behavior.
      • true : Input text field is read-only.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of incdec input

    "},{"location":"ui-tweaker/#number-input-from-list","title":"Number input from list","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\n// view: 'list',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'list',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'list', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • options : Option list, each item contains
      • text : Display text.
      • value : Set key to this value.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of list input

    "},{"location":"ui-tweaker/#number-input-from-buttons","title":"Number input from buttons","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\nview: 'buttons',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\nview: 'buttons',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'buttons'.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • options : Option list, each item contains
      • text : Display text.
      • value : Set key to this value.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of buttons input

    "},{"location":"ui-tweaker/#color-input","title":"Color input","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\nview: 'color',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\nview: 'color',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'color'.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of color input

    "},{"location":"ui-tweaker/#boolean-input-row","title":"Boolean input row","text":"

    object[key] is a boolean value.

    tweaker.addInput(object, key, {\n// view: 'boolean',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'boolean',\n// view: 'toggleSwitch',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'boolean', or 'toggleSwitch', if bindingTarget is not given.
      • 'boolean' : Checkbox input. Default behavior.
      • 'toggleSwitch' : Toggle switch input.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of boolean input

    "},{"location":"ui-tweaker/#value-callbacks-row","title":"Value callbacks row","text":"
    tweaker.addInput({\nbindingTarget: object,\n\nonGetValue(bindingTarget) {\n\n},\n\nonSetValue(bindingTarget, value) {\n\n},\n\nview: ,\n\n// Other properties..\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • onGetValue : Callback to get dispaly value
      function(bindingTarget) {\nreturn value;\n}\n
    • onSetValue : Callback to set value to bindingTarget
      function(bindingTarget, value) {        }\n
    • view : Any kind of view listed before.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    Note

    No bindingKey parameter in this case.

    "},{"location":"ui-tweaker/#add-button","title":"Add button","text":"
    tweaker.addButton({\n// bindingTarget: object,\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\ntitle: undefined,\n\nlabel: undefined,\n\ncallback: function(target) {},\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target will pass to callback. Optional.
      • Can bind target later via tweaker.setBindingTarget(object).
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label.
    • label : Display text of button, a string or a plain object.
      {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n}\n
    • callback : Callback when clicking button
      function(target) { }\n
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of botton

    "},{"location":"ui-tweaker/#add-buttons","title":"Add buttons","text":"
    tweaker.addButtons({\n// bindingTarget: object,\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\ntitle: undefined,\n\nbuttons:[\n{\nlabel: undefined,\ncallback: function(target) {},\n},\n{\nlabel: undefined,\ncallback: function(target) {},\n},\n// ...\n],\n\nwrap: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target will pass to callback. Optional.
      • Can bind target later via tweaker.setBindingTarget(object).
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label.
    • buttons : Array of button label and button callback
      {\nlabel: undefined,\ncallback: function(target) {},\n}\n
      • label : Display text of button, a string or a plain object. ```javascript { text: '',

        icon: undefined, \niconFrame: undefined,\niconSize: undefined,\n\naction: undefined, \nactionFrame: undefined,\nactionSize: undefined,\n

        } `` -callback: Callback when clicking button

        function(target) { }\n
        -wrap: Layout mode of buttons. -true: [fixwidth-sizer](ui-fixwidthsizer.md) layout. -false: [sizer](ui-sizer.md) layout. Default behavior. -key: Add this child into childMap, which could be read back bytweaker.getElement(key). -undefined` : Don't add this child. Default value.

    See Style of botton

    "},{"location":"ui-tweaker/#add-separator","title":"Add separator","text":"
    tweaker.addSeparator();\n

    See Style of separator

    "},{"location":"ui-tweaker/#add-folder","title":"Add folder","text":"

    Folder contains collapsible child tweaker game object.

    var childTweaker = tweaker.addFolder({\ntitle: titleA,\n\n// expanded: true,\n});\n\n// childTweaker.addInput(...)\n
    • childTweaker : Child tweaker game object. Add input rows by addInput method.
    • title Title of folder. Click title can collapse or expand child tweaker game object.
    • expanded :
      • true : Expand child tweaker game object at beginning. Default behavior.
      • false : Collapse child tweaker game object at beginning.

    See Style of folder

    "},{"location":"ui-tweaker/#add-tab","title":"Add tab","text":"

    Tab containes pages. Each page is a tweaker game object.

    var childrenTweakers = tweaker.addTab({\npages: [\n{\ntitle: titleA, // show: false\n},\n{\ntitle: titleB\n// show: false\n},\n// ...\n]\n});\n\n// childrenTweakers[0].addInput(...)\n// childrenTweakers[1].addInput(...)\n
    • childrenTweakers : Array of children tweaker game object. Add input rows by addInput method.
    • pages : Array of page setting.
      {\ntitle: titleA,\nshow: false,\n}\n
      • title : Display text of page title
      • show : Set to true to show this page at beginning

    See Style of tab

    "},{"location":"ui-tweaker/#add-columns","title":"Add columns","text":"

    Multiple columns in a row. Each column is a tweaker game object.

    var childrenTweakers = tweaker.addColumns(amount);\n\n// childrenTweakers[0].addInput(...)\n// childrenTweakers[1].addInput(...)\n

    or

    var childrenTweakers = tweaker.addColumns({\n// title: title,\n\ncolumns: [\n{\n// width: 0,\n// expand: true\n},\n{\n// width: 0,\n// expand: true\n},\n]\n});\n\n// childrenTweakers[0].addInput(...)\n// childrenTweakers[1].addInput(...)\n
    • childrenTweakers : Array of children tweaker game object. Add input rows by addInput method.
    • amount : A number, amount of columns. Will use default column config.
    • columns : Array of column config, each column config contains
      • width : Minimum width of this column, default value is 0, will set proportion to 1.
      • expand : Expand height of this column, default value is true.

    See Style of columns

    "},{"location":"ui-tweaker/#add-wrap","title":"Add wrap","text":"

    A tweaker panel which Wrap input rows into multiple lines.

    var childTweaker = tweaker.addWrap({\n// title: titleA,\n\nitemWidth: 0,\nitemHeight: 0,\n});\n\n// childTweaker.addInput(...)\n
    • childTweaker : Child tweaker game object. Add input rows by addInput method.
    • title Title of folder. Click title can collapse or expand child tweaker game object.
    • itemWidth, itemHeight : Size of input row.

    See Style of wrap

    "},{"location":"ui-tweaker/#add-scrollable","title":"Add scrollable","text":"

    Scrollable(Panel) contains child tweaker game object and slider.

    var childTweaker = tweaker.addScrollable({\n// title: title,\n\n// height: 0\n});\n\n// childTweaker.addInput(...)\n
    • childTweaker : Child tweaker game object. Add input rows by addInput method.
    • title Title of scrolable.
      • A string : Title string.
      • undefined : Hide this title game object.
    • height :
      • A number : Height of this Scrollable(Panel).
      • undefined, or 0 : Expand this scrollable(Panel).

    See Style of scrollable

    "},{"location":"ui-tweaker/#add-rows","title":"Add rows","text":"

    Add mutiple rows (input row, button, buttons, separator, folder, tab) in a single method

    tweaker.addRows(properties, target);\n// tweaker.addRows(properties, target, monitor);\n
    • properties : A list of properties, each property could be one of
      • Input row
        {\n$key: '',\n// $target:\n// More properties...\n}\n
        • $key : Assign this value to bindingKey
        • $target : Assign this value to bindingTarget
          • undefined : Use target parameter from addRows method. Default behavior
        • More properties. See
          • Text input row,
          • Text area input row,
          • Text input from list
          • Text input from buttons
          • Number input row
          • Number input in a range
          • Number input from list
          • Number input from buttons
          • Color input row
          • Boolean input row
          • Value callback row
      • Button
        {\n$type: 'button', title: '', label: '',\ncallback(target) {\n}\n}\n
      • Buttons
      • Separator
        { $type: 'separator' }\n
      • Folder
        {\n$type: 'folder', title: '',\n// $target: \n$properties: [\n// ...\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
      • Tab
        {\n$type: 'tab',\n// $target:\npages: [\n{\ntitle: '',\n$properties: [\n// ...\n]\n},\n{\ntitle: '',\n$properties: [\n// ...\n]\n},\n// ... More pages\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
      • Columns
        {\n$type: 'columns',\n// $target:\ncolumns: [\n{\n// width: 0,\n// expand: true,\n$properties: [\n// ...\n]\n},\n{\n// width: 0,\n// expand: true,\n$properties: [\n// ...\n]\n},\n// ... More columns\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
      • Wrap
        {\n$type: 'wrap', title: '',\n// $target: \n$properties: [\n// ...\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
      • Scrollable
        {\n$type: 'scrollable', title: undefined,\n// $target: \n$properties: [\n// ...\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
    • monitor :
      • false : Don't update input text every tick from target.
      • true : Update input text from current object, in postupdate event of scene. Default behavior.
    "},{"location":"ui-tweaker/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    tweaker.layout();\n

    See also - dirty

    "},{"location":"ui-tweaker/#styles","title":"Styles","text":""},{"location":"ui-tweaker/#style-of-text-input","title":"Style of text input","text":"

    Style of text-area input is defined in

    • styles.inputRow.title
    • styles.inputRow.inputText
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-text-area-input","title":"Style of text-area input","text":"

    Style of text-area input is defined in

    • styles.inputRow.title
    • styles.inputRow.inputTextArea
    • styles.inputRow.inputText
    • styles.inputRow.slider
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ninputTextArea: {\nheight: undefined,\n\ntext: {\n\n},\n\nslider: {\n// ...\n}\n},\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},\n\nslider: {\ntrack: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nindicator: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nthumb: {\nwidth: 0, height: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n}\n}\n}\n

    Style of text-area is defined at styles.inputRow.inputTextArea :

    • Define style of input text at styles.inputRow.inputTextArea.text, if not given, it will use styles.inputRow.inputText.
    • Define style of slider at styles.inputRow.inputTextArea.slider, if not given, it will use styles.inputRow.slider.
    "},{"location":"ui-tweaker/#style-of-list-input","title":"Style of list input","text":"

    Style of text/number list input is defined in

    • styles.inputRow.title
    • styles.inputRow.list
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nlist: {\nlabel: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\n},\n\nbutton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n\n'hover.color': undefined,\n'hover.alpha': undefined,\n'hover.strokeColor': undefined,\n'hover.strokeAlpha': undefined,\n'hover.strokeWidth': undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nlist: {\nalignParent: 'text',\nalignSide: 'left',\nexpandDirection: 'down',\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-buttons-input","title":"Style of buttons input","text":"

    Style of buttons input is defined in

    • styles.inputRow.title
    • styles.inputRow.button
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nbutton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpand: true\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-range-input","title":"Style of range input","text":"

    Style of range input is defined in

    • styles.inputRow.title
    • styles.inputRow.slider
    • styles.inputRow.inputText
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nslider: {\ntrack: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nindicator: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nthumb: {\nwidth: 0, height: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n}\n},\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\nrange: {\nslider: 0,\ninputText: 0,\n}\n}\n\n}\n}\n}\n
    • Set proportion.range.slider and proportion.range.inputText to layout slider and inputText.
    "},{"location":"ui-tweaker/#style-of-inc-dec-input","title":"Style of inc-dec input","text":"

    Style of range input is defined in

    • styles.inputRow.title
    • styles.inputRow.incDec
    • styles.inputRow.inputText
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nincDec: {\nincButton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nicon: {\nkey:,\nframe:,\n},\n\ntext: null,\naction: null,\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ndecButton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nicon: {\nkey:,\nframe:,\n},\n\ntext: null,\naction: null,\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ninputTextIndex: 0, // 0,1,2\n},\n\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\nrange: {\nslider: 0,\ninputText: 0,\n}\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-color-input","title":"Style of color input","text":"

    Style of color input is defined in

    • styles.inputRow.title
    • styles.inputRow.inputText
    • styles.inputRow.colorInput
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ncolorInput: {\nswatch: {\nradius: 0,\nsize: undefined,\n},\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},                // inputText: false,\n\ncolorPicker: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n}\n},\n\ncolorComponents: {\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n\n}\n}\n\n// colorComponents: false,\n\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-boolean-input","title":"Style of boolean input","text":"

    Style of boolean input is defined in

    • styles.inputRow.title
    • styles.inputRow.checkbox, or styles.inputRow.toggleSwitch
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\n// For checkbox view\ncheckbox: {\n// size: undefined,\n\ncolor: 0x005cb2,\nboxFillAlpha: 1,\nuncheckedColor: null,\nuncheckedBoxFillAlpha: 1,\n\nboxLineWidth: 4,\nboxStrokeColor: 0x005cb2,\nboxStrokeAlpha: 1,\nuncheckedBoxStrokeColor: 0x005cb2,\nuncheckedBoxStrokeAlpha: 1,\n\ncheckerColor: 0xffffff,\ncheckerAlpha: 1,\n\ncircleBox: false\n\nanimationDuration: 150,\n\nreadOnly: false,\n},\n\n// For toggle switch view\ntoggleSwitch: {\n// size: undefined,\n\ncolor: 0x005cb2,\ntrackFillAlpha: 1,\nfalseValueTrackColor: undefined,\nfalseValueTrackFillAlpha: 1,\n\nthumbColor: 0xffffff,\nthumbAlpha: 1,\n\ntrackWidth: 0.9,\ntrackHeight: 0.5,\ntrackCornerRadius: (trackHeight * 0.5),\n\nthumbHeight: (trackHeight * 0.9),\nthumbWidth: (thumbHeight),\nthumbCornerRadius: (thumbHeight * 0.5),\n\nthumbLeft: 0.3,\nthumbRight: (1 - thumbLeft),\nrtl: false,\n\nanimationDuration: 150,\n\nreadOnly: false,\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-botton","title":"Style of botton","text":"

    Style of button is defined in

    • styles.inputRow.title
    • styles.inputRow.button
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nbutton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-separator","title":"Style of separator","text":"

    Style of separator is defined in

    • styles.separator
    {\n// style: {...}\nstyles: {\nseparator: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-folder","title":"Style of folder","text":"

    Style of folder is defined in

    • styles.folder
    {\n// style: {...}\nstyles: {\nfolder: {\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpandedIcon: {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n},\n\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, }\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-tab","title":"Style of tab","text":"

    Style of tab is defined in

    • styles.tab
    {\n// style: {...}\nstyles: {\ntab: {\ntab: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n\n'active.color': undefined,\n'active.alpha': undefined,\n'active.strokeColor': undefined,\n'active.strokeAlpha': undefined,\n'active.strokeWidth': undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nwrapTabs: false,\n\ntabs: {\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, item: 0,\n}\n},\n\npages: {\nfadeIn: 0,\n}\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-columns","title":"Style of columns","text":"

    Style of columns is defined in

    • styles.columns
    {\n// style: {...}\nstyles: {\ncolumns: {\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpandedIcon: {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n},\n\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\n//background: [\n//    {\n//        radius: 0,\n//        // radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n//\n//        color: undefined,\n//        alpha: undefined,\n//        strokeColor: undefined,\n//        strokeAlpha: undefined,\n//        strokeWidth: undefined,\n//    }\n//],\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, column: 0,\n}\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-wrap","title":"Style of wrap","text":"

    Style of wrap is defined in

    • styles.wrap
    {\n// style: {...}\nstyles: {\nwrap: {\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpandedIcon: {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n},\n\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nspace: {\nitem: 0, line: 0\n},\n\nalign: 'justify-cneter'\n}\n}\n}\n
    • align : Align children of a line.
      • 0, 'left' : Align children of a line to left/top side.
      • 1, 'right' : Align children of a line to right/bottom side.
      • 2, 'center' : Align children of a line to ceter.
      • 3, 'justify', 'justify-left' : If remainder space is less or equal than 25%, then justify children. Else align children to left/top side.
      • 4, 'justify-right' : If remainder space is less or equal than 25%, then justify children. Else align children to right/bottom side.
      • 5, 'justify-cneter' : If remainder space is less or equal than 25%, then justify children. Else align children to center.
    "},{"location":"ui-tweaker/#style-of-scrollable","title":"Style of scrollable","text":"

    Style of scrollable is defined in

    • styles.scrollable
    {\n// style: {...}\nstyles: {\nscrollable: {\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpandedIcon: {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n},\n\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nslider: {\ntrack: { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n},\n\nthumb: { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n},\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n},\n\nspace: {\npanel:0, }\n}\n}\n}\n
    "},{"location":"ui-tweaker/#bind-target","title":"Bind target","text":"

    All input rows will bind to this new target, and update display status.

    tweaker.setBindingTarget(object);\n
    "},{"location":"ui-tweaker/#events","title":"Events","text":"
    • On value change of any bindingKey
      tweaker.on('valuechange', function(newValue, oldValue, bindingTarget, bindingKey) {\n\n})\n
    "},{"location":"ui-tweaker/#get-element","title":"Get element","text":"
    • Get by key
      var gameObject = tweaker.getElement(key);\n
      • key : Add by key parameter in tweaker.addInput(config) method
        tweaker.addInput({\nkey: ...\n})\n
    • Get by name
      var gameObject = tweaker.getElement('#' + name);\n// var gameObject = pages.getElement('#' + name, recursive);\n
      or
      var gameObject = tweaker.getByName(name);\n// var gameObject = tweaker.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-tweaker/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"uniqueitemlist/","title":"Unique item list","text":""},{"location":"uniqueitemlist/#introduction","title":"Introduction","text":"

    List of unique items. Support array and set methods.

    • Author: Rex
    • Data structure
    "},{"location":"uniqueitemlist/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"uniqueitemlist/#install-plugin","title":"Install plugin","text":""},{"location":"uniqueitemlist/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexuniqueitemlistplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuniqueitemlistplugin.min.js', true);\n
    • Add list object
      var listA = scene.plugins.get('rexuniqueitemlistplugin').add(config);\n
    "},{"location":"uniqueitemlist/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UniqueItemListPlugin from 'phaser3-rex-plugins/plugins/uniqueitemlist-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexUniqueItemList',\nplugin: UniqueItemListPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add list object
      var listA = scene.plugins.get('rexUniqueItemList').add(config);\n
    "},{"location":"uniqueitemlist/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import UniqueItemList from 'phaser3-rex-plugins/plugins/uniqueitemlist.js';\n
    • Add list object
      var listA = new UniqueItemList();\n
    "},{"location":"uniqueitemlist/#create-instance","title":"Create instance","text":"
    var listA = scene.plugins.get('rexUniqueItemList').add({\n// items: undefined,\n// autoCleanup: true\n});\n
    • items : Initial items.
    • autoCleanup : Set true to remove item when item is destroyed (from item's 'destroy' event)

    or

    var listA = scene.plugins.get('rexUniqueItemList').add(items);\n
    "},{"location":"uniqueitemlist/#items","title":"Items","text":"
    • Get first item
      var item = listA.getFirst();\n
    • Get last item
      var item = listA.getLast();\n
    • Get item at index
      var item = listA.get(index);\n
    • Get a random item
      var item = listA.getRandom();\n
    • Get items
      var items = listA.getItems();\n
    • Clone items to a new array
      var items = listA.cloneItems();\n
    "},{"location":"uniqueitemlist/#item-count","title":"Item count","text":"
    • Get item count
      var count = listA.length;\n
    • List is empty
      var isEmpty = listA.isEmpty();\n
    "},{"location":"uniqueitemlist/#contains","title":"Contains","text":"
    • Has item
      var hasItem = listA.contains(item);\n
    • Has any item
      var hasAny = listA.any(listB);\n
    • Has all items
      var hasAll = listA.all(listB);\n
    "},{"location":"uniqueitemlist/#array-operations","title":"Array operations","text":""},{"location":"uniqueitemlist/#add","title":"Add","text":"
    • Add to last
      listA.add(item);\n
      or
      listA.addLast(item);\n
    • Add to first
      listA.addFirst(item);\n
    • Insert to index
      listA.add(item, index);\n
    • Insert, or move to index
      listA.add(item, iindex, true);\n
    • Add items
      listA.addMultiple(items);\n
    • Clone list
      var newList = listA.clone();\n// listA.clone(listB)\n
    "},{"location":"uniqueitemlist/#remove","title":"Remove","text":"
    • Remove item
      listA.remove(item);\n
    • Remove first
      listA.removeFirst();\n
    • Remove last
      listA.removeLast();\n
    • Remove item at index
      listA.remove(undefined, index);\n
    • Remove items
      listA.removeMultiple(items);\n
    • Remove all items
      listA.clear();\n
    • Destroy all items
      listA.clear(true);\n
    "},{"location":"uniqueitemlist/#pop","title":"Pop","text":"
    • Pop first item
      var item = listA.pop();\n
      or
      var item = listA.popFirst();\n
    • Pop last item
      var item = listA.popLast();\n
    • Pop item at index
      var item = listA.pop(index);\n
    • Pop a random item
      var item = listA.popRandom();\n
    "},{"location":"uniqueitemlist/#slice","title":"Slice","text":"
    • Extract items from startIndex to endIndex (item of endIndex is included)
      var newList = listA.slice(startIndex, endIndex);\n// listA.slice(startIndex, endIndex, listB);\n
    "},{"location":"uniqueitemlist/#sort","title":"Sort","text":"
    • Sort
      list.sort(function(itemA, itemB) {\nif (itemA > itemB) {\nreturn 1;\n} else if (itemA < itemB) {\nreturn -1;\n} else {\nreturn 0;\n}\n})\n
    • Reverse
      listA.reverse();\n
    • Shuffle
      listA.shuffle();\n
    "},{"location":"uniqueitemlist/#set-operations","title":"Set operations","text":"
    • C = A | B
      var listC = listA.union(listB);\n// listA.union(listB, listC);\n
      • listC : Result unique-item-list. Can be listA, or listB.
    • C = A & B
      var listC = listA.intersect(listB);\n// listA.intersect(listB, listC);\n
      • listC : Result unique-item-list. Can be listA, or listB.
    • C = A - B
      var listC = listA.difference(listB);\n// listA.difference(listB, listC);\n
      • listC : Result unique-item-list. Can be listA, or listB.
    "},{"location":"uniqueitemlist/#call-method","title":"Call method","text":"

    Apply method of each item.

    listA.call(fnName, arg0, arg1, arg2, ...);\n
    • fnName : Method name of item.
    • arg0, arg1, arg2 : Arguments of fnName method.

    Warning

    Don't add or remove any item during this method.

    listA.call(function(item, i) {\n// ....\n}, scope);\n
    • callback : A function object.
      function(item, i) {\n\n}\n
    "},{"location":"uuid/","title":"UUID","text":""},{"location":"uuid/#introduction","title":"Introduction","text":"

    Creates and returns an RFC4122 version 4 compliant UUID, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"uuid/#usage","title":"Usage","text":"
    var uuid = Phaser.Utils.String.UUID();\n
    "},{"location":"vector2/","title":"Vector2","text":""},{"location":"vector2/#introduction","title":"Introduction","text":"

    A representation of a vector in 2D space ({x, y}), built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"vector2/#usage","title":"Usage","text":""},{"location":"vector2/#create-object","title":"Create object","text":"
    var vector = new Phaser.Math.Vector2();\n// var vector = new Phaser.Math.Vector2(x, y);\n// var vector = new Phaser.Math.Vector2({x, y});\n
    "},{"location":"vector2/#clone","title":"Clone","text":"
    var newVector = vector.clone();\n
    "},{"location":"vector2/#set-components","title":"Set components","text":"
    • Set (x, y)
      vector.set(x, y);\n// vector.setTo(x, y);\n
      or
      vector.copy({x, y});\n// vector.setFromObject({x, y});\n
    • Set angle
      vector.setAngle(angle);\n
      • angle : Angle in radians.
    • Rotate
      vector.rotate(delta);\n
      • delta : The angle to rotate by, in radians.
    • Project
      vector.project(srcVector2);\n
    • Set length
      vector.setLength(length);\n
    • Set from polar coordinate
      vector.setToPolar(azimuth, radius);\n
      • azimuth : The angular coordinate, in radians.
      • radius : The radial coordinate (length). Default is 1.
    • Reset to (0, 0)
      vector.reset();\n
    "},{"location":"vector2/#get-componments","title":"Get componments","text":"
    • X, Y
      var x = vector.x;\nvar y = vector.y;\n
    • Angle
      var angle = vector.angle(); // angle in radians\n
    • Length
      var length = vector.length();\n
      or
      var lengthSq = vector.lengthSq(); // squared\n
    "},{"location":"vector2/#methods","title":"Methods","text":"
    • Scale
      vector.scale(value);\n
    • Limit the length
      vector.limit(value);\n
    • Normalize
      vector.normalize();\n
    • Negate
      vector.negate();\n
    • Rotate perpendicular
      vector.normalizeRightHand();\nvector.normalizeLeftHand();\n
    • Reflect
      • Reflect this Vector off a line defined by a normal.
        vector.reflect(normal);\n
        • normal : A vector perpendicular to the line.
      • Reflect this Vector across another.
        vector.mirror(axis);\n
        • axis : A vector to reflect across.
    "},{"location":"vector2/#vector-methods","title":"Vector methods","text":"
    • Add
      vector.add(src); // src: {x, y}\n
    • Subtract
      vector.subtract(src); // src: {x, y}\n
    • Multiply
      vector.multiply(src); // src: {x, y}\n
    • Divide
      vector.divide(src); // src: {x, y}\n
    • Dot
      var value = vector.dot(src); // src: {x, y}\n
    • Cross
      var value = vector.cross(src); // src: {x, y}\n
    • Fuzzy Equal
      var equal = vector.fuzzyEquals(src); // src: {x, y}\n// var equal = vector.fuzzyEquals(src, epsilon);\n
    "},{"location":"vector2/#points-method","title":"Points method","text":"
    • Distance between 2 points.
      var distance = vector.distance(src);\n
      or
      var distanceSq = vector.distanceSq(src); // squared\n
    • Linearly interpolate between 2 points.
      vector.lerp(src, t); // src: {x, y}\n
      • t : The interpolation percentage, between 0 and 1.
    "},{"location":"vector2/#constant","title":"Constant","text":"
    • Zero (0,0)
      var vector = Phaser.Math.Vector2.ZERO;\n
    • One (1,1)
      var vector = Phaser.Math.Vector2.ONE;\n
    • Right (1,0)
      var vector = Phaser.Math.Vector2.RIGHT;\n
    • Left (-1,0)
      var vector = Phaser.Math.Vector2.LEFT;\n
    • Up (0,-1)
      var vector = Phaser.Math.Vector2.UP;\n
    • Down (0,1)
      var vector = Phaser.Math.Vector2.DOWN;\n
    "},{"location":"video/","title":"Video","text":""},{"location":"video/#introduction","title":"Introduction","text":"

    Handling playback of a video file, video stream or media stream.

    • Author: Richard Davey
    "},{"location":"video/#usage","title":"Usage","text":""},{"location":"video/#load-video","title":"Load video","text":"
    scene.load.video(key, url, noAudio);\n

    Reference: load video

    Cross-origin

    Can't load video cross-origin via scene.load.video(...). Using scene.add.video(x, y).loadURL(urls, noAudio, crossOrigin) to load video cross-origin.

    "},{"location":"video/#add-video-object","title":"Add video object","text":""},{"location":"video/#reference-video-from-video-cache","title":"Reference video from Video Cache","text":"
    var video = scene.add.video(x, y, key);\n
    • key : Key of the Video this Game Object will play, as stored in the Video Cache.
    "},{"location":"video/#load-video-from-url","title":"Load video from URL","text":"
    1. Add video object
      var video = scene.add.video(x, y);\n
    2. Play video from URL
      video.loadURL(url);\n// video.loadURL(urls, noAudio, crossOrigin);\n
      • noAudio : Does the video have an audio track? If not you can enable auto-playing on it.
        • false : Has audio track. Default behavior.
      • crossOrigin : The value to use for the crossOrigin property in the video load request.
        • undefined : crossorigin will not be set in the request. Default behavior.
        • 'anonymous'
        • 'use-credentials'
    "},{"location":"video/#load-video-from-mediastream","title":"Load video from MediaStream","text":"
    video.loadMediaStream(stream);\n// video.loadMediaStream(stream, noAudio, crossOrigin);\n
    • stream : The MediaStream object.
    • noAudio : Does the video have an audio track? If not you can enable auto-playing on it.
      • false : Has audio track. Default behavior.
    • crossOrigin : The value to use for the crossOrigin property in the video load request.
      • undefined : crossorigin will not be set in the request. Default behavior.
      • 'anonymous'
      • 'use-credentials'
    navigator.mediaDevices.getUserMedia({ video: true, audio: false })\n.then(function(stream) {\nvideo.loadMediaStream(stream, true);\nvideo.play();\n})\n.catch(function(err) {\n\n})\n
    • navigator.mediaDevices.getUserMedia
    "},{"location":"video/#get-first-frame","title":"Get first frame","text":"
    video.getFirstFrame();\n
    "},{"location":"video/#size","title":"Size","text":"
    • Initial size : 256x265 (video.setSize(256, 256))
    • Size after playing : Size of video from metadata
    "},{"location":"video/#play","title":"Play","text":"
    video.play();\n// video.play(loop, markerIn, markerOut);\n
    • loop : Should the video loop automatically when it reaches the end? Please note that not all browsers support seamless video looping for all encoding formats.
    • markerIn, markerOut : Optional in/out marker time, in seconds, for playback of a sequence of the video.

    Play video first time

    Call video.play() when playing video first time.

    Note

    If you need audio in your videos, then you'll have to consider the fact that the video cannot start playing until the user has interacted with the browser, into your game flow.

    "},{"location":"video/#pause","title":"Pause","text":"
    • Pause
      video.setPaused();\n// video.setPaused(true);\n
    • Resume
      video.setPaused(false);\n

    Play video after paused

    Call video.setPaused(false) to resume playing.

    "},{"location":"video/#stop","title":"Stop","text":"

    Stops the video playing and clears all internal event listeners.

    video.stop();\n
    "},{"location":"video/#is-playing","title":"Is playing","text":"
    • Is playing
      var isPlaying = video.isPlaying();  // (not PAUSE) and (not not ENDED)\n
    • Is paused
      var isPaused = video.isPaused();\n
    "},{"location":"video/#playback-time","title":"Playback time","text":"
    • Get
      var playbackTime = video.getCurrentTime();\n
      or
      var t = video.getProgress(); // t: 0~1\n
    • Set
      • Set to
        video.setCurrentTime(playbackTime);  // time in seconds\n
        or
        video.seekTo(t); // t: 0~1\n
        • Is seeking
          var isSeeking = video.isSeeking();\n
      • Forward
        video.setCurrentTime('+' + time);  // time in seconds\n// video.setCurrentTime('+2');\n
      • Backeard
        video.setCurrentTime('-' + time);  // time in seconds\n// video.setCurrentTime('-2');\n
    "},{"location":"video/#playback-rate","title":"Playback rate","text":"
    • Get
      var rate = video.getPlaybackRate();\n
    • Set
      video.setPlaybackRate(rate);\n
    "},{"location":"video/#duration","title":"Duration","text":"
    var duration = video.getDuration();  // time in seconds\n
    "},{"location":"video/#volume","title":"Volume","text":"
    • Get
      var volume = video.getVolume();  // volume: 0~1\n
    • Set
      video.setVolume(volume);  // volume: 0~1\n
    "},{"location":"video/#mute","title":"Mute","text":"
    • Get
      var muted = video.isMuted();  // muted: true/false\n
    • Set
      video.setMute(muted);  // muted: true/false\n
    "},{"location":"video/#loop","title":"Loop","text":"
    • Get
      var loop = video.getLoop();  // loop: true/false\n
    • Set
      video.setLoop(loop);  // loop: true/false\n
    "},{"location":"video/#video-key","title":"Video key","text":"
    • Get
      var key = video.getVideoKey();\n
    • Change video key (video source)
      video.changeSource(key);\n// video.changeSource(key, autoplay, loop, markerIn, markerOut);\n
      • autoplay : Should the video start playing immediately, once the swap is complete?
      • loop : Should the video loop automatically when it reaches the end? Not all browsers support seamless video looping for all encoding formats.
      • markerIn, markerOut : Optional in/out marker time, in seconds, for playback of a sequence of the video.
    "},{"location":"video/#marks","title":"Marks","text":"
    • Add mark
      video.addMarker(key, markerIn, markerOut);\n
      • key : A unique name to give this marker.
      • markerIn, markerOut : The time, in seconds, representing the start/end of this marker.
    • Play mark
      video.playMarker(key, loop);\n
    • Remove mark
      video.removeMarker(key);\n
    "},{"location":"video/#snapshot","title":"Snapshot","text":"
    1. Allocate a canvas texrure
      video.saveSnapshotTexture(key);\n
      • key : Texture key.
    2. Take a snapshot
      var canvasTexture = video.video.snapshot();\n// var canvasTexture = video.snapshot(width, height);\n
      or
      var canvasTexture = video.snapshotArea(x, y, srcWidth, srcHeight);\n// var canvasTexture = video.snapshotArea(x, y, srcWidth, srcHeight, destWidth, destHeight);\n
      • x, y : The horizontal/vertical location of the top-left of the area to grab from.
      • srcWidth, srcHeight : The width/height of area to grab from the video.
      • destWidth, destHeight : The destination width/height of the grab, allowing you to resize it.
      • canvasTexture : Canvas texture object.
        • Get key of texture
          var key = canvasTexture.key;\n
    "},{"location":"video/#save-texture","title":"Save texture","text":"

    The saved texture is automatically updated as the video plays. If you pause this video, or change its source, then the saved texture updates instantly.

    var texture = video.saveTexture(key);\n// var texture = video.saveTexture(key, flipY);\n
    • flipY : Set to true if use it as the input for a Shader.
    "},{"location":"video/#events","title":"Events","text":"
    • The media source doesn't represent a supported media format.
      video.on('unsupported', function(video, error){\n\n}, scope);\n
    • A Video is unlocked by a user gesture.
      video.on('unlocked', function(video, error){\n\n}, scope);\n
    • A Video tries to play a source that does not exist, or is the wrong file type.
      video.on('error', function(video, error){\n\n}, scope);\n
    • A Video has access to the metadata.
      video.on('metadata', function(video){\n\n}, scope);\n
    • A Video has exhausted its allocated time while trying to connect to a video source to start playback.
      video.on('timeout', function(video){\n\n}, scope);\n
    • A Video begins playback.
      video.on('play', function(video){\n\n}, scope);\n
    • First started or restarted.
      video.on('playing', function(video){\n\n}, scope);\n
    • The video has finished loading enough data for its first frame.
      video.on('textureready', function(video){\n\n}, scope);\n
    • A Video finishes playback by reaching the end of its duration, or markerOut.
      video.on('complete', function(video){\n\n}, scope);\n
    • A Video that is currently playing has looped.
      video.on('loop', function(video){\n\n}, scope);\n
    • A Video begins seeking to a new point in its timeline.
      video.on('seeking', function(video){\n\n}, scope);\n
    • A Video completes seeking to a new point in its timeline.
      video.on('seeked', function(video){\n\n}, scope);\n
    • Enough of the video source has been loaded, that the browser is able to render a frame from it.
      video.on('created', function(video, width, height){\n\n}, scope);\n
    • Stalled by stalled, suspend, waiting DOM event.
      video.on('stalled', function(video, width, height){\n\n}, scope);\n
    • A Video is stopped from playback via a call to the Video.stop method,
      video.on('stop', function(video){\n\n}, scope);\n
    "},{"location":"video/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"video/#create-mask","title":"Create mask","text":"
    var mask = video.createBitmapMask();\n

    See mask

    "},{"location":"video/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"viewport-coordinate/","title":"Viewport-coordinate","text":""},{"location":"viewport-coordinate/#introduction","title":"Introduction","text":"

    Attach vpx, vpy properties to a game object, to set position according to proportion (vpx, vpy) of viewport, a rectangle).

    • Author: Rex
    • Method only
    "},{"location":"viewport-coordinate/#live-demos","title":"Live demos","text":"
    • Resize
    "},{"location":"viewport-coordinate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"viewport-coordinate/#install-plugin","title":"Install plugin","text":""},{"location":"viewport-coordinate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexviewportcoordinateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexviewportcoordinateplugin.min.js', true);\n
    • Attach vpx, vpy properties.
      scene.plugins.get('rexviewportcoordinateplugin').add(gameObject, viewport, vpx, vpy);\ngameObject.vpx = 0.5;\ngameObject.vpy = 0.5;\n
    "},{"location":"viewport-coordinate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ViewportCoordinatePlugin from 'phaser3-rex-plugins/plugins/viewportcoordinate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexViewportCoordinate',\nplugin: ViewportCoordinatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Attach vpx, vpy, vpxOffset, vpyOffset properties.
      scene.plugins.get('rexViewportCoordinate').add(gameObject, viewport, vpx, vpy);\ngameObject.vpx = 0.5;\ngameObject.vpy = 0.5;\ngameObject.vpxOffset = 0;\ngameObject.vpyOffset = 0;\n
    "},{"location":"viewport-coordinate/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import AddViewportCoordinateProperties from 'phaser3-rex-plugins/plugins/viewportcoordinate.js';\n
    • Attach vpx, vpy, vpxOffset, vpyOffset properties.
      AddViewportCoordinateProperties(gameObject, viewport, vpx, vpy);\ngameObject.vpx = 0.5;\ngameObject.vpy = 0.5;\ngameObject.vpxOffset = 0;\ngameObject.vpyOffset = 0;\n
    "},{"location":"viewport-coordinate/#attach-properties","title":"Attach properties","text":"
    scene.plugins.get('rexViewportCoordinate').add(gameObject, viewport, vpx, vpy, transformCallback);\n
    • vpx, vpy : Proportion of viewport.
    • vpxOffset, vpyOffset : Offset of position.
    • viewport : Viewport in rectangle
    • transformCallback : Transform callback.
      • undefined : Use default transform callback.
        function(vpx, vpy, vpxOffset, vpyOffset, viewport, out) {\ngameObject.x = viewport.x + (viewport.width * vpx) + vpxOffset;\ngameObject.y = viewport.y + (viewport.height * vpy) + vpyOffset;\n}\n

    Changing

    • gameObject.vpx, gameObject.vpy, gameObject.vpxOffset, gameObject.vpyOffset
    • x, y, width, height of viewport (a rectangle)

    Will change position (x , y) of game object.

    "},{"location":"virtualjoystick/","title":"Virtual joystick","text":""},{"location":"virtualjoystick/#introduction","title":"Introduction","text":"

    Simulate cursor keys according to touch events.

    • Author: Rex
    • Member of scene
    "},{"location":"virtualjoystick/#live-demos","title":"Live demos","text":"
    • Virtual joystick
    • Two joySticks
    • Joystick and button
    • Toggle visible
    • Drag vector to cursor keys
    "},{"location":"virtualjoystick/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"virtualjoystick/#install-plugin","title":"Install plugin","text":""},{"location":"virtualjoystick/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexvirtualjoystickplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexvirtualjoystickplugin.min.js', true);\n
    • Create instance
      var joyStick = scene.plugins.get('rexvirtualjoystickplugin').addPlayer(scene, config);\n
    "},{"location":"virtualjoystick/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import VirtualJoystickPlugin from 'phaser3-rex-plugins/plugins/virtualjoystick-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexVirtualJoystick',\nplugin: VirtualJoystickPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var joyStick = scene.plugins.get('rexVirtualJoystick').addPlayer(scene, config);\n
    "},{"location":"virtualjoystick/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import VirtualJoystick from 'phaser3-rex-plugins/plugins/virtualjoystick.js';\n
    • Create instance
      var joyStick = new VirtualJoystick(scene, config);\n
    "},{"location":"virtualjoystick/#create-instance","title":"Create instance","text":"
    var joystick = scene.plugins.get('rexVirtualJoystick').add(scene, {\nx: x,\ny: y,\nradius: 100,\nbase: baseGameObject,\nthumb: thumbGameObject,\n// dir: '8dir',\n// forceMin: 16,\n// fixed: true,\n// enable: true\n});\n
    • base : Base game object.
      • Create a circle shape object if no base game object passed.
    • thumb : Thumb game object.
      • Create a circle shape object if no thumb game object passed.
    • x, y : Position of base game object
    • radius : Circle hit-area of base game object
    • dir :
      • 'up&down', or 0 : Simulate up or down cursor keys only.
      • 'left&right', or 1 : Simulate left or right cursor keys only.
      • '4dir', or 2 : Simulate up, down, left or right cursor keys.
      • '8dir', or 3 : Simulate up, up-left, up-right, down, down-left, down-right, left, or right cursor keys.
    • forceMin : Cursor keys will be pressed when force is larger then this value.
      • force : Distance between position of base game object to touch pointer
    • fixed : Set true to fix to camera, i.e set scrollFactor to 0 for base and thumb game object. Default value is true.
    • enable : Set false to disable cursor keys simulation
    "},{"location":"virtualjoystick/#state-of-cursor-keys","title":"State of cursor keys","text":"
    var cursorKeys = joystick.createCursorKeys();\n\nvar leftKeyDown = cursorKeys.left.isDown;\nvar rightKeyDown = cursorKeys.right.isDown;\nvar upKeyDown = cursorKeys.up.isDown;\nvar downKeyDown = cursorKeys.down.isDown;\n

    Or

    var leftKeyDown = joystick.left;\nvar rightKeyDown = joystick.right;\nvar upKeyDown = joystick.up;\nvar downKeyDown = joystick.down;\nvar noKeyDown = joystick.noKey;\n
    "},{"location":"virtualjoystick/#force-angle","title":"Force & Angle","text":"

    Force : Distance between position of base game object to touch pointer.

    var force = joystick.force;\nvar forceX = joystick.forceX;\nvar forceY = joystick.forceY;\n\nvar angle = joystick.angle;  // degree between -180 to 180\nvar rotation = joystick.rotation; // radians\n
    "},{"location":"virtualjoystick/#visible","title":"Visible","text":"

    Visible of base game object.

    • Get : Return visible of base game object
      var visible = joystick.visible;\n
    • Set : Set visible to base game object and thumb game object
      joystick.visible = visible;\njoystick.setVisible(visible);\njoystick.toggleVisible();\n
      Joystick will be disabled when invisible.
    "},{"location":"virtualjoystick/#enable","title":"Enable","text":"
    • Get
      var enable = joystick.enable;\n
    • Set
      joystick.setEnable(enable);  // enable: true, or false\n//joystick.enable = enable;\n
    • Toggle
      joystick.toggleEnable();\n
    "},{"location":"virtualjoystick/#position","title":"Position","text":"

    Position of base game object.

    • Get
      var x = joystick.x;\nvar y = joystick.y;\n
    • Set
      joystick.setPosition(x ,y);\n// joystick.x = x;\n// joystick.y = y;\n
    "},{"location":"virtualjoystick/#scroll-factor","title":"Scroll factor","text":"
    • Fix to camera
      joystick.setScrollFactor(0);\n
    "},{"location":"virtualjoystick/#touch-pointer","title":"Touch pointer","text":"
    • Position
      var x = joystick.pointerX;\nvar y = joystick.pointerY;\n
    • Pointer
      var pointer = joystick.pointer;\n
    "},{"location":"virtualjoystick/#destroy","title":"Destroy","text":"

    Destroy base & thumb game object.

    joystick.destroy();\n
    "},{"location":"virtualjoystick/#events","title":"Events","text":"
    • On joystick updated :
      joystick.on('update', function(){});\n
    • On pointer-down
      joystick.on('pointerdown', function(pointer){});\n
    • On pointer-up
      joystick.on('pointerup', function(pointer){});\n
    "},{"location":"virtualjoystick/#elements","title":"Elements","text":"
    • Base Game object:
      var baseGO = joystick.base;\n
    • Thumb Game object:
      var thumb = joystick.thumb;\n
    "},{"location":"virtualjoystick/#vector-to-cursor-keys","title":"Vector to cursor keys","text":"

    A controller to represent cursor keys by (drag) vector

    "},{"location":"virtualjoystick/#create-controller","title":"Create controller","text":"
    var controller = scene.plugins.get('rexVirtualJoyStick').addVectorToCursorKeys({\n// dir: '8dir',\n// forceMin: 16,\n// enable: true\n})\n

    or

    // import VirtualJoystick from 'phaser3-rex-plugins/plugins/vectortocursorkeys.js';\nvar controller = new VirtualJoystick(undefined, config);\n
    • dir :
      • 'up&down', or 0 : Simulate up or down cursor keys only.
      • 'left&right', or 1 : Simulate left or right cursor keys only.
      • '4dir', or 2 : Simulate up, down, left or right cursor keys.
      • '8dir', or 3 : Simulate up, up-left, up-right, down, down-left, down-right, left, or right cursor keys.
    • forceMin : Cursor keys will be pressed when force is larger then this value.
      • force : Distance between position of base game object to touch pointer
    • enable : Set false to disable cursor keys simulation.
    "},{"location":"virtualjoystick/#set-vector","title":"Set vector","text":"
    • Set vector
      controller.setVector(x0, y0, x1, y1);\n
    • Clear vector
      controller.clearVector();\n
    "},{"location":"virtualjoystick/#state-of-cursor-keys_1","title":"State of cursor keys","text":"
    var cursorKeys = controller.createCursorKeys();\n\nvar leftKeyDown = cursorKeys.left.isDown;\nvar rightKeyDown = cursorKeys.right.isDown;\nvar upKeyDown = cursorKeys.up.isDown;\nvar downKeyDown = cursorKeys.down.isDown;\n
    "},{"location":"virtualjoystick/#force-angle_1","title":"Force & Angle","text":"
    var force = controller.force;\nvar forceX = controller.forceX;\nvar forceY = controller.forceY;\n\nvar angle = controller.angle;  // degree between -180 to 180\nvar rotation = controller.rotation; // radians\n
    "},{"location":"waitevents/","title":"Wait events","text":""},{"location":"waitevents/#introduction","title":"Introduction","text":"

    Wait fired events or callbacks.

    • Author: Rex
    "},{"location":"waitevents/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"waitevents/#install-plugin","title":"Install plugin","text":""},{"location":"waitevents/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexwaiteventsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexwaiteventsplugin.min.js', true);\n
    • Create instance
      var waitEvents = scene.plugins.get('rexwaiteventsplugin').add(completeCallback, completeCallbackScope);\n
    "},{"location":"waitevents/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import WaitEventsPlugin from 'phaser3-rex-plugins/plugins/waitevents-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexWaitEvents',\nplugin: WaitEventsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var waitEvents = scene.plugins.get('rexWaitEvents').add(completeCallback, completeCallbackScope);\n
    "},{"location":"waitevents/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import WaitEvents from 'phaser3-rex-plugins/plugins/waitevents.js';\n
    • Create instance
      var waitEvents = new WaitEvents(completeCallback, completeCallbackScope);\n
    "},{"location":"waitevents/#create-instance","title":"Create instance","text":"
    var waitEvents = scene.plugins.get('rexWaitEvents').add(completeCallback, completeCallbackScope);\n
    • completeCallback, completeCallbackScope : Callback when all waitting events are fired.
    "},{"location":"waitevents/#set-complete-callback","title":"Set complete callback","text":"
    waitEvents.setCompleteCallback(completeCallback, completeCallbackScope);\n
    • completeCallback, completeCallbackScope : Callback when all waitting events are fired.
    "},{"location":"waitevents/#add-waiting-event","title":"Add waiting event","text":""},{"location":"waitevents/#callback","title":"Callback","text":"
    var callback = waitEvents.waitCallback();\n
    • callback : A function object which invoked when waitting event finished.

    For example, invokes completeCallback when all timers are time-out.

    scene.time.delayedCall(500, waitEvents.waitCallback());\nscene.time.delayedCall(1000, waitEvents.waitCallback());\nscene.time.delayedCall(1500, waitEvents.waitCallback());\n
    "},{"location":"waitevents/#callback-from-event-emitter","title":"Callback from event emitter","text":"
    waitEvents.waitEvent(eventEmitter, eventName);\n
    "},{"location":"waitevents/#remove-waiting-event","title":"Remove waiting event","text":"
    callback();\n

    or

    waitEvents.remove(callback);\n
    • callback : A function object created via waitEvents.waitCallback()
    "},{"location":"waitevents/#clear-all-waiting-events","title":"Clear all waiting events","text":"
    waitEvents.clear();\n
    "},{"location":"waitevents/#no-wait-event","title":"No wait event","text":"
    var noWaitEvent = waitEvents.noWaitEvent;\n
    "},{"location":"webfontloader/","title":"Webfont loader","text":""},{"location":"webfontloader/#introduction","title":"Introduction","text":"

    Load web font by google webfont loader in payload or preload stage.

    • Author: Rex
    • Custom File of loader
    "},{"location":"webfontloader/#live-demos","title":"Live demos","text":"
    • Webfont loader
    "},{"location":"webfontloader/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"webfontloader/#install-plugin","title":"Install plugin","text":""},{"location":"webfontloader/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      var sceneConfig = {\n// ....\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'rexwebfontloaderplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/    rexwebfontloaderplugin.min.js',\nstart: true\n}]\n}\n};\nclass MyScene extends Phaser.Scene {\nconstructor() {\nsuper(sceneConfig)\n}\n// ....\n\npreload() {\n// rexwebfontloaderplugin will be installed before preload(), but not added to loader yet\n// Call addToScene(scene) to add this await loader to loader of this scene\nthis.plugins.get('rexwebfontloaderplugin').addToScene(this);\n\nthis.load.rexWebFont(config);\n}\n}\n
    "},{"location":"webfontloader/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import WebFontLoaderPlugin from 'phaser3-rex-plugins/plugins/webfontloader-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexWebFontLoader',\nplugin: WebFontLoaderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In preload stage
      scene.load.rexWebFont(config);\n
    "},{"location":"webfontloader/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import WebFontLoader from 'phaser3-rex-plugins/plugins/webfontloader.js';\n
    • Start loading task
      WebFontLoader.call(scene.load, config);\n
    "},{"location":"webfontloader/#load-webfont","title":"Load webfont","text":"

    In preload stage:

    this.load.rexWebFont({\ngoogle: {\nfamilies: ['Bangers']\n},\n// testString: undefined,\n// testInterval: 20,\n});\n
    • testString : To test if the font is loaded completed or not.
      • undefined : No testing. Default value.
      • A string : A test string for all fonts
      • An object, {fontFamily: testString} : Test string for a specific font family.
    • testInterval : Retry interval.

    or load font in pack

    var sceneConfig = {\nkey: '...',\npack: {\nfiles: [{\ntype: 'rexWebFont',\nkey: 'webfont',\nconfig: {\ngoogle: {\nfamilies: ['Bangers']\n},\n// testString: undefined,\n// testInterval: 20,\n}\n}\n]\n}\n};\n

    Configuration of loading fonts

    • Google webfont
      WebFontConfig = {\ngoogle: {\nfamilies: ['Droid Sans', 'Droid Serif:bold']\n}\n};\n
    • Custom font
      WebFontConfig = {\ncustom: {\nfamilies: ['My Font', 'My Other Font:n4,i4,n7'],\nurls: ['/fonts.css']\n}\n};\n
      and fonts.css
      @font-face {\nfont-family: 'My Font';\nsrc: ...;\n}\n@font-face {\nfont-family: 'My Other Font';\nfont-style: normal;\nfont-weight: normal; /* or 400 */\nsrc: ...;\n}\n@font-face {\nfont-family: 'My Other Font';\nfont-style: italic;\nfont-weight: normal; /* or 400 */\nsrc: ...;\n}\n@font-face {\nfont-family: 'My Other Font';\nfont-style: normal;\nfont-weight: bold; /* or 700 */\nsrc: ...;\n}\n
    "},{"location":"webfontloader/#events","title":"Events","text":"
    • fontactive event

      this.load.on('webfontactive', function(fileObj, familyName){});\n
    • fontinactive event

      this.load.on('webfontinactive', function(fileObj, familyName){});\n
    "},{"location":"webfontloader/#test-string","title":"Test string","text":"

    Add string parameter testString into config, to test if the font is loaded completed or not.

    1. Fill 0 within an internal canvas.
    2. Draw testString.
    3. Check if any pixel has non-zero value.
    "},{"location":"wrap/","title":"Wrap","text":""},{"location":"wrap/#introduction","title":"Introduction","text":"

    Wrap the given value between min and max, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"wrap/#usage","title":"Usage","text":"
    var result = Phaser.Math.Wrap(value, min, max);\n
    • value : The value to wrap.
    "},{"location":"xor/","title":"XOR","text":""},{"location":"xor/#introduction","title":"Introduction","text":"

    Encrypt or decrypt string by XOR algorithm.

    • Author: Rex
    • Methods
    "},{"location":"xor/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"xor/#install-plugin","title":"Install plugin","text":""},{"location":"xor/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexxorplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexxorplugin.min.js', true);\n
    • Encrypt, or decrypt
      var encResult = scene.plugins.get('rexxorplugin').Encrypt(src, pwd);\nvar decResult = scene.plugins.get('rexxorplugin').Decrypt(encResult, pwd);\n
    "},{"location":"xor/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import XORPlugin from 'phaser3-rex-plugins/plugins/xor-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexXOR',\nplugin: XORPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Encrypt, or decrypt
      var encResult = scene.plugins.get('rexXOR').Encrypt(src, pwd);\nvar decResult = scene.plugins.get('rexXOR').Decrypt(encResult, pwd);\n
    "},{"location":"xor/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import XOR from 'phaser3-rex-plugins/plugins/xor.js';\n
    • Encrypt, or decrypt
      var encResult = XOR.Encrypt(src, pwd);\nvar decResult = XOR.Decrypt(encResult, pwd);\n
    "},{"location":"xor/#encrypt","title":"Encrypt","text":"
    var encResult = scene.plugins.get('rexXOR').Encrypt(src, pwd);\n
    "},{"location":"xor/#decrypt","title":"Decrypt","text":"
    var decResult = scene.plugins.get('rexXOR').Decrypt(encResult, pwd);\n
    "},{"location":"ymlachievements/","title":"YAML Achievements","text":""},{"location":"ymlachievements/#introduction","title":"Introduction","text":"

    Achievements in a YAML table.

    • Author: Rex
    • Member of scene
    "},{"location":"ymlachievements/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ymlachievements/#install-plugin","title":"Install plugin","text":""},{"location":"ymlachievements/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexymlachievementsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexymlachievementsplugin.min.js', true);\n
    • Add conditions-table object
      var achievements = scene.plugins.get('rexymlachievementsplugin').add();\n
    "},{"location":"ymlachievements/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AchievementsPlugin from 'phaser3-rex-plugins/plugins/ymlachievements-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAchievements',\nplugin: AchievementsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add conditions-table object
      var achievements = scene.plugins.get('rexAchievements').add();\n
    "},{"location":"ymlachievements/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Achievements from 'phaser3-rex-plugins/plugins/ymlachievements.js';\n
    • Add conditions-table object
      var achievements = new Achievements();\n
    "},{"location":"ymlachievements/#create-instance","title":"Create instance","text":"
    var achievements = scene.plugins.get('rexAchievements').add();\n
    "},{"location":"ymlachievements/#load-table-from-yaml-string","title":"Load table from YAML string","text":"
    achievements.loadYML(ymlString);\n

    For exameple

    Lv1 :\nAch1 : (A >= 10) && (A < 20)\nAch2 : (A >= 20) && (A < 50)\nAch3 : A >= 50\n

    Equations will be parsed by expression-parser.

    "},{"location":"ymlachievements/#test","title":"Test","text":"
    1. Run test
      var achievements.runTest(levelName, values);\n
      • levelName : Level name, in 1st column of achievements table.
      • values : Inputs in Key-value pairs
    2. Get obtained states
      var states = achievements.getObtainedState(levelName);\n
      • states : Obtained states of levelName
        {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n
        • wasObtained : Obtained this achievement achievementName before last testing.
        • justObtained : Obtained this achievement achievementName at last testing.

    or

    var states = achievements.getTestResults(levelName, values);\n
    "},{"location":"ymlachievements/#get-obtained-states","title":"Get obtained states","text":"
    • Get obtained states of an achievement in a level
      var state = achievements.getObtainedState(levelName, achievementName);\n
      • state : Obtained states of achievementName, in level levelName
        {\nwasObtained: boolean,\njustObtained: boolean\n}\n
        • wasObtained : Obtained this achievement achievementName before last testing.
        • justObtained : Obtained this achievement achievementName at last testing.
    • Get obtained states of a level
      var state = achievements.getObtainedState(levelName);\n
      • states : Obtained states of levelName
        {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n
    • Get obtained states of all levels
      var state = achievements.getObtainedState();\n// var state = achievements.getObtainedStates();\n
      • states : Obtained states of all levels
        {\nlevelName: {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n}\n
    • For each obtained state in a level
      achievements.forEachObtainedState(levelName, function(levelName, achievementName, state) {\n\n}, scope)\n
      • state : Obtained states of achievementName, in level levelName
        {\nwasObtained: boolean,\njustObtained: boolean\n}\n
    "},{"location":"ymlachievements/#get-name","title":"Get name","text":"
    • Name of levels
      var names = achievements.getLevelNames();\n// var names = achievements.getLevelNames(out);\n
    • Name of achievements in a level
      var names = achievements.getAchievementNames(levelName);\n// var names = achievements.getAchievementNames(levelName, out);\n
    "},{"location":"ymlachievements/#save-load-obtained-states","title":"Save & load obtained states","text":"
    • Get obtained states
      var states = achievements.getObtainedStates();\n
    • Load obtained states
      achievements.loadObtainedStates(states);\n
    "},{"location":"ymlachievements/#set-obtained-state","title":"Set obtained state","text":"
    • Set wasObtained, justObtained properties to true.
      achievements.setObtainedState(levelName, achievementName);\n
    • Set wasObtained, justObtained properties to false.
      achievements.clearObtainedState(levelName, achievementName);\n// achievements.setObtainedState(levelName, achievementName, false);\n
    "},{"location":"ymlconditionstable/","title":"YAML Conditions table","text":""},{"location":"ymlconditionstable/#introduction","title":"Introduction","text":"

    Check conditions to find passed tests listed in a YAML table.

    • Author: Rex
    • Member of scene
    "},{"location":"ymlconditionstable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ymlconditionstable/#install-plugin","title":"Install plugin","text":""},{"location":"ymlconditionstable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexymlconditionstableplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexymlconditionstableplugin.min.js', true);\n
    • Add conditions-table object
      var conditionstable = scene.plugins.get('rexymlconditionstableplugin').add();\n
    "},{"location":"ymlconditionstable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ConditionsTablePlugin from 'phaser3-rex-plugins/plugins/ymlconditionstable-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexConditionsTable',\nplugin: ConditionsTablePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add conditions-table object
      var conditionstable = scene.plugins.get('rexConditionsTable').add();\n
    "},{"location":"ymlconditionstable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ConditionsTable from 'phaser3-rex-plugins/plugins/ymlconditionstable.js';\n
    • Add conditions-table object
      var conditionstable = new ConditionsTable();\n
    "},{"location":"ymlconditionstable/#create-instance","title":"Create instance","text":"
    var table = scene.plugins.get('rexConditionsTable').add();\n
    "},{"location":"ymlconditionstable/#load-table-from-yaml-string","title":"Load table from YAML string","text":"
    table.loadYML(ymlString);\n

    For exameple

    Test1 : (A >= 10) && (A <= 20)\nTest2 : B == 3\n

    Equations will be parsed by expression-parser.

    "},{"location":"ymlconditionstable/#test","title":"Test","text":""},{"location":"ymlconditionstable/#get-test-results","title":"Get test results","text":"
    var results = table.getTestResults(context);\n
    • context : Inputs in Key-value pairs
    • results : {name: boolean}, use OR operation to combine result of tests with the same name.
    "},{"location":"ymlconditionstable/#get-first-pass-test-name","title":"Get first pass test name","text":"
    var testName = table.anyPassTest(context);\n
    • context : Inputs in Key-value pairs
    "},{"location":"youtubeplayer/","title":"Youtube player","text":""},{"location":"youtubeplayer/#introduction","title":"Introduction","text":"

    Play youtube video on iframe.

    • Author: Rex
    • DOM Game object
    "},{"location":"youtubeplayer/#live-demos","title":"Live demos","text":"
    • Youtube player
    "},{"location":"youtubeplayer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"youtubeplayer/#install-plugin","title":"Install plugin","text":""},{"location":"youtubeplayer/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexyoutubeplayerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexyoutubeplayerplugin.min.js', true);\n
    • Add youtube player object
      var youtubePlayer = scene.add.rexYoutubePlayer(x, y, width, height, config);\n
    "},{"location":"youtubeplayer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import YoutubePlayerPlugin from 'phaser3-rex-plugins/plugins/youtubeplayer-plugin.js';\nvar config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexYoutubePlayer',\nplugin: YoutubePlayerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Add youtube player object
      var youtubePlayer = scene.add.rexYoutubePlayer(x, y, width, height, config);\n
    "},{"location":"youtubeplayer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import YoutubePlayer from 'phaser3-rex-plugins/plugins/youtubeplayer.js';\n
    • Add youtube player object
      var youtubePlayer = new YoutubePlayer(scene, x, y, width, height, config);\nscene.add.existing(youtubePlayer);\n
    "},{"location":"youtubeplayer/#add-youtube-player-object","title":"Add youtube player object","text":"
    • Youtube player on DOM
      var player = scene.add.rexYoutubePlayer(x, y, width, height, config);\n// var player = scene.add.rexYoutubePlayer(x, y, config);\n// var player = scene.add.rexYoutubePlayer(config);\n

    Default configuration

    {\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\nvideoId: '',\nautoPlay: true,\ncontrols: false,\nkeyboardControl: true,\nmodestBranding: false,\nloop: false,\n}\n
    • x, y : Position
    • width, height : Size of element
    • videoId : The YouTube video ID that identifies the video that the player will load.
    • autoPlay : Automatically start to play when the player loads.
    • controls : Whether the video player controls are displayed.
    • keyboardControl : Set false to disable keyboard controls.
    • modestBranding : Set false to prevent the YouTube logo from displaying in the control bar.
    • loop : Play video when ended.
    "},{"location":"youtubeplayer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyYoutubePlayer extends YoutubePlayer {  // or YoutubePlayerCanvas\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta)\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var player = new MyYoutubePlayer(scene, x, y, width, height, config);\n
    "},{"location":"youtubeplayer/#load","title":"Load","text":"
    player.load(videoId);\n// player.load(videoId, autoPlay);\n
    "},{"location":"youtubeplayer/#play","title":"Play","text":"
    player.play();\n
    "},{"location":"youtubeplayer/#pause","title":"Pause","text":"
    player.pause();\n
    "},{"location":"youtubeplayer/#playback-time","title":"Playback time","text":"
    • Get
      var playbackTime = player.playbackTime; // time in seconds\n
      var t = player.t; // t: 0~1\n
    • Set
      player.setPlaybackTime(time); // time in seconds\n// player.playbackTime = time;\n
      player.setT(t); // t: 0~1\n// player.t = t;\n
    "},{"location":"youtubeplayer/#duration","title":"Duration","text":"
    var duration = player.duration;  // time in seconds\n
    "},{"location":"youtubeplayer/#volume","title":"Volume","text":"
    • Get
      var volume = player.volume;  // volume: 0~1\n
    • Set
      player.setVolume(volume);  // volume: 0~1\n// player.volume = volume;\n
    "},{"location":"youtubeplayer/#mute","title":"Mute","text":"
    • Get
      var muted = player.muted;  // muted: true/false\n
    • Set
      player.setMute(muted);  // muted: true/false\n// player.muted = muted;\n
    "},{"location":"youtubeplayer/#loop","title":"Loop","text":"
    • Get
      var loop = player.loop;  // loop: true/false\n
    • Set
      player.setLoop(loop);  // loop: true/false\n// player.loop = loop;\n
    "},{"location":"youtubeplayer/#resize","title":"Resize","text":"
    player.resize(width, height);\n
    "},{"location":"youtubeplayer/#status","title":"Status","text":"
    • Is playing
      var isPlaying = player.isPlaying;\n
    • Is paused
      var isPaused = player.isPaused;\n
    • Has end
      var hasEnded = player.hasEnded;\n
    • Video state
      var videoState = player.videoState;\n
      or
      var videoStateString = player.videoStateString;\n
      • -1 : unstarted
      • 0 : ended
      • 1 : playing
      • 2 : paused
      • 3 : buffering
      • 5 : cued
    "},{"location":"youtubeplayer/#events","title":"Events","text":"
    • Youtube player api ready
      player.on('ready', function(player){ }, scope);\n
    • State change
      player.on('statechange', function(player){ }, scope);\n
      • State : player.videoState
    • Unstarted
      player.on('unstarted', function(player){ }, scope);\n
    • Playing
      player.on('playing', function(player){ }, scope);\n
    • Pause
      player.on('pause', function(player){ }, scope);\n
    • Ended
      player.on('ended', function(player){ }, scope);\n
    • Buffering
      player.on('buffering', function(player){ }, scope);\n
    • Video cued
      player.on('cued', function(player){ }, scope);\n
    • Error
      player.on('error', function(player, errorMessage){ }, scope);\n

    No Playback time changed event

    Get playback time every tick might cause playing video lagging.

    "},{"location":"youtubeplayer/#other-properties","title":"Other properties","text":"

    See dom game object, game object

    "},{"location":"youtubeplayer/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"zone/","title":"Zone","text":""},{"location":"zone/#introduction","title":"Introduction","text":"

    Non-rendering rectangular game object for creating drop zones and input hit areas, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"zone/#usage","title":"Usage","text":""},{"location":"zone/#add-zone-object","title":"Add zone object","text":"
    var zone = scene.add.zone(x, y, width, height);\n

    Add zone from JSON

    var zone = scene.make.zone({\nx: 0,\ny: 0,\n//width: 1,\n//height: 1,\n// origin: {x: 0.5, y: 0.5},\n});\n
    "},{"location":"zone/#custom-class","title":"Custom class","text":"
    • Define class
      class MyZone extends Phaser.GameObjects.Zone {\nconstructor(scene, x, y, width, height) {\nsuper(scene, x, y, width, height);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var zone = new MyZone(x, y, width, height);\n
    "},{"location":"zone/#input-hit-zone","title":"Input hit zone","text":"
    zone.setInteractive();\n

    See touch events

    "},{"location":"zone/#drop-zones","title":"Drop zones","text":"
    • Default drop zone
      zone.setDropZone();\n
    • Rectangle drop zone
      zone.setRectangleDropZone(width, height);\n
    • Circular drop zone
      zone.setCircleDropZone(radius);\n
    • Custom drop zone
      zone.setDropZone(shape, callback);\n
      • callback
        function(shape, x, y, gameObject) {\nreturn hit;  // true/false\n}\n

    See drop zone

    "},{"location":"zone/#other-properties","title":"Other properties","text":"

    See game object

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Home","text":""},{"location":"#phaser","title":"Phaser","text":"

    Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

    "},{"location":"#links","title":"Links","text":""},{"location":"#phaser3","title":"Phaser3","text":"
    • FAQ
    • Official discord channel
    • API document
    • Examples
    • Bug report
    "},{"location":"#rex-plugins","title":"Rex plugins","text":"
    • Plugin list
      • Demos
    • Discord channel
    • Bug report
    • Feature suggestion & discussion
    "},{"location":"achievements/","title":"CSV Achievements","text":""},{"location":"achievements/#introduction","title":"Introduction","text":"

    Achievements in a csv table.

    • Author: Rex
    • Member of scene
    "},{"location":"achievements/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"achievements/#install-plugin","title":"Install plugin","text":""},{"location":"achievements/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexachievementsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexachievementsplugin.min.js', true);\n
    • Add conditions-table object
      var achievements = scene.plugins.get('rexachievementsplugin').add();\n
    "},{"location":"achievements/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AchievementsPlugin from 'phaser3-rex-plugins/plugins/achievements-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAchievements',\nplugin: AchievementsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add conditions-table object
      var achievements = scene.plugins.get('rexAchievements').add();\n
    "},{"location":"achievements/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Achievements from 'phaser3-rex-plugins/plugins/achievements.js';\n
    • Add conditions-table object
      var achievements = new Achievements();\n
    "},{"location":"achievements/#create-instance","title":"Create instance","text":"
    var achievements = scene.plugins.get('rexAchievements').add();\n
    "},{"location":"achievements/#load-table-from-csv-string","title":"Load table from csv string","text":"
    achievements.loadCSV(csvString, {\n// delimiter: ','\n});\n

    For exameple, csv string

    A A Lv1 Ach1 >= 10 < 20 Lv1 Ach2 >= 20 < 50 Lv1 Ach3 >= 50
    ,A,A\nLv1,Ach1,>= 10,<= 20,\nLv1,Ach2,>= 20,< 50,\nLv1,Ach3,>= 50,,\n
    • 1st column : Level names
    • 2nd column : Achievement names
    • Other columns : Condtions
    • 1st row : Variable names of conditions.

    means that:

    Lv1, Ach1: (A>=10) && (A<20)\nLv1, Ach2: (A>=20) && (A<50)\nLv1, Ach3: (A>=50)\n
    "},{"location":"achievements/#test","title":"Test","text":"
    1. Run test
      var achievements.runTest(levelName, values);\n
      • levelName : Level name, in 1st column of achievements table.
      • values : Inputs in Key-value pairs
    2. Get obtained states
      var states = achievements.getObtainedState(levelName);\n
      • states : Obtained states of levelName
        {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n
        • wasObtained : Obtained this achievement achievementName before last testing.
        • justObtained : Obtained this achievement achievementName at last testing.

    or

    var states = achievements.getTestResults(levelName, values);\n
    "},{"location":"achievements/#get-obtained-states","title":"Get obtained states","text":"
    • Get obtained states of an achievement in a level
      var state = achievements.getObtainedState(levelName, achievementName);\n
      • state : Obtained states of achievementName, in level levelName
        {\nwasObtained: boolean,\njustObtained: boolean\n}\n
        • wasObtained : Obtained this achievement achievementName before last testing.
        • justObtained : Obtained this achievement achievementName at last testing.
    • Get obtained states of a level
      var state = achievements.getObtainedState(levelName);\n
      • states : Obtained states of levelName
        {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n
    • Get obtained states of all levels
      var state = achievements.getObtainedState();\n// var state = achievements.getObtainedStates();\n
      • states : Obtained states of all levels
        {\nlevelName: {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n}\n
    • For each obtained state in a level
      achievements.forEachObtainedState(levelName, function(levelName, achievementName, state) {\n\n}, scope)\n
      • state : Obtained states of achievementName, in level levelName
        {\nwasObtained: boolean,\njustObtained: boolean\n}\n
    "},{"location":"achievements/#get-name","title":"Get name","text":"
    • Name of levels
      var names = achievements.getLevelNames();\n// var names = achievements.getLevelNames(out);\n
    • Name of achievements in a level
      var names = achievements.getAchievementNames(levelName);\n// var names = achievements.getAchievementNames(levelName, out);\n
    "},{"location":"achievements/#save-load-obtained-states","title":"Save & load obtained states","text":"
    • Get obtained states
      var states = achievements.getObtainedStates();\n
    • Load obtained states
      achievements.loadObtainedStates(states);\n
    "},{"location":"achievements/#set-obtained-state","title":"Set obtained state","text":"
    • Set wasObtained, justObtained properties to true.
      achievements.setObtainedState(levelName, achievementName);\n
    • Set wasObtained, justObtained properties to false.
      achievements.clearObtainedState(levelName, achievementName);\n// achievements.setObtainedState(levelName, achievementName, false);\n
    "},{"location":"alphamaskimage/","title":"Alpha mask image","text":""},{"location":"alphamaskimage/#introduction","title":"Introduction","text":"

    Load a texture, then apply an alpha mask from another texture. Extended from canvas plugin.

    • Author: Rex
    • Game object
    "},{"location":"alphamaskimage/#live-demos","title":"Live demos","text":"
    • Alpha-mask-image
    "},{"location":"alphamaskimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"alphamaskimage/#install-plugin","title":"Install plugin","text":""},{"location":"alphamaskimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexalphamaskimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexalphamaskimageplugin.min.js', true);\n
    • Add alpha-mask-image object
      var image = scene.add.rexAlphaMaskImage(x, y, key, frame, config);\n
    "},{"location":"alphamaskimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AlphaMaskImagePlugin from 'phaser3-rex-plugins/plugins/alphamaskimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAlphaMaskImagePlugin',\nplugin: AlphaMaskImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add alpha-mask-image object
      var image = scene.add.rexAlphaMaskImage(x, y, key, frame, config);\n
    "},{"location":"alphamaskimage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import AlphaMaskImage from 'phaser3-rex-plugins/plugins/alphamaskimage.js';\n
    • Add alpha-mask-image object
      var image = new AlphaMaskImage(scene, x, y, key, frame, config);\nscene.add.existing(image);\n
    "},{"location":"alphamaskimage/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAlphaMaskImagePlugin',\nplugin: AlphaMaskImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"alphamaskimage/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexAlphaMaskImage(x, y, key, frame, {\nmask: {\nkey: textureKey,\n// frame: frameName,\n// invertAlpha: false,\n// scale: undefined,\n}\n\n// backgroundColor: undefined,\n});\n

    or

    var image = scene.add.rexAlphaMaskImage(x, y, key, {\nmask: {\nkey: textureKey,\n// frame: frameName,\n// invertAlpha: false,\n// scale: undefined,\n}\n\n// backgroundColor: undefined,\n});\n
    • key, frame : Texture key, frame name of target texture.
    • mask.key, mask.frame : Texture key, frame name of the mask texture.
    • mask.invertAlpha :
      • false : Mask non-alpha (alpha === 0) area. Default behavior.
      • true : Mask alpha (alpha > 0) area.
    • mask.scale :
      • undefined : Expand mask texture size to fit target texture.
      • A number : Scale mask texture size.
    • backgroundColor : Background color filled with masked area.
      • undefiined : No background color.

    Add image from JSON

    var image = scene.make.rexAlphaMaskImage({\nx: 0,\ny: 0,\nkey: key,\nframe: name,\nmask: {\nkey: textureKey,\n// frame: frameName,\n// invertAlpha: false,\n// scale: undefined,\n}\n\n// backgroundColor: undefined,\n\nadd: true\n});\n
    "},{"location":"alphamaskimage/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImage extends AlphaMaskImage {\nconstructor(scene, x, y, key, frame, config) {\nsuper(scene, x, y, key, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImage(scene, key, frame, config);\n
    "},{"location":"alphamaskimage/#set-texture","title":"Set texture","text":"
    image.setTexture(key, frame);\n// image.setTexture(key, frame, mask);\n

    or

    image.setTexture(key, frame, {\nmask: {\nkey: textureKey,\n// frame: frameName,\n// invertAlpha: false,\n// scale: undefined,\n}\n\n// backgroundColor: undefined,\n});\n
    • mask.key, mask.frame : Texture key, frame name of the mask texture.
    • mask.invertAlpha :
      • false : Mask non-alpha (alpha === 0) area. Default behavior.
      • true : Mask alpha (alpha > 0) area.
    • mask.scale :
      • undefined : Expand mask texture size to fit target texture.
      • A number : Scale mask texture size.
    • backgroundColor : Background color filled with masked area.
      • undefiined : No background color.
    "},{"location":"alphamaskimage/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"alphamaskimage/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"alphamaskimage/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"anchor/","title":"Anchor","text":""},{"location":"anchor/#introduction","title":"Introduction","text":"

    Set size and position based on visible window.

    Note

    Visible window will be changed when scale mode is ENVELOP, WIDTH_CONTROLS_HEIGHT, or HEIGHT_CONTROLS_WIDTH.

    • Author: Rex
    • Behavior of game object
    "},{"location":"anchor/#live-demos","title":"Live demos","text":"
    • Anchor
    • Resize
    • Camera zoom/scroll
    "},{"location":"anchor/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"anchor/#install-plugin","title":"Install plugin","text":""},{"location":"anchor/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexanchorplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexanchorplugin.min.js', true);\n
    • Add anchor behavior
      var anchor = scene.plugins.get('rexanchorplugin').add(gameObject, config);\n
    "},{"location":"anchor/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AnchorPlugin from 'phaser3-rex-plugins/plugins/anchor-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAnchor',\nplugin: AnchorPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add anchor behavior
      var anchor = scene.plugins.get('rexAnchor').add(gameObject, config);\n
    "},{"location":"anchor/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Anchor from 'phaser3-rex-plugins/plugins/anchor.js';\n
    • Add anchor behavior
      var anchor = new Anchor(gameObject, config);\n
    "},{"location":"anchor/#create-instance","title":"Create instance","text":"
    var anchor = scene.plugins.get('rexAnchor').add(gameObject, {\n// left: '0%+0',\n// right: '0%+0',\n// centerX: '0%+0',\n// x: '0%+0',\n\n// top: '0%+0',\n// bottom: '0%+0',\n// centerY: '0%+0',\n// y: '0%+0',\n\n// width: '100%+0',\n// height: '100%+0',\n// onResizeCallback: function(width, height, gameObject, anchor) {},\n// onResizeCallbackScope: undefined,\n\n// onUpdateViewportCallback: function(viewport, gameObject, anchor) {},\n// onUpdateViewportCallbackScope: undefined,\n\n// enable: true\n});\n
    • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • 'left'(=0%), 'center'(=50%), 'right'(=100%)
        • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
      • Offset : '+n', or '-n'.

    For example, anchor game object's left bound to viewport's left+10, centerY to viewport's center

    {\nleft: 'left+10',\ncenterY: 'center'\n}\n
    • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0 ~ 100.
      • Padding : '+n', or '-n'.
    • onResizeCallback, onResizeCallbackScope : Callback of resizing game object
      • undefined : Default resize method.
      • Custom method
        function(width, height, gameObject, anchor) {\n// gameObject.setSize(width, height);\n// gameObject.setDisplaySize(width, height);\n// ...\n}\n
      • null or false : No callback
    • onUpdateViewportCallback, onUpdateViewportCallback : Callback invoked when viewport changed (anchor)

      fucntion(viewport, gameObject, anchor) {\n// Can change properties of viewport here\n// var centerX = viewport.centerX,\n//     centerY = viewport.centerY;\n// viewport.width *= 0.8;\n// viewport.height *= 0.9;\n// viewport.centerX = centerX;\n// viewport.centerY = centerY;\n}\n

      • viewport\uff1a A rectangle object
    • enable :

      • undefined, or true : Anchor game object under 'resize' event of scale manager.
      • false : Won't anchor game object automatially.
    "},{"location":"anchor/#reset-config","title":"Reset config","text":"
    anchor.resetFromJSON({\n// left: '0%+0',\n// right: '0%+0',\n// centerX: '0%+0',\n// x: '0%+0',\n\n// top: '0%+0',\n// bottom: '0%+0',\n// centerY: '0%+0',\n// y: '0%+0',\n\n// width: '100%+0',\n// height: '100%+0',    \n\n// onUpdateViewportCallback: function(viewport, gameObject, anchor) {}\n// onUpdateViewportCallbackScope: undefined,\n})\n
    • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0~100
        • 'left'(=0%), 'center'(=50%), 'right'(=100%)
        • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
      • Offset : '+n', or '-n'
    • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0 ~ 100.
      • Padding : '+n', or '-n'.
    • onResizeCallback, onResizeCallbackScope : Callback of resizing game object
      function(width, height, gameObject, anchor) {\n// gameObject.setSize(width, height);\n// gameObject.setDisplaySize(width, height);\n// ...\n}\n
    "},{"location":"anchor/#set-onupdateviewport-callback","title":"Set OnUpdateViewport callback","text":"
    anchor.setUpdateViewportCallback(callback, scope);\n
    • callback :
      fucntion(viewport, gameObject, anchor) {\n// Can change properties of viewport here\n// var centerX = viewport.centerX,\n//     centerY = viewport.centerY;\n// viewport.width *= 0.8;\n// viewport.height *= 0.9;\n// viewport.centerX = centerX;\n// viewport.centerY = centerY;\n}\n
      • viewport\uff1a A rectangle object
    "},{"location":"anchor/#manual-anchor","title":"Manual anchor","text":"
    anchor.anchor();\n
    "},{"location":"anchor/#auto-anchor","title":"Auto anchor","text":"
    • Anchor game object under 'resize' event of scale manager.
      anchor.autoAnchor();\n// anchor.autoAnchor(true);\n
    • Disable auto-anchor
      anchor.autoAnchor(false);\n
    "},{"location":"angle/","title":"Angle","text":""},{"location":"angle/#introduction","title":"Introduction","text":"

    Convert angle value, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"angle/#usage","title":"Usage","text":""},{"location":"angle/#degree-radians","title":"Degree <-> Radians","text":"
    • Degree to radians
      var rad = Phaser.Math.DegToRad(deg);\n
    • Radians to degree
      var deg = Phaser.Math.RadToDeg(rad);  // deg : -180 ~ 180\n
    "},{"location":"angle/#wrap","title":"Wrap","text":"
    • Wrap angle (radians) in the range of -PI to PI
      var rad = Phaser.Math.Angle.Wrap(angle);\n
    • Wrap angle (radians) in the range of 0 to 2*PI
      var rad = Phaser.Math.Angle.Normalize(angle);\n
    • Wrap angle (degrees) in the range of -180 to 180
      var deg = Phaser.Math.Angle.WrapDegrees(angle);\n
    "},{"location":"angle/#angle-between-points","title":"Angle between points","text":"
    • Angle from (0,0) to vector (x2 - x1 , y2 - y1)
      var rad = Phaser.Math.Angle.Between(x1, y1, x2, y2);\n
      var rad = Phaser.Math.Angle.BetweenPoints(point1, point2);\n
    "},{"location":"angle/#angle-between-angles","title":"Angle between angles","text":"
    • Shortest angle (degrees) between 2 angles
      var deg = Phaser.Math.Angle.ShortestBetween(angle1, angle2)\n
      • angle1, angle2 : Angle in degrees in the range of -180 to 180
      • deg : Shortest angle in degrees
        • deg > 0 : Counter-ClockWise rotation
        • deg < 0 : ClockWise rotation
    "},{"location":"angle/#rotate-around-position","title":"Rotate around position","text":"
    • Rotate a point around x and y by the given angle.
      var out = Phaser.Math.RotateAround(point, x, y, angle);\n
    • Rotate a point around x and y by the given angle and distance.
      var out = Phaser.Math.RotateAroundDistance(point, x, y, angle, distance);\n
    "},{"location":"angle/#rotate-to-angle","title":"Rotate to angle","text":"
    var rad = Phaser.Math.Angle.RotateTo(currentAngle, targetAngle, lerp)\n
    • currentAngle, : The current angle, in radians.
    • targetAngle : The target angle to rotate to, in radians.
    • lerp : The lerp value to add to the current angle.
    "},{"location":"angle/#random-angle","title":"Random angle","text":"
    • Returns a random angle in the range [-pi, pi].
      var angle = Phaser.Math.Angle.Random();\n
    • Returns a random angle in the range [-180, 180].
      var angle = Phaser.Math.Angle.RandomDegrees();\n
    "},{"location":"animation/","title":"Animation","text":""},{"location":"animation/#introduction","title":"Introduction","text":"

    Animation and animations manager.

    • Author: Richard Davey
    "},{"location":"animation/#usage","title":"Usage","text":""},{"location":"animation/#animation-manager","title":"Animation manager","text":""},{"location":"animation/#add-animation","title":"Add animation","text":"
    var animationConfig = {\nkey: '',\n\nframes: [],\n\nsortFrames: true,\ndefaultTextureKey: null,\nskipMissedFrames: true,\nrandomFrame: false,\n\n// time\ndelay: 0,\nduration: null,\nframeRate: null,\ntimeScale: 1,\n\n// repeat\nrepeat: 0,              // set to (-1) to repeat forever\nrepeatDelay: 0,\nyoyo: false,\n\n// visible\nshowBeforeDelay: false,\nshowOnStart: false,\nhideOnComplete: false\n};\n\nscene.anims.create(animationConfig);\n
    • key : Unique key of this animation data
    • frames : An array of {key, frame}
      • Properties
        {\nkey: '',\nframe: '', // string, or number\nduration: 0\n}\n
        • duration : The duration, in ms, of this frame of the animation.
      • A string : Texture key.
      • Every frame in the atlas
        scene.anims.generateFrameNames(key);\n
      • Frame sequence indexing from start to end
        var config = ;\nscene.anims.generateFrameNames(key,\n{\nprefix: '',\nstart: 0,\nend: 0,\nsuffix: '',\nzeroPad: 0,\n// outputArray: [], // Append frames into this array\n});\n
        • prefix + Pad(i, zeroPad, '0', 1) + suffix, i: start ~ end
      • Custom frame sequence
        var config = ;\nscene.anims.generateFrameNames(key,\n{\nprefix: '',\nsuffix: '',\nzeroPad: 0,\nframes: [ ... ]\n// outputArray: [], // Append frames into this array\n});\n
        • prefix + Pad(frames[i], zeroPad, '0', 1) + suffix
    • sortFrames : Frame names numerically sorted. Default value is true.
    • defaultTextureKey : The key of the texture all frames of the animation will use. Can be overridden on a per frame basis.
    • skipMissedFrames : Skip frames if the time lags, or always advanced anyway? Default value is true.
    • randomFrame : Start playback of this animation from a randomly selected frame? Default value is false.
    • delay : Delay before starting playback. Value given in milliseconds.
    • duration : How long the animation should play for in milliseconds. If not given its derived from frameRate.
    • frameRate : The frame rate of playback in frames per second. Default value is 24.
    • timeScale : The time scale to be applied to playback of this animation. Default value is 1.
    • repeat : Number of times to repeat the animation. Default value is 0.
      • -1 : Infinity
    • repeatDelay : Delay before the animation repeats. Value given in milliseconds.
    • yoyo : Should the animation yoyo? (reverse back down to the start) before repeating? Default value is false.
    • showBeforeDelay : If this animation has a delay, should it show the first frame immediately (true), or only after the delay (false)
    • showOnStart : Should sprite.visible = true when the animation starts to play? This happens after any delay, if set. Default value is false.
    • hideOnComplete : Should sprite.visible = false when the animation finishes? Default value is false.
    "},{"location":"animation/#add-from-aseprite","title":"Add from Aseprite","text":"

    Aseprite

    scene.anims.createFromAseprite(key);\n// scene.anims.createFromAseprite(key, tags, target);\n
    • key : The key of the loaded Aseprite atlas.
    • tags :
      • undefined : Load all tags.
      • Array of string tag : Load these tags.
    • target : Create the animations on this target Sprite.
      • undefined : Created globally in this Animation Manager. Default behavior.
    "},{"location":"animation/#remove-animation","title":"Remove animation","text":"
    scene.anims.remove(key);\n
    "},{"location":"animation/#delay-between-two-animations","title":"Delay between two animations","text":"
    • Add
      scene.anims.addMix(animA, animB, delay);\n
      • animA, animB : String key of an animation, or an instance of animation.
    • Remove
      scene.anims.removeMix(animA, animB);\n// scene.anims.removeMix(animA);\n
    • Get
      var delay = scene.anims.getMix(animA, animB);\n
    "},{"location":"animation/#play-animation","title":"Play animation","text":"
    • Play
      scene.anims.play(key, children);\n
    • Stagger play (delay play)
      scene.anims.staggerPlay(key, children, stagger, staggerFirst);\n
      • children : An array of Game Objects to play the animation on
      • stagger : The amount of time, in milliseconds, to offset each play time by
      • staggerFirst : Set true to apply delay on 1st child
    "},{"location":"animation/#pause-all-animations","title":"Pause all animations","text":"
    scene.anims.pauseAll();\n
    "},{"location":"animation/#resume-all-animations","title":"Resume all animations","text":"
    scene.anims.resumeAll();\n
    "},{"location":"animation/#global-time-scale","title":"Global time scale","text":"
    • Get
      var timeScale = scene.anims.globalTimeScale;\n
    • Set
      scene.anims.globalTimeScale = timeScale;\n
    "},{"location":"animation/#has-animation","title":"Has animation","text":"
    var hasAnim = scene.anims.exists(key);\n
    "},{"location":"animation/#exportload","title":"Export/load","text":"
    • Export JSON
      var json = scene.anims.toJSON();\n
    • Load from JSON
      scene.anims.fromJSON(json);\n// scene.anims.fromJSON(json, clearCurrentAnimations);\n
      • Load JSON in preload stage javascript scene.load.json(key, url);
      • Load animation in preload stage
        scene.load.animation(key, url);\n
    "},{"location":"animation/#events","title":"Events","text":"
    • On add animation
      scene.anims.on('add', function(key, anim) {});\n
    • On remove animation
      scene.anims.on('remove', function(key, anim) {});\n
    • On pause all animations
      scene.anims.on('pauseall', function() {});\n
    • On resume all animations
      scene.anims.on('resumeall', function() {});\n
    "},{"location":"animation/#animation-object","title":"Animation object","text":"
    var anim = scene.anims.get(key);\n
    "},{"location":"animation/#add-frame","title":"Add frame","text":"
    • Append frames
      anim.addFrame(frame);\n
      • frame : scene.anims.generateFrameNames(key, config)
    • Insert frames at index
      anim.addFrameAt(index, frame);\n
      • frame : scene.anims.generateFrameNames(key, config)
    "},{"location":"animation/#remove-frame","title":"Remove frame","text":"
    • Remove frame at
      anim.removeFrameAt(index);\n
    • Remove frame
      anim.removeFrame(frame);\n
    "},{"location":"animation/#get-frame","title":"Get frame","text":"
    • Has frame index
      var HasFrameAt = anim.checkFrame(index);\n
    • Get frame at index
      var frame = anim.getFrameAt(index);\n
    • Get last frame
      var frame = anim.getLastFrame();\n
    "},{"location":"animation/#export","title":"Export","text":"
    • Export JSON
      var json = anim.toJSON();\n
      or
      var jsonString = JSON.stringify(anim);\n
    "},{"location":"arcade-body/","title":"Body","text":""},{"location":"arcade-body/#introduction","title":"Introduction","text":"

    Arcade physics body.

    • Author: Richard Davey
    "},{"location":"arcade-body/#usage","title":"Usage","text":""},{"location":"arcade-body/#get-physics-body","title":"Get physics body","text":"
    1. Enable physics world
    2. Add existing game object(s) to physics world
      • Add a game object
        var gameObject = scene.physics.add.existing(gameObject, bodyType);\n
        • bodyType :
          • 0 : Dynamic body
          • 1 : Static body
      • Add game objects
        scene.physics.world.enable(gameObjects, bodyType);\n
        • gameObjects : An array of game objects, or a group object
        • bodyType :
          • 0 : Dynamic body
          • 1 : Static body
    3. Get physics body
      var body = gameObject.body;\n
    "},{"location":"arcade-body/#enable","title":"Enable","text":"

    Whether this Body is updated by the physics simulation.

    • Enable (default)
      body.setEnable();\n
      or
      body.enable = true;\n
    • Disable
      body.setEnable(false);\n
      or
      body.enable = false;\n
    "},{"location":"arcade-body/#direct-control","title":"Direct control","text":"

    Enable directControl when game object is controlled by tween or dragging. Default behavior is disable.

    • Enable
      body.setDirectControl();\n// body.setDirectControl(true);\n
      or
      body.directControl = true;\n
    • Disable
      body.setDirectControl(false);\n
      or
      body.directControl = false;\n
    "},{"location":"arcade-body/#immovable","title":"Immovable","text":"

    Whether this Body can be moved by collisions with another Body.

    • Enable
      body.setImmovable();\n// body.immovable = true;\n
    • Disable (defalut)
      body.setImmovable(false);\n// body.immovable = false;\n
    • Get
      var immovable = body.immovable;\n
    "},{"location":"arcade-body/#pushable","title":"Pushable","text":"

    Sets if this Body can be pushed by another Body.

    • Enable (default value of dynamic body)
      body.pushable = true;\n
    • Disable, reflect back all of the velocity it is given to the colliding body.
      body.pushable = false;\n
    • Get
      var pushable = body.pushable;\n
    "},{"location":"arcade-body/#moveable","title":"Moveable","text":"

    Whether the Body's position and rotation are affected by its velocity, acceleration, drag, and gravity.

    • Enable (default)
      body.moves = true;\n
    • Disable
      body.moves = false;\n
    • Get
      var moves = body.moves;\n
    "},{"location":"arcade-body/#destroy","title":"Destroy","text":"

    Physics body will be destroyed automatically when game object is destroyed.

    "},{"location":"arcade-body/#movement","title":"Movement","text":""},{"location":"arcade-body/#velocity","title":"Velocity","text":"
    • Set
      body.setVelocity(x,y);\n
      or
      body.setVelocityX(x);\nbody.setVelocityY(x);\n
    • Get
      var vx = body.velocity.x;\nvar vy = body.velocity.y;\n
    "},{"location":"arcade-body/#max-speed","title":"Max speed","text":"
    • Set
      body.setMaxSpeed(speed);\n
    • Get
      var speed = body.maxSpeed;\n
    "},{"location":"arcade-body/#max-velocity","title":"Max velocity","text":"
    • Set
      body.setMaxVelocity(x, y);\n
      or
      body.setMaxVelocityX(x);\nbody.setMaxVelocityY(y);\n
    • Get
      var vx = body.maxVelocity.x;\nvar vy = body.maxVelocity.y;\n
    "},{"location":"arcade-body/#acceleration","title":"Acceleration","text":"
    • Set
      body.setAcceleration(x, y);\n
      or
      body.setAccelerationX(x);\nbody.setAccelerationY(y);\n
    • Get
      var ax = body.acceleration.x;\nvar ay = body.acceleration.y;\n
    "},{"location":"arcade-body/#gravity","title":"Gravity","text":"
    • Set
      body.setGravity(x, y);\n
      or
      body.setGravityX(x);\nbody.setGravityY(y);\n
    • Get
      var gx = body.gravity.x;\nvar gy = body.gravity.y;\n
    • Enables (default)
      body.setAllowGravity();\n
    • Disable
      body.setAllowGravity(false);\n
    "},{"location":"arcade-body/#drag","title":"Drag","text":"

    Reduces speed per second.

    • Set
      body.setDrag(x, y);\n
      or
      body.setDragX(x);\nbody.setDragY(y);\n
    • Get
      var dx = body.drag.x;\nvar dy = body.drag.y;\n
    • Enables (default)
      body.setAllowDrag();\n
    • Disable
      body.setAllowDrag(false);\n
    • Enable Damping (default: disable)
      body.setDamping(true);\n// body.useDamping = true;\n
    "},{"location":"arcade-body/#slide-factor","title":"Slide factor","text":"

    The Slide Factor controls how much velocity is preserved when this Body is pushed by another Body.

    body.slideFactor.set(x, y);\n
    • x, y :
      • 1 : Take on all velocity given in the push. Default value.
      • 0 : Allow this Body to be pushed but then remain completely still after the push ends, such as you see in a game like Sokoban.
      • Other value between 0 ~ 1 : Keep x/y of the original velocity when the push ends.
        • Combine this with the setDrag() method to create deceleration.
    "},{"location":"arcade-body/#reset-position","title":"Reset position","text":"
    body.reset(x, y);\n
    "},{"location":"arcade-body/#stop","title":"Stop","text":"

    Sets acceleration, velocity, and speed to zero.

    body.stop();\n
    "},{"location":"arcade-body/#friction","title":"Friction","text":"

    If this Body is immovable and in motion, this the proportion of this Body's movement received by the riding body on each axis.

    • Set
      body.setFriction(x, y);\n
      or
      body.setFrictionX(x);\nbody.setFrictionY(y);\n
    • Get
      var fx = body.friction.x;\nvar fy = body.friction.y;\n
    "},{"location":"arcade-body/#speed","title":"Speed","text":"
    • The absolute (non-negative) change in this Body's horizontal/vertical position from the previous step.
      var dx = body.deltaAbsX();\nvar dy = body.deltaAbsY();\n
    "},{"location":"arcade-body/#rotation","title":"Rotation","text":""},{"location":"arcade-body/#allow-rotation","title":"Allow rotation","text":"

    Whether this Body's rotation is affected by its angular acceleration and velocity.

    • Enable (default)
      body.setAllowRotation();\n
    • Disable
      body.setAllowRotation(false);\n
    • Get
      var allowRotation = body.allowRotation;\n
    "},{"location":"arcade-body/#angular-velocity","title":"Angular velocity","text":"
    • Set
      body.setAngularVelocity(v);\n
    • Get
      var av = body.angularVelocity;\n
    "},{"location":"arcade-body/#angular-acceleration","title":"Angular acceleration","text":"
    • Set
      body.setAngularAcceleration(v);\n
    • Get
      var aa = body.angularAcceleration;\n
    "},{"location":"arcade-body/#angular-drag","title":"Angular drag","text":"

    Reduces angular speed per second.

    • Set
      body.setAngularDrag(v);\n
    • Get
      var ad = body.angularDrag;\n
    "},{"location":"arcade-body/#collision","title":"Collision","text":""},{"location":"arcade-body/#collision-category","title":"Collision category","text":"

    A body is only below to one collision category. A body can collide with multiple collision categories. The default is that all bodies collide with all others.

    • Collision category
      • Get
        var collisionCategory = body.collisionCategory;\n
      • Set
        body.setCollisionCategory(category);\n
        • category :
          • (1 << 0)
          • (1 << 1)
          • (1 << 2)
          • ...
          • (1 << 31)
      • Reset collision category, to default behavior (all bodies collide with all others)
        body.resetCollisionCategory();\n
        • Set collisionCategory to 1.
        • Set collisionMask to 1
    • Collision mask
      • Get
        var collisionMask = body.collisionMask;\n
      • Set
        body.setCollidesWith(categories);\n
        • categories : A single category value, or an array of them.
      • Add
        body.addCollidesWith(category):\n
        • category : A single category value.
      • Remove
        body.removeCollidesWith(category);\n
        • category : A single category value.
    "},{"location":"arcade-body/#collision-bound","title":"Collision bound","text":"
    • Rectangle
      body.setSize(width, height, center);\n
      • center : false to set body's offset to (0, 0).
        • Not work in Graphics object.
    • Circle
      body.setCircle(radius, offsetX, offsetY);\n
    "},{"location":"arcade-body/#offset","title":"Offset","text":"
    body.setOffset(x, y);\n
    "},{"location":"arcade-body/#push-out","title":"Push out","text":"
    scene.physics.add.collider(objectsA, objectsB);\n
    • objectsA, objectsB :
      • A game object
      • Game objects in array (Add or remove game objects)
      • Physics group (Add or remove game objects)
      • Group (Add or remove game objects)
    "},{"location":"arcade-body/#callbacks","title":"Callbacks","text":"

    Add collider

    "},{"location":"arcade-body/#point-inside","title":"Point inside","text":"
    var hit = body.hitTest(x, y);\n
    "},{"location":"arcade-body/#is-colliding","title":"Is colliding","text":"
    • Is colliding this tick
      var isColliding = body.touching;\n
      • isColliding :
        {\nnone: true,\nup: true,\ndown: true,\nleft: true,\nright: true\n}\n
    • Was colliding previous tick
      var wasColliding = body.wasTouching;\n
      • wasColliding :
        {\nnone: true,\nup: true,\ndown: true,\nleft: true,\nright: true\n}\n
    "},{"location":"arcade-body/#bounce","title":"Bounce","text":"
    • Set
      body.setBounce(x, y);\n
      or
      body.setBounceX(x);\nbody.setBounceY(y);\n
    • Get
      var bx = body.bounce.x;\nvar by = body.bounce.y;\n
    "},{"location":"arcade-body/#world-bounds","title":"World bounds","text":"
    • Default world bounds
    • Custom world bounds :
      body.setBoundsRectangle(bounds);\n
      • bounds : A rectangle object.
    • Enable
      body.setCollideWorldBounds();\n
    • Disable (default)
      body.setCollideWorldBounds(false);\n
    • Get world bounds rectangle
      var top = body.world.bounds.top;\nvar bottom = body.world.bounds.bottom;\nvar left = body.world.bounds.left;\nvar right = body.world.bounds.right;\n
    "},{"location":"arcade-body/#blocked","title":"Blocked","text":"

    Whether this Body is colliding with a tile or the world boundary.

    • Blocked when moveing down
      var onFloor = body.onFloor(); // blocked.down\n
    • Blocked when moveing up
      var onCeiling = body.onCeiling();  // blocked.up\n
    • Blocked when moveing left or right
      var onWall = body.onWall();  // blocked.left || this.blocked.right\n
    • State
      var blocked = body.blocked;\n
      • blocked :
        {\nnone: true,\nup: false,\ndown: false,\nleft: false,\nright: false\n}\n
    "},{"location":"arcade-body/#mass","title":"Mass","text":"
    • Set
      body.setMass(m);\n
    • Get
      var m = body.mass;\n
    "},{"location":"arcade-body/#static-body","title":"Static body","text":""},{"location":"arcade-body/#sync","title":"Sync","text":"

    Syncs the Bodies position and size with its parent Game Object.

    body.updateFromGameObject();\n
    "},{"location":"arcade-body/#debug","title":"Debug","text":"
    • Bounds of Body
      • Enable drawing body
        body.debugShowBody = true;\n
      • Color
        body.debugBodyColor = 0xff00ff;\n
    • Direction and magnitude of velocity
      • Enable drawing body
        body.debugShowVelocity = true;\n
    "},{"location":"arcade-gameobject/","title":"Game object","text":""},{"location":"arcade-gameobject/#introduction","title":"Introduction","text":"

    Arcade physics Image/Sprite/Group object.

    • Author: Richard Davey
    "},{"location":"arcade-gameobject/#usage","title":"Usage","text":""},{"location":"arcade-gameobject/#add-physics-object","title":"Add physics object","text":"

    Enable physics world

    "},{"location":"arcade-gameobject/#image-object","title":"Image object","text":"
    • Static object, extends from Image object
      var image = scene.physics.add.staticImage(x, y, key);\n
    • Dynamic object, extends from Image object
      var image = scene.physics.add.image(x, y, key);\n
    "},{"location":"arcade-gameobject/#sprite-object","title":"Sprite object","text":"
    • Static object, extends from Sprite object
      var image = scene.physics.add.staticSprite(x, y, key, frame);\n
    • Dynamic object, extends from Sprite object
      var image = scene.physics.add.sprite(x, y, key, frame);\n
    "},{"location":"arcade-gameobject/#group","title":"Group","text":"
    • Static sprite objects, extends from Group object
      var group = scene.physics.add.staticGroup(children, config);\n// var group = scene.physics.add.staticGroup(config);\n
    • Dynamic sprite objects, extends from Group object
      var group = scene.physics.add.group(children, config);\n// var group = scene.physics.add.staticGroup(config);\n
      • config
        var config = {\nclassType: ArcadeSprite,\nenable: true,\ncollideWorldBounds: false,\ncustomBoundsRectangle: null,\naccelerationX: 0,\naccelerationY: 0,\nallowDrag: true,\nallowGravity: true,\nallowRotation: true,\nuseDamping: false,\nbounceX: 0,\nbounceY: 0,\ndragX: 0,\ndragY: 0,\ngravityX: 0,\ngravityY: 0,\nfrictionX: 0,\nfrictionY: 0,\nmaxSpeed: -1,\nvelocityX: 0,\nvelocityY: 0,\nmaxVelocityX: 10000,\nmaxVelocityY: 10000,\nangularVelocity: 0,\nangularAcceleration: 0,\nangularDrag: 0,\nmass: 0,\nimmovable: false,\n\nmaxSize: -1,\nrunChildUpdate: false\n};\n
    "},{"location":"arcade-gameobject/#enable","title":"Enable","text":"
    • Enable body
      gameObject.enableBody();\n// gameObject.enableBody(false, 0, 0, enableGameObject, showGameObject);\n
      • Enable and reset position
        gameObject.enableBody(true, x, y);\n// gameObject.enableBody(true, x, y, enableGameObject, showGameObject);\n
      • enableGameObject : Also activate this Game Object.
      • showGameObject : Also show this Game Object.
    • Disable body
      gameObject.disableBody();\n// gameObject.disableBody(disableGameObject, hideGameObject);\n
      • disableGameObject : Also deactivate this Game Object.
      • hideGameObject : Also hide this Game Object.
    "},{"location":"arcade-gameobject/#movement","title":"Movement","text":""},{"location":"arcade-gameobject/#velocity","title":"Velocity","text":"
    • Set
      gameObject.setVelocity(x, y);\n
      or
      gameObject.setVelocityX(x);\ngameObject.setVelocityY(y);\n
    • Get
      var vx = gameObject.body.velocity.x;\nvar vy = gameObject.body.velocity.y;\n
    "},{"location":"arcade-gameobject/#max-velocity","title":"Max velocity","text":"
    • Set
      gameObject.setMaxVelocity(x, y);\n
    • Get
      var vx = gameObject.body.maxVelocity.x;\nvar vy = gameObject.body.maxVelocity.y;\n
    "},{"location":"arcade-gameobject/#acceleration","title":"Acceleration","text":"
    • Set
      gameObject.setAcceleration(x, y);\n
      or
      gameObject.setAccelerationX(x);\ngameObject.setAccelerationY(y);\n
    • Get
      var ax = gameObject.body.acceleration.x;\nvar ay = gameObject.body.acceleration.y;\n
    "},{"location":"arcade-gameobject/#gravity","title":"Gravity","text":"
    • Set
      gameObject.setGravity(x, y);\n
      or
      gameObject.setGravityX(x);\ngameObject.setGravityY(y);\n
    • Get
      var gx = gameObject.body.gravity.x;\nvar gy = gameObject.body.gravity.y;\n
    "},{"location":"arcade-gameobject/#drag","title":"Drag","text":"
    • Set
      gameObject.setDrag(x, y);\n
      or
      gameObject.setDragX(x);\ngameObject.setDragY(y);\n
    • Get
      var dx = gameObject.body.drag.x;\nvar dy = gameObject.body.drag.y;\n
    • Enable damping
      gameObject.setDamping(value);\n
    "},{"location":"arcade-gameobject/#immovable","title":"Immovable","text":"
    • Enable
      gameObject.setImmovable();\n
    • Disable
      gameObject.setImmovable(false);\n
    • Get
      var immovable = gameObject.body.immovable;\n
    "},{"location":"arcade-gameobject/#pushable","title":"Pushable","text":"
    • Enable
      gameObject.setPushable();\n
    • Disable
      gameObject.setPushable(false);\n
    • Get
      var pushable = gameObject.body.pushable;\n
    "},{"location":"arcade-gameobject/#slide-factor","title":"Slide factor","text":"

    The Slide Factor controls how much velocity is preserved when this Body is pushed by another Body.

    gameObject.setSlideFactor(x, y);\n
    • x, y :
      • 1 : Take on all velocity given in the push. Default value.
      • 0 : Allow this Body to be pushed but then remain completely still after the push ends, such as you see in a game like Sokoban.
      • Other value between 0 ~ 1 : Keep x/y of the original velocity when the push ends.
        • Combine this with the setDrag() method to create deceleration.
    "},{"location":"arcade-gameobject/#friction","title":"Friction","text":"

    If this Body is immovable and in motion, this the proportion of this Body's movement received by the riding body on each axis.

    • Set
      gameObject.setFriction(x, y);\n
      or
      gameObject.setFrictionX(x);\ngameObject.setFrictionY(y);\n
    • Get
      var fx = gameObject.body.friction.x;\nvar fy = gameObject.body.friction.y;\n
    "},{"location":"arcade-gameobject/#direct-control","title":"Direct control","text":"

    Enable directControl when game object is controlled by tween or dragging. Default behavior is disable.

    • Enable
      gameObject.setDirectControl();\n// gameObject.setDirectControl(true);\n
    • Disable
      gameObject.setDirectControl(false);\n

    Use case

    Enable setDirectControl when game object is controlled by tween or dragging.

    "},{"location":"arcade-gameobject/#rotation","title":"Rotation","text":""},{"location":"arcade-gameobject/#allow-rotation","title":"Allow rotation","text":"

    Whether this Body's rotation is affected by its angular acceleration and velocity.

    • Enable (default)
      body.setAllowRotation();\n
    • Disable
      body.setAllowRotation(false);\n
    • Get
      var allowRotation = gameObject.body.allowRotation;\n
    "},{"location":"arcade-gameobject/#angular-velocity","title":"Angular velocity","text":"
    • Set
      gameObject.setAngularVelocity(v);\n
    • Get
      var av = gameObject.body.angularVelocity;\n
    "},{"location":"arcade-gameobject/#angular-acceleration","title":"Angular acceleration","text":"

    -Set

    gameObject.setAngularAcceleration(v);\n
    - Get
    var aa = gameObject.body.angularAcceleration;\n

    "},{"location":"arcade-gameobject/#angular-drag","title":"Angular drag","text":"
    • Set
      gameObject.setAngularDrag(v);\n
    • Get
      var ad = gameObject.body.angularDrag;\n
    "},{"location":"arcade-gameobject/#collision","title":"Collision","text":""},{"location":"arcade-gameobject/#collision-category","title":"Collision category","text":"

    A body is only below to one collision category. A body can collide with multiple collision categories. The default is that all bodies collide with all others.

    • Collision category
      • Get
        var collisionCategory = gameObject.body.collisionCategory;\n
      • Set
        gameObject.setCollisionCategory(category);\n
        • category :
          • (1 << 0)
          • (1 << 1)
          • (1 << 2)
          • ...
          • (1 << 31)
      • Reset collision category, to default behavior (all bodies collide with all others)
        gameObject.resetCollisionCategory();\n
        • Set collisionCategory to 1.
        • Set collisionMask to 1
    • Collision mask
      • Get
        var collisionMask = gameObject.body.collisionMask;\n
      • Set
        gameObject.setCollidesWith(categories);\n
        • categories : A single category value, or an array of them.
      • Add
        gameObject.addCollidesWith(category):\n
        • category : A single category value.
      • Remove
        gameObject.removeCollidesWith(category);\n
        • category : A single category value.
    "},{"location":"arcade-gameobject/#collision-bound","title":"Collision bound","text":"
    • Rectangle
      gameObject.setBodySize(width, height, center);\n
      • center : false to set body's offset to (0, 0)
    • Circle
      gameObject.setCircle(radius, offsetX, offsetY);\n
    "},{"location":"arcade-gameobject/#offset","title":"Offset","text":"
    gameObject.setOffset(x, y);\n
    "},{"location":"arcade-gameobject/#push-out","title":"Push out","text":"
    scene.physics.add.collider(objectsA, objectsB);\n
    • objectsA, objectsB :
      • A game object
      • Game objects in array (Add or remove game objects)
      • Physics group (Add or remove game objects)
      • Group (Add or remove game objects)
    "},{"location":"arcade-gameobject/#callbacks","title":"Callbacks","text":"

    Add collider

    "},{"location":"arcade-gameobject/#point-inside","title":"Point inside","text":"
    var hit = gameObject.hitTest(x, y);\n
    "},{"location":"arcade-gameobject/#bounce","title":"Bounce","text":"
    • Set
      gameObject.setBounce(x, y);\n
      or
      gameObject.setBounceX(x);\ngameObject.setBounceY(y);\n
    • Get
      var bx = gameObject.body.bounce.x;\nvar by = gameObject.body.bounce.y;\n
    • Enable bounce when colliding with the world boundary
      gameObject.setCollideWorldBounds();\n
    • Disable bounce when colliding with the world boundary
      gameObject.setCollideWorldBounds(false);\n
    "},{"location":"arcade-gameobject/#mass","title":"Mass","text":"
    • Set
      gameObject.setMass(m);\n
    • Get
      var m = gameObject.body.mass;\n
    "},{"location":"arcade-gameobject/#static-game-object","title":"Static game object","text":""},{"location":"arcade-gameobject/#sync","title":"Sync","text":"

    Syncs the Bodies position and size in static game object.

    gameObject.refreshBody();\n
    "},{"location":"arcade-gameobject/#methods-of-group","title":"Methods of group","text":"
    group.setVelocity(x, y, step);\n
    group.setVelocityX(value, step);\n
    group.setVelocityY(value, step);\n
    group.refresh();  // call this method when position of game objects were changed in static object group\n
    "},{"location":"arcade-gameobject/#debug","title":"Debug","text":"
    gameObject.setDebug(showBody, showVelocity, bodyColor);\n
    gameObject.setDebugBodyColor(bodyColor);\n
    "},{"location":"arcade-tcrp-player/","title":"Player","text":""},{"location":"arcade-tcrp-player/#introduction","title":"Introduction","text":"

    Player of T ime-C ommand-R ecorder-P layer with Arcade physics engine, to run commands on time.

    • Author: Rex
    • Member of scene

    Arcade physics engine is fixed-step based, not tick time based.

    This Arcade-TCRP has better result of replaying, which store step count via WORLD_STEP(worldstep) event.

    "},{"location":"arcade-tcrp-player/#live-demos","title":"Live demos","text":"
    • Player
    "},{"location":"arcade-tcrp-player/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"arcade-tcrp-player/#install-plugin","title":"Install plugin","text":""},{"location":"arcade-tcrp-player/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexarcadetcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexarcadetcrpplugin.min.js', true);\n
    • Create instance
      var player = scene.plugins.get('rexarcadetcrpplugin').addPlayer(scene, config);\n
    "},{"location":"arcade-tcrp-player/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/arcadetcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var player = scene.plugins.get('rexTCRP').addPlayer(scene, config);\n
    "},{"location":"arcade-tcrp-player/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/arcadetcrp.js';\n
    • Create instance
      var player = new TCRP.Player(scene, config);\n
    "},{"location":"arcade-tcrp-player/#create-instance","title":"Create instance","text":"
    var player = scene.plugins.get('rexTCRP').addPlayer(scene, {\n// commands: [],       // [[time, command], [time, command], ...]\n// timeScale: 1,\n// scope: undefined\n});\n
    • commands : see next section
    • timeScale : An integer equal or larger than 1
    "},{"location":"arcade-tcrp-player/#load-commands","title":"Load commands","text":"
    player.load(commands, scope);\n
    • Commands : see also Run commands
      [\n[time, command],\n[time, command],\n...\n]\n
      • Format of each row :
        [time, fnName, param0, param1, ...]\n// [time, callback, param0, param1, ...]\n
        [time, [fnName, param0, param1, ...]]\n// [time, [callback, param0, param1, ...]]\n
        [time, [command0, command1, ...]]\n
      • time : Time in step-count
    "},{"location":"arcade-tcrp-player/#start-playing","title":"Start playing","text":"
    player.start();\n// player.start(startAt);  // Start-at time in step-count\n
    "},{"location":"arcade-tcrp-player/#events","title":"Events","text":"
    • Complete
      player.on('complete', function(player){});\n
    • Run command
      player.on('runcommand', function(commands, scope){});\n
    "},{"location":"arcade-tcrp-player/#pause-resume-stop-playing","title":"Pause, Resume, stop playing","text":"
    player.pause();\nplayer.resume();\nplayer.stop();\n
    "},{"location":"arcade-tcrp-player/#seek-elapsed-time","title":"Seek elapsed time","text":"
    player.seek(time);   // Elapsed time in step-count\n
    "},{"location":"arcade-tcrp-player/#state-of-player","title":"State of player","text":"
    var isPlaying = player.isPlaying;\nvar completed = player.completed;\nvar now = player.now;\n
    "},{"location":"arcade-tcrp-player/#time-scale","title":"Time-scale","text":"
    • Set
      player.setTimeScale(value);\n// player.timeScale = value;\n
      • timeScale : An integer equal or larger than 1
    • Get
      var timeScale = player.timeScale;\n
    "},{"location":"arcade-tcrp-recorder/","title":"Recoder","text":""},{"location":"arcade-tcrp-recorder/#introduction","title":"Introduction","text":"

    Recorder of T ime-C ommand-R ecorder-P layer with Arcade physics engine, to store commands with time.

    • Author: Rex
    • Member of scene

    Arcade physics engine is fixed-step based, not tick time based.

    This Arcade-TCRP has better result of replaying, which store step count via WORLD_STEP(worldstep) event.

    "},{"location":"arcade-tcrp-recorder/#live-demos","title":"Live demos","text":"
    • Player
    "},{"location":"arcade-tcrp-recorder/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"arcade-tcrp-recorder/#install-plugin","title":"Install plugin","text":""},{"location":"arcade-tcrp-recorder/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexarcadetcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexarcadetcrpplugin.min.js', true);\n
    • Create instance
      var recorder = scene.plugins.get('rexarcadetcrpplugin').addRecorder(scene);\n
    "},{"location":"arcade-tcrp-recorder/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/arcadetcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var recorder = scene.plugins.get('rexTCRP').addRecorder(scene);\n
    "},{"location":"arcade-tcrp-recorder/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/arcadetcrp.js';\n
    • Create instance
      var recorder = new TCRP.Recorder(scene);\n
    "},{"location":"arcade-tcrp-recorder/#create-instance","title":"Create instance","text":"
    var recorder = scene.plugins.get('rexTCRP').addRecorder(scene);\n
    "},{"location":"arcade-tcrp-recorder/#start-recording","title":"Start recording","text":"
    recorder.start();\n// recorder.start(startAt);  // start-at in step-count\n
    "},{"location":"arcade-tcrp-recorder/#push-commands","title":"Push commands","text":"
    recorder.addCommand([fnName, param0, param1, ...]);\n// recorder.addCommand([command0, command1, ...]);\n// recorder.addCommand([fnName, param0, param1, ...], offset);  // time-offset in step-count\n

    See also Run commands

    "},{"location":"arcade-tcrp-recorder/#get-commands","title":"Get commands","text":"
    var commands = recorder.getCommands();        // Get a shallow copy of commands\n// var commands = recorder.getCommands(true); // Get reference of commands\n

    Format of return commands:

    [\n[time, [command]],\n[time, [command0,command1]],\n...\n]\n
    • time : Time in step-count
    "},{"location":"arcade-tcrp-recorder/#pause-resume-stop-recording","title":"Pause, Resume, stop recording","text":"
    recorder.pause();\nrecorder.resume();\nrecorder.stop();\n
    "},{"location":"arcade-tcrp-recorder/#seek-elapsed-time","title":"Seek elapsed time","text":"
    recorder.seek(time);   // elapsed time in step-count\n
    "},{"location":"arcade-tcrp-recorder/#state-of-recorder","title":"State of recorder","text":"
    var isRecording = recorder.isRecording;\nvar now = recorder.now;\n
    • now : Now time in step-count.
    "},{"location":"arcade-tcrp-recorder/#time-scale","title":"Time-scale","text":"
    • Set
      recorder.setTimeScale(value);\n// recorder.timeScale = value;\n
      • timeScale : An integer equal or larger than 1
    • Get
      var timeScale = recorder.timeScale;\n
    "},{"location":"arcade-tcrp-step-runner/","title":"Step runner","text":""},{"location":"arcade-tcrp-step-runner/#introduction","title":"Introduction","text":"

    Execute command in next WORLD_STEP(worldstep) event, to synchronize command execution with step-counter of Recorder of Arcade-TCRP.

    • Author: Rex
    • Member of scene

    Command might be executed before or after WORLD_STEP(worldstep) event, which is emitted in scene's update event.

    • Before: Command is executed in any input(touch/keyboard) event, or in scene's preupdate event.
    • After: Command is executed in scene.updat() method.
    "},{"location":"arcade-tcrp-step-runner/#live-demos","title":"Live demos","text":"
    • Player
    "},{"location":"arcade-tcrp-step-runner/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"arcade-tcrp-step-runner/#install-plugin","title":"Install plugin","text":""},{"location":"arcade-tcrp-step-runner/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexarcadetcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexarcadetcrpplugin.min.js', true);\n
    • Create instance
      var stepRunner = scene.plugins.get('rexarcadetcrpplugin').addStepRunner(scene);\n
    "},{"location":"arcade-tcrp-step-runner/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/arcadetcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var stepRunner = scene.plugins.get('rexTCRP').addStepRunner(scene);\n
    "},{"location":"arcade-tcrp-step-runner/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/arcadetcrp.js';\n
    • Create instance
      var stepRunner = new TCRP.StepRunner(scene);\n
    "},{"location":"arcade-tcrp-step-runner/#create-instance","title":"Create instance","text":"
    var stepRunner = scene.plugins.get('rexTCRP').addStepRunner(scene);\n
    "},{"location":"arcade-tcrp-step-runner/#push-commands","title":"Push commands","text":"
    stepRunner.add(commands, scope);\n

    See also Run commands

    "},{"location":"arcade-tcrp-step-runner/#offset-recorder","title":"Offset recorder","text":"

    Since commands will be executed in next WORLD_STEP(worldstep) event, recorder have to add 1 step-count offset.

    • Offset at recording start
      recorder.start(1);\n
    • Add offset when pushing commands
      recorder.addCommand([fnName, param0, param1, ...], 1);\n
    "},{"location":"arcade-world/","title":"World","text":""},{"location":"arcade-world/#introduction","title":"Introduction","text":"

    World of Arcade physics engine in phaser.

    • Author: Richard Davey
    "},{"location":"arcade-world/#usage","title":"Usage","text":""},{"location":"arcade-world/#configuration","title":"Configuration","text":"
    var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n//    x: 0,\n//    y: 0,\n//    width: scene.sys.scale.width,\n//    height: scene.sys.scale.height,\n//    gravity: {\n//        x: 0,\n//        y: 0\n//    },\n//    checkCollision: {\n//        up: true,\n//        down: true,\n//        left: true,\n//        right: true\n//    },\n//    customUpdate: false,\n//    fixedStep: true,\n//    fps: 60,\n//    timeScale: 1,     // 2.0 = half speed, 0.5 = double speed\n//    customUpdate: false,\n//    overlapBias: 4,\n//    tileBias: 16,\n//    forceX: false,\n//    isPaused: false,\n//    debug: false,\n//    debugShowBody: true,\n//    debugShowStaticBody: true,\n//    debugShowVelocity: true,\n//    debugBodyColor: 0xff00ff,\n//    debugStaticBodyColor: 0x0000ff,\n//    debugVelocityColor: 0x00ff00,\n//    maxEntries: 16,\n//    useTree: true   // set false if amount of dynamic bodies > 5000\n}\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"arcade-world/#update","title":"Update","text":"
    • Default updating : World updating every tick
    • Custom updating :
      1. Set customUpdate of arcade config to false.
        • Enable world updating : scene.physics.enableUpdate()
        • Disable world updating : scene.physics.disableUpdate()
      2. Run world updating manually
        scene.physics.world.update(time, delta);\n
      3. Enable/disable world updating
        • Enable : scene.physics.enableUpdate()
        • Disable : scene.physics.disableUpdate()
    "},{"location":"arcade-world/#step","title":"Step","text":"
    • Advances the simulation by a single step.
      scene.physics.world.singleStep();\n
    • Advances the simulation by a time increment.
      scene.physics.world.step(delta);\n
    "},{"location":"arcade-world/#events","title":"Events","text":"
    • World step
      scene.physics.world.on('worldstep', function(delta) { /* ... */ });\n
      • delta : The delta time amount of this step, in seconds.
    "},{"location":"arcade-world/#control","title":"Control","text":""},{"location":"arcade-world/#pause","title":"Pause","text":"
    scene.physics.pause();\n
    "},{"location":"arcade-world/#resume","title":"Resume","text":"
    scene.physics.resume();\n
    "},{"location":"arcade-world/#events_1","title":"Events","text":"
    • Pause world
      scene.physics.world.on('pause', function() { /* ... */ });\n
    • Resume world
      scene.physics.world.on('resume', function() { /* ... */ });\n
    "},{"location":"arcade-world/#duration-per-frame","title":"Duration per frame","text":"
    • Time scale
      scene.physics.world.timeScale = timeScale;\n
      • 1.0 = normal speed
      • 2.0 = half speed
      • 0.5 = double speed
    • FPS
      scene.physics.world.setFPS(framerate);\n
    "},{"location":"arcade-world/#tile-filter-options","title":"Tile filter options","text":"
    var option = scene.physics.world.tileFilterOptions;\n
    • option
      {\nisColliding: true,\nisNotEmpty: true,\nhasInterestingFace: true\n}\n
    "},{"location":"arcade-world/#body","title":"Body","text":""},{"location":"arcade-world/#enable","title":"Enable","text":"
    scene.physics.world.enable(gameObject);\n// scene.physics.world.enable(gameObject, bodyType);\n
    • gameObject : A game object, or array of game objects, or game objects in a Group
    • bodyType :
      • 0 : Dynamic body. Default value.
      • 1 : Static body.

    Or

    scene.physics.add.existing(gameObject, bodyType);\n

    See arcade-body

    "},{"location":"arcade-world/#disable","title":"Disable","text":"
    scene.physics.world.disable(gameObject);\n
    • gameObject : A game object, or array of game objects, or game objects in a Group
    "},{"location":"arcade-world/#addremove-body","title":"Add/remove body","text":"
    • Add body to the local search trees.
      scene.physics.world.add(body);\n
    • Remove body from the local search trees.
      scene.physics.world.disableBody(body);\n
    "},{"location":"arcade-world/#collision","title":"Collision","text":""},{"location":"arcade-world/#set-bound","title":"Set bound","text":"

    See bound in body object, or game object.

    "},{"location":"arcade-world/#collider-callback","title":"Collider & callback","text":"
    • Add collider
      • Push out
        scene.physics.add.collider(objectsA, objectsB);\n
      • Performs a collision check and separation between the two physics enabled objects given.
        var collider = scene.physics.add.collider(objectsA, objectsB, collideCallback);\n// var collider = scene.physics.add.collider(objectsA, objectsB, collideCallback, processCallback, callbackContext);\n
      • If you don't require separation then use overlap instead.
        var collider = scene.physics.add.overlap(objectsA, objectsB, collideCallback);\n// var collider = scene.physics.add.overlap(objectsA, objectsB, collideCallback, processCallback, callbackContext);\n
      • Parameters
        • objectsA, objectsB :
          • A game object
          • An array contains Game objects (Add or remove game objects)
          • Physics group/Group (Add or remove game objects)
          • An array contains Physics group/Group
        • collideCallback :
          var collideCallback = function(gameObject1, gameObject2) {\n// ...\n}\n
        • processCallback : Fired when gameObject1 intersects gameObject2, optional.
          var processCallback = function(gameObject1, gameObject2) {\nreturn true;  // return false will discard remaining collision checking\n}\n
    • Remove collider
      scene.physics.world.removeCollider(collider);\n
    • Deactivate collider
      collider.active = false;  // Set true to activate again\n
    • Name of collider (unused by engine)
      collider.name = name;\n
    "},{"location":"arcade-world/#testing-wo-collider","title":"Testing wo collider","text":"
    • Test overlapping
      var isOverlapping = scene.physics.world.overlap(object1, object2);\n
      or
      var isOverlapping = scene.physics.world.overlap(object1, object2, collideCallback);\n// var isOverlapping = scene.physics.world.overlap(object1, object2, collideCallback, processCallback, callbackContext);\n
    • Test colliding, also push out
      var isCollided = scene.physics.world.collide(object1, object2);\n
      or
      var isCollided = scene.physics.world.collide(object1, object2, collideCallback);\n// var isCollided = scene.physics.world.collide(object1, object2, collideCallback, processCallback, callbackContext);\n
    "},{"location":"arcade-world/#events_2","title":"Events","text":"
    • Two bodies overlap and at least one of them has their onOverlap property set to true.
      scene.physics.world.on('overlap', function(gameObject1, gameObject2, body1, body2) { /* ... */ });\n
    • Two bodies overlap and at least one of them has their onCollide property set to true.
      scene.physics.world.on('collide', function(gameObject1, gameObject2, body1, body2) { /* ... */ });\n
    • A body overlaps with a Tile and has its onOverlap property set to true.
      scene.physics.world.on('tileoverlap', function(gameObject, tile, body) { /* ... */ });\n
    • A body overlaps with a Tile and has its onCollide property set to true.
      scene.physics.world.on('tilecollide', function(gameObject, tile, body) { /* ... */ });\n
    "},{"location":"arcade-world/#world-bounds","title":"World bounds","text":""},{"location":"arcade-world/#enable_1","title":"Enable","text":"
    • Body : Set body.setCollideWorldBounds() to enable worldBounds property.
    • World :
      • Set bounds rectangle and enable bounds
        scene.physics.world.setBounds(x, y, width, height);\n// scene.physics.world.setBounds(x, y, width, height, checkLeft, checkRight, checkUp, checkDown);\n
      • Set bounds rectangle
        scene.physics.world.bounds.setTo(x, y, width, height);\n
        or
        scene.physics.world.bounds.x = x;\nscene.physics.world.bounds.y = y;\nscene.physics.world.bounds.width = width;\nscene.physics.world.bounds.height = height;\n
      • Enable bounds
        scene.physics.world.setBoundsCollision();\n// scene.physics.world.setBoundsCollision(left, right, up, down);\n
        or
        scene.physics.world.checkCollision.left = left;\nscene.physics.world.checkCollision.right = right;\nscene.physics.world.checkCollision.up = up;\nscene.physics.world.checkCollision.down = down;\n
      • Get bounds rectangle
        var top = scene.physics.world.bounds.top;\nvar bottom = scene.physics.world.bounds.bottom;\nvar left = scene.physics.world.bounds.left;\nvar right = scene.physics.world.bounds.right;\n
    "},{"location":"arcade-world/#bodies-inside-an-area","title":"Bodies inside an area","text":"
    • Overlap a rectangle area
      var bodies = scene.physics.overlapRect(x, y, width, height, includeDynamic, includeStatic);\n
      • includeDynamic : Set true to search Dynamic Bodies
      • includeStatic : Set true to search Static Bodies
    • Overlap a circle area
      var bodies = scene.physics.overlapCirc(x, y, radius, includeDynamic, includeStatic);\n
      • includeDynamic : Set true to search Dynamic Bodies
      • includeStatic : Set true to search Static Bodies
    "},{"location":"arcade-world/#events_3","title":"Events","text":"
    • World bounds
      scene.physics.world.on('worldbounds', function(body, blockedUp, blockedDown, blockedLeft, blockedRight) { /* ... */ });\n
    "},{"location":"arcade-world/#wrap","title":"Wrap","text":"
    scene.physics.world.wrap(gameObject, padding);\n
    • gameObject:
      • game object
      • group
      • array of game objects
    "},{"location":"arcade-world/#move-to","title":"Move to","text":"
    • Move to position with a steady velocity
      scene.physics.moveTo(gameObject, x, y, speed, maxTime);\n
    • Move to object with a steady velocity
      scene.physics.moveToObject(gameObject, destination, speed, maxTime);\n
    "},{"location":"arcade-world/#accelerate-to","title":"Accelerate to","text":"
    • Accelerate to position
      scene.physics.accelerateTo(gameObject, x, y, acceleration, xSpeedMax, ySpeedMax);\n
    • Accelerate to object
      scene.physics.accelerateToObject(gameObject, destination, acceleration, xSpeedMax, ySpeedMax);\n
    "},{"location":"arcade-world/#gravity","title":"Gravity","text":"
    • Set
      scene.physics.world.gravity.x = gx;\nscene.physics.world.gravity.y = gy;\n
    • Get
      var gx = scene.physics.world.gravity.x;\nvar gy = scene.physics.world.gravity.y;\n

    Total Gravity = world.gravity + body.gravity

    "},{"location":"arcade-world/#bodies","title":"Bodies","text":""},{"location":"arcade-world/#closestfurthest","title":"Closest/furthest","text":"
    • Closest
      var body = scene.physics.closest(point);  // point: {x,y}\n// var body = scene.physics.closest(point, targets);\n
      • targets : Array of Arcade Physics Game Object, Body or Static Body.
    • Furthest
      var body = scene.physics.furthest(point);  // point: {x,y}\n// var body = scene.physics.furthest(point, targets);\n
      • targets : Array of Arcade Physics Game Object, Body or Static Body.
    "},{"location":"arcade-world/#debug","title":"Debug","text":""},{"location":"arcade-world/#draw-body-velocity","title":"Draw body & velocity","text":"
    • Bounds of dynamic Body
      • Enable drawing body
        scene.physics.world.defaults.debugShowBody = true;\n
      • Color
        scene.physics.world.defaults.bodyDebugColor = 0xff00ff;\n
    • Bounds of static Body
      • Enable drawing body
        scene.physics.world.defaults.debugShowStaticBody = true;\n
      • Color
        scene.physics.world.defaults.staticBodyDebugColor = 0x0000ff;\n
    • Direction and magnitude of velocity
      • Enable drawing body
        scene.physics.world.defaults.debugShowVelocity = true;\n
      • Color
        scene.physics.world.defaults.velocityDebugColor = 0x00ff00;\n
    "},{"location":"arcade-world/#graphics","title":"Graphics","text":"

    Draw debug body & velocity on a Graphics object.

    var graphics = scene.physics.world.debugGraphic;\n
    • Set visible
      scene.physics.world.debugGraphic.setVisible();\n
    • Set invisible
      scene.physics.world.debugGraphic.setVisible(false);\n
    "},{"location":"arcade-world/#update-loop","title":"Update loop","text":"
    1. scene.sys.events: update
      1. Update position & angle of each body
      2. Process each collider
      3. Update final position of each body
      4. Emit worldstep event
    2. scene.sys.events: postupdate
      1. Draw debug graphics
    graph TB\n\nSceneEventUpdate>\"scene.sys.events: update<br><br>Update arcade world<br>gameObject.preUpdate()\"]\nSceneUpdate[\"scene.update()\"]\nSceneEventPostUpdate>\"scene.sys.events: postupdate<br><br>Post update arcade world\"]\nRender\n\nSceneEventUpdate --> SceneUpdate\nSceneUpdate --> SceneEventPostUpdate\nSceneEventPostUpdate --> Render
    "},{"location":"array-addremove/","title":"Add/remove","text":""},{"location":"array-addremove/#introduction","title":"Introduction","text":"

    Add/insert/remove item(s) of an array, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"array-addremove/#usage","title":"Usage","text":""},{"location":"array-addremove/#add-item","title":"Add item","text":"
    Phaser.Utils.Array.Add(arr, item);\n// Phaser.Utils.Array.Add(arr, item, limit, callback, context);\n
    • item : An item, or an array of items.
    • limit : Optional limit which caps the size of the array.
    • callback : A callback to be invoked for each item successfully added to the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#insert-item-at","title":"Insert item at","text":"
    Phaser.Utils.Array.AddAt(arr, item, index);\n// Phaser.Utils.Array.AddAt(arr, item, index, limit, callback, context);\n
    • index : The index in the array where the item will be inserted.
    • item : An item, or an array of items.
    • limit : Optional limit which caps the size of the array.
    • callback : A callback to be invoked for each item successfully added to the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#remove-item","title":"Remove item","text":"
    Phaser.Utils.Array.Remove(arr, item);\n// Phaser.Utils.Array.Remove(arr, item, callback, context);\n
    • item : An item, or an array of items.
    • callback : A callback to be invoked for each item successfully removed from the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#remove-item-at","title":"Remove item at","text":"
    var removed = Phaser.Utils.Array.RemoveAt(arr, index);\n// var removed = Phaser.Utils.Array.RemoveAt(arr, index, callback, context);\n
    • removed : Removed item.
    • index : The array index to remove the item from. The index must be in bounds or it will throw an error.
    • callback : A callback to be invoked for each item successfully removed from the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#remove-items-between","title":"Remove items between","text":"
    var removed = Phaser.Utils.Array.RemoveBetween(arr, startIndex, endIndex);\n// var removed = Phaser.Utils.Array.RemoveBetween(arr, startIndex, endIndex, callback, context);\n
    • removed : Removed items.
    • startIndex : The start index to remove from.
    • callback : The end index to remove to.
    • callback : A callback to be invoked for each item successfully removed from the array.
    • context : The context in which the callback is invoked.
    "},{"location":"array-addremove/#remove-random-item","title":"Remove random item","text":"
    var item = Phaser.Utils.Array.RemoveRandomElement(arr);\n
    "},{"location":"array-addremove/#replace-item","title":"Replace item","text":"

    Replaces an element of the array with the new element. The new element cannot already be a member of the array.

    Phaser.Utils.Array.Replace(arr, oldItem, newItem);\n
    • oldItem : An item in array.
    • newItem : Another item, which is not in array.
    "},{"location":"array-filter/","title":"Filter/Map","text":""},{"location":"array-filter/#introduction","title":"Introduction","text":"

    Built-in javascript object.

    • Author: Built-in javascript function
    "},{"location":"array-filter/#usage","title":"Usage","text":""},{"location":"array-filter/#run-function-for-each-element","title":"Run function for each element","text":"
    arr.forEach(function(element, index, arr) {\n//\n}, scope);\n
    "},{"location":"array-filter/#filter-elements","title":"Filter elements","text":"

    Creates a new array with all elements that pass the test function.

    var result = arr.filter(function(element, index, arr) {\nreturn true; // false\n}, scope);\n
    "},{"location":"array-filter/#find-one-element","title":"Find one element","text":"
    var element = arr.find(function(element, index, arr) {\nreturn true; // false\n}, scope);\n
    "},{"location":"array-filter/#map-elements-to-a-new-array","title":"Map elements to a new array","text":"
    var newArray = arr.map(function(element, index, arr) {\nreturn newElement;\n}, scope);\n
    "},{"location":"array-random/","title":"Random","text":""},{"location":"array-random/#introduction","title":"Introduction","text":"

    Random operation of an array, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"array-random/#usage","title":"Usage","text":""},{"location":"array-random/#get-random-item","title":"Get random item","text":"
    var item = Phaser.Utils.Array.GetRandom(arr);\n// var item = Phaser.Utils.Array.GetRandom(arr, startIndex, length);\n
    "},{"location":"array-random/#remove-random-item","title":"Remove random item","text":"
    var item = Phaser.Utils.Array.RemoveRandomElement(arr);\n// var item = Phaser.Utils.Array.RemoveRandomElement(arr, startIndex, length);\n
    "},{"location":"array-random/#shuffle","title":"Shuffle","text":"
    var arr = Phaser.Utils.Array.Shuffle(arr);\n
    "},{"location":"array-sort/","title":"Sort","text":""},{"location":"array-sort/#introduction","title":"Introduction","text":"

    Array sorting, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"array-sort/#usage","title":"Usage","text":""},{"location":"array-sort/#built-in-array-sort","title":"Built-in array sort","text":"
    var out = arr.sort(compareFunction);\n
    • compareFunction : A function that defines an alternative sort order.
      function(a, b) {\n// return a - b;\n}\n
      • Return a negative value
      • Return 0
      • Return a positive value
    "},{"location":"array-sort/#stable-array-sort","title":"Stable array sort","text":"
    var out = Phaser.Utils.Array.StableSort(arr, compareFunction);\n
    "},{"location":"array-sort/#shuffle","title":"Shuffle","text":"
    var arr = Phaser.Utils.Array.Shuffle(arr);\n
    "},{"location":"array-sort/#move-item","title":"Move item","text":"
    • Moves the given element to the top of the array.
      Phaser.Utils.Array.BringToTop(arr, item);\n
    • Moves the given element to the bottom of the array.
      Phaser.Utils.Array.SendToBack(arr, item);\n
    • Moves the given array element up.
      Phaser.Utils.Array.MoveUp(array, item);\n
    • Moves the given array element down.
      Phaser.Utils.Array.MoveDown(array, item);\n
    • Moves an element in an array to a new position.
      Phaser.Utils.Array.MoveTo(array, item, index);\n
    • Swaps the position of two elements.
      Phaser.Utils.Array.Swap(array, item1, item2);\n
    • Moves the element at the start of the array to the end, shifting all items in the process.
      Phaser.Utils.Array.RotateLeft(array, steps);\n
      • steps : The number of times to shift the array.
    • Moves the element at the end of the array to the start, shifting all items in the process.
      Phaser.Utils.Array.RotateRight(array, steps);\n
      • steps : The number of times to shift the array.
    "},{"location":"audio/","title":"Audio","text":""},{"location":"audio/#introduction","title":"Introduction","text":"

    Play sounds, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"audio/#usage","title":"Usage","text":""},{"location":"audio/#configuration","title":"Configuration","text":""},{"location":"audio/#web-audio","title":"Web audio","text":"

    Web audio is the default audio context.

    "},{"location":"audio/#html5-audio","title":"Html5 audio","text":"
    var config = {\n// ....\naudio: {\ndisableWebAudio: true\n}\n// ....\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"audio/#no-audio","title":"No audio","text":"
    var config = {\n// ....\naudio: {\nnoAudio: true\n}\n// ....\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"audio/#load-audio-file","title":"Load audio file","text":"
    scene.load.audio(key, urls);  // urls: an array of file url\n// scene.load.audio(key, urls, {instances: 1}, xhrSettings);\n

    See loader

    "},{"location":"audio/#decode-audio","title":"Decode audio","text":"
    scene.sound.decodeAudio(key, audioData);\n
    • audioData : Audio data
      • A base64 encoded string
      • An audio media-type data uri
      • An ArrayBuffer instance

    Or

    scene.sound.decodeAudio(audioFiles);\n
    • audioFiles : An array of {key, data}
      • data : Audio data
        • A base64 encoded string
        • An audio media-type data uri
        • An ArrayBuffer instance
    "},{"location":"audio/#decoded-events","title":"Decoded events","text":"
    • Finished decoding an audio data
      scene.sound.on('decoded', key);\n
    • Finished decoding all audio data
      scene.sound.on('decodedall');\n
    "},{"location":"audio/#unlock-audio","title":"Unlock audio","text":"

    Unlocks Web Audio API/HTML5 Audio loading on the initial input event.

    scene.sound.unlock();\n
    "},{"location":"audio/#play-sound","title":"Play sound","text":"

    Sound instance will be destroyed when playback ends.

    scene.sound.play(key);\n

    or

    scene.sound.play(key, config);\n/*\nvar sound = scene.sound.add(key);\nsound.play(config);\n*/\n
    "},{"location":"audio/#position-of-the-spatial-audio-listener","title":"Position of the Spatial Audio listener","text":"
    scene.sound.setListenerPosition(x, y)\n
    • x, y : The x/y position of the Spatial Audio listener. Default value is center of the game canvas.

    Note

    Web audio only

    "},{"location":"audio/#sound-instance","title":"Sound instance","text":""},{"location":"audio/#create-sound-instance","title":"Create sound instance","text":"
    var music = scene.sound.add(key);\n
    var music = scene.sound.add(key, config);\n
    "},{"location":"audio/#configuration_1","title":"Configuration","text":"
    {\nmute: false,\nvolume: 1,\nrate: 1,\ndetune: 0,\nseek: 0,\nloop: false,\ndelay: 0,\n\n// source of the spatial sound\nsource: {\nx: 0,\ny: 0,\nz: 0,\npanningModel: 'equalpower',\ndistanceModel: 'inverse',\norientationX: 0,\norientationY: 0,\norientationZ: -1,\nrefDistance: 1,\nmaxDistance: 10000,\nrolloffFactor: 1,\nconeInnerAngle: 360,\nconeOuterAngle: 0,\nconeOuterGain: 0,\nfollow: undefined\n}\n}\n
    • source : Source of the spatial sound
      • x, y : The horizontal/vertical position of the audio in a right-hand Cartesian coordinate system.
      • z : Represents the longitudinal (back and forth) position of the audio in a right-hand Cartesian coordinate system.
      • panningModel : An enumerated value determining which spatialization algorithm to use to position the audio in 3D space.
        • 'equalpower'
        • 'HRTF'
      • orientationX, orientationY : The horizontal/vertical position of the audio source's vector in a right-hand Cartesian coordinate system.
      • orientationZ : Represents the longitudinal (back and forth) position of the audio source's vector in a right-hand Cartesian coordinate system.
      • refDistance : A double value representing the reference distance for reducing volume as the audio source moves further from the listener. For distances greater than this the volume will be reduced based on rolloffFactor and distanceModel.
      • maxDistance : The maximum distance between the audio source and the listener, after which the volume is not reduced any further.
      • rolloffFactor : A double value describing how quickly the volume is reduced as the source moves away from the listener. This value is used by all distance models.
      • coneInnerAngle : The angle, in degrees, of a cone inside of which there will be no volume reduction.
      • coneOuterAngle : The angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the coneOuterGain property.
      • coneOuterGain : The amount of volume reduction outside the cone defined by the coneOuterAngle attribute. Its default value is 0, meaning that no sound can be heard. A value between 0 and 1.
      • follow : Set this Sound object to automatically track the x/y position of this object. Can be a Phaser Game Object, Vec2 or anything that exposes public x/y properties.
    "},{"location":"audio/#play-sound-instance","title":"Play sound instance","text":"
    • Start playing
      music.play();\n
    • Start playing with configuration
      music.play(config);\n
      • config
    • Stop
      music.stop();\n
    • Pause
      music.pause();\n
    • Resume
      music.resume();\n
    "},{"location":"audio/#methods","title":"Methods","text":""},{"location":"audio/#mute","title":"Mute","text":"
    • Set
      music.setMute(mute); // mute: true/false\n// music.mute = mute;\n
    • Get
      var mute = music.mute;\n
    "},{"location":"audio/#volume","title":"Volume","text":"
    • Set
      music.setVolume(volume); // volume: 0 to 1\n// music.volume = volume;\n
    • Get
      var volume = music.volume;\n
    "},{"location":"audio/#detune","title":"Detune","text":"
    • Set
      music.setDetune(detune); // detune: -1200 to 1200\n// music.detune = detune;\n
    • Get
      var detune = music.detune;\n
    "},{"location":"audio/#play-rate","title":"Play-rate","text":"
    • Set
      music.setRate(rate); // rate: 1.0(normal speed), 0.5(half speed), 2.0(double speed)\n// music.rate = rate;\n
    • Get
      var rate = music.rate;\n
    "},{"location":"audio/#seek-to","title":"Seek to","text":"
    • Seek to
      music.setSeek(time); // seek: playback time\n// music.seek = seek;\n
    • Get current playback time
      var time = music.seek;  // return 0 when playback ends\n
    "},{"location":"audio/#loop","title":"Loop","text":"
    • Set
      music.setLoop(loop); // loop: true/false\n// music.loop = loop;\n
    • Get
      var loop = music.loop;\n
    "},{"location":"audio/#properties","title":"Properties","text":"
    • Duration : duration of this sound
      var duration = music.duration;\n
    • Is playing
      var isPlaying = music.isPlaying;\n
    • Is paused
      var isPaused = music.isPaused;\n
    • Asset key
      var key = music.key;\n
    "},{"location":"audio/#events","title":"Events","text":"
    • Start playing
      music.once('play', function(music){});\n
    • Playback end
      music.once('complete', function(music){});\n
    • Looping
      music.once('looped', function(music){});\n
    • Pause
      music.once('pause', function(music){});\n
    • Resume
      music.once('resume', function(music){});\n
    • Stop
      music.once('stop', function(music){});\n
    • Set mute
      music.once('mute', function(music, mute){});\n
    • Set volume
      music.once('volume', function(music, volume){});\n
    • Set detune
      music.once('detune', function(music, detune){});\n
    • Set play-rate
      music.once('rate', function(music, rate){});\n
    • Seek to
      music.once('seek', function(music, time){});\n
    • set loop
      music.once('loop', function(music, loop){});\n
    "},{"location":"audio/#play-marked-sound","title":"Play marked sound","text":"

    Sound instance will be destroyed when playback ends.

    scene.sound.play(key, marker);\n
    "},{"location":"audio/#marker","title":"Marker","text":"
    {\nname: '',\nstart: 0,\nduration: music.duration,\nconfig: {\nmute: false,\nvolume: 1,\nrate: 1,\ndetune: 0,\nseek: 0,\nloop: false,\ndelay: 0\n}\n}\n
    "},{"location":"audio/#markers-in-sound-instance","title":"Markers in sound instance","text":""},{"location":"audio/#add-marker","title":"Add marker","text":"
    music.addMarker(marker);\n

    Marker

    "},{"location":"audio/#play-marked-sound_1","title":"Play marked sound","text":"
    music.play(markerName);\n
    music.play(markerName, config);\n

    config

    "},{"location":"audio/#audio-sprite","title":"Audio sprite","text":""},{"location":"audio/#load-audio-sprite","title":"Load audio sprite","text":"
    scene.load.audioSprite(key, urls, markersConfig, config);\n

    See loader

    Format of markersConfig

    {\nresources: urls, // an array of audio files\nspritemap: {\nmarkerName0: {\nstart: 0,\nend: 0\n},\nmarkerName1: {\nstart: 0,\nend: 0\n}\n// ...\n}\n}\n

    "},{"location":"audio/#play-sound_1","title":"Play sound","text":"

    Create a sound instance then play the marked section, this sound instance will be destroyed when playback ends.

    scene.sound.playAudioSprite(key, markerName, config);\n

    config

    "},{"location":"audio/#sound-instance_1","title":"Sound instance","text":"

    Create a sound instance with markers.

    var music = scene.sound.addAudioSprite(key, config);\n

    config

    "},{"location":"audio/#play-sound-instance_1","title":"Play sound instance","text":"
    music.play(markerName);\n
    music.play(markerName, config);\n

    config

    "},{"location":"audio/#sound-manager","title":"Sound manager","text":""},{"location":"audio/#mute_1","title":"Mute","text":"
    • Set
      scene.sound.setMute(mute); // mute: true/false\n// scene.sound.mute = mute;\n
    • Get
      var mute = scene.sound.mute;\n
    "},{"location":"audio/#volume_1","title":"Volume","text":"
    • Set
      scene.sound.setVolume(volume); // volume: 0 to 1\n// scene.sound.volume = volume;\n
    • Get
      var volume = scene.sound.volume;\n
    "},{"location":"audio/#detune_1","title":"Detune","text":"
    • Set
      scene.sound.setDetune(detune); // detune: -1200 to 1200\n// scene.sound.detune = detune;\n
    • Get
      var detune = scene.sound.detune;\n
    "},{"location":"audio/#play-rate_1","title":"Play-rate","text":"
    • Set
      scene.sound.setRate(rate); // rate: 1.0(normal speed), 0.5(half speed), 2.0(double speed)\n// scene.sound.rate = rate;\n
    • Get
      var rate = scene.sound.rate;\n
    "},{"location":"audio/#get-music-instance","title":"Get music instance","text":"
    • Get first by key
      var music = scene.sound.get(key); // music instance, or null\n
    • Get all by key
      var musicArray = scene.sound.getAll(key); // music instance, or null\n
    • Get all
      var musicArray = scene.sound.getAll();\n
    • Get all playing
      var musicArray = scene.sound.getAllPlaying();\n
    "},{"location":"audio/#is-playing","title":"Is playing","text":"
    • Is any sound playing
      var isPlaying = scene.sound.isPlaying();\n
    • Is any sound playing by key
      var isPlaying = scene.sound.isPlaying(key);\n
    "},{"location":"audio/#remove-music-instance","title":"Remove music instance","text":"
    • Remove by key
      var removed = scene.sound.removeByKey(key);\n
      • removed : The number of matching sound objects that were removed.
    • Remove all
      scene.sound.removeAll();\n
    "},{"location":"audio/#stop-music-instance","title":"Stop music instance","text":"
    • Stop by key
      var stopped = scene.sound.stopByKey(key);\n
      • stopped : How many sounds were stopped.
    • Stop all
      scene.sound.stopAll();\n
    "},{"location":"audio/#analyser","title":"Analyser","text":"

    Analyser node is only available in Web audio mode.

    1. Create analyser node
      var analyser = scene.sound.context.createAnalyser();\n
    2. Configure analyser node
      analyser.smoothingTimeConstant = 1;\nanalyser.fftSize = 8192;\nanalyser.minDecibels = -90;\nanalyser.maxDecibels = -10;\n
      • smoothingTimeConstant : Averaging constant with the last analysis frame.
        • 0(no time averaging) ~ 1. Default value is 0.8.
      • fftSize : Window size.
        • 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768. Defaults to 2048.
      • minDecibels : Minimum decibel value for scaling the FFT analysis data.
        • 0 dB is the loudest possible sound, -10 dB is a 10th of that, etc. The default value is -100 dB
      • maxDecibels : Maximum decibel value for scaling the FFT analysis data.
        • The default value is -30 dB.
    3. Set source of analyser node
      • Global volume nodee -> analyser node
        scene.sound.masterVolumeNode.connect(analyser);\n
      • A sound instance -> analyser node
        music.volumeNode.connect(analyser);\n
    4. Ouput analyser node to audio context
      analyser.connect(scene.sound.context.destination);\n
    5. Create output data array
      var dataArrayLength = analyser.frequencyBinCount;\nvar dataArray = new Uint8Array(dataArrayLength);\n
    6. Get output data
      analyser.getByteTimeDomainData(dataArray);\n
      • Retrieve output data
        for(var i= 0; i < dataArrayLength; i++) {\nvar data = dataArray[i];\n}\n
    "},{"location":"awaitloader/","title":"Await loader","text":""},{"location":"awaitloader/#introduction","title":"Introduction","text":"

    Await custom task in preload stage.

    • Author: Rex
    • Custom File of loader
    "},{"location":"awaitloader/#live-demos","title":"Live demos","text":"
    • Wait 1000ms
    "},{"location":"awaitloader/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"awaitloader/#install-plugin","title":"Install plugin","text":""},{"location":"awaitloader/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      var sceneConfig = {\n// ....\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'rexawaitloaderplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/    rexawaitloaderplugin.min.js',\nstart: true\n}]\n}\n};\nclass MyScene extends Phaser.Scene {\nconstructor() {\nsuper(sceneConfig)\n}\n// ....\n\npreload() {\n// rexawaitloaderplugin will be installed before preload(), but not added to loader yet\n// Call addToScene(scene) to add this await loader to loader of this scene\nthis.plugins.get('rexawaitloaderplugin').addToScene(this);\n\nthis.load.rexAwait(function(successCallback, failureCallback) { // successCallback()\n});\n}\n}\n
    "},{"location":"awaitloader/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AwaitLoaderPlugin from 'phaser3-rex-plugins/plugins/awaitloader-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAwaitLoader',\nplugin: AwaitLoaderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In preload stage
      scene.load.rexAwait(function(successCallback, failureCallback) { // successCallback()\n});\n
    "},{"location":"awaitloader/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Awaitloader from 'phaser3-rex-plugins/plugins/awaitloader.js';\n
    • Start loading task
      Awaitloader.call(scene.load, function(successCallback, failureCallback) {\n// successCallback();\n}, scope)\n
    "},{"location":"awaitloader/#start-loading-task","title":"Start loading task","text":"

    In preload stage:

    scene.load.rexAwait(function(successCallback, failureCallback) {\n// successCallback();\n}, scope);\n

    or

    var callback = function(successCallback, failureCallback) {\n// successCallback();\n};\nscene.load.rexAwait(key, {\ncallback: callback,\n// scope: scope\n});\n
    1. This plugin runs callback to start custom task.
    2. Calls successCallback when custom task completed, or failureCallback if error.
    "},{"location":"awaytime/","title":"Away time","text":""},{"location":"awaytime/#introduction","title":"Introduction","text":"

    Get time from previous closing application to now.

    • Author: Rex
    • Standalone object
    "},{"location":"awaytime/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"awaytime/#install-plugin","title":"Install plugin","text":""},{"location":"awaytime/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexawaytimeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexawaytimeplugin.min.js', true);\n
    • Get away-time
      var awayTime = scene.plugins.get('rexawaytimeplugin').awayTime;\n
    "},{"location":"awaytime/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AwayTimePlugin from 'phaser3-rex-plugins/plugins/awaytime-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAwayTime',\nplugin: AwayTimePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Get away-time
      var awayTime = scene.plugins.get('rexAwayTime').awayTime;\n
    "},{"location":"awaytime/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import AwayTime from 'phaser3-rex-plugins/plugins/awaytime.js';\n
    • Get away-time
      var awayTime = (new AwayTime()).awayTime;\n
    "},{"location":"awaytime/#default-away-timer","title":"Default away-timer","text":""},{"location":"awaytime/#get-away-time","title":"Get away-time","text":"
    var awayTime = scene.plugins.get('rexAwayTime').awayTime;\n// var awayTime = scene.plugins.get('rexAwayTime').setKey(key).setPeriod(time).awayTime;\n
    • awayTime : Time in millisecond.
    • key : Save curent time-stamp in key of localstorage. Default value is 'away'.
    • time : Period of saving current time-stamp. Default value is 1000.

    Note

    This action also starts saving current time-stamp periodically into localstorage.

    "},{"location":"awaytime/#set-key","title":"Set key","text":"
    scene.plugins.get('rexAwayTime').setKey(key);\n
    • key : Save curent time-stamp in key of localstorage
    "},{"location":"awaytime/#set-period","title":"Set period","text":"
    scene.plugins.get('rexAwayTime').setPeriod(time);\n
    • time : Period of saving current time-stamp.
    "},{"location":"awaytime/#add-away-timer-object","title":"Add away timer object","text":"
    var awayTimer = scene.plugins.get('rexAwayTime').add({\nkey: 'away',\nperiod: 1000\n})\n
    "},{"location":"awaytime/#get-away-time_1","title":"Get away-time","text":"
    var awayTime = awayTimer.awayTime;\n

    Will also start timer.

    "},{"location":"awaytime/#stop-timer","title":"Stop timer","text":"
    awayTimer.stop();\n
    "},{"location":"base64/","title":"Base64","text":""},{"location":"base64/#introduction","title":"Introduction","text":"

    Decode a base64 string to an array buffer, or create a base64 string from an array buffer, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"base64/#usage","title":"Usage","text":""},{"location":"base64/#base64-array-buffer","title":"Base64 -> Array buffer","text":"
    var arrayBuffer = Phaser.Utils.Base64.Base64ToArrayBuffer(base64);\n
    "},{"location":"base64/#array-buffer-base64","title":"Array buffer -> Base64","text":"
    var base64 = Phaser.Utils.Base64.ArrayBufferToBase64(arrayBuffer, mediaType);\n
    • mediaType : An optional media type, i.e. audio/ogg or image/jpeg
    "},{"location":"bbcodetext/","title":"BBCode Text","text":""},{"location":"bbcodetext/#introduction","title":"Introduction","text":"

    Drawing text with BBCode protocol.

    • Author: Rex
    • Game object
    "},{"location":"bbcodetext/#live-demos","title":"Live demos","text":"
    • BBCode text
    • Hit area of words
    • Align
    • Escape
    • Page, typing
    • Wrap
      • Mix wrap
    • Font family
    • Measure margin of text
    • Generate texture
    • Image height
    • RTL
    "},{"location":"bbcodetext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bbcodetext/#install-plugin","title":"Install plugin","text":""},{"location":"bbcodetext/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbbcodetextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbbcodetextplugin.min.js', true);\n
    • Add text object
      var txt = scene.add.rexBBCodeText(x, y, content, config);\n
    "},{"location":"bbcodetext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BBCodeTextPlugin from 'phaser3-rex-plugins/plugins/bbcodetext-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBBCodeTextPlugin',\nplugin: BBCodeTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text object
      var txt = scene.add.rexBBCodeText(x, y, content, config);\n
    "},{"location":"bbcodetext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BBCodeText from 'phaser3-rex-plugins/plugins/bbcodetext.js';\n
    • Add text object
      var txt = new BBCodeText(scene, x, y, content, config);\nscene.add.existing(txt);\n
    "},{"location":"bbcodetext/#bbcode","title":"BBCode","text":"
    • Bold : [b]text[/b]
    • Weight : [weight=900]text[/weight]
      • Valid when text does not have bold tag.
    • Italic : [i]text[/i]
    • Color :
      • [color=red]text[/color]
      • [color=#FF0000]text[/color]
      • [color=rgb(255,0,0)]text[/color]
      • [color=rgba(255,0,0,1)]text[/color]
    • Size : [size=18]text[/size]
    • Family : [family=papyrus]text[/family]
    • Stroke : [stroke]text[/stroke]
      • Stroke with color setting : [stroke=red]text[/stroke]
    • Shadow : [shadow]text[/shadow]
      • Shadow with color setting : [shadow=red]text[/shadow]
    • Underline : [u]text[/u]
      • Underline with color setting : [u=red]text[/u]
    • Strikethrough : [s]text[/s]
      • Strikethrough with color setting : [s=red]text[/s]
    • Background color :
      • [bgcolor=red]text[/bgcolor]
      • [bgcolor=#FF0000]text[/bgcolor]
      • [bgcolor=rgb(255,0,0)]text[/bgcolor]
      • [bgcolor=rgba(255,0,0,1)]text[/bgcolor]
    • Superscript, subscript : [y=-12]text[y]
    • Image : [img=imgKey]
    • Hit area of words : [area=key]text[/area]
    • Url link : [url=http...]text[/url]
      • Click this area to open web page on a new tab (window.open(url, '_blank'))
      • Will register hit area with key url:http...
    • Line alignment :
      • [align=left]text[/align],
      • [align=center]text[/align],
      • [align=right]text[/align]
    • Escape : Tags between [esc] ... [/esc] or [raw] ... [/raw] will be treated as content.
      • [esc][color=yellow]Text[/color][/esc]
      • [esc][raw]Text[/raw][/esc]
      • [raw][esc]Text[/esc][/raw]
      • [raw][b]Text[/b][/raw]
    • Do nothing, just a marker :
      • [id=0][color=red]Text[/id]TextText[/color]

    Note

    Can set delimiter [] to another custom value in style of constructor.

    "},{"location":"bbcodetext/#add-text-object","title":"Add text object","text":"
    var txt = scene.add.rexBBCodeText(x, y, '[b]h[/b]ello');\n// var txt = scene.add.rexBBCodeText(x, y, '[b]h[/b]ello', { fontFamily: 'Arial', fontSize: 64, color: '#00ff00' });\n

    Default style

    {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,  // null, css string, or number\nbackgroundColor2: null,  // null, css string, or number\nbackgroundHorizontalGradient: true,\nbackgroundStrokeColor: null,  // null, css string, or number\nbackgroundStrokeLineWidth: 2,\n\nbackgroundCornerRadius: 0,  // 0   : no round corner, \n// > 0 : convex round corner\n// < 0 : concave round corner\n\nbackgroundCornerIteration: null,    color: '#fff',  // null, css string, or number\nstroke: '#fff',  // null, css string, or number\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',  // css string, or number\nblur: 0,\nstroke: false,\nfill: false\n},\nunderline: {\ncolor: '#000',  // css string, or number\nthickness: 0,\noffset: 0\n},\nstrikethrough: {\ncolor: '#000',  // css string, or number\nthickness: 0,\noffset: 0\n},\n// align: 'left',  // Equal to halign\nhalign: 'left', // 'left'|'center'|'right'\nvalign: 'top',  // 'top'|'center'|'bottom'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\ntestString: '|M\u00c9qgy',\n\nwrap: {\nmode: 'none',     // 0|'none'|1|'word'|2|'char'|'character'|3|'mix'\nwidth: null\n},\n// wordWrap: { width: 0 },   // Compatible with Text game object\n\n// rtl: false,\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n\n// images: {\n//     imgKey: {y: -8}\n// },\n\n// delimiters: '[]',\n\n// sharedPool: true,\n\n// urlTagCursorStyle: 'pointer',\n// interactive: false\n}\n

    or

    var txt = scene.add.rexBBCodeText({\nx: 0,\ny: 0,\ntext: '',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',\nbackgroundColor: '#ff00ff',\n// ...\n},\n})\n

    or

    var txt = scene.make.rexBBCodeText({\nx: 0,\ny: 0,\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n//x: 32,    // 32px padding on the left/right\n//y: 16     // 16px padding on the top/bottom\n},\ntext: 'Text\\nGame Object\\nCreated from config',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',\nbackgroundColor: '#ff00ff',\n// ...\n},\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    • Alignment
      • halign, or align : Horizontal alignment.
        • 'left', 'center', 'right'
      • valign : Vertical alignment.
        • 'top', 'center', 'bottom'
    • images : See Image
    • delimiters : Delimiters of tags, default value is [].
      • Don't use () as delimiters, which is preserved for color value.
    • sharedPool :
      • true : Use shared resouce pools during game. Default behavior.
      • false : Use local resource pools, will be free when game object destroying.
    • urlTagCursorStyle : Cursor style when cursor moving over a url tag. Default value is 'pointer'.
    • interactive :
      • true : Invoke txt.setInteractive() for hit-area tag, or url tag.
      • false : Do nothing. Default behavior.
    "},{"location":"bbcodetext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends BBCodeText {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, '[b]h[/b]ello');\n
    "},{"location":"bbcodetext/#wrap","title":"Wrap","text":"
    • Wrap by word or character.
      var txt = scene.make.rexBBCodeText({\nx: 400,\ny: 100,\ntext: 'The sky above the port was the color of television, tuned to a dead channel.',\norigin: { x: 0.5, y: 0.5 },\nstyle: {\nfont: 'bold 25px Arial',\nfill: 'white',\nwrap: {\nmode: 'none',    // 0|'none'|1|'word'|2|'char'|'character'|3|'mix'\nwidth: 0\n}\n}\n});\n
      • wrap.mode :
        • 0, or 'none' : No wrapping, default behavior.
        • 1, or 'word' : Word wrapping.
        • 2, or 'char', or 'character' : Character wrapping.
        • 3, or 'mix' : Word wrapping for ASCII word, Character wrapping for other (unicode) word.
      • wrap.width : Maximun wrapping width of a line.
        • Wrap-fit : Set wrapping width to fixedWidth - padding.left - padding.right if fixedWidth > 0
    • Wrap mode
      • Get
        var mode = txt.style.wrapMode;\n
      • Set
        txt.setWrapMode(mode);\n
        • 0, or 'none' : No wrapping.
        • 1, or 'word' : Word wrapping.
        • 2, or 'char', or 'character' : Character wrapping.
        • 3, or 'mix' : Word wrapping for ASCII word, Character wrapping for other (unicode) word.
    • Wrap width
      • Get
        var width = txt.style.wrapWidth;\n
      • Set
        txt.setWrapWidth(width);\n// txt.setWordWrapWidth(width);\n
        • width : Maximun wrapping width of a line.
          • Wrap-fit : Set wrapping width to fixedWidth - padding.left - padding.right if fixedWidth > 0
    "},{"location":"bbcodetext/#content","title":"Content","text":"
    • Get source text
      var curContent = txt.text;\n
    • Get plain text
      var plainText = txt.getPlainText();\n
      var plainText = txt.getPlainText(content);\n
    • Get sub-string
      var text = txt.getText(start, end);\n
    • Get wrapped lines
      var linesArray = txt.getWrappedText();\n
      var linesArray = txt.getWrappedText(content);\n
    • Set
      txt.setText('[b]h[/b]ello');\n// txt.text = '[b]h[/b]ello';\n
    • Append
      txt.appendText(text);\n// txt.text += '\\n' + text;\n
      or
      txt.appendText(text, false);\n// txt.text += text;\n
    "},{"location":"bbcodetext/#set-style","title":"Set style","text":"
    txt.setStyle(style);\ntxt.setFont(font);  // font: {fontFamily, fontSize, fontStyle}\ntxt.setFontFamily(family);\ntxt.setFontSize(size);\ntxt.setFontStyle(style);\n
    "},{"location":"bbcodetext/#color","title":"Color","text":"
    • Text color
      • Get
        var color = txt.style.color;\n
      • Set
        txt.setColor(color);\n
        or
        txt.setFill(color);\n
        • color : null, css string, or number.
    • Stroke color, thickness
      • Get
        var color = txt.style.stroke;\nvar thickness = txt.style.strokeThickness;\n
      • Set
        txt.setStroke(color, thickness);\n
        • color : null, css string, or number.
      • Clear
        txt.setStroke();\n
    • Underline color, thickness
      • Get
        var color = txt.style.underlineColor;\nvar thickness = txt.style.underlineThickness;\nvar offset = txt.style.underlineOffset;\n
      • Set
        txt.setUnderline(color, thickness, ofset);\ntxt.setUnderlineColor(color);\ntxt.setUnderlineThinkness(thickness);\ntxt.setUnderlineOffset(ofset);\n
        • color : null, css string, or number.
    • Strikethrough color, thickness
      • Get
        var color = txt.style.strikethroughColor;\nvar thickness = txt.style.strikethroughThickness;\nvar offset = txt.style.strikethroughOffset;\n
      • Set
        txt.setStrikethrough(color, thickness, ofset);\ntxt.setStrikethroughColor(color);\ntxt.setStrikethroughThinkness(thickness);\ntxt.setStrikethroughOffset(ofset);\n
        • color : null, css string, or number.
    • Background
      • Color, or gradient color
        • Get
          var color = txt.style.backgroundColor;\nvar color2 = txt.style.backgroundColor2;\nvar isHorizontalGradient = txt.style.backgroundHorizontalGradient;\n
        • Set
          txt.setBackgroundColor(color);\n// txt.setBackgroundColor(color, color2, isHorizontalGradient);\n
          • color, color2 : null, css string, or number.
      • Stroke color
        • Get
          var color = txt.style.backgroundStrokeColor;\nvar lineWidth = txt.style.backgroundStrokeLineWidth;\n
        • Set
          txt.setBackgroundStrokeColor(color, lineWidth);\n
          • color : null, css string, or number.
      • Round rectangle
        • Get
          var radius = txt.style.backgroundCornerRadius;\nvar iteration = txt.style.backgroundCornerIteration;\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
        • Set
          txt.setBackgroundCornerRadius(radius);\n// txt.setBackgroundCornerRadius(radius, iteration);\n
          • iteration :
            • undefined : Round rectangle
            • 0 : Octagon
    • Shadow
      • Get
        var color = txt.style.shadowColor;\nvar offsetX = txt.style.shadowOffsetX;\nvar offsetY = txt.style.shadowOffsetY;\nvar blur = txt.style.shadowBlur;\nvar stroke = txt.style.shadowStroke;\nvar enabled = txt.style.shadowFill;\n
      • Set
        txt.setShadow(x, y, color, blur, shadowStroke, shadowFill);\ntxt.setShadowOffset(x, y);\ntxt.setShadowColor(color);\ntxt.setShadowBlur(blur);\ntxt.setShadowStroke(enabled);\ntxt.setShadowFill(enabled);\n
        • color : null, css string, or number.
    "},{"location":"bbcodetext/#align","title":"Align","text":"
    • Horizontal align
      • Get
        var align = txt.style.halign;\n
        • align : 'left', 'center', 'right'
      • Set
        txt.setHAlign(align);    
        or
        txt.setAlign(align);    
        • align : 'left', 'center', 'right'
    • Vertical align
      • Get
        var align = txt.style.valign;\n
        • align : 'top', 'center', 'bottom'
      • Set
        txt.setVAlign(align);    
        • align : 'top', 'center', 'bottom'
    "},{"location":"bbcodetext/#image","title":"Image","text":"
    • Uses texture key as image key by default.
    • Add image render information
      txt.addImage(imgKey, {\nkey: textureKey,\nframe: frameName,\nwidth: undefined,\nheight: undefined,\ny: 0,\nleft: 0,\nright: 0,\noriginX: 0,\noriginY: 0,\ntintFill: false,\n});\n
      • imgKey : Image key used in text content, i.e. [img=imgKey].
      • key : Texture key.
      • frame : Frame name.
      • width : Render width, set undefined to use the cut width of frame.
      • height : Render height, set undefined to use the cut height of frame.
      • y : Extra offset y.
      • left : Left padding space.
      • Right : Right padding space.
      • originX : Offset x via frame width * originX
      • originY : Offset y via frame height * originY
      • tintFill :
        • false : Keep original color. Default behavior.
        • true : Change fill-color by color tag. [color=...][img=...].
    • Add some image render informations
      txt.addImage(data);\n
      • data : {imgKey, config}
    "},{"location":"bbcodetext/#hit-area-of-words","title":"Hit area of words","text":"

    Size of hit-area is word-width x line-height, or image-width x line-height.

    "},{"location":"bbcodetext/#hitting-events","title":"Hitting events","text":"
    • Pointer down
      txt.on('areadown', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areadown-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer click : pointer down then up, without pointer out
      txt.on('areaclick', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaclick-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer up
      txt.on('areaup', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaup-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer over
      txt.on('areaover', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaover-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer out
      txt.on('areaout', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaout-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    "},{"location":"bbcodetext/#draw-hit-areas","title":"Draw hit-areas","text":"
    txt.drawAreaBounds(graphics, color);\n
    • graphics : Graphics game object
    • color : Default value is 0xffffff
    "},{"location":"bbcodetext/#line-spacing","title":"Line spacing","text":"

    This value is added to the height of the font when calculating the overall line height.

    • Get
      var lineSpacing = txt.style.lineSpacing;\n
    • Set
      txt.setLineSpacing(value);\n
    "},{"location":"bbcodetext/#padding","title":"Padding","text":"
    • Get
      var left = txt.padding.left;\nvar top = txt.padding.top;\nvar right = txt.padding.right;\nvar bottom = txt.padding.bottom;\n
    • Set
      txt.setPadding(left, top, right, bottom);\n// txt.setPadding(padding); // padding: {left, top, right, bottom}\n
    "},{"location":"bbcodetext/#max-lines","title":"Max lines","text":"
    • Get
      var maxLines = txt.style.maxLines;\n
    • Set
      txt.setMaxLines(max);\n
    "},{"location":"bbcodetext/#fixed-size","title":"Fixed size","text":"
    • Get
      var width = txt.style.fixedWidth;\nvar height = txt.style.fixedHeight;\n
    • Set
      txt.setFixedSize(width, height);\n
    "},{"location":"bbcodetext/#margin-of-text","title":"Margin of text","text":"
    var leftMargin = txt.measureTextMargins(testString).left;\n
    • testString : Measure left margin of this text.
    "},{"location":"bbcodetext/#shift-start-position-of-text","title":"Shift start position of text","text":"
    txt.setXOffset(value);\n
    "},{"location":"bbcodetext/#resolution","title":"Resolution","text":"
    • Get
      var resolution = txt.style.resolution;\n
    • Set
      txt.setResolution(resolution);\n
    "},{"location":"bbcodetext/#test-string","title":"Test string","text":"

    Set the test string to use when measuring the font.

    txt.setTestString(text);\n
    "},{"location":"bbcodetext/#save-texture","title":"Save texture","text":"
    txt.generateTexture(key);\n// txt.generateTexture(key, x, y, width, height);\n
    "},{"location":"bbcodetext/#delimiters","title":"Delimiters","text":"
    txt.setDelimiters(delimiters);  // '<>', or ['<', '>']\n

    or

    txt.setDelimiters(delimiterLeft, delimiterRight); // '<', '>'\n

    Warning

    Don't use () as delimiters, which is preserved for color value.

    "},{"location":"bbcodetext/#rtl","title":"RTL","text":"
    • Set rtl in style config when creating this text game object
    • Change rtl during runtime
      txt.setRTL(rtl).setText(newContent);\n
      • Invoke setRTL method before setting new content.
    "},{"location":"bbcodetext/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"bbcodetext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"bbcodetext/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"bitmaptext/","title":"Static bitmap text","text":""},{"location":"bitmaptext/#introduction","title":"Introduction","text":"

    Drawing text by texture, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"bitmaptext/#usage","title":"Usage","text":""},{"location":"bitmaptext/#load-bitmap-font","title":"Load bitmap font","text":"
    • Load bitmap font from texture and xml configuration
      scene.load.bitmapFont(key, textureURL, xmlURL);\n
      • Reference: load bitmap font
      • Loaded texture also can be used for Image, Sprite, or Arcade Image, Arcade Sprite
        scene.add.image(x, y, key, char);\n
    • Load retro bitmap font from texture and JSON configuration
      1. Load texture in preload stage
        scene.load.image(key, url);\n
        Reference: load image
      2. Add retro bitmap font
        var config = {\n// image\nimage: '',\noffset: {\nx: 0,\ny: 0\n},\n// characters\nwidth: 32,\nheight: 32,\nchars: '',\ncharsPerRow: 10,\n// spacing\nspacing: {\nx: 0,\ny: 0\n},\nlineSpacing: 0\n}\nscene.cache.bitmapFont.add(key, Phaser.GameObjects.RetroFont.Parse(scene, config));\n
        • Image :
          • image : The key of the image containing the font.
          • offset : If the font set doesn't start at the top left of the given image, specify the X/Y coordinate offset here.
        • Characters :
          • width : The width of each character in the font set.
          • height : The height of each character in the font set.
          • chars : The characters used in the font set, in display order.
            • Default characters set
          • charsPerRow : The number of characters per row in the font set. If not given charsPerRow will be the image width / characterWidth.
        • Spacing :
          • spacing : If the characters in the font set have horizontal/vertical spacing between them set the required amount here.
          • lineSpacing : The amount of vertical space to add to the line height of the font.
    "},{"location":"bitmaptext/#add-bitmap-text-object","title":"Add bitmap text object","text":"
    var txt = scene.add.bitmapText(x, y, key, text);\n// var txt = scene.add.bitmapText(x, y, key, text, size, align);\n
    • size : The size of the font
    • align : The alignment of the text in a multi-line BitmapText object.
      • 0 : Left aligned (default)
      • 1 : Middle aligned
      • 2 : Right aligned

    Add text from JSON

    var txt = scene.make.bitmapText({\nx: 0,\ny: 0,\ntext: 'Text\\nGame Object\\nCreated from config',\nfont: '',\nsize: false,\nalign: 0,\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"bitmaptext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends Phaser.GameObjects.BitmapText {\nconstructor(scene, x, y, key, text, size, align) {\nsuper(scene, x, y, key, text, size, align);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, key, text);\n
    "},{"location":"bitmaptext/#set-text","title":"Set text","text":"
    txt.setText('...');\n

    or

    txt.text = '...';\n
    "},{"location":"bitmaptext/#set-align","title":"Set align","text":"
    • Left aligned
      txt.setLeftAlign();\n
    • Middle aligned
      txt.setCenterAlign();\n
    • Right aligned
      txt.setRightAlign();\n

    or

    txt.align = align;\n
    • align :
      • 0 : Left aligned (default)
      • 1 : Middle aligned
      • 2 : Right aligned
    "},{"location":"bitmaptext/#set-letter-spacing","title":"Set letter spacing","text":"
    txt.setLetterSpacing(spacing);\n

    or

    txt.letterSpacing = spacing;\n

    Can be a positive value to increase the space, or negative to reduce it.

    "},{"location":"bitmaptext/#set-line-spacing","title":"Set line spacing","text":"
    txt.setLineSpacing(spacing);\n

    or

    txt.lineSpacing = spacing;\n

    Can be a positive value to increase the space, or negative to reduce it.

    "},{"location":"bitmaptext/#set-font-size","title":"Set font size","text":"
    txt.setFontSize(size);\n

    or

    txt.fontSize = size;\n
    "},{"location":"bitmaptext/#set-font","title":"Set font","text":"
    txt.setFont(key);\n// txt.setFont(key, size, align);\n
    "},{"location":"bitmaptext/#tint","title":"Tint","text":"

    See Tint.

    "},{"location":"bitmaptext/#color-of-characters","title":"Color of characters","text":"
    • By character
      txt.setCharacterTint(start, length, tintFill, color);\n// txt.setCharacterTint(start, length, tintFill, topLeft, topRight, bottomLeft, bottomRight);\n
      • start : Index starting character.
        • < 0 : Counts back from the end of the text.
      • length : Number of characters to tint.
        • -1 : All characters from start
      • tintFill :
        • true : Fill-based tint
        • false : Additive tint
      • color, or topLeft, topRight, bottomLeft, bottomRight : Color integer.
    • By word
      txt.setWordTint(word, count, tintFill, color);\n// txt.setWordTint(word, count, tintFill, topLeft, topRight, bottomLeft, bottomRight);\n
      • word : The word to search for.
        • A string
        • An index of the word in the words array.
      • count : Number of matching words to tint.
        • -1 : All matching words
      • tintFill :
        • true : Fill-based tint
        • false : Additive tint
      • color, or topLeft, topRight, bottomLeft, bottomRight : Color integer.
    "},{"location":"bitmaptext/#drop-shadow-effect","title":"Drop shadow effect","text":"
    txt.setDropShadow(x, y, color, alpha);\n

    or

    txt.dropShadowX = x;\ntxt.dropShadowY = y;\ntxt.dropShadowColor = color;\ntxt.dropShadowAlpha = alpha;\n
    • x, y : The horizontal/vertical offset of the drop shadow.
    • color : The color of the drop shadow.
    • alpha : The alpha of the drop shadow.

    Note

    WebGL only

    "},{"location":"bitmaptext/#wrap","title":"Wrap","text":"
    • Wrap
      txt.setMaxWidth(width);\n// txt.setMaxWidth(width, wordWrapCharCode);\n
      • width : Line width in pixels.
      • wordWrapCharCode : The character code to check for when word wrapping. Defaults to 32 (the space character)
    • Disable wrapping
      txt.setMaxWidth(0);\n
    "},{"location":"bitmaptext/#get-bounds","title":"Get bounds","text":"
    var width = txt.width;\nvar height = txt.height;\n

    or

    var bounds = txt.getTextBounds(round);\n// bounds = {\n//     local: {\n//         x: 0,\n//         y: 0,\n//         width: 0,\n//         height: 0\n//     },\n//     global: {\n//         x: 0,\n//         y: 0,\n//         width: 0,\n//         height: 0\n//     },\n//     lines: {\n//         shortest: 0,\n//         longest: 0,\n//         lengths: null,\n//         height: 0\n//     },\n//     wrappedText: '',\n//     words: [],\n//     characters: [],\n//     scaleX: 0,\n//     scaleY: 0\n// };\n
    • round : Set true to round the results to the nearest integer.
    • local : The BitmapText based on fontSize and 0x0 coords.
    • global : The BitmapText, taking into account scale and world position.
    • lines : The BitmapText line data.
    • wrappedText : Wrapped content joined with '\\n'.
    • characters : Information of each character.
      {\nchar, code, i, idx, x, y, w, h, t, b, r, line\n}\n
      • char : Character (string).
      • code: Character code (number)
      • i : Index of character
      • x , y : World position of this character
      • w, h : Width/height of this character
      • t, b : The top/bottom of the line this character is on.
      • r : The right-most point of this character, including xAdvance.
      • line : The line number the character appears on.
    • words : Information of each word.
      {\nword, i, x, y, w, h, cr\n\n}\n
      • word : Word string.
      • i : Index of start character
      • x, y : World position of start character
      • w , h : Width/height of word
      • cr : Is last word of current line
    • scaleX, scaleY : Scale of width and height.
    "},{"location":"bitmaptext/#get-information-of-character","title":"Get information of character","text":"
    var data = txt.getCharacterAt(x, y);\n// var data = txt.getCharacterAt(x, y, camera);\n
    • x, y : World position.
    • camera : The Camera which is being tested against.
    • data : Information of character at world position.
      {\nchar, code, i, x, y, w, h, t, b, r, line\n}\n
      • char : Character (string).
      • code: Character code (number)
      • i : Index of character
      • x , y : World position of this character
      • w, h : Width/height of this character
      • t, b : The top/bottom of the line this character is on.
      • r : The right-most point of this character, including xAdvance.
      • line : The line number the character appears on.
    "},{"location":"bitmaptext/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"bitmaptext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"bitmaptext/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"bitmaptext/#appendix","title":"Appendix","text":""},{"location":"bitmaptext/#default-characters-set-of-retro-font","title":"Default characters set of retro font","text":"
    • Phaser.GameObjects.RetroFont.TEXT_SET1 :
      ' !\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET2 :
      ' !\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET3 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '\n
    • Phaser.GameObjects.RetroFont.TEXT_SET4 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET5 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() \\'!?-*:0123456789'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET6 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.\\' '\n
    • Phaser.GameObjects.RetroFont.TEXT_SET7 :
      'AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-\\'39'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET8 :
      '0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET9 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,\\'\"?!'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET10 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n
    • Phaser.GameObjects.RetroFont.TEXT_SET11 :
      'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()\\':;0123456789'\n
    "},{"location":"bitmapzone/","title":"Bitmap zone","text":""},{"location":"bitmapzone/#introduction","title":"Introduction","text":"

    Particles' emitter zone from canvas bitmap of text/canvas game object.

    • Author: Rex
    • Geometry object
    "},{"location":"bitmapzone/#live-demo","title":"Live demo","text":"
    • Particles
    "},{"location":"bitmapzone/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bitmapzone/#install-plugin","title":"Install plugin","text":""},{"location":"bitmapzone/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbitmapzoneplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbitmapzoneplugin.min.js', true);\n
    • Add bitmap-zone object
      var bitmapZone = scene.plugins.get('rexbitmapzoneplugin').add(gameObject, config);\n
    "},{"location":"bitmapzone/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BitmapZonePlugin from 'phaser3-rex-plugins/plugins/bitmapzone-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBitmapZone',\nplugin: BitmapZonePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add bitmap-zone object
      var bitmapZone = scene.plugins.get('rexBitmapZone').add(gameObject, config);\n
    "},{"location":"bitmapzone/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BitmapZone from 'phaser3-rex-plugins/plugins/bitmapzone.js';\n
    • Add bitmap-zone object
      var bitmapZone = new BitmapZone(gameObject, config);\n
    "},{"location":"bitmapzone/#create-shape","title":"Create shape","text":"
    var bitmapZone = scene.plugins.get('rexBitmapZone').add(gameObject);\n
    • gameObject :
      • Any kind of text object : Text object, bbcode text object, or tag text object.
      • Canvas object
    "},{"location":"bitmapzone/#emit-zone","title":"Emit zone","text":"
    var particles = scene.add.particles(key,\n[\n// emitter config\n{\n// blendMode:\n// scale:\n// speed:\n// garvityY:\nemitZone: {\ntype: 'random',\nsource: bitmapZone\n}\n}\n]);\n

    bitmapZone provides getRandomPoint method.

    "},{"location":"bitmapzone/#update-content","title":"Update content","text":"
    bitmapZone.setSource(gameObject);\n
    "},{"location":"blendmode/","title":"Blend mode","text":""},{"location":"blendmode/#introduction","title":"Introduction","text":"

    Constant value of blend modes.

    • Author: Richard Davey
    "},{"location":"blendmode/#usage","title":"Usage","text":""},{"location":"blendmode/#webgl-and-canvas","title":"WebGL and Canvas","text":"
    • 'NORMAL', or Phaser.BlendModes.NORMAL, or 0
      • Default setting and draws new shapes on top of the existing canvas content.
    • 'ADD', or Phaser.BlendModes.ADD, or 1
      • Where both shapes overlap the color is determined by adding color values.
    • 'MULTIPLY', or Phaser.BlendModes.MULTIPLY, or 2
      • The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result.
    • 'SCREEN', or Phaser.BlendModes.SCREEN, or 3
      • The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply)
    • 'ERASE', or Phaser.BlendModes.ERASE, or 17
      • Alpha erase blend mode. Only works when rendering to a framebuffer, like a Render Texture
    "},{"location":"blendmode/#canvas-only","title":"Canvas only","text":"
    • 'OVERLAY', or Phaser.BlendModes.OVERLAY, or 4
      • A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter.
    • 'DARKEN', or Phaser.BlendModes.DARKEN, or 5
      • Retains the darkest pixels of both layers.
    • 'LIGHTEN', or Phaser.BlendModes.LIGHTEN, or 6
      • Retains the lightest pixels of both layers.
    • 'COLOR_DODGE', or Phaser.BlendModes.COLOR_DODGE, or 7
      • Divides the bottom layer by the inverted top layer.
    • 'COLOR_BURN', or Phaser.BlendModes.COLOR_BURN, or 8
      • Divides the inverted bottom layer by the top layer, and then inverts the result.
    • 'HARD_LIGHT', or Phaser.BlendModes.HARD_LIGHT, or 9
      • A combination of multiply and screen like overlay, but with top and bottom layer swapped.
    • 'SOFT_LIGHT', or Phaser.BlendModes.SOFT_LIGHT, or 10
      • A softer version of hard-light. Pure black or white does not result in pure black or white.
    • 'DIFFERENCE', or Phaser.BlendModes.DIFFERENCE, or 11
      • Subtracts the bottom layer from the top layer or the other way round to always get a positive value.
    • 'EXCLUSION', or Phaser.BlendModes.EXCLUSION, or 12
      • Like difference, but with lower contrast.
    • 'HUE', or Phaser.BlendModes.HUE, or 13
      • Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.
    • 'SATURATION', or Phaser.BlendModes.SATURATION, or 14
      • Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.
    • 'COLOR', or Phaser.BlendModes.COLOR, or 15
      • Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.
    • 'LUMINOSITY', or Phaser.BlendModes.LUMINOSITY, or 16
      • Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.
    • 'SOURCE_IN', or Phaser.BlendModes.SOURCE_IN, or 18
      • The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent.
    • 'SOURCE_OUT', or Phaser.BlendModes.SOURCE_OUT, or 19
      • The new shape is drawn where it doesn't overlap the existing canvas content.
    • 'SOURCE_ATOP', or Phaser.BlendModes.SOURCE_ATOP, or 20
      • The new shape is only drawn where it overlaps the existing canvas content.
    • 'DESTINATION_OVER', or Phaser.BlendModes.DESTINATION_OVER, or 21
      • New shapes are drawn behind the existing canvas content.
    • 'DESTINATION_IN', or Phaser.BlendModes.DESTINATION_IN, or 22
      • The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent.
    • 'DESTINATION_OUT', or Phaser.BlendModes.DESTINATION_OUT, or 23
      • The existing content is kept where it doesn't overlap the new shape.
    • 'DESTINATION_ATOP', or Phaser.BlendModes.DESTINATION_ATOP, or 24
      • The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content.
    • 'LIGHTER', or Phaser.BlendModes.LIGHTER, or 25
      • Where both shapes overlap the color is determined by adding color values.
    • 'COPY', or Phaser.BlendModes.COPY, or 26
      • Only the new shape is shown.
    • 'XOR', or Phaser.BlendModes.XOR, or 27
      • Shapes are made transparent where both overlap and drawn normal everywhere else.

    Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these reasons try to be careful about the construction of your Scene and the frequency in which blend modes are used.

    "},{"location":"blitter/","title":"Blitter","text":""},{"location":"blitter/#introduction","title":"Introduction","text":"

    Display of static images, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"blitter/#usage","title":"Usage","text":""},{"location":"blitter/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"blitter/#add-blitter-container","title":"Add blitter container","text":"

    Add blitter container

    var blitter = scene.add.blitter(x, y, key);\n

    Add blitter container from JSON

    var blitter = scene.make.blitter({\nx: 0,\ny: 0,\nkey: '',\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"blitter/#custom-class","title":"Custom class","text":"
    • Define class
      class MyBlitter extends Phaser.GameObjects.Blitter {\nconstructor(scene, x, y, texture, frame) {\nsuper(scene, x, y, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var blitter = new MyBlitter(scene, x, y, key);\n
    "},{"location":"blitter/#add-bob-object","title":"Add bob object","text":"
    var bob = blitter.create(x, y);\n// var bob = blitter.create(x, y, frame, visible, index);\n
    • frame : The Frame the Bob will use. It must be part of the Texture the parent Blitter object is using.
    • visible : Should the created Bob render or not?
    • index : The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list.
    "},{"location":"blitter/#add-mutiple-bob-objects","title":"Add mutiple bob objects","text":"
    var bobs = blitter.createMultiple(quantity, frame, visible);\n
    • quantity : The quantity of Bob objects to create.
    "},{"location":"blitter/#add-bob-object-from-callback","title":"Add bob object from callback","text":"
    var bobs = blitter.createFromCallback(callback, quantity, frame, visible)\n// var callback = function(bob, i){};\n
    "},{"location":"blitter/#get-bob-objects","title":"Get bob objects","text":"
    var bobs = blitter.children.list;\n
    "},{"location":"blitter/#clear-all-bob-objects","title":"Clear all bob objects","text":"
    blitter.clear();\n
    "},{"location":"blitter/#bob-object","title":"Bob object","text":"

    A Bob has a position, alpha value and a frame from a texture that it uses to render with. You can also toggle the flipped and visible state of the Bob.

    "},{"location":"blitter/#position","title":"Position","text":"
    • Get
      var x = bob.x;\nvar y = bob.y;\n
    • Set
      bob.setPosition(x, y);\n// bob.x = 0;\n// bob.y = 0;\n
      or
      bob.reset(x, y);\n// bob.reset(x, y, frame);\n
    "},{"location":"blitter/#frame","title":"Frame","text":"
    • Get
      var frame = bob.frame;\n
      • frame : Frame object.
    • Set
      bob.setFrame(frame);\n
    "},{"location":"blitter/#flip","title":"Flip","text":"
    • Get
      var flipX = bob.flipX;\nvar flipY = bob.flipY;\n
    • Set
      bob.setFlip(boolX, boolY);\n// bob.setFlipX(boolean);\n// bob.setFlipY(boolean);\n// bob.flipX = flipX;\n// bob.flipY = flipY;\n
      or
      bob.resetFlip(); // bob.setFlip(false, false)\n
    "},{"location":"blitter/#visible","title":"Visible","text":"
    • Get
      var visible = bob.visible;\n
    • Set
      bob.setVisible(boolean);\n// bob.visible = v;\n
    "},{"location":"blitter/#alpha","title":"Alpha","text":"
    • Get
      var alpha = bob.alpha;\n
    • Set
      bob.setAlpha(v);\n// bob.aplha = v;\n
    "},{"location":"blitter/#tint","title":"Tint","text":"
    • Get
      var tint = bob.tint;\n
    • Set
      bob.setTint(tint);\n// bob.tint = tint;\n
      • tint : Tint value, between 0 and 0xffffff.
    "},{"location":"blitter/#destroy","title":"Destroy","text":"
    bob.destroy();\n
    "},{"location":"blitter/#data","title":"Data","text":"
    var data = bob.data;  // {}\n
    "},{"location":"blitter/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"blitter/#create-mask","title":"Create mask","text":"
    var mask = bob.createBitmapMask();\n

    See mask

    "},{"location":"blitter/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"board-bejeweled/","title":"Bejeweled","text":""},{"location":"board-bejeweled/#introduction","title":"Introduction","text":"

    Match3-like gameplay template.

    • Author: Rex
    • Template
    "},{"location":"board-bejeweled/#live-demos","title":"Live demos","text":"
    • Events
    • Custom input
    • Mask
    "},{"location":"board-bejeweled/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-bejeweled/#install-plugin","title":"Install plugin","text":""},{"location":"board-bejeweled/#load-minify-file","title":"Load minify file","text":"
    • Load rexBoard plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\nscene.load.script('rexbejeweled', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbejeweled.min.js');\n
    • Add bejeweled object
      var bejeweled = new rexbejeweled(scene, config);\n
    "},{"location":"board-bejeweled/#import-template","title":"Import template","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install rexBoard plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nimport Bejeweled from 'phaser3-rex-plugins/templates/bejeweled/Bejeweled.js';\n\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add bejeweled object
      var bejeweled = new Bejeweled(scene, config);\n
    "},{"location":"board-bejeweled/#create-bejeweled-object","title":"Create bejeweled object","text":"
    var bejeweled = new Bejeweled(scene, {\n// rexBoard: 'rexBoard',\n\nboard: {\ngrid: {\ngridType: 'quadGrid',\nx: 30,\ny: 30 - 600,\ncellWidth: 60,\ncellHeight: 60,\n},\nwidth: 10,\nheight: 20 // Prepared rows: upper 10 rows\n},\nmatch: {\n// wildcard: undefined\n// dirMask: undefined\n},\nchess: {\n// pick random symbol from array, or a callback to return symbol\nsymbols: [0, 1, 2, 3, 4, 5],\n// symbols: function(board, tileX, tileY, excluded) { return symbol; }\n\n// User-defined chess game object\ncreate: function (board) {\n// Create Game object (Shape, Image, or Sprite)\nvar scene = board.scene;\nvar gameObject = scene.add.sprite(0, 0, textureKey, frame);\n// Initial 'symbol' value\ngameObject.setData('symbol', undefined);\n// Add data changed event of 'symbol` key\ngameObject.data.events.on('changedata_symbol', function (gameObject, value, previousValue) {\n// Change the appearance of game object via new symbol value\ngameObject.setFrame(newFrame);\n});\nreturn gameObject;\n},\n\n// scope for callbacks\nscope: undefined,\n\n// moveTo behavior\nmoveTo: {\nspeed: 400\n},\n// tileZ: 1,\n},\n// mask: false,\n\nselect1Action: undefined,\nselect2Action: undefined,\nswapAction: undefined,\nundoSwapAction: undefined,\neliminatingAction: undefined,\nfallingAction: undefined,\n\n// input: true\n})\n

    Configurations

    • rexBoard : Key of 'rexBoard' plugin. Default is 'rexBoard'.
    • Board properties
      • board.width : Board width in tiles.
      • board.height : Board height in tiles.
      • board.grid.x, board.grid.y : World position of tile (0, 0)
      • board.grid.cellWidth, board.grid.cellHeight : The width/height of the cell, in pixels.
    • Chess properties
      • chess.symbols : An array of possible symbols, or a callback to return a symbol. See Generate symbol
      • chess.create, chess.scope : Callback of creating chess object.
      • chess.moveTo.speed : Constant moving speed of chess, in pixel per-second.
    • Custom actions
      • select1Action : Custom select first chess Action
      • select2Action : Custom select second chess Action
      • swapAction : Custon swap action
      • undoSwapAction : Custon undo-swap action
      • eliminatingAction : Custon eliminating action
      • fallingAction : Custon falling action
    • Touch input
      • input : Set true to register default touch input logic.
    • Mask
      • mask :
        • false : No mask. Default behavior.
        • true : Mask invisible upper rows.
          1. Create an internal layer
          2. Mask this internal layer.
    "},{"location":"board-bejeweled/#board-height","title":"Board height","text":"

    Board is separated into two parts: upper and bottom

    • Bottom : Visible N rows, to swap chess and run matching.
    • Upper : Invisible N rows, chess in these rows will move down, to fill bottom rows.

    For example, if amount of visible rows is 10, board.height should set to 20.

    "},{"location":"board-bejeweled/#generate-symbol","title":"Generate symbol","text":"

    Symbols are declared in property chess.symbols in a symbol array like [0, 1, 2, 3, 4, 5], or a callback to return a symbol. The callback also use chess.scope as the scope.

    function(board, tileX, tileY, excluded) {\nreturn symbol\n}\n
    • excluded : undefined or a symbol array. Don't return these symbols.
    "},{"location":"board-bejeweled/#create-chess-object","title":"Create chess object","text":"

    Return a game object from a callback.

    function(board) {\n// Create Game object (Image, Sprite, or Shape)\nvar scene = board.scene;\nvar gameObject = scene.add.sprite(0, 0, textureKey, frame);\n// Initial 'symbol' value\ngameObject.setData('symbol', undefined);\n// Add data changed event of 'symbol` key\ngameObject.data.events.on('changedata_symbol', function (gameObject, value, previousValue) {\n// Change the appearance of game object via new symbol value\ngameObject.setFrame(newFrame);\n});\nreturn gameObject;\n}\n

    Each chess has a symbol value stored in 'symbol' key in private data. Add data changed event of 'symbol' key to change the appearance of game object via new symbol value.

    "},{"location":"board-bejeweled/#states","title":"States","text":"
    graph TD\n\nStart((Start)) --> Select1Start[select1-start]\n\nsubgraph Select 1 states\n  Select1Start --> |Input| Select1[select1]\nend\n\nSelect1 --> select2Start[select2-start]\n\nsubgraph Select 2 states\n  select2Start --> |Input| select2[select2]\nend\n\nselect2Start --> Select1Start\nselect2 --> Swap[swap]\nSwap --> MatchStart[match-start]\n\nsubgraph Match states\n  MatchStart --> Match[match]\n  Match --> Eliminate[eliminate]\n  Match --> MatchEnd[match-end]\n  Eliminate --> Fall[fall]\n  Fall --> Fill[fill]\n  Fill --> Match\nend\n\nMatchEnd --> UndoSwap[undo-swap]\nUndoSwap --> Select1Start\nMatchEnd --> Select1Start
    "},{"location":"board-bejeweled/#select-first-chess","title":"Select first chess","text":"

    Fire 'select1' event

    bejeweled.on('select1', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-select-first-chess-action","title":"Custom Select first chess Action","text":"

    Default select action:

    function (chess, board, bejeweled) {\n// Do nothing\n}\n
    "},{"location":"board-bejeweled/#select-second-chess","title":"Select second chess","text":"

    Fire 'select2' event

    bejeweled.on('select2', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
      • Selected first chess :
        var chess = bejeweled.getSelectedChess1();\n
    "},{"location":"board-bejeweled/#custom-select-second-chess-action","title":"Custom Select second chess Action","text":"

    Default select action: The same as Select first chess Action

    "},{"location":"board-bejeweled/#swap-selected-chess","title":"Swap selected chess","text":"

    Fire 'swap' event

    bejeweled.on('swap', function(selectedChess1, selectedChess2, board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-swap-action","title":"Custom Swap Action","text":"

    Default swap action:

    function (chess1, chess2, board, bejeweled) {\nvar tileXYZ1 = board.chessToTileXYZ(chess1);\nvar tileXYZ2 = board.chessToTileXYZ(chess2);\nvar tileX1 = tileXYZ1.x,\ntileY1 = tileXYZ1.y,\ntileX2 = tileXYZ2.x,\ntileY2 = tileXYZ2.y,\ntileZ = tileXYZ1.z;\n\n// TileZ of chess1 and chess2 are the same, change tileZ of chess2 to a different value\nboard.moveChess(chess2, tileX2, tileY2, `#${tileZ}`, false);\n\n// Move chess1 to tileXYZ2, chess2 to tileXYZ1\nvar moveTo1 = bejeweled.getChessMoveTo(chess1);\nvar moveTo2 = bejeweled.getChessMoveTo(chess2);\nmoveTo1.moveTo(tileX2, tileY2);\nmoveTo2.moveTo(tileX1, tileY1);\n\n// Change tileZ of chess2 back\nboard.moveChess(chess2, tileX1, tileY1, tileZ, false);\n\nif (moveTo1.isRunning) {\nbejeweled.waitEvent(moveTo1, 'complete');\n}\nif (moveTo2.isRunning) {\nbejeweled.waitEvent(moveTo2, 'complete');\n}\n};\n
    • bejeweled.getChessMoveTo(chess) : Get moveTo behavior of a chess.
    • bejeweled.waitEvent(moveTo, 'complete') : Wait 'complete' event of this moveTo behavior.
    "},{"location":"board-bejeweled/#match-start","title":"Match start","text":"

    Fire 'match-start' event

    bejeweled.on('match-start', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#match-lines","title":"Match lines","text":"

    Fire 'match' event

    bejeweled.on('match', function(lines, board, bejeweled) {\n\n}, scope);\n
    • lines : An array of matched lines, each line is a built-in Set object.
      • Length of each line (lines[i].size) could be 5, 4, or 3.
      • lines[i].entries : An array of chess (Game Object) in a matched line.
      • Get cross chess of two lines via lineA.intersect(lineB).
      • All chess game objects in matched lines will be eliminated in next stage.
        • Add/remove chess game object in a line.
        • Add new line/remove a line in lines array to change the eliminated targets.
    • board : Board object.
      • Get tile position {x,y,z} of a chess game object via
        var tileXYZ = board.chessToTileXYZ(gameObject);\n//var tileXYZ = gameObject.rexChess.tileXYZ;\n
      • Get chess game object of a tile position {x,y,z} via
        var gameObject = board.tileXYZToChess(tileX, tileY, tileZ);\n
      • Get array of neighbor chess of a chess game object via
        var gameObjects = board.getNeighborChess(chess, null);\n
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#eliminating-chess","title":"Eliminating chess","text":"

    Fire 'eliminate' event

    bejeweled.on('eliminate', function(chessArray, board, bejeweled) {\n\n}, scope);\n
    • chessArray : An array of chess (Game Object) to be eliminated.
    • board : Board object
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-eliminating-action","title":"Custom Eliminating Action","text":"

    Default eliminating action:

    function (chessArray, board, bejeweled) {\nconst duration = 500; //ms\nfor (var i = 0, cnt = chessArray.length; i < cnt; i++) {\nvar fade = FadeOutDestroy(chessArray[i], duration);\nbejeweled.waitEvent(fade, 'complete');\n}\n}\n
    • bejeweled.waitEvent(fade, 'complete') : Wait 'complete' event of this fade-out-destroy behavior.
    "},{"location":"board-bejeweled/#falling-chess","title":"Falling chess","text":"

    Fire 'fall' event

    bejeweled.on('fall', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-falling-action","title":"Custom Falling Action","text":"

    Default falling action:

    function (board, bejeweled) {\nvar tileZ = bejeweled.chessTileZ,\nchess, moveTo;\n\nfor (var tileY = (board.height - 1); tileY >= 0; tileY--) { // bottom to top\nfor (var tileX = 0, cnt = board.width; tileX < cnt; tileX++) { // left to right\nchess = board.tileXYZToChess(tileX, tileY, tileZ);\nif (chess === null) {\ncontinue;\n}\nmoveTo = bejeweled.getChessMoveTo(chess);\ndo {\nmoveTo.moveToward(1);\n} while (moveTo.lastMoveResult)\nif (moveTo.isRunning) {\nbejeweled.waitEvent(moveTo, 'complete');\n}\n}\n}\n}\n
    • bejeweled.getChessMoveTo(chess) : Get moveTo behavior of a chess.
    • bejeweled.waitEvent(moveTo, 'complete') : Wait 'complete' event of this moveTo behavior.
    "},{"location":"board-bejeweled/#fill-chess","title":"Fill chess","text":"

    Fire 'fill' event

    bejeweled.on('fill', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#match-end","title":"Match end","text":"

    Fire 'match-end' event

    bejeweled.on('match-end', function(board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#undo-swap-selected-chess","title":"Undo-swap selected chess","text":"

    Fire 'undo-swap' event

    bejeweled.on('undo-swap', function(selectedChess1, selectedChess2, board, bejeweled) {\n\n}, scope);\n
    • board : Board object.
    • bejeweled : This bejeweled object.
    "},{"location":"board-bejeweled/#custom-undo-swap-action","title":"Custom Undo-Swap Action","text":"

    Default undo-swap action : Equal to Swap action

    "},{"location":"board-bejeweled/#start-gameplay","title":"Start gameplay","text":"
    bejeweled.start();\n
    "},{"location":"board-bejeweled/#input-control","title":"Input control","text":""},{"location":"board-bejeweled/#default-input","title":"Default input","text":"
    1. Enable default input control
      var bejeweled = new Bejeweled(scene, {\n// ...\ninput: true\n});\n
    2. Enable/disable temporarily.
      • Enable
        bejeweled.setInputEnable();\n
      • Disable
        bejeweled.setInputEnable(false);\n
    "},{"location":"board-bejeweled/#custom-input","title":"Custom input","text":"
    1. Discard default input control
      var bejeweled = new Bejeweled(scene, {\n// ...\ninput: false\n});\n
    2. Add custom input logic like
      scene.input\n.on('pointerdown', function (pointer) {\nvar chess = bejeweled.worldXYToChess(pointer.worldX, pointer.worldY);\nif (chess) {\nbejeweled.selectChess1(chess);\n}\n}, scene)\n.on('pointermove', function (pointer) {\nif (!pointer.isDown) {\nreturn;\n}\nvar chess = bejeweled.worldXYToChess(pointer.worldX, pointer.worldY);\nif (chess && (chess !== this.bejeweled.getSelectedChess1())) {\nbejeweled.selectChess2(chess);\n}\n}, scene);\n
      • Invoke bejeweled.selectChess1(chess), and bejeweled.selectChess2(chess) under custom logic.

    Helper methods

    • Get chess via worldXY position
      var chess = bejeweled.worldXYToChess(worldX, worldY);\n
    • Get chess via tileXY position
      var chess = bejeweled.tileXYToChess(tileX, tileY);\n
    • Get neighbor chess via angle
      var chess2 = bejeweled.getNeighborChessAtAngle(chess1, angle);\n
      • chess1 : Chess object, or tileXY position {x, y}.
      • angle : Angle in radius.
    • Get neighbor chess via direction
      var chess2 = bejeweled.getNeighborChessAtDirection(chess1, direction);\n
      • chess1 : Chess object, or tileXY position {x, y}.
      • direction : Number, or string number.
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
    "},{"location":"board-bejeweled/#data","title":"Data","text":"
    • Get
      var value = bejeweled.getData(key);\nvar values = bejeweled.getData(keys); // keys: an array of keys\nvar value = bejeweled.data.values[key];\n
    • Set
      bejeweled.setData(key, value);\nbejeweled.setData(obj); // obj: {key0:value0, key1:value1, ...}\nbejeweled.data.values[key] = value;\nbejeweled.data.values[key] += inc;\n
    • Enable
      bejeweled.setDataEnabled();\n
    • Events :
      • Set data evant
        bejeweled.on('setdata', function(bejeweled, key, value){ /* ... */ });\n
      • Change data event
        bejeweled.on('changedata', function(bejeweled, key, value, previousValue){ /* ... */ });\n
        bejeweled.on('changedata-' + key, function(bejeweled, value, previousValue){ /* ... */ });\n

    See data manager

    Note

    Ensure data manager is created before binding any data-changed events.

    "},{"location":"board-bejeweled/#misc","title":"Misc","text":"
    • Board instance
      var board = bejeweled.getBoard();\n
      • board : Board instance.
    • Match instance
      var match = bejeweled.getMatch();\n
      • match : Match instance.
    "},{"location":"board-chessdata/","title":"Chess data","text":""},{"location":"board-chessdata/#introduction","title":"Introduction","text":"

    Properties of chess, chess behavior of Board system.

    • Author: Rex
    • Behavior of chess
    "},{"location":"board-chessdata/#usage","title":"Usage","text":""},{"location":"board-chessdata/#add-chess-data-object","title":"Add chess data object","text":"

    Chess data will be added to game object via gameObject.rexChess once adding this game object to board, or attach any chess behavior.

    "},{"location":"board-chessdata/#get-chess-data","title":"Get chess data","text":"
    var chessData = gameObject.rexChess;\n
    "},{"location":"board-chessdata/#set-tile-z","title":"Set tile Z","text":"
    gameObject.rexChess.setTileZ(tileZ);\n

    (tileX, tileY) won't be changed.

    "},{"location":"board-chessdata/#get-tile-position","title":"Get tile position","text":"
    var tileXYZ = gameObject.rexChess.tileXYZ;\n
    • tileXYZ : Tile position {x,y,z}, return null if this chess is not added to any board.
    "},{"location":"board-chessdata/#get-board","title":"Get board","text":"
    var board = gameObject.rexChess.board;\n
    • board : Board object, or null if this chess is not added to any board.

    See also

    "},{"location":"board-chessdata/#blocker","title":"Blocker","text":"
    • Set
      gameObject.rexChess.setBlocker();\n
    • Disable
      gameObject.rexChess.setBlocker(false);\n
    • Get
      var blocker = gameObject.rexChess.blocker;\n
    "},{"location":"board-fieldofview/","title":"Field of view","text":""},{"location":"board-fieldofview/#introduction","title":"Introduction","text":"

    Visible testing, to find field of view, chess behavior of Board system.

    • Author: Rex
    • Behavior of chess
    "},{"location":"board-fieldofview/#live-demos","title":"Live demos","text":"
    • Field of view
    • Line of sigh
    • Filter visible chess
    • Pre-test callback
    "},{"location":"board-fieldofview/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-fieldofview/#install-plugin","title":"Install plugin","text":""},{"location":"board-fieldofview/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add field-of-view object
      var fieldOfView = scene.rexBoard.add.fieldOfView(chess, config);\n
    "},{"location":"board-fieldofview/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add field-of-view object
      var fieldOfView = scene.rexBoard.add.fieldOfView(chess, config);\n
    "},{"location":"board-fieldofview/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { FieldOfView } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add field-of-view object
      var fieldOfView = new FieldOfView(chess, config);\n
    "},{"location":"board-fieldofview/#create-instance","title":"Create instance","text":"
    var fieldOfView = scene.rexBoard.add.fieldOfView(chess, {\n// face: 0,\n// cone: undefined,\n// coneMode: 0,\n// perspective: false,\n\n// ** pre-test **\n// occupiedTest: false,\n// blockerTest: false,\n// preTestCallback: undefined,\n// preTestCallbackScope: undefined,\n\n// ** cost **\n// costCallback: undefined,\n// costCallbackScope: undefined,\n// cost: undefined,   // constant cost\n\n// debug: {\n//     graphics: undefined,\n//     visibleLineColor: 0x00ff00,\n//     invisibleLineColor: 0xff0000,\n//     log: false,\n// }\n})\n
    • face : Face of chess.
      • 0 ~ 3 : Quad grid.
      • 0 ~ 5 : Hexagon grid.
    • cone : View of cone. Tile position or chess which not in view of cone will be invisible.
      • undefined : Ignore this feature
    • coneMode : Unit of cone , in direction or angle.
      • 'direction', or 0 : Cone in directions. For example, visible directions are between (0 - 2/2) to (0 + 2/2) if set
        face : 0,\ncone : 2,\nconeMode: 0\n
      • 'angle', or 1 : Cone in angle. For example, visible angle is between (0 - 120/2) to (0 + 120/2) if set
        face : 0,\ncone : 120,\nconeMode: 1\n
    • perspective :
      • false : Test visible until blocked tiles. Default behavior.
      • true : Test visible until out-of-board. Will test cross any blocked (invisible) tile.
    • Pre-test : Test tiles on visible path.
      • occupiedTest : Set true to test if target tile position is occupied or not.
      • blockerTest : Set true to test blocker property.
      • preTestCallback, preTestCallbackScope : Custom pre-test function, return false to discard cost function.
        function(tileXYArray, visiblePoints, fieldOfView) {\n// return false;\n}\n
        • tileXYArray[0] is current tileXY position of chess.
    • Cost function of each tile on visible path
      • cost : A constant cost for each non-blocked tile
      • costCallback, costCallbackScope : Get cost via callback
        function(curTile, fieldOfView, tileXYArray) {\nreturn cost;\n}\n
        • Cost of blocker : fieldOfView.BLOCKER.
        • curTile : Currest testing tileXY.
        • tileXYArray : A read only tileXY array of sight path.
    • debug :
      • debug.graphics : A graphics object for showing debug messages.
      • debug.visibleLineColor : Color of visible line. Set undefined to not draw any line.
      • debug.invisibleLineColor : Color of invisible line. Set undefined to not draw any line.

    Note

    Blocker is visible, but tiles behind blocker are invisible.

    "},{"location":"board-fieldofview/#set-pre-test-function","title":"Set pre-test function","text":"
    fieldOfView.setPreTestFunction(callback, scope);\n
    • callback
      var callback = function(tileXYArray, visiblePoints, fieldOfView) {\nreturn false;\n}\n
      • tileXYArray[0] is current tileXY position of chess.
    "},{"location":"board-fieldofview/#set-cost-function","title":"Set cost function","text":"
    • Constant cost for each non-blocked tile
      fieldOfView.setCostFunction(cost);\n
    • Get cost via callback
      fieldOfView.setCostFunction(callback, scope);\n
      • callback
        var callback = function(curTile, fieldOfView, tileXYArray) {\nreturn cost;\n}\n
        • Cost of blocker : fieldOfView.BLOCKER
        • curTile : Currest testing tileXY.
        • tileXYArray : A read only tileXY array of sight path.
    "},{"location":"board-fieldofview/#is-tilexychess-visible","title":"Is tileXY/chess visible","text":"
    var isVisible = fieldOfView.isInLOS(chess);\n// var isVisible = fieldOfView.isInLOS(chess, visiblePoints);\n// var isVisible = fieldOfView.isInLOS(chess, visiblePoints, originTileXY);\n
    • chess : Chess object or tileXY
    • visiblePoints
      • fieldOfView.INFINITY (undefined) : Infinity visible points. Default value.
    • originTileXY : Put chess at this tileXY position for visible testing temporary.
      • undefined : Use current tileXY position for visible testing.
    "},{"location":"board-fieldofview/#get-tilexy-array-in-field-of-view","title":"Get tileXY array in field of view","text":"
    var tileXYArray = fieldOfView.findFOV();\n// var tileXYArray = fieldOfView.findFOV(visiblePoints);\n// var tileXYArray = fieldOfView.findFOV(visiblePoints, originTileXY);\n// var out = fieldOfView.findFOV(visiblePoints, out);\n// var out = fieldOfView.findFOV(visiblePoints, originTileXY, out);\n
    • visiblePoints
      • fieldOfView.INFINITY (undefined) : Infinity visible points. Default value.
    • out : Returned tileXY array.
    • originTileXY : Put chess at this tileXY position for visible testing temporary.
      • undefined : Use current tileXY position for visible testing.
    "},{"location":"board-fieldofview/#filter-visible-tilexy-array","title":"Filter visible tileXY array","text":"
    • Filter visible tileXY array
      var out = fieldOfView.LOS(chessArray);\n// var out = fieldOfView.LOS(chessArray, originTileXY);\n// var out = fieldOfView.LOS(chessArray, out);\n// var out = fieldOfView.LOS(chessArray, originTileXY, out);\n
      • chessArray : Array of chess object or tileXY
      • out : Array of visible chess object or tileXY
      • originTileXY : Put chess at this tileXY position for visible testing temporary.
        • undefined : Use current tileXY position for visible testing.
    • Filter visible tileXY array with visible points
      var out = fieldOfView.LOS(chessArray, visiblePoints);\n// var out = fieldOfView.LOS(chessArray, visiblePoints, originTileXY);\n// var out = fieldOfView.LOS(chessArray, visiblePoints, out);\n// var out = fieldOfView.LOS(chessArray, visiblePoints, originTileXY, out);\n
      • chessArray : Array of chess object or tileXY
      • out : Array of visible chess object or tileXY
      • originTileXY : Put chess at this tileXY position for visible testing temporary.
        • undefined : Use current tileXY position for visible testing.
    "},{"location":"board-fieldofview/#face","title":"Face","text":"

    Face direction

    • Get
      var face = fieldOfView.face;\n
    • Set
      fieldOfView.setFace(direction);\n
      or
      fieldOfView.face = direction;\n// fieldOfView.face ++;\n
    • face :
      • 0 ~ 3 : Quad grid.
      • 0 ~ 5 : Hexagon grid.
    "},{"location":"board-fieldofview/#debug","title":"Debug","text":"
    • Clear debug graphics
      fieldOfView.clearDebugGraphics();\n
    • Set color of lines
      fieldOfView.setDebugLineColor(visibleLineColor, invisibleLineColor);\n
      • visibleLineColor, invisibleLineColor : Set undefined to not draw any line.
    "},{"location":"board-hexagongrid/","title":"Hexagon","text":""},{"location":"board-hexagongrid/#introduction","title":"Introduction","text":"

    Hexagon grid object of Board system.

    • Author: Rex
    • Grid object of board
    "},{"location":"board-hexagongrid/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-hexagongrid/#create-instance","title":"Create instance","text":"
    var grid = scene.rexBoard.add.hexagonGrid({\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\n// size: undefined,\nstaggeraxis: 1,\nstaggerindex: 1\n});\n

    or

    // import { HexagonGrid } from 'phaser3-rex-plugins/plugins/board-components.js';\nvar grid = new HexagonGrid(config);\n
    • x, y : World position of origin tile (i.e. tileX = 0, tileY = 0)
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • size : Distance between center to each corner. Get cellWidth and cellHeight from size if this parameter is not undefined.
    • staggeraxis
      • 0, or y
      • 1, or x
    • staggerindex
      • 0, or even
      • 1, or odd
    "},{"location":"board-hexagongrid/#world-position-of-tile-0-0","title":"World position of tile (0, 0)","text":"
    • Get
      var worldX = grid.x;\nvar worldY = grid.y;\n
    • Set
      grid.setOriginPosition(worldX, worldY);\n
      or
      grid.x = worldX;\ngrid.y = worldY;\n
    "},{"location":"board-hexagongrid/#cell-size","title":"Cell size","text":"
    • Get
      var width = grid.width;\nvar height = grid.height;\n
    • Set
      grid.setCellSize(width, height);\n
      or
      grid.width = width;\ngrid.height = height;\n
      or
      grid.setCellRadius(size);\n
      • size : Distance between center to each corner.
    "},{"location":"board-hexagongrid/#grid-type","title":"Grid type","text":"
    • Get
      var staggeraxis = grid.staggeraxis;\nvar staggerindex = grid.staggerindex;\n
    • Set
      grid.setType(staggeraxis, staggerindex);\n
      • staggeraxis
        • 0, or y
        • 1, or x
      • staggerindex
        • 0, or even
        • 1, or odd
    "},{"location":"board-hexagongrid/#get-world-position","title":"Get world position","text":"
    var worldXY = grid.getWorldXY(tileX, tileY);  // worldXY: {x, y}\n// var out = grid.getWorldXY(tileX, tileY, out);\n
    "},{"location":"board-hexagongrid/#get-tile-position","title":"Get tile position","text":"
    var tileXY = grid.getTileXY(worldX, worldY);  // tileXY: {x, y}\n// var out = grid.getTileXY(worldX, worldY, out);\n
    "},{"location":"board-hexagongrid/#directions","title":"Directions","text":"
    • staggeraxis = 0/y
      • 0 : Down-right
      • 1 : Down
      • 2 : Down-left
      • 3 : Up-left
      • 4 : Up
      • 5 : Up-right
    • staggeraxis = 1/x
      • 0 : Right
      • 1 : Down-right
      • 2 : Down-left
      • 3 : Left
      • 4 : Up-left
      • 5 : Up-right
    "},{"location":"board-hexagonmap/","title":"Hexagon map","text":""},{"location":"board-hexagonmap/#introduction","title":"Introduction","text":"

    Create tile positions in hexagon/triangle/parallelogram geometry in hexagon grid.

    • Author: Rex
    • Help method of board
    "},{"location":"board-hexagonmap/#live-demos","title":"Live demos","text":"
    • Hexagon
    "},{"location":"board-hexagonmap/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-hexagonmap/#install-plugin","title":"Install plugin","text":""},{"location":"board-hexagonmap/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Create tile positions
      var tileXYArray = scene.rexBoard.add.hexagonMap.hexagon(board, radius);\nvar tileXYArray = scene.rexBoard.add.hexagonMap.parallelogram(board, type, width, height);\nvar tileXYArray = scene.rexBoard.add.hexagonMap.triangle(board, type, height);\n
    "},{"location":"board-hexagonmap/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create tile positions
      var tileXYArray = scene.rexBoard.add.hexagonMap.hexagon(board, radius);\nvar tileXYArray = scene.rexBoard.add.hexagonMap.parallelogram(board, type, width, height);\nvar tileXYArray = scene.rexBoard.add.hexagonMap.triangle(board, type, height);\n
    "},{"location":"board-hexagonmap/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { HexagonMap } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Create tile positions
      var tileXYArray = HexagonMap.hexagon(board, radius);\nvar tileXYArray = HexagonMap.parallelogram(board, type, width, height);\nvar tileXYArray = HexagonMap.triangle(board, type, height);\n
    "},{"location":"board-hexagonmap/#create-tile-positions","title":"Create tile positions","text":""},{"location":"board-hexagonmap/#hexagon","title":"Hexagon","text":"
    var tileXYArray = scene.rexBoard.hexagonMap.hexagon(board, radius);\n// var out = scene.rexBoard.hexagonMap.hexagon(board, radius, out);\n
    • tileXYArray : An array of tile position {x, y}.
    • board : Board object.
    • radius : Radius in tile count.
    staggeraxis y x"},{"location":"board-hexagonmap/#parallelogram","title":"Parallelogram","text":"
    var tileXYArray = scene.rexBoard.hexagonMap.parallelogram(board, type, width, height);\n// var out = scene.rexBoard.hexagonMap.parallelogram(board, type, width, height, out);\n
    • tileXYArray : An array of tile position {x, y}.
    • board : Board object.
    • width, height : Size of parallelogram
    type\\staggeraxis y x 0 1 2"},{"location":"board-hexagonmap/#triangle","title":"Triangle","text":"
    var tileXYArray = scene.rexBoard.hexagonMap.triangle(board, type, height);\n// var out = scene.rexBoard.hexagonMap.triangle(board, type, height, out);\n
    • tileXYArray : An array of tile position {x, y}.
    • board : Board object.
    • height : Size of Triangle
    type\\staggeraxis y x 0 1"},{"location":"board-hexagonmap/#retrieve-tile-positions","title":"Retrieve tile positions","text":"
    1. Offset all of tile positions to (0, 0), and set board size to fit these tile positions.
      var tileXYArray = board.fit(tileXYArray);\n
    2. Retrieve tile positions
      var tileXY;\nfor(var i = 0, cnt = tileXYArray.length; i < cnt; i++) {\ntileXY = tileXYArray[i];\n// ...\n}\n
    "},{"location":"board-image/","title":"Image","text":""},{"location":"board-image/#introduction","title":"Introduction","text":"

    Image chess object.

    • Author: Rex
    • Chess Game object of Board system
    "},{"location":"board-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-image/#install-plugin","title":"Install plugin","text":""},{"location":"board-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add chess object
      var chess = scene.rexBoard.add.image(board, tileX, tileY, tileZ, key, frame);\n
    "},{"location":"board-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add chess object
      var chess = scene.rexBoard.add.image(board, tileX, tileY, tileZ, key, frame);\n
    "},{"location":"board-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Image } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add chess object
      var chess = new Image(board, tileX, tileY, tileZ, key, frame);\nscene.add.existing(chess);\n
    "},{"location":"board-image/#add-chess-object","title":"Add chess object","text":"
    • Create chess object and add to board
      var chess = scene.rexBoard.add.image(board, tileX, tileY, tileZ, key, frame);\n
      • board : Board object
      • tileX, tileY, tileZ : Tile position
      • key, frame : Frame of this image chess object
    • Create chess object but not add to board
      var chess = scene.rexBoard.add.image(board, x, y, undefined, key, frame, false);\n
      • board : Board object
      • x, y : World position
      • key, frame : Frame of this image chess object
    "},{"location":"board-image/#other-properties","title":"Other properties","text":"

    See Image game object, game object

    "},{"location":"board-match/","title":"Match","text":""},{"location":"board-match/#introduction","title":"Introduction","text":"

    Get matched chess in lines, or neighbors grouping.

    • Author: Rex
    • Application of Board system
    "},{"location":"board-match/#live-demos","title":"Live demos","text":"
    • Match line
    • Match neighbors
    "},{"location":"board-match/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-match/#install-plugin","title":"Install plugin","text":""},{"location":"board-match/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add match object
      var match = scene.rexBoard.add.match(config);\n
    "},{"location":"board-match/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add match object
      var match = scene.rexBoard.add.match(config);\n
    "},{"location":"board-match/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Match } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add match object
      var match = new Match(config);\n
    "},{"location":"board-match/#add-match-object","title":"Add match object","text":"
    var match = scene.rexBoard.add.match({\nboard: board,\n// wildcard: undefined\n// dirMask: undefined\n});\n
    • board : A board object
    • wildcard : A string or a number
    • dirMask : Enable/Disable matching at directions, all directions are enbale by default.
      • Quad grid, 4 directions
        {\n0: true,  // set false to disable left/right matching\n1: true   // set false to disable up/down matching\n}\n
      • Quad grid, 8 directions
        {\n0: true,  // set false to disable left/right matching\n1: true,  // set false to disable up/down matching\n4: true,  // set false to disable left-down/right-up matching\n5: true   // set false to disable right-down/left-up matching\n}\n
      • Hexagon grid
        {\n0: true,\n1: true,\n3: true\n}\n
    "},{"location":"board-match/#custom-class","title":"Custom class","text":"
    • Define class
      class MyMatch extends RexPlugins.Board.Match {\nconstructor(config) {\nsuper(config);\n// ...\n}\n// ...\n}\n
    • Create instance
      var match = new MyMatch(config);\n
    "},{"location":"board-match/#set-board","title":"Set board","text":"

    Board object could be assigned later.

    match.setBoard(board);\n
    "},{"location":"board-match/#update-symbols","title":"Update symbols","text":"

    Each tile position (tileX, tileY) has a symbol.

    "},{"location":"board-match/#update-all-symbols-in-board","title":"Update all symbols in board","text":"
    match.refreshSymbols(function(tileXY, board) {\n// var chess = board.tileXYZToChess(tileXY.x, tileXY.y, 0);\n// if (chess == null) { return null; }\nreturn symbol;\n}, scope);\n
    • tileXY : Tile position {x, y}
    • board : Board object
    • symbol : A string or a number
      • null : No symbol
    "},{"location":"board-match/#updata-a-symbol","title":"Updata a symbol","text":"
    match.setSymbol(tileX, tileY, symbol);\n
    "},{"location":"board-match/#get-symbol","title":"Get symbol","text":"
    var symbol = match.getSymbol(tileX, tileY);\n
    "},{"location":"board-match/#for-each-symbol-cahce","title":"For each symbol cahce","text":"
    match.forEach(function(tileXY, symbol, board) {\n// return true; // Break for each loop\n}, scope)\n
    • tileXY : Tile position {x, y}
    • symbol : A string or a number
      • null : No symbol
    • board : Board object
    "},{"location":"board-match/#wildcard-symbol","title":"Wildcard symbol","text":"
    • Set
      match.setWildcard(symbol);\n
      or
      match.wildcard = symbol;\n
    • Get
      var wildcard = match.wildcard;\n
    "},{"location":"board-match/#directions-mask","title":"Directions mask","text":"

    Enable/Disable matching at directions, all directions are enbale by default.

    match.setDirMask(dir, value);\n
    • dir :
      • Quad grid, 4 directions : 0, 1
      • Quad grid, 8 directions : 0, 1, 4, 5
      • Hexagon grid : 0, 1, 2
    • value : true or false
    "},{"location":"board-match/#line-grouping","title":"Line grouping","text":""},{"location":"board-match/#match-n","title":"Match-N","text":"
    match.match(n, function (result, board) {\n// var chess = board.tileXYArrayToChess(result.tileXY, 0);\n// GroupCall(chess, function (chess) { chess.setScale(0.8); });\n\n// return true; // Break for each loop\n}, scope);\n
    • n : A number, to get matched chess with n equal symbols
    • result : A group of chess
      {\ntileXY: [],\ndirection: 0\npattern: symbol\n}\n
      • tileXY : An array of tile positions {x, y}
      • direction : Direction of this chess group
        • 0, 1, for quad grid with 4 directions
        • 0, 1, 4, 5, for quad grid with 8 directions
        • 0, 1, 2, for hexagon grid
      • pattern : Matched symbol
    • board : Board object
    "},{"location":"board-match/#any-match-n","title":"Any match-N","text":"
    var hasAnyMatchN = match.anyMatch(n);\n
    "},{"location":"board-match/#match-pattern","title":"Match pattern","text":"
    match.match(pattern, function (result, board) {\n// var chess = board.tileXYArrayToChess(result.tileXY, 0);\n// GroupCall(chess, function (chess) { chess.setScale(0.8); });\n}, scope);\n
    • pattern : A list of symbols
    "},{"location":"board-match/#any-match-pattern","title":"Any match pattern","text":"
    var hasAnyMatchN = match.anyMatch(pattern);\n
    "},{"location":"board-match/#neighbors-grouping","title":"Neighbors grouping","text":"
    • Group by neighbors with the same symbol
      tileXYArray = match.group(startTileX, startTileY);\n// out = match.group(startTileX, startTileY, out);\n
      • startTileX, startTileY : Tile position of grouping, to group neighbors with the same symbol. Can't start from null, undefined or wildcard symbol.
    "},{"location":"board-miniboard/","title":"Mini board","text":""},{"location":"board-miniboard/#introduction","title":"Introduction","text":"

    Chess Container, to rotate/mirror/drag chess together.

    • Author: Rex
    • Container Game object of chess group
    "},{"location":"board-miniboard/#live-demos","title":"Live demos","text":"
    • Group 4
    • Drag & drop, mirror, rotate
    "},{"location":"board-miniboard/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-miniboard/#install-plugin","title":"Install plugin","text":""},{"location":"board-miniboard/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add container
      var miniBoard = scene.rexBoard.add.miniBoard(x, y, config);\n
    "},{"location":"board-miniboard/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add container
      var miniBoard = scene.rexBoard.add.miniBoard(x, y, config);\n
    "},{"location":"board-miniboard/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { MiniBoard } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add match object
      var miniBoard = new MiniBoard(scene, x, y, config);\n
    "},{"location":"board-miniboard/#add-container","title":"Add Container","text":"
    var miniBoard = scene.rexBoard.add.miniBoard(x, y, {\ngrid: grid,\ndraggable: undefined,\n});\n
    • grid : Create board object first, then get grid object via board.grid.
      • gridType :
        • 'quadGrid' : Quad grid
        • 'hexagonGrid' : hexagon grid
    • draggable : Set true to enable dragging events
    "},{"location":"board-miniboard/#add-chess","title":"Add chess","text":"
    miniBoard.addChess(gameObject, tileX, tileY, tileZ);\n
    • chess : A game object.
    • tileX , tileY , tileZ : Tile position.
      • tileX , tileY : Number.
      • tileZ : Number or string.

    Chess and tile position

    • Any chess has a (tileX, tileY, tileZ) index
    • Any (tileX, tileY, tileZ) index contains only 1 chess.
    • (tileX, tileY) could have more then 1 chess with different tileZ index.
    • tileZ is not equal to depth.

    These world properties of chess will be changed with container.

    • Position/Angle/Scale
    • Visible
    • Alpha
    • Scroll factor
    • Mask
    "},{"location":"board-miniboard/#remove-chess","title":"Remove chess","text":"
    • Remove chess object from board
      miniBoard.removeChess(chess, null, null, null, destroy);\n
      • chess : A game object
      • destroy : Set true to desrtoy chess object.
    • Remove chess at (tileX, tileY, tileZ) from board
      miniBoard.removeChess(null, tileX, tileY, tileZ, destroy);\n
      • tileX, tileY, tileZ : Tile position
      • destroy : Set true to desrtoy chess object.
    • Remove all chess
      miniBoard.removeAllChess(destroy);\n
      • destroy : Set true to desrtoy chess object.
    "},{"location":"board-miniboard/#set-origin","title":"Set origin","text":"
    • Set origin tileXY by offset tileXY of all chess.
      miniBoard.setOrigin(origin);\n// miniBoard.setOrigin(originX, originY);\n
      • originX, originY: 0~1.
        • 0 : Left/top.
        • 0.5 : Center.
        • 1 : Right/bottom.
    • Set origin tileXY to center by offset tileXY of all chess.
      miniBoard.setOrigin();\n// miniBoard.setOrigin('center');\n
    • Set origin tileXY to top-left.
      miniBoard.setOrigin('top-left');\n
    "},{"location":"board-miniboard/#main-board","title":"Main board","text":"

    Put chess to a main-board (Board object) with the same tile position in mini-board, or pull chess out from main-board.

    "},{"location":"board-miniboard/#put-on-main-board","title":"Put on main-board","text":"
    miniBoard.putOnMainBoard(mainBoard, tileX, tileY);\n// miniBoard.putOnMainBoard(mainBoard, tileX, tileY, align);\n
    • mainBoard : Board object.
    • tileX, tileY : Tile position to put on.
    • align : Set true to align world position of each chess Game object to grid of main-board. Default is true.

    or

    miniBoard.putOnMainBoard(mainBoard);\n

    To put this mini-board to nearest grid of main-board.

    "},{"location":"board-miniboard/#pull-out-from-main-board","title":"Pull out from main-board","text":"
    miniBoard.pullOutFromMainBoard();\n

    Remove all chess from main-board.

    "},{"location":"board-miniboard/#put-back-to-previous-main-board","title":"Put back to previous main-board","text":"
    miniBoard.putBack();\n

    Previous main-board and tile position will be remembered for putting back.

    "},{"location":"board-miniboard/#is-overlapping-to-main-board","title":"Is overlapping to main-board","text":"

    Return true if any chess is overlapping to main-board.

    miniBoard.isOverlapping(mainBoard);\n

    or

    miniBoard.isOverlapping(mainBoard, tileZ);\n
    "},{"location":"board-miniboard/#align-world-position-to-grid-of-main-board","title":"Align world position to grid of main-board","text":"
    miniBoard.alignToMainBoard(mainBoard, tileX, tileY);\n
    • mainBoard : Board object
    • tileX, tileY : Tile position on main-board

    or

    miniBoard.alignToMainBoard(mainBoard);\n

    to align this mini-board to nearest grid of main-board.

    "},{"location":"board-miniboard/#get-current-main-board","title":"Get current main-board","text":"
    var board = miniBoard.mainBoard;\n
    • board : Board object

    Return null if this mini-board is not at any main-board.

    "},{"location":"board-miniboard/#rotate","title":"Rotate","text":""},{"location":"board-miniboard/#can-rotate","title":"Can rotate","text":"
    miniBoard.canRotate(n);\n
    • n : Rotate to direction current direction + n

    or

    miniBoard.canRotateTo(direction);\n
    • direction : Rotate to direction
      • 0 ~ 3 : Quad grid.
      • 0 ~ 5 : Hexagon grid.

    Always return true if this mini-board is not on a main-board.

    "},{"location":"board-miniboard/#rotate_1","title":"Rotate","text":"
    miniBoard.rotate(n);\n
    • n : Rotate direction to current direction + n

    or

    miniBoard.rotateTo(direction);\n
    • direction : Rotate to direction
      • 0 ~ 3 : Quad grid.
      • 0 ~ 5 : Hexagon grid.

    Return true if this rotating request is accepted.

    var isSuccess = miniBoard.lastTransferResult;\n
    "},{"location":"board-miniboard/#mirror","title":"Mirror","text":""},{"location":"board-miniboard/#can-mirror","title":"Can mirror","text":"
    miniBoard.canMirror(mode);\n
    • mode :
      • 0, or 'x' : Set tileX to -tileX
      • 1, or 'y' : Set tileY to -tileY
      • 3, or 'x&y' : Set tileX to -tileX, and tileY to -tileY

    Always return true if this mini-board is not on a main-board.

    "},{"location":"board-miniboard/#mirror_1","title":"Mirror","text":"
    miniBoard.mirror(mode);\n
    • mode :
      • 0, or 'x' : Set tileX to -tileX
      • 1, or 'y' : Set tileY to -tileY
      • 3, or 'x&y' : Set tileX to -tileX, and tileY to -tileY

    Return true if this mirroring request is accepted.

    var isSuccess = miniBoard.lastTransferResult;\n
    "},{"location":"board-miniboard/#touch-events","title":"Touch events","text":""},{"location":"board-miniboard/#set-interactive","title":"Set interactive","text":"
    • Enable
      miniBoard.setInteractive();\n
    • Disable
      miniBoard.setInteractive(false);\n
    "},{"location":"board-miniboard/#set-drag-able","title":"Set drag-able","text":"
    • Enable
      miniBoard.setDragEnable();\n
    • Disable
      miniBoard.setDragEnable(false);\n
    "},{"location":"board-miniboard/#touch-event","title":"Touch event","text":""},{"location":"board-miniboard/#pointer-down","title":"Pointer down","text":"
    • Pointer down at any chess
      miniBoard.on('pointerdown', function(pointer, miniBoard) {\n})\n
    • Pointer down at a chess
      miniBoard.on('gameobjectdown', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('miniboard.pointerdown', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board-miniboard/#pointer-up","title":"Pointer up","text":"
    • Pointer up
      miniBoard.on('pointerup', function(pointer, miniBoard) {\n})\n
    • Pointer up at a chess
      miniBoard.on('gameobjectup', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('miniboard.pointerup', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board-miniboard/#pointer-move","title":"Pointer move","text":"
    • Pointer move
      miniBoard.on('pointermove', function(pointer, miniBoard) {\n})\n
    • Pointer move to another chess
      miniBoard.on('gameobjectmove', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('miniboard.pointermove', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board-miniboard/#drag-events","title":"Drag events","text":"
    • Drag-start
      miniBoard.on('dragstart', function(pointer, dragX, dragY){\n/*\n    miniBoard.pullOutFromMainBoard();\n    */\n}, scope);\n
      Pull out from main-board for dragging.
    • Dragging
      miniBoard.on('drag', function(pointer, dragX, dragY){\n/*\n    miniBoard.setPosition(dragX, dragY);\n    if (miniBoard.isOverlapping(mainBoard)) {\n        miniBoard.alignToMainBoard(mainBoard);\n    }\n    */\n}, scope);\n
      Set world position of mini-board via (dragX, dragY), align to nearest grid of main-board if overlapping with that main-board.
    • Drag-end
      miniBoard.on('dragend', function(pointer, dragX, dragY){\n/*\n    miniBoard.putOnMainBoard(mainBoard);\n    if (miniBoard.mainBoard) {\n    }\n    */\n}, scope);\n
      Put chess on main-board at nearest grid.
    "},{"location":"board-monopoly/","title":"Monopoly","text":""},{"location":"board-monopoly/#introduction","title":"Introduction","text":"

    Move through path tiles, used in monopoly-like application, chess behavior of Board system.

    • Author: Rex
    • Behavior of chess
    "},{"location":"board-monopoly/#live-demos","title":"Live demos","text":"
    • Monopoly
    "},{"location":"board-monopoly/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-monopoly/#install-plugin","title":"Install plugin","text":""},{"location":"board-monopoly/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add monopoly behavior
      var monopoly = scene.rexBoard.add.monopoly(chess, config);\n
    "},{"location":"board-monopoly/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add monopoly behavior
      var monopoly = scene.rexBoard.add.monopoly(chess, config);\n
    "},{"location":"board-monopoly/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Monopoly } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add monopoly behavior
      var board = new Monopoly(chess, config);\n
    "},{"location":"board-monopoly/#create-instance","title":"Create instance","text":"
    var monopoly = scene.rexBoard.add.monopoly(chess, {\nface: 0,\n\n// ** cost **\n// pathTileZ: 0,\n// cost: 1,   // constant cost\n// costCallback: undefined,\n// costCallbackScope: undefined\n})\n
    • face : Moving direction.
      • 0 ~ 3 : Quad grid in 4 directions mode.
      • 0 ~ 7 : Quad grid in 8 directions mode.
      • 0 ~ 5 : Hexagon grid.
    • Cost function
      • pathTileZ : TileZ of path tiles.
      • cost : A constant cost for each non-blocked tile
      • costCallback, costCallbackScope : Get cost via callback
        function(curTileXY, preTileXY, monopoly) {\nreturn cost;\n}\n
    "},{"location":"board-monopoly/#cost-function","title":"Cost function","text":"
    var callback = function(curTileXY, preTileXY, monopoly) {\nreturn cost;\n}\n
    • cost : Number cost.
    • curTileXY, preTileXY : TileXY position {x, y}. Cost of moving from preTileXY to curTileXY.
    • monopoly : Path finder object.
      • monopoly.board : Board object
      • monopoly.gameObject : Chess game object.
      • monopoly.STOP, or -1 : Cost of stop. Return this value means chess will stop at curTileXY.
      • monopoly.BLOCKER, or null : Cost of blocker. Return this value means that chess can not move to curTileXY.
    "},{"location":"board-monopoly/#set-cost-function","title":"Set cost function","text":"
    • Constant cost for each non-blocked tile
      monopoly.setCostFunction(cost);\n
    • Get cost via callback
      monopoly.setCostFunction(callback, scope);\n
    "},{"location":"board-monopoly/#set-face-direction","title":"Set face direction","text":"
    monopoly.setFace(direction);\n
    • direction :
      • 0 ~ 3 : Quad grid in 4 directions mode.
      • 0 ~ 7 : Quad grid in 8 directions mode.
      • 0 ~ 5 : Hexagon grid.

    Moving direction

    Get path toward this face direction.

    "},{"location":"board-monopoly/#get-path","title":"Get path","text":"
    var tileXYArray = monopoly.getPath(movingPoints);\n// var out = monopoly.getPath(movingPoints, out);\n
    • tileXYArray : Moving path in an array of tile positions {x,y}
      • Uses moveTo behavior to move chess along path.
    "},{"location":"board-moveto/","title":"Move to","text":""},{"location":"board-moveto/#introduction","title":"Introduction","text":"

    Move chess towards target position with a steady speed, chess behavior of Board system.

    • Author: Rex
    • Behavior of chess
    "},{"location":"board-moveto/#live-demos","title":"Live demos","text":"
    • Push
    • Follow chess
    "},{"location":"board-moveto/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-moveto/#install-plugin","title":"Install plugin","text":""},{"location":"board-moveto/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add move-to behavior
      var moveTo = scene.rexBoard.add.moveTo(chess, config);\n
    "},{"location":"board-moveto/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add move-to behavior
      var moveTo = scene.rexBoard.add.moveTo(chess, config);\n
    "},{"location":"board-moveto/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { MoveTo } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add move-to behavior
      var moveTo = new MoveTo(chess, config);\n
    "},{"location":"board-moveto/#create-instance","title":"Create instance","text":"
    var moveTo = scene.rexBoard.add.moveTo(chess, {\n// speed: 400,\n\n// rotateToTarget: false,\n\n// occupiedTest: false,\n// blockerTest: false,\n// moveableTest: undefined,\n// moveableTestScope: undefined,\n\n// sneak: false,\n})\n
    • speed : moving speed, pixels in second.
    • rotateToTarget : Set true to change angle towards path.
    • occupiedTest : Set true to test if target tile position is occupied or not, in moveable testing.
    • blockerTest : Set true to test blocker property in moveable testing.
    • moveableTest, moveableTestScope : Custom moveable test callback
      function(fromTileXYZ, toTileXYZ, direction, board) {\nreturn true;\n}\n
      • fromTileXYZ, toTileXYZ : Move chess from tileXYZ {x, y, z}, to tileXYZ {x, y, z}
      • direction :
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
      • board : Board object.
    • sneak : Set true to allow changing tileZ when target tile position is occupied. Changing back when target tile position is not occupied.
      • occupiedTest will be ignored when sneak is true.
    "},{"location":"board-moveto/#move-to-destination-tile","title":"Move to destination tile","text":"
    moveTo.moveTo(tileX, tileY);\n// moveTo.moveTo(tileXY);\n
    • tileXY : Tile position {x,y}
    "},{"location":"board-moveto/#move-to-neighbor-tile","title":"Move to neighbor tile","text":"
    moveTo.moveToward(direction);\n
    • direction :
      • 0 ~ 3 : Quad grid in 4 directions mode.
      • 0 ~ 7 : Quad grid in 8 directions mode.
      • 0 ~ 5 : Hexagon grid.
    "},{"location":"board-moveto/#move-to-random-neighbor-tile","title":"Move to random neighbor tile","text":"
    moveTo.moveToRandomNeighbor();\n
    "},{"location":"board-moveto/#move-away-or-move-closer","title":"Move away or move closer","text":"
    • Move away from a tile position
      moveTo.moveAway(tileX, tileY);\n
      or
      moveTo.moveAway(tileXY);\n
      • tileXY : Tile position {x,y}
    • Move closer to a tile position
      moveTo.moveCloser(tileX, tileY);\n
      or
      moveTo.moveCloser(tileXY);\n
      • tileXY : Tile position {x,y}
    "},{"location":"board-moveto/#can-move-to-tile","title":"Can move to tile","text":"
    var canMoveTo = moveTo.canMoveTo(tileX, tileY);\n

    Return true if chess can move to (tileX, tileY)

    "},{"location":"board-moveto/#last-move-result","title":"Last move result","text":"
    var lastMoveResult = moveTo.lastMoveResult;\n

    Return true if chess is moved by moveTo.moveTo(), moveTo.moveToward(), or moveTo.moveToRandomNeighbor()

    "},{"location":"board-moveto/#destination","title":"Destination","text":"
    var destinationTileX = moveTo.destinationTileX;\nvar destinationTileY = moveTo.destinationTileY;\nvar destinationDirection = moveTo.destinationDirection;\n
    "},{"location":"board-moveto/#pause-resume-stop-moving","title":"Pause, Resume, stop moving","text":"
    moveTo.pause();\nmoveTo.resume();\nmoveTo.stop();\n
    "},{"location":"board-moveto/#enable","title":"Enable","text":"
    • Enable/resume (default)
      moveTo.setEnable();\n
      or
      moveTo.enable = true;\n
    • Disable/pause
      moveTo.setEnable(false);\n
      or
      moveTo.enable = false;\n
    "},{"location":"board-moveto/#set-speed","title":"Set speed","text":"
    moveTo.setSpeed(speed);\n// moveTo.speed = speed;\n
    "},{"location":"board-moveto/#set-rotate-to-target","title":"Set rotate-to-target","text":"
    moveTo.setRotateToTarget(rotateToTarget);\n
    • rotateToTarget : Set true to change angle towards target
    "},{"location":"board-moveto/#events","title":"Events","text":"
    • Try to move on an occupied tile position
      moveTo.on('occupy', function(occupiedChess, gameObject, moveTo){\n// Move away occupiedChess\n});\n
    • On reached target
      moveTo.on('complete', function(gameObject, moveTo){});\n// moveTo.once('complete', function(gameObject, moveTo){});\n
    "},{"location":"board-moveto/#status","title":"Status","text":"
    • Is moving
      var isRunning = moveTo.isRunning;\n
    "},{"location":"board-overview/","title":"Overview","text":""},{"location":"board-overview/#install-plugin","title":"Install plugin","text":""},{"location":"board-overview/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add board object
      var board = scene.rexBoard.add.board(config);\n
    "},{"location":"board-overview/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add board object
      var board = scene.rexBoard.add.board(config);\n
    "},{"location":"board-overview/#using-typescript-declaration-file","title":"Using typescript declaration file","text":"
    import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\n\nclass Game extends Phaser.Scene {\nrexBoard: BoardPlugin;  // Declare scene property 'rexBoard' as BoardPlugin type\n\ncreate() {\nvar board = this.rexBoard.add.board({\n// ...\n})\n}\n}\n\nvar game = new Phaser.Game({\nscene: Game,\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n});\n
    • 'phaser3-rex-plugins/plugins/board-plugin' : Factories of board components.
    • 'phaser3-rex-plugins/plugins/board-components' : Class of board components.
      import { Board } from 'phaser3-rex-plugins/plugins/board-components';\n

    See this example

    "},{"location":"board-overview/#list-of-board-plugins","title":"List of board plugins","text":""},{"location":"board-overview/#board","title":"Board","text":"
    • Board
    • Grids
      • Quad grid
      • Hexagon grid
    • Chess
    "},{"location":"board-overview/#chess-game-object","title":"Chess game object","text":"
    • Shape game object
    • Image game object
    • Sprite game object
    • Tile texture
    "},{"location":"board-overview/#behaviors","title":"Behaviors","text":"
    • Move to
    "},{"location":"board-overview/#applications","title":"Applications","text":"
    • Path finder
    • Monopoly
    • Field of view
    • Match
    • Hexagon map
    "},{"location":"board-overview/#mini-board","title":"Mini-board","text":"
    • Mini-board
    "},{"location":"board-overview/#templates","title":"Templates","text":"
    • Bejeweled
    "},{"location":"board-pathfinder/","title":"Path finder","text":""},{"location":"board-pathfinder/#introduction","title":"Introduction","text":"

    Find moveable area or moving path, chess behavior of Board system.

    • Author: Rex
    • Application of Board system, or behavior of chess
    "},{"location":"board-pathfinder/#live-demos","title":"Live demos","text":"
    • Find area, get path
    • Draw path
    • Energy drain
    • Turning cost
    • Move from high to low
    • Chinese checkers
    "},{"location":"board-pathfinder/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-pathfinder/#install-plugin","title":"Install plugin","text":""},{"location":"board-pathfinder/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add path-finder
      var pathFinder = scene.rexBoard.add.pathFinder(config);\n
    "},{"location":"board-pathfinder/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add path-finder
      var pathFinder = scene.rexBoard.add.pathFinder(config);\n
    "},{"location":"board-pathfinder/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PathFinder } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add path-finder
      var pathFinder = new PathFinder(config);\n
    "},{"location":"board-pathfinder/#create-instance","title":"Create instance","text":"
    var pathFinder = scene.rexBoard.add.pathFinder({\n// occupiedTest: false,\n// blockerTest: false,\n\n// ** cost **\n// cost: 1,   // constant cost\n// costCallback: undefined,\n// costCallbackScope: undefined,\n// cacheCost: true,\n\n// pathMode: 10,  // A*\n// weight: 10,   // weight for A* searching mode\n// shuffleNeighbors: false,\n})\n
    • occupiedTest : Set true to test if target tile position is occupied or not, in cost function.
    • blockerTest : Set true to test blocker property in cost function.
    • Cost function
      • cost : A constant cost for each non-blocked tile
      • costCallback, costCallbackScope : Get cost via callback
        function(curTile, preTile, pathFinder) {\nreturn cost;\n}\n
        • Board : pathFinder.board
        • Chess game object : pathFinder.gameObject
        • Cost of blocker : pathFinder.BLOCKER
    • pathMode
      • Shortest path
        • 'random', or 0
        • 'diagonal', or 1
        • 'straight', or 2
        • 'line', or 3
      • A* path
        • 'A*', or 10
        • 'A*-random', or 11
        • 'A*-line', or 12
    • weight : Weight parameter for A* searching mode.
    • cacheCost : Set false to get cost every time. It is useful when cost is a function of (current tile, previous tile).
    • shuffleNeighbors : Shuffle neighbors.
    "},{"location":"board-pathfinder/#create-behavior","title":"Create behavior","text":"
    var pathFinder = scene.rexBoard.add.pathFinder(chess, config);\n
    "},{"location":"board-pathfinder/#set-chess","title":"Set chess","text":"
    pathFinder.setChess(chess);\n

    Note

    Don't use this method if pathFinder is a behavior of Chess

    "},{"location":"board-pathfinder/#cost-function","title":"Cost function","text":"
    var callback = function(curTileXY, preTileXY, pathFinder) {\nreturn cost;\n}\n
    • cost : Number cost.
    • curTileXY, preTileXY : TileXY position {x, y}. Cost of moving from preTileXY to curTileXY.
      • preTileXY.pathCost : Path cost of preTilexY.
      • preTileXY.preNodes : Previous tiles of preTileXY.
    • pathFinder : Path finder object.
      • pathFinder.board : Board object
      • pathFinder.gameObject : Chess game object.
      • pathFinder.BLOCKER : Cost of blocker. Return this value means that chess can not move to curTileXY.
    "},{"location":"board-pathfinder/#set-cost-function","title":"Set cost function","text":"
    • Constant cost for each non-blocked tile
      pathFinder.setCostFunction(cost);\n
    • Get cost via callback
      pathFinder.setCostFunction(callback, scope);\n
    "},{"location":"board-pathfinder/#set-path-mode","title":"Set path mode","text":"
    pathFinder.setPathMode(pathMode)\n
    • pathMode
      • Shortest path
        • 'random', or 0
        • 'diagonal', or 1
        • 'straight', or 2
        • 'line', or 3
      • A* path
        • 'A*', or 10
        • 'A*-random', or 11
        • 'A*-line', or 12
    "},{"location":"board-pathfinder/#find-moveable-area","title":"Find moveable area","text":"
    var tileXYArray = pathFinder.findArea(movingPoints);\n// var out = pathFinder.findArea(movingPoints, out);\n
    • movingPoints
      • pathFinder.INFINITY (undefined) : Infinity moving points. Default value.
    • tileXYArray : An array of moveable tile positions {x,y,pathCost}
    "},{"location":"board-pathfinder/#get-shortest-path-to-a-moveable-tile","title":"Get shortest path to a moveable tile","text":"
    var tileXYArray = pathFinder.getPath(endTileXY);\n
    • endTileXY : Tile position of moveable area in last result of pathFinder.findArea()
    • tileXYArray : Moving path in an array of tile positions {x,y,pathCost}
      • Uses moveTo behavior to move chess along path.

    Path mode

    • Path info of each tile is calculated during pathFinder.findArea()
    "},{"location":"board-pathfinder/#find-moving-path","title":"Find moving path","text":"
    var tileXYArray = pathFinder.findPath(endTileXY);\n// var tileXYArray = pathFinder.findPath(endTileXY, movingPoints, isClosest, out);\n
    • endTileXY : Tile position
    • tileXYArray : Moving path in an array of tile positions {x,y,pathCost}
      • Uses moveTo behavior to move chess along path.
    • movingPoints
      • pathFinder.INFINITY (undefined) : Infinity moving points. Default value.
    • isClosest : Set true to get closest path.

    Path mode

    • Set pathMode to A* ('A*', 'A*-random', or 'A*-line') to speed up calculating.
    "},{"location":"board-pathfinder/#cost-of-tile","title":"Cost of tile","text":"

    During or after finding moveable area...

    • Get cost of path from chess to tile
      var pathCost = pathFinder.tileXYToCost(tileX, tileY, true);\n
    • Get cost of tile
      var tileCost = pathFinder.tileXYToCost(tileX, tileY, false);\n
    "},{"location":"board-quadgrid/","title":"Quad","text":""},{"location":"board-quadgrid/#introduction","title":"Introduction","text":"

    Quad grid object of Board system.

    • Author: Rex
    • Grid object of board
    "},{"location":"board-quadgrid/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-quadgrid/#create-instance","title":"Create instance","text":"
    var grid = scene.rexBoard.add.quadGrid({\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\ntype: 0,\n// dir: 4\n});\n

    or

    // import { QuadGrid } from 'phaser3-rex-plugins/plugins/board-components.js';\nvar grid = new QuadGrid(config);\n
    • x, y : World position of tile (0, 0)
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • type
      • 0, or orthogonal
      • 1, or isometric
    • dir :
      • 4 or '4dir' : Left/Down/Right/Up
      • 8 or '8dir' : Left/Down/Right/Up/Left-down/Down-right/Right-up/Up-left
    "},{"location":"board-quadgrid/#world-position-of-tile-0-0","title":"World position of tile (0, 0)","text":"
    • Get
      var worldX = grid.x;\nvar worldY = grid.y;\n
    • Set
      grid.setOriginPosition(worldX, worldY);\n
      or
      grid.x = worldX;\ngrid.y = worldY;\n
    "},{"location":"board-quadgrid/#cell-size","title":"Cell size","text":"
    • Get
      var width = grid.width;\nvar height = grid.height;\n
    • Set
      grid.setCellSize(width, height);\n
      or
      grid.width = width;\ngrid.height = height;\n
    "},{"location":"board-quadgrid/#grid-type","title":"Grid type","text":"
    • Get
      var mode = grid.mode;\n
    • Set
      grid.setType(mode);\n
      • mode
        • 0, or orthogonal
        • 1, or isometric
    "},{"location":"board-quadgrid/#get-world-position","title":"Get world position","text":"
    var worldXY = grid.getWorldXY(tileX, tileY);  // worldXY: {x, y}\n// var out = grid.getWorldXY(tileX, tileY, out);\n
    "},{"location":"board-quadgrid/#get-tile-position","title":"Get tile position","text":"
    var tileXY = grid.getTileXY(worldX, worldY);  // tileXY: {x, y}\n// var out = grid.getTileXY(worldX, worldY, out);\n
    "},{"location":"board-quadgrid/#directions","title":"Directions","text":"
    • 0 : Right
    • 1 : Down
    • 2 : Left
    • 3 : Up
    • 4 : Right-down
    • 5 : Left-down
    • 6 : Left-up
    • 7 : Right-up
    6|3|7\n-+-+-\n2|A|0\n-+-+-\n5|1|4\n
    "},{"location":"board-shape/","title":"Shape","text":""},{"location":"board-shape/#introduction","title":"Introduction","text":"

    Grid (polygon) shape chess object.

    • Author: Rex
    • Chess Game object of Board system
    "},{"location":"board-shape/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-shape/#install-plugin","title":"Install plugin","text":""},{"location":"board-shape/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add chess object
      var chess = scene.rexBoard.add.shape(board, tileX, tileY, tileZ, fillColor);\n
    "},{"location":"board-shape/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add chess object
      var chess = scene.rexBoard.add.shape(board, tileX, tileY, tileZ, fillColor);\n
    "},{"location":"board-shape/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Shape } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add chess object
      var chess = new Shape(board, tileX, tileY, tileZ, fillColor);\nscene.add.existing(chess);\n
    "},{"location":"board-shape/#add-chess-object","title":"Add chess object","text":"
    • Create chess object and add to board
      var chess = scene.rexBoard.add.shape(board, tileX, tileY, tileZ, fillColor, fillAlpha);\n
      • board : Board object
      • tileX, tileY, tileZ : Tile position
      • fillColor, fillAlpha : Color of this shape chess object
    • Create chess object but not add to board
      var chess = scene.rexBoard.add.shape(board, x, y, undefined, fillColor, fillAlpha, false);\n
      • board : Board object
      • x, y : World position
      • fillColor, fillAlpha : Color of this shape chess object
    "},{"location":"board-shape/#set-color","title":"Set color","text":"
    • Fill color
      chess.setFillStyle(color, alpha)\n
    • Stroke color
      chess.setStrokeStyle(lineWidth, color, alpha)\n

    No tint methods

    Uses shape.setFillStyle(color, alpha) to change color.

    "},{"location":"board-shape/#other-properties","title":"Other properties","text":"

    See polygon shape game object, game object

    "},{"location":"board-sprite/","title":"Sprite","text":""},{"location":"board-sprite/#introduction","title":"Introduction","text":"

    Sprite chess object.

    • Author: Rex
    • Chess Game object of Board system
    "},{"location":"board-sprite/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-sprite/#install-plugin","title":"Install plugin","text":""},{"location":"board-sprite/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add chess object
      var chess = scene.rexBoard.add.sprite(board, tileX, tileY, tileZ, key, frame);\n
    "},{"location":"board-sprite/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add chess object
      var chess = scene.rexBoard.add.sprite(board, tileX, tileY, tileZ, key, frame);\n
    "},{"location":"board-sprite/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Sprite } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add chess object
      var chess = new Sprite(board, tileX, tileY, tileZ, key, frame);\nscene.add.existing(chess);\n
    "},{"location":"board-sprite/#add-chess-object","title":"Add chess object","text":"
    • Create chess object and add to board
      var chess = scene.rexBoard.add.sprite(board, tileX, tileY, tileZ, key, frame);\n
      • board : Board object
      • tileX, tileY, tileZ : Tile position
      • key, frame : Frame of this sprite chess object
    • Create chess object but not add to board
      var chess = scene.rexBoard.add.sprite(board, x, y, undefined, key, frame, false);\n
      • board : Board object
      • x, y : World position
      • key, frame : Frame of this sprite chess object
    "},{"location":"board-sprite/#other-properties","title":"Other properties","text":"

    See Sprite game object, game object

    "},{"location":"board-texture/","title":"Tile texture","text":""},{"location":"board-texture/#introduction","title":"Introduction","text":"

    Create canvas-texture of tile.

    • Author: Rex
    • Help method of board
    "},{"location":"board-texture/#live-demos","title":"Live demos","text":"
    • Tile texture
    "},{"location":"board-texture/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-texture/#install-plugin","title":"Install plugin","text":""},{"location":"board-texture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Create tile texture
      scene.rexBoard.createTileTexture(board, key, fillStyle, strokeStyle, lineWidth);\n
    "},{"location":"board-texture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create tile texture
      scene.rexBoard.createTileTexture(board, key, fillStyle, strokeStyle, lineWidth);\n
    "},{"location":"board-texture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { CreateTileTexture } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Create tile texture
      CreateTileTexture(board, key, fillStyle, strokeStyle, lineWidth);\n
    "},{"location":"board-texture/#create-tile-texture","title":"Create tile texture","text":""},{"location":"board-texture/#hexagon","title":"Hexagon","text":"
    CreateTileTexture(board, key, fillStyle, strokeStyle, lineWidth);\n// CreateTileTexture(board, key, fillStyle, strokeStyle, lineWidth, overlapGrid, lineJoin);\n
    • board : Board object.
    • fillStyle : Fill color of tile texture.
      • undefined : Don't fill tile texture.
    • strokeStyle, lineWidth : Stroke color, stroke line width of tile texture.
      • undefined : Don't stroke tile texture.
    • overlapGrid :
      • true : Overlap grid. i.e. Grid width = lineWidth. Default behavior.
      • false : Don't overlap grid. i.e. Grid width = 2 * lineWidth.
    • lineJoin : Join style of stroke lines. 'round', 'bevel' and 'miter'. Default is 'miter'.
    "},{"location":"board-tilemap/","title":"Tilemap","text":""},{"location":"board-tilemap/#introduction","title":"Introduction","text":"

    Create board from tilemap

    • Author: Rex
    • Help method of board
    "},{"location":"board-tilemap/#live-demos","title":"Live demos","text":"
    • Create board from tilemap
    "},{"location":"board-tilemap/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board-tilemap/#install-plugin","title":"Install plugin","text":""},{"location":"board-tilemap/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Create board from tilemap
      var board = scene.rexBoard.createBoardFromTilemap(tilemap, layers);\n
    "},{"location":"board-tilemap/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create board from tilemap
      var board = scene.rexBoard.createBoardFromTilemap(tilemap, layers);\n
    "},{"location":"board-tilemap/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { CreateBoardFromTilemap } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Create board from tilemap
      var board = CreateBoardFromTilemap(tilemap, layers);\n
    "},{"location":"board-tilemap/#create-board-from-tilemap","title":"Create board from tilemap","text":"
    var board = CreateBoardFromTilemap(tilemap, layers);\n
    • tilemap : Tilemap object
    • layers : Add tiles of layers into board, tileZ will be name of layer (layer.name)
      • undefined : Add tiles of all layers.
      • Array of TilemapLayer game object, or a TilemapLayer game object
      • Array of layers' name, or a name of layer.
    • board : Board object.
    "},{"location":"board/","title":"Board","text":""},{"location":"board/#introduction","title":"Introduction","text":"

    Core object of Board system.

    • Author: Rex
    • Member of scene
    "},{"location":"board/#live-demos","title":"Live demos","text":"
    • Touch events
    • Get tileXY at direction
    • Line to tileXY array
    • Triangle to tileXY array
    • Ellipse to tileXY array
    • Bounds
    "},{"location":"board/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"board/#install-plugin","title":"Install plugin","text":""},{"location":"board/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexboardplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboardplugin.min.js', 'rexBoard', 'rexBoard');\n
    • Add board object
      var board = scene.rexBoard.add.board(config);\n
    "},{"location":"board/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoardPlugin from 'phaser3-rex-plugins/plugins/board-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexBoard',\nplugin: BoardPlugin,\nmapping: 'rexBoard'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add board object
      var board = scene.rexBoard.add.board(config);\n
    "},{"location":"board/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Board, HexagonGrid, QuadGrid } from 'phaser3-rex-plugins/plugins/board-components.js';\n
    • Add board object
      var board = new Board(scene, {\ngrid: QuadGrid(gridConfig),  // or HexagonGrid(gridConfig)\n// ...\n});\n
    "},{"location":"board/#add-board-object","title":"Add board object","text":"
    • Quad board
      var board = scene.rexBoard.add.board({\ngrid: {\ngridType: 'quadGrid',\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\ntype: 'orthogonal'  // 'orthogonal'|'isometric'\n},\n// width: 0,\n// height: 0,\n// wrap: false,\n// infinity: false,\n});\n
    • Hexagon board
      var board = scene.rexBoard.add.board({\ngrid: {\ngridType: 'hexagonGrid',\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\nstaggeraxis: 'x',   // 'x'|'y'\nstaggerindex: 'odd' // 'odd'|'even'\n},\n// width: 0,\n// height: 0,\n// wrap: false,\n// infinity: false,\n});\n

    Configuration

    • grid :
      • gridType :
        • 'quadGrid' : Quad grid
        • 'hexagonGrid' : hexagon grid
    • width : Board width in tiles
    • height : Board height in tiles
    • wrap : Set true to wrap board bounds. Default value is false.
    • infinity : Infinity board size if set to true. Default value is false.
    "},{"location":"board/#custom-class","title":"Custom class","text":"
    • Define class
      class MyBoard extends RexPlugins.Board.Board {\nconstructor(scene) {\nsuper(scene, {\ngrid: {\ngridType: 'quadGrid',\nx: 0,\ny: 0,\ncellWidth: 0,\ncellHeight: 0,\ntype: 'orthogonal'  // 'orthogonal'|'isometric'\n},\nwidth: 0,\nheight: 0\n});\n// ...\n}\n// ...\n}\n
    • Create instance
      var board = new MyBoard(scene);\n
    "},{"location":"board/#board-size","title":"Board size","text":"
    • Width : Board width in tiles
      • Get
        var width = board.width;\n
      • Set
        board.setBoardWidth(width);\n
    • Height : Board height in tiles
      • Get
        var height = board.height;\n
      • Set
        board.setBoardHeight(height);\n
    "},{"location":"board/#add-chess","title":"Add chess","text":"
    board.addChess(chess, tileX, tileY, tileZ, align);\n
    • chess : A game object.
    • tileX , tileY , tileZ : Tile position.
      • tileX , tileY : Number.
      • tileZ : Number or string.
    • align : Set true to align (i.e. set position) chess to grid (tileX, tileY). Default is true.

    Chess and tile position

    • Any chess has a (tileX, tileY, tileZ) index
    • Any (tileX, tileY, tileZ) index contains only 1 chess.
    • (tileX, tileY) could have more then 1 chess with different tileZ index.
    • tileZ is not equal to depth.
    "},{"location":"board/#kick-out-event","title":"Kick-out event","text":"

    Board will fire kickout event when adding chess to an occupied grid.

    board.on('kickout', function(chessToAdd, occupiedChess, tileXYZ){\n})\n

    chessToAdd kicks out occupiedChess at tile position tileXYZ({x,y,z}).

    "},{"location":"board/#remove-chess","title":"Remove chess","text":"
    • Remove chess object from board
      board.removeChess(chess, null, null, null, destroy);\n
      • chess : A game object
      • destroy : Set true to desrtoy chess object.
    • Remove chess at (tileX, tileY, tileZ) from board
      board.removeChess(null, tileX, tileY, tileZ, destroy);\n
      • tileX, tileY, tileZ : Tile position
      • destroy : Set true to desrtoy chess object.
    • Remove all chess
      board.removeAllChess(destroy);\n
      • destroy : Set true to desrtoy chess object.
    "},{"location":"board/#move-chess","title":"Move chess","text":"
    board.moveChess(chess, toTileX, toTileY, toTileZ, align);\n
    • chess : A game object
    • toTileX, toTileY, toTileZ : Target tile position
    • align : Set true to align (i.e. set position) chess to grid (tileX, tileY). Default is true.

    Do nothing if chess is not at this board.

    "},{"location":"board/#set-tilez-of-chess","title":"Set tileZ of chess","text":"
    board.setChessTileZ(chess, toTileZ, align);\n
    • chess : A game object
    • toTileZ : Target tileZ
    • align : Set true to align (i.e. set position) chess to grid (tileX, tileY). Default is false.
    "},{"location":"board/#swap-chess","title":"Swap chess","text":"
    board.swapChess(chessA, chessB, align);\n
    • chessA, chessB : Game objects
    • align : Set true to align (i.e. set position) chess to grid (tileX, tileY).
    "},{"location":"board/#chess-tile-position","title":"Chess -> tile position","text":"
    var tileXYZ = board.chessToTileXYZ(chess);\n
    • chess : A game object
    • tileXYZ : {x,y,z} or null if chess is not added to board.
    "},{"location":"board/#tile-position-chess","title":"Tile position -> chess","text":"
    • Get chess at (tileX, tileY, tileZ)
      var chess = board.tileXYZToChess(tileX, tileY, tileZ);\n
      • chess : A game object
    • Get chess at (tileX, tileY)
      var out = board.tileXYToChessArray(tileX, tileY);\n// var out = board.tileXYToChessArray(tileX, tileY, out);\n
      • out : An array of chess
    • Get chess at tileZ
      var out = board.tileZToChessArray(tileZ);\n// var out = board.tileZToChessArray(tileZ, out);\n
      • out : An array of chess
    • Get chess from array of (tileX, tileY)
      var out = board.tileXYArrayToChessArray(tileXYArray);\n// var out = board.tileXYArrayToChessArray(tileXYArray, out);\n
      or
      var out = board.tileXYArrayToChessArray(tileXYArray, tileZ);\n// var out = board.tileXYArrayToChessArray(tileXYArray, tileZ, out);\n
      • tileXYArray : An array of tileXY {x, y}
      • out : An array of chess
    "},{"location":"board/#world-position-chess","title":"World position -> chess","text":"
    • Get chess at (worldX, worldY)
      var out = board.worldXYToChessArray(worldX, worldY);\n// var out = board.worldXYToChessArray(worldX, worldY, out);\n
      • out : An array of chess
    • Get chess at (worldX, worldY), tileZ
      var chess = board.worldXYToChess(worldX, worldY, tileZ);\n
      • chess : A game object
    • Get chess at (worldX, worldY)
      var chess = board.worldXYToChess(worldX, worldY);\n
      • chess : A game object at a tileZ.
    "},{"location":"board/#contains","title":"Contains","text":"
    • Is (tileX, tileY) inside board?
      var isTileInBoard = board.contains(tileX, tileY);\n
    • Does (tileX, tileY, tileZ) have chess?
      var isTileInBoard = board.contains(tileX, tileY, tileZ);\n
    • Is chess inside board?
      var isChessInBoard = board.exists(chess);\n
      • chess : A game object
    "},{"location":"board/#for-each-tile","title":"For each tile","text":"
    board.forEachTileXY(function(tileXY, board) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n}, scope);\n

    Iteration order :

    board.forEachTileXY(function(tileXY, board) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n\n// return isBreak;\n}, scope, order);\n
    • order :
      • 0, or 'x+' : Increasing x, increasing y.
      • 1, or 'x-' : Decreasing x, increasing y.
      • 2, or 'y+' : Increasing y, increasing x.
      • 3, or 'y-' : Decreasing y, increasing x.

    Or using for-loop

    for (var tileY = 0; tileY < board.height; tileY++) {\nfor (var tileX = 0; tileX < board.width; tileX++) {\n// ...\n}\n}\n
    • board.width , board.height : Board width/height in tiles.
    "},{"location":"board/#for-each-tile-in-viewport-of-a-camera","title":"For each tile in viewport of a camera","text":"
    board.forEachCullTileXY(function(tileXY, board) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n}, scope);\n
    board.forEachCullTileXY(function(tileXY, board) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n}, scope, {\ncamera: board.scene.cameras.main,\npaddingX: 1,\npaddingY: 1,\norder: 0,\n});\n
    • camera : Camera of scene. Default value is the main camera.
    • paddingX , paddingY : Padding space of camera's viewport
    • order :
      • 0, or 'x+' : Increasing x, increasing y.
      • 1, or 'x-' : Decreasing x, increasing y.
      • 2, or 'y+' : Increasing y, increasing x.
      • 3, or 'y-' : Decreasing y, increasing x.
    "},{"location":"board/#tile-position-world-position","title":"Tile position -> world position","text":"
    var worldXY = board.tileXYToWorldXY(tileX, tileY);  // worldXY: {x, y}\n// var out = board.tileXYToWorldXY(tileX, tileY, out);\n
    "},{"location":"board/#world-position-tile-position","title":"World position -> tile position","text":"
    var tileXY = board.worldXYToTileXY(worldX, worldY);  // tileXY: {x, y}\n// var out = board.worldXYToTileXY(worldX, worldY, out);\n
    "},{"location":"board/#world-position-grid-world-position","title":"World position -> Grid world position","text":"
    var gridWorldXY = board.worldXYSnapToGrid(worldX, worldY);\n// var out = board.worldXYSnapToGrid(worldX, worldY, out);\n
    "},{"location":"board/#grid-distance","title":"Grid distance","text":"
    var distance = board.getDistance(tileA, tileB);\n
    • tileA, tileB : Chess object, or tileXY {x, y}.
    "},{"location":"board/#ring-tile-position","title":"Ring -> tile position","text":"
    • Get array of tile position around a ring.
      var out = board.ringToTileXYArray(centerTileXY, radius);\n// var out = board.ringToTileXYArray(centerTileXY, radius, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
      • radius : Radius of the ring.
    • Get array of tile position within a filled ring. centerTileXY will be included.
      var out = board.filledRingToTileXYArray(centerTileXY, radius);\nvar out = board.filledRingToTileXYArray(centerTileXY, radius, nearToFar);\n// var out = board.filledRingToTileXYArray(centerTileXY, radius, out);\n// var out = board.filledRingToTileXYArray(centerTileXY, radius, nearToFar, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
      • radius : Radius of the ring.
      • nearToFar : From near ring to far ring. Default value is true.
    "},{"location":"board/#ring-chess","title":"Ring -> chess","text":"
    • Get array of chess around a ring.
      var out = board.ringToChessArray(centerTileXY, radius, tileZ);\n// var out = board.ringToChessArray(centerTileXY, radius, tileZ, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
    • Get array of chess within a filled ring. Chess at centerTileXY will be included.
      var out = board.filledRingToTileXYArray(centerTileXY, radius, tileZ);\nvar out = board.filledRingToTileXYArray(centerTileXY, radius, tileZ, nearToFar);\n// var out = board.filledRingToTileXYArray(centerTileXY, radius, tileZ, out);\n// var out = board.filledRingToTileXYArray(centerTileXY, radius, tileZ, nearToFar, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
    "},{"location":"board/#shape-tile-position","title":"Shape -> tile position","text":""},{"location":"board/#line-tile-position","title":"Line -> tile position","text":"

    Get array of tile position along a line defined via (startWorldX, startWorldY) to (endWorldX, endWorldY)

    var out = board.lineToTileXYArray(startWorldX, startWorldY, endWorldX, endWorldY);\n// var out = board.lineToTileXYArray(startWorldX, startWorldY, endWorldX, endWorldY, out);\n
    • startWorldX, startWorldY, endWorldX, endWorldY : Start and end pointer of a line
    • out : An array of tile position

    or

    var out = board.lineToTileXYArray(line);\n// var out = board.lineToTileXYArray(line, out);\n
    • line : Line object
    "},{"location":"board/#circle-tile-position","title":"Circle -> tile position","text":"

    Get array of tile position inside a circle shape

    var out = board.circleToTileXYArray(circle);\n// var out = board.circleToTileXYArray(circle, out);\n// var out = board.circleToTileXYArray(circle, testMode, out);\n
    • circle : Circle shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#rectangle-tile-position","title":"Rectangle -> tile position","text":"

    Get array of tile position inside a rectangle shape

    var out = board.rectangleToTileXYArray(rectangle);\n// var out = board.rectangleToTileXYArray(rectangle, out);\n// var out = board.rectangleToTileXYArray(rectangle, testMode, out);\n
    • rectangle : Rectangle shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#ellipse-tile-position","title":"Ellipse -> tile position","text":"

    Get array of tile position inside a ellipse shape

    var out = board.ellipseToTileXYArray(ellipse);\n// var out = board.ellipseToTileXYArray(ellipse, out);\n// var out = board.ellipseToTileXYArray(ellipse, testMode, out);\n
    • ellipse : Ellipse shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#triangle-tile-position","title":"Triangle -> tile position","text":"

    Get array of tile position inside a triangle shape

    var out = board.triangleToTileXYArray(triangle);\n// var out = board.triangleToTileXYArray(triangle, out);\n// var out = board.triangleToTileXYArray(triangle, testMode, out);\n
    • triangle : Triangle shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#polygon-tile-position","title":"Polygon -> tile position","text":"

    Get array of tile position inside a polygon shape

    var out = board.polygonToTileXYArray(polygon);\n// var out = board.polygonToTileXYArray(polygon, out);\n// var out = board.polygonToTileXYArray(polygon, testMode, out);\n
    • polygon : Polygon shape
    • testMode :
      • 0 : Test if shape is overlapping center position of a grid. Default behavior.
      • 1 : Test if shape is overlapping grid bounds of a grid.
      • 2 : Test if shape is overlapping grid points of a grid.
    • out : An array of tile position.
    "},{"location":"board/#angle-between-world-position-of-2-tiles","title":"Angle between world position of 2 tiles","text":"
    var radian = board.angleBetween(tileA, tileB);\n
    • tileA, tileB : Chess object, or tileXY {x, y} of ring center.
    • radian : Angle between world position of 2 tiles, in radian.
    "},{"location":"board/#is-angle-in-cone","title":"Is angle in cone","text":"
    var isInCone = board.isAngleInCone(chessA, chessB, face, cone);\n
    • chessA, chessB : Chess object, or tileXY {x, y}.
    • face, cone : Range of compared angle is between face - (cone/2) to face + (cone/2). Angle in radian.
    "},{"location":"board/#direction-between-2-tiles","title":"Direction between 2 tiles","text":"
    var direction = board.directionBetween(chessA, chessB);\n
    • chessA, chessB : A chess object, or tile position {x,y}.
    • direction : Integer number.
      • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7.
      • Hexagon grid : 0, 1, 2, 3, 4, 5.
    var direction = board.directionBetween(chessA, chessB, false);\n
    • direction : Integer number, or float number.
      • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7, or float number between 0~1, 1~2, 2~3, 3~4, 4~5, 5~6, 6~7.
      • Hexagon grid : 0, 1, 2, 3, 4, 5, or float number between 0~1, 1~2, 2~3, 3~4, 4~5, 5~6.
    "},{"location":"board/#is-direction-in-cone","title":"Is direction in cone","text":"
    var isInCone = board.isDirectionInCone(chessA, chessB, face, cone);\n
    • chessA, chessB : Chess object, or tileXY {x, y}.
    • face, cone : Range of compared direction is between face - (cone/2) to face + (cone/2). Integer number, or float number.
      • Quad grid : 0, 1, 2, 3, or float number between 0~1, 1~2, 2~3, 3~4.
      • Hexagon grid : 0, 1, 2, 3, 4, 5, or float number between 0~1, 1~2, 2~3, 3~4, 4~5, 5~6.
    "},{"location":"board/#opposite-direction","title":"Opposite direction","text":"
    var direction = board.getOppositeDirection(tileX, tileY, direction);\n

    or

    var direction = board.getOppositeDirection(tileXY, direction);\n
    • tileXY : Chess object, or tileXY {x, y}.
    "},{"location":"board/#angle-snap-to-direction","title":"Angle snap to direction","text":"
    var direction = board.angleSnapToDirection(tileXY, angle);\n
    • tileXY : Chess object, or tileXY {x, y}, or undefined.
    • angle : Angle in radius.
    • direction : Integer number.
      • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7.
      • Hexagon grid : 0, 1, 2, 3, 4, 5.
    "},{"location":"board/#align-world-position-to-grid","title":"Align world position to grid","text":"
    • Align one chess object
      board.gridAlign(chess);\n
    • Align all chess
      board.gridAlign();\n
    "},{"location":"board/#is-overlapping-with-world-position","title":"Is overlapping with world position","text":"
    var isOverlapping = board.isOverlappingPoint(worldX, worldY);\n

    or

    var isOverlapping = board.isOverlappingPoint(worldX, worldY, tileZ);\n
    "},{"location":"board/#neighbors","title":"Neighbors","text":""},{"location":"board/#neighbor-tile-position","title":"Neighbor tile position","text":"
    • Get neighbor tile position at 1 direction
      var neighborTileXY = board.getNeighborTileXY(srcTileXY, direction);\n// var out = board.getNeighborTileXY(srcTileXY, direction, out);\n
      • srcTileXY : Chess object, or tileXY {x, y} of source.
      • direction : Number, or string number.
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
      • neighborTileXY : Tile position {x, y} of neighbor. Retrun null if no neighbor there (i.e. source chess is at the edge of board.)
    • Get neighbor tile position at directions
      var neighborTileXY = board.getNeighborTileXY(srcTileXY, directions);\n// var out = board.getNeighborTileXY(srcTileXY, directions, out);\n
      • directions
        • Array of numbers, [0, 2, 4].
        • String number concatenated via ,, '0,2,4'.
      • out : Tile position array of all neighbors
    • Get neighbor tile position at all directions
      var out = board.getNeighborTileXY(srcTileXY, null);\n// var out = board.getNeighborTileXY(srcTileXY, null, out);\n
      • out : Tile position array of all neighbors
    • Get direction between 2 tile positions
      var direction = board.getNeighborTileDirection(srcTile, neighborTileXY);\n
      • srcTile, neighborTileXY : Chess object, or tileXY {x, y}.
      • direction : Retu1rn null if these 2 tile positions are not neighbors.
    • Get neighbor tile position at angle
      var neighborTileXY = board.getNeighborTileXYAtAngle(srcTileXY, angle);\n// var out = board.getNeighborTileXYAtAngle(srcTileXY, angle, out);\n
      • srcTileXY : Tile position {x, y} of source.
      • angle : Angle in radius.
      • neighborTileXY : Tile position {x, y} of neighbor. Retrun null if no neighbor there (i.e. source chess is at the edge of board.)
    "},{"location":"board/#neighbor-chess","title":"Neighbor chess","text":"
    • Get neighbor chess at 1 direction
      var neighborChess = board.getNeighborChess(chess, direction); // neighborTileZ = tileZ of chess\n// var neighborChess = board.getNeighborChess(chess, direction, neighborTileZ);\n
      • chess : A chess object, or tile position {x, y, z}.
      • direction : Number, or string number.
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
      • neighborChess : A chess object.
    • Get neighbor chess at directions
      var out = board.getNeighborChess(chess, directions); // neighborTileZ = tileZ of chess\n// var out = board.getNeighborChess(chess, directions, neighborTileZ);\n
      • chess : A chess object, or tile position {x,y,z}.
      • directions
        • Array of numbers, [0, 2, 4].
        • String number concatenated via ,, '0,2,4'.
      • out : Chess array of neighbors.
    • Get neighbor chess at all directions
      var out = board.getNeighborChess(chess, null); // neighborTileZ = tileZ of chess\n// var out = board.getNeighborChess(chess, null, neighborTileZ);\n
      • chess : A chess object, or tile position {x, y, z}.
      • out : Chess array of all neighbors.
    • Get direction between 2 chess
      var direction = board.getNeighborChessDirection(chess, neighborChess);\n
      • direction : Return null if these 2 chess are not neighbors.
    • Are 2 chess neighbors?
      var areNeighbor = board.areNeighbors(tileA, tileB);\n
    • tileA, tileB : A chess object, or tile position {x, y}.
    • areNeighbor : Return true if chessA and chessB are neighbors.
    "},{"location":"board/#map-neighbor-tile-position","title":"Map neighbor tile position","text":"
    var newArray = board.mapNeighbors(chess, function(neighborTileXY, index, neighborTileXYArray){\nreturn {};\n}, scope);\n

    or

    var newArray = board.mapNeighbors(chess, distance, function(neighborTileXY, index, neighborTileXYArray){\nreturn {};\n}, scope);\n
    • chess : A chess object, or tile position {x,y,z}.
    • neighborTileXY : Neighbor tile position {x,y,direction}
    "},{"location":"board/#tile-at-direction","title":"Tile at direction","text":"
    • Get tile position at 1 direction
      var out = board.getTileXYAtDirection(srcTileXY, direction, distance);\n// var out = board.getTileXYAtDirection(srcTileXY, direction, distance, out);\n
      • srcTileXY : A chess object, or tile position {x, y} of source.
      • direction : Number, or string number.
        • 0 ~ 3 : Quad grid in 4 directions mode.
        • 0 ~ 7 : Quad grid in 8 directions mode.
        • 0 ~ 5 : Hexagon grid.
      • distance : A JSON, number, or number array.
        • JSON : Range of distances. {end: 3} is equal to [1,2,3].
          {\nstart: 1,\nend: 1,\nstep: 1\n}\n
          • start : Start distance. Default value is 1.
          • end : End distance. Default value is 1.
          • step : Step. Default value is 1.
        • Number, 3.
        • Array of numbers, [2, 3, 5] : Array of distances.
      • out :
        • A single tile position, if distance is a number.
        • Tile position {x, y} array, if distance is a JSON or a number array.
    • Get tile positions at directions
      var neighborTileXY = board.getTileXYAtDirection(srcTileXY, directions, distance);\n// var out = board.getTileXYAtDirection(srcTileXY, directions, distance, out);\n
      • directions
        • Array of numbers, [0, 2, 4].
        • String number concatenated via ,, '0,2,4'.
      • out : Tile position {x, y} array.
    • Get tile positions at all directions
      var out = board.getTileXYAtDirection(srcTileXY, null, distance);\n// var out = board.getTileXYAtDirection(srcTileXY, null, distance, out);\n
      • out : Tile position {x, y} array.
    "},{"location":"board/#empty-tile-position","title":"Empty tile position","text":"
    • Is tile empty? (TileXY is inside board, and TileXYZ has no chess)
      var isEmpty = board.isEmptyTileXYZ(tileX, tileY, tileZ);\n
    • Get a random tile position which does not have any chess
      var tileXY = board.getRandomEmptyTileXY(tileZ);\n// var out = board.getRandomEmptyTileXY(tileZ, out);\n
      • tileXY : Tile position {x, y},
        • null : All positions are occupied.
    • Get an array of tile position which does not have any chess
      var tileXYArray = board.getEmptyTileXYArray(tileZ);\n// var out = board.getEmptyTileXYArray(tileZ, out);\n
      • tileXYArray : An array of tile position
    • Get a random tile position of neighbor which does not have any chess
      var tileXY = board.getRandomEmptyTileXYInRange(centerTileXY, radius, tileZ);\n// var out = board.getRandomEmptyTileXYInRange(centerTileXY, radius, tileZ, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
      • radius : Radius of the ring.
      • tileXY : Tile position {x, y},
        • null : All positions are occupied.
    • Get an array of tile position of neighbors which does not have any chess
      var tileXYArray = board.getEmptyTileXYArrayInRange(centerTileXY, radius, tileZ);\n// var out = board.getEmptyTileXYArrayInRange(centerTileXY, radius, tileZ, out);\n
      • centerTileXY : Chess object, or tileXY {x, y} of ring center.
      • radius : Radius of the ring.
      • tileXYArray : An array of tile position
    "},{"location":"board/#get-all-chess","title":"Get all chess","text":"
    var chessArray = board.getAllChess();\n
    "},{"location":"board/#fit","title":"Fit","text":"
    var out = board.fit(tileXYArray);\n
    • tileXYArray : An array of tile position {x,y}.

    Offset all of tile positions to (0, 0), and set board size to fit these tile positions.

    "},{"location":"board/#blocker","title":"Blocker","text":"
    • Set blocker property : See chess data
    • Has blocker at tile position (tileX, tileY, tileZ)
      var hasBlocker = board.hasBlocker(tileX, tileY, tileZ);\n// var hasBlocker = board.hasBlocker(chess);  // chess or tileXYZ\n
    • Any chess at (tileX, tileY) has blocker property
      var hasBlocker = board.hasBlocker(tileX, tileY);\n// var hasBlocker = board.hasBlocker(chess);  // chess or tileXY\n
    "},{"location":"board/#touch-events","title":"Touch events","text":""},{"location":"board/#set-interactive","title":"Set interactive","text":"
    • Enable
      board.setInteractive();\n// board.setInteractive({ useTouchZone: false });\n
      • useTouchZone :
        • true : Detect touch input by input event of a full-screen zone game object. Default behavior.
        • false : Detect touch input by input event of scene.
    • Disable
      board.setInteractive(false);\n
    "},{"location":"board/#touch-zone","title":"Touch Zone","text":"
    • Get
      var touchZone = board.getTouchZone();\n// var touchZone = board.touchZone;\n
      • Return null if useTouchZone is false.
    • Set depth
      touchZone.setDepth(depth);\n
      or
      scene.children.bringToTop(touchZone);\nscene.children.sendToBack(touchZone);\nscene.children.moveUp(touchZone);\nscene.children.moveDown(touchZone);\nscene.children.moveUp(touchZone);\nscene.children.moveTo(touchZone, index);\nscene.children.moveAbove(touchZone, child); // Move touchZone above child\nscene.children.moveBelow(touchZone, child); // Move touchZone below child\nscene.children.swap(touchZone, child);\n
    "},{"location":"board/#pointer-down","title":"Pointer down","text":"
    • Pointer down at any tile
      board.on('tiledown', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • pointer : Touch pointer
      • tileXY : {x, y}
    • Pointer down at chess
      board.on('gameobjectdown', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointerdown', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#pointer-up","title":"Pointer up","text":"
    • Pointer up at any tile
      board.on('tileup', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • tileXY : {x, y}
    • Pointer up at chess
      board.on('gameobjectup', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointerup', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#pointer-move","title":"Pointer move","text":"
    • Pointer move to another tile
      board.on('tilemove', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • tileXY : {x, y}
      • Only triggered when tileXY is changed.
    • Pointer move to another chess
      board.on('gameobjectmove', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointermove', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#pointer-over","title":"Pointer over","text":"
    • Pointer over to another tile
      board.on('tileover', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • tileXY : {x, y}
      • Only triggered when tileXY is changed.
    • Pointer over to another chess
      board.on('gameobjectover', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointerover', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#pointer-out","title":"Pointer out","text":"
    • Pointer out tile
      board.on('tileout', function(pointer, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • tileXY : {x, y}
      • Only triggered when tileXY is changed.
    • Pointer out chess
      board.on('gameobjectout', function(pointer, gameObject) {\n})\n
      or
      gameObject.on('board.pointerout', function(pointer) {\n})\n
      • pointer : Touch pointer
      • gameObject : Game object at pointer-out (tileX, tileY)
    "},{"location":"board/#tap","title":"Tap","text":"
    • Tap at any tile
      board.on('tiletap', function(tap, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n// var tapsCount = tap.tapsCount;\n});\n
      • tap : Tap behavior.
        • tap.tapsCount : Taps count.
      • tileXY : {x, y}
    • N-taps at any tile
      board.on('tile' + tapsCount + 'tap' , function(tap, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • 'tile' + tapsCount + 'tap' : 'tile1tap', 'tile2tap', 'tile3tap', etc ...
      • tap : Tap behavior.
      • tileXY : {x, y}
    • Tap at chess
      board.on('gameobjecttap', function(tap, gameObject) {\n// var tapsCount = tap.tapsCount;\n})\n
      or
      gameObject.on('board.tap', function(tap) {\n// var tapsCount = tap.tapsCount;\n})\n
      • tap : Tap behavior.
        • tap.tapsCount : Taps count.
      • gameObject : Game object at touched (tileX, tileY)
    • N-taps at chess
      board.on('gameobject' + tapsCount + 'tap' , function(tap, gameObject) {\n})\n
      or
      gameObject.on('board.' + tapsCount + 'tap', function(tap) {\n})\n
      • 'gameobject' + tapsCount + 'tap' : 'gameobject1tap', 'gameobject2tap', 'gameobject3tap', etc ...
      • 'board.' + tapsCount + 'tap' : 'board.1tap', 'board.2tap', 'board.3tap', etc ...
      • tap : Tap behavior.
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#press","title":"Press","text":"
    • Press-start at any tile
      board.on('tilepressstart', function(press, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • press : Press behavior.
      • tileXY : {x, y}
    • Press-end at any tile
      board.on('tilepressend', function(press, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n});\n
      • press : Press behavior.
      • tileXY : {x, y}
    • Press-star at chess
      board.on('gameobjectpressstart', function(press, gameObject) {\n})\n
      or
      gameObject.on('board.pressstart', function(press) {\n})\n
      • press : Press behavior.
      • gameObject : Game object at touched (tileX, tileY)
    • Press-end at chess
      board.on('gameobjectpressend', function(press, gameObject) {\n})\n
      or
      gameObject.on('board.pressend', function(press) {\n})\n
      • press : Press behavior.
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#swipe","title":"Swipe","text":"
    • Swipe at any tile
      board.on('tileswipe', function(swipe, tileXY) {\n// var tileX = tileXY.x;\n// var tileY = tileXY.y;\n// var direction = swipe.direction;\n});\n
      • swipe : Swipe behavior.
        • swipe.direction : Integer number.
          • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7.
          • Hexagon grid : 0, 1, 2, 3, 4, 5.
      • tileXY : {x, y}
    • Swipe at chess
      board.on('gameobjectswipe', function(swipe, gameObject) {\n// var direction = swipe.direction;\n})\n
      or
      gameObject.on('board.swipe', function(swipe) {\n// var direction = swipe.direction;\n})\n
      • swipe : Swipe behavior.
        • swipe.direction : Integer number.
          • Quad grid : 0, 1, 2, 3, 4, 5, 6, 7.
          • Hexagon grid : 0, 1, 2, 3, 4, 5.
      • gameObject : Game object at touched (tileX, tileY)
    "},{"location":"board/#grid-points","title":"Grid points","text":"
    • Get an array of grid points at tile position (tileX, tileY).
      var points = board.getGridPoints(tileX, tileY);\n// var out = board.getGridPoints(tileX, tileY, out);\n// var points = board.getGridPoints(chess, out);  // chess or tileXY\n
      • points :\u3000Array of world position {x, y}.
    • Draw grid polygon on graphics object
      graphics.strokePoints(points, true);\n
    "},{"location":"board/#bounds","title":"Bounds","text":""},{"location":"board/#board-bounds","title":"Board bounds","text":"
    • Get a rectangle of all tiles
      var rectangle = board.getBoardBounds();\n// var out = board.getGridBounds(out);\n
      • rectangle : Rectangle object.
    • Draw rectangle on graphics object
      graphics.strokeRectShape(rectangle);\n
    "},{"location":"board/#grid-bounds","title":"Grid bounds","text":"
    • Get a rectangle of a tile
      var rectangle = board.getGridBounds(tileX, tileY);\n// var out = board.getGridBounds(tileX, tileY, out);\n// var rectangle = board.getGridBounds(chess, out);  // chess or tileXY\n
      • rectangle : Rectangle object.
    • Draw rectangle on graphics object
      graphics.strokeRectShape(rectangle);\n
    "},{"location":"board/#get-board","title":"Get Board","text":"
    • Static method

      var board = Board.GetBoard(chess);\n

      • GetBoard is a static method of Board class.
    • Member method

      var board = board.chessToBoard(chess);\n

    • Board property
      • Chess
        var board = chess.rexChess.board;\n
      • Miniboard
        var board = miniboard.mainBoard;\n
    "},{"location":"board/#other-properties","title":"Other properties","text":"
    • Scene
      var scene = board.scene;\n
    • Grid object
      • Get
        var grid = board.grid;\n
        • grid : Quad grid, or hexagon grid.
      • Set
        board.setGrid(grid);\n
        • grid : Quad grid, or hexagon grid.
    "},{"location":"bounds/","title":"Bounds","text":""},{"location":"bounds/#introduction","title":"Introduction","text":"

    Clamp or wrap position of game object inside target bounds.

    • Author: Rex
    • Behavior of game object
    "},{"location":"bounds/#live-demos","title":"Live demos","text":"
    • Drag inside bounds
    • Target bounds
    • Wrap bounds
    "},{"location":"bounds/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bounds/#install-plugin","title":"Install plugin","text":""},{"location":"bounds/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexboundsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexboundsplugin.min.js', true);\n
    • Add bounds behavior
      var bounds = scene.plugins.get('rexboundsplugin').add(gameObject, config);\n
    "},{"location":"bounds/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BoundsPlugin from 'phaser3-rex-plugins/plugins/bounds-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBounds',\nplugin: BoundsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add bounds behavior
      var bounds = scene.plugins.get('rexBounds').add(gameObject, config);\n
    "},{"location":"bounds/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Bounds from 'phaser3-rex-plugins/plugins/bounds.js';\n
    • Add bounds behavior
      var bounds = new Bounds(gameObject, config);\n
    "},{"location":"bounds/#create-instance","title":"Create instance","text":"
    var bounds = scene.plugins.get('rexBounds').add(gameObject, {\n// target: undefined,\n// bounds: undefined,\n// enable: true,\n\n// boundsHitMode: 'clamp',  // 'clamp', or 'wrap'\n// boundsHitMode: {\n//     left: 'clamp',\n//     right: 'clamp',\n//     top: 'clamp',\n//     bottom: 'clamp' \n// },\n\n// alignMode: 0\n});\n
    • target :
      • A game object : Update target bounds from this game object in each tick.
      • undefined, null, or false : Set target bounds in bounds parameter. Default behavior.
    • bounds : Target bounds used when target is not a game object.
      • A rectangle object
      • An object :
        {\nwidth: 0, height: 0,\nx: 0, y: 0,\ncenterX: 0, centerY: 0,            }\n
        • width, height : Size of target bounds.
        • x, y, or centerX, centerY : Position of target bounds.
    • enable :
      • true : Clamp or wrap game object's position when game object overlap left/right/top/bottom bounds.
      • false : Don't clamp or wrap game object's position at any bound
      • An objecct : Set true to clamp or wrap game object's position at a bound
        {\nleft: true,\nright: true,\ntop: true,\nbottom: true\n}\n
    • boundsHitMode : Position mode when game object overlap bounds
      • 0, or 'clamp' : Clamp game object's position when game object overlap left/right/top/bottom bounds.
      • 1, or 'wrap' : Wrap game object's position when game object overlap left/right/top/bottom bounds.
      • An objecct : Set 0/'clamp', or 1/'wrap' to clamp or wrap game object's position at a bound
        {\nleft: 0,   // 0,'clamp',1,'wrap'\nright: 0,  // 0,'clamp',1,'wrap'\ntop: 0,    // 0,'clamp',1,'wrap'\nbottom: 0  // 0,'clamp',1,'wrap'\n}\n
    • alignMode :
      • 0, or 'bounds' : Align bounds of game object to target bound. Default behavior if boundsHitMode are all set to clamp mode.
      • 1, or 'origin' : Set position of game object to target bound. Default behavior if boundsHitMode has wrap mode.
    "},{"location":"bounds/#target-game-object","title":"Target game object","text":"
    • Set
      bounds.setBoundsTarget(gameObject);\n// bounds.boundsTarget = gameObject;\n
    • Clear
      bounds.setBoundsTarget();\n// bounds.boundsTarget = undefined;\n
    • Get
      var gameObject = bounds.boundsTarget;\n
    "},{"location":"bounds/#target-bounds","title":"Target bounds","text":"
    • Set
      bounds.setBounds(bounds);\n
      • bounds : Target bounds used when target is not a game object.
        • A rectangle
        • An object :
          {\nwidth: 0, height: 0,\nx: 0, y: 0,\ncenterX: 0, centerY: 0,            }\n
          • width, height : Size of target bounds.
          • x, y, or centerX, centerY : Position of target bounds.
    • Get
      var rect = bounds.bounds;\n
      • rect : A rectangle object
    "},{"location":"bounds/#enable","title":"Enable","text":"
    • Set
      • Enable all bounds
        bounds.setEnable();\n//  bounds.setEnable(true);\n
      • Disable all bounds
        bounds.setEnable(false);\n
      • Enable bounds via object
        bounds.setEnable({\nleft: true,\nright: true,\ntop: true,\nbottom: true\n});\n
    • Get
      var enable = bounds.enable;\n
      • true : Has any enabled bounds
      • false : All bounds are disabled.
    • Get enabled of a bound
      var enableLeftBound = bounds.boundsEnable.left;\nvar enableRightBound = bounds.boundsEnable.right;\nvar enableTopBound = bounds.boundsEnable.top;\nvar enableBottomBound = bounds.boundsEnable.bottom;\n
    "},{"location":"bounds/#bound-hit-mode","title":"Bound hit mode","text":"
    • Set
      bounds.setBoundsHitMode(mode);\n
      • 0, or 'clamp' : Clamp game object's position when game object overlap left/right/top/bottom bounds.
      • 1, or 'wrap' : Wrap game object's position when game object overlap left/right/top/bottom bounds.
      • An objecct : Set 0/'clamp', or 1/'wrap' to clamp or wrap game object's position at a bound
        {\nleft: 0,   // 0,'clamp',1,'wrap'\nright: 0,  // 0,'clamp',1,'wrap'\ntop: 0,    // 0,'clamp',1,'wrap'\nbottom: 0  // 0,'clamp',1,'wrap'\n}\n
    • Get
      var leftBoundHitMode = bounds.boundsHitMode.left;\nvar rightBoundHitMode = bounds.boundsHitMode.right;\nvar topBoundHitMode = bounds.boundsHitMode.top;\nvar bottomBoundHitMode = bounds.boundsHitMode.bottom;\n
    "},{"location":"bounds/#align-mond","title":"Align mond","text":"
    • Set
      bounds.setAlignMode(mode);\n
      • 0, or 'bounds' : Align bounds of game object to target bound.
      • 1, or 'origin' : Set position of game object to target bound.
    • Get
      var alignMode = bounds.alignMode;\n
      • 0 : Align bounds of game object to target bound.
      • 1 : Set position of game object to target bound.
    "},{"location":"bounds/#hit-result","title":"Hit result","text":"
    • Game object is hitting any bound
      var isHitAny = bounds.isHitAny;\n
    • Game object is hitting a bound
      var isHitLeft = this.isHitLeft;\nvar isHitRight = this.isHitRight;\nvar isHitTop = this.isHitTop;\nvar isHitBottom = this.isHitBottom;\n
    "},{"location":"bounds/#event","title":"Event","text":"
    • On hit any bound
      bounds.on('hitany', function(gameObject, bounds) {\n\n})\n
    • On hit left bound
      bounds.on('hitleft', function(gameObject, bounds) {\n\n})\n
    • On hit right bound
      bounds.on('hitright', function(gameObject, bounds) {\n\n})\n
    • On hit top bound
      bounds.on('hittop', function(gameObject, bounds) {\n\n})\n
    • On hit bottom bound
      bounds.on('hitbottom', function(gameObject, bounds) {\n\n})\n
    "},{"location":"bracketparser/","title":"Bracket parser","text":""},{"location":"bracketparser/#introduction","title":"Introduction","text":"

    A lite-weight delimiter parser.

    • Author: Rex
    • Object
    "},{"location":"bracketparser/#live-demoes","title":"Live demoes","text":"
    • Basic
    • Markup text
    "},{"location":"bracketparser/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bracketparser/#install-plugin","title":"Install plugin","text":""},{"location":"bracketparser/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbracketparserplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbracketparserplugin.min.js', true);\n
    • Add parser object
      var parser = scene.plugins.get('rexbracketparserplugin').add(config);\n
    "},{"location":"bracketparser/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BracketParserPlugin from 'phaser3-rex-plugins/plugins/bracketparser-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBracketParser',\nplugin: BracketParserPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add parser object
      var parser = scene.plugins.get('rexBracketParser').add(config);\n
    "},{"location":"bracketparser/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BracketParser from 'phaser3-rex-plugins/plugins/bracketparser.js';\n
    • Add parser object
      var parser = new BracketParser(config);\n
    "},{"location":"bracketparser/#create-instance","title":"Create instance","text":"
    var parser = scene.plugins.get('rexBracketParser').add({\n// delimiters: '<>', // or ['<', '>']\n// valueConvert: true,\n// translateTagNameCallback: undefined,\n});\n
    • delimiters: String of left-delimiter and right-delimiter.
      • A single string with 2 characters. Default value is '<>'.
      • A array with 2 strings
    • valueConvert : A callback to convert values.
      • true : Use defaule value converter. Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string.
      • false, or null : Bypass string value.
      • Function object:
        function(s) {\nreturn s;\n}\n
    • translateTagNameCallback : Callback to translate tag-name
      • undefined : Use original tag-name. Default behavior.
      • A function, return new tag name.
        function(tagName) {\nreturn newTagName;\n}\n
    "},{"location":"bracketparser/#tag-and-content","title":"Tag and content","text":"

    Assume that left-delimiter and right-delimiter is '<>'

    • Start-tag : '<TAG>'
      • Start-tag with a single value : '<TAG=value>'
        • value : If valueConvert is true,
          • Number
          • Boolean
          • null
          • String
      • Start-tag with array values, separated via ',' : '<TAG=value0,value1,value2>'
    • End-tag : '<\\TAG>'
    • Content : Any string outside of tag-start, or tag-end.
    "},{"location":"bracketparser/#start-parsing","title":"Start parsing","text":"
    parser.start(text);\n

    These events will be emitted under this method.

    "},{"location":"bracketparser/#pause","title":"Pause","text":"
    • Pause
      parser.pause();\n
    • Pause until event
      parser.pauseUntilEvent(eventEmitter, eventName);\n
      • Will invoke
        eventEmitter.once(eventName, function() {\nparser.next();\n})\n

    Invoke this method during tag-start,tag-end, or content events to suspend parsing.

    "},{"location":"bracketparser/#resume","title":"Resume","text":"
    parser.next();\n
    "},{"location":"bracketparser/#skip-any-tag-startany-tag-end-event","title":"Skip any-tag-start/any-tag-end event","text":"
    parser.skipEvent();\n

    When getting a tag-start, or a tag-end event, parser will emitts

    • Start-tag : '+TAG', then '+'
    • End-tag : '-TAG', then '-'

    Invoke this medthod under '+TAG', or '-TAG' event to skip '+', or '-' event.

    "},{"location":"bracketparser/#status","title":"Status","text":"
    • Is parsing
      var isRunning = parser.isRunning;\n
      • true : Has remainder characters
      • false : After parsing last character
    • Is paused
      var isPaused = parser.isPaused;\n
    "},{"location":"bracketparser/#events","title":"Events","text":""},{"location":"bracketparser/#tagscontent","title":"Tags/Content","text":"
    • Get a specific tag-start
      • Start-tag with a single value : '<TAG=value>'
        parser.on('+' + TagName, function(value){ /* ... */ });\n
      • Start-tag with array values, separated via ',' : '<TAG=value0,value1,value2>'
        parser.on('+' + TagName, function(value0, value1, value2){ /* ... */ });\n
    • Get any-tag-start
      • Start-tag with a single value : '<TAG=value>'
        parser.on('+', function(tagName, value){ /* ... */ });\n
      • Start-tag with array values, separated via ',' : '<TAG=value0,value1,value2>'
        parser.on('+', function(tagName, value0, value1, value2){ /* ... */ });\n
    • Get a specific tag-end
      parser.on('-' + TagName, function(){ /* ... */ });\n
    • Get a content
      parser.on('content', function(content){ /* ... */ });\n
      • Previous tag-start : parser.lastTagStart
    • Get any-tag-end
      parser.on('-', function(tagName){ /* ... */ });\n
      • Previous tag-start : parser.lastTagStart
      • Previous Content : parser.lastContent
    "},{"location":"bracketparser/#control-flow","title":"Control flow","text":"
    • Parsing start
      parser.on('start', function(){ /* ... */ });\n
    • Parsing end
      parser.on('complete', function(){ /* ... */ });\n
    • On pause
      parser.on('pause', function(){ /* ... */ });\n
    • On resume
      parser.on('resume', function(){ /* ... */ });\n
    "},{"location":"bracketparser2/","title":"Bracket parser 2","text":""},{"location":"bracketparser2/#introduction","title":"Introduction","text":"

    A lite-weight delimiter parser.

    • Author: Rex
    • Object
    "},{"location":"bracketparser2/#live-demoes","title":"Live demoes","text":"
    • Basic
    "},{"location":"bracketparser2/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bracketparser2/#install-plugin","title":"Install plugin","text":""},{"location":"bracketparser2/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbracketparser2plugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbracketparser2plugin.min.js', true);\n
    • Add parser object
      var parser = scene.plugins.get('rexbracketparser2plugin').add(config);\n
    "},{"location":"bracketparser2/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BracketParserPlugin from 'phaser3-rex-plugins/plugins/bracketparser2-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBracketParser',\nplugin: BracketParserPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add parser object
      var parser = scene.plugins.get('rexBracketParser').add(config);\n
    "},{"location":"bracketparser2/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BracketParser from 'phaser3-rex-plugins/plugins/bracketparser2.js';\n
    • Add parser object
      var parser = new BracketParser(config);\n
    "},{"location":"bracketparser2/#create-instance","title":"Create instance","text":"
    var parser = scene.plugins.get('rexBracketParser').add({\n// delimiters: '<>', // or ['<', '>']\n// valueConvert: true,\n// translateTagNameCallback: undefined,\n});\n
    • delimiters: String of left-delimiter and right-delimiter.
      • A single string with 2 characters. Default value is '<>'.
      • A array with 2 strings
    • valueConvert : A callback to convert values.
      • true : Use defaule value converter. Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string.
      • false, or null : Bypass string value.
      • Function object:
        function(s) {\nreturn s;\n}\n
    • translateTagNameCallback : Callback to translate tag-name
      • undefined : Use original tag-name. Default behavior.
      • A function, return new tag name.
        function(tagName) {\nreturn newTagName;\n}\n
    "},{"location":"bracketparser2/#tag-and-content","title":"Tag and content","text":"

    Assume that left-delimiter and right-delimiter is '<>'

    • Start-tag : <TAG>
    • Start-tag with payload :
      <TAG param0=value0 param1=value1>\n
      or
      <\n    TAG\n    param0=value0 \n    param1=value1\n>\n
      • payload will be {param0:value0, param1:value1}
      • value : If valueConvert is true,
        • String with '...', or \"...\"
        • JSON array with [...]
        • JSON object with {...}
        • Number
        • Boolean
        • null
        • String
    • End-tag : <\\TAG>
    • End-tag with payload
      <\\TAG param0=value0 param1=value1>\n
      or
      <\n    \\TAG\n    param0=value0 \n    param1=value1\n>\n
      • payload will be {param0:value0, param1:value1}
      • value : If valueConvert is true,
        • String with '...', or \"...\"
        • JSON array with [...]
        • JSON object with {...}
        • Number
        • Boolean
        • null
        • String
    • Content : Any string outside of tag-start, or tag-end.
    "},{"location":"bracketparser2/#start-parsing","title":"Start parsing","text":"
    parser.start(text);\n

    These events will be emitted under this method.

    "},{"location":"bracketparser2/#pause","title":"Pause","text":"
    • Pause
      parser.pause();\n
    • Pause until event
      parser.pauseUntilEvent(eventEmitter, eventName);\n
      • Will invoke
        eventEmitter.once(eventName, function() {\nparser.next();\n})\n

    Invoke this method during tag-start,tag-end, or content events to suspend parsing.

    "},{"location":"bracketparser2/#resume","title":"Resume","text":"
    parser.next();\n
    "},{"location":"bracketparser2/#skip-any-tag-startany-tag-end-event","title":"Skip any-tag-start/any-tag-end event","text":"
    parser.skipEvent();\n

    When getting a tag-start, or a tag-end event, parser will emitts

    • Start-tag : '+TAG', then '+'
    • End-tag : '-TAG', then '-'

    Invoke this medthod under '+TAG', or '-TAG' event to skip '+', or '-' event.

    "},{"location":"bracketparser2/#status","title":"Status","text":"
    • Is parsing
      var isRunning = parser.isRunning;\n
      • true : Has remainder characters
      • false : After parsing last character
    • Is paused
      var isPaused = parser.isPaused;\n
    "},{"location":"bracketparser2/#events","title":"Events","text":""},{"location":"bracketparser2/#tagscontent","title":"Tags/Content","text":"
    • Get a specific tag-start
      • Start-tag with payload : '<TAG param0=value0 param1=value1>'
        parser.on('+' + TagName, function(payload){ /* ... */ });\n
        • payload : {param0:value0, param1:value1, ...}
    • Get any-tag-start
      • Start-tag with payload : '<TAG param0=value0 param1=value1>'
        parser.on('+', function(tagName, payload){ /* ... */ });\n
        • payload : {param0:value0, param1:value1, ...}
    • Get a specific tag-end
      • End-tag with payload : '<\\TAG param0=value0 param1=value1>'
        parser.on('-' + TagName, function(payload){ /* ... */ });\n
        • payload : {param0:value0, param1:value1, ...}
    • Get a content
      parser.on('content', function(content){ /* ... */ });\n
      • Previous tag-start : parser.lastTagStart
        {\nname: '',\npayload: {}\n}\n
    • Get any-tag-end
      • End-tag with payload : '<TAG param0=value0 param1=value1>'
        parser.on('-', function(tagName, payload){ /* ... */ });\n
        • payload : {param0:value0, param1:value1, ...}
      • Previous tag-start : parser.lastTagStart
        {\nname: '',\npayload: {}\n}\n
      • Previous Content : parser.lastContent
    "},{"location":"bracketparser2/#control-flow","title":"Control flow","text":"
    • Parsing start
      parser.on('start', function(){ /* ... */ });\n
    • Parsing end
      parser.on('complete', function(){ /* ... */ });\n
    • On pause
      parser.on('pause', function(){ /* ... */ });\n
    • On resume
      parser.on('resume', function(){ /* ... */ });\n
    "},{"location":"bracketparser2/#compare-with-bracket-parser","title":"Compare with bracket-parser","text":"

    Tag format in

    • bracket-parser:
      <TAG=value0,value1>\n
      • Carried parameters is an array, more compactly.
    • bracket-parser2:
      <TAG param0=value0 param1=value1>\n
      or
      <\n  TAG \n    param0=value0 \n    param1=value1\n>\n
      • Carried parameters is a dictionary, more clearly.
    "},{"location":"buffdata/","title":"Buff data","text":""},{"location":"buffdata/#introduction","title":"Introduction","text":"

    Data manager with buffs, extends from built-in data manager.

    • Author: Rex
    • Member of scene
    "},{"location":"buffdata/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"buffdata/#install-plugin","title":"Install plugin","text":""},{"location":"buffdata/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbuffdataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbuffdataplugin.min.js', true);\n
    • Add buff data manager object
      var data = scene.plugins.get('rexbuffdataplugin').add(parent);\n
    "},{"location":"buffdata/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BuffDataPlugin from 'phaser3-rex-plugins/plugins/buffdata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBuffData',\nplugin: BuffDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add buff data manager object
      var data = scene.plugins.get('rexBuffData').add(parent);\n
    "},{"location":"buffdata/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BuffData from 'phaser3-rex-plugins/plugins/buffdata.js';\n
    • Add buff data manager object
      var data = new BuffData(parent);\n
    "},{"location":"buffdata/#create-instance","title":"Create instance","text":"
    var data = scene.plugins.get('rexBuffData').add(parent);\n// var data = scene.plugins.get('rexBuffData').add(parent, eventEmitter);\n
    • data : Buff data manager
    • parent : The object (a scene, or a game object) that this DataManager belongs to.
    • eventEmitter : The DataManager's event emitter.
    "},{"location":"buffdata/#extend-existing-data-manager","title":"Extend existing data manager","text":"
    var data = scene.plugins.get('rexBuffData').extend(data);\n
    • data : Existing data manager
    "},{"location":"buffdata/#buff","title":"Buff","text":"

    A value is composed of baseValue, and some buffs, clamped by min, max values.

    • Base value

      • Set
        data.setBaseValue(key, value);\n
      • Remove
        data.removeBaseValue(key);\n
      • Get
        var baseValue = data.getBaseValue(key);\n
    • Buffs, each value can have many buffs, or no buff.

      • Add/set a buff
        data.setBuff(key, buffKey, value);\n
        • value :
          • A number
          • A string for percentage like '10%', which means that (baseValue * percentage)
      • Remove a buff of a key
        data.removeBuff(key, buffKey);\n
      • Remove all buffs of a key
        data.removeBuff(key);\n
      • Get a buff value
        var buffValue = data.getBuffValue(key, buffKey);\n
    • Min, max bounds, optional.
      • Set
        data.setMin(key, min);\n
        data.setMax(key, max);\n
        data.setBounds(key, min, max);\n
        • min, max : Clamp buffed result value between min and max value. Set undefined to ignore it.
      • Get
        var min = data.getMinBound(key);\nvar max = data.getMaxBound(key);\n
    • Buffed result
      • Get
        var result = data.get(key);\n
      • Events
    "},{"location":"buildarcadeobject/","title":"Build arcade object","text":""},{"location":"buildarcadeobject/#introduction","title":"Introduction","text":"

    Create arcade body, and inject arcade object methods.

    • Author: Rex
    • Arcade behavior of game object
    "},{"location":"buildarcadeobject/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"buildarcadeobject/#install-plugin","title":"Install plugin","text":""},{"location":"buildarcadeobject/#load-minify-file","title":"Load minify file","text":"
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbuildarcadeobjectplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbuildarcadeobjectplugin.min.js', true);\n
    • Inject arcade object methods
      var gameObject = scene.plugins.get('rexbuildarcadeobjectplugin').build(gameObject);\n
    "},{"location":"buildarcadeobject/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine and install plugin in configuration of game
      import BuildArcadeObjectPlugin from 'phaser3-rex-plugins/plugins/buildarcadeobject-plugin.js';\nvar config = {\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBuildArcadeObject',\nplugin: BuildArcadeObjectPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Inject arcade object methods
      var gameObject = scene.plugins.get('rexBuildArcadeObject').build(gameObject);\n
    "},{"location":"buildarcadeobject/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Import class
      import BuildArcadeObject from 'phaser3-rex-plugins/plugins/buildarcadeobject.js';\n
    • Inject arcade object methods
      var gameObject = BuildArcadeObject(gameObject);\n
    "},{"location":"buildarcadeobject/#inject-arcade-object-methods","title":"Inject arcade object methods","text":"
    • Inject arcade method to game object
      scene.plugins.get('rexBuildArcadeObject').injectMethods(gameObject);\n// scene.physics.add.existing(gameObject);        // Dynamic arcade body\n// scene.physics.add.existing(gameObject, true);  // Static arcade body\n
    • Inject arcade method to game object class
      scene.plugins.get('rexBuildArcadeObject').injectMethods(GameObjectClass.prototype);\n
    • Inject arcade method to root of all game object class
      scene.plugins.get('rexBuildArcadeObject').injectMethodsToRootClass();\n
    • Create dynamic arcade body
      var gameObject = scene.plugins.get('rexBuildArcadeObject').build(gameObject);\n// var gameObjects = scene.plugins.get('rexBuildArcadeObject').build(gameObjects);\n
    • Create static arcade body
      var gameObject = scene.plugins.get('rexBuildArcadeObject').build(gameObject, true);\n// var gameObjects = scene.plugins.get('rexBuildArcadeObject').build(gameObjects, true);\n
    "},{"location":"bullet/","title":"Bullet","text":""},{"location":"bullet/#introduction","title":"Introduction","text":"

    Move game object toward current angle of game object, with a constant speed.

    • Author: Rex
    • Arcade behavior of game object
    "},{"location":"bullet/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"bullet/#install-plugin","title":"Install plugin","text":""},{"location":"bullet/#load-minify-file","title":"Load minify file","text":"
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbulletplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbulletplugin.min.js', true);\n
    • Add bullet behavior
      var bullet = scene.plugins.get('rexbulletplugin').add(gameObject, config);\n
    "},{"location":"bullet/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine and install plugin in configuration of game
      import BulletPlugin from 'phaser3-rex-plugins/plugins/bullet-plugin.js';\nvar config = {\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBullet',\nplugin: BulletPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add bullet behavior
      var bullet = scene.plugins.get('rexBullet').add(gameObject, config);\n
    "},{"location":"bullet/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Import class
      import Bullet from 'phaser3-rex-plugins/plugins/bullet.js';\n
    • Add bullet behavior
      var bullet = new Bullet(gameObject, config);\n
    "},{"location":"bullet/#create-instance","title":"Create instance","text":"
    var bullet = scene.plugins.get('rexBullet').add(gameObject, {\nspeed: 200,\n// wrap: false,\n// padding: 0,\n// enable: true,\n\n// angle: undefined,\n// rotation: undefined\n});\n
    • speed : moving speed, pixels in second.
    • Wrap
      • wrap : Set true to enable wrap mode. Default value is false.
      • padding
    • enable : set false to disable moving.
    • angle, rotation :
      • undefined : Use angle of game object as angle of bullet. Default value.
      • A number : Angle of bullet, in degrees or radians.
    "},{"location":"bullet/#speed","title":"Speed","text":"
    • Set
      bullet.setSpeed(speed);\n// bullet.speed = speed;\n
    • Get
      var speed = bullet.speed;\n
    "},{"location":"bullet/#set-wrap-mode","title":"Set wrap mode","text":"
    bullet.setWrapMode(wrap, padding);\n
    • wrap : Set true to enable wrap mode.
    "},{"location":"bullet/#angle","title":"Angle","text":"
    • Set angle
      bullet.setAngle(degrees);\n// bullet.angle = degrees;\n
      or
      bullet.setRotation(radians);\n// bullet.rotation  = radians;\n
    • Use angle of game object
      bullet.setAngle();\n// bullet.setRotation();\n
    "},{"location":"button/","title":"Click/Button","text":""},{"location":"button/#introduction","title":"Introduction","text":"

    Fires 'click' event when touch releasd after pressed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"button/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"button/#install-plugin","title":"Install plugin","text":""},{"location":"button/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbuttonplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbuttonplugin.min.js', true);\n
    • Add button behavior
      var button = scene.plugins.get('rexbuttonplugin').add(gameObject, config);\n
    "},{"location":"button/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ButtonPlugin from 'phaser3-rex-plugins/plugins/button-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexButton',\nplugin: ButtonPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add button behavior
      var button = scene.plugins.get('rexButtonn').add(gameObject, config);\n
    "},{"location":"button/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Button from 'phaser3-rex-plugins/plugins/button.js';\n
    • Add button behavior
      var button = new Button(gameObject, config);\n
    "},{"location":"button/#create-instance","title":"Create instance","text":"
    var button = scene.plugins.get('rexButton').add(gameObject, {\n// enable: true,\n// mode: 1,              // 0|'press'|1|'release'\n// clickInterval: 100    // ms\n// threshold: undefined\n});\n
    • enable : Clickable.
    • mode :
      • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
      • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
    • clickInterval : Interval between 2 'click' events, in ms.
    • threshold : Cancel clicking detecting when dragging distance is larger then this threshold.
      • undefined : Ignore this feature. Default behavior.
    "},{"location":"button/#events","title":"Events","text":"
    • Click
      button.on('click', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Enable
      button.on('enable', function (button, gameObject) {\n// ...\n}, scope);\n
    • Disable
      button.on('disable', function (button, gameObject) {\n// ...\n}, scope);\n
    • Pointer over
      button.on('over', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
    • Pointer out
      button.on('out', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
    • Pointer down
      button.on('down', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
    • Pointer up
      button.on('up', function (button, gameObject, pointer, event) {\n// ...\n}, scope);\n
    "},{"location":"button/#enable","title":"Enable","text":"
    • Get
      var enabled = button.enable;  // enabled: true, or false\n
    • Set
      button.setEnable(enabled);  // enabled: true, or false\n// button.enable = enabled;\n
    • Toggle
      button.toggleEnable();\n
    "},{"location":"button/#set-mode","title":"Set mode","text":"
    button.setMode(mode);\n
    • mode :
      • 'press', or 0 : Fire 'click' event when touch pressed.
      • 'release', or 1 : Fire 'click' event when touch released after pressed.
    "},{"location":"button/#set-click-interval","title":"Set click interval","text":"
    button.setClickInterval(interval);  // interval in ms\n
    "},{"location":"button/#set-dragging-threshold","title":"Set dragging threshold","text":"
    button.setDragThreshold(distance);  // distance in pixels\n
    "},{"location":"camera-controller/","title":"Controller","text":""},{"location":"camera-controller/#introduction","title":"Introduction","text":"

    Scroll/zoom camera.

    • Author: Richard Davey
    "},{"location":"camera-controller/#usage","title":"Usage","text":""},{"location":"camera-controller/#setup","title":"Setup","text":"
    1. Create controllor
      // var cursors = scene.input.keyboard.createCursorKeys();\nvar controls = new Phaser.Cameras.Controls.SmoothedKeyControl({\ncamera: camera,\n\nleft: cursors.left,    // { isDown, isUp }\nright: cursors.right,  // { isDown, isUp }\nup: cursors.up,        // { isDown, isUp }\ndown: cursors.down,    // { isDown, isUp }\nzoomIn: null,          // { isDown, isUp }\nzoomOut: null,         // { isDown, isUp }\n\nzoomSpeed: 0.01,\nminZoom: 0.001,\nmaxZoom: 1000,\n\nacceleration: null,\n// acceleration: {\n//    x: 0,\n//    y: 0\n// }\n\ndrag: null,\n// drag: {\n//    x: 0,\n//    y: 0\n// }\n\nmaxSpeed: null\n// maxSpeed: {\n//    x: 0,\n//    y: 0\n// }\n});\n
      or
      var controls = new Phaser.Cameras.Controls.FixedKeyControl(config);\n
    2. Update
      scene.update = function (time, delta) {\ncontrols.update(delta);\n}\n
    "},{"location":"camera-controller/#other-methods","title":"Other methods","text":"
    • Start
      controls.start();\n
    • Stop
      controls.stop();\n
    • Set camera
      controls.setCamera(camera);\n
    "},{"location":"camera-effects/","title":"Effects","text":""},{"location":"camera-effects/#introduction","title":"Introduction","text":"

    Effects of camera.

    • Author: Richard Davey
    "},{"location":"camera-effects/#usage","title":"Usage","text":""},{"location":"camera-effects/#fade","title":"Fade","text":"
    • Fades the Camera in, from the given color over the duration specified.
      camera.fadeIn(duration);   // duration in ms\n// camera.fadeIn(duration, red, green, blue, callback, context);\n// red/green/blue: the value to fade the red/green/blue channel from. A value between 0 and 255.\n
      • callback , context : It will be invoked every frame for the duration of the effect.
        function(camera, progress) {}\n
    • Fades the Camera out, to the given color over the duration specified.
      camera.fadeOut(duration);   // duration in ms\n// camera.fadeOut(duration, red, green, blue, callback, context);\n
      • callback , context : It will be invoked every frame for the duration of the effect.
        function(camera, progress) {}\n
    • Fades the Camera, from the given color to transparent over the duration specified.
      camera.fadeFrom(duration);   // duration in ms\n// camera.fadeFrom(duration, red, green, blue, force, callback, context);\n
      • force : Force the effect to start immediately, even if already running.
      • callback , context : It will be invoked every frame for the duration of the effect.
        function(camera, progress) {}\n
    • Fades the Camera, from transparent to the given color over the duration specified.
      camera.fade(duration);   // duration in ms\n// camera.fade(duration, red, green, blue, force, callback, context);\n
      • force : Force the effect to start immediately, even if already running.
      • callback , context : It will be invoked every frame for the duration of the effect.
        function(camera, progress) {}\n
    "},{"location":"camera-effects/#events","title":"Events","text":"
    camera.on('camerafadeincomplete', camera, fade);\n
    camera.on('camerafadeoutcomplete', camera, fade);\n
    "},{"location":"camera-effects/#flash","title":"Flash","text":"
    camera.flash(duration);   // duration in ms\n// camera.flash(duration, red, green, blue, force, callback, context);\n
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress) {}\n
    "},{"location":"camera-effects/#events_1","title":"Events","text":"
    camera.on('cameraflashstart', camera, flash, duration, red, green, blue);\n
    camera.on('cameraflashcomplete', camera, flash);\n
    "},{"location":"camera-effects/#shake","title":"Shake","text":"
    camera.shake(duration);   // duration in ms\n// camera.shake(duration, intensity, force, callback, context);  // callback: invoked when completed\n
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress) {}\n
    "},{"location":"camera-effects/#events_2","title":"Events","text":"
    camera.on('camerashakestart', camera, shake, duration, intensity);\n
    camera.on('camerashakecomplete', camera, shake);\n
    "},{"location":"camera-effects/#pan","title":"Pan","text":"
    camera.pan(x, y, duration);   // duration in ms\n// camera.pan(x, y, duration, ease, force, callback, context);\n
    • x, y : The destination x/y coordinate to scroll the center of the Camera viewport to.
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress, x, y) {}\n
    "},{"location":"camera-effects/#events_3","title":"Events","text":"
    camera.on('camerapanstart', camera, pan, duration, x, y);\n
    camera.on('camerapancomplete', camera, pan);\n
    "},{"location":"camera-effects/#zoom","title":"Zoom","text":"
    camera.zoomTo(zoomValue, duration);   // duration in ms\n// camera.zoomTo(zoomValue, duration, ease, force, callback, context);\n
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress, zoomValue) {}\n
    "},{"location":"camera-effects/#events_4","title":"Events","text":"
    camera.on('camerazoomstart', camera, zoom, duration, zoomValue);\n
    camera.on('camerazoomcomplete', camera, zoom);\n
    "},{"location":"camera-effects/#rotate-to","title":"Rotate to","text":"
    camera.rotateTo(radians, shortestPath, duration);   // duration in ms\n// camera.rotateTo(radians, shortestPath, duration, ease, force, callback, context);\n
    • callback , context : It will be invoked every frame for the duration of the effect.
      function(camera, progress, angle) {}\n
    "},{"location":"camera-effects/#events_5","title":"Events","text":"
    camera.on('camerarotatestart', camera, rotateTo, duration, angle);\n
    camera.on('camerarotatecomplete', camera, rorotateTotate);\n
    "},{"location":"camera-effects/#mask","title":"Mask","text":"
    • Add mask
      camera.setMask(mask);\n
    • Clear mask
      camera.clearMask();\n

    More detail about mask

    "},{"location":"camera-shader-effect/","title":"Shader effect","text":""},{"location":"camera-shader-effect/#introduction","title":"Introduction","text":"

    Shader effect of camera.

    • Author: Richard Davey
    "},{"location":"camera-shader-effect/#usage","title":"Usage","text":""},{"location":"camera-shader-effect/#register-post-fx-pipeline","title":"Register post-fx pipeline","text":"
    • Register post-fx pipeline in game config
      import PostFxClass from 'path';\nvar config = {\n// ...\npipeline: [PostFxClass]\n// ...\n};\nvar game = new Phaser.Game(config);\n

    Some post-fx pipelines:

    • Barrel: Barrel post processing filter.
    • Color replace: Replace color post processing filter.
    • Cross-stitching: Cross-stitching post processing filter.
    • CRT: CRT post processing filter.
    • Dissolve: Dissolve transition post processing filter.
    • Fish eye: Fish-eye post processing filter.
    • Glow-filter: Glow post processing filter.
    • Glow-filter: Glow post processing filter, ported from pixi.
    • Gray-scale: Gray scale post processing filter.
    • Hsl-adjust: Adjust color in HSL domain, post processing filter.
    • Horri-fi: 6-in-1 post processing filter.
    • Inverse: Inverse color post processing filter.
    • Kawase-blur: Kawase-blur post processing filter.
    • Pixelation: Pixelation post processing filter.
    • Toonify: Draw outlines and quantize color in HSV domain, post processing filter.
    • Shockwave: Shockwave post processing filter.
    • Split: Split image into 4 parts.
    • Swirl: Swirl post processing filter.
    • Warp: Warp post processing filter.
    "},{"location":"camera-shader-effect/#add-post-fx-pipeline","title":"Add post-fx pipeline","text":"
    camera.setPostPipeline(PostFxClass);\n
    • PostFxClass : Class of post-fx pipeline.
    "},{"location":"camera-shader-effect/#remove-post-fx-pipeline","title":"Remove post-fx pipeline","text":"
    • Remove a kind of post-fx pipeline
      camera.removePostPipeline(PostFxClass);\n
    • Remove all post-fx pipelines
      camera.resetPipeline(true);\n
      or
      camera.postPipelines = [];\ncamera.hasPostPipeline = false;\n
    "},{"location":"camera-shader-effect/#get-post-fx-pipeline","title":"Get post-fx pipeline","text":"
    var pipelineInstance = camera.getPostPipeline(PostFxClass);\n
    • pipelineInstance :
      • A pipeline instance
      • An array of pipeline instances
    "},{"location":"camera-shader-effect/#add-effect-properties","title":"Add effect properties","text":"

    See Add effect properties behavior

    "},{"location":"camera/","title":"Camera","text":""},{"location":"camera/#introduction","title":"Introduction","text":"

    Camera to display game objects, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"camera/#usage","title":"Usage","text":""},{"location":"camera/#get-camera","title":"Get camera","text":"

    Each scene has one or more cameras.

    • Main camera
      var camera = scene.cameras.main;\n
    • Get camera by name
      var camera = scene.cameras.getCamera(name);\n
    • Add new camera
      var camera = scene.cameras.add();\n// var camera = scene.cameras.add(x, y, width, height);\n
    • Add new camera with name
      var camera = scene.cameras.add(undefined, undefined, undefined, undefined, false, name);\n// var camera = scene.cameras.add(x, y, width, height, makeMain, name);\n
    • Add existed camera
      scene.cameras.addExisting(camera);\n
    "},{"location":"camera/#create-cameras-from-json","title":"Create cameras from JSON","text":"
    scene.cameras.fromJSON(config);\n// scene.cameras.fromJSON(configArray);\n
    • config :
      {\nname: '',\nx: 0,\ny: 0,\nwidth: scene.sys.scale.width,\nheight: scene.sys.scale.height,\nzoom: 1,\nrotation: 0,\nscrollX: 0,\nscrollY: 0,\nroundPixels: false,\nvisible: true,\nbackgroundColor: false,\nbounds: null, // {x, y, width, height}\n}\n
    "},{"location":"camera/#remove-camera","title":"Remove camera","text":"
    scene.cameras.remove(camera);\n
    "},{"location":"camera/#destroy-camera","title":"Destroy camera","text":"
    camera.destroy();\n
    "},{"location":"camera/#view-port","title":"View port","text":"
    • Set
      camera.setViewport(top, left, width, height);\n
      or
      camera.setPosition(top, left);\n// camera.x = top;\n// camera.y = left;\n
      camera.setSize(width, height);\n// camera.width = width;\n// camera.height = height;\n
    • Get
      • Position
        • Top-left
          var top = camera.x;\nvar left = camera.y;\n
        • Center, relative to the top-left of the game canvas.
          var x = camera.centerX;\nvar y = camera.centerY;\n
      • Width & height
        var width = camera.width;\nvar height = camera.height;\n
        var displayWidth = camera.displayWidth;\nvar displayHeight = camera.displayHeight;\n
    "},{"location":"camera/#zoom","title":"Zoom","text":"
    • Set
      camera.setZoom(zoomValue);  // The minimum it can be is 0.001.\ncamera.zoom = zoomValue;\n
    • Get
      var zoomValue = camera.zoom;\n
    "},{"location":"camera/#rotation","title":"Rotation","text":"
    • Set
      camera.setAngle(angle);  // angle in degree\ncamera.setRotation(angle);  // angle in radians\ncamera.rotation = angle; // angle in radians\n
    • Get
      var angle = camera.rotation;  // angle in radians\n
    "},{"location":"camera/#origin","title":"Origin","text":"
    • Set
      camera.setOrigin(x, y);\n// camera.originX = 0.5;\n// camera.originY = 0.5;\n
    • Get
      var originX = camera.originX\nvar originY = camera.originY\n
    "},{"location":"camera/#visible","title":"Visible","text":"

    A visible camera will render and perform input tests. An invisible camera will not render anything and will skip input tests.

    camera.setVisible(value);\n// camera.visible = value\n
    var visible = camera.visible;\n
    "},{"location":"camera/#alpha","title":"Alpha","text":"
    camera.setAlpha(value);\n// camera.alpha = value;\n
    var alpha = camera.alpha;\n
    "},{"location":"camera/#scroll","title":"Scroll","text":"
    camera.setScroll(x, y)\n
    camera.scrollX = scrollX;\ncamera.scrollY = scrollY;\n
    camera.centerToBounds();\n
    camera.centerOn(x, y);  // centered on the given coordinates\n
    camera.centerOnX(x);\ncamera.centerOnY(y);\n
    camera.centerToSize();\n
    "},{"location":"camera/#follow-game-object","title":"Follow game object","text":"
    • Start following
      camera.startFollow(gameObject);\n// camera.startFollow(gameObject, roundPx, lerpX, lerpY, offsetX, offsetY);  // \n
      • roundPx : set true to round the camera position to integers
      • lerpX, lerpY : A value between 0 and 1.
        • 1 : Camera will instantly snap to the target coordinates.
        • 0.1 : Camera will more slowly track the target, giving a smooth transition.
      • offsetX, offsetY : The horizontal/vertical offset from the camera follow target.x position.
    • Stop following
      camera.stopFollow();\n
    • Set follow offset
      camera.setFollowOffset(x, y);\n
    • Set lerp
      camera.setLerp(x, y);\n
      • 1 : Camera will instantly snap to the target coordinates.
      • 0.1 : Camera will more slowly track the target, giving a smooth transition.
    • Deadzone
      camera.setDeadzone(width, height);\n
      If the target moves outside of this area, the camera will begin scrolling in order to follow it.
      • Boundaries
        var left = camera.deadzone.left;\nvar right = camera.deadzone.right;\nvar top = camera.deadzone.top;\nvar bootom = camera.deadzone.bottom;\n
      • Clear deadzone
        camera.setDeadzone();\n
    "},{"location":"camera/#events","title":"Events","text":"
    • Follower Update
      camera.on('followupdate', function(camera, gameObject){ })\n
    "},{"location":"camera/#scroll-factor","title":"Scroll factor","text":"

    See Scroll factor in game object.

    "},{"location":"camera/#bounds","title":"Bounds","text":"
    • Set
      camera.setBounds(x, y, width, height)\n
    • Get
      var bounds = camera.getBounds();  // bounds: a rectangle object\n// var out = camera.getBounds(out);\n
    "},{"location":"camera/#world-coordinates","title":"World coordinates","text":"
    • World view, a rectangle object
      var worldView = camera.worldView;\nvar x = worldView.x;\nvar y = worldView.y;\nvar width = worldView.width;  // displayWidth\nvar height = worldView.height; // displayHeight\nvar left = worldView.left;  // x\nvar right = worldView.right;  // x + width\nvar top = worldView.top;  // y\nvar bottom = worldView.bottom;  // y + height\nvar centerX = worldView.centerX;\nvar centerY = worldView.centerY;\nvar isInside = worldView.contains(x, y);\nvar randPoint = worldView.getRandomPoint(point); // point: {x, y}\n
    • Middle point
      var x = camera.midPoint.x;\nvar y = camera.midPoint.y;\n
    • Get world position
      var out = camera.getWorldPoint(x, y);\n// var out = camera.getWorldPoint(x, y, out);\n
      • x , y : Position of camera.
      • out : World position {x, y}
    "},{"location":"camera/#set-background-color","title":"Set background color","text":"
    camera.setBackgroundColor(color);\n
    "},{"location":"camera/#ignore-game-object","title":"Ignore game object","text":"

    Ignored game objects won't show at that camera.

    camera.ignore(gameObject);\n
    • gameObject :
      • A game object
      • An array of game objects
      • A group
    "},{"location":"camera/#get-cameras-below-pointer","title":"Get cameras below pointer","text":"
    var cameras = scene.cameras.getCamerasBelowPointer(pointer);\n
    • cameras : An array of cameras.
    • pointer : {x, y}
    "},{"location":"camera/#pause-resume","title":"Pause, resume","text":"
    • Pause
      camera.renderToTexture = false; // Pause\n
    • Resume
      camera.renderToTexture = true; // Resume\n
    "},{"location":"camera/#clear","title":"Clear","text":"
    camera.clearRenderToTexture();\n
    "},{"location":"camera/#children","title":"Children","text":""},{"location":"camera/#visible-children","title":"Visible children","text":"
    • Filter visible children
      var visible = scene.cameras.getVisibleChildren(children, camera);\n
    • Get all visible children
      var visible = scene.cameras.getVisibleChildren(scene.sys.displayList.list, camera);\n

    See also: gameObject.willRender(camera)

    "},{"location":"camera/#render-children","title":"Render children","text":"
    var children = camera.renderList;\n

    Read only.

    "},{"location":"canvas-circularprogress/","title":"Circular progres","text":""},{"location":"canvas-circularprogress/#introduction","title":"Introduction","text":"

    Circular progress bar on canvas.

    • Author: Rex
    • Game object
    "},{"location":"canvas-circularprogress/#live-demos","title":"Live demos","text":"
    • Circular-progress
    "},{"location":"canvas-circularprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas-circularprogress/#install-plugin","title":"Install plugin","text":""},{"location":"canvas-circularprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcircularprogresscanvasplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcircularprogresscanvasplugin.min.js', true);\n
    • Add circular-progress object
      var circularProgress = scene.add.rexCircularProgressCanvas(x, y, radius, color, value, config);\n
    "},{"location":"canvas-circularprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CircularProgressCanvasPlugin from 'phaser3-rex-plugins/plugins/circularprogresscanvas-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircularProgressCanvasPlugin',\nplugin: CircularProgressCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add circular-progress object
      var circularProgress = scene.add.rexCircularProgressCanvas(x, y, radius, color, value, config);\n
    "},{"location":"canvas-circularprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CircularProgressCanvas from 'phaser3-rex-plugins/plugins/circularprogresscanvas.js';\n
    • Add circular-progress object
      var circularProgress = new CircularProgressCanvas(scene, x, y, radius, color, value, config);\nscene.add.existing(image);\n
    "},{"location":"canvas-circularprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircularProgressCanvasPlugin',\nplugin: CircularProgressCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"canvas-circularprogress/#create-instance","title":"Create instance","text":"
    var circularProgress = scene.add.rexCircularProgressCanvas(x, y, radius, barColor, value, {\nbarColor2: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nendAngle: Phaser.Math.DegToRad(270+360),\nanticlockwise: false,\n\ntextColor: undefined,\ntextStrokeColor: undefined,\ntextStrokeThickness: undefined,\n// textFont: ,\ntextSize: '16px',\ntextFamily: 'Courier',\ntextStyle: '',\ntextFormatCallback: undefined,\ntextFormatCallbackScope: undefined,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n

    or

    var circularProgress = scene.add.rexCircularProgressCanvas({\nx: 0,\ny: 0,\nradius: 1,\n\nbarColor: undefined,\nbarColor2: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nendAngle: Phaser.Math.DegToRad(270+360),\nanticlockwise: false,\n\ntextColor: undefined,\ntextStrokeColor: undefined,\ntextStrokeThickness: undefined,\n// textFont: ,\ntextSize: '16px',\ntextFamily: 'Courier',\ntextStyle: '',\ntextFormatCallback: undefined,\ntextFormatCallbackScope: undefined,\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n
    • x, y : Position of this object.
    • radius : Radius of this circle. Size will be (radius*2, radius*2).
    • barColor, barColor2 : Fill color of circular bar, in number or css string value. Assign gradient start color by barColor2.
    • trackColor : Color of circular track, in number or css string value.
    • centerColor : Color of center circle, in number or css string value.
    • thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
    • startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
    • endAngle : End angle of circular bar, in radians. Default value is 270+360 degrees.
    • anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
    • textColor : Color of display text. Default is undefined.
    • textStrokeColor, textStrokeThickness : Stroke color, stroke line width of display text. Default is undefined.
    • textSize, textFamily, textStyle : Size, family, style of display text.
    • textFormatCallback, textFormatCallbackScope : Formating callback of display text. ex:
      function(value) {\nreturn Math.floor(value * 100).toString();\n}\n
      Default value is undefined.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, circularProgress) {\n}\n

    Add circular-progress from JSON

    var circularProgress = scene.make.rexCircularProgressCanvas({\nx: 0,\ny: 0,\nradius: 1,\n\nbarColor: undefined,\nbarColor2: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nendAngle: Phaser.Math.DegToRad(270+360),\nanticlockwise: false,\n\ntextColor: undefined,\ntextStrokeColor: undefined,\ntextStrokeThickness: undefined,\ntextSize: '16px',\ntextFamily: 'Courier',\ntextStyle: '',\ntextFormatCallback: undefined,\ntextFormatCallbackScope: undefined,\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n\nadd: true\n});\n
    "},{"location":"canvas-circularprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCircularProgressCanvas extends CircularProgressCanvas {\nconstructor(scene, x, y, radius, barColor, value, config) {\nsuper(scene, x, y, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var circularProgress = new MyCircularProgressCanvas(scene, x, y, radius, color, value, config);\n
    "},{"location":"canvas-circularprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = circularProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = circularProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = circularProgress.value; // value: 0 ~ 1\n
    • Set value
      circularProgress.setValue(value, min, max); // value: min ~ max\n
      or
      circularProgress.setValue(value); // value: 0 ~ 1\n
      or
      circularProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      circularProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      circularProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      circularProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"canvas-circularprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      circularProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      circularProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      circularProgress.stopEaseValue();\n
    • Set ease duration
      circularProgress.setEaseValueDuration(duration);\n
    • Set ease function
      circularProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"canvas-circularprogress/#radius","title":"Radius","text":"
    • Get
      var radius = circularProgress.radius;\n
    • Set
      circularProgress.setRadius(radius);\n// circularProgress.radius = radius;\n
      • Also resize this game object to (radius*2, radius*2)
    "},{"location":"canvas-circularprogress/#circular-track","title":"Circular track","text":"
    • Color
      • Get
        var trackColor = circularProgress.trackColor;\n
      • Set
        circularProgress.setTrackColor(trackColor);\n// circularProgress.trackColor = trackColor;\n
    • Thickness : radius*thickness
      circularProgress.setThickness(thickness);\n
      • thickness : 0~1.
    "},{"location":"canvas-circularprogress/#circular-bar","title":"Circular bar","text":"
    • Color
      • Get
        var barColor = circularProgress.barColor;\n
      • Set
        circularProgress.setBarColor(color);\n// circularProgress.barColor = color;\n
    • Color2
      • Get
        var barColor2 = circularProgress.barColor2;\n
      • Set
        circularProgress.setBarColor2(color);\n// circularProgress.barColor2 = color;\n
    • Thickness : radius*thickness
      circularProgress.setThickness(thickness);\n
      • thickness : 0~1.
    • Start angle
      • Get
        var startAngle = circularProgress.startAngle;\n
      • Set
        circularProgress.setStartAngle(startAngle);\ncircularProgress.startAngle = startAngle;\n
        • startAngle : Start angle of circular bar, in radians.
    • End angle
      • Get
        var endAngle = circularProgress.endAngle;\n
      • Set
        circularProgress.setEndAngle(endAngle);\ncircularProgress.endAngle = endAngle;\n
        • endAngle : End angle of circular bar, in radians.
    • Anticlockwise
      • Get
        var anticlockwise = circularProgress.anticlockwise;\n
      • Set
        circularProgress.setAnticlockwise(anticlockwise);\n// circularProgress.anticlockwise = anticlockwise;\n
    "},{"location":"canvas-circularprogress/#center-circle","title":"Center circle","text":"
    • Color
      • Get
        var centerColor = circularProgress.centerColor;\n
      • Set
        circularProgress.setCenterColor(centerColor);\n// circularProgress.centerColor = centerColor;\n
    "},{"location":"canvas-circularprogress/#display-text","title":"Display text","text":"
    • Fill color
      circularProgress.setTextColor(color);\n
    • Stroke color
      circularProgress.setTextStrokeColor(color, thickness);\n
    • Font
      circularProgress.setTextFont(fontSize, fontFamily, fontStyle);\n
    • Format callback
      circularProgress.setTextFormatCallback(callback, scope);\n
      • callback :
        function(value) {\nreturn Math.floor(value * 100).toString(); }\n
    "},{"location":"canvas-circularprogress/#events","title":"Events","text":"
    • On value changed
      circularProgress.on('valuechange', function(newValue, oldValue, circularProgress){\n//\n}, scope);\n
    "},{"location":"canvas-circularprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"canvas-circularprogress/#create-mask","title":"Create mask","text":"
    var mask = circularProgress.createBitmapMask();\n

    See mask

    "},{"location":"canvas-circularprogress/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"canvas-circularprogress/#compare-with-circular-progress-shape","title":"Compare with Circular-progress shape","text":"
    • Circular-progress canvas creates a canvas then draw on that canvas, circular progress shape draw on GRAPHICS pipeline like Shape or Graphics game object.
    • Circular-progress canvas can draw text directly, circular progress shape can't draw any text.
    "},{"location":"canvas-data/","title":"Canvas image data","text":""},{"location":"canvas-data/#introduction","title":"Introduction","text":"

    Get image data from texture, or text object.

    • Author: Rex
    • Method only
    "},{"location":"canvas-data/#live-demos","title":"Live demos","text":"
    • Text to bit-map
    • Texture to color-map
    "},{"location":"canvas-data/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas-data/#install-plugin","title":"Install plugin","text":""},{"location":"canvas-data/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcanvasdataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcanvasdataplugin.min.js', true);\n
    • Add canvas-data object
      var canvasData = scene.plugins.get('rexcanvasdataplugin').canvasObjectToBitmap(gameObject);\nvar canvasData = scene.plugins.get('rexcanvasdataplugin').textureTColorMap(textureKey, frameName);\n
    "},{"location":"canvas-data/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CanvasDataPlugin from 'phaser3-rex-plugins/plugins/canvasdata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCanvasData',\nplugin: CanvasDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add canvas-data object
      var canvasData = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(gameObject);\nvar canvasData = scene.plugins.get('rexCanvasData').textureTColorMap(textureKey, frameName);\n
    "},{"location":"canvas-data/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CanvasData from 'phaser3-rex-plugins/plugins/canvasdata.js';\n
    • Add canvas-data object
      var canvasdata = CanvasData.canvasObjectToBitmap(gameObject);\nvar canvasdata = CanvasData.textureTColorMap(textureKey, frameName);\n
    "},{"location":"canvas-data/#textcanvas-object-bitmap","title":"Text/canvas object -> Bitmap","text":"
    var canvasData = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(gameObject);\n// var out = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(gameObject, out);\n
    • gameObject :
      • Any kind of text object : Text object, bbcode text object, or tag text object.
      • Canvas object
    • For each pixel data
      canvasData.forEach(function(value, x, y, canvasData){\n\n}, scope);\n
      • value : true, or false
    "},{"location":"canvas-data/#texture-color-map","title":"Texture -> Color map","text":"
    • Texture -> Color map
      var canvasData = scene.plugins.get('rexCanvasData').textureTColorMap(textureKey, frameName);\n// var out = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(textureKey, frameName, out);\n
    • Texture of game object -> Color map
      var canvasData = scene.plugins.get('rexCanvasData').textureTColorMap(gameObject);\n// var out = scene.plugins.get('rexCanvasData').canvasObjectToBitmap(gameObject, out);\n
    • For each pixel data
      canvasData.forEach(function(value, x, y, canvasData){\n\n}, scope);\n
      • value : Color32 integer = color integer + (alpha << 24)
        • Get color integer (0 ~ 0xffffff)
          var color = value & 0xffffff;\n
          or
          var color = canvasData.color32ToColorInt(value);\n
        • Get alpha (0 ~ 0xff)
          var alpha = value >>> 24;\n
          var alpha = canvasData.color32ToAlpha(value);\n
    "},{"location":"canvas-data/#canvas-data","title":"Canvas data","text":""},{"location":"canvas-data/#for-each-pixel","title":"For each pixel","text":"
    • For each pixel data
      canvasData.forEach(callback, scope);\n
      • callback : Callback for each pixel
        function(value, x, y, canvasData) {\n\n}\n
    • For each non zero pixel data
      canvasData.forEachNonZero(callback, scope);\n
    "},{"location":"canvas-data/#get-pixel-data","title":"Get pixel data","text":"
    var data = canvasData.get(x, y);\n
    • data :
      • true, or false in result of canvasObjectToBitmap method
      • Color32 in result of textureTColorMap method
    "},{"location":"canvas-data/#size","title":"Size","text":"
    var width = canvasData.width;\nvar height = canvasData.height;\n
    "},{"location":"canvas-lineprogress/","title":"Line progres","text":""},{"location":"canvas-lineprogress/#introduction","title":"Introduction","text":"

    Horizontal line progress bar filled with gradient color on canvas.

    • Author: Rex
    • Game object
    "},{"location":"canvas-lineprogress/#live-demos","title":"Live demos","text":"
    • Line-progress
    "},{"location":"canvas-lineprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas-lineprogress/#install-plugin","title":"Install plugin","text":""},{"location":"canvas-lineprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlineprogresscanvasplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlineprogresscanvasplugin.min.js', true);\n
    • Add line-progress object
      var lineProgress = scene.add.rexLineProgressCanvas(x, y, width, height, barColor, value, config);\n
    "},{"location":"canvas-lineprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LineProgressCanvasPlugin from 'phaser3-rex-plugins/plugins/lineprogresscanvas-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLineProgressCanvasPlugin',\nplugin: LineProgressCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add line-progress object
      var lineProgress = scene.add.rexLineProgressCanvas(x, y, width, height, barColor, value, config);\n
    "},{"location":"canvas-lineprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LineProgressCanvas from 'phaser3-rex-plugins/plugins/lineprogresscanvas.js';\n
    • Add line-progress object
      var lineProgress = new LineProgressCanvas(scene, x, y, width, height, barColor, value, config);\nscene.add.existing(image);\n
    "},{"location":"canvas-lineprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLineProgressCanvasPlugin',\nplugin: LineProgressCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"canvas-lineprogress/#create-instance","title":"Create instance","text":"
    var lineProgress = scene.add.rexLineProgressCanvas(x, y, width, height, barColor, value, {    barColor2: undefined,\nisHorizontalGradient: true,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n});\n

    or

    var lineProgress = scene.add.rexLineProgressCanvas({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\nbarColor: undefined,\nbarColor2: undefined,\nisHorizontalGradient: true,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • barColor, barColor2, isHorizontalGradient : Fill color of line bar, in number or css string value. Assign gradient start color by barColor2.
    • trackColor : Fill color of line track, in number or css string value.
    • trackStrokeColor : Stroke color of track, in number or css string value.
    • trackStrokeThickness : Stroke line width of track.
    • skewX : Horizontal skew of track and bar.
    • rtl :
      • false : Bar starts from left side. Default behavior.
      • true : Bar starts from right side.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, lineProgress) {\n}\n

    Add line-progress from JSON

    var lineProgress = scene.make.rexLineProgressCanvas({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\nbarColor: undefined,\nbarColor2: undefined,\nisHorizontalGradient: true,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n\nadd: true\n});\n
    "},{"location":"canvas-lineprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLineProgressCanvas extends LineProgressCanvas {\nconstructor(scene, x, y, width, height, barColor, value, config) {\nsuper(scene, x, y, width, height, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var lineProgress = new MyLineProgressCanvas(scene, x, y, width, height, barColor, value, config);\n
    "},{"location":"canvas-lineprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = lineProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = lineProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = lineProgress.value; // value: 0 ~ 1\n
    • Set value
      lineProgress.setValue(value, min, max); // value: min ~ max\n
      or
      lineProgress.setValue(value); // value: 0 ~ 1\n
      or
      lineProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      lineProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      lineProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      lineProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"canvas-lineprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      lineProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      lineProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      lineProgress.stopEaseValue();\n
    • Set ease duration
      lineProgress.setEaseValueDuration(duration);\n
    • Set ease function
      lineProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"canvas-lineprogress/#line-track","title":"Line track","text":"
    • Color
      • Get
        var trackColor = lineProgress.trackColor;\n
      • Set
        lineProgress.setTrackColor(trackColor);\n// lineProgress.trackColor = trackColor;\n
    • Stroke
      • Get
        var trackStrokeColor = lineProgress.trackStrokeColor;\nvar trackStrokeThickness = lineProgress.trackStrokeThickness;\n
      • Set
        lineProgress.setTrackColor(color);\nlineProgress.setTrackStroke(lineWidth, color);\n
    "},{"location":"canvas-lineprogress/#line-bar","title":"Line bar","text":"
    • Color
      • Get
        var barColor = lineProgress.barColor;\nvar barColor2 = lineProgress.barColor2;\n
      • Set
        lineProgress.setBarColor(barColor, barColor2);\n// lineProgress.barColor = barColor;\n// lineProgress.barColor2 = barColor2;\n
    "},{"location":"canvas-lineprogress/#horizontal-skew","title":"Horizontal skew","text":"
    • Get
      var skewX = lineProgress.skewX;\n
    • Set
      lineProgress.setSkewX(skewX);\n// lineProgress.skewX = skewX;\n
    "},{"location":"canvas-lineprogress/#right-to-left","title":"Right-to-left","text":"
    • Get
      var rtl = lineProgress.rtl;\n
    • Set
      lineProgress.setRTL(rtl);\n// lineProgress.rtl = rtl;\n
    "},{"location":"canvas-lineprogress/#events","title":"Events","text":"
    • On value changed
      lineProgress.on('valuechange', function(newValue, oldValue, lineProgress){\n//\n}, scope);\n
    "},{"location":"canvas-lineprogress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = lineProgress.alpha;\n
    • Set
      lineProgress.setAlpha(alpha);\n// lineProgress.alpha = alpha;\n
    "},{"location":"canvas-lineprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"canvas-lineprogress/#create-mask","title":"Create mask","text":"
    var mask = lineProgress.createBitmapMask();\n

    See mask

    "},{"location":"canvas-lineprogress/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"canvas-lineprogress/#compare-with-line-progress-shape","title":"Compare with Line-progress shape","text":"
    • Line-progress canvas creates a canvas then draw on that canvas, line progress shape draw on GRAPHICS pipeline like Shape or Graphics game object.
    • Line-progress canvas can fill gradient color, line progress shape only can fill 1 color.
    "},{"location":"canvas-roundrectangle/","title":"Round rectangle","text":""},{"location":"canvas-roundrectangle/#introduction","title":"Introduction","text":"

    Round rectangle on canvas.

    • Author: Rex
    • Game object
    "},{"location":"canvas-roundrectangle/#live-demos","title":"Live demos","text":"
    • Round rectangle
    "},{"location":"canvas-roundrectangle/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas-roundrectangle/#install-plugin","title":"Install plugin","text":""},{"location":"canvas-roundrectangle/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexroundrectanglecanvasplugin', 'https://raw.githubusercontent.com/rexrainbow/    phaser3-rex-notes/master/dist/rexroundrectanglecanvasplugin.min.js', true);\n
    • Add shape object
      var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    "},{"location":"canvas-roundrectangle/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RoundRectanglePlugin from 'phaser3-rex-plugins/plugins/roundrectanglecanvas-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRoundRectangleCanvasPlugin',\nplugin: RoundRectangleCanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shape object
      var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    "},{"location":"canvas-roundrectangle/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RoundRectangleCanvas from 'phaser3-rex-plugins/plugins/roundrectanglecanvas.js';\n
    • Add shape object
      var rect = new RoundRectangleCanvas(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\nscene.add.existing(rect);\n
    "},{"location":"canvas-roundrectangle/#create-shape-object","title":"Create shape object","text":"
    var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    • width, height : Size of rectangle.
      • undefined : Set ot undefined to draw a circle.
    • radius : Radius of four corners.
      • 0, or undefined : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
        • Radius and iteration
          {\nradius: radius,\niteration: 0\n}\n
          or
          {\nradius: {x: radiusX, y: radiusY},\niteration: 0\n}\n
          or
          {\nradius: {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n},\niteration: 0\n}\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
          • iteration : Number of interpolation points in each round corner. Default value is 4.
            • 0 : Draw a straight line instead of arc.
    • fillStyle : Fill color in number or css string value, or a callback
      • Number, or css string value : Color value
      • Callback :
        function(canvas, context) {\n// Radial gradient\nvar grd = context.createRadialGradient(x0, y0, r0, x1, y1, r1);\ngrd.addColorStop(0, color0);\ngrd.addColorStop(1, color1);\nreturn grd;\n}\n
    • strokeStyle : Stroke color in number or css string value.
    • lineWidth : Stroke line width.
    • fillColor2 : Gradient color in number or css string value.
    • isHorizontalGradient :
      • true : Horizontal gradient.
      • false : Vertical gradient.

    Note

    If radius >= 0, draw convex corner, else draw concave corner

    "},{"location":"canvas-roundrectangle/#deform","title":"Deform","text":"
    • Rectangle, set radius of 4 corners to 0.
      var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, 0, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    • Circle, set width and height to 2*radius.
      var rect = scene.add.rexRoundRectangleCanvas(x, y, (2*radius), (2*radius), radius, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    • Ellipse, set width and height to 2*radiusX, 2*radiusY.
      var rect = scene.add.rexRoundRectangleCanvas(x, y, (2*radiusX), (2*radiusX), {x: radiusX, y: radiusY}, fillColor, fillAlpha);\n
    • Rhombus, set width and height to 2*radius, and assign iteration to 0
      var rect = scene.add.rexRoundRectangleCanvas(x, y, (2*radius), (2*radius), {\nradius: radius,\niteration: 0\n}, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    • Octagon, assign iteration to 0
      var rect = scene.add.rexRoundRectangleCanvas(x, y, width, height, {\nradius: radius,\niteration: 0\n}, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    "},{"location":"canvas-roundrectangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRoundRectangleCanvas extends RexPlugins.GameObjects.RoundRectangleCanvas {\nconstructor(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient) {\nsuper(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rect = new MyRoundRectangleCanvas(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
    "},{"location":"canvas-roundrectangle/#color","title":"Color","text":"
    • Fill color
      • Get
        var fillStyle = rect.fillStyle;\nvar fillColor2 = rect.fillColor2;\nvar isHorizontalGradient = rect.isHorizontalGradient;\n
      • Set
        rect.setFillStyle(fillStyle);\n// rect.setFillStyle(fillStyle, fillColor2, isHorizontalGradient);\n
        • fillStyle : Fill color in number or css string value, or a callback
          • Number, or css string value : Color value
          • Callback :
            function(canvas, context) {\n// Radial gradient\nvar grd = context.createRadialGradient(x0, y0, r0, x1, y1, r1);\ngrd.addColorStop(0, color0);\ngrd.addColorStop(1, color1);\nreturn grd;\n}\n
      • Clear
        rect.setFillStyle();\n
    • Stroke color
      • Get
        var strokeStyle = rect.strokeStyle;\nvar lineWidth = rect.lineWidth;\n
      • Set
        rect.setStrokeStyle(strokeStyle, lineWidth);\n
      • Clear
        rect.setStrokeStyle();\n
    "},{"location":"canvas-roundrectangle/#size","title":"Size","text":"
    • Get
      var width = rect.width;\nvar height = rect.height;\n
    • Set
      rect.setSize(width, height);\n
      or
      rect.width = width;\nrect.height = height;\n
    "},{"location":"canvas-roundrectangle/#radius","title":"Radius","text":"
    • Set
      rect.setRadius(value);\n
      or
      rect.radius = radius;\n
      • radius :
        • Number : 4 corners with the same radius.
          • 0 : No round corner
          • > 0 : Convex round corner
          • < 0 : Concave round corner
        • JSON
          • 4 corners with the same radius X/Y
            {\nx: radiusX,\ny: radiusY\n}\n
          • Eeach radius of corner
            {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
            or
            {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
    "},{"location":"canvas-roundrectangle/#iteration","title":"Iteration","text":"
    • Get
      var iteration = rect.iteration;\n
    • Set
      rect.setIteration(value);\n
      or
      rect.iteration = value;\n

    Number of interpolation points in each round corner. Default value is 4.

    • 0 : Draw a straight line instead of arc.
    "},{"location":"canvas-roundrectangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"canvas-roundrectangle/#create-mask","title":"Create mask","text":"
    var mask = rect.createBitmapMask();\n

    See mask

    "},{"location":"canvas-roundrectangle/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"canvas-roundrectangle/#compare-with-shape-roundrectangle","title":"Compare with Shape-Roundrectangle","text":"
    • Gradient
      • Canvas-RoundRectangle can fill with gradient color.
      • Shape-Roundrectangle can't fill gradient color.
    • Drawing method
      • Canvas-RoundRectangle draw shape on canvas, then map this canvas to frame buffer.
      • Shape-Roundrectangle draw shape on frame buffer directly without drawing to canvas first.
    "},{"location":"canvas-texture/","title":"Canvas texture","text":""},{"location":"canvas-texture/#introduction","title":"Introduction","text":"

    Canvas Canvas Texture stored in texture cache, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"canvas-texture/#usage","title":"Usage","text":""},{"location":"canvas-texture/#create-canvas-texture","title":"Create canvas texture","text":"
    var texture = scene.textures.createCanvas(key, width, height);\n
    "},{"location":"canvas-texture/#get-canvas-element","title":"Get canvas element","text":"
    var canvas = texture.getCanvas();\nvar context = texture.getContext();\n

    Canvas api

    "},{"location":"canvas-texture/#draw-frame","title":"Draw frame","text":"
    texture.drawFrame(key, frame, x, y);\n// texture.drawFrame(key, frame, x, y, update);\n
    • update : Update the internal ImageData buffer and arrays. Default value is true.
    "},{"location":"canvas-texture/#draw-image","title":"Draw image","text":"
    texture.draw(x, y, source);\n// texture.draw(x, y, source, update);\n
    • source : The HTML Image element, or HTML Canvas element to draw to this canvas.
    • update : Update the internal ImageData buffer and arrays. Default value is true.
    "},{"location":"canvas-texture/#clear","title":"Clear","text":"
    texture.clear();\n
    texture.clear(x, y, width, height);\n// // texture.clear(x, y, width, height, update);\n
    • update : Update the internal ImageData buffer and arrays. Default value is true.
    "},{"location":"canvas-texture/#refresh-texture","title":"Refresh texture","text":"
    texture.refresh();\n
    "},{"location":"canvas-texture/#color","title":"Color","text":"
    • Set
      texture.setPixel(x, y, red, green, blue);\n// texture.setPixel(x, y, red, green, blue, alpha);\n
    • Get
      var color = texture.getPixel(x, y);\n// var color = texture.getPixel(x, y, color);\n
      var colors = texture.getPixels(x, y, width, height);\n
      • colors : [{x, y, color, alpha}, ...]
    "},{"location":"canvas-texture/#image-data","title":"Image data","text":"
    • Set
      texture.putData(imageData, x, y);\n
    • Get
      var imageData = texture.getData(x, y, width, height);\n
    "},{"location":"canvas-texture/#add-frame","title":"Add frame","text":"
    texture.add(name, sourceIndex, x, y, width, height);\n
    • name : The name of this Frame. The name is unique within the Texture.
    • sourceIndex : The index of the TextureSource that this Frame is a part of.
    • x : The x coordinate of the top-left of this Frame.
    • y : The y coordinate of the top-left of this Frame.
    • width : The width of this Frame.
    • height : The height of this Frame.
    "},{"location":"canvas/","title":"Canvas","text":""},{"location":"canvas/#introduction","title":"Introduction","text":"

    Drawing on canvas.

    • Author: Rex
    • Game object
    "},{"location":"canvas/#live-demos","title":"Live demos","text":"
    • Kaleidoscope
    • chartjs
    • Resolution
    "},{"location":"canvas/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvas/#install-plugin","title":"Install plugin","text":""},{"location":"canvas/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcanvasplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcanvasplugin.min.js', true);\n
    • Add canvas object
      var canvas = scene.add.rexCanvas(x, y, width, height);\n
    "},{"location":"canvas/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CanvasPlugin from 'phaser3-rex-plugins/plugins/canvas-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCanvasPlugin',\nplugin: CanvasPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add canvas object
      var canvas = scene.add.rexCanvas(x, y, width, height);\n
    "},{"location":"canvas/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Canvas from 'phaser3-rex-plugins/plugins/canvas.js';\n
    • Add canvas object
      var canvas = new Canvas(scene, x, y, width, height);\nscene.add.existing(canvas);\n
    "},{"location":"canvas/#create-instance","title":"Create instance","text":"
    var canvas = scene.add.rexCanvas(x, y, width, height);\n// var canvas = scene.add.rexCanvas(x, y, width, height, resolution);\n

    Add canvas from JSON

    var canvas = scene.make.rexCanvas({\nx: 0,\ny: 0,\nwidth: 256,\nheight: 256,\n// resolution: 1,\n\n// origin: {x: 0.5, y: 0.5},\n// fill: null,\n\nadd: true\n});\n
    • resolution : The resolution the content is rendered to its internal canvas at. Default value is 1.
    "},{"location":"canvas/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCanvas extends Canvas {\nconstructor(scene, x, y, width, height, resolution) {\nsuper(scene, x, y, width, height, resolution);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var canvas = new MyCanvas(scene, x, y, width, height, resolution);\n
    "},{"location":"canvas/#clear-or-fill-canvas","title":"Clear or fill canvas","text":"
    • Clear
      canvas.clear();\n
    • Fill color
      canvas.fill(color);\n
    "},{"location":"canvas/#update-canvas","title":"Update canvas","text":"
    1. Get canvas elemet
      var canvasElem = canvas.getCanvas();\nvar context = canvas.getContext();\n
      or
      var canvaesElem = canvas.canvas;\nvar context = canvas.context;\n
    2. Draw on context
    "},{"location":"canvas/#update-display-texture","title":"Update display texture","text":"
    • Update texture when rendering
      canvas.needRedraw();\n
      or
      canvas.dirty = true;\n
    • Update texture now
      canvas.updateTexture();\n
      or update canvas and texture
      canvas.updateTexture(function(canvasElem, context) { });\n// canvas.updateTexture(callback, scope);\n
    "},{"location":"canvas/#load-or-save-texture","title":"Load or save texture","text":"
    • Save canvas to texuture
      canvas.generateTexture(key);\n// canvas.generateTexture(key, x, y, width, height);\n
    • Copy canvas from texture
      canvas.loadTexture(key, frame);\n
    "},{"location":"canvas/#paste-frame","title":"Paste frame","text":"
    canvas.drawFrame(key, frame);\n// canvas.drawFrame(key, frame, dx, dy, dWidth, dHeight);\n// canvas.drawFrame(key, frame, dx, dy, dWidth, dHeight, sxOffset, syOffset, sWidth, sHeight);\n
    • dx, dy : Top-left position in this canvas. Default value is 0, 0.
    • dWidth, dHeight : The size to draw the image in this canvas. Default value is origin size of frame.
    • sxOffset, syOffset : Offset position of source frame. Default value is 0, 0
    • sWidth, sHeight : The size of the sub-rectangle of the source frame to draw into this canvas. Default value is origin size of frame.
    "},{"location":"canvas/#data-url","title":"Data URL","text":"
    • Load image from URL
      canvas.loadFromURL(url);\n// canvas.loadFromURL(url, callback);\n
      or
      canvas.loadFromURLPromise(url)\n.then(function() {\n\n})\n
      • url : Image url/uri(base64 string)
      • callback : Load complete callback.
    • Get data URL of image
      var dataURL = canvas.getDataURL();\n// var dataURL = canvas.getDataURL(type, encoderOptions);\n
      • dataURL : A base64 string.
      • type : A DOMString indicating the image format. The default format type is image/png.
      • encoderOptions : A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp.
    "},{"location":"canvas/#file","title":"File","text":"
    • Load image from File object
      canvas.loadFromFile(file);\n// canvas.loadFromFile(file, callback);\n
      or
      canvas.loadFromFilePromise(file)\n.then(function() {\n\n})\n
      • file : File object
      • callback : Load complete callback.
    "},{"location":"canvas/#pixel-color","title":"Pixel color","text":"
    • Get color
      var color = canvas.getPixel(x, y);\n
      • color : Color object
        • color.red, color.green, color.blue, color.alpha
    • Set color
      canvas.setPixel(x, y, r, g, b);\n// canvas.setPixel(x, y, r, g, b, a);\n
      or
      canvas.setPixel(x, y, color);\n
      • r, g, b, a : Integer number between 0 ~ 255.
      • color : Color object
    "},{"location":"canvas/#size","title":"Size","text":"
    canvas.setCanvasSize(width, height);\n

    or

    canvas.setSize(width, height);\n

    or

    canvas.resize(width, height);\n
    "},{"location":"canvas/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"canvas/#create-mask","title":"Create mask","text":"
    var mask = canvas.createBitmapMask();\n

    See mask

    "},{"location":"canvas/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"canvas/#compare-with-graphics-object","title":"Compare with Graphics object","text":"
    • Drawing method
      • This canvas object draws stuff on canvas in WEBGL or CANVAS render mode.
      • Graphics object draws stuff on webgl render pipeline in WEBGL render mode.
    • Size
      • This canvas object has size (width, height) and origin.
      • Graphics object does not have size and origin.
    "},{"location":"canvasinput/","title":"Canvas input","text":""},{"location":"canvasinput/#introduction","title":"Introduction","text":"

    An invisible Input DOM element to receive character input and display on DynamicText.

    Inspirited from CanvasInput.

    • Author: Rex
    • Game object
    "},{"location":"canvasinput/#live-demos","title":"Live demos","text":"
    • Simple
    • Text input
    • Number input
    • With rexui-Label
    • Text area
    "},{"location":"canvasinput/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"canvasinput/#install-plugin","title":"Install plugin","text":""},{"location":"canvasinput/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcanvasinputplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcanvasinputplugin.min.js', true);\n
    • Add canvas-input object
      var txt = scene.add.rexCanvasInput(x, y, width, height, config);\n
    "},{"location":"canvasinput/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CanvasInputPlugin from 'phaser3-rex-plugins/plugins/canvasinput-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCanvasInputPlugin',\nplugin: CanvasInputPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add canvas-input object
      var txt = scene.add.rexCanvasInput(x, y, width, height, config);\n
    "},{"location":"canvasinput/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CanvasInput from 'phaser3-rex-plugins/plugins/canvasinput.js';\n
    • Add canvas-input object
      var txt = new CanvasInput(textGameObject, x, y, width, height, config);\nscene.add.existing(txt);\n
    "},{"location":"canvasinput/#create-instance","title":"Create instance","text":"
    var txt = scene.add.rexCanvasInput({\n// Parameters of DynamicText\nx: 0, y: 0,\nwidth: undefined, height: undefined,\nresolution: 1,\n\n// padding: 0,  // {left: 0, right: 0, top: 0, bottom: 0}\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n\n// Style when focus\n// 'focus.color': ...\n// 'focus.color2': ...\n// 'focus.stroke': ...\n},\nfocusStyle: undefined,\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0,\n\n// Style when cursor move on\n// 'cursor.color': ...\n// 'cursor.backgroundColor': ...\n// 'cursor.xxx': ...\n\n// Style when range selecting\n// 'range.color': ...\n// 'range.backgroundColor': ...\n// 'range.xxx': ...\n// Using cursor style if no range style is given\n},\ncursorStyle: undefined,\n\nchildrenInteractive: false,\n\ntext: '',\n\nwrap: {\nlineHeight: undefined,\nuseDefaultLineHeight: true,\nmaxLines: 1,\nwrapWidth: undefined,\nletterSpacing: 0,\nwrapMode: 'char',  // 1|'word'|2|'char'|'character'|3|'mix', for single line text input\nhAlign: 0, // 0|'left'|1|'center'|2|'right'|3|'justify'|'justify-left'|4|'justify-center'|5| justify-right'\nvAlign: 'center',  // For single line text input        \n},\n\ntextArea: false,\n\n// Parameters of hidden-text-editor   \n// inputType: 'text',  // 'text'|'password'|'textarea'|...                \n\n// readOnly: false,\n// maxLength: undefined,\n// minLength: undefined,\n// selectAll: false,\n\n// enterClose: true,\n\n// Callbacks\n// onOpen: function (textObject, hiddenInputText) {\n// },\n\n// onClose: function (textObject, hiddenInputText) {\n// },\n\n// onUpdate: function (text, textObject, hiddenInputText) {\n//     return text;\n// },   \n\n// onAddChar: function(child, index, canvasInput) {\n//    child.modifyStyle({...})\n// },\n\n// onCursorOut: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// onCursorIn: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// onRangeOut: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// onRangeIn: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// Use 'onCursorIn' and 'onCursorOut' if 'onRangeOut' and 'onRangeIn' are not given\n\n// parseTextCallback: function(text) {\n//     return text;\n// }.\n\n});\n
    • textArea :
      • false : Single line text input. Default behavior.
      • true : Multiple lines text input.
    • Parameters of DynamicText...
      • wrap : Some default value in wrap are changed
        • wrap.useDefaultLineHeight : Default value is true
        • wrap.maxLines : Default value is 1
        • wrap.vAlign : Default value is 'center'
    • Parameters of hidden-text-editor
      • inputType : Type of element
        • 'text', 'password', 'textarea', ...
      • enterClose : Set true to close input text when enter-key was pressed. Default value is true.
      • readOnly :
        • true : un-editable.
        • false : Editable. Defaule behavior.
      • maxLength, minLength : Maximun or minimun of input characters
      • selectAll : Set to true to select all characters when focusing.
    • Callbacks
      • onOpen : Callback invoked when focus on this hidden input text.
        function (textObject) {\n// textObject.setInputText(txt);\n}\n
      • onClose : Callback invoked when blur.
        function (textObject) {            }\n
      • onUpdate :
        • A callback invoked in each tick of editing.
          function (text, textObject) {\n// return text;\n}\n
          • Can return a new string for text game object displaying.
        • 'number' : Only output number string.
      • onAddChar : Callback invoked when adding new character child
        function(child, index, canvasInput) {\nchild.modifyStyle({...})\n}\n
        • child : character child
      • onCursorOut : Callback invoked when cursor move out of a character child
        function(child, index, canvasInput) {\nchild.modifyStyle({...})\n}\n
        • child : character child
      • onCursorIn : Callback invoked when cursor move on a character child
        function(child, index, canvasInput) {\nchild.modifyStyle({...})\n}\n
        • child : character child
      • onRangeOut : Callback invoked when leaving range-selecting on a character child
        function(child, index, canvasInput) {\nchild.modifyStyle({...})\n}\n
        • child : character child
        • Use onCursorOut callback if onRangeOut and onRangeIn callbacks are not given, for backward compatible.
      • onRangeIn : Callback invoked when entering range-selecting on a character child
        function(child, index, canvasInput) {\nchild.modifyStyle({...})\n}\n
        • child : character child
        • Use onCursorIn callback if onRangeOut and onRangeIn callbacks are not given, for backward compatible.
      • parseTextCallback : Callback of parsing text (txt.text) to value (txt.value)
        • undefined : Bypass text to value. Default behavior.
        • A function object
          function(text) {\nreturn text;\n}\n
    • focusStyle : Will apply this style to background when focusing.
      • undefined : Ignore this behavior.
      • A plain object
        {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n}\n
      • Or add these style settings in background parameter, with prefix 'focus.'.
    • cursorStyle : Will apply this style when cursor move on a character child.
      • undefined : Ignore this behavior.
      • A plain object
        {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: 0,\nbackgroundLeftX: 0,\nbackgroundRightX: 0,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0\n}\n
      • Or add these style settings in style parameter, with prefix 'cursor.'.
    • rangeStyle : Will apply this style when entering range-selecting on character children.
      • undefined : Ignore this behavior.
      • A plain object
        {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: 0,\nbackgroundLeftX: 0,\nbackgroundRightX: 0,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0\n}\n
      • Or add these style settings in style parameter, with prefix 'range.'.
      • Using cursorStyle if no rangeStyle found in config, for backward compatible.
    "},{"location":"canvasinput/#number-input","title":"Number input","text":"
    txt.setNumberInput();\n
    "},{"location":"canvasinput/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCanvasInput extends CanvasInput {\nconstructor(textGameObject, x, y, width, height, config)) {\nsuper(textGameObject, x, y, width, height, config)) {\n// ...            \n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyCanvasInput(textGameObject, config);\n
    "},{"location":"canvasinput/#open-editor","title":"Open editor","text":"
    txt.open();\n

    or

    txt.open(onCloseCallback);\n
    • onCloseCallback : Callback invoked when closing text-editor
    "},{"location":"canvasinput/#close-editor","title":"Close editor","text":"
    txt.close();\n
    "},{"location":"canvasinput/#is-opened","title":"Is opened","text":"
    var isOpened = txt.isOpened;\n
    "},{"location":"canvasinput/#text","title":"Text","text":"
    • Display text on dynamic text game object
      • Get
        var text = txt.text;\n
        or
        var text = txt.displayText;\n
      • Set
        txt.setText(text);\n
        or
        txt.setDisplayText(text);\n
    • Input text on hidden text edit behavior
      • Get
        var text = txt.inputText;\n
      • Set
        var text = txt.setInputText(text);\n
    "},{"location":"canvasinput/#value","title":"Value","text":"
    • Get. Parse text to value.
      var value = txt.getValue();\n// var value = txt.value;\n
      • Set parseTextCallback
        txt.setParseTextCallback(callback);\n
        • callback :
          • undefined : Bypass text to value. Default behavior.
          • A function object
            function(text) {\nreturn text;\n}\n
    • Set. Conver any type of value to string.
      txt.setValue(value);\n// txt.value = value;\n
    "},{"location":"canvasinput/#read-only","title":"Read only","text":"
    • Enable read only
      txt.setReadOnly();\n// txt.setReadOnly(true);\n
      or
      txt.readOnly = true;\n
    • Disable read only
      txt.setReadOnly(false);\n
      or
      txt.readOnly = false;\n
    • Get read only
      var readOnlyEanble = txt.readOnly;\n
    "},{"location":"canvasinput/#size","title":"Size","text":"
    • Resize canvas size
      txt.setCanvasSize(width, height)\n
    • Reisze text wrapping size and canvas size.
      txt.setSize(width, height);\n
      or
      txt.setFixedSize(width, height);\n
    • Resize to minimun size to show all visible characters.
      txt.setToMinSize();\n
    "},{"location":"canvasinput/#events","title":"Events","text":"
    • On text change
      txt.on('textchange', function(text, txt){\n})\n
    • On character child adding
      txt.on('addchar', function(child, index, canvasInput) {\nchild.modifyStyle({...})\n})\n
      • child : character child
    • On cursor moving out of a character child
      txt.on('cursorout', function(child, index, canvasInput) {\nchild.modifyStyle({...})\n})\n
      • child : character child
    • On cursor moving on a character child
      txt.on('cursorin', function(child, index, canvasInput) {\nchild.modifyStyle({...})\n})\n
      • child : character child
    • On open text-editor
      txt.on('open', function() {\n\n})\n
    • On close text-editor
      txt.on('close', function() {\n\n})\n
    • Close editor by ENTER key down
      txt.on('keydown-ENTER', function(){\n})\n
    • Not a number input
      txt.on('nan', function(text){\n\n})\n
    "},{"location":"canvasinput/#select-text","title":"Select text","text":"

    This feature does not support.

    "},{"location":"canvasinput/#bypass-key-input","title":"Bypass key input","text":"

    Registered keyboard events might capture key input.

    var keyObj = scene.input.keyboard.addKey('W', enableCapture, emitOnRepeat);\n

    Set enableCapture to false to bypass key input to this input-text game objecct.

    "},{"location":"canvasinput/#other-properties","title":"Other properties","text":"

    See Dynamic text game object game object

    "},{"location":"canvasinput/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"canvasinput/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"capitalizes-first/","title":"Capitalizes first","text":""},{"location":"capitalizes-first/#introduction","title":"Introduction","text":"

    Capitalizes the first letter of a string, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"capitalizes-first/#usage","title":"Usage","text":"
    var result = Phaser.Utils.String.UppercaseFirst(str);\n
    "},{"location":"charactercache/","title":"Character cache","text":""},{"location":"charactercache/#introduction","title":"Introduction","text":"

    Generate bitmapfont from text game object, or bbcode text game object.

    • Author: Rex
    • Member of scene
    "},{"location":"charactercache/#live-demos","title":"Live demos","text":"
    • Set text
    • Textbox
    "},{"location":"charactercache/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"charactercache/#install-plugin","title":"Install plugin","text":""},{"location":"charactercache/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcharactercacheplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcharactercacheplugin.min.js', true);\n
    • Add character-cache object
      var characterCache = scene.plugins.get('rexcharactercacheplugin').add(config);\n
    "},{"location":"charactercache/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CharacterCachePlugin from 'phaser3-rex-plugins/plugins/charactercache-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCharacterCache',\nplugin: CharacterCachePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add character-cache object
      var characterCache = scene.plugins.get('rexCharacterCache').add(config);\n
    "},{"location":"charactercache/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CharacterCache from 'phaser3-rex-plugins/plugins/charactercache.js';\n
    • Add character-cache object
      var characterCache = new CharacterCache(game, config);\n
      or
      var characterCache = new CharacterCache(scene, config);\n
    "},{"location":"charactercache/#create-instance","title":"Create instance","text":"
    var characterCache = scene.plugins.get('rexCharacterCache').add({\nkey: '',  cellWidth: 32,\ncellHeight: 32,\nmaxCharacterCount: 4096,\nfreqMode: true,\n\nstyle: textStyle,\n// textObject: textGameOject,\n\n\ncontent: '',\n});\n
    • key : Texture key in texture manager
    • cellWidth, cellHeight : Maximum frame size.
    • maxCharacterCount : Maximun character count.
      • Width of texture = Math.ceil(Math.sqrt(maxCharacterCount)) * cellWidth
      • Height of texture = Math.ceil(Math.sqrt(maxCharacterCount)) * cellHeight
    • freqMode :
      • true : Swap out un-unsed and low-frequence character.
      • false : Swap out any un-unsed character.
    • style : Style of Text game object. Create a text game object by this style setting on systemScene if textObject parameter is not given.
    • textObject : Text game object, or bbcode text game object for drawing character.
    • content : Load these characters into cache.
    "},{"location":"charactercache/#create-bitmaptext","title":"Create BitmapText","text":"

    Create BitmapText/Dynamci BitmapText game object using this character cache, add this game object into scene's display list

    • BitmapText
      var txt = characterCache.addBitmapText(scene);    // var txt = characterCache.addBitmapText(scene, x, y, text, size, align);\n
    • Dynamci BitmapText
      var txt = characterCache.addDynamicBitmapText(scene);    // var txt = characterCache.addDynamicBitmapText(scene, x, y, text, size, align);\n
    "},{"location":"charactercache/#load-characters","title":"Load characters","text":"

    Load characters into bitmap font, replace unused characters if no free character space.

    characterCache.load(content);\n// characterCache.load(content, lock);\n
    • content : Characters in a string.
    • lock
      • true : Lock these characters, won't be replaced out later.
      • false : Don't lock these characters, can be replaced out later. Default behavior.

    Warning

    Console.warn messages if no unused character is found.

    "},{"location":"charactercache/#events","title":"Events","text":"
    • Add a character
      characterCache.on('add', function(character, textObject) {\n// Can change style of textObject here\n})\n
    • Swap out a character
      characterCache.on('remove', function(character, textObject) {\n})\n
    "},{"location":"charactercache/#override-bitmaptext","title":"Override bitmaptext","text":"

    Inject characterCache.load(text) into bitmapText.setText(text) method.

    characterCache.overrideBitmapText(bitmapText);\n// var bitmapText = characterCache.overrideBitmapText(bitmapText);\n

    Now setText method has lock parameter : bitmapText.setText(text, lock).

    Or user can override bitmapText.setText by extending Phaser.GameObjects.BitmapText class.

    "},{"location":"charactercache/#unlock-all-characters","title":"Unlock all characters","text":"
    characterCache.unlock();\n
    "},{"location":"charactercache/#get-all-cache-data","title":"Get all cache data","text":"
    var cacheData = characterCache.getAllData();\n
    • cacheData : Array of cache data
      {\ncharacter: string,\nfreq: number,\nalive: boolean,\nlock: boolean,\n}\n
    "},{"location":"charactercache/#destroy-instance","title":"Destroy instance","text":"
    characterCache.destroy();\n
    "},{"location":"charactercache/#properties","title":"Properties","text":"
    • characterCache.key : Font key.
    • characterCache.cellWidth, characterCache.cellHeight : Cell size.
    • characterCache.inCacheCount : Amount of characters in cache.
    "},{"location":"circlemaskimage/","title":"Circle mask image","text":""},{"location":"circlemaskimage/#introduction","title":"Introduction","text":"

    Load a texture, then apply a circle mask. Extended from canvas plugin.

    • Author: Rex
    • Game object
    "},{"location":"circlemaskimage/#live-demos","title":"Live demos","text":"
    • Circle-mask-image
    "},{"location":"circlemaskimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"circlemaskimage/#install-plugin","title":"Install plugin","text":""},{"location":"circlemaskimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcirclemaskimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcirclemaskimageplugin.min.js', true);\n
    • Add circle-mask-image object
      var image = scene.add.rexCircleMaskImage(x, y, key, frame, config);\n
    "},{"location":"circlemaskimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CircleMaskImagePlugin from 'phaser3-rex-plugins/plugins/circlemaskimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircleMaskImagePlugin',\nplugin: CircleMaskImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add circle-mask-image object
      var image = scene.add.rexCircleMaskImage(x, y, key, frame, config);\n
    "},{"location":"circlemaskimage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CircleMaskImage from 'phaser3-rex-plugins/plugins/circlemaskimage.js';\n
    • Add circle-mask-image object
      var image = new CircleMaskImage(scene, x, y, key, frame, config);\nscene.add.existing(image);\n
    "},{"location":"circlemaskimage/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircleMaskImagePlugin',\nplugin: CircleMaskImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"circlemaskimage/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexCircleMaskImage(x, y, key, frame, {\nmaskType: 0,\n// radius: undefined,\n\n// backgroundColor: undefined,\n\n// strokeColor: undefined,\n// strokeWidth: 0,\n});\n

    or

    var image = scene.add.rexCircleMaskImage(x, y, key, {\nmaskType: 0,\n// radius: undefined,\n\n// backgroundColor: undefined,\n\n// strokeColor: undefined,\n// strokeWidth: 0,\n});\n
    • maskType : Type of mask.
      • null : No mask.
      • 'circle', or 0 : Circle mask.
      • 'ellipse', or 1 : Ellipse mask.
      • 'roundRectangle', or 2 : Round rectangle mask.
    • radius : Radius of round rectangle mask.
      • 0 : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
    • backgroundColor : Fill background with color.
      • undefined, or null : No background filling. Default behavior.
    • strokeColor : Add stroke around masked image.
      • undefined, or null : No stroke line. Default behavior.
    • strokeWidth : Stroke line width.

    Add image from JSON

    var image = scene.make.rexCircleMaskImage({\nx: 0,\ny: 0,\nkey: key,\nframe: name,\nmaskType: 0,\n// radius: undefined\n// origin: {x: 0.5, y: 0.5},\n\n// backgroundColor: undefined,\n\n// strokeColor: undefined,\n// strokeWidth: 0,\n\nadd: true\n});\n
    "},{"location":"circlemaskimage/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImage extends CircleMaskImage {\nconstructor(scene, x, y, key, frame, config) {\nsuper(scene, x, y, key, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImage(scene, key, frame, config);\n
    "},{"location":"circlemaskimage/#set-texture","title":"Set texture","text":"
    image.setTexture(key, frame);\n// image.setTexture(key, frame, maskType);\n

    or

    image.setTexture(key, frame, {\nmaskType: 0,\n// radius: undefined\n});\n
    • maskType : Type of mask
      • null : No mask.
      • 0, or 'circle' : Circle mask. Default value.
      • 1, or 'ellipse' : Ellipse mask.
    • radius : Radius of round rectangle mask.
      • 0 : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
    "},{"location":"circlemaskimage/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"circlemaskimage/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"circlemaskimage/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"clamp/","title":"Clamp","text":""},{"location":"clamp/#introduction","title":"Introduction","text":"

    Force a value within the boundaries by clamping it to the range min, max, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"clamp/#usage","title":"Usage","text":"
    var result = Phaser.Math.Clamp(value, min, max);\n
    • value : The value to be clamped.
    "},{"location":"clickoutside/","title":"Click outside","text":""},{"location":"clickoutside/#introduction","title":"Introduction","text":"

    Fires 'clickoutside' event when pointer-down or pointer-up outside of game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"clickoutside/#live-demos","title":"Live demos","text":"
    • Click outside
    "},{"location":"clickoutside/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"clickoutside/#install-plugin","title":"Install plugin","text":""},{"location":"clickoutside/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexclickoutsideplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexclickoutsideplugin.min.js', true);\n
    • Add click-outside behavior
      var clickOutside = scene.plugins.get('rexclickoutsideplugin').add(gameObject, config);\n
    "},{"location":"clickoutside/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ClickOutsidePlugin from 'phaser3-rex-plugins/plugins/clickoutside-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexClickOutsiden',\nplugin: ClickOutsidePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add click-outside behavior
      var clickOutside = scene.plugins.get('rexClickOutsiden').add(gameObject, config);\n
    "},{"location":"clickoutside/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ClickOutside from 'phaser3-rex-plugins/plugins/clickoutside.js';\n
    • Add clickoutside behavior
      var clickOutside = new ClickOutside(gameObject, config);\n
    "},{"location":"clickoutside/#create-instance","title":"Create instance","text":"
    var clickOutside = scene.plugins.get('rexClickOutside').add(gameObject, {\n// enable: true,\n// mode: 1,              // 0|'press'|1|'release'\n// clickInterval: 100,   // ms\n// threshold: undefined\n});\n
    • enable : Clickable.
    • mode :
      • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
      • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
    • clickInterval : Interval between 2 'click' events, in ms.
    • threshold : Cancel clicking detecting when dragging distance is larger then this threshold.
      • undefined : Ignore this feature. Default behavior.
    "},{"location":"clickoutside/#events","title":"Events","text":"
    • Click-outside
      clickOutside.on('clickoutside', function (clickoutside, gameObject, pointer) {\n// ...\n}, scope);\n
    • Enable
      clickOutside.on('enable', function (clickoutside, gameObject) {\n// ...\n}, scope);\n
    • Disable
      clickOutside.on('disable', function (clickoutside, gameObject) {\n// ...\n}, scope);\n
    "},{"location":"clickoutside/#enable","title":"Enable","text":"
    • Get
      var enabled = clickOutside.enable;  // enabled: true, or false\n
    • Set
      clickOutside.setEnable(enabled);  // enabled: true, or false\n// clickOutside.enable = enabled;\n
    • Toggle
      clickOutside.toggleEnable();\n
    "},{"location":"clickoutside/#set-mode","title":"Set mode","text":"
    clickOutside.setMode(mode);\n
    • mode :
      • 'press', or 0 : Fire 'click' event when touch pressed.
      • 'release', or 1 : Fire 'click' event when touch released after pressed.
    "},{"location":"clickoutside/#set-click-interval","title":"Set click interval","text":"
    clickOutside.setClickInterval(interval);  // interval in ms\n
    "},{"location":"clickoutside/#set-dragging-threshold","title":"Set dragging threshold","text":"
    clickOutside.setDragThreshold(distance);  // distance in pixels\n
    "},{"location":"clock/","title":"Clock","text":""},{"location":"clock/#introduction","title":"Introduction","text":"

    A clock to count elapsed time.

    • Author: Rex
    • Member of scene
    "},{"location":"clock/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"clock/#install-plugin","title":"Install plugin","text":""},{"location":"clock/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexclockplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexclockplugin.min.js', true);\n
    • Add clock object
      var clock = scene.plugins.get('rexclockplugin').add(scene, config);\n
    "},{"location":"clock/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ClockPlugin from 'phaser3-rex-plugins/plugins/clock-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexClock',\nplugin: ClockPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add clock object
      var clock = scene.plugins.get('rexClock').add(scene, config);\n
    "},{"location":"clock/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Clock from 'phaser3-rex-plugins/plugins/clock.js';\n
    • Add clock object
      var clock = new Clock(scene, config);\n
    "},{"location":"clock/#create-instance","title":"Create instance","text":"
    var clock = scene.plugins.get('rexClock').add(scene, {\n// timeScale: 1\n});\n
    • timeScale : time-scale for counting elapsed time.
    "},{"location":"clock/#start-counting","title":"Start counting","text":"
    clock.start();\n// clock.start(startAt);  // start-at time in ms\n
    "},{"location":"clock/#force-ticking","title":"Force ticking","text":"
    clock.tick(0);\n// clock.tick(delta);\n
    "},{"location":"clock/#get-elapsed-time","title":"Get elapsed time","text":"
    var now = clock.now;  // Elapsed time in ms\n
    "},{"location":"clock/#pause-resume-stop-counting","title":"Pause, Resume, stop counting","text":"
    clock.pause();\nclock.resume();\nclock.stop();\n
    "},{"location":"clock/#seek-elapsed-time","title":"Seek elapsed time","text":"
    clock.seek(time);   // elapsed time in ms\n
    "},{"location":"clock/#state-of-counting","title":"State of counting","text":"
    var isRunning = clock.isRunning;\n
    "},{"location":"clock/#time-scale","title":"Time-scale","text":"
    • Get
      var timeScale = clock.timeScale;\n
    • Set
      clock.setTimeScale(timeScale);\n// clock.timeScale = timeScale;\n
    "},{"location":"clock/#events","title":"Events","text":"
    • On ticking
      clock.on('update', function(now, delta){ })\n
      • now : Elapsed time in ms.
      • delta : Delta time in ms.
    "},{"location":"color/","title":"Color","text":""},{"location":"color/#introduction","title":"Introduction","text":"

    Get color value, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"color/#usage","title":"Usage","text":""},{"location":"color/#get-color-integer","title":"Get color integer","text":"
    • Hex string, or color integer
      var color = Phaser.Display.Color.ValueToColor(input);\n
      • input : Hex string, or color integer
    • RGB to color
      var color = Phaser.Display.Color.GetColor(red, green, blue);\n
      • red, green, blue : 0 ~ 255
    • RGBA to color
      var color = Phaser.Display.Color.GetColor32(red, green, blue, alpha);\n
      • red, green, blue, alpha : 0 ~ 255
    • Hex string to color
      var color = Phaser.Display.Color.HexStringToColor(hex).color;\n
      • hex : #0033ff, #03f, 0x0033ff, or 0x03f
    • RGB string to color
      var color = Phaser.Display.Color.RGBStringToColor(rgb);\n
      • rgb : 'rgb(r,g,b)', or 'rgba(r,g,b,a)'
        • r, g, b : 0 ~ 255
        • a : 0 ~ 1
    • HSV to color
      var color = Phaser.Display.Color.HSVToRGB(h, s, v).color;\n
      • h, s, v : 0 ~ 1
    "},{"location":"color/#color-integer-to-rgb","title":"Color integer to RGB","text":"
    var rgb = Phaser.Display.Color.IntegerToRGB(color);\n
    • color : Color integer (0xAARRGGBB)
    • rgb : JSON object ({r, g, b, a})
    "},{"location":"color/#hsv-color-wheel","title":"HSV color wheel","text":"
    1. Create color array
      var colorArray = Phaser.Display.Color.HSVColorWheel(s, v);\n
    2. Get color
      var color = colorArray[i].color;  // i : 0 ~ 359\n
    "},{"location":"color/#color-object","title":"Color object","text":""},{"location":"color/#create-color-object","title":"Create color object","text":"
    • Create via r,g,b,a components
      var color = new Phaser.Display.Color(red, green, blue); // alpha = 255\n// var color = new Phaser.Display.Color(red, green, blue, alpha);\n
      • red, green, blue, alpha: 0 ~ 255
    • Create via color integer
      var color = Phaser.Display.Color.IntegerToColor(colorInteger);\n
      • colorInteger : Color integer (0xAARRGGBB)
    "},{"location":"color/#set-color","title":"Set color","text":"
    • Set color
      color.setTo(red, green, blue);  // alpha = 255\n// color.setTo(red, green, blue, alpha);\n
      • red, green, blue, alpha: 0 ~ 255
    • Set color in GL values
      color.setGLTo(red, green, blue);  // alpha = 1\n// color.setTo(red, green, blue, alpha);\n
      • red, green, blue, alpha: 0 ~ 1
    • Set color from color object
      color.setFromRGB(rgba);\n
      • rgba :
        {\nr: 0,\ng: 0,\nb: 0,\n// a: 0\n}\n
    • Set color from HSV
      color.setFromHSV(h, s, v);\n
    • Set to transparent ()
      color.transparent();\n
      • Set (red, green, blue) to 0
    • Set to gray color
      color.gray(value);\n
    • Set to a random color
      color.random();\n
      or
      color.random(min, max);\n
      • min : 0 ~ 255. Default value is 0.
      • max : 0 ~ 255. Default value is 255.
    • Set to random gray
      color.randomGray();\n
      or
      color.randomGray(min, max);\n
    • Set red/green/blue/alpha channel : 0 ~ 255
      color.red = value;\n// color.red += value;\ncolor.green = value;\n// color.green += value;\ncolor.blue = value;\n// color.blue += value;\ncolor.alpha = value;\n// color.alpha += value;\n
    • Set H/S/V channel : 0 ~ 1
      color.h = value;\n// color.h += value;\ncolor.s = value;\n// color.s += value;\ncolor.v = value;\n// color.v += value;\n
    • Set normalized red, green, blue, alpha : 0 ~ 1
      color.redGL = value;\n// color.redGL += value;\ncolor.greenGL = value;\n// color.greenGL += value;\ncolor.blueGL = value;\n// color.blueGL += value;\ncolor.alphaGL = value;\n// color.alphaGL += value;\n
    • Set brighten
      color.brighten(value);\n
      • value : Percentage, 0 ~ 100
    • Saturate : Increase the saturation (S) of this Color by the percentage amount given.
      color.saturate(value);\n
      • value : Percentage, 0 ~ 100
    • Desaturate : Decrease the saturation (S) of this Color by the percentage amount given.
      color.desaturate(value);\n
      • value : Percentage, 0 ~ 100
    • Lighten : Increase the lightness (V) of this Color by the percentage amount given.
      color.lighten(value);\n
      • value : Percentage, 0 ~ 100
    • Darken : Decrease the lightness (V) of this Color by the percentage amount given.
      color.darken(value);\n
      • value : Percentage, 0 ~ 100
    "},{"location":"color/#properties","title":"Properties","text":"
    • RGB Color, not including the alpha channel
      var c = color.color;\n
    • RGB Color, including the alpha channel.
      var c = color.color32;\n
    • RGB color string which can be used in CSS color values.
      var c = color.rgba;\n
    • Red, green, blue, alpha : 0 ~ 255
      var r = color.red;\nvar g = color.green;\nvar b = color.blue;\nvar a = color.alpha;\n
    • H, S, V : 0 ~ 1
      var h = color.h;\nvar s = color.s;\nvar v = color.v;\n
    • Normalized red, green, blue, alpha : 0 ~ 1
      var r = color.redGL;\nvar g = color.greenGL;\nvar b = color.blueGL;\nvar a = color.alphaGL;\n
    "},{"location":"color/#clone","title":"Clone","text":"
    var newColor = color.clone();\n
    "},{"location":"color/#to-hex-string","title":"To hex string","text":"
    var hexString = Phaser.Display.Color.RGBToString(color.r, color.g, color.b, color.a);\n// var hexString = Phaser.Display.Color.RGBToString(color.r, color.g, color.b, color.a, prefix);\n
    "},{"location":"color/#interpolation","title":"Interpolation","text":"

    Interpolate between 2 colors.

    var colorOut = Phaser.Display.Color.Interpolate.RGBWithRGB(r1, g1, b1, r2, g2, b2, length, index);\nvar colorOut = Phaser.Display.Color.Interpolate.ColorWithColor(color1, color2, length, index);\nvar colorOut = Phaser.Display.Color.Interpolate.ColorWithRGB(color, r, g, b, length, index);\n
    • length, index : t = index/length (0~1)
    "},{"location":"conditionstable/","title":"CSV Conditions table","text":""},{"location":"conditionstable/#introduction","title":"Introduction","text":"

    Check conditions to find passed tests listed in a csv table.

    • Author: Rex
    • Member of scene
    "},{"location":"conditionstable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"conditionstable/#install-plugin","title":"Install plugin","text":""},{"location":"conditionstable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexconditionstableplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexconditionstableplugin.min.js', true);\n
    • Add conditions-table object
      var conditionstable = scene.plugins.get('rexconditionstableplugin').add();\n
    "},{"location":"conditionstable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ConditionsTablePlugin from 'phaser3-rex-plugins/plugins/conditionstable-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexConditionsTable',\nplugin: ConditionsTablePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add conditions-table object
      var conditionstable = scene.plugins.get('rexConditionsTable').add();\n
    "},{"location":"conditionstable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ConditionsTable from 'phaser3-rex-plugins/plugins/conditionstable.js';\n
    • Add conditions-table object
      var conditionstable = new ConditionsTable();\n
    "},{"location":"conditionstable/#create-instance","title":"Create instance","text":"
    var table = scene.plugins.get('rexConditionsTable').add();\n
    "},{"location":"conditionstable/#load-table-from-csv-string","title":"Load table from csv string","text":"
    table.loadCSV(csvString, {\n// delimiter: ','\n});\n

    For exameple, csv string

    name A A B Test1 >= 10 <= 20 Test2 3
    ,A,A,B\nTest1,>= 10,<= 20,\nTest2,,,3\n

    means that:

    Test1: (A>=10) && (A<=20)\nTest2: (B==3)\n

    Equations will be evaled by new Function.

    "},{"location":"conditionstable/#test","title":"Test","text":""},{"location":"conditionstable/#get-test-results","title":"Get test results","text":"
    var results = table.getTestResults(context);\n
    • context : Inputs in Key-value pairs
    • results : {name: boolean}, use OR operation to combine result of tests with the same name.
    "},{"location":"conditionstable/#get-first-pass-test-name","title":"Get first pass test name","text":"
    var testName = table.anyPassTest(context);\n
    • context : Inputs in Key-value pairs
    "},{"location":"config-data/","title":"Configuration data","text":""},{"location":"config-data/#introduction","title":"Introduction","text":"

    Get parameters from configuration object.

    • Author: Richard Davey
    "},{"location":"config-data/#usage","title":"Usage","text":""},{"location":"config-data/#quick-start","title":"Quick start","text":"
    const GetValue = Phaser.Utils.Objects.GetValue;\nvar myMethod = function(config) {\nvar x = GetValue(config, 'x', 0);\nvar y = GetValue(config, 'y', 0);\nvar width = GetValue(config, 'width', 0);\nvar height = GetValue(config, 'height', 0);\n// ...\n}\n
    "},{"location":"config-data/#get-value","title":"Get value","text":"
    • Retrieves a value from an object.
      var value = Phaser.Utils.Objects.GetValue(source, key, defaultValue);\n
      • source : Configuration object.
      • key : The name of the property to retrieve from the object. For example,
        • Property source.name, key = name
        • Property source.position.x, key = position.x
      • defaultValue : The value to return if the key isn't found in the source object.
    • Finds the key within the top level of the source object, or returns defaultValue.
      var value = Phaser.Utils.Objects.GetFastValue(source, key, defaultValue);\n
      • key : The key for the property on source. Must exist at the top level of the source object.
    • Retrieves a value from an object. Allows for more advanced selection options.
      var value = Phaser.Utils.Objects.GetAdvancedValue(source, key, defaultValue);\n
      • Implicit
        var source = {x: 4};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = 4\n
      • From function
        var source = {x: function(key){return 4;}};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = 4\n
        • Pass key to function's 1st parameter, and get return value as final result.
      • Randomly pick one element from the array
        var source = {x: [a, b, c]};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = random item from array [a, b, c]\n
      • Random integer between min and max
        var source = {x: randInt: [min, max]};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = random int min~max\n
      • Random float between min and max
        var source = {x: randFloat: [min, max]};\nvar value = Phaser.Utils.Objects.GetAdvancedValue(source, 'x'); // value = random float min~max\n
    "},{"location":"config-data/#is-plain-object","title":"Is plain object","text":"
    var isPlainObject = Phaser.Utils.Objects.IsPlainObject(object);\n

    Plain object:

    • var obj = {};
    • var obj = new Object();
    "},{"location":"config-data/#merge-configuration","title":"Merge configuration","text":"
    var configOut = Phaser.Utils.Objects.Merge(configIn, defaultConfig);\n
    "},{"location":"container/","title":"Container","text":""},{"location":"container/#introduction","title":"Introduction","text":"

    Control the position and angle of children game objects, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"container/#usage","title":"Usage","text":""},{"location":"container/#container","title":"Container","text":""},{"location":"container/#add-container-object","title":"Add container object","text":"
    var container = scene.add.container(x, y);\n// var container = scene.add.container(x, y, children); // children: an array of game object\n
    "},{"location":"container/#custom-class","title":"Custom class","text":"
    • Define class
      class MyContainer extends Phaser.GameObjects.Container {\nconstructor(scene, x, y, children) {\nsuper(scene, x, y, children);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var container = new MyContainer(scene, x, y, children);\n
    "},{"location":"container/#destroy","title":"Destroy","text":"
    container.destroy();\n

    Also destroy all children game objects.

    "},{"location":"container/#set-properties","title":"Set properties","text":"

    Reference game object, to set position, angle, visible, alpha, etc...

    "},{"location":"container/#set-size","title":"Set size","text":"
    container.setSize(width, height);\n

    Default size is 0x0.

    "},{"location":"container/#set-scroll-factor","title":"Set scroll factor","text":"
    container.setScrollFactor(x, y);\n

    Apply this scrollFactor to all Container children.

    container.setScrollFactor(x, y, true);\n
    "},{"location":"container/#hit-area","title":"Hit area","text":"
    container.setInteractive(new Phaser.Geom.Circle(0, 0, radius), Phaser.Geom.Circle.Contains);\n// container.setInteractive(false); // disable\n

    Assign hit area with a circle shape.

    "},{"location":"container/#non-exclusive","title":"Non-exclusive","text":"
    container.setExclusive(false);\n

    Allows a game object added to container many times.

    "},{"location":"container/#children","title":"Children","text":""},{"location":"container/#add-child","title":"Add child","text":"
    container.add(child);  // child: a game object or an array of game objects\n
    container.addAt(child, index);\n
    "},{"location":"container/#exist","title":"Exist","text":"
    var hasChild = container.exists(child);\n
    "},{"location":"container/#get-child","title":"Get child","text":"
    var firstChild = container.first;\nvar nextChild = container.next;\nvar prevChild = container.previous;\nvar lastChild = container.last;\n
    var child = container.getByName(name);\n
    var child = container.getRandom(startIndex, length);\n
    var child = container.getFirst(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    var children = container.getAll(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    var amount = container.count(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    "},{"location":"container/#sort-children","title":"Sort children","text":"
    container.sort(property);\n
    container.sort(property, function(childA, childB){\nreturn 0; // 0, 1, -1\n});\n
    "},{"location":"container/#remove-child","title":"Remove child","text":"
    container.remove(child);\n// container.remove(child, true);  // remove child object and destroy it\n
    container.removeAt(index);\n// container.removeAt(index, true);  // remove child object and destroy it\n
    container.removeBetween(startIndex, endIndex);\n// container.removeBetween(startIndex, endIndex, true);  // remove children objects and destroy them\n
    container.removeAll();\n// container.removeAll(true);  // remove all children objects and destroy them\n

    Removing child from container without destroying will put back into scene's display list.

    "},{"location":"container/#order-of-child","title":"Order of child","text":"
    container.moveTo(child, index);\n
    container.bringToTop(child);\n
    container.sendToBack(child);\n
    container.moveUp(child);\n
    container.moveDown(child);\n
    container.moveAbove(child1, child2);  // Move child1 above child2\n
    container.moveBelow(child1, child2);  // Move child1 below child2\n
    container.swap(child1, child2);\n
    container.reverse();\n
    container.shuffle();\n
    "},{"location":"container/#replace-child","title":"Replace child","text":"
    container.replace(oldChild, newChild);\n// container.replace(oldChild, newChild, true);  // destroy oldChild\n
    "},{"location":"container/#set-properties_1","title":"Set properties","text":"
    container.setAll(property, value, startIndex, endIndex);\n
    "},{"location":"container/#for-each-child","title":"For each child","text":"
    • Iterate current children list
      container.iterate(callback);\n// container.iterate(callback, context);\n// container.iterate(callback, context, arg0, arg1, ...);\n
      • callback :
        function(child, arg0, arg1, ...) {\n\n}\n
    • Iterate a copy of current children list
      container.each(callback);\n// container.each(callback, context);\n// container.each(callback, context, arg0, arg1, ...);\n
      • callback :
        function(child, arg0, arg1, ...) {\n\n}\n
    "},{"location":"container/#get-world-position-rotation-scale","title":"Get world position, rotation, scale","text":"
    var matrix = child.getWorldTransformMatrix();\nvar x = matrix.tx;\nvar y = matrix.ty;\nvar rotation = matrix.rotation;\nvar scaleX = matrix.scaleX;\nvar scaleY = matrix.scaleY;\n
    "},{"location":"container/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"container/#create-mask","title":"Create mask","text":"
    var mask = container.createBitmapMask();\n

    See mask

    "},{"location":"container/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"container/#compare-with-group-object","title":"Compare with group object","text":"
    • Container and group objects are all have a children list.
    • Container has position, angle, alpha, visible, ...etc, but group does not have.
    • Container controls properties of children (position, angle, alpha, visible, ...etc), but group won't.
    • A game object could be added to many groups, but it only could be added to one container (exclusive mode).
    "},{"location":"containerlite-perspective/","title":"Perspective","text":""},{"location":"containerlite-perspective/#introduction","title":"Introduction","text":"

    Snapshot children of containerlite, to a perspective render texture.

    • Author: Rex
    • Behavior of containerlite
    "},{"location":"containerlite-perspective/#live-demos","title":"Live demos","text":"
    • Flip ui
    "},{"location":"containerlite-perspective/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"containerlite-perspective/#install-plugin","title":"Install plugin","text":""},{"location":"containerlite-perspective/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add perspective behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar perspective = scene.plugins.get('rexperspectiveimageplugin').addContainerPerspective(container, config);\n
    "},{"location":"containerlite-perspective/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add perspective behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar perspective = scene.plugins.get('rexPerspectiveImagePlugin').addContainerPerspective(container, config);\n
    "},{"location":"containerlite-perspective/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ContainerPerspective } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add perspective behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar perspective = new ContainerPerspective(container, config);\n
    "},{"location":"containerlite-perspective/#create-instance","title":"Create instance","text":"
    var perspective = scene.plugins.get('rexPerspectiveImagePlugin').addContainerPerspective(container, {\nuseParentBounds: false,\n// hideCCW: true,\n});\n
    • useParentBounds :
      • true : Use bounds of parent container
      • false : Union all visible children's bounds
    • hideCCW :
      • true : Hide backward facing Faces. Default behavior.
      • false : Show backward facing Faces
    "},{"location":"containerlite-perspective/#perspective-mode","title":"Perspective mode","text":""},{"location":"containerlite-perspective/#enter","title":"Enter","text":"
    perspective.enter();\n
    1. Snapshot current visible children into perspective render texture
    2. Set current visible children to invisible
    3. Set this perspective render texture to visible
    "},{"location":"containerlite-perspective/#exit","title":"Exit","text":"
    perspective.exit();\n
    1. Inverse visible of children and perspective render texture
    "},{"location":"containerlite-perspective/#is-in-perspective-mode","title":"Is in perspective mode","text":"
    var isInPerspectiveMode = perspective.perspectiveState;\n
    "},{"location":"containerlite-perspective/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleX = perspective.angleX; // Angle in degrees\nvar angleY = perspective.angleY; // Angle in degrees\nvar angleZ = perspective.angleZ; // Angle in degrees\n
      or
      var rotationX = perspective.rotationX; // Angle in radians\nvar rotationY = perspective.rotationY; // Angle in radians\nvar rotationZ = perspective.rotationZ; // Angle in radians\n
    • Set rotation angle
      perspective.angleX = angleX; // Angle in degrees\nperspective.angleY = angleY; // Angle in degrees\nperspective.angleZ = angleZ; // Angle in degrees\n
      or
      perspective.rotationX = rotationX; // Angle in radians\nperspective.rotationY = rotationY; // Angle in radians\nperspective.rotationZ = rotationZ; // Angle in radians\n
    "},{"location":"containerlite-perspective/#flip","title":"Flip","text":"
    scene.tweens.add({\ntargets: perspective,\nangleY: { start: 0, to: -180}\n})\n
    "},{"location":"containerlite-perspective/#other-properties","title":"Other properties","text":"

    See Perspective rendertexture game object.

    "},{"location":"containerlite-skew/","title":"Skew","text":""},{"location":"containerlite-skew/#introduction","title":"Introduction","text":"

    Snapshot children of containerlite, to a skew render texture.

    • Author: Rex
    • Behavior of containerlite
    "},{"location":"containerlite-skew/#live-demos","title":"Live demos","text":"
    • Skew ui
    "},{"location":"containerlite-skew/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"containerlite-skew/#install-plugin","title":"Install plugin","text":""},{"location":"containerlite-skew/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add skew behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar skew = scene.plugins.get('rexquadimageplugin').addContainerSkew(container, config);\n
    "},{"location":"containerlite-skew/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add skew behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar skew = scene.plugins.get('rexQuadImagePlugin').addContainerSkew(container, config);\n
    "},{"location":"containerlite-skew/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ContainerSkew } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add skew behavior
      // var container = scene.add.rexContainerLite(x, y);\nvar skew = new ContainerSkew(container, config);\n
    "},{"location":"containerlite-skew/#create-instance","title":"Create instance","text":"
    var quad = scene.plugins.get('rexQuadImagePlugin').addContainerSkew(container, {\nuseParentBounds: false\n});\n
    • useParentBounds :
      • true : Use bounds of parent container
      • false : Union all visible children's bounds
    "},{"location":"containerlite-skew/#skew-mode","title":"Skew mode","text":""},{"location":"containerlite-skew/#enter","title":"Enter","text":"
    skew.enter();\n
    1. Snapshot current visible children into skew render texture
    2. Set current visible children to invisible
    3. Set this skew render texture to visible
    "},{"location":"containerlite-skew/#exit","title":"Exit","text":"
    skew.exit();\n
    1. Inverse visible of children and skew render texture
    "},{"location":"containerlite-skew/#is-in-skew-mode","title":"Is in skew mode","text":"
    var isInSkewMode = skew.skewState;\n
    "},{"location":"containerlite-skew/#skew","title":"Skew","text":"
    • Set
      image.setSkewX(skewXRad);\nimage.setSkewXDeg(skewXDeg);\n
      image.setSkewY(skewXRad);\nimage.setSkewYDeg(skewXDeg);\n
      image.setSkew(skewXRad, skewYRad);\nimage.setSkewDeg(skewXDeg, skewYDeg);\n
      image.skewX = skewXRad;\nimage.skewXDeg = skewXDeg;\n
      image.skewY = skewYRad;\nimage.skewYDeg = skewYDeg;\n
    • Get
      var skewXRad = image.skewX;\nvar skewXDeg = image.skewXDeg;\n
      var skewYRad = image.skewY;\nvar skewYDeg = image.skewYDeg;\n
    "},{"location":"containerlite-skew/#other-properties","title":"Other properties","text":"

    See Skew rendertexture game object.

    "},{"location":"containerlite/","title":"Container Lite","text":""},{"location":"containerlite/#introduction","title":"Introduction","text":"

    Control the position and angle of children game objects.

    It is inspired from Ziao/phaser3-interim-containers.

    • Author: Rex
    • Game object
    "},{"location":"containerlite/#live-demos","title":"Live demos","text":"
    • Rotate, alpha
    • Tween child
    • Create tween config
    • Mix timeline
    • Snapshot
    • Destroy:
      • Destroy containerLite
      • Destory scrollablePanel,
    • Add to p3-container
    "},{"location":"containerlite/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"containerlite/#install-plugin","title":"Install plugin","text":""},{"location":"containerlite/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcontainerliteplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcontainerliteplugin.min.js', true);\n
    • Add container object
      var container = scene.add.rexContainerLite(x, y);\n
    "},{"location":"containerlite/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ContainerLitePlugin from 'phaser3-rex-plugins/plugins/containerlite-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexContainerLitePlugin',\nplugin: ContainerLitePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add container object
      var container = scene.add.rexContainerLite(x, y);\n
    "},{"location":"containerlite/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ContainerLite from 'phaser3-rex-plugins/plugins/containerlite.js';\n
    • Add container object
      var container = new ContainerLite(scene, x, y);\nscene.add.existing(container);\n
    "},{"location":"containerlite/#add-container-object","title":"Add container object","text":"
    var container = scene.add.rexContainerLite(x, y);  // width = 1, height = 1\n// var container = scene.add.rexContainerLite(x, y, width, height);\n

    or

    var container = scene.add.rexContainerLite(x, y, children);  // width = 1, height = 1\n// var container = scene.add.rexContainerLite(x, y, width, height, children);\n

    Add container from JSON

    var container = scene.make.rexContainerLite({\nx: 0,\ny: 0,\nwidth: 1,\nheight: 1,\n\n// angle: 0,\n// alpha: 1,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n});\n
    "},{"location":"containerlite/#custom-class","title":"Custom class","text":"
    • Define class
      class MyContainer extends ContainerLite {\nconstructor(scene, x, y, width, height, children) {\nsuper(scene, x, y, width, height, children);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var container = new MyContainer(scene, x, y, width, height, children);\n
    "},{"location":"containerlite/#destroy","title":"Destroy","text":"
    container.destroy();\n

    Also destroy all children.

    "},{"location":"containerlite/#other-properties","title":"Other properties","text":"

    This container game object inherits from Zone.

    "},{"location":"containerlite/#add-child","title":"Add child","text":""},{"location":"containerlite/#pin","title":"Pin","text":"

    Add(pin) a game obejct to container

    container.add(child);  // child: a game object\n// container.pin(child);\n
    • child : A game object

    or

    container.pin(child, {\n// syncPosition: true,\n// syncRotation: true,\n// syncScale : true,\n// syncAlpha: true,\n// syncScrollFactor: true,\n// syncCameraFilter: true,\n// syncDisplayList: true\n});\n
    • child : A game object
    • syncPosition :
      • true : Sync position of child, default behavior.
      • false : Don't sync position of child.
    • syncRotation :
      • true : Sync angle of child, default behavior.
      • false : Don't sync angle of child.
    • syncScale :
      • true : Sync scale of child, default behavior.
      • false : Don't sync angle of child.
    • syncAlpha :
      • true : Sync alpha of child, default behavior.
      • false : Don't sync alpha of child.
    • syncScrollFactor :
      • true : Sync scrollFactor of child, default behavior.
      • false : Don't sync scrollFactor of child.
    • syncCameraFilter :
      • true : Sync cameraFilter of child, default behavior.
      • false : Don't sync cameraFilter of child.
    • syncDisplayList :
      • true : Put child into parent's displayList/Layer, default behavior.
        • Child has to belong to any displayList first.
      • false : Don't change child's displayList.

    Or add(pin) children

    container.addMultiple(children);\n// container.add(children);\n
    • children : An array of game objects

    These world properties of children will be changed with container.

    • Position/Angle/Scale
    • Visible
    • Alpha
    • Scroll factor
    • Mask

    Note

    • Position of child is the world position, i.e. position of child won't be changed when adding to container initially.
      • For example, container-lite is at (100, 100), and child is at (110, 110), then child will be placed at (110, 110) after adding to container-lite.
    • This behavior is different from official container, which using related position of child when adding to container.
      • For example, official container is at (100, 100), and child is at (10, 10), then child will be placed at (110, 110) after adding to official container.
    "},{"location":"containerlite/#add-local","title":"Add local","text":"
    container.addLocal(child);\n

    or

    container.addLocalMultiple(children);\n

    or

    container.pinLocal(child, {\n// syncPosition: true,\n// syncRotation: true,\n// syncScale : true,\n// syncAlpha: true,\n});\n

    Add child to container with related properties, like official container. For example, container-lite is at (100, 100), and child is at (10, 10), then child will be placed at (110, 110) after adding to container-lite.

    "},{"location":"containerlite/#remove-child","title":"Remove child","text":"
    • Remove(unpin) a child
      container.remove(child);\n// container.remove(child, destroyChild);\n
      or
      container.unpin(child);\n// container.unpin(child, destroyChild);\n
      • child : Game object
      • destroyChild : Set true to destroy child. Default is false.
    • Remove all children
      container.clear();\n// container.clear(destroyChild);\n
    "},{"location":"containerlite/#get-child","title":"Get child","text":"
    • Get first child by name
      var gameObject = container.getByName(name);\n// var gameObject = container.getByName(name, recursive);\n
      • gameObject : A child, or null if not found.
      • recursive : Set true to search all children recursively.
    • Get a random child
      var gameObject = container.getRandom();\n// var gameObject = container.getRandom(startIndex, length);\n
    • Get children in this container-lite
      • Internal children array
        var gameObjects = container.getChildren();\n
      • Copy of children array
        var gameObjects = container.getChildren([]);\n// var gameObjects = container.getChildren(out);\n
    • Get all children under this container-lite recursively
      var gameObjects = container.getAllChildren();\n
      • Put container itself and all children into Layer
        layer.add(container.getAllChildren([container]));\n
      • Draw on render texture
        rt.draw(container.getAllChildren());\n
      • Ignored in camera
        camera.ignore(container.getAllChildren());\n
    "},{"location":"containerlite/#traversal","title":"Traversal","text":"
    • Depth-First Search
      container.dfs(function(current) {\n// return true;  // Discard children traveraling\n})\n
      • Return true to discard children traveraling
    • Breadth-First Search
      container.bfs(function(current) {\n// return true;  // Discard children traveraling\n})\n
      • Return true to discard children traveraling
    "},{"location":"containerlite/#exist","title":"Exist","text":"

    Return true if child is under this container-lite (nested).

    var hasChild = container.contains(child);\n
    "},{"location":"containerlite/#children","title":"Children","text":"
    var children = container.children;\n
    • children : Array of child game objects.
    "},{"location":"containerlite/#get-parent","title":"Get parent","text":"
    var parentContainer = scene.plugins.get('rexContainerLitePlugin').getParent(child);\n

    or

    var parentContainer = Container.GetParent(child); // Static method\n
    "},{"location":"containerlite/#set-properties-of-child","title":"Set properties of child","text":""},{"location":"containerlite/#position","title":"Position","text":"
    container.setChildPosition(child, x, y);\n
    "},{"location":"containerlite/#rotation","title":"Rotation","text":"
    container.setChildRotation(child, rotation);\n
    • rotation : Angle in radians.
    "},{"location":"containerlite/#scale","title":"Scale","text":"
    container.setChildScale(child, scaleX, scaleY);\n

    or

    container.setChildDisplaySize(child, width, height);\n
    "},{"location":"containerlite/#visible","title":"Visible","text":"
    container.setChildVisible(child, visible);\n
    "},{"location":"containerlite/#alpha","title":"Alpha","text":"
    container.setChildAlpha(child, alpha);\n
    "},{"location":"containerlite/#local-state-of-child","title":"Local state of child","text":"

    Get local state

    var localState = container.getLocalState(child);\n

    or

    var localState = child.rexContainer;\n
    • Properties of localState
      • x, y
      • rotation
      • scaleX, scaleY
      • visible
      • alpha
    "},{"location":"containerlite/#change-local-state-of-child","title":"Change local state of child","text":"
    • Local position
      container.setChildLocalPosition(child, x, y);\n
    • Local scale
      container.setChildLocalScale(child, scaleX, scaleY);\n
    • Local alpha
      container.setChildLocalAlpha(child, alpha);\n
    • Local visible
      container.setChildLocalVisible(child, visible);\n
    "},{"location":"containerlite/#reset-local-state-of-child","title":"Reset local state of child","text":"

    Reset local state of child according to current properties of children

    • Reset local state of all properties
      container.resetChildState(child);\n
    • Reset local state of position
      container.resetChildPositionState(child);\n
    • Reset local state of rotation
      container.resetChildRotationState(child);\n
    • Reset local state of scale
      container.resetChildScaleState(child);\n
    • Reset local state of alpha
      container.resetChildAlphaState(child);\n
    • Reset local state of visible
      container.resetChildVisibleState(child);\n
    • Reset local state of active
      container.resetChildActiveState(child);\n
    "},{"location":"containerlite/#tween-local-state","title":"Tween local state","text":"
    var tweenObj = container.tweenChild({\ntargets: child,\n// x: '+=100',\n// y: '+=100',\n// repeat: -1,\n// yoyo: true\n})\n
    • targets : A game object, or an array of game object.
      • A containerLite child, can tween its local state.

    Paramters of configuration is the same as tween task.

    Supported properties :

    • x, y,
    • angle, rotation
    • scaleX, scaleY, displayWidth, displayHeight
    • alpha
    "},{"location":"containerlite/#tween-local-state-of-a-containerlite-child","title":"Tween local state of a containerlite child","text":"
    var tweenObj = containerLiteChild.tweenSelf({    // x: '+=100',\n// y: '+=100',\n// repeat: -1,\n// yoyo: true\n})\n

    Equal to

    containerLiteChild.tweenChild({\ntargets: containerLiteChild,\n// x: '+=100',\n// y: '+=100',\n// repeat: -1,\n// yoyo: true\n})\n
    "},{"location":"containerlite/#create-tween-config","title":"Create tween config","text":"
    var tweenConfig = container.createTweenChildConfig({\ntargets: child,\n// x: '+=100',\n// y: '+=100',\n// repeat: -1,\n// yoyo: true\n});\nscene.tweens.add(tweenConfig);\n
    • Input of targets is/are game object(s), will be replaced by local state of game object(S)
    • Wrap onUpdate callback, to update properties of child according to local state.
    "},{"location":"containerlite/#depth","title":"Depth","text":"
    • Get depth of container
      var depth = container.depth;\n
    • Set depth of container
      container.setDepth(value, true);\n// container.depth = depth;\n
    • Set depth of container and all children
      container.setDepth(value);\n
    • Bring this container and its children to top
      container.bringMeToTop();\n// container.bringToTop();\n
    • Send this container and its children to back
      container.sendMeToBack();\n// container.sendToBack();\n
    • Swap depth with another container
      containerA.swapDepth(containerB);\n
    • Increase of container and all children
      container.incDepth(value);\n
    • Move game object below this container and all children
      container.moveMyDepthBelow(gameObject);\n// container.moveDepthBelow(gameObject);\n
    • Move game object above this container and all children
      container.moveMyDepthAbove(gameObject);\n// container.moveDepthAbove(gameObject);\n
    • Bring a child of container to top of this container
      container.bringChildToTop(gameObject);\n
    • Send a child of container to bottom of this container
      container.sendChildToBack(gameObject);\n
    "},{"location":"containerlite/#render-layer","title":"Render layer","text":"

    A containerLite can have a layer. Current children and new children will draw on this layer, instead of display list of scene.

    • Enable layer. Do nothing if layer is existed.
      container.enableLayer();\n
    • Get layer game object. Will enable layer if layer is not existed.
      var layer = container.getLayer();\n
    • Get layer game object, without enable layer.
      var layer = container.privateRenderLayer;\n
    • Has layer game object
      var hasLayer = container.hasLayer();\n
    "},{"location":"containerlite/#mask","title":"Mask","text":"
    • Assign mask object to children
      container.setMask(mask);  // container.mask = mask;\n
    • Remove mask object of children
      container.clearMask();\n
    • Remove mask object of children, and destroy mask object
      container.clearMask(true);\n
    "},{"location":"containerlite/#shader-effects","title":"Shader effects","text":"

    Apply post-fx pipeline on layer of containerLite.

    "},{"location":"containerlite/#snapshot","title":"Snapshot","text":"
    • Draw all visible children on a render-texture.
      var renderTexture = container.snapshot({\nrenderTexture: undefined,\npadding: 0\n});\n
      • renderTexture : Draw on this render-texture
        • undefined : Create a new render-texture
      • padding :
        • 0 : No extra padding space. Default value.
        • A number : Add extra padding space around this render-texture.
    • Draw all visible children on a dynamic-texture
      container.snapshot({\npadding: 0,\nsaveTexture: textureKey\n});\n
      • saveTexture : Save render result to texture manager.
    "},{"location":"containerlite/#draw-bounds","title":"Draw bounds","text":"
    • Draw bounds of shown game object on a graphics game object
      container.drawBounds(graphics);\n// container.drawBounds(graphics, color);\n
      or
      container.drawBounds(graphics, {\n// color: 0xffffff,\n// lineWidth: 1,\n// padding: 0,\n// drawContainer: true,\n// children: undefined,\n});\n
      • graphics : Graphics game object
      • color : Default value is 0xffffff.
      • lineWidth : Default value is 1.
      • padding : Extra space around bounds. Default value is 0.
      • drawContainer :
        • true : Draw all children game objects included containerLite. Default behavior.
        • false : Draw all children game objects excluded containerLite
      • children :
        • Array of game objects : Only draw bounds of these children
        • undefined : Draw bounds of all children
    "},{"location":"containerlite/#scroll-factor","title":"Scroll factor","text":"
    • Set scroll factor to children
      container.setScrollFactor(x, y);\n
    "},{"location":"containerlite/#change-origin","title":"Change origin","text":"
    container.changeOrigin(originX, originY);\n

    This method also will reset all local state of children.

    "},{"location":"containerlite/#add-to-container","title":"Add to container","text":"
    • Add to built-in container
      containerLite.addToContainer(p3Container);\n
      or
      p3Container.add(containerLite);\n
      • p3Container : Container game object.
    • Add to Layer
      container.addToLayer(layer);\n
      • layer : Layer game object.
    "},{"location":"containerlite/#remove-from-container","title":"Remove from container","text":"
    • Remove from built-in container
      containerLite.removeFromContainer(p3Container);\n
      or
      p3Container.remove(containerLite);\n
      • p3Container : Container game object.
    • Remove from Layer
      container.removeFromLayer(layer);\n
      • layer : Layer game object.
    "},{"location":"containerlite/#other-properties_1","title":"Other properties","text":"

    See game object

    "},{"location":"containerlite/#compare-with-official-container","title":"Compare with Official Container","text":"
    • Position/anlge/scale of a child object :
      • Container : Local position/anlge/scale, responding to parent container, not a world position/anlge/scale.
      • Container-Lite : World position/anlge/scale.
    • Updating period
      • Container : Re-calculate position/anlge/scale of each child every render.
      • Container-Lite: Re-calculate position/anlge/scale of each child when parent container changes position/anlge/scale.
    • Mask
      • Container : It has mask property, and it could become a mask object.
      • Container-Lite : It has mask property, but it could not become a mask object.
    • DOM game object
      • Container : Only 1 level parent container will affect DOM game object. Therefore position of DOM game object in nested container might be incorrect.
      • Container-Lite : DOM game object can work with nested Container-Lite.
    "},{"location":"create-number-array/","title":"Number array","text":""},{"location":"create-number-array/#introduction","title":"Introduction","text":"

    Create an array representing the range of numbers, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"create-number-array/#usage","title":"Usage","text":""},{"location":"create-number-array/#create-number-array","title":"Create number array","text":"

    Create an array representing the range of numbers (usually integers), between, and inclusive of, the given start and end arguments.

    var arr = Phaser.Utils.Array.NumberArray(start, end);\n

    For example,

    var arr = Phaser.Utils.Array.NumberArray(2, 4);\n// arr = [2, 3, 4]\n

    "},{"location":"create-number-array/#create-number-array-with-step","title":"Create number array with step","text":"

    Create an array of numbers (positive and/or negative) progressing from start up to but not including end by advancing by step.

    var arr = Phaser.Utils.Array.NumberArray(start, end, step);\n

    For example,

    var arr = Phaser.Utils.Array.NumberArrayStep(0, 20, 5);\n// arr =  [0, 5, 10, 15]\n

    "},{"location":"create-number-array/#create-prefix-number-suffix-string-array","title":"Create prefix-number-suffix string array","text":"
    var arr = Phaser.Utils.Array.NumberArray(start, end, prefix, suffix);\n

    For example,

    var arr = Phaser.Utils.Array.NumberArray(5, 7, 'HD-', '.png');\n// arr = ['HD-5.png', 'HD-6.png', 'HD-7.png']\n

    "},{"location":"csvscenario/","title":"CSV scenario","text":""},{"location":"csvscenario/#introduction","title":"Introduction","text":"

    Run script in csv format. Csv could be edited by excel or google document.

    • Author: Rex
    • Member of scene
    "},{"location":"csvscenario/#live-demos","title":"Live demos","text":"
    • CSV-scenario
    • With TextPlayer
    "},{"location":"csvscenario/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"csvscenario/#install-plugin","title":"Install plugin","text":""},{"location":"csvscenario/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcsvscenarioplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcsvscenarioplugin.min.js', true);\n
    • Add csv-scenario object
      var scenario = scene.plugins.get('rexcsvscenarioplugin').add(scene);\n
    "},{"location":"csvscenario/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CsvScenarioPlugin from 'phaser3-rex-plugins/plugins/csvscenario-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCsvScenario',\nplugin: CsvScenarioPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add csv-scenario object
      var scenario = scene.plugins.get('rexCsvScenario').add(scene);\n
    "},{"location":"csvscenario/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CsvScenario from 'phaser3-rex-plugins/plugins/csvscenario.js';\n
    • Add csv-scenario object
      var scenario = new CsvScenario(scene);\n
    "},{"location":"csvscenario/#create-instance","title":"Create instance","text":"
    var scenario = scene.plugins.get('rexCSVScenario').add(scene, {\n// timeUnit: 0,        // 'ms'|0|'s'|'sec'|1\n// prefix: /^#([a-zA-Z]+)/\n// argsConvert: true,\n// argsConvertScope: undefined,\n// delimiter: ','\n// translateCommandNameCallback: undefined,\n});\n
    • csvString : Commands in csv-string.
    • scope : Running commands via methods in this scope object.
      • Get scope : var scope = scenario.scope
    • timeUnit: time-unit of dt, for delay-execution
      • 'ms', or 0 : dt in millisecond
      • 's', 'sec', or 1 : dt in second
    • prefix: regex of picking control instructions
    • argsConvert: A callback to convert parameters of run-custom-function
      • true : Use defaule value converter. Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string.
      • Function object:
        function(s) {\nreturn s;\n}\n
    • argsConvertScope: scope of argsConvert
    • delimiter : Delimiter of CSV string.
    • translateCommandNameCallback : Callback to translate custom command name
      • undefined : Use original custom command name. Default behavior.
      • A function, return new custom command name.
        function(commandName) {\nreturn newCommandName;\n}\n
    "},{"location":"csvscenario/#load-csv-script","title":"Load csv script","text":"
    scenario.load(csvString, scope, {\n// timeUnit: 0,        // 'ms'|0|'s'|'sec'|1\n// prefix: /^#([a-zA-Z]+)/\n// argsConvert: true,\n// argsConvertScope: undefined,\n// delimiter: ',',\n// translateCommandNameCallback: undefined,\n})\n
    • csvString : Commands in csv-string.
    • scope : Running commands via methods in this scope object.
      • Get scope : var scope = scenario.scope
    • timeUnit: time-unit of dt, for delay-execution
      • 'ms', or 0 : dt in millisecond
      • 's', 'sec', or 1 : dt in second
    • prefix: regex of picking control instructions
    • argsConvert: A callback to convert parameters of run-custom-function
      • true : Use defaule value converter. Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string.
      • Function object:
        function(s) {\nreturn s;\n}\n
    • argsConvertScope: scope of argsConvert
    • delimiter : Delimiter of CSV string.
    "},{"location":"csvscenario/#append-csv-script","title":"Append csv script","text":"
    scenario.append(csvString);\n
    "},{"location":"csvscenario/#start-running-instructions","title":"Start running instructions","text":"

    scenario.start({\n// label: '',\n// offset: 0\n})\n
    scenario.play({\n// label: '',\n// offset: 0\n})\n

    • label : Go to the label and execute. '' label is starting from 1st instruction
    • offset : Offset time

    or

    scenario.playPromise({\n// label: '',\n// offset: 0\n})\n.then(function(){\n// On complete\n})\n
    "},{"location":"csvscenario/#events","title":"Events","text":"
    • Complete
      scenario.on('complete', function(scope, scenario){ });\n
    • Wait event
      scenario.on('wait.' + eventName, function(scenario){ });\n
      scenario.on('wait', function(eventName, scenario){ });\n
    • Label has changed
      scenario.on('labelchange', function(lastLabel, prevLabel, scope, scenario){ });\n
    • Dump execution log
      scenario.on('log', function(msg, scope, scenario){ });\n
    • Notify error
      scenario.on('error', function(msg, scope, scenario){ });\n
    "},{"location":"csvscenario/#types-of-instructions","title":"Types of instructions","text":"

    Each row in csv table is an instruction.

    "},{"location":"csvscenario/#run-custom-function","title":"Run custom function","text":"

    Run custom function of scope, which passed from scenario.load(...)

    Format:

    -,fnName,param0,param1,...\n
    • 1st column of instruction: -
    • Parameters will be converted to number, boolean, null, or string by default.
    • Method name of last custom command :
      var methodName = scenario.lastCustomCommandName;\n
    • An error event will be fired if fnName is invalid in scope.
    "},{"location":"csvscenario/#delay-execution","title":"Delay execution","text":"

    Run custom function after a delay.

    Format:

    time,fnName,param0,param1,...\n
    • 1st column of instruction: a number
    • time-unit of delay is set from scenario.load(...)
    • Parameters will be converted to number, boolean, null, or string by default.
    "},{"location":"csvscenario/#wait-then-execution","title":"Wait then execution","text":"

    Run custom function until scenario.continue(eventName)

    Format:

    eventName,fnName,param0,param1,...\n
    • 1st column of instruction: not a number, not a string start from #
    • Execution will be hang until scenario.continue(eventName) is called
    • Parameters will be converted to number, boolean, null, or string by default.
    "},{"location":"csvscenario/#skip-waiting","title":"Skip waiting","text":"
    scenario.continue(true);\n
    "},{"location":"csvscenario/#task","title":"Task","text":"

    Sample code

    Scenario will be paused if custom function return an event emitter, resumed when that evnt emitter fires complete event.

    See also: Sequence

    "},{"location":"csvscenario/#label","title":"Label","text":"

    Sample code

    A label for #GOTO or #IF instructions.

    Format:

    #LABEL,label\n
    • 1st column of instruction: #LABEL, case insensitive.
    • Label '' is reserved, don't use '' for label name.

    Example: A label named 'AA'

    #LABEL,AA\n
    • Last label :
      var label = scenario.lastLabel;\n
    • Previous label :
      var previousLabel = scenario.previousLabel;\n
    "},{"location":"csvscenario/#exit","title":"Exit","text":"

    Exit current execution.

    Format:

    #EXIT\n
    • 1st column of instruction: #EXIT, case insensitive.
    "},{"location":"csvscenario/#goto","title":"Goto","text":"

    Sample code

    Go to label and execute.

    Format:

    #GOTO,label\n
    • 1st column of instruction: #GOTO, case insensitive.
    • An error event will be fired if label is not found.

    Example: Goto label 'AA'

    #GOTO,AA\n
    "},{"location":"csvscenario/#if-goto","title":"If-goto","text":"

    Sample code

    Go to trueLabel if condition is true, otherwise go to falseLabel.

    Format:

    #IF,condition,trueLabel,falseLabel\n
    • 1st column of instruction: #IF, case insensitive.
    • conditon: boolean equation
      • this is the scope passed from scenario.load(...)
    • trueLabel/falseLabel: go to this label if condition is true/false
      • run next instruction if label is ''
      • An error event will be fired if label is not found.

    Example: Goto label 'AA' if (this.coin > 100), else run next instruction

    #IF,this.coin > 100,AA\n
    "},{"location":"csvscenario/#wait","title":"Wait","text":"

    Run next instruction after a delay time, or scenario.continue(eventName).

    Format:

    #WAIT,time\n
    #WAIT,eventName\n
    • 1st column of instruction: #WAIT, case insensitive.
    • 2nd colume of instruction:
      • a number: a delay time
        • time-unit of delay is set from scenario.load(...)
      • a string: an event name for scenario.continue(eventName)

    Example:

    • Wait 1 time-unit
      #WAIT,1\n
    • Wait until 'click'
      #WAIT,click\n
      scenario.continue('click');\n
    "},{"location":"csvscenario/#pause","title":"Pause","text":"
    scenario.pause();\n
    "},{"location":"csvscenario/#resume","title":"Resume","text":"
    scenario.resume();\n
    "},{"location":"csvscenario/#time-scale","title":"Time-scale","text":"
    • Get
      var timeScale = scenario.timeScale;\n
    • Set
      scenario.setTimeScale(timeScale);\n// scenario.timeScale = timeScale;\n
    "},{"location":"csvscenario/#clear","title":"Clear","text":"

    Stop running and clear instructions.

    scenario.clear();\n
    "},{"location":"csvscenario/#states","title":"States","text":"
    • Is running
      var isRunning = scenario.isRunning;\n
    • Is paused
      var isPaused = scenario.isPaused;\n
    "},{"location":"csvtoarray/","title":"CSV to array","text":""},{"location":"csvtoarray/#introduction","title":"Introduction","text":"

    Generate array from csv string.

    • Reference: Papa Parse
    • Method only
    "},{"location":"csvtoarray/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"csvtoarray/#import-class","title":"Import class","text":"
    import rexCSVToArray from './plugins/csvtoarray.js';\n
    "},{"location":"csvtoarray/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CSVToArrayPlugin from 'phaser3-rex-plugins/plugins/csvtoarray-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCSVToArray',\nplugin: CSVToArrayPlugin,\nstart: true\n}\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Convert csv
      var arr = scene.plugins.get('rexCSVToArray').convert(csvString, config);\n
    "},{"location":"csvtoarray/#convert-csv","title":"Convert csv","text":"
    var arr = scene.plugins.get('rexCSVToArray').convert(csvString, {\n// delimiter: ',',\n// convert: true\n});\n

    Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string, if convert is true.

    "},{"location":"csvtohashtable/","title":"CSV to hash table","text":""},{"location":"csvtohashtable/#introduction","title":"Introduction","text":"

    Hash table indexed by (col-key, row-key) from csv string.

    • Author: Rex
    • Member of scene
    "},{"location":"csvtohashtable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"csvtohashtable/#install-plugin","title":"Install plugin","text":""},{"location":"csvtohashtable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcsvtohashtableplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcsvtohashtableplugin.min.js', true);\n
    • Add hash-table object
      var table = scene.plugins.get('rexcsvtohashtableplugin').add();\n
    "},{"location":"csvtohashtable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CsvToHashTablePlugin from 'phaser3-rex-plugins/plugins/csvtohashtable-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCsvToHashTable',\nplugin: CsvToHashTablePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add hash-table object
      var table = scene.plugins.get('rexCsvToHashTable').add();\n
    "},{"location":"csvtohashtable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CsvToHashTable from 'phaser3-rex-plugins/plugins/csvtohashtable.js';\n
    • Add hash-table object
      var table = new CsvToHashTable();\n
    "},{"location":"csvtohashtable/#create-instance","title":"Create instance","text":"
    var table = scene.plugins.get('rexCsvToHashTable').add();\n
    "},{"location":"csvtohashtable/#append-rows-from-csv-string","title":"Append rows from csv string","text":"
    table.loadCSV(csvString, {\n// delimiter: ',',\n// convert: true\n// convertScope: undefined\n});\n

    For exameple, csv string

    name hp mp Rex 100 20 Alice 300 40
    name,hp,mp\nRex,100,20\nAlice,300,40\n

    will be converted to

    {\n\"Alice\": {\n\"name\": \"Alice\",\n\"hp\": 300,\n\"mp\": 40\n},\n\"Rex\": {\n\"name\": \"Rex\",\n\"hp\": 100,\n\"mp\": 20\n}\n}\n

    Then get value by

    var value = table.get('Rex', 'hp');\n
    "},{"location":"csvtohashtable/#convert-value-type","title":"Convert value type","text":"

    Values will be converted to number (include hex number string like '0xFF'), boolean, null, or string, if convert is true, or assign your convert function by convert and convertScope when loading table (table.loadCSV(...)).

    var convertCallback = function(table, rowKey, colKey, value) {\n// value = ...\nreturn value;\n};\n

    Or uses these metheds to convert columns or rows.

    • convert values in column
      table.convertCol(colKey);  // colKey: a colKey, or an array of colKeys\n// table.convertCol(colKey, convertCallback, convertCallbackScope);\n
    • convert values in row
      table.convertRow(rowKey);  // rowKey: a rowKey, or an array of rowKeys\n// table.convertRow(rowKey, convertCallback, convertCallbackScope);\n
    "},{"location":"csvtohashtable/#get-value","title":"Get value","text":"
    var val = table.get(rowKey, colKey);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#set-value","title":"Set value","text":"
    table.set(rowKey, colKey, value);\n
    table.add(rowKey, colKey, value);\n// equal to table.set(rowKey, colKey, table.get(rowKey, colKey) + value);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#has-columnrow-key","title":"Has column/row key","text":"
    var hasRow = table.hasRowKey(rowKey);\n
    var hasCol = table.hasColKey(colKey);\n
    var hasCell = table.hasKey(rowKey, colKey);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#value-in-column-or-row","title":"Value in column or row","text":"
    var existed = table.isValueInRol(rowKey, value);\n
    var existed = table.isValueInCol(colKey, value);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#create-table","title":"Create table","text":""},{"location":"csvtohashtable/#clear-table","title":"Clear table","text":"
    table.clear();\n
    "},{"location":"csvtohashtable/#append-a-column","title":"Append a column","text":"
    table.appendCol(colKey, initValue);\n// table.appendCol(colKey, callback, scope);  // get initValue from callback\n

    Callback

    var callback = function (table, rowKey, colKey) { // value = ...\nreturn value;\n};\n
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#append-a-row","title":"Append a row","text":"
    table.appendRow(rowKey, initValue);\n// table.appendRow(rowKey, callback, scope);  // get initValue from callback\n

    Callback

    var callback = function (table, rowKey, colKey) { // value = ...\nreturn value;\n};\n
    • rowKey : Row key string, or row index number.
    "},{"location":"csvtohashtable/#remove-a-column","title":"Remove a column","text":"
    table.removeCol(colKey);\n
    • colKey : Column key string, or column index number.
    "},{"location":"csvtohashtable/#remove-a-row","title":"Remove a row","text":"
    table.removeRol(rowKey);\n
    • rowKey : Row key string, or row index number.
    "},{"location":"csvtohashtable/#sort-column-or-row","title":"Sort column or row","text":"
    table.sortCol(colKey, mode);\n// table.sortCol(callback, scope);  // sort columns by callback\n
    table.sortRow(rowKey, mode);\n// table.sortRow(callback, scope);  // sort rows by callback\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.

    Mode:

    • 'ascending', or 0
    • 'descending', or 1
    • 'logical ascending', or 2
    • 'logical descending', or 3

    Sorting callback

    var callback = function(rowKeyA, rowKeyB) {\nreturn result; // 1, -1, or 0\n};\n
    "},{"location":"csvtohashtable/#retrieve-columns-or-rows","title":"Retrieve columns or rows","text":"
    table.eachCol(rowKey, callback, scope);\n
    table.eachRow(colKey, callback, scope);\n
    • rowKey : Row key string, or row index number.
    • colKey : Column key string, or column index number.

    Callback

    var callback = function(table, rowKey, colKey, value) {\n// ...\n};\n
    "},{"location":"csvtohashtable/#json","title":"JSON","text":"
    • Table to json
      var jsonData = table.toJSON();\n
    • Reset table by JSON
      table.resetFromJSON(jsonData);\n
    "},{"location":"cursor/","title":"Cursor","text":""},{"location":"cursor/#introduction","title":"Introduction","text":"

    Custom cursor, built-in feature of phaser.

    • Author: Richard Davey
    "},{"location":"cursor/#usage","title":"Usage","text":"

    References:

    • Cursor
    • Using URL values for the cursor property
    "},{"location":"cursor/#set-default-cursor","title":"Set default cursor","text":"
    scene.input.setDefaultCursor(CSSString);\n// CSSString: 'url(assets/input/cursors/sword.cur), pointer'\n
    "},{"location":"cursor/#set-cursor-of-a-game-object","title":"Set cursor of a Game Object","text":"

    Change cursor image when cursor is over that Game Object.

    gameObject.setInteractive({\ncursor: CSSString\n});\n// CSSString: 'url(assets/input/cursors/sword.cur), pointer'\n

    Set cursor image directly after gameObject.setInteractive().

    gameObject.input.cursor = CSSString;\n// CSSString: 'url(assets/input/cursors/sword.cur), pointer'\n

    Use pointer (hand cursor).

    gameObject.setInteractive({\nuseHandCursor: true\n});\n
    "},{"location":"cursor/#change-current-cursor","title":"Change current cursor","text":"
    scene.input.canvas.style.cursor = cursor;\n
    • cursor : CSSString

    or

    scene.input.setCursor(gameObject.input);\n
    "},{"location":"cursor/#reset-to-default-cursor","title":"Reset to default cursor","text":"
    scene.input.resetCursor(null, true);\n
    "},{"location":"cursoratbounds/","title":"Cursor at bounds","text":""},{"location":"cursoratbounds/#introduction","title":"Introduction","text":"

    Map cursor-at-(left/right/top/botttom-)bound to (left/right/up/down) cursor key state.

    • Author: Rex
    • Member of scene
    "},{"location":"cursoratbounds/#live-demos","title":"Live demos","text":"
    • Custom bounds
    • Camera scrolling
    "},{"location":"cursoratbounds/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"cursoratbounds/#install-plugin","title":"Install plugin","text":""},{"location":"cursoratbounds/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcursoratboundsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcursoratboundsplugin.min.js', true);\n
    • Add cursor-at-bound object
      var cursorAtBound = scene.plugins.get('rexcursoratboundsplugin').add(scene, config);\n
    "},{"location":"cursoratbounds/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CursorAtBoundsPlugin from 'phaser3-rex-plugins/plugins/cursoratboundss-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCursorAtBounds',\nplugin: CursorAtBoundsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add cursor-at-bound object
      var cursorAtBound = scene.plugins.get('rexCursorAtBounds').add(scene, config);\n
    "},{"location":"cursoratbounds/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CursorAtBounds from 'phaser3-rex-plugins/plugins/cursoratboundss.js';\n
    • Add cursor-at-bound object
      var cursorAtBound = new CursorAtBounds(scene, config);\n
    "},{"location":"cursoratbounds/#create-instance","title":"Create instance","text":"
    var cursorAtBound = scene.plugins.get('rexCursorAtBounds').add(scene, {\n// enable: true,\n// bounds: undefined,\n// sensitiveDistance: 20,\n// pointerOutGameRelease: true,\n// pointerOutBoundsRelease: false,\n});\n
    • bounds : A rectangle object for detecting the position of cursor.
      • undefined : Current viewport. Will update bounds when window resizing.
    • sensitiveDistance : A sensitive distance in pixels.
    • pointerOutGameRelease :
      • true : All cursor keys are released when pointer is out of game window. Default behavior.
      • false : Don't change status of cursor keys when pointer is out of game window.
    • pointerOutBoundsRelease
      • true : All cursor keys are released when pointer is out of bounds.
      • false : Continue cursor key detection when pointer is out of bounds. Default behavior.

    Map position of cursor to state of cursor key

    • left cursor key is pressed :
      • Position x is between left bound and left bound + sensitive distance
      • Position x at left side of left bound, if pointerOutBoundsRelease is false
    • Right cursor key is pressed :
      • Position x is between right bound and right bound - sensitive distance
      • Position x at right side of right bound, if pointerOutBoundsRelease is false
    • Up cursor key is pressed :
      • Position y is between top bound and top bound + sensitive distance
      • Position y at up side of top bound, if pointerOutBoundsRelease is false
    • Down cursor key is pressed :
      • Position y is between bottom bound and bottom bound - sensitive distance
      • Position y at down side of bottom bound, if pointerOutBoundsRelease is false
    "},{"location":"cursoratbounds/#state-of-cursor-keys","title":"State of cursor keys","text":"
    var cursorKeys = cursorAtBound.createCursorKeys();\n\nvar leftKeyDown = cursorKeys.left.isDown;\nvar rightKeyDown = cursorKeys.right.isDown;\nvar upKeyDown = cursorKeys.up.isDown;\nvar downKeyDown = cursorKeys.down.isDown;\n

    Or

    var leftKeyDown = cursorAtBound.left;\nvar rightKeyDown = cursorAtBound.right;\nvar upKeyDown = cursorAtBound.up;\nvar downKeyDown = cursorAtBound.down;\nvar noKeyDown = cursorAtBound.noKey;\n
    "},{"location":"cursoratbounds/#destroy","title":"Destroy","text":"
    cursorAtBound.destroy();\n
    "},{"location":"cursoratbounds/#enable","title":"Enable","text":"
    • Get
      var enable = joystick.enable;\n
    • Set
      joystick.setEnable(enable);  // enable: true, or false\n//joystick.enable = enable;\n
    • Toggle
      joystick.toggleEnable();\n
    "},{"location":"cursoratbounds/#bounds","title":"Bounds","text":"
    • Get
      var bounds = cursorAtBound.bounds;\n
      • bounds : A rectangle object
    • Set
      cursorAtBound.setBounds(bounds);\n
      or
      cursorAtBound.bounds = bounds;;\n
      • bounds : A rectangle object
    "},{"location":"cursoratbounds/#sensitive-distance","title":"Sensitive distance","text":"
    • Get
      var distance = cursorAtBound.sensitiveDistance;\n
    • Set
      cursorAtBound.setSensitiveDistance(distance);\n
      or
      cursorAtBound.sensitiveDistance = distance;\n
    "},{"location":"curve-spiral/","title":"Spiral curve","text":""},{"location":"curve-spiral/#introduction","title":"Introduction","text":"

    Spiral curve.

    • Author: Rex
    • Curve object
    "},{"location":"curve-spiral/#live-demos","title":"Live demos","text":"
    • Spiral curve
    • Particles along spiral curve
    "},{"location":"curve-spiral/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"curve-spiral/#install-plugin","title":"Install plugin","text":""},{"location":"curve-spiral/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexspiralcurveplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexspiralcurveplugin.min.js', true);\n
    • Add spiral curve object
      var spiral = scene.plugins.get('rexspiralcurveplugin').add(config);\n
    "},{"location":"curve-spiral/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SpiralCurvePlugin from 'phaser3-rex-plugins/plugins/spiralcurve-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSpiralCurve',\nplugin: SpiralCurvePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add spiral curve object
      var spiral = scene.plugins.get('rexSpiralCurve').add(config);\n
    "},{"location":"curve-spiral/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import SpiralCurve from 'phaser3-rex-plugins/plugins/spiralcurve.js';\n
    • Add spiral curve object
      var spiral = new SpiralCurve(config);\n
    "},{"location":"curve-spiral/#create-shape","title":"Create shape","text":"
    • All properties
      var spiral = scene.plugins.get('rexSpiralCurve').add({\n// Origin point\n// Ease origin point\n// startX:0, endX: 0, easeX: 'Linear',\n// startY:0, endY: 0, easeY: 'Linear',\n// Fixed point\n// x, y,\n\n// x-radius\n// startXRadius: 0, endXRadius, easeXRadius: 'Linear',\n// y-radius\n// startYRadius: 0, endYRadius, easeYRadius: 'Linear',\n// start-end radius\n// startRadius, endRadiux\n\n// angle\n// startAngle: 0, endAngle: 360, easeAngle: 'Linear',\n\n// rotation: 0\n});\n
      • Origin point
        • startX, endX, easeX, startY, endY, easeY : Ease origin point.
          • easeX, easeY : Ease equation, default value is 'Linear'.
        • x, y : Fixed origin point, i.e. start point is equal to end point.
      • Radius
        • startXRadius, endXRadius, easeXRadius : Ease x-radius.
          • easeXRadius : Ease equation, default value is 'Linear'.
        • startYRadius, endYRadius, easeYRadius : Ease y-radius.
          • easeYRadius : Ease equation, default value is 'Linear'.
        • startRadius, endRadiux :
          • Set startXRadius, and startYRadius to startRadius.
          • Set endXRadius, and endYRadius to endRadius.
      • Angle
        • startAngle, endAngle, easeAngle : Ease angle, in degrees.
          • easeAngle : Ease equation, default value is 'Linear'.
      • rotation : Rotate curve.
    • Simple spiral curve
      var spiral = scene.plugins.get('rexSpiralCurve').add(x, y, startRadius, endRadius, startAngle, endAngle, rotation);\n
      • x : Set startX, endX to x, and easeX to 'Linear'.
      • y : Set startY, endY to y, and easeY to 'Linear'.
      • startRadius : Set startXRadius, startYRadius to startRadius
      • endRadius : Set endXRadius, endYRadius to endRadius, and easeXRadius, easeYRadius to Linear.
      • Set easeAngle to 'Linear'
    "},{"location":"curve-spiral/#properties","title":"Properties","text":"
    • Origin point
      • Get
        var startX = spiral.startX;\nvar startY = spiral.startY;\nvar endX = spiral.endX;\nvar endY = spiral.endY;\n
        or
        var startPoint = spiral.p0; // {x, y}\nvar endPoint = spiral.p1; // {x, y}\n
      • Set
        spiral.setStartX(x);\nspiral.setStartY(y);\nspiral.setEndX(x);\nspiral.setEndY(y);\n
        or
        spiral.startX = x;\nspiral.startY = y;\nspiral.endX = x;\nspiral.endY = y;\n
    • Radius
      • Get
        var startXRadius = spiral.startXRadius;\nvar startYRadius = spiral.startYRadius;\nvar endXRadius = spiral.endXRadius;\nvar endYRadius = spiral.endYRadius;\n
      • Set
        spiral.setStartXRadius(startXRadius);\nspiral.setStartYRadius(startYRadius);\nspiral.setEndXRadius(endXRadius);\nspiral.setEndYRadius(endYRadius);\n
        or
        spiral.startXRadius = startXRadius;\nspiral.startYRadius = startYRadius;\nspiral.endXRadius = endXRadius;\nspiral.endYRadius = endYRadius;\n
    • Angle, in degrees.
      • Get
        var startAnlge = spiral.startAngle;\nvar endAnlge = spiral.endAngle;\n
      • Set
        spiral.setStartAngle(startAnlge);\nspiral.setEndAngle(endAnlge);\n
        spiral.startAngle = startAnlge;\nspiral.endAngle = endAnlge;\n
    "},{"location":"curve-spiral/#other-methods","title":"Other methods","text":"

    See path

    "},{"location":"cutjigsawimage/","title":"Cut Jigsaw Image","text":""},{"location":"cutjigsawimage/#introduction","title":"Introduction","text":"

    Cut image into pieces for jigsaw application.

    • Author: Rex
    • Method only
    "},{"location":"cutjigsawimage/#live-demos","title":"Live demos","text":"
    • Create pieces
    • Custom piece shape
    • Drag drop with pixelPerfect
    "},{"location":"cutjigsawimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"cutjigsawimage/#install-plugin","title":"Install plugin","text":""},{"location":"cutjigsawimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcutjigsawimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcutjigsawimageplugin.min.js', true);\n
    • Cut image into pieces
      var pieces = scene.plugins.get('rexcutjigsawimageplugin').gridCut(gameObject, config);\n
    "},{"location":"cutjigsawimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CutJigsawImagePlugin from 'phaser3-rex-plugins/plugins/cutjigsawimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCutJigsawImage',\nplugin: CutJigsawImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Cut image into pieces
      var pieces = scene.plugins.get('rexCutJigsawImage').gridCut(gameObjects, config);\n
    "},{"location":"cutjigsawimage/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import CutJigsawImage from 'phaser3-rex-plugins/plugins/cutjigsawimage.js';\n
    • Cut image into pieces
      var images = CutJigsawImage(gameObjects, config);\n
    "},{"location":"cutjigsawimage/#create-pieces","title":"Create pieces","text":"
    var pieces = scene.plugins.get('rexCutJigsawImage').gridCut(gameObject, {\npiecesKey: ,\ncolumns: , rows: ,\nedgeWidth: , edgeHeight: ,\nuseDynamicTexture: true,\n\n// drawShapeCallback: undefined,\n// edges: undefined,    \n\n// createImageCallback: undefined,\n// ImageClass: Phaser.GameObjects.Image,\n\n// originX: 0.5,\n// originY: 0.5,\n// add: true,\n// align: true,\n// objectPool: undefined\n});\n
    • gameObjects : Target game object which has a texture, ex Image, RenderTexture.
    • piecesKey : Store frame of each piece in this dynamic texture.
      • undefined : Use 'gameObjects.texture.key' + '_pieces' as texture key.
    • columns, rows : Cut texture in columns x rows grids
    • edgeWidth, edgeHeight : Padding around piece.
    • useDynamicTexture : Generate frame of pieces on dynamic texture or canvas texture.
      • true : Generate frame of pieces on dynamic texture. Default value.
      • false : Generate frame of pieces on canvas texture.
    • drawShapeCallback : Callback of creating piece shape
      • undefined : Use default piece shape.
      • A function object
        function(graphics, width, height, edgeWidth, edgeHeight, edgeMode) {\n}\n
        • graphics : Graphics game object, or canvas.
          • Draw piece shape on a Graphics game object, if useDynamicTexture is set to true
          • Draw piece shape on canvas, if useDynamicTexture is set to false
        • width, height : Frame size of this piece
        • edgeWidth, edgeHeigh : Padding around piece.
        • edgeMode :
          {\nleft: 0,   // 0|1|2\nright: 0,  // 0|1|2\ntop: 0,    // 0|1|2\nbottom: 0  // 0|1|2\n}\n
          • left, right, top, bottom
            • 0 : Flat edge
            • 1 : Convex edge
            • 2 : Concave edge
    • edges : edgeMode in a 2d array for each piece
      • undefined : Create random edges for each piece.
    • createImageCallback : Custom callback to return an image game object, optional.
      function(scene, texture, frame) {\nreturn gameObject;\n}\n
      • texture : A texture object.
      • frame : Frame name.
    • ImageClass : Create image game object from this class. Default value is built-in Image class. Used when createImageCallback is undefined.
    • originX, originY : Origin of created image game objects
    • add :
      • true : Add these created image game objects to scene. Default value.
      • false : Don't add created image game objects to scene.
    • align :
      • true : Align position of created image game objects to target game object (gameObjects). Default value when add is set to true.
      • false : Don't set position of created image game objects. Default value when add is set to false.
    • objectPool : An array of image game objects, will reuse image game objects from this pool. Optional.
    • pieces : Return piece game objects.
      • Size of any piece game object (frame size) :
        • width : (gameObjects.width / columns) + (2 * edgeWidth)
        • height : (gameObjects.height / rows) + (2 * edgeHeigh)
      • Frame name of a piece game object : columnIndex + ',' + rowIndex
    "},{"location":"datamanager/","title":"Built-in data","text":""},{"location":"datamanager/#introduction","title":"Introduction","text":"

    Store data in key-value pairs, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"datamanager/#usage","title":"Usage","text":""},{"location":"datamanager/#write","title":"Write","text":""},{"location":"datamanager/#set-value","title":"Set value","text":"
    • Set value
      parent.data.set(key, value);\n
      or
      parent.data.values[key] = value;\n
      • key : Key string.
    • Increase number value. If the key doesn't already exist in the Data Manager then it is increased from 0.
      parent.data.inc(key, data);\n
      or
      parent.data.values[key] += value;\n
      • data : The value to increase.
    • Toggle boolean value. If the key doesn't already exist in the Data Manager then it is toggled from false.
      parent.data.toggle(key);\n
      or
      parent.data.values[key] = !parent.data.values[key];\n
    "},{"location":"datamanager/#set-values","title":"Set values","text":"
    parent.data.set(data);    // data: {key:value, ...}\n
    "},{"location":"datamanager/#merge-values","title":"Merge values","text":"
    parent.data.merge(data);  // data: {key:value, ...}\nparent.data.merge(data, false);  // won't overwrite existed keys\n
    "},{"location":"datamanager/#events","title":"Events","text":"

    Fires setdata event when a value is first set.

    parent.data.events.on('setdata', function(parent, key, value){ /* ... */ });\n

    Fires changedata, and changedata- + key events when a value is set that already exists.

    parent.data.events.on('changedata', function(parent, key, value, previousValue){ /* ... */ });\n
    parent.data.events.on('changedata-' + key, function(parent, value, previousValue){ /* ... */ });\n
    "},{"location":"datamanager/#read","title":"Read","text":""},{"location":"datamanager/#get-value","title":"Get value","text":"

    var value = parent.data.get(key);\n
    or
    var value = parent.data.values[key];\n

    "},{"location":"datamanager/#get-values","title":"Get values","text":"
    var values = parent.data.get(keys); // values: [value, value, ...], keys: [key, key, ...]\n
    "},{"location":"datamanager/#get-all-values","title":"Get all values","text":"
    var allValues = parent.data.getAll();  // return a copy of data\n
    "},{"location":"datamanager/#query","title":"Query","text":"

    Using string.match() to pick matched keys.

    var result = parent.data.query(rgExp);\n
    "},{"location":"datamanager/#remove","title":"Remove","text":""},{"location":"datamanager/#remove-key","title":"Remove key","text":"
    parent.data.remove(key);\n
    "},{"location":"datamanager/#remove-keys","title":"Remove keys","text":"
    parent.data.remove(keys);  // keys: [key, key, ...]\n
    "},{"location":"datamanager/#pop-key","title":"Pop key","text":"
    var value = parent.data.pop(key);\n

    Get and remove that key.

    "},{"location":"datamanager/#delet-all-keys","title":"Delet all keys","text":"

    Delete all data in this Data Manager and unfreeze it.

    parent.data.reset();\n
    "},{"location":"datamanager/#events_1","title":"Events","text":"

    Fires removedata event when a key is removed.

    parent.data.events.on('removedata', function(parent, key, value){ /* ... */ });\n
    "},{"location":"datamanager/#freeze","title":"Freeze","text":"
    var isFrozen = parent.data.freeze;\nparent.data.freeze = true;\n

    No changes can be written to it.

    "},{"location":"datamanager/#has-key","title":"Has key","text":"
    var hasKey = parent.data.has(key);\n
    "},{"location":"datamanager/#for-each-key","title":"For each key","text":"
    parent.data.each(function(parent, key, value){\n/* ... */\n}, scope);\n
    "},{"location":"datamanager/#count-of-data","title":"Count of data","text":"
    var cnt = parent.data.count;\n
    "},{"location":"datamanager/#reset","title":"Reset","text":"

    Reset status and clear all keys.

    parent.data.reset()\n
    "},{"location":"date/","title":"Date","text":""},{"location":"date/#introduction","title":"Introduction","text":"

    Get current date or unix-timestamp.

    • Author: Built-in javascript function
    "},{"location":"date/#usage","title":"Usage","text":"

    Reference

    "},{"location":"date/#create-instance","title":"Create instance","text":"
    var d = new Date();\nvar d = new Date(timestamp);\nvar d = new Date(dateString);\nvar d = new Date(year, month, day, hours, minutes, seconds, milliseconds);\n
    "},{"location":"date/#get-date","title":"Get date","text":"
    var year = d.getFullYear();    // returns the year\nvar month = d.getMonth();      // returns the month (0-11)\nvar date = d.getDate();        // returns the day of the month (1-31)\nvar day = d.getDay();          // returns the day of the week\nvar hour = d.getHours();       // returns the hour (0-23)\nvar min = d.getMinutes();      // returns the minutes (0-59)\nvar sec = d.getSeconds();      // returns the seconds (0-59)\nvar ms = d.getMilliseconds();  // returns the milliseconds (0-999)\n
    "},{"location":"date/#get-unix-timestamp","title":"Get unix-timestamp","text":"
    var timestamp = d.getTime();;   // unix-timestamp in milliseconds\n

    or

    var timestamp = Date.now();;    // unix-timestamp in milliseconds\n
    "},{"location":"date/#to-string","title":"To string","text":"
    var s = d.toLocaleString();   // locale conventions\nvar iso = d.toISOString();    // ISO standard\n
    "},{"location":"device/","title":"Device","text":""},{"location":"device/#introduction","title":"Introduction","text":"

    Get information of device, built-in properties of phaser.

    • Author: Richard Davey
    "},{"location":"device/#usage","title":"Usage","text":""},{"location":"device/#os","title":"OS","text":"
    • Platform
      scene.sys.game.device.os.android      // Is running on android?\nscene.sys.game.device.os.chromeOS     // Is running on chromeOS?\nscene.sys.game.device.os.cordova      // Is the game running under Apache Cordova?\nscene.sys.game.device.os.crosswalk    // Is the game running under the Intel Crosswalk XDK?\nscene.sys.game.device.os.desktop      // Is running on a desktop?\nscene.sys.game.device.os.ejecta       // Is the game running under Ejecta?\nscene.sys.game.device.os.electron     // Is the game running under GitHub Electron?\nscene.sys.game.device.os.iOS          // Is running on iOS?\nscene.sys.game.device.os.iPad         // Is running on iPad?\nscene.sys.game.device.os.iPhone       // Is running on iPhone?\nscene.sys.game.device.os.kindle       // Is running on an Amazon Kindle?\nscene.sys.game.device.os.linux        // Is running on linux?\nscene.sys.game.device.os.macOS        // Is running on macOS?\nscene.sys.game.device.os.node         // Is the game running under Node.js?\nscene.sys.game.device.os.nodeWebkit   // Is the game running under Node-/Webkit?\nscene.sys.game.device.os.webApp       // Set to true if running as a WebApp, i.e. within a WebView\nscene.sys.game.device.os.windows      // Is running on windows?\nscene.sys.game.device.os.windowsPhone // Is running on a Windows Phone?\n
    • Major version number of ios
      var version = scene.sys.game.device.os.iOSVersion;\n
    • Pixel-ratio of the host device
      var pixelRatio = scene.sys.game.device.os.pixelRatio;\n
    "},{"location":"device/#browser","title":"Browser","text":"
    • Platform
      scene.sys.game.device.browser.chrome       // Is running in Chrome?\nscene.sys.game.device.browser.edge         // Is running in Microsoft Edge browser?\nscene.sys.game.device.browser.firefox      // Is running in Firefox?\nscene.sys.game.device.browser.ie           // Is running in Internet Explorer 11 or less (not Edge)?\nscene.sys.game.device.browser.mobileSafari // Is running in Mobile Safari?\nscene.sys.game.device.browser.opera        // Is running in Opera?\nscene.sys.game.device.browser.safari       // Is running in Safari?\nscene.sys.game.device.browser.silk         // Is running in the Silk browser (as used on the Amazon Kindle)?\nscene.sys.game.device.browser.trident       // Is running a Trident version of Internet Explorer (IE11+)?\n
    • Version
      var version = scene.sys.game.device.browser.chromeVersion;\nvar version = scene.sys.game.device.browser.firefoxVersion;\nvar version = scene.sys.game.device.browser.ieVersion;\nvar version = scene.sys.game.device.browser.safariVersion;\nvar version = scene.sys.game.device.browser.tridentVersion;\n
    "},{"location":"device/#audio","title":"Audio","text":"
    var flac = scene.sys.game.device.audio.flac;\nvar aac = scene.sys.game.device.audio.aac;\nvar dolby = scene.sys.game.device.audio.dolby;\nvar m4a = scene.sys.game.device.audio.m4a;\nvar mp3 = scene.sys.game.device.audio.mp3;\nvar ogg = scene.sys.game.device.audio.ogg;\nvar opus = scene.sys.game.device.audio.opus;\nvar wav = scene.sys.game.device.audio.wav;\nvar webm = scene.sys.game.device.audio.webm;\nvar webAudio = scene.sys.game.device.audio.webAudio;\nvar audioData = scene.sys.game.device.audio.audioData;\n
    "},{"location":"device/#video","title":"Video","text":"
    var h264Video = scene.sys.game.device.video.h264;  // Can this device play h264 mp4 video files?\nvar hlsVideo = scene.sys.game.device.video.hls;    // Can this device play hls video files?\nvar mp4Video = scene.sys.game.device.video.mp4;    // Can this device play h264 mp4 video files?\nvar m4vVideo = scene.sys.game.device.video.m4v;    // Can this device play m4v (typically mp4) video files?\nvar oggVideo = scene.sys.game.device.video.ogg;    // Can this device play ogg video files?\nvar vp9Video = scene.sys.game.device.video.vp9;    // Can this device play vp9 video files?\nvar webmVideo = scene.sys.game.device.video.webm;  // Can this device play webm video files?\n
    "},{"location":"dialog-quest/","title":"Dialog-quest","text":""},{"location":"dialog-quest/#introduction","title":"Introduction","text":"

    Flow control of question manager with a dialog.

    • Author: Rex
    • Template
    "},{"location":"dialog-quest/#live-demos","title":"Live demos","text":"
    • Branch
    • Shuffle
    "},{"location":"dialog-quest/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"dialog-quest/#install-plugin","title":"Install plugin","text":""},{"location":"dialog-quest/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');    scene.load.script('rexdialogquest', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdialogquest.min.js');\n
    • Add dialog and quest object
      var dialog = scene.rexUI.add.dialog(config); var quest = new rexdialogquest({\ndialog: dialog,\n// ...\n});\n
    "},{"location":"dialog-quest/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nimport DialogQuest from 'phaser3-rex-plugins/templates/dialog-quest/DialogQuest.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dialog and quest object
      var dialog = scene.rexUI.add.dialog(config); var quest = new DialogQuest({\ndialog: dialog,\n// ...\n});\n
    "},{"location":"dialog-quest/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Dialog } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\nimport DialogQuest from 'phaser3-rex-plugins/templates/dialog-quest/DialogQuest.js';\n
    • Add dialog object
      var dialog = new Dialog(scene, config);\nscene.add.existing(dialog);\nvar quest = new DialogQuest({\ndialog: dialog,\n// ...\n});\n
    "},{"location":"dialog-quest/#create-dialog-quest-object","title":"Create dialog-quest object","text":"
    var quest = new DialogQuest({\ndialog: dialog,\n\nquestions: undefined,\n// format: undefined,\n// delimiter: ',',\n// types: {\n//     question: 'q',\n//     option: '',\n// },\n// convert: true,\n\nquest: true,\n// quest: {\n//     shuffleQuestions: false,\n//     shuffleOptions: false,\n// }\n});\n
    • dialog : A dialog game object.
      • UI plugin does not included in this template, install it before creating a dialog game object.
      • Reuse/update dialog game object for each question.
      • The number of choice buttons should be equal or larger than the maximun number of options.
    • Other parameters : See quest
    "},{"location":"dialog-quest/#flow-chart","title":"Flow chart","text":"
    graph TB\n\nStart[\"quest.start()\"] --> EventUpdateChoice[\"quest.emit('update-choice', choice, option, quest)<br>----<br>Update each choice button via question.option[i]\"]\n\nEventUpdateChoice --> EventUpdateDialog[\"quest.emit('update-dialog', dialog, question, quest)<br>----<br>Update dialog, action button via question\"]\n\nEventUpdateDialog --> EventClickChoice[\"quest.emit('click-choice', choice, dialog, quest)<br>----<br>Click any choice button\"]\n\nEventClickChoice --> EventClickAction[\"quest.emit('click-action', action, dialog, quest)<br>----<br>Click any action button\"]\n\nEventClickAction --> IsLast{\"quest.isLast()\"}\nEventClickChoice --> IsLast\n\nIsLast --> |No| Next[\"quest.next()\"]\nIsLast --> |Yes| Complete(\"Complete\")\n\nNext --> EventUpdateChoice
    "},{"location":"dialog-quest/#events","title":"Events","text":"
    • Update dialog events
      • Update each choice button via question.option[i]
        quest.on('update-choice', function(choice, option, quest){\n}, scope);\n
        • choice : Choice button game object.
          • Unused choice button game object will be hideen.
        • option : Option object.
        • quest : Quest object.
      • Update dialog, action buttos via question
        quest.on('update-dialog', function(dialog, question, quest){\n}, scope);\n
        • dialog : Dialog game object.
          • Call dialog.layout() if needs.
        • question : Question object.
        • quest : Quest object.
    • Button clicking events
      • Click choice button
        quest.on('click-choice', function(choice, dialog, quest) {\n\n}, scope);\n
        • choice : Clicked choice button game object.
        • dialog : Dialog game object.
        • quest : Quest object.
      • Click choice button
        quest.on('click-action', function(action, dialog, quest) {\n\n}, scope);\n
        • choice : Clicked action button game object.
        • dialog : Dialog game object.
        • quest : Quest object.
    "},{"location":"dialog-quest/#quest-methods","title":"Quest methods","text":"
    • Start quest
      quest.start();\n
    • Next quest
      quest.next();\n
      or
      quest.next(key);\n
    • Is last question
      var isLast = quest.isLast();\n
    • Remove all questions
      quest.removeAll();\n
    • Add questions
      quest.add(questions, config);\n
      • questions : An array of question objects, or a csv string. See questions section in Create question manager instance section.
      • config :
        • delimiter : Delimiter of csv string. Default value is ','
        • types : Define value of row type.
          • types.question : Define value of question row. Default value is q.
          • types.option : Define value of option row. Default value is '' (empty string).
        • convert : Convert string values to other types.
          • Default type converting : Convert string to number, boolean, null, or string
            • '0', '1', ... (number string) -> number
            • 'true', or 'false' -> true or false
            • '' (empty string) -> null
            • Others : string.
          • Set false to ignore types converting, i.e. all values are string.
          • A custom type converting function :
            function(stringValue, key) {\n// return value;\n}\n
    "},{"location":"dialog-quest/#private-data-methods","title":"Private data methods","text":"
    • Get data
      var value = quest.getData(key, defaultValue);\n
    • Get all data
      var data = quest.getData();\n
    • Set value
      quest.setData(key, value);\n
    • Increase value
      quest.incData(key, inc, defaultValue);\n
    • Multiple value
      quest.mulData(key, mul, defaultValue);\n
    • Clear all data
      quest.clearData();\n
    "},{"location":"distance/","title":"Distance","text":""},{"location":"distance/#introduction","title":"Introduction","text":"

    Get distance, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"distance/#usage","title":"Usage","text":""},{"location":"distance/#distance","title":"Distance","text":"
    • Get distance between 2 points
      var d = Phaser.Math.Distance.Between(x1, y1, x2, y2);\n
      or
      var d = Phaser.Math.Distance.BetweenPoints(a, b); // a, b: {x, y}\n
    • Get squared distance
      var d = Phaser.Math.Distance.BetweenPointsSquared(a, b); // a, b: {x, y}\n
    • Get Chebyshev distance (the maximum of the horizontal and vertical distances)
      var d = Phaser.Math.Distance.Chebyshev(x1, y1, x2, y2);\n
    • Get snake distance(i.e. rectilinear distance, Manhattan distance, the sum of the horizontal and vertical distance)
      var d = Phaser.Math.Distance.Snake(x1, y1, x2, y2);\n
    • Get power distance (the sum of the horizontal power distance and vertical power distance)
      var d = Phaser.Math.Distance.Power(x1, y1, x2, y2);\n
    "},{"location":"distance/#speed","title":"Speed","text":"
    • Get speed
      var d = Phaser.Math.GetSpeed(distance, time);\n
      • distance : The distance to travel in pixels.
      • time : The time, in ms, to cover the distance in.
    "},{"location":"domelement/","title":"DOM element","text":""},{"location":"domelement/#introduction","title":"Introduction","text":"

    Carry DOM element, built-in game object of phaser.

    Limitations

    Dom elements appear above or below your game canvas. You cannot blend them into the display list, meaning you cannot have a DOM Element, then a Sprite, then another DOM Element behind it.

    • Author: Richard Davey
    "},{"location":"domelement/#usage","title":"Usage","text":""},{"location":"domelement/#configuration","title":"Configuration","text":"
    • Set parent to divId
    • Set dom.createContainer to true.
    var config = {\n// ...\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n}\nvar game = new Phaser.Game(config);\n
    "},{"location":"domelement/#add-dom-element-object","title":"Add DOM element object","text":""},{"location":"domelement/#add-html-string","title":"Add html string","text":"
    1. Load html string in preload stage
      scene.load.html(key, url);\n
      Reference: load html
    2. Add DOM element object with html string from cache
      var domElement = scene.add.dom(x, y).createFromCache(key);  // elementType = 'div'\n// var domElement = scene.add.dom(x, y).createFromCache(key, elementType);\n
      • Add DOM element object with html string
        var domElement = scene.add.dom(x, y).createFromHTML(htmlString);  // elementType = 'div'\n// var domElement = scene.add.dom(x, y).createFromHTML(htmlString, elementType);\n
        • `elementType : The tag name of the element into which all of the html will be inserted. Defaults to a plain div tag.
    "},{"location":"domelement/#create-element","title":"Create element","text":"
    scene.add.dom(x, y).createElement(tagName);\n// scene.add.dom(x, y).createElement(tagName, style, innerText);\n
    • tagName : A string that specifies the type of element to be created. For example, 'div'
    • style : Either a DOMString that holds the CSS styles to be applied to the created element, or an object the styles will be readyfrom. Optional.
    • innerText : A DOMString that holds the text that will be set as the innerText of the created element. Optional.
    "},{"location":"domelement/#add-existing-dom","title":"Add existing DOM","text":"
    1. Create DOM element
      var el = document.createElement('div');\n// el.style = '...';\n// el.innerText = '...';\n
    2. Add to scene
      var domElement = scene.add.dom(x, y, el);\n// var domElement = scene.add.dom(x, y, el, style, innerText);\n
    "},{"location":"domelement/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDOMElement extends Phaser.GameObjects.DOMElement {\nconstructor(scene, x, y, element, style, innerText) {\nsuper(scene, x, y, element, style, innerText);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var domElement = new MyDOMElement(scene, x, y, element);\n
    "},{"location":"domelement/#event-of-dom-element","title":"Event of DOM element","text":"
    • Add listener
      domElement.addListener(eventName);\n
      • eventName : Event name
        • Single string. ex. 'click'
        • Event name joined with ' '
    • Add event handler
      var callback = function(event) {\n// event.target.name\n};\ndomElement.on(eventName, callback, scope);\n// domElement.once(eventName, callback, scope);\n
      Reference: event emitter
    • Remove listener
      domElement.removeListener(eventName);\n
      • eventName : Event name
        • Single string. ex. 'click'
        • Event name joined with ' '
    "},{"location":"domelement/#get-child","title":"Get child","text":"
    • Get child by name
      var child = domElement.getChildByName(name)\n
    • Get child by id
      var child = domElement.getChildByID(id)\n
    • Get child by property
      var child = domElement.getChildByProperty(property, value)\n
    "},{"location":"domelement/#set-inner-html-string","title":"Set inner html string","text":"
    scene.setHTML(html);\n

    or

    scene.setText(html);\n
    "},{"location":"domelement/#dom-element","title":"DOM Element","text":"

    Each DOM element object has 1 DOM element.

    • Set
      domElement.setElement(el);\n// domElement.setElement(el, style, innerText);\n
    • Get
      var el = domElement.node;\n
    "},{"location":"domelement/#depth","title":"Depth","text":"
    domElement.setDepth(value);\n
    "},{"location":"domelement/#set-size","title":"Set size","text":"
    var style = domElement.node.style;\nstyle.width = width + 'px';\nstyle.height = height + 'px';\ndomElement.updateSize();\n
    "},{"location":"domelement/#skew","title":"Skew","text":"
    domElement.setSkew(x, y);\n

    or

    domElement.skewX = x;\ndomElement.skewY = y;\n
    "},{"location":"domelement/#rotate-3d","title":"Rotate 3d","text":"

    The rotate3d() CSS function defines a transformation that rotates an element around a fixed axis in 3D space, without deforming it.

    domElement.rotate3d.set(x, y, z, a);\n

    or

    domElement.rotate3d.x = x;\ndomElement.rotate3d.y = y;\ndomElement.rotate3d.z = z;\ndomElement.rotate3d.w = a;\n

    Reference

    "},{"location":"domelement/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"
    1. DOM game object always put above game canvas, i.e. DOM game object will render above any other kind of game object.
    2. DOM game object will receive touch event even if it is not the first touched game object.
    3. P3's 'pointerdown', 'pointerup' events will be fired above/under DOM game object.
    4. P3's 'pointermove' event won't be fired above/under DOM game object, except
      • Setting DOM game object to be invisilbe.
      • Assign input.mouse.target parameter of game config.
    5. DOM game object only can be displayed by main camera. i.e. dom game object can't add to other camera.
    "},{"location":"domelement/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"drag/","title":"Drag","text":""},{"location":"drag/#introduction","title":"Introduction","text":"

    Drag game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"drag/#live-demos","title":"Live demos","text":"
    • Try dragging
    "},{"location":"drag/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"drag/#install-plugin","title":"Install plugin","text":""},{"location":"drag/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdragplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdragplugin.min.js', true);\n
    • Add drag behavior
      var drag = scene.plugins.get('rexdragplugin').add(gameObject, config);\n
    "},{"location":"drag/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DragPlugin from 'phaser3-rex-plugins/plugins/drag-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDrag',\nplugin: DragPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add drag behavior
      var drag = scene.plugins.get('rexDrag').add(gameObject, config);\n
    "},{"location":"drag/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Drag from 'phaser3-rex-plugins/plugins/drag.js';\n
    • Add drag behavior
      var drag = new Drag(gameObject, config);\n
    "},{"location":"drag/#create-instance","title":"Create instance","text":"
    var drag = scene.plugins.get('rexDrag').add(gameObject, {\n// enable: true,\n// axis: 0,      //0|'both'|'h&v'|1|'horizontal'|'h'|2|'vertical'|'v'\n// rotation: Phaser.Math.DegToRad(45)  // axis rotation in rad\n});\n
    • enable : Set false to disable input events.
    • axis :
      • 'both','h&v', 'x&y', or 0 : Dragging on all directions.
      • 'horizontal','h', 'x', or 1 : Dragging on horizontal/x axis.
      • 'vertical','v', 'y', or 2 : Dragging on vertical/y axis.
    • rotation : Axis rotation in rad, available in horizontal or vertical axis mode.
    "},{"location":"drag/#events","title":"Events","text":"

    Built-in dragging events

    gameObject.on('dragstart', function(pointer, dragX, dragY){ /*...*/ });\ngameObject.on('drag', function(pointer, dragX, dragY){ /*...*/ });\ngameObject.on('dragend', function(pointer, dragX, dragY, dropped){ /*...*/ });\n
    "},{"location":"drag/#enable","title":"Enable","text":"
    • Get
      var enable = drag.enable;  // enable: true, or false\n
    • Set
      drag.setEnable(enable);  // enable: true, or false\n// drag.enable = enable;\n
    • Toggle
      drag.toggleEnable();\n
    "},{"location":"drag/#get-dragging-state","title":"Get dragging state","text":"
    var isDragging = drag.isDragging;\n
    "},{"location":"drag/#set-rotation-of-axis","title":"Set rotation of axis","text":"
    drag.setAxisRotation(rad);\n// drag.axisRotation = rad;\n
    "},{"location":"drag/#set-axis-mode","title":"Set axis mode","text":"
    drag.setAxisMode(axis);\n
    • axis :
      • 'both','h&v', 'x&y', or 0 : Dragging on all directions.
      • 'horizontal','h', 'x', or 1 : Dragging on horizontal/x axis.
      • 'vertical','v', 'y', or 2 : Dragging on vertical/y axis.
    "},{"location":"drag/#try-drag","title":"Try drag","text":"

    Game object will be dragged if there is any point above it.

    drag.drag();\n
    "},{"location":"drag/#drop","title":"Drop","text":"

    Game object will be dropped(dragend) manually.

    drag.dragend();\n
    "},{"location":"dragrotate/","title":"Drag rotate","text":""},{"location":"dragrotate/#introduction","title":"Introduction","text":"

    Get dragging angle around a specific point.

    • Author: Rex
    • Member of scene
    "},{"location":"dragrotate/#live-demos","title":"Live demos","text":"
    • Spin-button
    • Origin game object
    "},{"location":"dragrotate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"dragrotate/#install-plugin","title":"Install plugin","text":""},{"location":"dragrotate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdragrotateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdragrotateplugin.min.js', true);\n
    • Add drag-rotate input
      var dragRotate = scene.plugins.get('rexdragrotateplugin').add(scene, config);\n
    "},{"location":"dragrotate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DragRotatePlugin from 'phaser3-rex-plugins/plugins/dragrotate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDragRotate',\nplugin: DragRotatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add drag-rotate input
      var dragRotate = scene.plugins.get('rexDragRotate').add(scene, config);\n
    "},{"location":"dragrotate/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import DragRotate from 'phaser3-rex-plugins/plugins/dragrotate.js';\n
    • Add drag-rotate input
      var dragRotate = new DragRotate(scene, config);\n
    "},{"location":"dragrotate/#create-instance","title":"Create instance","text":"
    var dragRotate = scene.plugins.get('rexDragRotate').add(scene, {\norigin: undefined,\nx: 0,\ny: 0,\n\nmaxRadius: undefined\nminRadius: 0,\n\n// enable: true,\n});\n
    • origin : Use game object's position as origin point.
      • undefined : Use fixed origin position.
    • x, y : Fixed orgin point, in world position.
    • maxRadius, minRadius : Dragging is valid when distance between touch pointer and origin position is larger then minRadius and less then maxRadius.
    • enable : Set false to disable input events.
    "},{"location":"dragrotate/#enable","title":"Enable","text":"
    • Get
      var enable = dragRotate.enable;  // enable: true, or false\n
    • Set
      dragRotate.setEnable(enable);  // enable: true, or false\n// dragRotate.enable = enable;\n
    • Toggle
      dragRotate.toggleEnable();\n
    "},{"location":"dragrotate/#origin-point","title":"Origin point","text":"
    • Use game object's position as origin point.
      dragRotate.setOrigin(gameObject);\n
    • Fixed orgin point
      • Get
        var x = dragRotate.x;\nvar y = dragRotate.y;\n
      • Set
        dragRotate.setOrigin(x, y);\n
        or
        dragRotate.setOrigin(pointer); // pointer: {x, y}\n

    Note

    Parameter (x,y) is world position, not camera position.

    "},{"location":"dragrotate/#radius","title":"Radius","text":"
    • Get
      var maxRadius = dragRotate.maxRadius;\nvar minRadius = dragRotate.minRadius;\n
    • Set
      dragRotate.setRadius(maxRadius, minRadius);\n
    "},{"location":"dragrotate/#get-dragging-state","title":"Get dragging state","text":"
    var state = dragRotate.state;\n
    • 0 : No touch pointer
    • 1 : Catch touch pointer
      • Fire 'dragstart' event when catching touch pointers.
      • Fire 'drag' event when any catched touch pointer moved.
      • Fire 'dragend' event when releasing catched touch pointer.
    "},{"location":"dragrotate/#is-drag","title":"Is drag","text":"
    var isDrag = dragRotate.isDrag;\n

    Return true if (dragRotate.state === 1) and catched touch pointer just moved.

    "},{"location":"dragrotate/#drag-cancel","title":"Drag cancel","text":"
    dragRotate.dragCancel();\n
    "},{"location":"dragrotate/#events","title":"Events","text":""},{"location":"dragrotate/#on-dragging","title":"On dragging","text":"
    • On dragging
      dragRotate.on('drag', function(dragRotate) {\n// gameObject.rotation += dragRotate.deltaRotation;\n}, scope);\n
      • dragRotate.deltaRotation : Dragging angle around origin position, in radians.
        • Add to gameObject.rotation to spin target game object.
          gameObject.rotation += dragRotate.deltaRotation;\n
      • dragRotate.deltaAngle : Dragging angle around origin position, in degrees.
        • Add to gameObject.angle to spin target game object.
          gameObject.angle += dragRotate.deltAangle;\n
      • dragRotate.cw : Return true if dragging is dragrotate-wise.
      • dragRotate.ccw : Return true if dragging is counter-dragrotate-wise.
    "},{"location":"dragrotate/#on-drag-start-on-drag-end","title":"On drag start, on drag end","text":"
    • On drag touch pointer start, fired when catching touch pointer.
      dragRotate.on('dragstart', function(dragRotate) {\n\n}, scope);\n
    • On drag touch pointer end, fired when releasing the catched touch pointer.
      dragRotate.on('dragend', function(dragRotate) {\n\n}, scope);\n
    "},{"location":"dragrotate/#catched-touch-pointer","title":"Catched touch pointer","text":"
    • Pointer, available when state is 1
      var pointer = dragRotate.pointer;\n
      • World position of pointer
        var x = pointer.worldX;\nvar y = pointer.worldY;\n
    "},{"location":"dropdown/","title":"Drop down","text":""},{"location":"dropdown/#introduction","title":"Introduction","text":"

    Drop down game object below another target game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"dropdown/#live-demos","title":"Live demos","text":"
    • Drop-down
    "},{"location":"dropdown/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"dropdown/#install-plugin","title":"Install plugin","text":""},{"location":"dropdown/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdropdownplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdropdownplugin.min.js', true);\n
    • Add drop-down behavior
      var dropDown = scene.plugins.get('rexdropdownplugin').add(gameObject, config);\n
    "},{"location":"dropdown/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add drop-down behavior
      var dropDown = scene.plugins.get('rexDropDown').add(gameObject, config);\n
    "},{"location":"dropdown/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import DropDownBehavior from 'phaser3-rex-plugins/plugins/dropdown.js';\n
    • Add drop-down behavior
      var dropDown = new DropDownBehavior(gameObject, config);\n
    "},{"location":"dropdown/#create-instance","title":"Create instance","text":"
    var dropDown = scene.plugins.get('rexDropDown').add(gameObject, {        // expandDirection: 0,\n// alignTargetX: \n// alignTargetY: \n// alignOffsetX: \n// alignOffsetY: \n// bounds:\n\n// When to close dropdown dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n\n// duration: {\n//     in: 200,\n//     out: 200\n// }\n\n// transitIn: undefined,\n// transitOut: undefined,\n\n// destroy: true\n});\n
    • expandDirection : Expand direction
      • 0, 'down' : Expand game object down. i.e. game object will put below target game object. Defatut behavior.
      • 1, 'up' : Expand game object up. i.e. game object will put above target game object.
    • alignTargetX : Align left side game object to left side of target game object
    • alignTargetY : Required parameter
      • Align top side game object to bottom side of target game object, if expandDirection is 0('down').
      • Align bottom side game object to top side of target game object, if expandDirection is 1('up').
    • alignOffsetX, alignOffsetY : Extra position offset. Default value ares 0, 0.
    • bounds : Put game object below target game object if bottom of game object is inside bounds (Rectangle)
      • undefined : Use viewport as bounds
      • Rectangle
    • touchOutsideClose : Set to true to close dropdown dialog when clicking out side of gameObject.
      • Default value is false. Will be set to false if anyTouchClose is set to true.
    • anyTouchClose : Set to true to close dropdown dialog when any clicking.
      • Default value is false.
    • duration : Duration of transition-in, hold, trantion-out.
      • duration.in : Duration of transition-in (open dialog).
        • 0 : No transition, open dialog immediately.
      • duration.out : Duration of transition-out (close dialog).
        • 0 : No transition, close dialog immediately.
    • transitIn : Tween behavior of opening dialog. Default behavior is scale up the height of game object.
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • transitOut : Tween behavior of closing dialog. Default behavior is scale down the height of game
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • destroy
      • true : Destroy dialog when closing completed. Default behavior.
      • fasle : Don't destroy dialog.
    "},{"location":"dropdown/#close","title":"Close","text":"
    dropDown.requestClose();\n// dropDown.requestClose();\n
    "},{"location":"dropdown/#events","title":"Events","text":"
    • On opened dialog
      dropDown.on('open', function(gameObject, dropdown) {\n})\n
    • On closed dialog
      dropDown.on('close', function(closeEventData) {\n})\n
    "},{"location":"dynamic-texture/","title":"Dynamic texture","text":""},{"location":"dynamic-texture/#introduction","title":"Introduction","text":"

    Canvas Dynamic Texture stored in texture cache, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"dynamic-texture/#usage","title":"Usage","text":""},{"location":"dynamic-texture/#create-dynamic-texture","title":"Create dynamic texture","text":"
    var texture = scene.textures.addDynamicTexture(key, width, height);\n

    Disable texture.isSpriteTexture if this texture is not a base texture for Sprite Game Objects.

    texture.setIsSpriteTexture(false);\n// texture.isSpriteTexture = false;\n
    "},{"location":"dynamic-texture/#set-size","title":"Set size","text":"
    texture.setSize(width, height);\n
    "},{"location":"dynamic-texture/#fill-color","title":"Fill color","text":"
    texture.fill(rgb);\n// texture.fill(rgb, alpha, x, y, width, height);\n
    • rgb : The number color to fill this Dynamic Texture with.
    • alpha : The alpha value used by the fill. Default value is 1.
    • x, y, width, height : The area of the fill rectangle. Default behavior is filling whole size.
    "},{"location":"dynamic-texture/#clear","title":"Clear","text":"
    texture.clear();\n
    texture.clear(x, y, width, height);\n
    "},{"location":"dynamic-texture/#draw-game-object","title":"Draw game object","text":"
    texture.draw(entries);\n// texture.draw(entries,x, y);\n// texture.draw(entries, x, y, alpha, tint);\n
    • entries :
      • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
      • Tilemap Layers.
      • A Group. The contents of which will be iterated and drawn in turn.
      • A Container. The contents of which will be iterated fully, and drawn in turn.
      • A Scene Display List. Pass in Scene.children to draw the whole list.
      • Another Dynamic Texture, or a Render Texture.
      • A Texture Frame instance.
      • A string. This is used to look-up the texture from the Texture Manager.
    • x, y : The x/y position to draw the Frame at, or the offset applied to the object.
      • If the object is a Group, Container or Display List, the coordinates are added to the positions of the children.
      • For all other types of object, the coordinates are exact.
    • alpha, tint : Only used by Texture Frames.
      • Game Objects use their own alpha and tint values when being drawn.
    "},{"location":"dynamic-texture/#erase","title":"Erase","text":"
    texture.erase(entries);\n// texture.erase(entries, x, y);\n
    • entries :
      • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
      • Tilemap Layers.
      • A Group. The contents of which will be iterated and drawn in turn.
      • A Container. The contents of which will be iterated fully, and drawn in turn.
      • A Scene Display List. Pass in Scene.children to draw the whole list.
      • Another Dynamic Texture, or a Render Texture.
      • A Texture Frame instance.
      • A string. This is used to look-up the texture from the Texture Manager.
    • x, y : The x/y position to draw the Frame at, or the offset applied to the object.
      • If the object is a Group, Container or Display List, the coordinates are added to the positions of the children.
      • For all other types of object, the coordinates are exact.
    "},{"location":"dynamic-texture/#draw-frame","title":"Draw frame","text":"
    texture.stamp(key, frame, x, y, {\nalpha: 1,\ntint: 0xffffff,\nangle: 0,\nrotation: 0,\nscale: 1,\nscaleX: 1,\nscaleY: 1,\noriginX: 0.5,\noriginY: 0.5,\nblendMode: 0,\nerase: false,\nskipBatch: false\n})\n

    or

    texture.drawFrame(key, frame, x, y);\n// texture.drawFrame(key, frame, x, y, alpha, tint);\n
    • x, y : Top-left position
    "},{"location":"dynamic-texture/#draw-repeat-frames","title":"Draw repeat frames","text":"
    • Repeat frames full of size
      texture.repeat(key, frame);\n
    • Repeat in an area
      texture.repeat(key, frame, x, y, width, height);\n// texture.repeat(key, frame, x, y, width, height, alpha, tint, skipBatch);\n
    "},{"location":"dynamic-texture/#add-frame","title":"Add frame","text":"
    texture.add(name, sourceIndex, x, y, width, height);\n
    • name : The name of this Frame. The name is unique within the Texture.
    • sourceIndex : The index of the TextureSource that this Frame is a part of.
    • x : The x coordinate of the top-left of this Frame.
    • y : The y coordinate of the top-left of this Frame.
    • width : The width of this Frame.
    • height : The height of this Frame.
    "},{"location":"dynamic-texture/#batch-draw","title":"Batch draw","text":"
    1. Begin
      texture.beginDraw();\n
    2. Draw
      • Draw game object
        texture.batchDraw(entries, x, y, alpha, tint);\n
        • entries :
          • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
          • Tilemap Layers.
          • A Group. The contents of which will be iterated and drawn in turn.
          • A Container. The contents of which will be iterated fully, and drawn in turn.
          • A Scene Display List. Pass in Scene.children to draw the whole list.
          • Another Dynamic Texture, or a Render Texture.
          • A Texture Frame instance.
          • A string. This is used to look-up the texture from the Texture Manager.
      • Draw frame
        texture.batchDrawFrame(key, frame, x, y, alpha, tint);\n
      • Draw image
        texture.stamp(key, frame, x, y, {\n// ...\nskipBatch: true\n})\n
      • Draw repeat images
        texture.repeat(key, frame, x, y, width, height, alpha, tint, true);\n
    3. End
      texture.endDraw();\n
    "},{"location":"dynamic-texture/#internal-camera","title":"Internal camera","text":"

    Internal camera texture.camera

    • Scroll (offset)
      texture.camera.setScroll(x, y);\n
    • Zoom (scale)
      texture.camera.setZoom(zoom);\n
    • Rotate
      texture.camera.setAngle(angle);  // angle in degrees\n
    "},{"location":"dynamic-texture/#snapshot","title":"Snapshot","text":""},{"location":"dynamic-texture/#snapshot-area","title":"Snapshot area","text":"
    texture.snapshot(callback);\n// texture.snapshot(callback, type, encoderOptions);\n

    or

    texture.snapshotArea(x, y, width, height, callback, type, encoderOptions);\n
    • callback : The Function to invoke after the snapshot image is created.
      function(imageElement) {\n}\n
      • imageElement : HTMLImageElement.
    • type : The format of the image to create, usually 'image/png' or 'image/jpeg'. Default value is 'image/png'.
    • encoderOptions : The image quality, between 0 and 1. Used for image formats with lossy compression, such as 'image/jpeg'. Default value is 0.92.
    • x, y, width, height : Snapshot area.
    "},{"location":"dynamic-texture/#get-color-of-a-pixel","title":"Get color of a pixel","text":"
    texture.snapshotPixel(x, y, callback);\n
    • x, y : The x/y coordinate of the pixel to get.
    • callback : The Function to invoke after the snapshot image is created.
      function(color) {        }\n
      • color : Color object.
    "},{"location":"dynamicbitmaptext/","title":"Dynamic bitmap text","text":""},{"location":"dynamicbitmaptext/#introduction","title":"Introduction","text":"

    Drawing text by texture with a callback for each character triggered at every tick, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"dynamicbitmaptext/#usage","title":"Usage","text":""},{"location":"dynamicbitmaptext/#load-bitmap-font","title":"Load bitmap font","text":"

    Reference: load bitmap font

    "},{"location":"dynamicbitmaptext/#add-bitmap-text-object","title":"Add bitmap text object","text":"
    var txt = scene.add.dynamicBitmapText(x, y, key, text);\n// var txt = scene.add.dynamicBitmapText(x, y, key, text, size, align);\n
    • size : The size of the font
    • align : The alignment of the text in a multi-line BitmapText object.
      • 0 : Left aligned (default)
      • 1 : Middle aligned
      • 2 : Right aligned

    Add text from JSON

    var txt = scene.make.dynamicBitmapText({\nx: 0,\ny: 0,\ntext: 'Text\\nGame Object\\nCreated from config',\nfont: '',\nsize: false,\nalign: 0,\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"dynamicbitmaptext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends Phaser.GameObjects.DynamicBitmapText {\nconstructor(scene, x, y, key, text, size, align) {\nsuper(scene, x, y, key, text, size, align);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, key, text);\n
    "},{"location":"dynamicbitmaptext/#set-callback","title":"Set callback","text":"
    var callback = function(data) {\n// input\n// data.index, data.charCode\n// data.x, data.y, data.scale, data.rotation\n// data.data\n// data.tint.topLeft, data.tint.topRight, data.tint.bottomLeft, data.tint.bottomRight    \n\n// modify input `data` then return it\n// ...\n// offset: data.y += 2\n// set tint: data.color = tint\nreturn data;\n}\ntxt.setDisplayCallback(callback);\n
    "},{"location":"dynamicbitmaptext/#set-text","title":"Set text","text":"
    txt.setText('...');\n

    or

    txt.text = '...';\n
    "},{"location":"dynamicbitmaptext/#crop","title":"Crop","text":"
    • Set size
      txt.setSize(width, height);\n
      or
      txt.cropWidth = width;\ntxt.cropHeight = height;\n
    • Set offset
      txt.setScrollX(scrollX);\ntxt.setScrollY(scrollY);\n
      or
      this.scrollX = scrollX;\nthis.scrollY = scrollY;\n
    "},{"location":"dynamicbitmaptext/#other-properties","title":"Other properties","text":"

    See bitmap text, game object

    "},{"location":"dynamicbitmaptext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"dynamicbitmaptext/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"dynamictext/","title":"Dynamic text","text":""},{"location":"dynamictext/#introduction","title":"Introduction","text":"

    Control position, angle of each character drawn on a canvas.

    • Author: Rex
    • Game object
    "},{"location":"dynamictext/#live-demos","title":"Live demos","text":"
    • Wrap
      • Wrap modes
      • Horizontal alignment modes
    • Page typing
    • Align, rotation, drawBelowCallback
    • Vertical wrap
    • Character's world position
    • Child input event
    "},{"location":"dynamictext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"dynamictext/#install-plugin","title":"Install plugin","text":""},{"location":"dynamictext/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdynamictextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdynamictextplugin.min.js', true);\n
    • Add dynamic-text object
      var txt = scene.add.rexDynamicText(x, y, width, height, config);\n
    "},{"location":"dynamictext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DynamicTextPlugin from 'phaser3-rex-plugins/plugins/dynamictext-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDynamicTextPlugin',\nplugin: DynamicTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dynamic-text object
      var txt = scene.add.rexDynamicText(x, y, width, height, config);\n
    "},{"location":"dynamictext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import DynamicText from 'phaser3-rex-plugins/plugins/dynamictext.js';\n
    • Add dynamic-text object
      var txt = new DynamicText(scene, x, y, width, height, config);\nscene.add.existing(txt);\n
    "},{"location":"dynamictext/#create-instance","title":"Create instance","text":"
    var txt = scene.add.rexDynamicText({\nx: 0, y: 0,\nwidth: undefined, height: undefined,\nresolution: 1,\n\npadding: 0,  // {left: 0, right: 0, top: 0, bottom: 0}\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\n\nchildrenInteractive: false,\n\ntext: '',\n\nwrap: undefined,\n\ntestString: '|M\u00c9qgy',\n});\n
    • x, y : Position of this dynamic-text game object.
    • width : Fixed width.
      • A number : Width of this dynamic-text game object.
        • Wrap-width is width - padding.left - padding.right.
      • undefined : Width of this dynamic-text game object will be set after invoked runWordWrap method.
    • height : Fixed height.
      • A number : Height of this dynamic-text game object.
      • undefined : Height of this dynamic-text game object will be set after invoked runWordWrap method.
    • resolution : The resolution the content is rendered to its internal canvas at. Default value is 1.
    • padding : Padding of bounds.
      • A number
      • padding.left, padding.right, padding.top, padding.bottom
    • background : Properties of background round-rectangle.
      • background.color : Fill color, number or string.
        • null : No filling.
      • background.color2 : Gradient fill color, number or string.
        • null : No gradient filling.
      • background.horizontalGradient : Horizontal or vertical gradient filling.
        • true : Horizontal gradient filling.
        • false : Vertical gradient filling.
      • background.stroke : Stroke color, number or string.
        • null : No stroke.
      • background.strokeThickness : Line width of stroke.
      • background.cornerRadius : Corner-radius of round rectangle.
      • background.cornerIteration : Iteration of corner-radius.
        • null : Draw corner-radius via arc directly.
        • A number : Draw corner-radius via lines
    • innerBounds : Properties of inner-bounds.
      • innerBounds.color : Fill color, number or string.
        • null : No filling.
      • innerBounds.color2 : Gradient fill color, number or string.
        • null : No gradient filling.
      • innerBounds.horizontalGradient : Horizontal or vertical gradient filling.
        • true : Horizontal gradient filling.
        • false : Vertical gradient filling.
      • innerBounds.stroke : Stroke color, number or string.
        • null : No stroke.
      • innerBounds.strokeThickness : Line width of stroke.
    • style : Initial text-style.
      • style.bold : Bold
      • style.italic : Italic
      • style.fontSize : Font size, number or string.
      • style.fontFamily : Font family
      • style.color : Fill color, number or string.
      • style.stroke : Stroke color, number or string.
      • style.strokeThickness : Line width of stroke.
      • style.shadowColor : Shadow color, number or string.
        • null : No shadow.
      • style.shadowOffsetX : OffsetX of shadow.
      • style.shadowOffsetY : OffsetY of shadow.
      • style.shadowBlur : Blur of shadow.
      • style.backgroundColor : Background color of a character.
      • style.backgroundHeight, style.backgroundBottomY : Background position and height of a character.
        • undefined, or null : Use height of character as background height. Default behavior.
      • style.offsetX : OffsetX.
      • style.offsetY : OffsetY.
      • style.align : Override default line-alignment setting.
        • 0, 'left', 'top' : Align remainder lines to left/top.
        • 1, 'center' : Align remainder lines to center.
        • 2, 'right', 'bottom' : Align remainder lines to right/bottom.
        • undefined : Use default line-alignment setting.
    • childrenInteractive :
      • true : Fire input events ('child.pointerdown', 'child.pointerup', 'child.pointerover', 'child.pointerout') of any child after text.setInteractive().
      • false : Won't fire any input events of child. Default behavior.
    • text : Content of text.
    • wrap : Default configuration Horizontal/Vertical wrapping.
    • testString : Test string to get text ascent and text height with default text style.

    or

    var txt = scene.add.rexDynamicText(x, y, width, height, config);\n

    or

    var txt = scene.add.rexDynamicText(x, y, config);\n

    Add dynamictext from JSON

    var txt = scene.make.rexDynamicText({\nx: 0,\ny: 0,\n\n// origin: {x: 0.5, y: 0.5},\n// fill: null,\n\nadd: true\n});\n
    "},{"location":"dynamictext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDynamicText extends DynamicText {\nconstructor(scene, x, y, width, height, config)) {\nsuper(scene, x, y, width, height, config));\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyDynamicText(scene, x, y, config);\n
    "},{"location":"dynamictext/#clear-content","title":"Clear content","text":"
    txt.clearContent();\n
    "},{"location":"dynamictext/#text","title":"Text","text":""},{"location":"dynamictext/#append-text","title":"Append text","text":"
    txt.appendText(text);\n

    or

    txt.appendText(text, {\n// bold: false,\n// italic: false,\n// fontSize: '16px',\n// fontFamily: 'Courier',\n// color: '#fff',\n// stroke: '#fff',\n// strokeThickness: 0,\n// shadowColor: null,\n// shadowOffsetX: 0,\n// shadowOffsetY: 0,\n// shadowBlur: 0,\n// backgroundColor: null,\n// backgroundHeight: undefined,\n// backgroundBottomY: undefined,\n// offsetY: 0,\n// offsetY: 0,\n// align: undefined\n}\n);\n

    To overwrite some properties of text-style.

    Each character will be placed at position (0,0), without rotation. Uses word-wrap method to rearrange position of characters.

    "},{"location":"dynamictext/#set-text","title":"Set text","text":"
    txt.setText(text);\n

    or

    txt.setText(text, {\n// bold: false,\n// italic: false,\n// fontSize: '16px',\n// fontFamily: 'Courier',\n// color: '#fff',\n// stroke: '#fff',\n// strokeThickness: 0,\n// shadowColor: null,\n// shadowOffsetX: 0,\n// shadowOffsetY: 0,\n// shadowBlur: 0,\n// backgroundColor: null,\n// backgroundHeight: undefined,\n// backgroundBottomY: undefined,\n// offsetY: 0,\n// offsetY: 0,\n// align: undefined\n}\n);\n
    "},{"location":"dynamictext/#insert-text","title":"Insert text","text":"

    txt.insertText(index, text);\n
    or

    txt.insertText(index, text, {\n// bold: false,\n// italic: false,\n// fontSize: '16px',\n// fontFamily: 'Courier',\n// color: '#fff',\n// stroke: '#fff',\n// strokeThickness: 0,\n// shadowColor: null,\n// shadowOffsetX: 0,\n// shadowOffsetY: 0,\n// shadowBlur: 0,\n// backgroundColor: null,\n// backgroundHeight: undefined,\n// backgroundBottomY: undefined,\n// offsetY: 0,\n// offsetY: 0,\n// align: undefined\n}\n);\n
    "},{"location":"dynamictext/#remove-text","title":"Remove text","text":"
    txt.removeText(index);\n
    "},{"location":"dynamictext/#get-text","title":"Get text","text":"
    • Get active characters
      var text = txt.text;\n
      or
      var text = txt.getText();\n
    • Get all characters
      var text = txt.getText(false);\n
    "},{"location":"dynamictext/#image","title":"Image","text":""},{"location":"dynamictext/#append-image","title":"Append image","text":"
    txt.appendImage(key, frame, {\n// width: ,\n// height: ,\n// scaleX: ,\n// scaleY: ,\n// color: ,\n})\n
    • width : Scaled-width. Aspect-ratio will be kept if no height, or scaleY is set.
    • height : Scaled-height. Aspect-ratio will be kept if no width, or scaleX is set.
    • color : Tint-fill color. Default is undefined.
    "},{"location":"dynamictext/#background","title":"Background","text":"
    • Fill style
      txt.setBackgroundColor(color);\n// txt.setBackgroundColor(color, color2, isHorizontalGradient);\n
    • Stroke style
      txt.setBackgroundStroke(color, lineWidth);\n
    • Corner radius
      txt.setBackgroundCornerRadius(radius);\n// txt.setBackgroundCornerRadius(radius, iteration)\n
    "},{"location":"dynamictext/#inner-bounds","title":"Inner bounds","text":"
    • Fill style
      txt.setInnerBoundsColor(color);\n// txt.setInnerBoundsColor(color, color2, isHorizontalGradient);\n
    • Stroke style
      txt.setInnerBoundsStroke(color, lineWidth);\n
    "},{"location":"dynamictext/#wrap","title":"Wrap","text":"

    Control characters :

    • '\\n' : New line
    • '\\f' : Page break
    "},{"location":"dynamictext/#horizontal-wrap","title":"Horizontal wrap","text":"
    var result = txt.runWordWrap({\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n},\nascent: undefined,\nlineHeight: undefined,\nuseDefaultTextHeight: false,\nmaxLines: undefined,\nwrapWidth: undefined,\nwrapMode: 'word',  // 1|'word'|2|'char'|'character'|3|'mix'\nletterSpacing: 0,\nhAlign: 0,\nvAlign: 0,\n\n\n});\n
    • padding :
      • padding.top, padding.bottom, padding.left, padding.right : Extra space around lines.
    • ascent, lineHeight : Height of first line and remainder lines
      • ascent will set to lineHeight if ascent is undefined but lineHeight is not undefined (backward compatible)
      • Get ascent, lineHeight from default text style and test string, if ascent, lineHeight are both undefined
    • useDefaultTextHeight : If parameter lineHeight is not given,
      • false : Set line height to (total line height / maxLines), if parameter maxLines is larger than 0. Default behavior.
      • true : Set line height to default text height.
    • maxLines : Lines number of this page.
      • 0 : Wrapping whole content.
      • undefined : It will be set if lineHeight and height is given
    • wrapWidth : Width of wrapping. Use inner width if this parameter is undefined.
    • wrapMode :
      • No wrapping if wrapWidth, or inner width is not given.
      • 1, or 'word' : Word wrapping. Default behavior.
      • 2, or 'char', or 'character' : Character wrapping.
      • 3, or 'mix' : Word wrapping for ASCII word, Character wrapping for other (unicode) word.
    • letterSpacing : Space between each character.
    • hAlign : Horizontal alignment.
      • 0, or 'left' : Align to left bound.
      • 1, or 'center' : Align to center.
      • 2, or 'right' : Align to right bound.
      • 3, 'justify', 'justify-left' : If remainder space is less or equal than 25%, then justify children. Else align children to left/top side.
      • 4, 'justify-right' : If remainder space is less or equal than 25%, then justify children. Else align children to right/bottom side.
      • 5, 'justify-cneter' : If remainder space is less or equal than 25%, then justify children. Else align children to center.
    • vAlign : Vertical alignment.
      • 0, or 'top' : Align to top bound.
      • 1, or 'center' : Align to center.
      • 2, or 'bottom' : Align to bottom bound.
    "},{"location":"dynamictext/#align","title":"Align","text":"
    • Set vertical align mode
      txt.setVAlign(vAlign);\n
      • vAlign : Vertical alignment.
        • 0, or 'top' : Align to top bound.
        • 1, or 'center' : Align to center.
        • 2, or 'bottom' : Align to bottom bound.
    • Set horizontal align mode
      txt.setHAlign(hAlign);\n
      • hAlign : Horizontal alignment.
        • 0, or 'left' : Align to left bound.
        • 1, or 'center' : Align to center.
        • 2, or 'right' : Align to right bound.
    "},{"location":"dynamictext/#test-string","title":"Test string","text":"
    txt.setTestString(text);\n
    "},{"location":"dynamictext/#vertical-wrap","title":"Vertical wrap","text":"
    var result = txt.runVerticalWrap({\npadding: {\ntop: 0,\nleft: 0,\nright: 0,\nbottom: 0\n},\nlineWidth: undefined,\nmaxLines: undefined,\nfixedChildHeight: undefined,\ncharPerLine: undefined,\nwrapHeight: undefined,\nletterSpacing: 0,\nrtl: true,\nhAlign: 0,\nvAlign: 0,\n});\n
    • padding :
      • padding.top, padding.bottom, padding.left, padding.right : Extra space around lines.
    • lineWidth : Line width.
      • undefined : It will be set if maxLines and fixedWidth is given.
    • maxLines : Lines number of this page.
      • 0 : Wrapping whole content.
      • undefined : It will be set if lineWidth and fixedWidth is given.
    • fixedChildHeight : Each character has the same fixed height.
      • undefined : Get fixedChildHeight according to charPerLine parameter. Or use height of each character if fixedChildHeight and charPerLine parameters are undefined.
    • charPerLine : Amount of characters in each line, to get fixedChildHeight.
    • wrapHeight : Height of wrapping
    • letterSpacing : Space between each character.
    • rtl :
      • true : Place lines from right to left.
      • false : Place lines from left to right.
    • hAlign : Horizontal alignment.
      • 0, or 'left' : Align to left bound. Default value if rtl is set to false.
      • 1, or 'center' : Align to center.
      • 2, or 'right' : Align to right bound. Default value if rtl is set to true.
    • vAlign : Vertical alignment.
      • 0, or 'top' : Align to top bound.
      • 1, or 'center' : Align to center.
      • 2, or 'bottom' : Align to bottom bound.
    "},{"location":"dynamictext/#result","title":"Result","text":"
    {\nchildren: [],\nlines: [],\nisLastPage: false\n}\n
    • children : Character/Image data in this page.
    • lines : Array of line data. A line data contains
      {\nchildren: [],\nwidth: 0,     // Horizontal-wrapping\nheight: 0,    // Vertical-wrapping.        \n}\n
      • children : Character/Image data in this line.
      • width : Width of this line, in result of horizontal-wrapping.
      • height : Height of this line, in result of vertical-wrapping.
    • isLastPage :
      • false : Run txt.runWordWrap(result)/txt.runVerticalWrap(result) to get next page of word-wrapping result.
      • true : No remainder of characters.
    "},{"location":"dynamictext/#wrap-next-page","title":"Wrap next page","text":"
    var result = txt.runWordWrap(prevResult);\n
    • prevResult : Result of previous word-wraping.
    • result : Current result of word-wraping.
    "},{"location":"dynamictext/#default-configuration-of-wrapping","title":"Default configuration of wrapping","text":"
    txt.setWrapConfig(config);\n
    • config : Default configuration Horizontal/Vertical wrapping.
    "},{"location":"dynamictext/#scroll-content","title":"Scroll content","text":"

    Scroll content by setting textOX, textOY members

    • Set
      txt.setTextOXY(x, y).updateTexture();    // txt.setTextOX(x).updateTexture();\n// txt.setTextOY(x).updateTexture(); \n
      or
      txt.addTextOXY(incX, incY).updateTexture(); // txt.addTextOX(incX).updateTexture(); \n// txt.addTextOY(incY).updateTexture(); \n
      or
      txt.textOX = x;\ntxt.textOY = y;\ntxt.updateTexture();\n
    • Get
      var ox = txt.textOX;\nvar oy = txt.textOY;\n
    "},{"location":"dynamictext/#child","title":"Child","text":""},{"location":"dynamictext/#general-properties","title":"General properties","text":"
    • Visible :
      • Get
        var visible = child.visible;\n
      • Set
        child.setVisible();\n// child.visible = true;\n
        or
        child.setVisible(false);  // Set to invisible\n// child.visible = false;\n
    • Alpha
      • Get
        var alpha = child.alpha;\n
      • Set
        child.setAlpha(alpha);\n// child.alpha = alpha;\n
    • Position :
      • Get
        var x = child.x;\nvar y = child.y;\n
      • Set
        child.setPosition(x, y);\n// child.x = x;\n// child.y = y;\n
    • Angle :
      • Get
        var degrees = child.angle;\n// var radians = child.rotation;\n
      • Set
        child.setAngle(degrees);\nchild.setRotation(radians);\n// child.angle = degrees;\n// child.rotation = radians;\n
    • Scale
      • Get
        var scaleX = child.scaleX;\nvar scaleY = child.scaleY;\n
      • Set
        child.setScale(scaleX, scaleY);\n// child.scaleX = scaleX;\n// child.scaleY = scaleY;\n
    • Draw callbacks
      • Set
        child.setDrawBelowCallback(callback);\nchild.setDrawAboveCallback(callback);\n
        • callback :
          function(child) {\nvar text = child.text;                var context = child.context;\n// ...\n}\n
    • World position
      var worldXY = child.getWorldPosition();\n// out = child.getWorldPosition(out);\n
      or
      var worldXY = txt.getCharWorldPosition(char);\n// out = txt.getCharWorldPosition(char, out);\n
    "},{"location":"dynamictext/#character","title":"Character","text":""},{"location":"dynamictext/#text-style","title":"Text-style","text":"
    • Get
      var bold = char.style.bold;\nvar italic = char.style.italic;\nvar fontSize = char.style.fontSize;\nvar fontFamily = char.style.fontFamily;\nvar color = char.style.color;\nvar stroke = char.style.stroke;\nvar strokeThickness = char.style.strokeThickness;\nvar shaodwColor = char.style.shadowColor;\nvar shadowBlur = char.style.shadowBlur;\nvar shadowOffsetX = char.style.shadowOffsetX;\nvar shadowOffsetY = char.style.shadowOffsetY;\nvar backgroundColor = char.style.backgroundColor;\nvar backgroundHeight = char.style.backgroundHeight;\nvar backgroundBottomY = char.style.backgroundBottomY;\nvar xOffset = char.style.x;\nvar yOffset = char.style.y;\n
    • Set
      char.modifyStyle({\n// bold: false,\n// italic: false,\n// fontSize: '16px',\n// fontFamily: 'Courier',\n// color: '#fff',\n// stroke: '#fff',\n// strokeThickness: 0,\n// shaodwColor: null,\n// shadowBlur: 0,\n// shadowOffsetX: 0,\n// shadowOffsetY: 0,\n// backgroundColor: null,\n// backgroundHeight: undefined,\n// backgroundBottomY: undefined,\n// offsetX: 0,\n// offsetY: 0\n})\n
      or
      char.setBold();\n// char.setBold(false);\n
      char.setItalic();\n// char.setItalic(false);\n
      char.setFontSize(fontSize); // number, string\n
      char.setFontFamily(fontFamily);\n
      char.setColor(color); // number, string\n// char.setColor(); // No filling color\n
      char.setStrokeStyle(color, thickness);\n// char.setStrokeStyle();  // No stroke\n
      char.setShadowColor(color);\n// char.setShadowColor();  // No shadow\n
      char.setShadowOffset(offsetX, offsetY);\n
      char.setShadowBlur(blur);\n
      char.setBackgroundColor(color);\n// char.setBackgroundColor();  // No shadow\n
      char.setOffsetX(offsetX);\nchar.setOffsetY(offsetY);\n
    "},{"location":"dynamictext/#image_1","title":"Image","text":"
    • Size
      • Get
        var width = image.width;\nvar height = image.height;\n
      • Set
        image.setWidth(width);\n// image.setWidth(width, true);  // Resize and keep aspect- ratio\nimage.setHeight(height);\n// image.setHeight(height, true);  // Resize and keep aspect- ratio\n
    "},{"location":"dynamictext/#for-each-child","title":"For each child","text":"
    • Any child
      • For each active child
        txt.forEachChild(function(child, childIndex){\n}, scope)\n
      • For each character child
        txt.forEachChild(function(child, childIndex){\n}, scope, false);\n
    • Renderable child
      • For each active renderable child
        txt.forEachRenderableChild(function(child, charIndex){\n}, scope)\n
      • For each renderable child
        txt.forEachRenderableChild(function(child, charIndex){\n}, scope, false);\n
    • Character child
      • For each active character child
        txt.forEachCharChild(function(child, charIndex){\n}, scope)\n
      • For each character child
        txt.forEachCharChild(function(child, charIndex){\n}, scope, false);\n
    "},{"location":"dynamictext/#get-children","title":"Get children","text":"
    • Get all children
      var children = txt.getChildren();\n
    • Get last appended children
      var children = txt.getLastAppendedChildren();\n
    • Get active children, after wrapping
      var children = txt.getActiveChildren();\n
    "},{"location":"dynamictext/#get-character-children","title":"Get character children","text":"
    • Get active character children
      var children = txt.getCharChildren();\n
    • Get all character children
      var children = txt.getCharChildren(false);\n
    • Get character child by character index
      var child = txt.getCharChild(charIndex);\n
    "},{"location":"dynamictext/#move-child","title":"Move child","text":"
    • Move child to fist
      txt.moveChildToFist(child);\n
    • Move child to last
      txt.moveChildToLast(child);\n
    • Move child up
      txt.movechildUp(child);\n
    • Move child to down
      txt.movechildDown(child);\n
    • Move child above another child
      txt.movechildAbove(child, baseChild);\n
    • Move child below another child
      txt.movechildBelow(child, baseChild);\n
    "},{"location":"dynamictext/#size","title":"Size","text":"
    • Resize canvas size
      txt.setCanvasSize(width, height)\n
    • Reisze text wrapping size and canvas size.
      txt.setSize(width, height);\n
      or
      txt.setFixedSize(width, height);\n
    • Resize to minimun size to show all visible characters.
      txt.setToMinSize();\n
    "},{"location":"dynamictext/#input-events-of-child","title":"Input events of child","text":"
    • Enable input events of child on config of constructor, or via method
      txt.setChildrenInteractiveEnable();\n
    • Pointer down/up on child
      txt.on('child.pointerdown', function(child, pointer, localX, localY, event) {        })\n
      txt.on('child.pointerup', function(child, pointer, localX, localY, event) {        })\n
      • child : Any Character or Image child
    • Pointer over/out on child
      txt.on('child.pointerover', function(child, pointer, localX, localY, event) {        })\n
      txt.on('child.pointerout', function(child, pointer, localX, localY, event) {        })\n
      • child : Any Character or Image child
    "},{"location":"dynamictext/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"dynamictext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"dynamictext/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"dynamictext/#compare-with-other-kinds-of-text-game-object","title":"Compare with other kinds of text game object","text":"
    • Built-in text:
      • Single color per game object.
      • Draw content line by line.
      • Best render performance.
    • BBCode text:
      • Multiple colors, multiple font size per gaem object.
      • Draw content segment by segment.
      • Slower than built-in text game object.
    • Dynamic text:
      • Multiple colors, multiple font size per gaem object.
      • Draw content character by character.
      • Slower than bbcode text game object.
    "},{"location":"ease-function/","title":"Ease","text":""},{"location":"ease-function/#introduction","title":"Introduction","text":"

    Ease functions, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"ease-function/#usage","title":"Usage","text":""},{"location":"ease-function/#ease-functions","title":"Ease functions","text":"
    • Linear : Phaser.Math.Easing.Linear
    • Quadratic, Power1
      • Quadratic ease-out : Phaser.Math.Easing.Quadratic.Out
      • Quadratic ease-in : Phaser.Math.Easing.Quadratic.In
      • Quadratic ease-in/out : Phaser.Math.Easing.Quadratic.InOut
    • Cubic, Power2
      • Cubic ease-out : Phaser.Math.Easing.Cubic.Out
      • Cubic ease-in : Phaser.Math.Easing.Cubic.In
      • Cubic ease-in/out : Phaser.Math.Easing.Cubic.InOut
    • Quartic, Power3
      • Quartic ease-out : Phaser.Math.Easing.Quartic.Out
      • Quartic ease-in : Phaser.Math.Easing.Quartic.In
      • Quartic ease-in/out : Phaser.Math.Easing.Quartic.InOut
    • Quintic, Power4
      • Quintic ease-out : Phaser.Math.Easing.Quintic.Out
      • Quintic ease-in : Phaser.Math.Easing.Quintic.In
      • Quintic ease-in/out : Phaser.Math.Easing.Quintic.InOut
    • Sinusoidal
      • Sinusoidal ease-out : Phaser.Math.Easing.Sine.Out
      • Sinusoidal ease-in : Phaser.Math.Easing.Sine.In
      • Sinusoidal ease-in/out : Phaser.Math.Easing.Sine.InOut
    • Exponential
      • Exponential ease-out : Phaser.Math.Easing.Expo.Out
      • Exponential ease-in : Phaser.Math.Easing.Expo.In
      • Exponential ease-in/out : Phaser.Math.Easing.Expo.InOut
    • Circular
      • Circular ease-out : Phaser.Math.Easing.Circular.Out
      • Circular ease-in : Phaser.Math.Easing.Circular.In
      • Circular ease-in/out : Phaser.Math.Easing.Circular.InOut
    • Elastic
      • Elastic ease-out : Phaser.Math.Easing.Elastic.Out
      • Elastic ease-in : Phaser.Math.Easing.Elastic.In
      • Elastic ease-in/out : Phaser.Math.Easing.Elastic.InOut
    • Bounce
      • Bounce ease-out : Phaser.Math.Easing.Bounce.Out
      • Bounce ease-in : Phaser.Math.Easing.Bounce.In
      • Bounce ease-in/out : Phaser.Math.Easing.Bounce.InOut
    • Back
      • Back ease-out : Phaser.Math.Easing.Back.Out
      • Back ease-in : Phaser.Math.Easing.Back.In
      • Back ease-in/out : Phaser.Math.Easing.Back.InOut
    • Stepped : Phaser.Math.Easing.Stepped(v, step)
    "},{"location":"ease-function/#get-ease-function-via-string","title":"Get ease function via string","text":"
    var easeFunction = Phaser.Tweens.Builders.GetEaseFunction(ease);\n// var easeFunction = Phaser.Tweens.Builders.GetEaseFunction(ease, easeParams);\n
    • ease :
      • A string :
        • Power0 : Linear
        • Power1 : Quadratic.Out
        • Power2 : Cubic.Out
        • Power3 : Quartic.Out
        • Power4 : Quintic.Out
        • Linear
        • Quad : Quadratic.Out
        • Cubic : Cubic.Out
        • Quart : Quartic.Out
        • Quint : Quintic.Out
        • Sine : Sine.Out
        • Expo : Expo.Out
        • Circ : Circular.Out
        • Elastic : Elastic.Out
        • Back : Back.Out
        • Bounce : Bounce.Out
        • Stepped
        • Quad.easeIn
        • Cubic.easeIn
        • Quart.easeIn
        • Quint.easeIn
        • Sine.easeIn
        • Expo.easeIn
        • Circ.easeIn
        • Back.easeIn
        • Bounce.easeIn
        • Quad.easeOut
        • Cubic.easeOut
        • Quart.easeOut
        • Quint.easeOut
        • Sine.easeOut
        • Expo.easeOut
        • Circ.easeOut
        • Back.easeOut
        • Bounce.easeOut
        • Quad.easeInOut
        • Cubic.easeInOut
        • Quart.easeInOut
        • Quint.easeInOut
        • Sine.easeInOut
        • Expo.easeInOut
        • Circ.easeInOut
        • Back.easeInOut
        • Bounce.easeInOut
      • A custom function
        function(v) {\nreturn v;\n}\n
        function(v, param0, param1, ...) {\nreturn v;\n}\n
        • v : 0 ~ 1
    "},{"location":"ease-function/#get-result","title":"Get result","text":"
    var result = easeFunction(t);\n
    • t : 0 ~ 1
    "},{"location":"easedata/","title":"Ease-data","text":""},{"location":"easedata/#introduction","title":"Introduction","text":"

    Easing data value of game object's data-manager.

    • Author: Rex
    • Method only
    "},{"location":"easedata/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"easedata/#install-plugin","title":"Install plugin","text":""},{"location":"easedata/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeasedataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeasedataplugin.min.js', true);\n
    • Add ease-data behavior
      var easedata = scene.plugins.get('rexeasedataplugin').add(gameObject);\n
    "},{"location":"easedata/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import EaseDataPlugin from 'phaser3-rex-plugins/plugins/easedata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEaseData',\nplugin: EaseDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add ease-data behavior
      var easedata = scene.plugins.get('rexEaseData').add(gameObject);\n
    "},{"location":"easedata/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import { EaseData } from 'phaser3-rex-plugins/plugins/easedata.js';\n
    • EaseData-out-destroy
      var easedata = new EaseData(gameObject);\n
    "},{"location":"easedata/#create-instance","title":"Create instance","text":"
    var easedata = scene.plugins.get('rexEaseData').add(gameObject);\n
    "},{"location":"easedata/#ease-data","title":"Ease data","text":"
    • Start
      easedata.easeTo(key, value, duration);\n// easedata.easeTo(key, value, duration, ease);\n
      or
      easedata.easeTo({\nkey:key,\nvalue:value,\nduration:1000,\nease:'Linear'\n});\n
      or
      easedata.easeTo({\nkey:key,\nvalue:value,\nspeed: 10,    // value changing rate, per second\nease:'Linear'\n});\n
    • Stop
      easedata.stopEase(key);           // Set to end value\n// easedata.stopEase(key, false); // Stop at current value\n
      or
      easedata.stopAll();           // Set to end value\n// easedata.stopAll(false);   // Stop at current value\n
    "},{"location":"easedata/#events","title":"Events","text":"
    • Easing complete
      easedata.on('complete-' + key, function(gameObject, easedata){\n\n}, scope);\n
      easedata.on('complete', function(key, gameObject, easedata){\n\n}, scope);\n
    "},{"location":"easemove/","title":"Ease-move","text":""},{"location":"easemove/#introduction","title":"Introduction","text":"

    Ease-move game object.

    • Author: Rex
    • Method only
    "},{"location":"easemove/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"easemove/#install-plugin","title":"Install plugin","text":""},{"location":"easemove/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeasemoveplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeasemoveplugin.min.js', true);\n
    • Ease-move to/from
      var easemove = scene.plugins.get('rexeasemoveplugin').moveTo(gameObject, duration, x, y, ease);\nvar easemove = scene.plugins.get('rexeasemoveplugin').moveFrom(gameObject, duration, x, y, ease);\n
    "},{"location":"easemove/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import EaseMovePlugin from 'phaser3-rex-plugins/plugins/easemove-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEaseMove',\nplugin: EaseMovePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Ease-move to/from
      var easemove = scene.plugins.get('rexEaseMove').moveTo(gameObject, duration, x, y, ease);\nvar easemove = scene.plugins.get('rexEaseMove').moveFrom(gameObject, duration, x, y, ease);\n
    "},{"location":"easemove/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import { EaseMoveTo, EaseMoveFrom } from 'phaser3-rex-plugins/plugins/easemove.js';\n
    • EaseMove-out-destroy
      var easemove = EaseMoveTo(gameObject, duration, x, y, ease);\nvar easemove = EaseMoveFrom(gameObject, duration, x, y, ease);\n
    "},{"location":"easemove/#move-to","title":"Move to","text":"
    var easemove = scene.plugins.get('rexEaseMove').moveTo(gameObject, duration, x, y);\n// var easemove = scene.plugins.get('rexEaseMove').moveTo(gameObject, duration, x, y, ease);\n// easemove = scene.plugins.get('rexEaseMove').moveTo(gameObject, duration, x, y, ease, easemove);\n
    • x, y : End position.
      • Number : End position x/y.
      • String(+=300) : Related position of current position x/y.
      • undefined : Don't move along x/y axis.
    • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • easemove : Ease-move behavior.
    "},{"location":"easemove/#move-from","title":"Move from","text":"
    var easemove = scene.plugins.get('rexEaseMove').moveFrom(gameObject, duration, x, y);\n// var easemove = scene.plugins.get('rexEaseMove').moveFrom(gameObject, duration, x, y, ease);\n// easemove = scene.plugins.get('rexEaseMove').moveFrom(gameObject, duration, x, y, ease, easemove);\n
    • x, y : Start position.
      • Number : Start position x/y.
      • String(-=300) : Related position of current position x/y.
      • undefined : Don't move along x/y axis.
    • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • easemove : Ease-move behavior.
    "},{"location":"easemove/#events","title":"Events","text":"

    See Events of tween task

    • Move completes or is stopped.
      easemove.on('complete', function(gameObject, easemove){\n\n}, scope);\n
    "},{"location":"easemove/#inject-methods","title":"Inject methods","text":"
    • Inject methods into game object
      scene.plugins.get('rexEaseMove').injectMethods(gameObject);\n
    • Inject methods into class of game object
      scene.plugins.get('rexEaseMove').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexEaseMove').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into class of game object
      scene.plugins.get('rexEaseMove').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexEaseMove').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into root class of game object
      scene.plugins.get('rexEaseMove').injectMethodsToRootClass(e);\n// scene.plugins.get('rexEaseMove').injectMethods(Phaser.GameObjects.GameObject.prototype);\n
    "},{"location":"easemove/#injected-methods","title":"Injected methods","text":"
    • Move from
      gameObject.moveFrom(duration, x, y);\n// gameObject.moveFrom(duration, x, y, ease);\n// gameObject.moveFrom({x, y, duration, ease});\n// gameObject.moveFrom({x, y, speed, ease});\n
      or
      gameObject\n.moveFromPromise(duration, x, y, ease)\n// .moveFromPromise({x, y, duration, ease})\n// .moveFromPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
      • x, y : Start position.
        • Number : Start position x/y.
        • String(+=300) : Related position of current position x/y.
        • undefined : Current position x/y.
      • speed : Get duration according to speed and distance between current gameObject position to {x, y}
      • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • Move-from destroy
      gameObject.moveFromDestroy(duration, x, y);\n// gameObject.moveFrom(duration, x, y, ease);\n// gameObject.moveFrom({x, y, duration, ease});\n// gameObject.moveFrom({x, y, speed, ease});\n
      or
      gameObject\n.moveFromDestroyPromise(duration, x, y, ease)\n// .moveFromDestroyPromise({x, y, duration, ease})\n// .moveFromDestroyPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
    • Move to
      gameObject.moveTo(duration, x, y);\n// gameObject.moveTo(duration, x, y, ease);\n// gameObject.moveTo({x, y, duration, ease});\n// gameObject.moveTo({x, y, speed, ease});\n
      or
      gameObject\n.moveToPromise(duration, x, y, ease)\n// .moveToPromise({x, y, duration, ease})\n// .moveToPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
      • x, y : End position.
        • Number : End position x/y.
        • String(+=300) : Related position of current position x/y.
        • undefined : Current position x/y.
      • speed : Get duration according to speed and distance between current gameObject position to {x, y}
      • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • Move-to destroy
      gameObject.moveToDestroy(duration, x, y);\n// gameObject.moveTo(duration, x, y, ease);\n// gameObject.moveTo({x, y, duration, ease});\n// gameObject.moveTo({x, y, speed, ease});\n
      or
      gameObject\n.moveToDestroyPromise(duration, x, y, ease)\n// .moveToDestroyPromise({x, y, duration, ease})\n// .moveToDestroyPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
    • Move-stop
      gameObject.moveStop();\n// gameObject.moveStop(true);  // Set to end position\n
    • Events
      • Move-from complete
        gameObject.on('movefrom.complete', function(gameObject) { });\n
      • Move-to complete
        gameObject.on('moveto.complete', function(gameObject) { });\n
    "},{"location":"effect-properties/","title":"Effect properties","text":""},{"location":"effect-properties/#introduction","title":"Introduction","text":"

    Attach properties to a game object or camera, to add/remove/control builtin preFX or postFX effects.

    • Author: Rex
    • Method only
    • Pre-fx, and Post-fx shader effects

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"effect-properties/#live-demos","title":"Live demos","text":"
    • Color effects
    • Reveal
    • Interactive
    • Camera
    "},{"location":"effect-properties/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"effect-properties/#install-plugin","title":"Install plugin","text":""},{"location":"effect-properties/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeffectpropertiesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeffectpropertiesplugin.min.js', true);\n
    • Attach properties to a game object/camera.
      scene.plugins.get('rexeffectpropertiesplugin').add(gameObject);\n
      scene.plugins.get('rexeffectpropertiesplugin').add(camera);\n
    "},{"location":"effect-properties/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import EffectPropertiesPlugin from 'phaser3-rex-plugins/plugins/effectproperties-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEffectProperties',\nplugin: EffectPropertiesPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Attach properties to a game object/camera.
      scene.plugins.get('rexEffectProperties').add(gameObject);\n
      scene.plugins.get('rexEffectProperties').add(camera);\n
    "},{"location":"effect-properties/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import AddEffectPropertiesProperties from 'phaser3-rex-plugins/plugins/effectproperties.js';\n
    • Attach properties to a game object/camera.
      AddEffectPropertiesProperties(gameObject);\n
      AddEffectPropertiesProperties(camera);\n
    "},{"location":"effect-properties/#attach-properties","title":"Attach properties","text":"

    Supported effects are barrel, blackWhite, bloom, blur, bokeh, brightness, brown, circle, contrast, desaturate, desaturateLuminance, displacement, glow, gradient, grayscale, hue, kodachrome, lsd, negative, pixelate, polaroid, reveal, saturate, sepia, shadow, shiftToBGR, shine, technicolor, tiltShift, vignette, vintagePinhole, wipe.

    • Attatch properties of all effects to a game object/camera.
      scene.plugins.get('rexEffectProperties').add(gameObject);\n
      scene.plugins.get('rexEffectProperties').add(camera);\n
    • Attatch properties of some preFX/postFX effects to a game object/camera.
      scene.plugins.get('rexEffectProperties').add(gameObject, {\nbarrel: true,\nblackWhite: true,\nbloom: true,\nblur: true,\nbokeh: true,\nbrightness: true,\nbrown: true,\ncircle: true,\ncontrast: true,\ndesaturate: true,\ndesaturateLuminance: true,\ndisplacement: true,\nglow: true,\ngradient: true,\ngrayscale: true,\nhue: true,\nkodachrome: true,\nlsd: true,\nnegative: true,\npixelate: true,\npolaroid: true,\nreveal: true,\nsaturate: true,\nsepia: true,\nshadow: true,\nshiftToBGR: true,\nshine: true,\ntechnicolor: true,\ntiltShift: true,\nvignette: true,\nvintagePinhole: true,\nwipe: true,\n});\n
      or
      scene.plugins.get('rexEffectProperties').add(gameObject, [\n'barrel', 'blackWhite', 'bloom', 'blur', 'bokeh', 'brightness', 'brown',\n'circle', 'contrast',\n'desaturate', 'desaturateLuminance', 'displacement',\n'glow', 'gradient', 'grayscale',\n'hue',\n'kodachrome',\n'lsd',\n'negative',\n'pixelate', 'polaroid',\n'reveal',\n'saturate', 'sepia', 'shadow', 'shiftToBGR', 'shine',\n'technicolor', 'tiltShift',\n'vignette', 'vintagePinhole',\n'wipe'\n]);\n
      or
      scene.plugins.get('rexEffectProperties').add(gameObject, effectName);\n
      • A plain object with effect names.
      • A list of effect name string.
      • A effect name string.
    "},{"location":"effect-properties/#effect-properties","title":"Effect properties","text":"

    Will try to create preFX effect if gameObject has preFX, otherwise, try to create postFX effect.

    "},{"location":"effect-properties/#barrel","title":"Barrel","text":"
    • barrel :
      • A number : Enable this effect and set intensity of barrel (1: origin).
      • null : Remove this effect
    "},{"location":"effect-properties/#blackwhite","title":"BlackWhite","text":"
    • blackWhite :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#bloom","title":"Bloom","text":"
    • bloomColor :
      • A number : Enable this effect and set color of bloom (0xffffff).
      • null : Remove this effect
    • bloomOffsetX, bloomOffsetY, bloomBlurStrength, bloomStrength, bloomSteps :
      • A number
    "},{"location":"effect-properties/#blur","title":"Blur","text":"
    • blurColor :
      • A number : Enable this effect and set color of blur (0xffffff).
      • null : Remove this effect
    • blurQuality, blurX, blurY, blurStrength, blurSteps :
      • A number
    "},{"location":"effect-properties/#bokeh","title":"Bokeh","text":"
    • bokehRadius :
      • A number : Enable this effect and set radius of bokeh (0~1).
      • null : Remove this effect
    • bokehAmount, bokehContrast :
      • A number
    "},{"location":"effect-properties/#brightness","title":"Brightness","text":"
    • brightness :
      • A number : Enable this effect and set brightness (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#brown","title":"Brown","text":"
    • brown :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#circle","title":"Circle","text":"
    • circleColor :
      • A number : Enable this effect and set color of circle (0xffffff).
      • null : Remove this effect
    • circleThickness, circleBackgroundColor, circleBackgroundAlpha, circleScale, circleFeather :
      • A number
    "},{"location":"effect-properties/#contrast","title":"Contrast","text":"
    • contrast :
      • A number : Enable this effect and set contrast (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#desaturate","title":"Desaturate","text":"
    • desaturate :
      • A number : Enable this effect and set desaturate (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#desaturateluminance","title":"DesaturateLuminance","text":"
    • desaturateLuminance :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#displacement","title":"Displacement","text":"
    • displacementKey :
      • A string : Enable this effect and set displacement reference texture.
      • null : Remove this effect
    • displacementX, displacementY :
      • A number
    "},{"location":"effect-properties/#glow","title":"Glow","text":"
    • glowColor :
      • A number : Enable this effect and set color of glow (0xffffff).
      • null : Remove this effect
    • glowOuterStrength, glowInnerStrength :
      • A number
    "},{"location":"effect-properties/#gradient","title":"Gradient","text":"
    • gradientColor :
      • [number, number] : Enable this effect and set gradient color1 and gradient color2 (0xffffff).
      • null : Remove this effect
    • gradientAlpha, gradientFromX, gradientFromY, gradientToX, gradientToY, gradientSize :
      • A number
    "},{"location":"effect-properties/#grayscale","title":"Grayscale","text":"
    • grayscale :
      • A number : Enable this effect and set intensity of grayscale (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#hue","title":"Hue","text":"
    • hue :
      • A number : Enable this effect and set hue rotation, in degrees.
      • null : Remove this effect
    "},{"location":"effect-properties/#kodachrome","title":"Kodachrome","text":"
    • kodachrome :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#lsd","title":"Lsd","text":"
    • lsd :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#negative","title":"Negative","text":"
    • negative :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#pixelate","title":"Pixelate","text":"
    • pixelate :
      • A number : Enable this effect and set size of pixelate, in pixels.
      • null : Remove this effect
    "},{"location":"effect-properties/#polaroid","title":"Polaroid","text":"
    • polaroid :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#reveal","title":"Reveal","text":"
    • revealLeft, revealRight, revealUp, or revealDown :
      • A number : Enable this effect with specific reveal direction and set progress (0~1).
      • null : Remove this effect
    • revealWidth :
      • A number
    "},{"location":"effect-properties/#saturate","title":"Saturate","text":"
    • saturate :
      • A number : Enable this effect and set saturate (0~1).
      • null : Remove this effect
    "},{"location":"effect-properties/#sepia","title":"Sepia","text":"
    • sepia :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#shadow","title":"Shadow","text":"
    • shadowColor :
      • A number : Enable this effect and set color of shadow (0xffffff).
      • null : Remove this effect
    • shadowX, shadowY, shadowDecay, shadowPower, shadowSamples, shadowIntensity :
      • A number
    "},{"location":"effect-properties/#shifttobgr","title":"ShiftToBGR","text":"
    • shiftToBGR :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#shine","title":"Shine","text":"
    • shineSpeed :
      • A number : Enable this effect and set speed of shine, in seconds.
      • null : Remove this effect
    • shineLineWidth, shineGradient :
      • A number
    "},{"location":"effect-properties/#technicolor","title":"Technicolor","text":"
    • technicolor :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#tiltshift","title":"TiltShift","text":"
    • tiltShiftRadius :
      • A number : Enable this effect and set radius of tiltShift (0~1).
      • null : Remove this effect
    • tiltShiftAmount, tiltShiftContrast, tiltShiftBlurX, tiltShiftBlurY, tiltShiftStrength :
      • A number
    "},{"location":"effect-properties/#vignette","title":"Vignette","text":"
    • vignetteRadius :
      • A number : Enable this effect and set radius of vignette (0~1).
      • null : Remove this effect
    • vignetteX, vignetteY, vignetteStrength :
      • A number
    "},{"location":"effect-properties/#vintagepinhole","title":"VintagePinhole","text":"
    • vintagePinhole :
      • true, or 1 : Enable this effect.
      • null : Remove this effect
    "},{"location":"effect-properties/#wipe","title":"Wipe","text":"
    • wipeLeft, wipeRight, wipeUp, or wipeDown :
      • A number : Enable this effect with specific wipe direction and set progress (0~1).
      • null : Remove this effect
    • wipeWidth :
      • A number
    "},{"location":"effect-properties/#clear-all-effects","title":"Clear all effects","text":"
    gameObject.clearAllEffects();\n
    "},{"location":"effectlayer-outline/","title":"Effectlayer outline","text":""},{"location":"effectlayer-outline/#introduction","title":"Introduction","text":"

    Draw outline of target game objects.

    • Author: Rex
    • Game object
    "},{"location":"effectlayer-outline/#live-demos","title":"Live demos","text":"
    • Outline
    "},{"location":"effectlayer-outline/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"effectlayer-outline/#install-plugin","title":"Install plugin","text":""},{"location":"effectlayer-outline/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexoutlineeffectlayerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexoutlineeffectlayerplugin.min.js', true);\n
    • Add outline effect layer object
      var effectLayer = scene.add.rexOutlineEffectLayer(config);\n
    "},{"location":"effectlayer-outline/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import OutlineEffectLayerPlugin from 'phaser3-rex-plugins/plugins/outlineeffectlayer-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexOutlineEffectLayerPlugin',\nplugin: OutlineEffectLayerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add outline effect layer object
      var effectLayer = scene.add.rexOutlineEffectLayer(config);\n
    "},{"location":"effectlayer-outline/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import OutlineEffectLayer from 'phaser3-rex-plugins/plugins/outlineeffectlayer.js';\n
    • Add outline effect layer object
      var effectLayer = new OutlineEffectLayer(scene, config);\nscene.add.existing(effectLayer);\n
    "},{"location":"effectlayer-outline/#create-instance","title":"Create instance","text":"
    var effectLayer = scene.add.rexOutlineEffectLayer({\n// knockout: false,\n// thickness: 3,\n// outlineColor: 0x000000\n});\n
    • knockout :
      • true : Draw outline only.
      • false : Draw source texture and outline both.
    • thickness : Thickness of outline.
    • outlineColor : Color of outline.
    "},{"location":"effectlayer-outline/#custom-class","title":"Custom class","text":"
    • Define class
      class MyOutlineEffectLayer extends OutlineEffectLayer {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var effectLayer = new MyOutlineEffectLayer(scene, config);\n
    "},{"location":"effectlayer-outline/#thickness","title":"Thickness","text":"
    • Get
      var thickness = effectLayer.thickness;\n
    • Set
      effectLayer.thickness = thickness;\n// effectLayer.thickness += value;\n
      or
      effectLayer.setThickness(value);\n
    "},{"location":"effectlayer-outline/#outline-color","title":"Outline color","text":"
    • Get
      var color = effectLayer.outlineColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      effectLayer.setOutlineColor(value);\n
      effectLayer.outlineColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"effectlayer-outline/#target-game-objects","title":"Target game objects","text":"

    Draw outline of added target game objects.

    • Add
      effectLayer.add(gameObject);\n
    • Remove
      effectLayer.remove(gameObject);\n
    • Clear
      effectLayer.clear();\n
    • Contains
      var hasGameObject = effectLayer.contains(gameObject);\n
    "},{"location":"effectlayer-outline/#limitation","title":"Limitation","text":"
    • Can't support if camera.zoom is less then 1

    • Can't support if camera.startFollow(gameObject), i.e. please scroll camera before target game objects draw on effect layer game object.

    "},{"location":"eightdirection/","title":"8 direction","text":""},{"location":"eightdirection/#introduction","title":"Introduction","text":"

    Move game object by cursor keys, with a constant speed.

    • Author: Rex
    • Arcade behavior of game object
    "},{"location":"eightdirection/#live-demos","title":"Live demos","text":"
    • Virtual-joyStick + Eight-direction
    "},{"location":"eightdirection/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"eightdirection/#install-plugin","title":"Install plugin","text":""},{"location":"eightdirection/#load-minify-file","title":"Load minify file","text":"
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeightdirectionplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeightdirectionplugin.min.js', true);\n
    • Add eight-direction behavior
      var eightDirection = scene.plugins.get('rexeightdirectionplugin').add(gameObject, config);\n
    "},{"location":"eightdirection/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine and install plugin in configuration of game
      import EightDirectionPlugin from 'phaser3-rex-plugins/plugins/eightdirection-plugin.js';\nvar config = {\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEightDirection',\nplugin: EightDirectionPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add eight-direction behavior
      var eightDirection = scene.plugins.get('rexEightDirection').add(gameObject, config);\n
    "},{"location":"eightdirection/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Import class
      import EightDirection from 'phaser3-rex-plugins/plugins/eightdirection.js';\n
    • Add eight-direction behavior
      var eightDirection = new EightDirection(gameObject, config);\n
    "},{"location":"eightdirection/#create-instance","title":"Create instance","text":"
    var eightDirection = scene.plugins.get('rexEightDirection').add(gameObject, {\nspeed: 200,\n// dir: '8dir',     // 0|'up&down'|1|'left&right'|2|'4dir'|3|'8dir'\n// rotateToDirection: false,\n// wrap: false,\n// padding: 0,\n// enable: true,\n// cursorKeys: scene.input.keyboard.createCursorKeys()\n});\n
    • speed : moving speed, pixels in second.
    • dir :
      • 'up&down', or 0 :Aaccept up or down cursor keys only.
      • 'left&right', or 1 : Aaccept left or right cursor keys only.
      • '4dir', or 2 : Aaccept up, down, left or right cursor keys.
      • '8dir', or 3 : Aaccept up, up-left, up-right, down, down-left, down-right, left, or right cursor keys.
    • rotateToDirection : Set true to change angle towards moving direction.
    • Wrap
      • wrap : Set true to enable wrap mode. Default value is false.
      • padding
    • enable : set false to disable moving.
    • cursorKeys : CursorKey object, using keyboard's cursorKeys by default.
    "},{"location":"eightdirection/#set-speed","title":"Set speed","text":"
    eightDirection.setSpeed(speed);\n// eightDirection.speed = speed;\n
    "},{"location":"eightdirection/#set-rotate-to-direction","title":"Set rotate-to-direction","text":"
    eightDirection.setRotateToDirection(rotateToDirection);\n
    • rotateToDirection : Set true to change angle towards moving direction
    "},{"location":"eightdirection/#set-direction-mode","title":"Set direction mode","text":"
    eightDirection.setDirMode(dir);\n
    • dir :
      • 'up&down', or 0 :Aaccept up or down cursor keys only.
      • 'left&right', or 1 : Aaccept left or right cursor keys only.
      • '4dir', or 2 : Aaccept up, down, left or right cursor keys.
      • '8dir', or 3 : Aaccept up, up-left, up-right, down, down-left, down-right, left, or right cursor keys.
    "},{"location":"eightdirection/#set-wrap-mode","title":"Set wrap mode","text":"
    ship.setWrapMode(wrap, padding);\n
    • wrap : Set true to enable wrap mode.
    "},{"location":"eventemitter3/","title":"Event emitter","text":""},{"location":"eventemitter3/#introduction","title":"Introduction","text":"

    Event emitter.

    "},{"location":"eventemitter3/#usage","title":"Usage","text":""},{"location":"eventemitter3/#get-event-emitter","title":"Get event emitter","text":"
    • Scene:
      var ee = scene.events;\n
    • Game object:
      var ee = gameObject;\n
    "},{"location":"eventemitter3/#attach-listener","title":"Attach listener","text":"
    ee.on(eventName, callback, scope);\nee.once(eventName, callback, scope);  // only fire listeners one time\n

    Alias

    ee.addListener(eventName, callback, scope);\nee.addListener(eventName, callback, scope, true);  // only fire listeners one time\n
    "},{"location":"eventemitter3/#fire-event","title":"Fire event","text":"
    ee.emit(eventName, parameter0, ...);\n
    "},{"location":"eventemitter3/#remove-listeners","title":"Remove listeners","text":"
    • Remove a linstener
      ee.off(eventName, callback, scope);\nee.off(eventName, callback, scope, true);   // only remove one-time listeners\n
      or
      ee.removeListener(eventName, callback, scope); ee.removeListener(eventName, callback, scope, true);  // only remove one-time listeners\n
    • Remove listeners of an event
      ee.off(eventName);\n
      or
      ee.removeListener(eventName); 
    • Remove listeners of all events
      ee.removeAllListeners();\n
    "},{"location":"eventemitter3/#get-listeners-count","title":"Get listeners count","text":"
    var count = ee.listenerCount(eventName);\n//var noListener = (ee.listenerCount(eventName) === 0);\n
    "},{"location":"eventemitter3/#get-listeners","title":"Get listeners","text":"
    var listeners = ee.listeners(eventName);\n
    "},{"location":"eventemitter3/#get-event-names","title":"Get event names","text":"
    var names = ee.eventNames();\n
    "},{"location":"eventemitter3/#listener","title":"Listener","text":"
    {\nfn: callback,\ncontext: scope,\nonce: once\n}\n
    "},{"location":"eventemitter3/#custom-event-emitter-class","title":"Custom event emitter class","text":"
    class MyEventEmitter extends Phaser.Events.EventEmitter {\n// construct() {\n//     super();\n// }\n\n// destroy() {\n//     super.destroy();\n// }\n}\n
    "},{"location":"eventpromise/","title":"Event promise","text":""},{"location":"eventpromise/#introduction","title":"Introduction","text":"

    Return a promise of an event.

    • Author: Rex
    • Method only
    "},{"location":"eventpromise/#live-demos","title":"Live demos","text":"
    • Wait complete
    "},{"location":"eventpromise/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"eventpromise/#install-plugin","title":"Install plugin","text":""},{"location":"eventpromise/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexeventpromiseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexeventpromiseplugin.min.js', true);\n
    • Get event promise
      var promoise = scene.plugins.get('rexeventpromiseplugin').waitEvent(eventEmitter, eventName);\n// var promoise = scene.plugins.get('rexeventpromiseplugin').waitComplete(eventEmitter);\n
    "},{"location":"eventpromise/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import EventPromisePlugin from 'phaser3-rex-plugins/plugins/eventpromise-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexEventPromise',\nplugin: EventPromisePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Get event promise
      var promoise = scene.plugins.get('rexEventPromise').waitEvent(eventEmitter, eventName);\n// var promoise = scene.plugins.get('rexEventPromise').waitComplete(eventEmitter);\n
    "},{"location":"eventpromise/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { WaitEvent, WaitComplete } from 'phaser3-rex-plugins/plugins/eventpromise.js';\n
    • Get event promise
      var promoise = WaitEvent(eventEmitter, eventName);\n// var promoise = WaitComplete(eventEmitter);\n
    "},{"location":"eventpromise/#get-event-promise","title":"Get event promise","text":"
    var promoise = scene.plugins.get('rexEventPromise').waitEvent(eventEmitter, eventName)\n.then(function() {\n\n})\n
    • eventEmitter : Any kind of event emitter. for example, game object, or tween task, or scene event
    "},{"location":"eventpromise/#get-complete-event-promise","title":"Get complete event promise","text":"
    var promoise = scene.plugins.get('rexEventPromise').waitComplete(eventEmitter)\n.then(function() {\n\n})\n
    • eventEmitter : Event emitter which will fire 'complete' event, for example, tween task.
    "},{"location":"expression-parser/","title":"Expression parser","text":""},{"location":"expression-parser/#introduction","title":"Introduction","text":"

    Parse expression string into function. Parser is generated from jison

    • Author: Rex
    • Member of scene
    "},{"location":"expression-parser/#live-demos","title":"Live demos","text":"
    • Dot-notation
    • Custom method
    • Proxy as context
    "},{"location":"expression-parser/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"expression-parser/#install-plugin","title":"Install plugin","text":""},{"location":"expression-parser/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexexpressionparserplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexexpressionparserplugin.min.js', true);\n
    • Add parser
      var parser = scene.plugins.get('rexexpressionparserplugin').add();\n
    • Or, parse expression to function object.
      var f = scene.plugins.get('rexexpressionparserplugin').compile(expressionString);\n// var value = f(context);\n
    "},{"location":"expression-parser/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ExpressionParserPlugin from 'phaser3-rex-plugins/plugins/expressionparser-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexExpressionParserPlugin',\nplugin: ExpressionParserPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add parser
      var parser = scene.plugins.get('rexExpressionParserPlugin').add();\n
    • Or, parse expression to function object.
      var f = scene.plugins.get('rexExpressionParserPlugin').compile(expressionString);\n// var value = f(context);\n
    "},{"location":"expression-parser/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ExpressionParser from 'phaser3-rex-plugins/plugins/expressionparser.js';\n
    • Add parser
      var parser = new ExpressionParser();\n
    "},{"location":"expression-parser/#create-instance","title":"Create instance","text":"
    var parser = scene.plugins.get('rexExpressionParserPlugin').add();\n
    "},{"location":"expression-parser/#execute","title":"Execute","text":""},{"location":"expression-parser/#compile-then-execute","title":"Compile then execute","text":"
    1. Compile expression string into function
      var f = parser.compile(expressionString);\n
      or
      var f = scene.plugins.get('rexExpressionParserPlugin').compile(expressionString);\n
      • expressionString :
        • Number : 1, 1.5, 0xf.
        • Variable : a, $a, _a, a.$b._c_, a['b'].c
        • Arithmetic : +, -, *, \\, %, (, ), ex : '(a + b.c) * 3 + (2 % 3)'.
        • Boolean : >, <, >=, <=, ==, !=, &&, ||, ex '(a > 10) && (a < 30) || (b.c > c)'.
        • Condition : (cond)? v0:v1, ex'(a > b.c)? a:b.c'.
        • Custom method : randomInt(a, b.c).
        • String concat : 'Hello ' + name.
    2. Invoke function
      var value = f(context);\n
      • f : Function object from compiled result.
      • context : Varables used in expression.
        {\na: 10,  // Number\nb: {c: 10},  // Objet with number property\nc: 20,\nrandomInt(a, b) {  // Custom method\nreturn Math.floor(Math.random()*(b-a)+a);\n}\n}\n
    "},{"location":"expression-parser/#execute-directly","title":"Execute directly","text":"
    var value = parser.exec(expressionString, context);\n

    or

    var value = parser.exec(f, context);\n
    "},{"location":"expression-parser/#custom-method","title":"Custom method","text":"
    • Add method into parser instance
      var parser = scene.plugins.get('rexExpressionParserPlugin').add();\nparser.randomInt = function(a, b) {\nreturn Math.floor(Math.random()*(b-a)+a); }\n// var value = parser.exec('randomInt(a, b)', {a:10, b:20});\n
    • Declare method into class of parser
      class MyParser extends ExpressionParser {\nrandomInt(a, b) {\nreturn Math.floor(Math.random()*(b-a)+a); }\n}\nvar parser = new MyParser();\n// var value = parser.exec('randomInt(a, b)', {a:10, b:20});\n
    • Add method into context
      var context = {\na: 10,\nb: 20,\nrandomInt(a, b) {  // Custom method\nreturn Math.floor(Math.random()*(b-a)+a);\n}\n}\nvar value = parser.exec('randomInt(a, b)', context);\n
    "},{"location":"expression-parser/#proxy-as-context","title":"Proxy as context","text":"

    Proxy with has and get handlers could be a context.

    For example, proxy scene data :

    var context = new Proxy({}, {\nhas(target, key) {\nreturn scene.data.has(key);\n},\nget(target, prop) {\nreturn scene.data.get(prop);\n}\n})\n

    or

    var context = scene.plugins.get('rexExpressionParserPlugin').createProxyContext({\nhas(target, key) {\n// return boolean\n},\nget(target, prop) {\n// return any;\n}\n})\n
    "},{"location":"fadeoutdestroy/","title":"Fade out destroy","text":""},{"location":"fadeoutdestroy/#introduction","title":"Introduction","text":"

    Fade out game object then destroy it.

    • Author: Rex
    • Method only
    "},{"location":"fadeoutdestroy/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"fadeoutdestroy/#install-plugin","title":"Install plugin","text":""},{"location":"fadeoutdestroy/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfadeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfadeplugin.min.js', true);\n
    • Fade-out-destroy
      var fade = scene.plugins.get('rexfadeplugin').fadeOutDestroy(gameObject, duration);\n
    "},{"location":"fadeoutdestroy/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FadePlugin from 'phaser3-rex-plugins/plugins/fade-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFade',\nplugin: FadePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Fade-out-destroy
      var fade = scene.plugins.get('rexFade').fadeOutDestroy(gameObject, duration);\n
    "},{"location":"fadeoutdestroy/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import FadeOutDestroy from 'phaser3-rex-plugins/plugins/fade-out-destroy.js';\n
    • Fade-out-destroy
      var fade = FadeOutDestroy(gameObject, duration);\n
    "},{"location":"fadeoutdestroy/#fade-out-destroy","title":"Fade-out-destroy","text":"
    var fade = scene.plugins.get('rexFade').fadeOutDestroy(gameObject, duration);\n
    "},{"location":"fadeoutdestroy/#events","title":"Events","text":"

    See Events of tween task

    • Scale completes or is stopped.
      fade.on('complete', function(gameObject, fade){\n\n}, scope);\n
    "},{"location":"fadeoutdestroy/#inject-methods","title":"Inject methods","text":"
    • Inject methods into game object
      scene.plugins.get('rexFade').injectMethods(gameObject);\n
    • Inject methods into class of game object
      scene.plugins.get('rexFade').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexFade').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into class of game object
      scene.plugins.get('rexFade').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexFade').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into root class of game object
      scene.plugins.get('rexFade').injectMethodsToRootClass(e);\n// scene.plugins.get('rexFade').injectMethods(Phaser.GameObjects.GameObject.prototype);\n
    "},{"location":"fadeoutdestroy/#injected-methods","title":"Injected methods","text":"
    • Fade-in
      gameObject.fadeIn(duration);\n
      or
      gameObject.fadeIn(duration, endAlpha);\n
      or
      gameObject.fadeIn(duration, {start:0, end:1});\n
      or
      gameObject.fadeInPromise(duration, endAlpha)\n.then(function(){\n// ...\n})\n
      or
      gameObject.fadeInPromise(duration, {start:0, end:1})\n.then(function(){\n// ...\n})\n
    • Fade-out destroy
      gameObject.fadeOutDestroy(duration);\n
      or
      gameObject.fadeOutDestroyPromise(duration)\n.then(function(){\n// ...\n})\n
    • Fade-out without destroy
      gameObject.fadeOut(duration);\n
      or
      gameObject.fadeOutPromise(duration)\n.then(function(){\n// ...\n})\n
    • Events
      • Fade-in complete
        gameObject.on('fadein.complete', function(gameObject) { });\n
      • Fade-out, fade-out destroy complete
        gameObject.on('fadeout.complete', function(gameObject) { });\n
    "},{"location":"fadevolume/","title":"Volume fading","text":""},{"location":"fadevolume/#introduction","title":"Introduction","text":"

    Fade-in/fade-out volume of sound.

    • Author: Rex
    • Method only
    "},{"location":"fadevolume/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"fadevolume/#install-plugin","title":"Install plugin","text":""},{"location":"fadevolume/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexsoundfadeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexsoundfadeplugin.min.js', true);\n
    • Sound fade-in/fade-out
      var sound = scene.plugins.get('rexsoundfadeplugin').fadeIn(sound, duration);\nvar sound = scene.plugins.get('rexsoundfadeplugin').fadeOut(sound, duration);\n
    "},{"location":"fadevolume/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SoundFadePlugin from 'phaser3-rex-plugins/plugins/soundfade-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSoundFade',\nplugin: SoundFadePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Sound fade-in/fade-out
      var sound = scene.plugins.get('rexSoundFade').fadeIn(sound, duration);\nvar sound = scene.plugins.get('rexSoundFade').fadeOut(sound, duration);\n
    "},{"location":"fadevolume/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import SoundFade from 'phaser3-rex-plugins/plugins/soundfade.js';\n
    • Sound fade-in/fade-out
      var sound = SoundFade.fadeIn(sound, duration);\nvar sound = SoundFade.fadeOut(sound, duration);\n
    "},{"location":"fadevolume/#fade-in","title":"Fade in","text":"
    • Play and fade in voluem.
      var sound = scene.plugins.get('rexSoundFade').fadeIn(sound, duration);\n// var sound = scene.plugins.get('rexSoundFade').fadeIn(sound, duration, endVolume, startVolume);\n
      • sound : Sound instance, or a key of audio cache.
    "},{"location":"fadevolume/#fade-out","title":"Fade out","text":"
    • Fade out volume then destroy it
      scene.plugins.get('rexSoundFade').fadeOut(sound, duration);\n
      • sound : Sound instance.
    • Fade out volume then stop it
      scene.plugins.get('rexSoundFade').fadeOut(sound, duration, false);\n
      • sound : Sound instance.
    "},{"location":"filechooser/","title":"File chooser","text":""},{"location":"filechooser/#introduction","title":"Introduction","text":"

    Create a transparent file chooser button (<input type=\"file\">).

    • Author: Rex
    • DOM Game object
    "},{"location":"filechooser/#live-demos","title":"Live demos","text":"
    • File chooser button
    • Open file chooser dialog
    "},{"location":"filechooser/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"filechooser/#install-plugin","title":"Install plugin","text":""},{"location":"filechooser/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfilechooserplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfilechooserplugin.min.js', true);\n
    • Add file chooser object
      var fileChooser = scene.add.rexFileChooser(config);\n
    "},{"location":"filechooser/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FileChooserPlugin from 'phaser3-rex-plugins/plugins/filechooser-plugin.js';\nvar config = {    parent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFileChooser',\nplugin: FileChooserPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add file chooser object
      var fileChooser = scene.add.rexFileChooser(config);\n
    "},{"location":"filechooser/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { FileChooser } from 'phaser3-rex-plugins/plugins/filechooser.js';\n
    • Add file chooser object
      var fileChooser = new FileChooser(config);\nscene.add.existing(fileChooser);\n
    "},{"location":"filechooser/#add-file-chooser-object","title":"Add file chooser object","text":"
    var fileChooser = scene.add.rexFileChooser({\naccept: '',\nmultiple: false\n});\n// var fileChooser = scene.add.rexFileChooser(x, y, width, height, config);\n
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    • multiple : Set true to select multiple files.
    "},{"location":"filechooser/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFlieChooser extends FileChooser {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var fileChooser = new MyFlieChooser(scene, x, y, width, height, config);\n
    "},{"location":"filechooser/#sync","title":"Sync","text":"

    Sync position, size and origin to another game object.

    fileChooser.syncTo(gameObject);\n
    "},{"location":"filechooser/#selected-files","title":"Selected files","text":"
    var files = fileChooser.files;\n
    • files : Array of file object.
    "},{"location":"filechooser/#set-accept-filter","title":"Set accept filter","text":"
    fileChooser.setAccept(accept);\n
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    "},{"location":"filechooser/#multiple-files","title":"Multiple files","text":"
    • Enable
      fileChooser.setMultiple();\n
    • Disable
      fileChooser.setMultiple(false);\n
    "},{"location":"filechooser/#events","title":"Events","text":"
    • Selected file(s) changed
      fileChooser.on('change', function(fileChooser) {\nvar files = fileChooser.files;\nif (files.length === 0) { // No selected file\nreturn;\n}\n\nvar file = files[0];\nvar url = URL.createObjectURL(file);\n// ...\n})\n
    "},{"location":"filechooser/#load-file-to-cache","title":"Load file to cache","text":"
    fileChooser.loadFile(file, loaderType, key);\n// fileChooser.loadFile(file, loaderType, key, cahceType);\n

    or

    fileChooser.loadFilePromise(file, loaderType, key, cahceType)\n.then(function(content) {\n\n})\n
    • file : File object, see Events
    • loaderType : image, text, binary, ... See Loader
    • key : Unique string key.
    • cahceType :
      • undefined : Use default value.
    • content : Content of file.
    "},{"location":"filechooser/#create-object-url","title":"Create object URL","text":"
    • Create object url
      var objectURL = URL.createObjectURL(file);\n
    • Release object url
      URL.revokeObjectURL(objectURL);\n
    "},{"location":"filechooser/#open-file-chooser","title":"Open file chooser","text":"

    Failure

    This method won't work at ios.

    Note

    Open a file chooser dialog under any touch event. i.e. User can't open file chooser dialog directly.

    scene.plugins.get('rexFileChooser').open({\n// accept: '',\n// multiple: false,\n// closeDelay: 200\n})\n.then(function(result) {\n// var files = result.files;\n})\n
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    • multiple : Set true to select multiple files.
    • closeDelay : Add a small delay to detect dialog canceled after game focus.
      • File chooser dialog dose not have cancel event.
    • files : Array of selected files.
      • Each file object (files[i]) has properties
        • file.name : File name with file extension.
        • file.type : File type. (ex. 'image/jpeg')
        • file.size : File size in bytes.
        • file.lastModified : Timestamp of last-modified time.
        • file.lastModifiedDate : Date object of last-modified time. Equal to new Data(lastModified).
        • Get object url :
          var objectURL = URL.createObjectURL(file);\n
      • Length files is 0 : User cancels file chooser dialog.
    "},{"location":"filechooser/#enable-clicking-open","title":"Enable clicking-open","text":"
    • Enable
      fileChooser.setOpenEnable();\n// fileChooser.setOpenEnable(true);\n
    • Disable
      fileChooser.setOpenEnable(false)\n
    "},{"location":"filechooser/#other-properties","title":"Other properties","text":"

    See dom game object, game object

    "},{"location":"filechooser/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"filedropzone/","title":"File drop zone","text":""},{"location":"filedropzone/#introduction","title":"Introduction","text":"

    Create a div element for dropping file(s).

    • Author: Rex
    • DOM Game object
    "},{"location":"filedropzone/#live-demos","title":"Live demos","text":"
    • Drop text file
    • Drop image file
    • Interactve with other game objects
    "},{"location":"filedropzone/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"filedropzone/#install-plugin","title":"Install plugin","text":""},{"location":"filedropzone/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfiledropzoneplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfiledropzoneplugin.min.js', true);\n
    • Add file-drop-zone object
      var fileDropZone = scene.add.rexFileDropZone(config);\n
    "},{"location":"filedropzone/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FileDropZonePlugin from 'phaser3-rex-plugins/plugins/filedropzone-plugin.js';\nvar config = {    parent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n}, // ...\nplugins: {\nglobal: [{\nkey: 'rexFileDropZone',\nplugin: FileDropZonePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add file-drop-zone object
      var fileDropZone = scene.add.rexFileDropZone(config);\n
    "},{"location":"filedropzone/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { FileDropZone } from 'phaser3-rex-plugins/plugins/filedropzone.js';\n
    • Add file-drop-zone object
      var fileDropZone = new FileDropZone(config);\nscene.add.existing(fileDropZone);\n
    "},{"location":"filedropzone/#add-file-drop-zone-object","title":"Add file-drop-zone object","text":"
    var fileDropZone = scene.add.rexFileDropZone({\n// style: { },\n\n// dropEnable: true,\n// filters: { filterType: (file, files) => boolean }\n});\n// var fileDropZone = scene.add.rexFileDropZone(x, y, width, height, config);\n
    • style : CSS style of div element.
    • dropEnable :
      • true : Fire drop events when dropping files. Default behavior.
      • false : Won't fire drop events.
    • filters : Filter methods, optional. For example, image files filter, will fire 'drop.image' event
      {\nimage: function(file, files) { return file.name.match(/\\.(jpg|jpeg|png|gif)$/i)\n}\n}\n
    "},{"location":"filedropzone/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFileDropZone extends FileDropZone {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var fileDropZone = new MyFileDropZone(scene, x, y, width, height, config);\n
    "},{"location":"filedropzone/#sync","title":"Sync","text":"

    Sync position, size and origin to another game object.

    fileDropZone.syncTo(gameObject);\n
    "},{"location":"filedropzone/#dropped-files","title":"Dropped files","text":"
    var files = fileDropZone.files;\n
    • files : Array of file object.
    "},{"location":"filedropzone/#events","title":"Events","text":"
    • Drop files
      fileDropZone.on('drop', function(fileDropZone) {\nvar files = fileDropZone.files;\n})\n
    • Drop filtered files
      fileDropZone.on('drop.' + filterType, function(files) {\n})\n
    • Drag-enter/drag-leave/drag-over file(s)
      fileDropZone.on('dragenter', function(fileDropZone) {\n})\n
      fileDropZone.on('dragleave', function(fileDropZone) {\n})\n
      fileDropZone.on('dragover', function(fileDropZone) {\n})\n

    Warning

    Game objects under this file drop zone can't receive touch input events.

    "},{"location":"filedropzone/#enable-drop-events","title":"Enable drop events","text":"
    • Enable
      fileDropZone.setDropEnable();\n// fileDropZone.setDropEnable(true);\n
    • Disable
      fileDropZone.setDropEnable(false);\n
    • Toggle
      fileDropZone.toggleDropEnable();\n
    "},{"location":"filedropzone/#load-file-to-cache","title":"Load file to cache","text":"
    fileDropZone.loadFile(file, loaderType, key);\n// fileDropZone.loadFile(file, loaderType, key, cahceType, onComplete);\n

    or

    fileDropZone.loadFilePromise(file, loaderType, key, cahceType)\n.then(function(content) {\n\n})\n
    • file : File object, see Events
    • loaderType : image, text, binary, ... See Loader
    • key : Unique string key.
    • cahceType :
      • undefined : Use default value.
    • onComplete : Callback invoked when file loaded to cache.
    • content : Content of file.
    "},{"location":"filedropzone/#create-object-url","title":"Create object URL","text":"
    • Create object url
      var objectURL = URL.createObjectURL(file);\n
    • Release object url
      URL.revokeObjectURL(objectURL);\n
    "},{"location":"filedropzone/#other-properties","title":"Other properties","text":"

    See dom game object, game object

    "},{"location":"filedropzone/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"firebase-auth/","title":"Authentication","text":""},{"location":"firebase-auth/#introduction","title":"Introduction","text":"

    It supports authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook and Twitter, and more.

    • Author: Firebase
    "},{"location":"firebase-auth/#usage","title":"Usage","text":"

    Official document

    Sample code

    "},{"location":"firebase-auth/#setup","title":"Setup","text":"
    1. Import firestore
      import firebase from 'firebase/app';\nimport 'firebase/auth';\n
      Firebase has been included in package.json.
    2. Initialize
      var firebaseApp = firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n});\n
    "},{"location":"firebase-auth/#on-sign-insign-out","title":"On sign-in/sign-out","text":"
    firebaseApp.auth().onAuthStateChanged(function (user) {\nif (user) {\n// User is signed in.\nvar displayName = user.displayName;\nvar email = user.email;\nvar emailVerified = user.emailVerified;\nvar photoURL = user.photoURL;\nvar isAnonymous = user.isAnonymous;\nvar uid = user.uid;\nvar providerData = user.providerData;\n// ...\n} else {\n// User is signed out.\n// ...\n}\n});\n
    "},{"location":"firebase-auth/#sign-in-with-facebook","title":"Sign-in with facebook","text":"
    var provider = new firebase.auth.FacebookAuthProvider();\nfirebaseApp.auth().signInWithPopup(provider).then(function (result) {\n// This gives you a Facebook Access Token. You can use it to access the Facebook API.\nvar token = result.credential.accessToken;\n// The signed-in user info.\nvar user = result.user;\n// ...\n}).catch(function (error) {\n// Handle Errors here.\nvar errorCode = error.code;\nvar errorMessage = error.message;\n// The email of the user's account used.\nvar email = error.email;\n// The firebase.auth.AuthCredential type that was used.\nvar credential = error.credential;\n// ...\n});\n
    "},{"location":"firebase-auth/#sign-in-with-google","title":"Sign-in with Google","text":"
    var provider = new firebase.auth.GoogleAuthProvider();\nfirebaseApp.auth().signInWithPopup(provider).then(function (result) {\n// This gives you a Google Access Token. You can use it to access the Google API.\nvar token = result.credential.accessToken;\n// The signed-in user info.\nvar user = result.user;\n// ...\nconsole.log(user);\n}).catch(function (error) {\n// Handle Errors here.\nvar errorCode = error.code;\nvar errorMessage = error.message;\n// The email of the user's account used.\nvar email = error.email;\n// The firebase.auth.AuthCredential type that was used.\nvar credential = error.credential;\n// ...\n});\n
    "},{"location":"firebase-auth/#sign-in-with-password","title":"Sign-in with password","text":"
    • Create new user
      firebaseApp.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {\n// Handle Errors here.\nvar errorCode = error.code;\nvar errorMessage = error.message;\n});\n
    • Sign-in
      firebase.auth().signInWithEmailAndPassword(email, password).catch(function (error) {\n// Handle Errors here.\nvar errorCode = error.code;\nvar errorMessage = error.message;\n});\n
    "},{"location":"firebase-auth/#sign-out","title":"Sign-out","text":"
    firebaseApp.auth().signOut();\n
    "},{"location":"firebase-auth/#current-sign-in-user","title":"Current sign-in user","text":"
    var user = firebaseApp.auth().currentUser;\nif (user != null) {\nvar name = user.displayName;\nvar email = user.email;\nvar photoUrl = user.photoURL;\nvar emailVerified = user.emailVerified;\nvar uid = user.uid;\n}\n
    "},{"location":"firebase-auth/#update-email","title":"Update email","text":"
    user.updateEmail('...').then(function() {\n// Update successful.\n}).catch(function(error) {\n// An error happened.\n});\n
    "},{"location":"firebase-auth/#update-profile","title":"Update profile","text":"
    user.updateProfile({\ndisplayName: '...',\nphotoURL: '...'\n}).then(function() {\n// Update successful.\n}).catch(function(error) {\n// An error happened.\n});\n
    "},{"location":"firebase-auth/#send-a-verification-email","title":"Send a verification email","text":"
    user.sendEmailVerification().then(function() {\n// Email sent.\n}).catch(function(error) {\n// An error happened.\n});\n
    "},{"location":"firebase-broadcast/","title":"Broadcast","text":""},{"location":"firebase-broadcast/#introduction","title":"Introduction","text":"

    Broadcast real-time messages, using firebase-database.

    • Author: Rex
    "},{"location":"firebase-broadcast/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-broadcast/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-broadcast/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add messager object
      var messager = scene.plugins.get('rexfirebaseplugin').add.broadcast(config);\n
    "},{"location":"firebase-broadcast/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add messager object
      var messager = scene.plugins.get('rexFirebase').add.broadcast(config);\n
    "},{"location":"firebase-broadcast/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { Broadcast } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add messager object
      var messager = new Broadcast(config);\n
    "},{"location":"firebase-broadcast/#create-instance","title":"Create instance","text":"
    var messager = scene.plugins.get('rexFirebase').add.broadcast({\nroot: '',\n// senderID: '',\n// senderName: '',\n// receiverID: '',\n// history: 0\n});\n
    • root : Path of this messager.
    • senderID : ID of sender.
    • senderName : Name of sender.
    • receiverID : ID of receiver/channel.
    • history : Stored received (history) messages in client side.
      • 0, or false : No history message stored.
      • -1, or true : Infinity history message stored. i.e. store all messages from starting updating.
      • A number larger then 0 : Length of stored history message.
    "},{"location":"firebase-broadcast/#send-message","title":"Send message","text":"
    1. Set sender in config, or setSender method.
      messager.setSender(userID, userName);\n
      or
      messager.setSender({\nuserID: userID,\nuserName: userName\n});\n
      • userID : User ID of sender.
      • userName : Display name of sender.
    2. Set receiver in config, or setReceiver method.
      messager.setReceiver(receiverID);\n
      • receiverID : ID of receiver/channel.
    3. Send message to receiverID.
      messager.send(message)\n// .then(function() { })\n// .catch(function() { })\n
      • message : A string message, or a JSON data.
    "},{"location":"firebase-broadcast/#receive-messages","title":"Receive messages","text":"
    1. Register receive event
      messager.on('receive', function(data){\n// var senderID = data.senderID;\n// var senderName = data.senderName;\n// var message = data.message;\n})\n
    2. Set receiver in config, or setReceiver method
      messager.setReceiver(receiverID);\n
      • receiverID : ID of receiver/channel.
    3. Start receiving
      messager.startReceiving();\n
    4. Stop receive
      messager.stopReceiving();\n

    Only receive messages after invoking startReceiving method. Previous messages won't be got anymore.

    "},{"location":"firebase-broadcast/#received-messages","title":"Received messages","text":"

    Received messages will be saved in client side.

    • Get received (history) messages.
      var messages = messager.getHistory();\n
    • Clear history messages.
      messager.clearHistory();\n
    "},{"location":"firebase-files/","title":"Files","text":""},{"location":"firebase-files/#introduction","title":"Introduction","text":"

    Save JSON data, using firebase-firestore.

    Each owner has several files, each file contains header and content indexed by fileID.

    • Author: Rex
    "},{"location":"firebase-files/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-files/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-files/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add file-manager object
      var fileManager = scene.plugins.get('rexfirebaseplugin').add.files(config);\n
    "},{"location":"firebase-files/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add file-manager object
      var fileManager = scene.plugins.get('rexFirebase').add.files(config);\n
    "},{"location":"firebase-files/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { Files } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add file-manager object
      var fileManager = new Files(config);\n
    "},{"location":"firebase-files/#create-instance","title":"Create instance","text":"
    var fileManager = scene.plugins.get('rexFirebase').add.files({\nroot: ''\n});\n
    • root : Collection name of these files.
    "},{"location":"firebase-files/#save-file","title":"Save file","text":"
    1. Set file owner.
      fileManager.setOwner(userID);\n
      or
      fileManager.setOwner({\nuserID: userID\n});\n
      • userID : User ID of file owner.
    2. Save header and content data.
      • Overwrite
        fileManager.save(fileID, header, content);\n
        • fileID : Unique ID of this file.
        • header : Header data for indexing, a JSON object.
          • Reserve keys : userID, fileID, type, contentDocID. (i.e. don't use these keys)
        • content : Content/body, a JSON object.
          • Reserve keys : userID, fileID, type. (i.e. don't use these keys)
      • Update
        fileManager.save(fileID, header, content, true);\n
    "},{"location":"firebase-files/#load-headers","title":"Load headers","text":"
    1. Set file owner.
      fileManager.setOwner(userID);\n
    2. Load all headers of this file owner.
      fileManager.loadHeaders()\n.then(function(result) { // var headers = result.headers;\n// var userID = result.userID;\n})\n.catch(function(result) {\n// var error = result.error;\n// var userID = result.userID;\n})\n
      • headers : Get header by headers[fileID], each header contains
        • header.fileID : Unique ID of this file.
        • header.userID : User ID of file owner.
    "},{"location":"firebase-files/#load-file","title":"Load file","text":"
    1. Set file owner.
      fileManager.setOwner(userID);\n
    2. Load file.
      fileManager.load(fileID)\n.then(function(result) { // var header = result.header;\n// var content = result.content;\n// var fileID = result.fileID;\n// var userID = result.userID;\n})\n.catch(function(result) {\n// var error = result.error;\n// var fileID = result.fileID;\n// var userID = result.userID;\n})\n
      • header, content : Header/content of this file.
      • fileID : Unique ID of this file.
      • userID : User ID of file owner.
    "},{"location":"firebase-firestore/","title":"Firestore","text":""},{"location":"firebase-firestore/#introduction","title":"Introduction","text":"

    Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud Platform.

    • Author: Firebase
    "},{"location":"firebase-firestore/#usage","title":"Usage","text":"

    Official document

    Sample code

    "},{"location":"firebase-firestore/#setup","title":"Setup","text":"
    1. Import firestore
      import firebase from 'firebase/app';\nimport 'firebase/firestore';\n
      Firebase has been included in package.json.
    2. Initialize
      var firebaseApp = firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n});\nvar db = firebaseApp.firestore();\ndb.settings({\ntimestampsInSnapshots: true\n})\n
    "},{"location":"firebase-firestore/#references","title":"References","text":"
    • Reference of collection
      var collectionRef = db.collection(collectionName);\n
    • Reference of document
      var docRef = db.collection(collectionName).doc(docName);\n
    "},{"location":"firebase-firestore/#save","title":"Save","text":"
    • Add document
      db.collection(collectionName).add(doc)      // doc: { ... }\n.then(function(doc) { /* ... */ })\n.catch(function(error) { /* ... */ });\n
      Maximum size for a document : 1 MiB (1,048,576 bytes)
    • Set document
      db.collection(collectionName).doc(docName).set(keyValues)  // keyValues: { ... }\n.then(function(doc) { /* ... */ })\n.catch(function(error) { /* ... */ });\n
      Overwrite document
    • Update data
      db.collection(collectionName).doc(docName).update(keyValues)  // keyValues: { ... }\n.then(function(doc) { /* ... */ })\n.catch(function(error) { /* ... */ });\n
    • Batched writes
      // Get a new write batch\nvar batch = db.batch();\n\nbatch.set(db.collection(collectionName).doc(docName), keyValues);\nbatch.update(db.collection(collectionName).doc(docName), keyValues);\nbatch.delete(db.collection(collectionName).doc(docName));\n// ...\n\n// Commit the batch\nbatch.commit()\n.then(function() { /* ... */ })\n.catch(function(error) { /* ... */ });\n
      Maximum document writting in a commit : 500
    • Delete a document
      db.collection(collectionName).doc(docName).delete()\n.then(function() { /* ... */ })\n.catch(function(error) { /* ... */ });\n
    • Delete a field
      db.collection(collectionName).doc(docName).update({\nkey: firebase.firestore.FieldValue.delete()\n})\n.then(function() { /* ... */ })\n.catch(function(error) { /* ... */ });\n
    • Transaction
      var docRef = db.collection(collectionName).doc(docName);\ndb.runTransaction(function(transaction) {\n// read-modify-write\n// This code may get re-run multiple times if there are conflicts.\nreturn transaction.get(docRef).then(function(doc) {\n// doc.exists\ntransaction.update(docRef, keyValues);\n});\n})\n.then(function() {\n//console.log(\"Transaction successfully committed!\");\n})\n.catch(function(error) {\n//console.log(\"Transaction failed: \", error);\n});\n

    Limitation: Writes and transactions section

    "},{"location":"firebase-firestore/#server-timestamp","title":"Server timestamp","text":"
    firebase.firestore.FieldValue.serverTimestamp()\n
    "},{"location":"firebase-firestore/#load","title":"Load","text":"
    • Get a document
      db.collection(collectionName).doc(docName).get()\n.then(function(doc) { /* ... */ })\n.catch(function(error) { /* ... */ });\n
      • doc
        • doc.id
        • doc.data()
    • Get all documents
      db.collection(collectionName).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
      • querySnapshot
        • querySnapshot.docs
        • querySnapshot.forEach(callback, thisArg)
        • querySnapshot.empty
        • querySnapshot.size
    • Simple queries
      db.collection(collectionName).where(key, op, value).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
      • op : '>', '==', '<', '>=', '<='
        • != : where(key,'>', value).where(key, '<', value)
    • Compound queries
      db.collection(collectionName).where(key0, op0, value0).where(key1, op1, value1).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
      • Range filters (<, <=, >, >=) on only one field
    "},{"location":"firebase-firestore/#paginate","title":"Paginate","text":"
    • Order, limit
      db.collection(collectionName).orderBy(key).limit(count)\n
      • Descending order : orderBy(key, 'desc')
      • Order by multiple fields : orderBy(key0).orderBy(key1)
    • Query, order, limit
      db.collection(collectionName).where(key, op, value).orderBy(key).limit(count)\n
      • Key of first order must be equal to range comparison (<, <=, >, >=)
    • Page
      1. Start at
        db.collection(collectionName).orderBy(key).startAt(value).limit(count).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
        • endAt(value)
      2. Next page
        var lastDoc = querySnapshot.docs[querySnapshot.docs.length - 1];\ndb.collection(collectionName).orderBy(key).startAfter(lastDoc).limit(count).get()\n.then(function(querySnapshot) { /* ... */ })\n.catch(function(error){ /* ... */ });\n
        • endBefore(lastDoc)
    "},{"location":"firebase-firestore/#get-realtime-updates","title":"Get realtime updates","text":"
    • Get updates of a document
      var unsubscribe = db.collection(collectionName).doc(docName)\n.onSnapshot(function(doc) { /* ... */ });\n
    • Get updates of documents
      var unsubscribe = db.collection(collectionName).where(key, op, value)\n.onSnapshot(function(querySnapshot) { /* ... */ });\n
      • Changes
        var changes = querySnapshot.docChanges();  // [change]\n
        • Change
          • change.type : 'added', 'modified', 'removed'
          • change.newIndex
          • change.oldIndex
    • Detach a listener
      unsubscribe();\n
    • Events for metadata changes
      var unsubscribe = db.collection(collectionName).doc(docName)\n.onSnapshot({\nincludeMetadataChanges: true    // Listen for document metadata changes\n},\nfunction(doc) { /* ... */ } );\n
    "},{"location":"firebase-firestore/#indexing","title":"Indexing","text":"

    Reference

    "},{"location":"firebase-idalias/","title":"ID-alias","text":""},{"location":"firebase-idalias/#introduction","title":"Introduction","text":"

    Map an unique ID to another unique ID (alias), using firebase-firestore.

    Each owner has several files, each file contains header and content indexed by fileID.

    • Author: Rex
    "},{"location":"firebase-idalias/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-idalias/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-idalias/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add id-alias object
      var idAlias = scene.plugins.get('rexfirebaseplugin').add.idAlias(config);\n
    "},{"location":"firebase-idalias/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add id-alias object
      var idAlias = scene.plugins.get('rexFirebase').add.idAlias(config);\n
    "},{"location":"firebase-idalias/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { IdAlias } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add id-alias object
      var idAlias = new IdAlias(config);\n
    "},{"location":"firebase-idalias/#create-instance","title":"Create instance","text":"
    var idAlias = scene.plugins.get('rexFirebase').add.idAlias({\nroot: ''\n});\n
    • root : Collection name of this id-alias.
    "},{"location":"firebase-idalias/#random-alias","title":"Random alias","text":"

    Get alias of an id, or register an alias from a random word.

    idAlias.getRandomAlias(id, {\ndigits: 10,\ncandidates: '0123456789',\nretry: 1000\n})\n.then(function(result) { // var alias = result.alias;\n// var id = result.id;\n})\n.catch(function(error) { })\n
    • id : An unique ID.
    • digits : String length of alias.
    • candidates : Candidate characters.
    • retry : Max retry count.
    "},{"location":"firebase-idalias/#specific-alias","title":"Specific alias","text":"
    • Add a specific alias
      idAlias.add(id, alias)\n.then(function(result) { // var alias = result.alias;\n// var id = result.id;\n})\n.catch(function(error) { })\n
      • id : An unique ID.
      • alias : Another unique ID.
    • Get ID from alias
      idAlias.getId(alias)\n.then(function(result) { // var alias = result.alias;\n// var id = result.id; // Return undefined if alias is not existed.\n})\n.catch(function(error) { })\n
    • Get alias from ID
      idAlias.getAlias(id)\n.then(function(result) { // var alias = result.alias; // Return undefined if id is not existed.\n// var id = result.id;\n})\n.catch(function(error) { })\n
    "},{"location":"firebase-itemtable/","title":"Item table","text":""},{"location":"firebase-itemtable/#introduction","title":"Introduction","text":"

    1d/2d/3d table, using firebase-database.

    • Author: Rex
    "},{"location":"firebase-itemtable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-itemtable/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-itemtable/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add table object
      var table = scene.plugins.get('rexfirebaseplugin').add.itemTable(config);\n
    "},{"location":"firebase-itemtable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add table object
      var table = scene.plugins.get('rexFirebase').add.itemTable(config);\n
    "},{"location":"firebase-itemtable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { ItemTable } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add table object
      var table = new ItemTable(config);\n
    "},{"location":"firebase-itemtable/#create-instance","title":"Create instance","text":"
    var table = scene.plugins.get('rexFirebase').add.itemTable({\nroot: '',\ntype: 3\n});\n
    • root : Path of this item table.
    • type : Table type.
      • 1, or '1d' : 1d table, indexing by (key0)
      • 2, or '2d' : 2d table, indexing by (key0, key1)
      • 3, or '3d' : 3d table, indexing by (key0, key1, key2)
    "},{"location":"firebase-itemtable/#write","title":"Write","text":"
    • Set data
      table.setData(key0, value)\n// table.setData(key0, key1, value)\n// table.setData(key0, key1, key2, value)\n.then(function() { })\n.catch(function() { })\n
      • key0, key1, key2 : Any string.
      • value : Number, string, or JSON data.
    • Increase value
      table.incValue(key0, value)\n// table.incValue(key0, key1, value)\n// table.incValue(key0, key1, key2, value)\n.then(function() { })\n.catch(function() { })    
      • key0, key1, key2 : Any string.
      • value : Number.
    • Remove key
      table.removeData(key0)\n// table.removeData(key0, key1)\n// table.inremoveDatacValue(key0, key1, key2)\n.then(function() { })\n.catch(function() { })    
      • key0, key1, key2 : Any string.
    • Batch writing specific values at key pathes
      table.updateData({\n`${key0}` : value0,\n`${key0}/${key1}` : value1,\n`${key0}/${key1}/${key2}` : value2,\n...\n})\n.then(function() { })\n.catch(function() { })    
    • Transaction, write new value according to latest value
      table.transaction(key0, callback)\n// table.transaction(key0, key1, callback)\n// table.transaction(key0, key1, key2, callback)\n.then(function() { })\n.catch(function() { })    
      • key0, key1, key2 : Any string.
      • callback : Write new value according to latest value.
        function(preValue) { return newValue; }\n
    • Remove key when current user disconnect
      table.removeDataOnDisconnect(key0)\n// table.removeDataOnDisconnect(key0, key1)\n// table.removeDataOnDisconnect(key0, key1, key2)\n.then(function() { })\n.catch(function() { })        
    • Set value when current user disconnect
      table.setDataOnDisconnect(key0, value)\n// table.setDataOnDisconnect(key0, key1, value)\n// table.setDataOnDisconnect(key0, key1, key2, value)\n.then(function() { })\n.catch(function() { })        
    "},{"location":"firebase-itemtable/#read","title":"Read","text":"
    • Start updating
      table.startUpdate();\n
      • Trigger 'init' event when all data read back.
      • table.initialFlag : Return true when all data read back.
    • Stop updating
      table.stopUpdate();\n
    • Read data stored in client
      var data = table.getData(key0);\n// var data = table.getData(key0, key1);\n// var data = table.getData(key0, key1, key2);\n
      • data : Number, string, or JSON data.
    • Read all data stored in client
      var data = table.getData();\n
      • data : JSON data.
    • Clone data stored in client
      var data = table.cloneData(key0);\n// var data = table.cloneData(key0, key1);\n// var data = table.cloneData(key0, key1, key2);    \n
    • Clone all data stored in client
      var data = table.cloneData();\n
    "},{"location":"firebase-itemtable/#events","title":"Events","text":"
    • Initialize, read all data back after start updating
      table.on('init', function(data) { })\n
      • data : Table data.
      • table.initialFlag will be set to true.
    • Any value updated
      table.on('update', function(data) { })\n
      • data : Table data.
    "},{"location":"firebase-itemtable/#1d-table","title":"1d table","text":"

    1d table, indexing by (key0)

    • On add key0
      table.on('addkey0', function(key0, value) {  });\n
    • On remove key0
      table.on('removekey0', function(key0) {  });\n
    • On change key0
      table.on('changekey0', function(key0, value) {  });\n
    "},{"location":"firebase-itemtable/#2d-table","title":"2d table","text":"

    2d table, indexing by (key0, key1)

    • On add key0
      table.on('addkey0', function(key0, value) {  });\n
    • On remove key0
      table.on('removekey0', function(key0) {  });\n
    • On add key1
      table.on('addkey1', function(key0, key1, value) {  });\n
    • On remove key1
      table.on('removekey1', function(key0, key1) {  });\n
    • On change key1
      table.on('changekey1', function(key0, key1, value) {  });\n
    "},{"location":"firebase-itemtable/#3d-table","title":"3d table","text":"

    3d table, indexing by (key0, key1, key2)

    • On add key0
      table.on('addkey0', function(key0, value) {  });\n
    • On remove key0
      table.on('removekey0', function(key0) {  });\n
    • On add key1
      table.on('addkey1', function(key0, key1, value) {  });\n
    • On remove key1
      table.on('removekey1', function(key0, key1) {  });\n
    • On add key2
      table.on('addkey2', function(key0, key1, key2, value) {  });\n
    • On remove key2
      table.on('removekey2', function(key0, key1, key2) {  });\n
    • On change key2
      table.on('changekey2', function(key0, key1, key2, value) {  });\n
    "},{"location":"firebase-leaderboard/","title":"Leaderboard","text":""},{"location":"firebase-leaderboard/#introduction","title":"Introduction","text":"

    Descending sort scores, using firebase-firestore.

    • Author: Rex
    "},{"location":"firebase-leaderboard/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-leaderboard/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-leaderboard/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add leader-board object
      var leaderBoard = scene.plugins.get('rexfirebaseplugin').add.leaderBoard(config);\n
    "},{"location":"firebase-leaderboard/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add leader-board object
      var leaderBoard = scene.plugins.get('rexFirebase').add.leaderBoard(config);\n
    "},{"location":"firebase-leaderboard/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { LeaderBoard } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add leader-board object
      var leaderBoard = new LeaderBoard(config);\n
    "},{"location":"firebase-leaderboard/#create-instance","title":"Create instance","text":"
    var leaderBoard = scene.plugins.get('rexFirebase').add.leaderBoard({\nroot: '',\n// timeFilters: false,\n// timeFilterType: 'year',\n// pageItemCount: 100,\n// userID: '',\n// userName: '',\n// boardID: undefined,\n// tag: undefined\n});\n
    • root : Collection name of this leaderboard.
    • timeFilters : Time filter of day/week/month/year.
      • false : Don't use any time filter.
      • true : Enable all time filters.
      • JSON object, enable some time filters.
        {\nday: true,\nweek: true,\nmonth: true,\nyear: true,\nall: true\n}\n
    • timeFilterType : Type of time filter.
      • 'day', or 'd' : Filter scores by current day.
      • 'week', or 'w' : Filter scores by current week.
      • 'month', 'm' : Filter scores by current month.
      • 'year', 'y' : Filter scores by current year. Default value.
      • 'all', 'a' : No time filter to track all scores.
    • pageItemCount : Item count of a page, default value is 100
    • userID : ID of user.
    • userName : Name of user.
    • boardID : Board ID, optional.
    • tag : Custom tag, optional.

    Time filter enabled

    Add indexes if time filter is enabled. - tagD(ascending), scoreD(descending), boardID(ascending), tag(ascending) - tagW(ascending), scoreW(descending), boardID(ascending), tag(ascending) - tagM(ascending), scoreM(descending), boardID(ascending), tag(ascending) - tagY(ascending), scoreY(descending), boardID(ascending), tag(ascending) - tagA(ascending), scoreA(descending), boardID(ascending), tag(ascending)

    "},{"location":"firebase-leaderboard/#post-score","title":"Post score","text":"
    1. Set user.
      leaderBoard.setUser(userID, userName);\n
      or
      leaderBoard.setUser({\nuserID: userID,\nuserName: userName\n});\n
      • userID : User ID.
      • userName : Display name of user, optional.
    2. Set board property, optional.
      • Board ID
        leaderBoard.setBoardID(boardID);\n
      • Custom tag
        leaderBoard.setTag(tag);\n
    3. Post score
      leaderBoard.post(score)\n// leaderBoard.post(score, extraData)\n// leaderBoard.post(score, extraData, timestamp)\n.then(function(record) { })\n.catch(function(error) { })\n
      • score : A number, scores will be sorted descend.
      • extraData : Extra data in JSON format.
      • timestamp : Timestamp of posting.
        • undefined : Current time.
        • A number : For debug usage.
    "},{"location":"firebase-leaderboard/#get-my-score","title":"Get my score","text":"
    leaderBoard.getScore()\n// leaderBoard.getScore(userID)\n.then(function(score) { })\n.catch(function(error) { })\n
    • userID : User ID, optional.
      • undefined : Current user ID.
    • score : Score object.
      • Time filter enabled : {userID, scoreD, scoreW, scoreM, scoreY, tagD, tagW, tagM, tagY, tagA}
        • scoreD, scoreW, scoreM, scoreY, scoreA : Score of day/week/month/year/all-time.
        • tagD, tagW, tagM, tagY, tagA : Time tag of day/week/month/year/all-time.
      • Time filter disabled : {userID, score}
    "},{"location":"firebase-leaderboard/#get-my-rank","title":"Get my rank","text":"
    leaderBoard.getRank()\n// leaderBoard.getRank(userID)\n.then(function(rank) { })\n.catch(function(error) { })\n
    • userID : User ID, optional.
      • undefined : Current user ID.
    • rank : Rank object. {userID, rank}
    "},{"location":"firebase-leaderboard/#get-scores","title":"Get scores","text":"
    1. Set board property, optional.
      • Board ID
        leaderBoard.setBoardID(boardID);\n
      • Custom tag
        leaderBoard.setTag(tag);\n
    2. Set time filter, optional.
      leaderBoard.setTimeFilterType(type);\n
      • type :
        • 'day', or 'd' : Filter scores by current day.
        • 'week', or 'w' : Filter scores by current week.
        • 'month', 'm' : Filter scores by current month.
        • 'year', 'y' : Filter scores by current year.
        • 'all', 'a' : No time filter to track all scores.
    3. Load scores page by page.
      • Load first page.
        leaderBoard.loadFirstPage()\n.then(function(scores) { })\n.catch(function(error) { })\n
        • scores : An array of score object. Each score object is {userID, userName, socre}
      • Load next page.
        leaderBoard.loadNextPage()\n.then(function(scores) { })\n.catch(function(error) { })\n
        • scores : An array of score object. Each score object is {userID, userName, socre}
      • Load previous page.
        leaderBoard.loadPreviousPage()\n.then(function(scores) { })\n.catch(function(error) { })\n
        • scores : An array of score object. Each score object is {userID, userName, socre}
      • Reload current page.
        leaderBoard.loadCurrentPage()\n.then(function(scores) { })\n.catch(function(error) { })\n
        • scores : An array of score object. Each score object is {userID, userName, socre}
    "},{"location":"firebase-leaderboard/#page-index","title":"Page index","text":"
    • Current page index
      var pageIndex = leaderBoard.pageIndex;\n
    • Is first page
      var isFirstPage = leaderBoard.isFirstPage;\n
    • Is last page
      var isLastPage = leaderBoard.isLastPage;\n
    "},{"location":"firebase-leaderboard/#delete","title":"Delete","text":"
    • Delete user
      leaderBoard.deleteUserScore(userID)\n.then(function(){ })\n.catch(function(){ })\n
    • Delete board
      leaderBoard.deleteBoard(boardID, tag)\n.then(function(){ })\n.catch(function(){ })\n
    "},{"location":"firebase-messages/","title":"Messages","text":""},{"location":"firebase-messages/#introduction","title":"Introduction","text":"

    Store messages in firebase-firestore.

    • Author: Rex
    "},{"location":"firebase-messages/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-messages/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-messages/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add leader-board object
      var messages = scene.plugins.get('rexfirebaseplugin').add.messages(config);\n
    "},{"location":"firebase-messages/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add leader-board object
      var messages = scene.plugins.get('rexFirebase').add.messages(config);\n
    "},{"location":"firebase-messages/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { Messages } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add leader-board object
      var messages = new Messages(config);\n
    "},{"location":"firebase-messages/#create-instance","title":"Create instance","text":"
    var messages = scene.plugins.get('rexFirebase').add.messages({\nroot: '',\n// pageItemCount: 100,\n\n// senderID: '',\n// senderName: '',\n// receiverID: undefined,\n});\n
    • root : Collection name of this messages.
    • pageItemCount : Item count of a page, default value is 100
    • senderID : ID of sender.
    • senderName : Name of sender, optional.
    • receiverID : ID of receiver, optional.
    "},{"location":"firebase-messages/#send-message","title":"Send message","text":"
    1. Set sender.
      messages.setSender(userID, userName);\n
      or
      messages.setSender({\nuserID: userID,\nuserName: userName\n});\n
      • userID : User ID.
      • userName : Display name of user, optional.
    2. Set receiver, optional.
      messages.setReceiver(userID);\n
      • userID : User ID.
    3. Send message
      messages.send(message)    .then(function() { })\n.catch(function(error) { })\n
      • message : String, number, or JSON object.
    "},{"location":"firebase-messages/#receive-messages","title":"Receive messages","text":"
    1. Set receiverID, optional.
      messages.setReceiver(userID)\n
      • userID : User ID.
    2. Load previous messages, optional.
      messages.loadPreviousMessages()\n.then(function(messageObjs) { })\n.catch(function(error) { })    
      • messageObjs : Array of Received message objects
        • messageObj.senderID, messageObj.senderName : Sernder ID and name.
        • messageObj.receiverID : Receiver ID, optional.
        • messageObj.message : Sent message, a string, number, or JSON object.
        • messageObj.timestamp : Server-timestamp.
    3. Add 'receiver' event.
      messages.on('receive', function(messageObj) {\n// var senderID = messageObj.senderID;\n// var senderName = messageObj.senderName;\n// var receiverID = messageObj.receiverID;\n// var message = messageObj.message;\n// var timestamp = messageObj.timestamp;\n})\n
      • messageObj : Received message object.
    4. Start receiving
      messages.startReceiving();\n
    5. Stop receiving
      messages.stopReceiving();\n

    Received messages will be stored in messages.cacheMessages

    "},{"location":"firebase-onlineuserlist/","title":"Online user list","text":""},{"location":"firebase-onlineuserlist/#introduction","title":"Introduction","text":"

    Online user list, using firebase-database.

    • Author: Rex
    "},{"location":"firebase-onlineuserlist/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-onlineuserlist/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-onlineuserlist/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add online-user-list object
      var userList = scene.plugins.get('rexfirebaseplugin').add.onlineUserList(config);\n
    "},{"location":"firebase-onlineuserlist/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add online-user-list object
      var userList = scene.plugins.get('rexFirebase').add.onlineUserList(config);\n
    "},{"location":"firebase-onlineuserlist/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { OnlineUserList } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add online-user-list object
      var userList = new OnlineUserList(config);\n
    "},{"location":"firebase-onlineuserlist/#create-instance","title":"Create instance","text":"
    var userList = scene.plugins.get('rexFirebase').add.onlineUserList({\nroot: '',\n// maxUsers: 0,\n\n// userID: '',\n// userName: '',\n});\n
    • root : Path of this online user list.
    • maxUsers: Maximum users in this list. Set to 0 to have infinity users.
    • userID : ID of user.
    • userName : Name of user.
    "},{"location":"firebase-onlineuserlist/#join","title":"Join","text":"
    1. Set userID and user name.
      userList.setUser(userID, userName);\n
      or
      userList.setUser({\nuserID: userID,\nuserName: userName\n});\n
      • userID : User ID.
      • userName : Display name.
    2. Join list.
      userList.join()\n// .then(function() { })\n// .catch(function() { })\n
    "},{"location":"firebase-onlineuserlist/#leave","title":"Leave","text":"
    userList.leave()\n// .then(function() { })\n// .catch(function() { })\n
    "},{"location":"firebase-onlineuserlist/#kick-user","title":"Kick user","text":"
    userList.leave(userID)\n// .then(function() { })\n// .catch(function() { })\n
    "},{"location":"firebase-onlineuserlist/#change-user-name","title":"Change user name","text":"
    userList.changeUserName(newUserName)\n// .then(function() { })\n// .catch(function() { })\n
    "},{"location":"firebase-onlineuserlist/#user-list","title":"User list","text":"
    • Get users in user list
      var users = userList.getUsers();\n
      • users : Array of user {userID, userName}
    • Is first user in user list?
      var isFirstUser = userList.isFirstUser(userID);\n// var isFirstUser = userList.isFirstUser();  // Current user is first user\n
    • User list is full
      var isFull = userList.isFull();\n
    • Maximun users setting value
      var maxUsers = userList.maxUsers;\n
    • Current user is in list
      var isInList = userList.isInList;\n
    "},{"location":"firebase-onlineuserlist/#events","title":"Events","text":"
    • Any user join
      userList.on('join', user);\n
      • user : {userID, userName}
    • Any user leave
      userList.on('leave', user);\n
      • user : {userID, userName}
    • User list updated, includes user join, user leave, and user name changed
      userList.on('update', users);\n
      • users : Array of user {userID, userName}
    • User name is changed
      userList.on('changename', userID, userName, prevUserName);\n
    "},{"location":"firebase-overview/","title":"Overview","text":""},{"location":"firebase-overview/#introduction","title":"Introduction","text":"
    • Home page
    • Available libraries
    "},{"location":"firebase-overview/#usage","title":"Usage","text":""},{"location":"firebase-overview/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-overview/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n    <script src=\"/__/firebase/10.13/firebase-firestore-compat.js\"></script>        \n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Get firebase plugin
      var rexFireBase = scene.plugins.get('rexfirebaseplugin');\n
    "},{"location":"firebase-overview/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Get firebase plugin
      var rexFireBase = scene.plugins.get('rexFirebase');\n
    "},{"location":"firebase-singleroom/","title":"Single room","text":""},{"location":"firebase-singleroom/#introduction","title":"Introduction","text":"

    Chat room, using firebase-database.

    • Author: Rex
    "},{"location":"firebase-singleroom/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"firebase-singleroom/#install-plugin","title":"Install plugin","text":""},{"location":"firebase-singleroom/#load-minify-file","title":"Load minify file","text":"
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add single-room object
      var room = scene.plugins.get('rexfirebaseplugin').add.singleRoom(config);\n
    "},{"location":"firebase-singleroom/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Install plugin in configuration of game
      import FirebasePlugin from 'phaser3-rex-plugins/plugins/firebase-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFirebase',\nplugin: FirebasePlugin,\nstart: true\n}]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Add single-room object
      var room = scene.plugins.get('rexFirebase').add.singleRoom(config);\n
    "},{"location":"firebase-singleroom/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add Firebase SDKs
      <body>\n    <!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->\n    <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->\n    <script src=\"/__/firebase/10.13/firebase-app-compat.js\"></script>\n    <!-- Add Firebase products that you want to use -->\n    <script src=\"/__/firebase/10.13/firebase-database-compat.js\"></script>\n</body>    \n
    • Initialize firebase application.
      firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n})\n
    • Import class
      import { SingleRoom } from 'phaser3-rex-plugins/plugins/firebase-components.js';\n
    • Add single-room object
      var room = new SingleRoom(config);\n
    "},{"location":"firebase-singleroom/#create-instance","title":"Create instance","text":"
    var room = scene.plugins.get('rexFirebase').add.singleRoom({\nroot: '',\n// maxUsers: 0,\n// userID: '',\n// userName: '',\n// broadcast: true,\n// tables: undefined,\n\n});\n
    • root : Path of this room.
    • maxUsers: Maximum users in this list. Set to 0 to have infinity users.
    • userID : ID of user.
    • userName : Name of user.
    • broadcast : Broadcast chat messages.
      • true : Enable broadcasting, without storing received (history) messages. Default behavior.
      • false : Disable broadcasting.
      • A JSON object :
        {\nhistory: 0\n}\n
        • history : Stored received (history) messages in client side.
          • 0, or false : No history message stored.
          • -1, or true : Infinity history message stored. i.e. store all messages from starting updating.
          • A number larger then 0 : Length of stored history message.
    • tables : Configuration of tables.
      • undefined : No table.
      • Array of table-config JSON object for each table.
        [\n{\nkey: tableKey,\ntype: '1d'\n},\n{\n...\n}\n]\n
        • key : Unique name of this table.
        • type : Table type.
          • 1, or '1d' : 1d table, indexing by (key0)
          • 2, or '2d' : 2d table, indexing by (key0, key1)
          • 3, or '3d' : 3d table, indexing by (key0, key1, key2)
    "},{"location":"firebase-singleroom/#current-user-infomation","title":"Current user infomation","text":"
    • User name
      • Get
        var userName = room.userInfo.userName;\n
      • Set
        room.changeUserName(newUserName);\n
    • User ID
      • Get
        var userID = room.userInfo.userID;\n
    "},{"location":"firebase-singleroom/#join-room","title":"Join room","text":"
    1. Set userID and user name.
      room.setUser(userID, userName);\n
      • userID : User ID.
      • userName : Display name.
    2. Join room.
      room.joinRoom();\n
    "},{"location":"firebase-singleroom/#leave-room","title":"Leave room","text":"
    room.leaveRoom();\n
    "},{"location":"firebase-singleroom/#kick-user","title":"Kick user","text":"
    room.kickUser(userID);\n
    "},{"location":"firebase-singleroom/#user-list","title":"User list","text":"
    • Get users in room(user list)
      var users = room.getUsers();\n
      • users : Array of user {userID, userName}
    • Is first user in room(user list)?
      var isFirstUser = room.isFirstUser(userID);\n// var isFirstUser = room.isFirstUser();  // Current user is first user\n
    • Room(user list) is full
      var isFull = room.isFull();\n
    • Maximun users setting value
      var maxUsers = room.maxUsers;\n
    • Current user is in room(user list)
      var isInRoom = room.isInRoom();\n
    "},{"location":"firebase-singleroom/#send-message","title":"Send message","text":"
    room.broadcast.send(message);\n
    • message : A string message, or a JSON data.
    "},{"location":"firebase-singleroom/#receive-messages","title":"Receive messages","text":"
    1. Register receive event
      room.on('broadcast.receive', function(data){\n// var senderID = data.senderID;\n// var senderName = data.senderName;\n// var message = data.message;\n})\n

    Only receive messages after joined room. Previous messages won't be got anymore.

    "},{"location":"firebase-singleroom/#received-messages","title":"Received messages","text":"

    Received messages will be saved in client side.

    • Get received (history) messages.
      var messages = room.broadcast.getHistory();\n
    • Clear history messages.
      room.broadcast.clearHistory();\n
    "},{"location":"firebase-singleroom/#tables","title":"Tables","text":"
    • Get table
      var table = room.getTable(key);\n
      • key : Unique name of this table.
    "},{"location":"firebase-singleroom/#write","title":"Write","text":"

    See here

    "},{"location":"firebase-singleroom/#read","title":"Read","text":"

    See here

    "},{"location":"firebase-singleroom/#events","title":"Events","text":""},{"location":"firebase-singleroom/#user-list-events","title":"User list events","text":"
    • Any user join
      room.on('userlist.join', user);\n
      • user : {userID, userName}
    • Any user leave
      room.on('userlist.leave', user);\n
      • user : {userID, userName}
    • User list updated, includes user join, user leave, and user name changed
      room.on('userlist.update', users);\n
      • users : Array of user {userID, userName}
    • User name is changed
      room.on('userlist.changename', userID, userName, prevUserName);\n
    "},{"location":"firebase-singleroom/#broadcast-events","title":"Broadcast events","text":"
    • Receive message
      room.on('broadcast.receive', function(data){\n// var senderID = data.senderID;\n// var senderName = data.senderName;\n// var message = data.message;\n})\n
    "},{"location":"firebase-singleroom/#table-events","title":"Table events","text":"

    Event names of each table indexed by key

    • init : tables.${key}.init
    • update : tables.${key}.update
    • addkey0 : tables.${key}.addkey0
    • removekey0 : tables.${key}.removekey0
    • changekey0 : tables.${key}.changekey0
    • addkey1 : tables.${key}.addkey1
    • removekey1 : tables.${key}.removekey1
    • changekey1 : tables.${key}.changekey1
    • addkey2 : tables.${key}.addkey2
    • removekey2 : tables.${key}.removekey2
    • changekey2 : tables.${key}.changekey2
    "},{"location":"firebase-storage/","title":"Storage","text":""},{"location":"firebase-storage/#introduction","title":"Introduction","text":"

    It supports authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook and Twitter, and more.

    • Author: Firebase
    "},{"location":"firebase-storage/#usage","title":"Usage","text":"

    Official document

    Sample code

    "},{"location":"firebase-storage/#setup","title":"Setup","text":"
    1. Import firestore
      import firebase from 'firebase/app';\nimport 'firebase/storage';\n
      Firebase has been included in package.json.
    2. Initialize
      var firebaseApp = firebase.initializeApp({\napiKey: '...',\nauthDomain: '...',\ndatabaseURL: '...',\nprojectId: '...',\nstorageBucket: '...',\nmessagingSenderId: '...'\n});\nvar storageRef = firebaseApp.storage().ref();\n
    "},{"location":"firebase-storage/#upload-string","title":"Upload string","text":"
    • Upload string
      var fileRef = storageRef.child('path/to/filename');\nvar uploadTask = fileRef.putString(content)\n.then(function (snapshot) {})\n.catch(function (error) {});\n
    • Upload base64 formatted string
      var fileRef = storageRef.child('path/to/filename');\nvar uploadTask = fileRef.putString(content, 'base64')\n.then(function (snapshot) {})\n.catch(function (error) {});\n
    • Upload base64url formatted string
      var fileRef = storageRef.child('path/to/filename');\nvar uploadTask = fileRef.putString(content, 'base64url')\n.then(function (snapshot) {})\n.catch(function (error) {});\n
    • Upload data URL string
      var fileRef = storageRef.child('path/to/filename');\nvar uploadTask = fileRef.putString(content, 'data_url')\n.then(function (snapshot) {})\n.catch(function (error) {});\n
    "},{"location":"firebase-storage/#upload-image","title":"Upload image","text":"
    1. Get image from image texture
      var image = scene.textures.get(key).getSourceImage();\n
    2. Copy image to canvas
      var canvas = CanvasPool.create(scene, image.width, image.height);\nvar ctx = canvas.getContext('2d');\nctx.drawImage(image, 0, 0, image.width, image.height);\n
    3. Get blob from canvas, then upload this blob.
      var uploadTask;\ncanvasToBlob(canvas)\n.then(function(blob) {\nvar metadata = {\ncontentType: 'image/jpeg',\n};        var fileRef = storageRef.child('path/to/filename');\nuploadTask = fileRef.put(blob, metadata);\nreturn uploadTask;\n})\n.then(function (snapshot) {})\n.catch(function (error) {});\n
      Reference: canvasToBlob
    4. Free canvas
      CanvasPool.remove(canvas);\n
    "},{"location":"firebase-storage/#upload-task","title":"Upload task","text":"
    • Pause task
      uploadTask.pause();\n
    • Resume task
      uploadTask.resume();\n
    • Cancel task
      uploadTask.cancel();\n
    • Monitor progress
      uploadTask.on('state_changed', function(snapshot){\n// Observe state change events such as progress, pause, and resume\nvar progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\nswitch (snapshot.state) {\ncase firebase.storage.TaskState.PAUSED: // or 'paused'\nconsole.log('Upload is paused');\nbreak;\ncase firebase.storage.TaskState.RUNNING: // or 'running'\nconsole.log('Upload is running');\nbreak;\n}\n},\nfunction(error) {\n// Handle unsuccessful uploads\n// https://firebase.google.com/docs/storage/web/handle-errors\nswitch (error.code) {\ncase 'storage/unauthorized':\n// User doesn't have permission to access the object\nbreak;\ncase 'storage/canceled':\n// User canceled the upload\nbreak;\ncase 'storage/unknown':\n// Unknown error occurred, inspect error.serverResponse\nbreak;\n}\n},\nfunction() {\n// Handle successful uploads on complete\n// Get download url\nuploadTask.snapshot.ref.getDownloadURL()\n.then(function(url) {\nconsole.log('File available at', url);\n})\n.catch(function (error) {});\n}\n);\n
    "},{"location":"firebase-storage/#download-file","title":"Download file","text":"
    1. Get download url
      var fileRef = storageRef.child('path/to/filename');\nfileRef.getDownloadURL()\n.then(function(url) {})\n.catch(function (error) {});\n
    2. Download file by loader
    "},{"location":"firebase-storage/#delete-file","title":"Delete file","text":"
    var fileRef = storageRef.child('path/to/filename');\nfileRef.delete()\n.then(function() {})\n.catch(function(error) {});\n
    "},{"location":"flash/","title":"Flash","text":""},{"location":"flash/#introduction","title":"Introduction","text":"

    Flashing (set invisible then visible) game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"flash/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"flash/#install-plugin","title":"Install plugin","text":""},{"location":"flash/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexflashplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexflashplugin.min.js', true);\n
    • Add flash behavior
      var flash = scene.plugins.get('rexflashplugin').add(gameObject, config);\n
    "},{"location":"flash/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FlashPlugin from 'phaser3-rex-plugins/plugins/flash-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFlash',\nplugin: FlashPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add flash behavior
      var flash = scene.plugins.get('rexFlash').add(gameObject, config);\n
    "},{"location":"flash/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Flash from 'phaser3-rex-plugins/plugins/flash.js';\n
    • Add flash behavior
      var flash = new Flash(gameObject, config);\n
    "},{"location":"flash/#create-instance","title":"Create instance","text":"
    var flash = scene.plugins.get('rexFlash').add(gameObject, {\n// duration: 500,\n// repeat: 2\n});\n
    • duration : Duration of invisible(50%) and visible(50%), in millisecond.
    • repeat : The number of times the flashing will repeat itself (a value of 1 means the flash will play twice, as it repeated once)
    "},{"location":"flash/#start-flashing","title":"Start flashing","text":"
    flash.flash();\n// flash.flash(duration, repeat);\n

    or

    flash.flash({\nduration: 500,\nrepeat: 2\n});\n
    "},{"location":"flash/#stop-flashing","title":"Stop flashing","text":"
    flash.stop();\n
    "},{"location":"flash/#enable","title":"Enable","text":"
    • Enable/resume (default)
      flash.setEnable();\n
      or
      flash.enable = true;\n
    • Disable/pause
      flash.setEnable(false);\n
      or
      flash.enable = false;\n
    "},{"location":"flash/#set-duration","title":"Set duration","text":"
    flash.setDuration(duration);\n// flash.duration = duration;\n
    "},{"location":"flash/#set-repeat","title":"Set repeat","text":"
    flash.setRepeat(repeat);\n// flash.repeat = repeat;\n
    "},{"location":"flash/#events","title":"Events","text":"
    • On reached target
      flash.on('complete', function(flash, gameObject){});\n
    "},{"location":"flash/#status","title":"Status","text":"
    • Is flashing
      var isRunning = flash.isRunning;\n
    "},{"location":"flip/","title":"Flip","text":""},{"location":"flip/#introduction","title":"Introduction","text":"

    Flipping game object to another face by scaling width/height.

    • Author: Rex
    • Behavior of game object
    "},{"location":"flip/#live-demos","title":"Live demos","text":"
    • Flip image
    • Flip ui
    "},{"location":"flip/#usage","title":"Usage","text":"

    Sample code, Sample code-2

    "},{"location":"flip/#install-plugin","title":"Install plugin","text":""},{"location":"flip/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexflipplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexflipplugin.min.js', true);\n
    • Add flip behavior
      var flip = scene.plugins.get('rexflipplugin').add(gameObject, config);\n
    "},{"location":"flip/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FlipPlugin from 'phaser3-rex-plugins/plugins/flip-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFlip',\nplugin: FlipPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add flip behavior
      var flip = scene.plugins.get('rexFlip').add(gameObject, config);\n
    "},{"location":"flip/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Flip from 'phaser3-rex-plugins/plugins/flip.js';\n
    • Add flip behavior
      var flip = new Flip(gameObject, config);\n
    "},{"location":"flip/#create-instance","title":"Create instance","text":"
    var flip = scene.plugins.get('rexFlip').add(gameObject, {\nface: 'back',\nfront: { key, frame }, // key, or callback\nback: { key, frame },  // key, or callback\n\n// orientation: 0, // 0|'x'|1|'y'\n// duration: 500,\n// delay: 0,\n// ease: 'Sine',\n});\n
    • face : Initial face.
      • 0, 'front' : Front face.
      • 1, 'back' : Back face.
    • front, back : Texture of front/back face.
      • undefined : Use current texture key, or frame name
      • key : A string for texture key.
      • {key, frame}, or {frame} : A texture key and frame name
      • callback : Configure game object via callback.
        function(gameObject) {\n}\n
    • orientation : Flipping orientation.
      • 0, 'x', or 'horizontal' : Horizontal flipping.
      • 1, 'y', or 'vertical' : Vertical flipping.
    • duration : Duration of flipping, in millisecond.
    • delay : Initial delay
    • ease Ease function. Default value is 'Sine'.
    "},{"location":"flip/#start-flipping","title":"Start flipping","text":"
    flip.flip();\n// flip.flip(duration);\n
    "},{"location":"flip/#stop-flipping","title":"Stop flipping","text":"
    flip.stop();\n
    "},{"location":"flip/#set-duration","title":"Set duration","text":"
    flip.setDuration(duration);\n// flip.duration = duration;\n
    "},{"location":"flip/#set-ease","title":"Set ease","text":"
    flip.setEase(ease);\n// flip.ease = ease;\n
    "},{"location":"flip/#faces","title":"Faces","text":""},{"location":"flip/#current-face","title":"Current face","text":"
    • Get
      var face = flip.face;\n
      • 0 : Front face
      • 1 : Back face
    • Set
      flip.setFace(face);\n// flip.face = face;\n
      • 0, 'front' : Front face.
      • 1, 'back' : Back face.
    • Toggle face
      flip.toggleFace();\n
    "},{"location":"flip/#set-texture-of-face","title":"Set texture of face","text":"
    • Front face
      flip.setFrontFace(key, frame);\n
      or
      flip.setFrontFace(callback);\n
      • callback :
        function(gameObject) {\n// ...\n}\n
    • Back face
      flip.setBackFace(key, frame);\n
      or
      flip.setBackFace(callback);\n
      • callback :
        function(gameObject) {\n// ...\n}\n
    "},{"location":"flip/#events","title":"Events","text":"
    • On flipping complete
      flip.on('complete', function(gameObject, flip){\n// ...\n});\n
    "},{"location":"flip/#status","title":"Status","text":"
    • Is flipping
      var isRunning = flip.isRunning;\n
    "},{"location":"format/","title":"Format","text":""},{"location":"format/#introduction","title":"Introduction","text":"

    Format string with variables, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"format/#usage","title":"Usage","text":"

    Replace %x from an array. x starts from 1.

    // const Format = Phaser.Utils.String.Format;\nvar template = 'hello, %1';\nvar view = ['rex'];\nvar result = Format(template, view);\n
    "},{"location":"framemanager/","title":"Frame manager","text":""},{"location":"framemanager/#introduction","title":"Introduction","text":"

    Draw frames on canvas texture, or dynamic texture.

    • Author: Rex
    • Member of scene
    "},{"location":"framemanager/#live-demos","title":"Live demos","text":"
    • Paste text
    "},{"location":"framemanager/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"framemanager/#install-plugin","title":"Install plugin","text":""},{"location":"framemanager/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexframemanagerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexframemanagerplugin.min.js', true);\n
    • Add frame-manager object
      var frameManager = scene.plugins.get('rexframemanagerplugin').add(scene, config);\n
    "},{"location":"framemanager/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FrameManagerPlugin from 'phaser3-rex-plugins/plugins/framemanager-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFrameManager',\nplugin: FrameManagerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add frame-manager object
      var frameManager = scene.plugins.get('rexFrameManager').add(scene, config);\n
    "},{"location":"framemanager/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import FrameManager from 'phaser3-rex-plugins/plugins/framemanager.js';\n
    • Add frame-manager object
      var frameManager = new FrameManager(scene, config);\n
    "},{"location":"framemanager/#create-instance","title":"Create instance","text":"
    var frameManager = scene.plugins.get('rexFrameManager').add(scene, {\nkey: '',\nwidth: 4096,\nheight: 4096,\ncellWidth: 64,\ncellHeight: 64,\ncellPadding: 0,\ncolumns: undefined,\nrows: undefined,\nfillColor: undefined,\nuseDynamicTexture: false,\n});\n
    • key : Texture key in texture manager
    • width, height : Size of canvas.
      • Calculate width/height by columns/rows and cellWidth/cellHeight, if columns, rows parameters are given.
    • columns, rows :
      • undefined : Calculate columns/rows by width/height and cellWidth/cellHeight.
    • cellWidth, cellHeight : Maximum frame size.
    • cellPadding : Extra space around frame. Default value is 0.
      • Total cell width will be cellWidth + (cellPadding * 2)
      • Total cell height will be cellHeight + (cellPadding * 2)
    • fillColor : Fill an initial color, in css color string (for canvas-texture), or number (for dynamic-texture)
      • undefined : Don't fill color.
    • useDynamicTexture
      • false : Use canvas-texture. Default behavior.
      • true : Use dynamic-texture.

    or

    var frameManager = scene.plugins.get('rexFrameManager').add(scene, key, width, height, cellWidth, cellHeight, fillColor, useDynamicTexture);\n

    Steps of generating bitmapfont :

    1. Add frames :
      frameManager.paste(frameName, gameObject);\n
    2. Update texture
      frameManager.updateTexture();\n
    3. Export frame data to bitmapfont
      frameManager.addToBitmapFont();\n
    "},{"location":"framemanager/#add-frame","title":"Add frame","text":""},{"location":"framemanager/#from-game-object","title":"From game object","text":"

    After rendering content on text, bbcode text, canvas

    frameManager.paste(frameName, gameObject);\n
    • frameName : Frame name.
    • gameObject :
      • Canvas-texture mode :
        • Game objects which has canvas, for example, text, bbcode text, or canvas.
      • Dynamic-texture mode :
        • Any render-able game object except :
          • Graphics can't paste directly, because that Graphics game object does not have size.
            • Draw Graphics to RenderTexture, then paste this RenderTexture to frameMamager.
    "},{"location":"framemanager/#custom-drawing","title":"Custom drawing","text":"

    frameManager.draw(frameName, callback, scope)\n
    - frameName : Frame name. - callback : - Canvas-texture mode :
    function(canvas, context, frameSize) {\n// The maximum frame size\nvar cellWidth = frameSize.width;\nvar cellHeight = frameSize.height;\n\n// Draw content in area of (0, 0) - (cellWidth, cellHeight)\n\n// Update frame size\n// frameSize.width = ...\n// frameSize.height = ...\n}\n
    - Dynamic-texture mode :
    function(texture, frameSize) {\n// The maximum frame size\nvar cellWidth = frameSize.width;\nvar cellHeight = frameSize.height;\n\n// Draw content in area of (0, 0) - (cellWidth, cellHeight)\n\n// Update frame size\n// frameSize.width = ...\n// frameSize.height = ...\n}\n

    "},{"location":"framemanager/#empty-frame","title":"Empty frame","text":"
    frameManager.addEmptyFrame(frameName);\n// frameManager.addEmptyFrame(frameName, width, height);\n
    • frameName : Frame name.
    • width : Frame width, default value is cellWidth
    • height : Frame height, default value is cellHeight
    "},{"location":"framemanager/#update-texture","title":"Update texture","text":"

    Update texture after adding frames, for Canvas-texture mode.

    frameManager.updateTexture();\n

    Do nothing in Dynamic-texture mode.

    "},{"location":"framemanager/#remove-frame","title":"Remove frame","text":"
    • Remove a frame
      frameManager.remove(frameName);\n
      • frameName : Frame name.
    • Remove all frames
      frameManager.clear();\n

    Remove frame data but won't clear texture image.

    "},{"location":"framemanager/#export-to-bitmapfont","title":"Export to bitmapfont","text":"
    frameManager.addToBitmapFont();\n
    "},{"location":"framemanager/#destroy-instance","title":"Destroy instance","text":"
    frameManager.destroy();\n
    "},{"location":"fsm/","title":"FSM","text":""},{"location":"fsm/#introduction","title":"Introduction","text":"

    Finite state machine.

    • Author: Rex
    • Object
    "},{"location":"fsm/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"fsm/#install-plugin","title":"Install plugin","text":""},{"location":"fsm/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfsmplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfsmplugin.min.js', true);\n
    • Add FSM object
      var states = scene.plugins.get('rexfsmplugin').add(config);\n
    "},{"location":"fsm/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FSMPlugin from 'phaser3-rex-plugins/plugins/fsm-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFSM',\nplugin: FSMPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add FSM object
      var states = scene.plugins.get('rexFSM').add(config);\n
    "},{"location":"fsm/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import FSM from 'phaser3-rex-plugins/plugins/fsm.js';\n
    • Add FSM object
      var states = new FSM(config);\n
    "},{"location":"fsm/#create-instance","title":"Create instance","text":""},{"location":"fsm/#create-by-config","title":"Create by config","text":"
    var states = scene.plugins.get('rexFSM').add({\nstart: 'A',   // default: undefined\nstates: {\nA: {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},                 // this: this fsm instance\nexit: function() {},                  // this: this fsm instance\nupdate: function(time, delta) {},     // this: this fsm instance\npreupdate: function(time, delta) {},  // this: this fsm instance\npostupdate: function(time, delta) {}, // this: this fsm instance\n},\n// ...\n},\ninit: function() {},   // this: this fsm instance\nextend: {\ni: 0,        // Add member `i` into this fsm instance\nname: 'abc'\n// ...\n},\nenable: true,\nscene: undefined,\neventEmitter: undefined\n});\n
    • start: Initial state.
    • states: Define states.
      • stateName
        • next: String of next state, or a callback to get next state.
        • enter: Callback when enter state.
          function() {\n// this : this fsm instance\n}\n
        • exit: Callback when exit state. javascript function() { // this : this fsm instance }
        • update, preupdate, postupdate : Callback invoked by scene's 'update', 'preupdate', 'postupdate' events.
          function(time, delta) {\n// this : this fsm instance\n}\n
    • init: Initial callback when creating instance.
      function() {\n// this : this fsm instance\n}\n
    • extend: Inject key-value pairs into this fsm instance.
    • enable: Set false to block any state changing.
    • scene : Scene object for startUpdate, startPreUpdate, startPostUpdate method. Optional.
    • eventEmitter
      • undefined : Create a private event emitter, default value.
      • false : Don't add any event emitter, i.e. no event will be fired.
      • Event emitter object : Fire event through this event emitter.
    "},{"location":"fsm/#inheritance","title":"Inheritance","text":"
    1. Create new class
      class State extends FSM {\nconstructor() {\nsuper();\n}\n\nnext_A() { return 'B' }\n\nenter_A() { }\n\nexit_A() { }\n\nupdate_A(time, delta) { }\npreupdate_A(time, delta) { }\npostupdate_A(time, delta) { }\n}\n
      Members: - next_ + stateName : Callback to get next state. - enter_ + stateName : Callback when enter state. - exit_ + stateName : Callback when exit state. - update_ + stateName, preupdate_ + stateName, postupdate_ + stateName : Callback invoked by scene's 'update', 'preupdate', 'postupdate' events.
    2. Create instance
      var states = new State();\n
    "},{"location":"fsm/#read-state","title":"Read state","text":"
    • Current state
      var curState = states.state;\n
    • Previous state
      var preState = states.prevState;\n
    "},{"location":"fsm/#start-at-state","title":"Start at state","text":"
    states.start(newState);\n

    Note

    Set new state without triggering any state-changing callbacks or events.

    "},{"location":"fsm/#next-state","title":"Next state","text":"
    graph TB\n\nnext[\"states.next()\"] --> next_A[\"states.next_A()<br>return 'B'\"]\n\nnext_A --> eventStateChange[\"states.emit('statechange', states)<br>states.prevState -> states.state\"]\n\nsubgraph State changing\n\neventStateChange --> exit_A[\"states.exit_A()\"]\nexit_A --> eventExitA[\"states.emit('exit_A', states)\"]\n\neventExitA --> enter_B[\"states.enter_B()\"]\nenter_B --> eventEnterB[\"states.emit('enter_B', states)\"]\n\nsubgraph Exit\nexit_A\neventExitA\nend\n\nsubgraph Enter\nenter_B\neventEnterB\nend\n\nend\n\ngoto[\"states.goto('B')\"] --> eventStateChange\n\nsubgraph Request\n\nsubgraph Next\nnext\nnext_A\nend\n\nsubgraph Goto\ngoto\nend\n\nend
    "},{"location":"fsm/#request","title":"Request","text":"
    • Get next state by callback
      states.next();    // nextState = states.next_A()    \n
    • Goto state
      states.goto(nextState);\n// states.state = nextState;\n
    "},{"location":"fsm/#state-changing","title":"State-changing","text":"

    These callbacks or events will be triggered if state is changing.

    For example, state is changing from 'A' to 'B'.

    1. event statechange
      states.on('statechange', function(states) {\nconsole.log( states.prevState + '->' + states.state );\n});\n
    2. callback states.exit_A
    3. event exit_A
      states.on('exit_A', function(states) {\n/*...*/\n});\n
    4. callback states.enter_B
    5. event enter_B
      states.on('enter_B', function(states) {\n/*...*/\n});\n
    "},{"location":"fsm/#enable","title":"Enable","text":"
    states.setEnable();\n// states.setEnable(false); // disable\n

    or

    states.toggleEnable();\n

    states.next() and states.goto() will be ignored if disabled.

    "},{"location":"fsm/#update","title":"Update","text":"
    • Start
      states.startUpdate();\nstates.startPreUpdate();\nstates.startPostUpdate();\n// Assume that `scene` is assigned in config of constructor\n
      or
      states.startUpdate(scene);\nstates.startPreUpdate(scene);\nstates.startPostUpdate(scene);\n
      • scene : Scene object
    • Stop
      states.stopUpdate();\nstates.stopPreUpdate();\nstates.stopPostUpdate();\n
    "},{"location":"fsm/#add-new-state","title":"Add new state","text":"

    states.addState(name, {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {},\nupdate: function(time, delta) {},\npreupdate: function(time, delta) {},\npostupdate: function(time, delta) {},\n})\n
    states.addState({\nname: 'A',\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {},\nupdate: function(time, delta) {},\npreupdate: function(time, delta) {},\npostupdate: function(time, delta) {},\n})\n

    or

    states.addStates({\n'A' : {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {},\nupdate: function(time, delta) {},\npreupdate: function(time, delta) {},\npostupdate: function(time, delta) {},\n},\n// ...\n})\n
    states.addStates([\n{\nname: 'A',\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {},\nupdate: function(time, delta) {},\npreupdate: function(time, delta) {},\npostupdate: function(time, delta) {},\n},\n// ...\n]);\n

    "},{"location":"fullscreen/","title":"Full screen","text":""},{"location":"fullscreen/#introduction","title":"Introduction","text":"

    Enable or disable full screen mode, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"fullscreen/#usage","title":"Usage","text":""},{"location":"fullscreen/#enabledisable","title":"Enable/disable","text":"

    Under any input event (touch or keyboard)

    gameObject.setInteractive().on('pointerdown', function() {\nif (scene.scale.isFullscreen) {\nscene.scale.stopFullscreen();\n// On stop fulll screen\n} else {\nscene.scale.startFullscreen();\n// On start fulll screen\n}\n});\n

    Fire one of these events

    • 'fullscreenunsupported' : Tried to enter fullscreen mode, but it is unsupported by the browser.
    • 'enterfullscreen' : Entered fullscreen mode successfully.
    • 'fullscreenfailed' : Tried to enter fullscreen mode but failed.
    "},{"location":"fullscreen/#toggle","title":"Toggle","text":"

    Under any input event (touch or keyboard)

    gameObject.setInteractive().on('pointerdown', function() {\nscene.scale.toggleFullscreen();\nif (scene.scale.isFullscreen) {\n// On start fulll screen\n} else {\n// On stop fulll screen\n}\n});\n
    • Fire 'fullscreenunsupported' or 'enterfullscreen' event.
    "},{"location":"fullscreen/#state","title":"State","text":"
    • Is in full screen mode
      var isFullScreen = scene.scale.isFullscreen;\n
    • Support full screen
      var supported = Phaser.Device.Fullscreen.available;\n
    "},{"location":"fullscreen/#events","title":"Events","text":"
    • Full screen mode unsupported
      scene.scale.on('fullscreenunsupported', function() {});\n
    • Enter full screen mode
      scene.scale.on('enterfullscreen', function() {});\n
    "},{"location":"fullscreen/#with-dom-game-object","title":"With DOM game object","text":"

    Set gameConfig.fullscreenTarget to parent id.

    var config = {\nparent: parentDivID,\nfullscreenTarget: parentDivID\n};\n\nvar game = new Phaser.Game(config);\n
    "},{"location":"fuzzy/","title":"Fuzzy","text":""},{"location":"fuzzy/#introduction","title":"Introduction","text":"

    A wrap of fuzzy logic (MIT license).

    • Author of wrap : Rex , Core API : Michael Herzog
    • Member of scene, or game object
    "},{"location":"fuzzy/#live-demos","title":"Live demos","text":"
    • Fuzzy
    "},{"location":"fuzzy/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"fuzzy/#install-plugin","title":"Install plugin","text":""},{"location":"fuzzy/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfuzzyplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfuzzyplugin.min.js', true);\n
    • Add fuzzy module object
      var fuzzyModule = scene.plugins.get('rexfuzzyplugin').add(config);\n
    "},{"location":"fuzzy/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GashaponPlugin from 'phaser3-rex-plugins/plugins/fuzzy-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGashapon',\nplugin: GashaponPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add fuzzy module object
      var fuzzyModule = scene.plugins.get('rexFuzzy').add(config);\n
    "},{"location":"fuzzy/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import BuildFuzzyModule from 'phaser3-rex-plugins/plugins/fuzzy.js';\n
    • Add fuzzy module object
      var fuzzyModule = BuildFuzzyModule(config);\n
    "},{"location":"fuzzy/#create-instance","title":"Create instance","text":"
    var fuzzyModule = scene.plugins.get('rexFuzzy').add(`\n// Declare fuzzy sets\nFuzzySetName : left, middle, right, setType\nFuzzySetName : left, middle, right\nFuzzySetName : left, right\n\n// Declare rules\nFuzzySetNameA => FuzzySetNameT\nFuzzySetNameA and FuzzySetNameB => FuzzySetNameT\nFuzzySetNameA or FuzzySetNameB => FuzzySetNameT\nFuzzySetNameA or (FuzzySetNameA and FuzzySetNameB) => FuzzySetNameT\n\n// More comment lines...\n`);\n
    • config can be a multiple lines string, or a plain object
      • A multiple lines string contains
        • FuzzySetName : left, middle, right, setType : A line with ':', declare a fuzzy set.
          • FuzzySetName : Fuzzy set name in one of these format
            • Variable name with postfix '+', or '-'. For example, HP-, HP, HP+, HP--, HP++, the variable name is HP.
            • variableName.setName. For example, DIST.near, DIST.middle, DIST.far, the variable name is DIST.
              • Variable name and set name are composed of number(0-9) or English characters (A-Za-z).
          • left, middle, right : Left, middle, right point of fuzzy set, in numbers.
            • left, right : Two numbers for left and right point, middle point is the average of (left + right).
          • setType :
            • Can be one of these string, or none.
              • Left part : leftShoulder, leftSCurve.
                • Default value is leftShoulder for first fuzzy set of a variable.
              • Right part : rightShoulder, rightSCurve.
                • Default value is rightShoulder for last fuzzy set of a variable.
              • Middle parts : triangular, singleton, normal.
                • Default value is triangular for other fuzzy sets of a variable.
        • FuzzySetNameA and FuzzySetNameB => FuzzySetNameT : A line with '=>', declare a fuzzy rule.
        • // ... : Comment lines
      • A plain object
        {\nvariables: {\nVariableName: [\n{\nname: leftSetName, setType: undefined,\nparameters: [left, middle, right]\n},\n{\nname: middleSetName, setType: undefined,\nparameters: [left, middle, right]\n},\n{\nname: rightSetName, setType: undefined,\nparameters: [left, middle, right]\n},\n],\n// ....\n},\n\nrules: [\n'FuzzySetNameA => FuzzySetNameT',\n'FuzzySetNameA and FuzzySetNameB => FuzzySetNameT',\n'FuzzySetNameA or FuzzySetNameB => FuzzySetNameT',\n// ...\n]\n\n}\n
    "},{"location":"fuzzy/#set-input","title":"Set input","text":"
    fuzzyModule.fuzzify(variableName, value);\n
    • variableName : An antecedent variable name string.
    • value : A number.

    or

    fuzzyModule.fuzzify({\nvarName: value,\n});\n
    "},{"location":"fuzzy/#get-result","title":"Get result","text":"
    var result = fuzzyModule.defuzzify(variableName);\n
    • variableName : A consequence variable name string.

    or

    var result = fuzzyModule.defuzzify([varName0, varName1, ...]);\n
    • result : {varName0: value0, varName1, value1, ...}

    or

    var result = fuzzyModule.defuzzify();\n
    • result : {varName0: value0, varName1, value1, ...}
      • Grab variable names from all consequence of rules.
    "},{"location":"game/","title":"Game","text":""},{"location":"game/#boot","title":"Boot","text":"
    var config = {\ntype: Phaser.AUTO,\nparent: null,\nwidth: 1024,\nheight: 768,\nscale: {\nmode: Phaser.Scale.FIT,\nautoCenter: Phaser.Scale.CENTER_BOTH\n},\n\nscene: null\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"game/#configuration","title":"Configuration","text":"

    Reference

    {\ntype: Phaser.AUTO,\nparent: 'phaser-example',\nwidth: 800,\nheight: 600,\nscale: {\nmode: Phaser.Scale.FIT,\nautoCenter: Phaser.Scale.CENTER_BOTH\n},\ndom: {\ncreateContainer: false,\n},\nscene: null,\nbackgroundColor: 0x333333\n}\n

    or

    {\ntype: Phaser.AUTO,\nparent: null,\nwidth: 800,\nheight: 600,\n\nscale: {\nmode: Phaser.Scale.NONE,\nautoCenter: Phaser.Scale.NO_CENTER,\nresizeInterval: 500,\n// width:\n// height:\n// zoom:\n// parent:\nexpandParent: true.\n// min: {width: 0, height: 0},\n// max: {width: 0, height: 0},\n// snap: {width: 0, height: 0},\n// autoRound: false,\nfullscreenTarget: null,\n},\n\nautoRound: false,\ncanvas: null,\ncanvasStyle: null,\n\nscene: null,\n\ncallbacks: {\npreBoot: NOOP,\npostBoot: NOOP\n},\n\nseed: [ (Date.now() * Math.random()).toString() ],\n\ntitle: '',\nurl: 'https://phaser.io',\nversion: '',\n\nautoFocus: true,\ninput: {\nkeyboard: {\ntarget: window\n},\nmouse: {\ntarget: null,\ncapture: true\n},\nactivePointers: 1,\ntouch: {\ntarget: null,\ncapture: true\n},\nsmoothFactor: 0,\ngamepad: false,\nwindowEvents: true,\n},\ndisableContextMenu: false,\n\nbackgroundColor: 0,\n\nrender: {\nantialias: true,\nantialiasGL: true,\ndesynchronized: false,\npixelArt: false,\nroundPixels: false,\ntransparent: false,\nclearBeforeRender: true,\npreserveDrawingBuffer: false,\npremultipliedAlpha: true,\nfailIfMajorPerformanceCaveat: false,\npowerPreference: 'default', // 'high-performance', 'low-power' or 'default'\nbatchSize: 4096,\nmaxLights: 10,\nmaxTextures: -1,\nmipmapFilter: 'LINEAR', // 'NEAREST', 'LINEAR', 'NEAREST_MIPMAP_NEAREST', 'LINEAR_MIPMAP_NEAREST', 'NEAREST_MIPMAP_LINEAR', 'LINEAR_MIPMAP_LINEAR'\nautoMobilePipeline: true,\ndefaultPipeline: 'MultiPipeline',\npipeline:[]\n},\ndisablePreFX: false,\ndisablePostFX: false,\n\nphysics: {\ndefault: false,  // 'arcade', or 'matter'\narcade: {...},   // See arcade-world#Configuration\nmatter: {...},   // See matterjs-world#Configuration\n},\n\nloader:{\nbaseURL: '',\npath: '',\nmaxParallelDownloads: 4,\ncrossOrigin: undefined,\nresponseType: '',\nasync: true,\nuser: '',\npassword: '',\ntimeout: 0,\nmaxRetries: 2,\nwithCredentials: false,\nimageLoadType: 'XHR',    // 'HTMLImageElement' \nlocalScheme: [ 'file://', 'capacitor://' ]\n},\n\nimages: {\ndefault: 'data:image/png;base64....',\nmissing: 'data:image/png;base64....',\nwhite: 'data:image/png;base64....',\n},\n\naudio: {\ndisableWebAudio: false,\ncontext:\nnoAudio: false,\n},\n\ndom: {\ncreateContainer: false,\nbehindCanvas: false,\npointerEvents: 'none'\n},\n\nplugins: {\nglobal: [\n//{key, plugin, start}\n],\nscene: [\n// ...\n]\n},\n\npipeline: { key:PipelineClass },\n\nfps: {\nmin: 10,\ntarget: 60,\nlimit: 0,\nforceSetTimeOut: false,\ndeltaHistory: 10,\npanicMax: 120,\nsmoothStep: true,\n},\n\nbanner: {\nhidePhaser: false,\ntext: '#ffffff',\nbackground: [\n'#ff0000',\n'#ffff00',\n'#00ff00',\n'#00ffff',\n'#000000'\n]\n},\n// banner: false,\n\nstableSort: -1\n}\n
    "},{"location":"game/#destroy","title":"Destroy","text":"
    game.destroy();\n// game.destroy(removeCanvas, noReturn);\n
    • removeCanvas : Set to true if you would like the parent canvas element removed from the DOM, or false to leave it in place.
    • noReturn : If true all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this.
    "},{"location":"game/#global-members","title":"Global members","text":""},{"location":"game/#scene-manager","title":"Scene manager","text":"

    Global scene manager in game.scene, or scene.scene in each scene.

    "},{"location":"game/#global-data","title":"Global data","text":"

    Instance of data manager in game.registry, or scene.registry in each scene.

    • Get
      var value = scene.registry.get(key);\n// var value = game.registry.get(key);\n
    • Set
      scene.registry.set(key, value);\n// game.registry.set(key, value);\n
    • Event
      • Set data event
        scene.registry.events.on('setdata', function(parent, key, value){ /* ... */ });\n// game.registry.events.on('setdata', function(parent, key, value){ /* ... */ })\n
      • Change data event
        scene.registry.events.on('changedata', function(parent, key, value, previousValue){ /* ... */ });\n// game.registry.events.on('changedata', function(parent, key, value, previousValue){ /* ... */ })\n
        scene.registry.events.on('changedata-' + key, function(parent, value, previousValue){ /* ... */ });\n// game.registry.events.on('changedata-' + key, function(parent, value, previousValue){ /* ... */ });\n
    "},{"location":"game/#game-time","title":"Game time","text":"
    • The time that the current game step started at.
      var time = game.getTime();\n// var time = scene.game.getTime();\n
    • The current game frame.
      var frameCount = game.getFrame();\n// var frameCount = scene.game.getFrame();\n
    • The delta time, since the last game step. This is a clamped and smoothed average value.
      var delta = game.loop.delta;\n// var delta = scene.game.loop.delta;\n
    "},{"location":"game/#game-config","title":"Game config","text":"
    var config = game.config;\n// var config = scene.game.config;\n
    "},{"location":"game/#window-size","title":"Window size","text":"
    • Width
      var width = game.config.width;\n// var width = scene.game.config.width;\n
    • Height
      var height = game.config.height;\n// var height = scene.game.config.height;\n
    "},{"location":"game/#pause-resume","title":"Pause / Resume","text":"
    • Pause the entire game and emit a PAUSE event.
      game.pause();\n
    • Resume the entire game and emit a RESUME event.
      game.resume();\n
    • Get pause duration
      var time = game.pauseDuration;\n
    • Is paused
      var isPaused = game.isPaused;\n
    "},{"location":"game/#events","title":"Events","text":"
    • Pause(window is invisible)/Resume(window is visible)
      game.events.on('pause', function() {});\n
      game.events.on('resume', function() {});\n
    • Destroy event, triggered by game.destroy()
      game.events.on('destroy', function() {})\n
    • On window focused/blurred
      game.events.on('focus', function() {})\n
      game.events.on('blur', function(){ })\n
    "},{"location":"gameobject/","title":"Game object","text":""},{"location":"gameobject/#introduction","title":"Introduction","text":"

    Base class of all game object in phaser.

    • Author: Richard Davey
    "},{"location":"gameobject/#usage","title":"Usage","text":""},{"location":"gameobject/#destroy","title":"Destroy","text":"
    • Destroy game object
      gameObject.destroy();\n
    • Game object will be destroyed automatically when scene destroyed, if it is in display list, or update list.
    • Event
      gameObject.once('destroy', function(gameObject, fromScene) {\n\n}, scope);\n
      • fromScene : true if game object is destroyed during scene is shutdown. When scene is shutdown, all game objects will be destroyed.
    "},{"location":"gameobject/#position","title":"Position","text":"
    • Get
      var x = gameObject.x;\nvar y = gameObject.y;\n
    • Set
      gameObject.x = 0;\ngameObject.y = 0;\ngameObject.setPosition(x,y);\ngameObject.setX(x);\ngameObject.setY(y);\n
      • Set random
        gameObject.setRandomPosition(x, y, width, height);\n// gameObject.setRandomPosition(); // x=0, y=0, width=game.width, height=game.height\n
    "},{"location":"gameobject/#local-point","title":"Local point","text":"

    Transfer world point to local point

    var point = gameObject.getLocalPoint(x, y);  // point : {x, y}\n// var out = gameObject.getLocalPoint(x, y, out);\n
    or
    var out = gameObject.getLocalPoint(x, y, out, camera);\n

    "},{"location":"gameobject/#angle","title":"Angle","text":"
    • Get
      var angle = gameObject.angle;\nvar radians = gameObject.rotation;  // angle in radians\n
    • Set
      gameObject.angle = degrees;\ngameObject.rotation = radians;\ngameObject.setAngle(degrees);\ngameObject.setRotation(radians);\n
    "},{"location":"gameobject/#visible","title":"Visible","text":"
    • Get
      var visible = gameObject.visible; // visible: true/false\n
    • Set
      gameObject.visible = visible;\ngameObject.setVisible(visible);\n
    "},{"location":"gameobject/#alpha","title":"Alpha","text":"
    • Get
      var alpha = gameObject.alpha;  // 0~1\n
    • Set
      gameObject.setAlpha(alpha);\n// gameObject.alpha = alpha;\n
      or
      gameObject.setAlpha(topLeft, topRight, bottomLeft, bottomRight);\n// gameObject.alphaTopLeft = alpha;\n// gameObject.alphaTopRight = alpha;\n// gameObject.alphaBottomLeft = alpha;\n// gameObject.alphaBottomRight = alpha;\n
    • Clear (set to 1)
      gameObject.clearAlpha();\n
    "},{"location":"gameobject/#flipx-flipy","title":"FlipX, FlipY","text":"
    • Get
      var flip = gameObject.flipX;  // flip: true/false\nvar flip = gameObject.flipY;  // flip: true/false\n
    • Set
      gameObject.flipX = flip;\ngameObject.flipY = flip;\ngameObject.setFlipX(flip);\ngameObject.setFlipY(flip);\ngameObject.setFlip(flipX, flipY);\ngameObject.toggleFlipX();\ngameObject.toggleFlipY();\ngameObject.resetFlip();  // equal to gameObject.setFlip(false, false);\n
    "},{"location":"gameobject/#order-of-rendering","title":"Order of rendering","text":""},{"location":"gameobject/#depth-z-index","title":"Depth (z-index)","text":"

    The depth starts from zero (the default value) and increases from that point. A game object with a higher depth value will always render in front of one with a lower value.

    • Get
      var depth = gameObject.depth;\n
    • Set
      gameObject.depth = value;\ngameObject.setDepth(value);\n
    "},{"location":"gameobject/#display-list","title":"Display list","text":"
    • Get displayList
      var displayList = gameObject.getDisplayList();\n
    • Move the game Object to the top of the display list
      gameObject.setToTop()\n
      var displayList = gameObject.getDisplayList();\ndisplayList.bringToTop(child);\n
    • Move the game Object to the bottom of the display list
      gameObject.setToBack()\n
      var displayList = gameObject.getDisplayList();\ndisplayList.sendToBack(child);\n
    • Move the Game Object to appear above a given Game Object
      gameObject.setAbove(givenGameObject)\n
      var displayList = gameObject.getDisplayList();\ndisplayList.moveAbove(gameObject, givenGameObject);\n
    • Move the Game Object to appear below a given Game Object
      gameObject.setBelow(givenGameObject)\n
      var displayList = gameObject.getDisplayList();\ndisplayList.moveBelow(gameObject, givenGameObject);\n
    • Move the game object by index
      var displayList = gameObject.getDisplayList();\ndisplayList.moveTo(gameObject, index);\n
    • Swap two game objects
      var displayList = gameObject.getDisplayList();\ndisplayList.swap(gameObject, givenGameObject);\n
    • Move up or down
      var displayList = gameObject.getDisplayList();\ndisplayList.moveUp(gameObject);\ndisplayList.moveDown(gameObject);\n
    "},{"location":"gameobject/#layer-game-object","title":"Layer game object","text":"

    Place game object into Layer game object

    "},{"location":"gameobject/#scroll-factor","title":"Scroll factor","text":"
    • Get
      var scrollFactorX = gameObject.scrollFactorX;\nvar scrollFactorY = gameObject.scrollFactorY;\n
    • Set
      gameObject.setScrollFactor(scrollFactor);\ngameObject.setScrollFactor(scrollFactorX, scrollFactorY);\n

    Scroll factor: 0~1

    • 0= fixed to camera
    • 0.25= quarter the speed of the camera
    • 0.5= half the speed of the camera
    "},{"location":"gameobject/#bounds","title":"Bounds","text":"
    var output = gameObject.getTopLeft(output);     // output: {x, y}\nvar output = gameObject.getTopCenter(output);     // output: {x, y}\nvar output = gameObject.getTopRight(output);    // output: {x, y}\nvar output = gameObject.getLeftCenter(output);    // output: {x, y}\nvar output = gameObject.getRightCenter(output);    // output: {x, y}\nvar output = gameObject.getBottomLeft(output);  // output: {x, y}\nvar output = gameObject.getBottomCenter(output);     // output: {x, y}\nvar output = gameObject.getBottomRight(output); // output: {x, y}\nvar output = gameObject.getCenter(output);      // output: {x, y}\nvar output = gameObject.getBounds(output);      // output: {x, y, width, height}\n
    "},{"location":"gameobject/#origin","title":"Origin","text":"
    • Get
      var originX = gameObject.originX;\nvar originY = gameObject.originY;\n
    • Set
      gameObject.setOrigin(x, y);\n// gameObject.setOrigin(x); // y = x\n
      • Set to top-left
        gameObject.setOrigin(0);\n
      • Set to center
        gameObject.setOrigin(0.5);\n
      • Set to bottom-right
        gameObject.setOrigin(1);\n
    "},{"location":"gameobject/#tint","title":"Tint","text":"
    • Get
      var color = gameObject.tintTopLeft;     // color: 0xRRGGBB\nvar color = gameObject.tintTopRight;\nvar color = gameObject.tintBottomLeft;\nvar color = gameObject.tintBottomRight;\nvar isTinted = gameObject.isTinted;\n
    • Set
      gameObject.tint = color;\ngameObject.setTint(color);  // multiply color value\ngameObject.setTint(colorTopLeft, colorTopRight, colorBottomLeft, colorBottomRight);\ngameObject.setTintFill(color);  // replace color value\ngameObject.setTintFill(colorTopLeft, colorTopRight, colorBottomLeft, colorBottomRight);    gameObject.clearTint();     // equal to `gameObject.setTint(0xffffff)`\n

    Note

    gameObject.tint is a write-only property

    "},{"location":"gameobject/#blend-mode","title":"Blend mode","text":"
    • Get
      var blendMode = gameObject.blendMode;\n
    • Set
      gameObject.blendMode = blendMode;\ngameObject.setBlendMode(blendMode);\n
      • blendMode : Blend mode
    "},{"location":"gameobject/#mask","title":"Mask","text":"

    See Mask.

    "},{"location":"gameobject/#built-in-shader-effects","title":"Built-in shader effects","text":"

    See built-in shader effects

    "},{"location":"gameobject/#post-fx-pipeline","title":"Post-fx pipeline","text":""},{"location":"gameobject/#register-post-fx-pipeline","title":"Register post-fx pipeline","text":"
    • Register post-fx pipeline in game config
      import PostFxClass from 'path';\nvar config = {\n// ...\npipeline: [PostFxClass]\n// ...\n};\nvar game = new Phaser.Game(config);\n

    Some post-fx pipelines:

    • Barrel: Barrel post processing filter.
    • Color replace: Replace color post processing filter.
    • Cross-stitching: Cross-stitching post processing filter.
    • Dissolve: Dissolve transition post processing filter.
    • Fish eye: Fish-eye post processing filter.
    • Glow-filter: Glow post processing filter.
    • Glow-filter: Glow post processing filter, ported from pixi.
    • Gray-scale: Gray scale post processing filter.
    • Hsl-adjust: Adjust color in HSL domain, post processing filter.
    • Horri-fi: 6-in-1 post processing filter.
    • Inverse: Inverse color post processing filter.
    • Kawase-blur: Kawase-blur post processing filter.
    • Pixelation: Pixelation post processing filter.
    • Toonify: Draw outlines and quantize color in HSV domain, post processing filter.
    • Shockwave: Shockwave post processing filter.
    • Split: Split image into 4 parts.
    • Swirl: Swirl post processing filter.
    • Warp: Warp post processing filter.
    "},{"location":"gameobject/#add-post-fx-pipeline","title":"Add post-fx pipeline","text":"
    gameObject.setPostPipeline(PostFxClass);\n
    • PostFxClass : Class of post-fx pipeline.
    "},{"location":"gameobject/#remove-post-fx-pipeline","title":"Remove post-fx pipeline","text":"
    • Remove a post-fx pipeline
      gameObject.removePostPipeline(PostFxClass);\n
    • Remove all post-fx pipelines
      gameObject.resetPipeline(true);\n
      or
      gameObject.postPipelines = [];\ngameObject.hasPostPipeline = false;\n
    "},{"location":"gameobject/#get-post-fx-pipeline","title":"Get post-fx pipeline","text":"
    var pipelineInstance = gameObject.getPostPipeline(PostFxClass);\n
    "},{"location":"gameobject/#size","title":"Size","text":"
    • Native (un-scaled) size
      • Get
        var width = gameObject.width;\nvar height = gameObject.height;\n
      • Set
        gameObject.setSize(width, height);\n
        or
        gameObject.width = width;\ngameObject.height = height;\n
    • Display size
      • Get
        var displayWidth = gameObject.displayWidth;\nvar displayHeight = gameObject.displayHeight;\n
      • Set
        gameObject.setDisplaySize(displayWidth, displayHeight);\n
        or
        gameObject.displayWidth = displayWidth;\ngameObject.displayHeight = displayHeight;\n
    • Scale
      • Get
        var scaleX = gameObject.scaleX;\nvar scaleY = gameObject.scaleY;\n
        or
        var scale = gameObject.scale;  // Return (scaleX + scaleY)/2\n
      • Set
        gameObject.setScale(scaleX, scaleY);\n
        or
        gameObject.scaleX = scaleX;\ngameObject.scaleY = scaleY;\n
        or
        gameObject.scale = scale;  // Set scaleX, scaleY to scale\n
    "},{"location":"gameobject/#click","title":"Click","text":"
    gameObject.setInteractive().on('pointerdown', function(pointer, localX, localY, event){\n// ...\n});\n

    See touch event

    "},{"location":"gameobject/#state","title":"State","text":"
    • Get
      var state = gameObject.state;\n
    • Set
      gameObject.setState(state);\n
    "},{"location":"gameobject/#data","title":"Data","text":"
    • Get
      var value = gameObject.getData(key);\nvar values = gameObject.getData(keys); // keys: an array of keys\nvar value = gameObject.data.values[key];\n
    • Set
      gameObject.setData(key, value);\ngameObject.incData(key, value);    gameObject.setData(obj); // obj: {key0:value0, key1:value1, ...}\ngameObject.data.values[key] = value;\ngameObject.data.values[key] += inc;\n
      or
      gameObject.toggleData(key);\n
    • Enable
      gameObject.setDataEnabled();\n
    • Events :
      • Set data evant
        gameObject.on('setdata', function(gameObject, key, value){ /* ... */ });\n
      • Change data event
        gameObject.on('changedata', function(gameObject, key, value, previousValue){ /* ... */ });\n
        gameObject.on('changedata-' + key, function(gameObject, value, previousValue){ /* ... */ });\n

    See data manager

    Note

    Ensure data manager is created before binding any data-changed events.

    "},{"location":"gameobject/#texture","title":"Texture","text":"
    • Set texture via key string
      gameObject.setTexture(key);\n// gameObject.setTexture(key, frame);\n// gameObject.setTexture(key, frame, updateSize, updateOrigin);\n
    • Set texture via texture object
      gameObject.setTexture(texture);\n// gameObject.setTexture(texture, frame);\n
      • texture : Texture object, or canvas texture object
    • Set frame
      gameObject.setFrame(frame);\n// gameObject.setFrame(frame, updateSize, updateOrigin);\n
      • frame :\u3000The name or index of the frame within the Texture.
      • updateSize : Should this call adjust the size of the Game Object?
      • updateOrigin : Should this call adjust the origin of the Game Object?
    • Set frame by frame object
      gameObject.setFrame(frameObject);\n// gameObject.setFrame(frameObject, updateSize, updateOrigin);\n
    • Applies a crop to a texture
      gameObject.setCrop(x, y, width, height);\n
      The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left.
      • Reset crop
        gameObject.setCrop();\n// gameObject.isCropped = false;\n
    • Get texture, frame.
      var texture = gameObject.texture;\nvar frame = gameObject.frame;\n
    • Get texture key, frame name.
      var textureKey = gameObject.texture.key;\nvar frameName = gameObject.frame.name;\n
    "},{"location":"gameobject/#name","title":"Name","text":"
    • Get
      var name = gameObject.name;\n
    • Set
      gameObject.setName(name);\ngameObject.name = name;\n
    "},{"location":"gameobject/#will-render","title":"Will render","text":"
    • Test render flag and camera filter.
      var willRennder = gameObject.willRender(camera);\n
    • Test render flag only
      var willRender = (gameObject.renderFlags === Phaser.GameObjects.GameObject.RENDER_MASK);\n
      • Phaser.GameObjects.GameObject.RENDER_MASK : 15 (Visible, Alpha, Transform and Texture)
    "},{"location":"gameobject/#add-to-scenecontainer","title":"Add to scene/container","text":""},{"location":"gameobject/#add","title":"Add","text":"

    Trigger 'addedtoscene' event, which invoke gameObject.addedToScene()

    • Register 'addedtoscene' event
      gameObject.on('addedtoscene', function(gameObject, scene){});\n
    • Or, override addedToScene method
      class MyClass extends BaseClass {\n// ...\naddedtoscene() {\nsuper.addedtoscene();\n// ...\n}\n}\n
    "},{"location":"gameobject/#remove","title":"Remove","text":"

    Trigger 'removedfromscene' event, which invoke gameObject.removedFromScene()

    • Register 'removedfromscene' event
      gameObject.on('removedfromscene', function(gameObject, scene){});\n
    • Or, override removedFromScene method
      class MyClass extends BaseClass {\n// ...\nremovedFromScene() {\nsuper.removedFromScene();\n// ...\n}\n}\n
    "},{"location":"gameobject/#custom-class","title":"Custom class","text":"
    • Define class
      class MyClass extends BaseClass {\nconstructor(scene, x, y) {\nsuper(scene, x, y);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     if (super.preUpdate) {\n//         super.preUpdate(time, delta);\n//     }\n// }\n\n// destroy(fromScene) {\n//     //  This Game Object has already been destroyed\n//     if (!this.scene) {\n//         return;\n//     }\n//     super.destroy(fromScene);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
          • Some kinds of game object like Sprite, Dom-element has preUpdate method already.
    • Create instance
      var image = new MyClass(scene, x, y, key);\n
    "},{"location":"gamepad/","title":"Gamepad","text":""},{"location":"gamepad/#introduction","title":"Introduction","text":"

    Gamepad's state of buttons, or axis.

    • Author: Richard Davey
    "},{"location":"gamepad/#usage","title":"Usage","text":""},{"location":"gamepad/#enable-gamepad-manager","title":"Enable gamepad manager","text":"
    var config = {\n// ...\ninput: {\ngamepad: true\n},\n// ...\n}\nvar game = new Phaser.Game(config);\n
    "},{"location":"gamepad/#get-gamepad","title":"Get gamepad","text":"
    • Get all currently connected Gamepads.
      var gamepads = scene.input.gamepad.getAll();\n
    • Get gamepad by index
      var gamepad = scene.input.gamepad.getPad(0);\n// var gamepad = scene.input.gamepad.getPad(index);\n
    • Get gamepad when button-down.
      scene.input.gamepad.once('down', function (gamepad, button, value) {\n}\n
      • gamepad : A reference to the Gamepad on which the button was released. See Properties of gamepad
      • button : A reference to the Button which was released.
      • value : The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons.
    "},{"location":"gamepad/#events","title":"Events","text":"
    • Button down
      scene.input.gamepad.on('down', function (gamepad, button, value) {\n})\n
      or
      gamepad.on('down', function(buttonIndex, value, button) {\n})\n
    • Button up
      scene.input.gamepad.on('up', function (gamepad, button, value) {\n}\n
      or
      gamepad.on('up', function(buttonIndex, value, button) {\n})\n
    • Gamepad connected
      scene.input.gamepad.on('connected', function (gamepad, event) {\n}\n
    • Gamepad disconnected
      scene.input.gamepad.on('disconnected', function (gamepad, event) {\n}\n
    "},{"location":"gamepad/#gamepad","title":"Gamepad","text":""},{"location":"gamepad/#buttons","title":"Buttons","text":"
    • Cursor buttons
      var isLeftDown = gamepad.left;\nvar isRightftDown = gamepad.right;\nvar isUpDown = gamepad.up;\nvar isDownDown = gamepad.down;\n
    • Right buttons cluster
      var isADown = gamepad.A;  // Dual Shock controller: X button\nvar isYDown = gamepad.Y;  // Dual Shock controller: Triangle button\nvar isXDown = gamepad.X;  // Dual Shock controller: Square button.\nvar isBDown = gamepad.B;  // Dual Shock controller: Circle button\n
    • Shoulder buttons
      var isL1Down = gamepad.L1; // XBox controller: LB button\nvar isL2Down = gamepad.L2; // XBox controller: LT button\nvar isR1Down = gamepad.R1; // XBox controller: RB button\nvar isR2Down = gamepad.R2; // XBox controller: RT button\n
    "},{"location":"gamepad/#axis-sticks","title":"Axis sticks","text":"
    • Left sticks, right sticks
      var leftStick = gamepad.leftStick;\nvar rightStick = gamepad.rightStick;\n
      • leftStick, rightStick : Read only vector2.
        • Angle : leftStick.angle()
        • Length : leftStick.length()
        • x, y : leftStick.x , leftStick.y
    "},{"location":"gamepad/#properties","title":"Properties","text":"
    • gamepad.index : An integer that is unique for each Gamepad currently connected to the system. This can be used to distinguish multiple controllers. Note that disconnecting a device and then connecting a new device may reuse the previous index.
    • gamepad.id : A string containing some information about the controller.
    • gamepad.buttons : An array of Gamepad Button objects, corresponding to the different buttons available on the Gamepad.
    • gamepad.axes : An array of Gamepad Axis objects, corresponding to the different axes available on the Gamepad, if any.
    "},{"location":"gashapon/","title":"Gashapon","text":""},{"location":"gashapon/#introduction","title":"Introduction","text":"

    Pick random item from box.

    • Author: Rex
    • Member of scene, or game object
    "},{"location":"gashapon/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gashapon/#install-plugin","title":"Install plugin","text":""},{"location":"gashapon/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgashaponplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgashaponplugin.min.js', true);\n
    • Add gashapon object
      var gashapon = scene.plugins.get('rexgashaponplugin').add(config);\n
    "},{"location":"gashapon/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GashaponPlugin from 'phaser3-rex-plugins/plugins/gashapon-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGashapon',\nplugin: GashaponPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add gashapon object
      var gashapon = scene.plugins.get('rexGashapon').add(config);\n
    "},{"location":"gashapon/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Gashapon from 'phaser3-rex-plugins/plugins/gashapon.js';\n
    • Add gashapon object
      var gashapon = new Gashapon(config);\n
    "},{"location":"gashapon/#create-instance","title":"Create instance","text":"
    var gashapon = scene.plugins.get('rexGashapon').add({\nmode: 'shuffle',  // 0|'shuffle'|1|'random\nitems: {  // name:count\na:1, b:2, c:3 },\nreload: true,     // true|false\nrnd: undefined,\n});\n
    • mode :
      • 'shuffle', or 0 : pick item from box without put it back.
      • 'random', or 1 : pick item from box then put it back.
    • reload : set true to reload items when box is empty for shuffle mode.
    • items : initial items { name:count } in box.
    • rnd : Use random data generator to generate result.
      • undefined : Use Math.random() to generate result.
      • Phaser.Math.RND : Use pre-defined random data generator.
    "},{"location":"gashapon/#pick-item","title":"Pick item","text":"
    • Pick a random item
      var item = gashapon.next();\n
      • return null if pick nothing
    • Pick specific item
      var item = gashapon.next(name);\n
      • return null if pick nothing
    • Last picked item
      var item = gashapon.result;\n
    "},{"location":"gashapon/#set-item","title":"Set item","text":"
    • Set item
      gashapon.setItem(name, count);\n
    • Add item
      gashapon.addItem(name, count);\n
    • Put item back
      gashapon.putItemBack(name, count);\n
    "},{"location":"gashapon/#remove-item","title":"Remove item","text":"
    • Remove item
      gashapon.removeItem(name);\n
    • Remove all items
      gashapon.removeAllItems();\n
    "},{"location":"gashapon/#current-status","title":"Current status","text":"
    • Get current status
      var status = gashapon.toJSON();\n
    • Clone object
      var state = gashapon.toJSON();\nvar gashapon2 = new Gashapon(state);\n
    • Overwrite current status
      var status = gashapon.toJSON();\n// gashapon.next()...\ngashapon.resetFromJSON(status);\n
    "},{"location":"gashapon/#get-items","title":"Get items","text":"
    • Get initial items
      var items = gashapon.getItems();\n
    • Get remainder items
      var items = gashapon.getRemain();\n
    • Get initial item count
      var count = gashapon.getItemCount(name);\n
    • Get remainder item count
      var count = gashapon.getRemainCount(name);\n
    • For each initial item
      gashapon.forEachItem(function(name, count) {\n\n}, scope);\n
    • For each remainder item
      gashapon.forEachRemain(function(name, count) {\n\n}, scope);\n
    "},{"location":"gashapon/#set-random-generator","title":"Set random generator","text":"
    gashapon.setRND(rnd);\n
    • rnd : Use random data generator to generate result.
      • undefined, or null : Use Math.random() to generate result.
      • Phaser.Math.RND : Use pre-defined random data generator.
    "},{"location":"geom-circle/","title":"Circle","text":""},{"location":"geom-circle/#introduction","title":"Introduction","text":"

    Circle shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-circle/#usage","title":"Usage","text":""},{"location":"geom-circle/#create-shape","title":"Create shape","text":"
    var circle = new Phaser.Geom.Circle(x, y, radius);\n
    "},{"location":"geom-circle/#clone-shape","title":"Clone shape","text":"
    var circle1 = Phaser.Geom.Circle.Clone(circle0);\n
    "},{"location":"geom-circle/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillCircleShape(circle);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeCircleShape(circle);\n

    Note

    Negative radius will be treated as positive radius. i.e. Math.abs(radius)

    "},{"location":"geom-circle/#set-properties","title":"Set properties","text":"
    • All properties
      circle.setTo(x, y, radius);\n
      or
      Phaser.Geom.Circle.CopyFrom(source, dest);\n
    • Position
      circle.setPosition(x, y);\n
      or
      circle.x = 0;\ncircle.y = 0;\n
      or
      circle.left = 0;       // circle.x\ncircle.top = 0;        // circle.y\n// circle.right = 0;   // circle.x\n// circle.bottom = 0;  // circle.y\n
      or
      Phaser.Geom.Circle.Offset(circle, dx, dy); // circle.x += dx, circle.y += dy\n
      or
      Phaser.Geom.Circle.OffsetPoint(circle, point); // circle.x += point.x, circle.y += point.y\n
    • Radius
      circle.radius = radius;\n
      or
      circle.diameter = diameter;  // diameter = 2 * radius\n
    "},{"location":"geom-circle/#get-properties","title":"Get properties","text":"
    • Position
      var x = circle.x;\nvar y = circle.y;\nvar top = circle.top;\nvar left = circle.left;\nvar right = circle.right;\nvar bottom = circle.bottom;\n
    • Radius
      var radius = circle.radius;\n// var diameter = circle.diameter;\n
    • Bound
      var bound = Phaser.Geom.Circle.GetBounds(circle);\n// var bound = Phaser.Geom.Circle.GetBounds(circle, bound);  // push bound\n
      • bound : A Rectangle shape object
    • Area
      var area = Phaser.Geom.Circle.Area(circle);\n
    • Circumference
      var circumference = Phaser.Geom.Circle.Circumference(circle);\n
    • Type:
      var type = circle.type; // 0\n
    "},{"location":"geom-circle/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = circle.getPoint(t);  // t : 0 ~ 1 (angle/360)\n// var point = circle.getPoint(t, point);  // modify point\n
      or
      var point = Phaser.Geom.Circle.CircumferencePoint(circle, angle);  // angle in degrees\n// var point = Phaser.Geom.Circle.CircumferencePoint(circle, angle, point);  // modify point\n
    • Get a random point inside shape
      var point = circle.getRandomPoint();\n// var point = circle.getRandomPoint(point);  // modify point\n
    • Get points around shape's edge
      var points = circle.getPoints(quantity);\n// var points = circle.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = circle.getPoints(false, step);\n// var points = circle.getPoints(false, step, points);  // push points\n
      • points : an array of point
    • Point is inside shape
      var isInside = circle.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Circle.ContainsPoint(circle, point);\n
    • Rectangle is inside shape
      var isInside = Phaser.Geom.Circle.ContainsRect(circle, rect);  // rect : 4 points\n
    "},{"location":"geom-circle/#empty","title":"Empty","text":"
    • Set empty
      circle.setEmpty();     // circle.radius = 0\n
    • Is empty
      var isEmpty = circle.isEmpty();   // circle.radius <= 0\n
    "},{"location":"geom-circle/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Circle.Equals(circle0, circle1);\n

    Position and radius are equal.

    "},{"location":"geom-circle/#intersection","title":"Intersection","text":""},{"location":"geom-circle/#circle-to-circle","title":"Circle to circle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.CircleToCircle(circleA, circleB);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetCircleToCircle(circleA, circleB);\n// var out = Phaser.Geom.Intersects.GetCircleToCircle(circleA, circleB, out);\n
    "},{"location":"geom-circle/#circle-to-rectangle","title":"Circle to rectangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.CircleToRectangle(circle, rect);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetCircleToRectangle(circle, rect);\n// var out = Phaser.Geom.Intersects.GetCircleToRectangle(circle, rect, out);\n
    "},{"location":"geom-circle/#circle-to-triangle","title":"Circle to triangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToCircle(triangle, circle);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToCircle(triangle, circle);\n// var out = Phaser.Geom.Intersects.GetTriangleToCircle(triangle, circle, out);\n
    "},{"location":"geom-circle/#circle-to-line","title":"Circle to line","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.LineToCircle(line, circle);\n// var result = Phaser.Geom.Intersects.LineToCircle(line, circle, nearest);\n
      • nearest : Nearest point on line.
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetLineToCircle(line, circle);\n// var out = Phaser.Geom.Intersects.GetLineToCircle(line, circle, out);\n
    "},{"location":"geom-ellipse/","title":"Ellipse","text":""},{"location":"geom-ellipse/#introduction","title":"Introduction","text":"

    Ellipse shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-ellipse/#usage","title":"Usage","text":""},{"location":"geom-ellipse/#create-shape","title":"Create shape","text":"
    var ellipse = new Phaser.Geom.Ellipse(x, y, width, height);\n
    "},{"location":"geom-ellipse/#clone-shape","title":"Clone shape","text":"
    var ellipse1 = Phaser.Geom.Ellipse.Clone(ellipse0);\n
    "},{"location":"geom-ellipse/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillEllipseShape(ellipse);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeEllipseShape(ellipse);\n

    Note

    Negative width, height will be treated as positive width, height. i.e. Math.abs(width), Math.abs(height)

    "},{"location":"geom-ellipse/#set-properties","title":"Set properties","text":"
    • All properties
      ellipse.setTo(x, y, width, height);\n
      or
      Phaser.Geom.Ellipse.CopyFrom(source, dest);\n
    • Position
      ellipse.setPosition(x, y);\n
      or
      ellipse.x = 0;\nellipse.y = 0;\n
      or
      ellipse.left = 0;       // ellipse.x\nellipse.top = 0;        // ellipse.y\n// ellipse.right = 0;   // ellipse.x\n// ellipse.bottom = 0;  // ellipse.y\n
      or
      Phaser.Geom.Ellipse.Offset(ellipse, dx, dy); // ellipse.x += dx, ellipse.y += dy\n
      or
      Phaser.Geom.Ellipse.OffsetPoint(ellipse, point); // ellipse.x += point.x, ellipse.y += point.y\n
    • Width, height
      ellipse.width = width;\nellipse.height = height;\n
    "},{"location":"geom-ellipse/#get-properties","title":"Get properties","text":"
    • Position
      var x = ellipse.x;\nvar y = ellipse.y;\nvar top = ellipse.top;\nvar left = ellipse.left;\nvar right = ellipse.right;\nvar bottom = ellipse.bottom;\n
    • Width, height
      var width = ellipse.width;\nvar height = ellipse.height;\n
    • Bound
      var bound = Phaser.Geom.Ellipse.GetBounds(ellipse);\n// var bound = Phaser.Geom.Ellipse.GetBounds(ellipse, bound);  // push bound\n
      • bound : A Rectangle shape object
    • Area
      var area = Phaser.Geom.Ellipse.Area(ellipse);\n
    • Circumference
      var circumference = Phaser.Geom.Ellipse.Circumference(ellipse);\n
    • Type:
      var type = ellipse.type; // 1\n
    "},{"location":"geom-ellipse/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = ellipse.getPoint(t);  // t : 0 ~ 1 (angle/360)\n// var point = ellipse.getPoint(t, point);  // modify point\n
      or
      var point = Phaser.Geom.Ellipse.CircumferencePoint(ellipse, angle);  // angle in degrees\n// var point = Phaser.Geom.Ellipse.CircumferencePoint(ellipse, angle, point);  // modify point\n
    • Get a random point inside shape
      var point = ellipse.getRandomPoint();\n// var point = ellipse.getRandomPoint(point);  // modify point\n
    • Get points around shape's edge
      var points = ellipse.getPoints(quantity);\n// var points = ellipse.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = ellipse.getPoints(false, step);\n// var points = ellipse.getPoints(false, step, points);  // push points\n
      • points : an array of point
    • Point is inside shape
      var isInside = ellipse.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Ellipse.ContainsPoint(ellipse, point);\n
    • Rectangle is inside shape
      var isInside = Phaser.Geom.Ellipse.ContainsRect(ellipse, rect);  // rect : 4 points\n
    "},{"location":"geom-ellipse/#empty","title":"Empty","text":"
    • Set empty
      ellipse.setEmpty();     // ellipse.width = 0, ellipse.height = 0\n
    • Is empty
      var isEmpty = ellipse.isEmpty();   // ellipse.width <= 0 || ellipse.height <= 0\n
    "},{"location":"geom-ellipse/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Ellipse.Equals(ellipse0, ellipse1);\n

    Position and width, height are equal.

    "},{"location":"geom-hexagon/","title":"Hexagon","text":""},{"location":"geom-hexagon/#introduction","title":"Introduction","text":"

    Hexagon shape and methods, extends from Polygon geometry object.

    • Author: Rex
    • Geometry object
    "},{"location":"geom-hexagon/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"geom-hexagon/#install-plugin","title":"Install plugin","text":""},{"location":"geom-hexagon/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexhexagonplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexhexagonplugin.min.js', true);\n
    • Add hexagon geometry object
      var hexagon = scene.plugins.get('rexhexagonplugin').add(x, y, size, orientationType);\n
    "},{"location":"geom-hexagon/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import HexagonPlugin from 'phaser3-rex-plugins/plugins/hexagon-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexHexagon',\nplugin: HexagonPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add hexagon geometry object
      var hexagon = scene.plugins.get('rexHexagon').add(x, y, size, orientationType);\n
    "},{"location":"geom-hexagon/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Hexagon from 'phaser3-rex-plugins/plugins/hexagon.js';\n
    • Add hexagon geometry object
      var hexagon = new Hexagon(x, y, size, orientationType);\n
    "},{"location":"geom-hexagon/#create-shape","title":"Create shape","text":"

    var hexagon = scene.plugins.get('rexHexagon').add(x, y, size, orientationType);\n
    or
    var hexagon = scene.plugins.get('rexHexagon').add({\nx: 0,\ny: 0,\nsize: 20,\norientationType: 0     // 0|'flat'|'vertical'|1|'pointy'|'horizontal'\n});\n
    or
    var hexagon = new Phaser.Geom.rexHexagon(x, y, size, orientationType);\n

    • x : Center X.
    • y : Center Y.
    • size : Distance between center to each corner.
    • orientationType : See here
      • 0, 'flat', or 'y'
      • 1, 'pointy' or ,'x'
    "},{"location":"geom-hexagon/#draw-on-graphics","title":"Draw on graphics","text":"

    See Polygon shape.

    "},{"location":"geom-hexagon/#set-properties","title":"Set properties","text":"
    • All properties
      hexagon.setTo(x, y, size, orientationType);\n
    • Position
      hexagon.setPosition(x, y);\n
      or
      hexagon.x = 0;\nhexagon.y = 0;\n
      or
      hexagon.centerX = 0;  // equal to hexagon.x\nhexagon.centerY = 0;  // equal to hexagon.y\n
      or
      hexagon.left = 0;       // hexagon.x\nhexagon.top = 0;        // hexagon.y\nhexagon.right = 0;      // hexagon.x\nhexagon.bottom = 0;     // hexagon.y\n
    • Size
      hexagon.setSize(size);\n
      or
      hexagon.size = size;\n
    • Orientation type
      hexagon.setType(orientationType);\n
      or
      hexagon.orientationType = orientationType;\n
      • orientationType : See here
        • 0, 'flat', or 'y'
        • 1, 'pointy' or ,'x'
    "},{"location":"geom-hexagon/#get-properties","title":"Get properties","text":"

    See Polygon shape.

    • Position
      • Center
        var centerX = hexagon.centerX;\nvar centerY = hexagon.centerY;\n
        or
        var centerX = hexagon.x;\nvar centerY = hexagon.y;\n
      • Bound
        var top = hexagon.top;\nvar left = hexagon.left;\nvar right = hexagon.right;\nvar bottom = hexagon.bottom;\n
    • Width
      var width = hexagon.width;\n
    • Height
      var width = hexagon.height;\n
    • Lines around hexagon
      var edge01 = hexagon.getLineA();\nvar edge12 = hexagon.getLineB();\nvar edge23 = hexagon.getLineC();\nvar edge34 = hexagon.getLineD();\nvar edge45 = hexagon.getLineE();\nvar edge50 = hexagon.getLineF();\n// var out = hexagon.getLineF(out);\n
      or
      var edge = hexagon.getEdge(edgeIdx);\n// var out = hexagon.getEdge(edgeIdx, out);\n
    "},{"location":"geom-hexagon/#points-shape","title":"Point(s) & shape","text":"

    See Polygon shape.

    "},{"location":"geom-line/","title":"Line","text":""},{"location":"geom-line/#introduction","title":"Introduction","text":"

    Line shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-line/#usage","title":"Usage","text":""},{"location":"geom-line/#create-shape","title":"Create shape","text":"
    var line = new Phaser.Geom.Line(x1, y1, x2, y2);\n
    "},{"location":"geom-line/#clone-shape","title":"Clone shape","text":"
    var line1 = Phaser.Geom.Line.Clone(line0);\n
    "},{"location":"geom-line/#draw-on-graphics","title":"Draw on graphics","text":"
    // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeLineShape(line);\n
    "},{"location":"geom-line/#set-properties","title":"Set properties","text":"
    • All properties
      line.setTo(x1, y1, x2, y2);\n
      or
      Phaser.Geom.Line.CopyFrom(source, dest);\n
    • Position
      line.x1 = 0;\nline.y1 = 0;\nline.x2 = 0;\nline.y2 = 0;\n
      or
      line.left = 0;    // min(x1, x2)\nline.top = 0;     // min(y1, y2)\nline.right = 0;   // max(x1, x2)\nline.bottom = 0;  // max(y1, y2)\n
      • Offset start, end
        var line = Phaser.Geom.Line.Offset(line, dx, dy); // line.x1 += dx, line.y1 += dy, line.x2 += dx, line.y2 += dy\n
      • Set center position
        var line = Phaser.Geom.Line.CenterOn(line, x, y);\n
    • Start point, angle, length
      var line = Phaser.Geom.Line.SetToAngle(line, x, y, angle, length);\n
      • line : The line to set
      • x , y : start point
      • angle : The angle of the line in radians
        var rad = Phaser.Math.DegToRad(deg);\n
      • length :\u3000The length of the line
    • Rotate
      • Rotate around midpoint
        var line = Phaser.Geom.Line.Rotate(line, angle)\n
        • line : The line to set
        • angle : The angle of the line in radians
          var rad = Phaser.Math.DegToRad(deg);\n
      • Rotate around point
        var line = Phaser.Geom.Line.RotateAroundPoint(line, point, angle);\n
        or
        var line = Phaser.Geom.Line.RotateAroundXY(line, x, y, angle);\n
        • line : The line to set
        • angle : The angle of the line in radians
          var rad = Phaser.Math.DegToRad(deg);\n
    • Extend
      var line = Phaser.Geom.Line.Extend(line, left, right);\n
    "},{"location":"geom-line/#get-properties","title":"Get properties","text":"
    • Position
      var x1 = line.x1;\nvar y1 = line.y1;\nvar x2 = line.x2;\nvar y2 = line.y2;\nvar top = line.top;       // min(x1, x2)\nvar left = line.left;     // min(y1, y2)\nvar right = line.right;   // max(x1, x2)\nvar bottom = line.bottom; // max(y1, y2)\n
      • Start point
        var start = line.getPointA();  // start: {x, y}\nvar start = line.getPointA(start);  // push start\n
      • End point
        var end = line.getPointB();  // end: {x, y}\nvar end = line.getPointB(end);  // push end\n
      • Middle point
        var middle = Phaser.Geom.Line.GetMidPoint(line);  // middle: {x, y}\n// var middle = Phaser.Geom.Line.GetMidPoint(line, middle);\n
    • Length
      var length = Phaser.Geom.Line.Length(line);\n
      • Width : Abs(x1 - x2)
        var width = Phaser.Geom.Line.Width(line);\n
      • Height : Abs(y1 - y2)
        var width = Phaser.Geom.Line.Height(line);\n
    • Slope
      • Slope : (y2 - y1) / (x2 - x1)
        var slope = Phaser.Geom.Line.Slope(line);\n
      • Perpendicular slope : -((x2 - x1) / (y2 - y1))
        var perpSlope = Phaser.Geom.Line.PerpSlope(line);\n
    • Angle
      • Angle
        var angle = Phaser.Geom.Line.Angle(line);\n
        • angle : The angle of the line in radians
          var deg = Phaser.Math.RadToDeg(rad);  // deg : -180 ~ 180\n
      • Normal angle (angle - 90 degrees)
        • Normal angle
          var normalAngle = Phaser.Geom.Line.NormalAngle(line);\n
        • Normal vector
          var normal = Phaser.Geom.Line.GetNormal(line);  // normal: {x, y}\n// var normal = Phaser.Geom.Line.GetNormal(line, normal);  // push normal\n
          or
          var normalX = Phaser.Geom.Line.NormalX(line);\nvar normalY = Phaser.Geom.Line.NormalY(line);\n
      • Reflect angle
        var reflectAngle = Phaser.Geom.Line.ReflectAngle(aimLine, reflectingLine);\n
    • Type:
      var type = line.type; // 2\n
    "},{"location":"geom-line/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = line.getPoint(t);  // t : 0 ~ 1. 0=start, 0.5=middle, 1=end\n// var point = line.getPoint(t, point);  // modify point\n
    • Get a random point inside shape
      var point = line.getRandomPoint();\n// var point = line.getRandomPoint(point);  // modify point\n
    • Get points around shape's edge
      var points = line.getPoints(quantity);\n// var points = line.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = line.getPoints(false, step);\n// var points = line.getPoints(false, step, points);  // push points\n
      • points : an array of point
    • Get points using Bresenham's line algorithm
      var points = Phaser.Geom.Line.BresenhamPoints(line, step);\n// var points = Phaser.Geom.Line.BresenhamPoints(line, step, points);  // push points\n
    • Get points using easing function
      var points = Phaser.Geom.Line.GetEasedPoints(line, ease, quantity);\n// var points = Phaser.Geom.Line.GetEasedPoints(line, ease, quantity, collinearThreshold, easeParams);\n
      • ease : String of ease function, or a custom function (function (t) { return value}).
      • quantity : The number of points to return.
      • collinearThreshold : Each point is spaced out at least this distance apart. This helps reduce clustering in noisey eases.
      • easeParams : Array of ease parameters to go with the ease.
    • Get the nearest point on a line perpendicular to the given point.
      var point = Phaser.Geom.Line.GetNearestPoint(line, pointIn);\n// var point = Phaser.Geom.Line.GetNearestPoint(line, pointIn, point);\n
    • Get the shortest distance from a Line to the given Point.
      var distance = Phaser.Geom.Line.GetShortestDistance(line, point);\n
    "},{"location":"geom-line/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Line.Equals(line0, line1);\n

    x1, y2, x2, y2 are equal.

    "},{"location":"geom-line/#intersection","title":"Intersection","text":""},{"location":"geom-line/#line-to-circle","title":"Line to circle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.LineToCircle(line, circle);\n// var result = Phaser.Geom.Intersects.LineToCircle(line, circle, nearest);\n
      • nearest : Nearest point on line.
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetLineToCircle(line, circle);\n// var out = Phaser.Geom.Intersects.GetLineToCircle(line, circle, out);\n
    "},{"location":"geom-line/#line-to-rectangle","title":"Line to rectangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.LineToRectangle(line, rect);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetLineToRectangle(line, rect);\n// var out = Phaser.Geom.Intersects.GetLineToRectangle(line, rect, out);\n
    "},{"location":"geom-line/#line-to-triangle","title":"Line to triangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToLine(triangle, line);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToLine(triangle, line);\n// var out = Phaser.Geom.Intersects.GetTriangleToLine(triangle, line, out);\n
    "},{"location":"geom-line/#line-to-line","title":"Line to line","text":"
    • Is intersection
      var isIntersection = Phaser.Geom.Intersects.LineToLine(line1, line2);\n
      • isIntersection : Return true if line1 and line2 are intersectioned
    • Get intersection point
      var isIntersection = Phaser.Geom.Intersects.LineToLine(line1, line2, out);\n
      • isIntersection : Return true if line1 and line2 are intersectioned
      • out : intersected point
    "},{"location":"geom-point/","title":"Point","text":""},{"location":"geom-point/#introduction","title":"Introduction","text":"

    Warning

    The Geom.Point class and all related functions will be removed. All functionality for this can be found in the existing Vector2 math classes. All Geometry classes that currently create and return Point objects will be updated to return Vector2 objects instead.

    Point shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-point/#usage","title":"Usage","text":""},{"location":"geom-point/#create-shape","title":"Create shape","text":"
    var point = new Phaser.Geom.Point(x, y);\n
    "},{"location":"geom-point/#clone-shape","title":"Clone shape","text":"
    var point1 = Phaser.Geom.Point.Clone(point0);\n
    "},{"location":"geom-point/#draw-on-graphics","title":"Draw on graphics","text":"
    // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillPointShape(point, size);\n
    "},{"location":"geom-point/#set-properties","title":"Set properties","text":"
    • All properties
      point.setTo(x, y);\n
      or
      Phaser.Geom.Point.CopyFrom(source, dest);\n
    • Position
      point.x = 0;\npoint.y = 0;\n
    • Round
      • Ceil : Apply Math.ceil() to each coordinate of the given Point
        var point = Phaser.Geom.Point.Ceil(point)\n
      • Floor : Apply Math.floor() to each coordinate of the given Point.
        var point = Phaser.Geom.Point.Floor(point)\n
    "},{"location":"geom-point/#symmetry","title":"Symmetry","text":"
    • Invert : x = y, y = x
      var point = Phaser.Geom.Point.Invert(point);\n
    • Negative : x = -x, y = -y
      var out = Phaser.Geom.Point.Negative(point);\n// var out = Phaser.Geom.Point.Negative(point, out);  // modify out\n
    "},{"location":"geom-point/#get-properties","title":"Get properties","text":"
    • Position
      var x = point.x;\nvar y = point.y;\n
    • Type:
      var type = point.type; // 3\n
    "},{"location":"geom-point/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Point.Equals(point0, point1);\n

    x, y are equal.

    "},{"location":"geom-point/#points","title":"Points","text":"
    • Centroid : center-point over some points
      var out = Phaser.Geom.Point.GetCentroid(points);\n// var out = Phaser.Geom.Point.GetCentroid(points, out);  // modify out\n
    • Calculates the Axis Aligned Bounding Box (or aabb) from an array of points (rectangle)
      var rect = Phaser.Geom.Point.GetRectangleFromPoints(points);\n// var rect = Phaser.Geom.Point.GetRectangleFromPoints(points, rect);  // modify rect\n
    • Interpolate
      var out = Phaser.Geom.Point.Interpolate(pointA, pointB, t);  // out : point\n// var out = Phaser.Geom.Point.Interpolate(pointA, pointB, t, out);  // modify out\n
    "},{"location":"geom-point/#intersection","title":"Intersection","text":"
    • Point to line
      var result = Phaser.Geom.Intersects.PointToLine(point, line);\n// var result = Phaser.Geom.Intersects.PointToLine(point, line, lineThickness);\n
      var result = Phaser.Geom.Intersects.PointToLineSegment(point, line);\n
    "},{"location":"geom-point/#point-as-vector","title":"Point as Vector","text":"

    Vector starting at (0,0)

    • Magnitude : sqrt( (x * x) + (y * y) )
      var magnitude = Phaser.Geom.Point.GetMagnitude(point);\n
      or
      var magnitudeSq = Phaser.Geom.Point.GetMagnitudeSq(point);\n
    • Project
      var out = Phaser.Geom.Point.Project(from, to);\n// var out = Phaser.Geom.Point.Project(from, to, out);  // modify out\n
      or
      var out = Phaser.Geom.Point.ProjectUnit(from, to);  // vector `from` and `to` are unit vector (length = 1)\n// var out = Phaser.Geom.Point.ProjectUnit(from, to, out);  // modify out\n
    "},{"location":"geom-polygon/","title":"Polygon","text":""},{"location":"geom-polygon/#introduction","title":"Introduction","text":"

    Polygon shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-polygon/#usage","title":"Usage","text":""},{"location":"geom-polygon/#create-shape","title":"Create shape","text":"
    var polygon = new Phaser.Geom.Polygon(points);\n
    • points :
      • An array of number : [x0, y0, x1, y1, ...]
      • An array of points : [{x:x0, y:y0}, {x:x1, y:y1}, ...]
      • A string : 'x0 y0 x1 y1 ...'
    "},{"location":"geom-polygon/#clone-shape","title":"Clone shape","text":"
    var polygon1 = Phaser.Geom.Polygon.Clone(polygon0);\n
    "},{"location":"geom-polygon/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillPoints(polygon.points, true);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokePoints(polygon.points, true);\n
    "},{"location":"geom-polygon/#set-properties","title":"Set properties","text":"
    polygon.setTo(points);\n// points = [x0, y0, x1, y1, x2, y2, ...] , or [{x,y}, {x,y}, {x,y}, ...]\n
    "},{"location":"geom-polygon/#get-properties","title":"Get properties","text":"
    • Points
      var points = polygon.points;    // array of points {x,y}\n
    • Area
      var area = polygon.area;\n
    • Number array
      var out = Phaser.Geom.Polygon.GetNumberArray(polygon);\n// var out = Phaser.Geom.Polygon.GetNumberArray(polygon, out);  // modify out\n
      • arr : [x0, y0, x1, y1, x2, y2, ...]
    • AABB (A minimum rectangle to cover this polygon)
      var out = Phaser.Geom.Polygon.GetAABB(polygon);\n// var out = Phaser.Geom.Polygon.GetAABB(polygon, out);\n
      • out : A rectangle object
    • Type:
      var type = polygon.type; // 4\n
    "},{"location":"geom-polygon/#points-shape","title":"Point(s) & shape","text":"
    • Point is inside shape
      var isInside = polygon.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Polygon.ContainsPoint(polygon, point);\n
    • Translate : Shift points.
      Phaser.Geom.Polygon.Translate(polygon, x, y);\n
    • Reverse the order of points.
      var polygon = Phaser.Geom.Polygon.Reverse(polygon);\n
    • Smooth : Takes a Polygon object and applies Chaikin's smoothing algorithm on its points.
      Phaser.Geom.Polygon.Smooth(polygon)\n
    • Simplify : Simplifies the points by running them through a combination of Douglas-Peucker and Radial Distance algorithms. Simplification dramatically reduces the number of points in a polygon while retaining its shape, giving a huge performance boost when processing it and also reducing visual noise.
      var polygon = Phaser.Geom.Polygon.Simplify(polygon);\n// var polygon = Phaser.Geom.Polygon.Simplify(polygon, tolerance, highestQuality);\n
    "},{"location":"geom-polygon/#vector-to-polygon","title":"Vector to polygon","text":"
    • Get closest point of intersection between a vector and an array of polygons
      var result = Phaser.Geom.Intersects.GetLineToPolygon(line, polygons);\n// var out = Phaser.Geom.Intersects.GetLineToPolygon(line, polygons, isRay, out);\n
      • line : Vector of line object
      • polygons : A single polygon, or array of polygons
      • isRay : Is line a ray or a line segment?
      • out :
        • out.x, out.y : Intersection point
        • out.z : Closest intersection distance
        • out.w : Index of the polygon
    • Projects rays out from the given point to each line segment of the polygons.
      var out = Phaser.Geom.Intersects.GetRaysFromPointToPolygon(x, y, polygons);\n
      • x, y : The point to project the rays from.
      • polygons : A single polygon, or array of polygons
      • out : An array containing all intersections
        • out[i].x, out[i].y : Intersection point
        • out[i].z : Angle of intersection
        • out[i].w : Index of the polygon
    "},{"location":"geom-rectangle/","title":"Rectangle","text":""},{"location":"geom-rectangle/#introduction","title":"Introduction","text":"

    Rectangle shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-rectangle/#usage","title":"Usage","text":""},{"location":"geom-rectangle/#create-shape","title":"Create shape","text":"
    var rect = new Phaser.Geom.Rectangle(x, y, width, height);\n
    "},{"location":"geom-rectangle/#create-from-points","title":"Create from points","text":"

    All of the given points are on or within its bounds.

    var rect = Phaser.Geom.Rectangle.FromPoints(points);\n// var rect = Phaser.Geom.Rectangle.FromPoints(points, rect);  // push rect\n
    • points : an array with 4 points. [x, y], or {x:0, y:0}

    or

    var rect = Phaser.Geom.Rectangle.FromXY(x1, y1, x2, y2);\n// var rect = Phaser.Geom.Rectangle.FromXY(x1, y1, x2, y2, rect);  // push rect\n
    "},{"location":"geom-rectangle/#clone-shape","title":"Clone shape","text":"
    var rect1 = Phaser.Geom.Rectangle.Clone(rect0);\n
    "},{"location":"geom-rectangle/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillRectShape(rect);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeRectShape(rect);\n

    Note

    x with positive/negative width is left/right bound y with positive/negative height is top/bottom bound

    "},{"location":"geom-rectangle/#set-properties","title":"Set properties","text":"
    • All properties
      rect.setTo(x, y, width, height);\n
      or
      Phaser.Geom.Rectangle.CopyFrom(source, dest);\n
    • Position
      rect.setPosition(x, y);\n
      or
      rect.x = 0;\nrect.y = 0;\n
      or
      rect.left = 0;       // rect.x, rect.width\nrect.top = 0;        // rect.y, rect.height\n// rect.right = 0;   // rect.x, rect.width\n// rect.bottom = 0;  // rect.y, rect.height\nrect.centerX = 0;    // rect.x\nrect.centerY = 0;    // rect.y\n
      or
      Phaser.Geom.Rectangle.Offset(rect, dx, dy); // rect.x += dx, rect.y += dy\n
      or
      Phaser.Geom.Rectangle.OffsetPoint(rect, point); // rect.x += point.x, rect.y += point.y\n
      or
      Phaser.Geom.Rectangle.CenterOn(rect, x, y);  // rect.x = x - (rect.width / 2), rect.y = y - (rect.height / 2)\n
    • Size
      rect.setSize(width, height);\n// rect.setSize(width);   // height = width\n
      or
      rect.width = 0;\nrect.height = 0;\n
      • Scale
        Phaser.Geom.Rectangle.Scale(rect, x, y); // rect.width *= x, rect.height *= y;\n// Phaser.Geom.Rectangle.Scale(rect, x);   // y = x\n
      • Extend size to include points
        Phaser.Geom.Rectangle.MergePoints(rect, points);\n
        • points : an array of points. [x, y], or {x:0, y:0}
      • Extend size to include another rectangle
        Phaser.Geom.Rectangle.MergeRect(target, source);\n
    • Inflate
      Phaser.Geom.Rectangle.Inflate(rect, x, y);\n
      1. change size to width += x*2, height += y*2
      2. center on previous position
    • Fits the target rectangle into the source rectangle
      Phaser.Geom.Rectangle.FitInside(target, source);\n
      Preserves aspect ratio, scales and centers the target rectangle to the source rectangle
    • Fits the target rectangle around the source rectangle
      Phaser.Geom.Rectangle.FitOutside(target, source);\n
      Preserves aspect ratio, scales and centers the target rectangle to the source rectangle
    • Ceil
      Phaser.Geom.Rectangle.Ceil(rect);  // ceil x, y\n
      Phaser.Geom.Rectangle.CeilAll(rect);  // ceil x, y, width, height\n
    • Floor
      Phaser.Geom.Rectangle.Floor(rect);  // floor x, y\n
      Phaser.Geom.Rectangle.FloorAll(rect);  // floor x, y, width, height\n
    "},{"location":"geom-rectangle/#get-properties","title":"Get properties","text":"
    • Position
      var x = rect.x;\nvar y = rect.y;\n
      • Bound
        var top = rect.top;\nvar left = rect.left;\nvar right = rect.right;\nvar bottom = rect.bottom;\n
        or
        var points = Phaser.Geom.Rectangle.Decompose(rect);\n// var points = Phaser.Geom.Rectangle.Decompose(rect, points); // push result points\n
        • points : top-left, top-right, bottom-right, bottom-left
      • Center
        var centerX = rect.centerX;\nvar centerY = rect.centerY;\n
        or
        var point = Phaser.Geom.Rectangle.GetCenter(rect);\n// var point = Phaser.Geom.Rectangle.GetCenter(rect, point);\n
    • Size
      var width = rect.width;\nvar height = rect.height;\n
      or
      var point = Phaser.Geom.Rectangle.GetSize(rect); // {x: rect.width, y: rect.height}\n
    • Area
      var area = Phaser.Geom.Rectangle.Area(rect);\n
    • Perimeter
      var perimeter = Phaser.Geom.Rectangle.Perimeter(rect);  // 2 * (rect.width + rect.height)\n
    • Aspect ratio
      var aspectRatio = Phaser.Geom.Rectangle.GetAspectRatio(rect);  // rect.width / rect.height\n
    • Lines around rectangle
      var topLine = rect.getLineA();  // top line of this rectangle\nvar rightLine = rect.getLineB();  // right line of this rectangle\nvar bottomLine = rect.getLineC();  // bottom line of this rectangle\nvar leftLine = rect.getLineD();  // left line of this rectangle\n// var out = rect.getLineA(out);  // top line of this rectangle\n
    • Type:
      var type = rect.type; // 5\n
    "},{"location":"geom-rectangle/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = rect.getPoint(t);  // t : 0 ~ 1 (0= top-left, 0.5= bottom-right, 1= top-left)\n// var point = rect.getPoint(t, point);  // modify point\n
      or
      var point = Phaser.Geom.Rectangle.PerimeterPoint(rect, angle);  // angle in degrees\n// var point = Phaser.Geom.Rectangle.PerimeterPoint(rect, angle, point);  // push point\n
    • Get points around shape's edge
      var points = rect.getPoints(quantity);\n// var points = rect.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = rect.getPoints(false, step);\n// var points = rect.getPoints(false, step, points);  // push points\n
      • step : width of each step, in pixels. quantity = Perimeter(rectangle) / step;
      • points : an array of point
    • Point is inside shape
      var isInside = rect.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Rectangle.ContainsPoint(rect, point);\n
    • Get a random point inside shape
      var point = rect.getRandomPoint();\n// var point = rect.getRandomPoint(point);  // modify point\n
    • Get a random point outside shape
      var point = Phaser.Geom.Rectangle.RandomOutside(outer, inner);\n// var point = Phaser.Geom.Rectangle.RandomOutside(outer, inner, point); // modify point\n
    • Rectangle is inside shape
      var isInside = Phaser.Geom.Rectangle.ContainsRect(rectA, rectB);  // rectB is inside rectA\n
    "},{"location":"geom-rectangle/#rectangles","title":"Rectangles","text":"
    • Is overlapping
      var isOverlapping = Phaser.Geom.Rectangle.Overlaps(rectA, rectB);\n
    • Get intersection rectangle
      var rect = Phaser.Geom.Rectangle.Intersection(rectA, rectB);\nvar rect = Phaser.Geom.Rectangle.Intersection(rectA, rectB, rect);  // push rect\n
    • Get union rectangle
      var rect = Phaser.Geom.Rectangle.Union(rectA, rectB);\nvar rect = Phaser.Geom.Rectangle.Union(rectA, rectB, rect);  // push rect\n
    "},{"location":"geom-rectangle/#empty","title":"Empty","text":"
    • Set empty
      rect.setEmpty();     // rect.x = 0, rect.y = 0, rect.width = 0, rect.height = 0\n
    • Is empty
      var isEmpty = rect.isEmpty();   // rect.radius <= 0;\n
    "},{"location":"geom-rectangle/#equal","title":"Equal","text":"
    • Position, width, and height are the same
      var isEqual = Phaser.Geom.Rectangle.Equals(rect0, rect1);\n
    • Width and height are the same
      var isEqual = Phaser.Geom.Rectangle.SameDimensions(rect0, rect1);\n
    "},{"location":"geom-rectangle/#intersection","title":"Intersection","text":""},{"location":"geom-rectangle/#rectangle-to-circle","title":"Rectangle to circle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.CircleToRectangle(circle, rect);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetCircleToRectangle(circle, rect);\n// var out = Phaser.Geom.Intersects.GetCircleToRectangle(circle, rect, out);\n
    "},{"location":"geom-rectangle/#rectangle-to-rectangle","title":"Rectangle to rectangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.RectangleToRectangle(rectA, rectB);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetRectangleToRectangle(rectA, rectB);\n// var out = Phaser.Geom.Intersects.GetRectangleToRectangle(rectA, rectB, out);\n
    "},{"location":"geom-rectangle/#rectangle-to-triangle","title":"Rectangle to triangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.RectangleToTriangle(rect, triangle);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetRectangleToTriangle(rect, triangle);\n// var out = Phaser.Geom.Intersects.GetRectangleToTriangle(rect, triangle, out);\n
    "},{"location":"geom-rectangle/#rectangle-to-line","title":"Rectangle to line","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.LineToRectangle(line, rect);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetLineToRectangle(line, rect);\n// var out = Phaser.Geom.Intersects.GetLineToRectangle(line, rect, out);\n
    "},{"location":"geom-rhombus/","title":"Rhombus","text":""},{"location":"geom-rhombus/#introduction","title":"Introduction","text":"

    Rhombus shape and methods, extends from Polygon geometry object.

    • Author: Rex
    • Geometry object
    "},{"location":"geom-rhombus/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"geom-rhombus/#install-plugin","title":"Install plugin","text":""},{"location":"geom-rhombus/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrhombusplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrhombusplugin.min.js', true);\n
    • Add rhombus geometry object
      var rhombus = scene.plugins.get('rexrhombusplugin').add(x, y, width, height);\n
    "},{"location":"geom-rhombus/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RhombusPlugin from 'phaser3-rex-plugins/plugins/rhombus-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRhombus',\nplugin: RhombusPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add rhombus geometry object
      var rhombus = scene.plugins.get('rexRhombus').add(x, y, width, height);\n
    "},{"location":"geom-rhombus/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Rhombus from 'phaser3-rex-plugins/plugins/rhombus.js';\n
    • Add rhombus geometry object
      var rhombus = new Rhombus(x, y, width, height);\n
    "},{"location":"geom-rhombus/#create-shape","title":"Create shape","text":"

    var rhombus = scene.plugins.get('rexRhombus').add(x, y, width, height);\n
    or
    var rhombus = scene.plugins.get('rexRhombus').add({\nx: 0,\ny: 0,\nwidth: 40,\nheight: 20\n});\n
    or
    var rhombus = new rexRhombus(x, y, width, height);\n// var rhombus = new Phaser.Geom.rexRhombus(x, y, width, height);\n

    • x : Top X.
    • y : Left Y.
    "},{"location":"geom-rhombus/#draw-on-graphics","title":"Draw on graphics","text":"

    See Polygon shape.

    "},{"location":"geom-rhombus/#set-properties","title":"Set properties","text":"
    • All properties
      rhombus.setTo(x, y, width, height);\n
    • Position
      rhombus.setPosition(x, y);\n
      or
      rhombus.x = 0;\nrhombus.y = 0;\n
      or
      rhombus.left = 0;       // rhombus.x\nrhombus.top = 0;        // rhombus.y\nrhombus.right = 0;      // rhombus.x\nrhombus.bottom = 0;     // rhombus.y\n
    • Size
      rhombus.setSize(width, height);\n
      or
      rhombus.width = width;\nrhombus.height = height;\n
    "},{"location":"geom-rhombus/#get-properties","title":"Get properties","text":"

    See Polygon shape.

    • Position
      • Center
        var centerX = rhombus.centerX;\nvar centerY = rhombus.centerY;\n
      • Bound
        var top = rhombus.top;\nvar left = rhombus.left;\nvar right = rhombus.right;\nvar bottom = rhombus.bottom;\n
    • Width
      var width = rhombus.width;\n
    • Height
      var width = rhombus.height;\n
    • Lines around rhombus
      var edge01 = rhombus.getLineA();\nvar edge12 = rhombus.getLineB();\nvar edge23 = rhombus.getLineC();\nvar edge34 = rhombus.getLineD();\n
      or
      var edge = rhombus.getEdge(edgeIdx);\n// var out = rhombus.getEdge(edgeIdx, out);\n
    "},{"location":"geom-rhombus/#points-shape","title":"Point(s) & shape","text":"

    See Polygon shape.

    "},{"location":"geom-triangle/","title":"Triangle","text":""},{"location":"geom-triangle/#introduction","title":"Introduction","text":"

    Triangle shape and methods, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"geom-triangle/#usage","title":"Usage","text":""},{"location":"geom-triangle/#create-shape","title":"Create shape","text":"
    var triangle = new Phaser.Geom.Triangle(x1, y1, x2, y2, x3, y3);\n
    "},{"location":"geom-triangle/#clone-shape","title":"Clone shape","text":"
    var triangle1 = Phaser.Geom.Triangle.Clone(triangle0);\n
    "},{"location":"geom-triangle/#equilateral-triangle","title":"Equilateral triangle","text":"
    var triangle = Phaser.Geom.Triangle.BuildEquilateral(x1, y1, length);\n
    "},{"location":"geom-triangle/#right-triangle","title":"Right triangle","text":"
    var triangle = Phaser.Geom.Triangle.BuildRight(x1, y1, width, height);\n
    "},{"location":"geom-triangle/#polygon-to-triangles","title":"Polygon to triangles","text":"
    var out = Phaser.Geom.Triangle.BuildFromPolygon(data);\n// var out = Phaser.Geom.Triangle.BuildFromPolygon(data, holes, scaleX, scaleY);\n// out = Phaser.Geom.Triangle.BuildFromPolygon(data, holes, scaleX, scaleY, out);\n
    • data : A flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...]
    • out : Array of triangles
    "},{"location":"geom-triangle/#draw-on-graphics","title":"Draw on graphics","text":"
    • Fill shape
      // graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\ngraphics.fillTriangleShape(triangle);\n
    • Stroke shape
      // graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\ngraphics.strokeTriangleShape(triangle);\n
    "},{"location":"geom-triangle/#set-properties","title":"Set properties","text":"
    • All properties
      triangle.setTo(x1, y1, x2, y2, x3, y3);\n
      or
      Phaser.Geom.Triangle.CopyFrom(source, dest);\n
    • Position
      triangle.x1 = 0;\ntriangle.y1 = 0;\ntriangle.x2 = 0;\ntriangle.y2 = 0;\ntriangle.x3 = 0;\ntriangle.y3 = 0;\n
      or
      triangle.left = 0;       // triangle.x1, triangle.x2, triangle.x3\ntriangle.top = 0;        // triangle.y1, triangle.y2, triangle.y3\n// triangle.right = 0;   // triangle.x1, triangle.x2, triangle.x3\n// triangle.bottom = 0;  // triangle.y1, triangle.y2, triangle.y3\n
      or
      Phaser.Geom.Triangle.Offset(triangle, dx, dy); // triangle.x += dx, triangle.y += dy\n
      or
      Phaser.Geom.Triangle.CenterOn(triangle, x, y);\n
    • Rotate
      • Rotate around center (incenter)
        var triangle = Phaser.Geom.Triangle.Rotate(triangle, angle);\n
        • angle : Radian
      • Rotate around point
        var triangle = Phaser.Geom.Triangle.RotateAroundPoint(triangle, point, angle);\n
        • point : {x, y}
        • angle : Radian
      • Rotate around (x,y)
        var triangle = Phaser.Geom.Triangle.RotateAroundXY(triangle, x, y, angle);\n
        • angle : Radian
    "},{"location":"geom-triangle/#get-properties","title":"Get properties","text":"
    • Position
      var x1 = triangle.x1;\nvar y1 = triangle.y1;\nvar x2 = triangle.x2;\nvar y2 = triangle.y2;\nvar x3 = triangle.x3;\nvar y3 = triangle.y3;\nvar top = triangle.top;\nvar left = triangle.left;\nvar right = triangle.right;\nvar bottom = triangle.bottom;\n
      or
      var out = Phaser.Geom.Triangle.Decompose(triangle);  // out: [{x1,y1}, {x2,y2}, {x3,y3}]\n// var out = Phaser.Geom.Triangle.Decompose(triangle, out);\n
    • Perimeter
      var perimeter = Phaser.Geom.Triangle.Perimeter(triangle);\n
    • Area
      var area = Phaser.Geom.Triangle.Area(triangle);\n
    • Lines around triangle
      var line12 = rect.getLineA();     // line from (x1, y1) to (x2, y2)\nvar line23 = rect.getLineB();     // line from (x2, y2) to (x3, y3)\nvar line31 = rect.getLineC();     // line from (x3, y3) to (x1, y1)\n
    • Centroid
      var out = Phaser.Geom.Triangle.Centroid(triangle);  // out: {x,y}\n
    • Incenter
      var out = Phaser.Geom.Triangle.InCenter(triangle);  // out: {x,y}\n// var out = Phaser.Geom.Triangle.InCenter(triangle, out);\n
    • Circumcenter
      var out = Phaser.Geom.Triangle.CircumCenter(triangle);  // out: {x,y}\n// var out = Phaser.Geom.Triangle.CircumCenter(triangle, out);\n
    • Circumcircle
      var out = Phaser.Geom.Triangle.CircumCircle(triangle);  // out: a circle object\n// var out = Phaser.Geom.Triangle.CircumCircle(triangle, out);\n
    • Type:
      var type = triangle.type; // 6\n
    "},{"location":"geom-triangle/#points-shape","title":"Point(s) & shape","text":"
    • Get point at shape's edge
      var point = triangle.getPoint(t);  // t : 0 ~ 1 (angle/360)\n// var point = triangle.getPoint(t, point);  // modify point\n
    • Get a random point inside shape
      var point = triangle.getRandomPoint();\n// var point = triangle.getRandomPoint(point);  // modify point\n
    • Get points around shape's edge
      var points = triangle.getPoints(quantity);\n// var points = triangle.getPoints(quantity, null, points);  // push points\n
      or calculate quantity from steps
      var points = triangle.getPoints(false, step);\n// var points = triangle.getPoints(false, step, points);  // push points\n
      • points : an array of point
    • Point is inside shape
      var isInside = triangle.contains(x, y);\n
      or
      var isInside = Phaser.Geom.Triangle.ContainsPoint(triangle, point);\n
      • Points inside shape
        var out = Phaser.Geom.Triangle.ContainsArray(triangle, points, returnFirst);\n// var out = Phaser.Geom.Triangle.ContainsArray(triangle, points, returnFirst, out);\n
        • out : Points inside triangle
        • returnFirst : True to get fist matched point
    "},{"location":"geom-triangle/#equal","title":"Equal","text":"
    var isEqual = Phaser.Geom.Triangle.Equals(triangle0, triangle1);\n

    Position and radius are equal.

    "},{"location":"geom-triangle/#intersection","title":"Intersection","text":""},{"location":"geom-triangle/#triangle-to-circle","title":"Triangle to circle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToCircle(triangle, circle);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToCircle(triangle, circle);\n// var out = Phaser.Geom.Intersects.GetTriangleToCircle(triangle, circle, out);\n
    "},{"location":"geom-triangle/#triangle-to-rectangle","title":"Triangle to rectangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.RectangleToTriangle(rect, triangle);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetRectangleToTriangle(rect, triangle);\n// var out = Phaser.Geom.Intersects.GetRectangleToTriangle(rect, triangle, out);\n
    "},{"location":"geom-triangle/#triangle-to-triangle","title":"Triangle to triangle","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToTriangle(triangleA, triangleB);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToTriangle(triangleA, triangleB);\n// var out = Phaser.Geom.Intersects.GetTriangleToTriangle(triangleA, triangleB, out);\n
    "},{"location":"geom-triangle/#triangle-to-line","title":"Triangle to line","text":"
    • Is intersection
      var result = Phaser.Geom.Intersects.TriangleToLine(triangle, line);\n
    • Get intersection points
      var result = Phaser.Geom.Intersects.GetTriangleToLine(triangle, line);\n// var out = Phaser.Geom.Intersects.GetTriangleToLine(triangle, line, out);\n
    "},{"location":"gesture-overview/","title":"Overview","text":""},{"location":"gesture-overview/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-overview/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Object factories : scene.rexGestures.add.xxx(config)
    "},{"location":"gesture-overview/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Object factories : scene.rexGestures.add.xxx(config)
    "},{"location":"gesture-overview/#list-of-gesture-plugins","title":"List of gesture plugins","text":""},{"location":"gesture-overview/#one-pointer-gesture","title":"One pointer gesture","text":"
    • Tap
    • Press
    • Swipe
    • Pan
    "},{"location":"gesture-overview/#two-pointers-gesture","title":"Two pointers gesture","text":"
    • Pinch
    • Rotate
    "},{"location":"gesture-pan/","title":"Pan","text":""},{"location":"gesture-pan/#introduction","title":"Introduction","text":"

    Get pan events of a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"gesture-pan/#live-demos","title":"Live demos","text":"
    • Camera scroll
    • Pan & rotate
    "},{"location":"gesture-pan/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-pan/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-pan/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add pan input
      var pan = scene.rexGestures.add.pan(config);\n// var pan = scene.rexGestures.add.pan(gameObject, config);\n
    "},{"location":"gesture-pan/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add pan input
      var pan = scene.rexGestures.add.pan(config);\n// var pan = scene.rexGestures.add.pan(gameObject, config);\n
    "},{"location":"gesture-pan/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Pan } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add pan input
      var pan = new Pan(scene, config);\n// var pan = new Pan(gameObject, config);\n
    "},{"location":"gesture-pan/#create-instance","title":"Create instance","text":"
    • Pan input
      var pan = scene.rexGestures.add.pan({\n// enable: true,\n// bounds: undefined,\n\n// threshold: 10,\n});\n
      • enable : Set false to disable input events.
      • bounds : Touch detecting area rectangle, if game obect is not given.
        • undefined : Ignore this feature, default behavior.
      • threshold : Minimal movement when pointer is down.
    • Pan behavior of game object
      var pan = scene.rexGestures.add.pan(gameObject, {\n// enable: true,\n\n// threshold: 10,\n});\n
    "},{"location":"gesture-pan/#enable","title":"Enable","text":"
    • Get
      var enable = pan.enable;  // enable: true, or false\n
    • Set
      pan.setEnable(enable);  // enable: true, or false\n// pan.enable = enable;\n
    • Toggle
      pan.toggleEnable();\n
    "},{"location":"gesture-pan/#events","title":"Events","text":""},{"location":"gesture-pan/#pan","title":"Pan","text":"
    pan.on('pan', function(pan, gameObject, lastPointer){\n}, scope);\n
    • pan.dx, pan.dy : Vector from previous pointer to current pointer.
    • pan.dWorldX, pan.dWorld : Vector from previous pointer to current pointer, in world position. i.e, including camera-zoom.
    • pan.worldX, pan.worldY : World position of current pointer.
    • pan.x, pan.y : Scene position of current pointer.
    • gameObject, pan.gameObject : Parent gameobject of this pan behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-pan/#pan-start","title":"Pan start","text":"
    pan.on('panstart', function(pan, gameObject, lastPointer){\n}, scope);\n
    • pan.startWorldX, pan.startWorldY : World position of pan-start pointer.
    • pan.startX, pan.startY : Scene position of pan-start pointer.
    • gameObject, pan.gameObject : Parent gameobject of this pan behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-pan/#pan-end","title":"Pan end","text":"
    pan.on('panend', function(pan, gameObject, lastPointer){\n}, scope);\n
    • pan.endWorldX, pan.endWorldY : World position of pan-end pointer.
    • pan.endX, pan.endY : Scene position of pan-end pointer.
    • gameObject, pan.gameObject : Parent gameobject of this pan behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-pan/#is-panned","title":"Is panned","text":"
    var isPanned = pan.isPanned;\n

    Return true if panned.

    "},{"location":"gesture-pan/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any pan event,

    pan.on('panend', function(pan){\nvar isPointerInsideGameObject = pan.isPointerInGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-pan/#other-properties","title":"Other properties","text":"
    • Drag threshold
      • Get
        var dragThreshold = pan.dragThreshold;\n
      • Set
        pan.setDragThreshold(dragThreshold);\n// pan.dragThreshold = dragThreshold;\n
    • Detect bounds
      • Get
        var bounds = pan.bounds;\n
      • Set
        pan.setDetectBounds(bounds);\n// pan.bounds = bounds;\n
    "},{"location":"gesture-pinch/","title":"Pinch","text":""},{"location":"gesture-pinch/#introduction","title":"Introduction","text":"

    Get scale factor from 2 dragging touch pointers.

    • Author: Rex
    • Member of scene
    "},{"location":"gesture-pinch/#live-demos","title":"Live demos","text":"

    Pinch-zoom

    "},{"location":"gesture-pinch/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-pinch/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-pinch/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add pinch input
      var pinch = scene.rexGestures.add.pinch(config);\n// var pinch = scene.rexGestures.add.pinch(gameObject, config);\n
    "},{"location":"gesture-pinch/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add pinch input
      var pinch = scene.rexGestures.add.pinch(config);\n// var pinch = scene.rexGestures.add.pinch(gameObject, config);\n
    "},{"location":"gesture-pinch/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Pinch } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add pinch input
      var pinch = new Pinch(scene, config);\n// var pinch = new Pinch(gameObject, config);\n
    "},{"location":"gesture-pinch/#create-instance","title":"Create instance","text":"
    • Pinch input
      var pinch = scene.rexGestures.add.pinch({\n// enable: true,\n// bounds: undefined,\n\n// threshold: 0,\n});\n
      • enable : Set false to disable input events.
      • bounds : A rectangle object or undefined (to use game window as rectangle object), for detecting the position of cursor.
      • threshold : Fire pinch events after dragging distances of catched pointers are larger than this threshold.
    • Pinch behavior of game object
      var pan = scene.rexGestures.add.pinch(gameObject, {\n// enable: true,\n// bounds: undefined,\n\n// threshold: 0,\n});\n
      • Start pinching when pointer-down on this game object.
    "},{"location":"gesture-pinch/#enable","title":"Enable","text":"
    • Get
      var enable = pinch.enable;  // enable: true, or false\n
    • Set
      pinch.setEnable(enable);  // enable: true, or false\n// pinch.enable = enable;\n
    • Toggle
      pinch.toggleEnable();\n
    "},{"location":"gesture-pinch/#events","title":"Events","text":""},{"location":"gesture-pinch/#on-dragging","title":"On dragging","text":"
    • On dragging 1st touch pointer, fired when 1st touch pointer is moving
      pinch.on('drag1', function(pinch) {\n// var drag1Vector = pinch.drag1Vector; // drag1Vector: {x, y}\n}, scope);\n
      • pinch.drag1Vector : Drag vector from prevoius touch position to current touch position of 1st catched touch pointer.
    • On dragging 2 touch pointers, fired when any catched touch pointer moved.
      pinch.on('pinch', function(pinch) {\n// var scaleFactor = pinch.scaleFactor;\n// gameObject.scaleX *= scaleFactor;\n// gameObject.scaleY *= scaleFactor;\n}, scope);\n
      • pinch.scaleFactor : Rate of distance change between 2 catched touch pointers.
    "},{"location":"gesture-pinch/#on-drag-start-on-drag-end","title":"On drag start, on drag end","text":"
    • On drag 1 touch pointer start, fired when catching 1st touch pointer.
      pinch.on('drag1start', function(pinch) {\n\n}, scope);\n
    • On drag 1 touch pointer end, fired when releasing the last one catched touch pointer.
      pinch.on('drag1end', function(pinch) {\n\n}, scope);\n
    • On drag 2 touch pointers start, fired when catching 2 touch pointers.
      pinch.on('pinchstart', function(pinch) {\n\n}, scope);\n
    • On drag 2 touch pointers end, fired when releasing any catched touch pointer.
      pinch.on('pinchend', function(pinch) {\n\n}, scope);\n
    "},{"location":"gesture-pinch/#scale-factor","title":"Scale factor","text":"
    var scaleFactor = pinch.scaleFactor;\n

    Rate of distance change between 2 catched touch pointers. (i.e current distance between 2 catched touch pointers / previous distance ).

    "},{"location":"gesture-pinch/#drag-vector-of-1st-touch-pointer","title":"Drag vector of 1st touch pointer","text":"
    var drag1Vector = pinch.drag1Vector; // {x, y}\n
    "},{"location":"gesture-pinch/#catched-touch-pointers","title":"Catched touch pointers","text":"
    • Pointer 0, available when state is 1
      var pointer0 = pinch.pointers[0];\n
      • Position of pointer
        var x = pointer0.x;\nvar y = pointer0.y;\nvar worldX = pointer0.worldX;\nvar worldY = pointer0.worldY;\n
    • Pointer 1, available when state is 2
      var pointer1 = pinch.pointers[1];\n
    "},{"location":"gesture-pinch/#is-pinched","title":"Is pinched","text":"
    var isPinched = pinch.isPinched;\n

    Return true if pinched.

    "},{"location":"gesture-pinch/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any pinch event,

    pinch.on('pinch', function(pinch) {\nvar isPointer0InsideGameObject = pinch.isPointer0InGameObject(anotherGameObject);\nvar isPointer1InsideGameObject = pinch.isPointer1InGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-pinch/#other-properties","title":"Other properties","text":"
    • Drag threshold
      • Get
        var dragThreshold = pinch.dragThreshold;\n
      • Set
        pinch.setDragThreshold(dragThreshold);\n// pinch.dragThreshold = dragThreshold;\n
    • Detect bounds
      • Get
        var bounds = pinch.bounds;\n
      • Set
        pinch.setDetectBounds(bounds);\n// pinch.bounds = bounds;\n
    "},{"location":"gesture-press/","title":"Press","text":""},{"location":"gesture-press/#introduction","title":"Introduction","text":"

    Get press events of a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"gesture-press/#live-demos","title":"Live demos","text":"
    • Press object
    "},{"location":"gesture-press/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-press/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-press/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add press input
      var press = scene.rexGestures.add.press(config);\n// var press = scene.rexGestures.add.press(gameObject, config);\n
    "},{"location":"gesture-press/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add press input
      var press = scene.rexGestures.add.press(config);\n// var press = scene.rexGestures.add.press(gameObject, config);\n
    "},{"location":"gesture-press/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Press } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add press input
      var press = new Press(scene, config);\n// var press = new Press(gameObject, config);\n
    "},{"location":"gesture-press/#create-instance","title":"Create instance","text":"
    • Press input
      var press = scene.rexGestures.add.press({\n// enable: true,\n// bounds: undefined,\n\n// time: 251,\n// threshold: 9,\n});\n
      • enable : Set false to disable input events.
      • bounds : Touch detecting area rectangle, if game obect is not given.
        • undefined : Ignore this feature, default behavior.
      • time : Minimal time of the pointer to be pressed.
      • threshold : Minimal movement when pointer is down.
    • Press behavior of game object
      var press = scene.rexGestures.add.press(gameObject, {\n// enable: true,\n\n// time: 251,\n// threshold: 9,\n});\n
    "},{"location":"gesture-press/#enable","title":"Enable","text":"
    • Get
      var enable = press.enable;  // enable: true, or false\n
    • Set
      press.setEnable(enable);  // enable: true, or false\n// press.enable = enable;\n
    • Toggle
      press.toggleEnable();\n
    "},{"location":"gesture-press/#events","title":"Events","text":""},{"location":"gesture-press/#pressing-start","title":"Pressing start","text":"
    press.on('pressstart', function(press, gameObject, lastPointer){\n}, scope);\n
    • press.gameObject : Parent gameobject of this press behavior.
    • press.worldX, press.worldY : World position of pressing start.
    • press.x, press.y : Scene position of pressing start.
    • gameObject, press.gameObject : Parent gameobject of this press behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-press/#pressing-end","title":"Pressing end","text":"
    press.on('pressend', function(press, gameObject, lastPointer){\n}, scope);\n
    "},{"location":"gesture-press/#is-pressed","title":"Is pressed","text":"
    var isPressed = press.isPressed;\n

    Return true if pressed.

    "},{"location":"gesture-press/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any press event,

    press.on('pressstart', function(press){\nvar isPointerInsideGameObject = press.isPointerInGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-press/#other-properties","title":"Other properties","text":"
    • Hold time
      • Get
        var holdTime = press.holdTime;\n
      • Set
        press.setHoldTime(holdTime);\n// press.holdTime = holdTime;\n
    • Drag threshold
      • Get
        var dragThreshold = press.dragThreshold;\n
      • Set
        press.setDragThreshold(dragThreshold);\n// press.dragThreshold = dragThreshold;\n
    • Detect bounds
      • Get
        var bounds = press.bounds;\n
      • Set
        press.setDetectBounds(bounds);\n// press.bounds = bounds;\n
    "},{"location":"gesture-rotate/","title":"Rotate","text":""},{"location":"gesture-rotate/#introduction","title":"Introduction","text":"

    Get spin angle from 2 dragging touch pointers.

    • Author: Rex
    • Member of scene
    "},{"location":"gesture-rotate/#live-demos","title":"Live demos","text":"
    • Rotate & rotate
    "},{"location":"gesture-rotate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-rotate/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-rotate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add rotate input
      var rotate = scene.rexGestures.add.rotate(config);\n// var rotate = scene.rexGestures.add.rotate(gameObject, config);\n
    "},{"location":"gesture-rotate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add rotate input
      var rotate = scene.rexGestures.add.rotate(config);\n// var rotate = scene.rexGestures.add.rotate(gameObject, config);\n
    "},{"location":"gesture-rotate/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Rotate } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add rotate input
      var rotate = new Rotate(scene, config);\n// var rotate = new Rotate(gameObject, config);\n
    "},{"location":"gesture-rotate/#create-instance","title":"Create instance","text":"
    • Rotate input
      var rotate = scene.rexGestures.add.rotate({\n// enable: true,\n// bounds: undefined,\n\n// threshold: 0,\n});\n
      • enable : Set false to disable input events.
      • bounds : A rectangle object or undefined (to use game window as rectangle object), for detecting the position of cursor.
      • threshold : Fire rotate events after dragging distances of catched pointers are larger than this threshold.
    • Rotate behavior of game object
      var rotate = scene.rexGestures.add.rotate(gameObject, {\n// enable: true,\n// bounds: undefined,\n\n// threshold: 0,\n});\n
      • Start rotation when pointer-down on this game object.
    "},{"location":"gesture-rotate/#enable","title":"Enable","text":"
    • Get
      var enable = rotate.enable;  // enable: true, or false\n
    • Set
      rotate.setEnable(enable);  // enable: true, or false\n// rotate.enable = enable;\n
    • Toggle
      rotate.toggleEnable();\n
    "},{"location":"gesture-rotate/#events","title":"Events","text":""},{"location":"gesture-rotate/#on-dragging","title":"On dragging","text":"
    • On dragging 1st touch pointer, fired when 1st touch pointer is moving
      rotate.on('drag1', function(rotate) {\n// var drag1Vector = rotate.drag1Vector; // drag1Vector: {x, y}\n}, scope);\n
      • rotate.drag1Vector : Drag vector from prevoius touch position to current touch position of 1st catched touch pointer.
    • On dragging 2 touch pointers, fired when any catched touch pointer moved.
      rotate.on('rotate', function(rotate) {\n// rotate.spinObject(gameObejects);\n// var angle = rotate.rotation;\n}, scope);\n
      • rotate.spinObject(gameObejects) : Drag and spin an array of game object, or a game object around current center of 2 dragging pointers.
      • rotate.rotation : Return spin angle of 2 dragging pointers, in radius.
    "},{"location":"gesture-rotate/#on-drag-start-on-drag-end","title":"On drag start, on drag end","text":"
    • On drag 1 touch pointer start, fired when catching 1st touch pointer.
      rotate.on('drag1start', function(rotate) {\n\n}, scope);\n
    • On drag 1 touch pointer end, fired when releasing the last one catched touch pointer.
      rotate.on('drag1end', function(rotate) {\n\n}, scope);\n
    • On drag 2 touch pointers start, fired when catching 2 touch pointers.
      rotate.on('rotatestart', function(rotate) {\n\n}, scope);\n
    • On drag 2 touch pointers end, fired when releasing any catched touch pointer.
      rotate.on('rotateend', function(rotate) {\n\n}, scope);\n
    "},{"location":"gesture-rotate/#spin-game-object","title":"Spin game object","text":"
    rotate.spinObject(gameObejects);\n

    Drag and spin game objects around current center of 2 dragging pointers. Uses this function under 'rotate' event.

    • gameObejects : An array of game object, or a game object.
    "},{"location":"gesture-rotate/#spin-angle","title":"Spin angle","text":"
    var angle = rotate.rotation;\n

    Spin angle of 2 dragging pointers, in radius.

    "},{"location":"gesture-rotate/#drag-vector-of-1st-touch-pointer","title":"Drag vector of 1st touch pointer","text":"
    var drag1Vector = rotate.drag1Vector; // {x, y}\n
    "},{"location":"gesture-rotate/#catched-touch-pointers","title":"Catched touch pointers","text":"
    • Pointer 0, available when state is 1
      var pointer0 = rotate.pointers[0];\n
      • Position of pointer
        var x = pointer0.x;\nvar y = pointer0.y;\nvar worldX = pointer0.worldX;\nvar worldY = pointer0.worldY;\n
    • Pointer 1, available when state is 2
      var pointer0 = rotate.pointers[1];\n
    "},{"location":"gesture-rotate/#is-rotated","title":"Is rotated","text":"
    var isRotated = rotate.isRotated;\n

    Return true if pinched.

    "},{"location":"gesture-rotate/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any rotate event,

    rotate.on('rotate', function(rotate) {\nvar isPointer0InsideGameObject = rotate.isPointer0InGameObject(anotherGameObject);\nvar isPointer1InsideGameObject = rotate.isPointer1InGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-rotate/#other-properties","title":"Other properties","text":"
    • Drag threshold
      • Get
        var dragThreshold = rotate.dragThreshold;\n
      • Set
        rotate.setDragThreshold(dragThreshold);\n// rotate.dragThreshold = dragThreshold;\n
    • Detect bounds
      • Get
        var bounds = rotate.bounds;\n
      • Set
        rotate.setDetectBounds(bounds);\n// rotate.bounds = bounds;\n
    "},{"location":"gesture-swipe/","title":"Swipe","text":""},{"location":"gesture-swipe/#introduction","title":"Introduction","text":"

    Get swipe events of a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"gesture-swipe/#live-demos","title":"Live demos","text":"
    • Swipe
    "},{"location":"gesture-swipe/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-swipe/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-swipe/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add swipe input
      var swipe = scene.rexGestures.add.swipe(config);\n// var swipe = scene.rexGestures.add.swipe(gameObject, config);\n
    "},{"location":"gesture-swipe/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add swipe input
      var swipe = scene.rexGestures.add.swipe(config);\n// var swipe = scene.rexGestures.add.swipe(gameObject, config);\n
    "},{"location":"gesture-swipe/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Swipe } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add swipe input
      var swipe = new Swipe(scene, config);\n// var swipe = new Swipe(gameObject, config);\n
    "},{"location":"gesture-swipe/#create-instance","title":"Create instance","text":"
    • Swipe input
      var swipe = scene.rexGestures.add.swipe({\n// enable: true,\n// bounds: undefined,\n\n// threshold: 10,\n// velocityThreshold: 1000,\n// dir: '8dir',\n});\n
      • enable : Set false to disable input events.
      • bounds : Touch detecting area rectangle, if game obect is not given.
        • undefined : Ignore this feature, default behavior.
      • time : Max time of the pointer to be down.
      • threshold : Minimal movement when pointer is down.
      • velocityThreshold : Minimal dragging speed.
      • dir :
        • 'up&down', or 0 : Get up or down state only.
        • 'left&right', or 1 : Get left or right state only.
        • '4dir', or 2 : Get up, down, left or right state.
        • '8dir', or 3 : Get up, up/left, up/right, down, down/left, down/right, left, or right state.
    • Swipe behavior of game object
      var swipe = scene.rexGestures.add.swipe(gameObject, {\n// enable: true,\n\n// threshold: 10,\n// velocityThreshold: 1000,\n// direction: '8dir',\n});\n
    "},{"location":"gesture-swipe/#enable","title":"Enable","text":"
    • Get
      var enable = swipe.enable;  // enable: true, or false\n
    • Set
      swipe.setEnable(enable);  // enable: true, or false\n// swipe.enable = enable;\n
    • Toggle
      swipe.toggleEnable();\n
    "},{"location":"gesture-swipe/#events","title":"Events","text":""},{"location":"gesture-swipe/#swipe","title":"Swipe","text":"
    swipe.on('swipe', function(swipe, gameObject, lastPointer){\n}, scope);\n
    • swipe.left, swipe.right, swipe.up, swipe.down : Swipe direction states.
    • swipe.worldX, swipe.worldY : World position of swiping start.
    • swipe.x, swipe.y : Scene position of swiping start.
    • swipe.dragVelocity : Velocity of dragging.
    • gameObject, swipe.gameObject : Parent gameobject of this pan behavior.
    • lastPointer : Last touch pointer.
    "},{"location":"gesture-swipe/#is-swiped","title":"Is swiped","text":"
    var isSwiped = swipe.isSwiped;\n

    Return true if panning.

    "},{"location":"gesture-swipe/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any swipe event,

    swipe.on('swipe', function(swipe){\nvar isPointerInsideGameObject = swipe.isPointerInGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-swipe/#other-properties","title":"Other properties","text":"
    • Drag threshold
      • Get
        var dragThreshold = swipe.dragThreshold;\n
      • Set
        swipe.setDragThreshold(dragThreshold);\n// swipe.dragThreshold = dragThreshold;\n
    • Velocity threshold
      • Get
        var velocityThreshold = swipe.velocityThreshold;\n
      • Set
        swipe.setVelocityThreshold(velocityThreshold);\n// swipe.velocityThreshold = velocityThreshold;\n
    • Direction mode
      • Get
        var dirMode = swipe.dirMode;  // 0,1,2,3\n
      • Set
        swipe.setDirectionMode(dirMode);  // 0,1,2,3,'up&down','left&right','4dir','8dir'\n// swipe.dirMode = dirMode;  // 0,1,2,3\n
    • Detect bounds
      • Get
        var bounds = swipe.bounds;\n
      • Set
        swipe.setDetectBounds(bounds);\n// swipe.bounds = bounds;\n
    "},{"location":"gesture-tap/","title":"Tap","text":""},{"location":"gesture-tap/#introduction","title":"Introduction","text":"

    Get tap/multi-taps events of a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"gesture-tap/#live-demos","title":"Live demos","text":"
    • Tap object
    "},{"location":"gesture-tap/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gesture-tap/#install-plugin","title":"Install plugin","text":""},{"location":"gesture-tap/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexgesturesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgesturesplugin.min.js', 'rexGestures', 'rexGestures');\n
    • Add tap input
      var tap = scene.rexGestures.add.tap(config);\n// var tap = scene.rexGestures.add.tap(gameObject, config);\n
    "},{"location":"gesture-tap/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GesturesPlugin from 'phaser3-rex-plugins/plugins/gestures-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexGestures',\nplugin: GesturesPlugin,\nmapping: 'rexGestures'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tap input
      var tap = scene.rexGestures.add.tap(config);\n// var tap = scene.rexGestures.add.tap(gameObject, config);\n
    "},{"location":"gesture-tap/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Tap } from 'phaser3-rex-plugins/plugins/gestures.js';\n
    • Add tap input
      var tap = new Tap(scene, config);\n// var tap = new Tap(gameObject, config);\n
    "},{"location":"gesture-tap/#create-instance","title":"Create instance","text":"
    • Tap input
      var tap = scene.rexGestures.add.tap({\n// enable: true,\n// bounds: undefined,\n\n// time: 250,\n// tapInterval: 200,\n// threshold: 9,\n// tapOffset: 10,\n\n// taps: undefined,\n// minTaps: undefined,\n// maxTaps: undefined,\n});\n
      • enable : Set false to disable input events.
      • bounds : Touch detecting area rectangle, if game obect is not given.
        • undefined : Ignore this feature, default behavior.
      • time : Max time of the pointer to be down.
      • tapInterval : Max time between the multi-tap taps.
      • threshold : Minimal movement when pointer is down.
      • tapOffset : A multi-tap can be a bit off the initial position.
      • taps : Fire tap event only when taps count reaches this value.
        • undefined : Fire tap event only when tapped end. i.e pointer-up time exceeds tapInterval.
      • minTaps : Fire tap event only when taps count is larger than this value.
        • undefined : Don't check taps count.
      • maxTaps : Fire tap event only when taps count is less than this value.
        • undefined : Don't check taps count.
    • Tap behavior of game object
      var tap = scene.rexGestures.add.tap(gameObject, {\n// enable: true,\n\n// time: 250,\n// tapInterval: 200,\n// threshold: 9,\n// tapOffset: 10,\n\n// taps: undefined,\n// minTaps: undefined,\n// maxTaps: undefined,\n});\n
    "},{"location":"gesture-tap/#enable","title":"Enable","text":"
    • Get
      var enable = tap.enable;  // enable: true, or false\n
    • Set
      tap.setEnable(enable);  // enable: true, or false\n// tap.enable = enable;\n
    • Toggle
      tap.toggleEnable();\n
    "},{"location":"gesture-tap/#events","title":"Events","text":""},{"location":"gesture-tap/#tap","title":"Tap","text":"
    tap.on('tap', function(tap, gameObject, lastPointer){\n}, scope);\n
    • tap.tapsCount : Taps count.
    • gameObject, tap.gameObject : Parent gameobject of this tap behavior.
    • tap.worldX, tap.worldY : World position of first tapping.
    • tap.x, tap.y : Scene position of first tapping.
    • lastPointer : Last touch pointer.
    tap.on(tapsCount + 'tap', function(tap, gameObject, lastPointer){\n}, scope);\n
    • tapsCount + 'tap' : 1tap, 2tap, 3tap, etc ...
    "},{"location":"gesture-tap/#tapping-start","title":"Tapping start","text":"

    Each pointer-down will increase taps count and fire tappingstart event.

    tap.on('tappingstart', function(tap, gameObject, lastPointer){\n}, scope);\n
    "},{"location":"gesture-tap/#is-tapped","title":"Is tapped","text":"
    var isTapped = tap.isTapped;\n

    Return true if tapped end.

    "},{"location":"gesture-tap/#is-pointer-inside-another-game-object","title":"Is pointer inside another game object","text":"

    Under any tap event,

    tap.on('tap', function(tap){\nvar isPointerInsideGameObject = tap.isPointerInGameObject(anotherGameObject);\n});\n
    "},{"location":"gesture-tap/#other-properties","title":"Other properties","text":"
    • Hold time
      • Get
        var holdTime = tap.holdTime;\n
      • Set
        tap.setHoldTime(holdTime);\n// tap.holdTime = holdTime;\n
    • Tap interval
      • Get
        var tapInterval = tap.tapInterval;\n
      • Set
        tap.setTapInterval(tapInterval);\n// tap.tapInterval = tapInterval;\n
    • Drag threshold
      • Get
        var dragThreshold = tap.dragThreshold;\n
      • Set
        tap.setDragThreshold(dragThreshold);\n// tap.dragThreshold = dragThreshold;\n
    • Tap offset
      • Get
        var tapOffset = tap.tapOffset;\n
      • Set
        tap.setTapOffset(tapOffset);\n// tap.tapOffset = tapOffset;\n
    • Max taps
      • Get
        var maxTaps = tap.maxTaps;\n
      • Set
        tap.setMaxTaps(maxTaps);\n// tap.maxTaps = maxTaps;\n
    • Min taps
      • Get
        var minTaps = tap.minTaps;\n
      • Set
        tap.setMinTaps(minTaps);\n// tap.minTaps = minTaps;\n
    • Taps
      taps.setTaps(taps);\n// taps.setTaps(minTaps, maxTaps);\n
    • Detect bounds
      • Get
        var bounds = taps.bounds;\n
      • Set
        taps.setDetectBounds(bounds);\n// taps.bounds = bounds;\n
    "},{"location":"graphics/","title":"Graphics","text":""},{"location":"graphics/#introduction","title":"Introduction","text":"

    Drawing on webgl or canvas, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"graphics/#usage","title":"Usage","text":""},{"location":"graphics/#add-graphics-object","title":"Add graphics object","text":"
    var graphics = scene.add.graphics();\n

    or

    var graphics = scene.add.graphics({\nx: 0,\ny: 0,\n\n// lineStyle: {\n//     width: 1,\n//     color: 0xffffff,\n//     alpha: 1\n// },\n// fillStyle: {\n//     color: 0xffffff,\n//     alpha: 1\n// },\n\nadd: true\n});\n
    "},{"location":"graphics/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGraphics extends Phaser.GameObjects.Graphics {\nconstructor(scene, options) {\nsuper(scene, options);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var graphics = new MyGraphics(scene, options);\n
    "},{"location":"graphics/#drawing-commands","title":"Drawing commands","text":""},{"location":"graphics/#set-style","title":"Set style","text":"
    • Set default line style and fill style
      graphics.setDefaultStyles({\nlineStyle: {\nwidth: 1,\ncolor: 0xffffff,\nalpha: 1\n},\nfillStyle: {\ncolor: 0xffffff,\nalpha: 1\n}\n});\n
    • Set line style
      graphics.lineStyle(lineWidth, color, alpha);   // color: 0xRRGGBB\n
    • Set fill style
      • Fill color
        graphics.fillStyle(color, alpha);   // color: 0xRRGGBB\n
      • Fill gradient color (WebGL only)
        graphics.fillGradientStyle(topLeft, topRight, bottomLeft, bottomRight, alpha);  // alpha= 1\n// graphics.fillGradientStyle(topLeft, topRight, bottomLeft, bottomRight, alphaTopLeft, alphaTopRight, alphaBottomLeft, alphaBottomRight);\n
        • topLeft : The tint being applied to the top-left of the Game Object.
        • topRight : The tint being applied to the top-right of the Game Object.
        • bottomLeft : The tint being applied to the bottom-left of the Game Object.
        • bottomRight : The tint being applied to the bottom-right of the Game Object.
        • alphaTopLeft : The top left alpha value.
        • alphaTopRight : The top right alpha value.
        • alphaBottomLeft : The bottom left alpha value.
        • alphaBottomRight : The bottom right alpha value.
    "},{"location":"graphics/#clear","title":"Clear","text":"
    graphics.clear();\n
    "},{"location":"graphics/#path","title":"Path","text":"
    graphics.beginPath();\ngraphics.closePath();\ngraphics.fillPath(); // = graphics.fill()\ngraphics.strokePath(); // = graphics.stroke()\n
    "},{"location":"graphics/#rectangle","title":"Rectangle","text":"
    graphics.fillRectShape(rect); // rect: {x, y, width, height}\ngraphics.fillRect(x, y, width, height);\ngraphics.strokeRectShape(rect);  // rect: {x, y, width, height}\ngraphics.strokeRect(x, y, width, height);\n
    "},{"location":"graphics/#rounded-rectangle","title":"Rounded rectangle","text":"
    graphics.fillRoundedRect(x, y, width, height, radius);\ngraphics.strokeRoundedRect(x, y, width, height, radius);\n
    • radius : number or an object {tl, tr, bl, br},
      • Positive value : Convex corner.
      • Negative value : Concave corner.
    "},{"location":"graphics/#triangle","title":"Triangle","text":"
    graphics.fillTriangleShape(triangle); // triangle: {x1, y1, x2, y2, x3, y3}\ngraphics.fillTriangle(x1, y1, x2, y2, x3, y3);\ngraphics.strokeTriangleShape(triangle); // triangle: {x1, y1, x2, y2, x3, y3}\ngraphics.strokeTriangle(x1, y1, x2, y2, x3, y3);\n
    "},{"location":"graphics/#point","title":"Point","text":"
    graphics.fillPointShape(point, size); // point: {x, y}\ngraphics.fillPoint(x, y, size);\n
    "},{"location":"graphics/#line","title":"Line","text":"
    graphics.strokeLineShape(line); // line: {x1, y1, x2, y2}\ngraphics.lineBetween(x1, y1, x2, y2);\ngraphics.lineTo(x, y);\ngraphics.moveTo(x, y);\n
    "},{"location":"graphics/#lines","title":"Lines","text":"
    graphics.strokePoints(points, closeShape, closePath, endIndex);  // points: [{x, y}, ...]\ngraphics.fillPoints(points, closeShape, closePath, endIndex);  // points: [{x, y}, ...]\n
    • points : Array of {x, y}
    • closeShape : When true, the shape is closed by joining the last point to the first point.
    • closePath : When true, the path is closed before being stroked.
    • endIndex : The index of points to stop drawing at. Defaults to points.length.
    "},{"location":"graphics/#circle","title":"Circle","text":"
    graphics.fillCircleShape(circle); // circle: {x, y, radius}\ngraphics.fillCircle(x, y, radius);\ngraphics.strokeCircleShape(circle);  // circle: {x, y, radius}\ngraphics.strokeCircle(x, y, radius);\n

    Draw or fill circle shape by points.

    "},{"location":"graphics/#ellipse","title":"Ellipse","text":"
    graphics.strokeEllipseShape(ellipse, smoothness);   // ellipse: Phaser.Geom.Ellipse\ngraphics.strokeEllipse(x, y, width, height, smoothness);\ngraphics.fillEllipseShape(ellipse, smoothness);    // ellipse: Phaser.Geom.Ellipse\ngraphics.fillEllipse(x, y, width, height, smoothness);\n

    Draw or fill ellipse shape by points.

    "},{"location":"graphics/#arc","title":"Arc","text":"
    graphics.arc(x, y, radius, startAngle, endAngle, anticlockwise);\ngraphics.arc(x, y, radius, startAngle, endAngle, anticlockwise, overshoot);\n

    Draw arc curve by points.

    "},{"location":"graphics/#pie-chart-slice","title":"Pie-chart slice","text":"
    graphics.slice(x, y, radius, startAngle, endAngle, anticlockwise);\ngraphics.slice(x, y, radius, startAngle, endAngle, anticlockwise, overshoot);\n

    Draw pie-chart slice shape by points.

    Fill this shape

    graphics.fillPath();\n
    "},{"location":"graphics/#clear-pattern","title":"Clear pattern","text":"
    graphics.setTexture();\n
    "},{"location":"graphics/#transfer","title":"Transfer","text":"
    graphics.save();\ngraphics.restore();\ngraphics.translateCanvas(x, y);\ngraphics.scaleCanvas(x, y);\ngraphics.rotateCanvas(radians);\n
    "},{"location":"graphics/#generate-texture","title":"Generate texture","text":"
    graphics.generateTexture(key, width, height);  // key: texture key\n
    "},{"location":"graphics/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"graphics/#create-mask","title":"Create mask","text":"
    var mask = graphics.createGeometryMask();\n

    See mask

    "},{"location":"graphics/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"gridalign/","title":"Quad/Hexagon grid align","text":""},{"location":"gridalign/#introduction","title":"Introduction","text":"

    Align objects on quadrilateral or hexagon grid.

    See also built-in grid-align.

    • Author: Rex
    • Methods
    "},{"location":"gridalign/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gridalign/#install-plugin","title":"Install plugin","text":""},{"location":"gridalign/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgridalignplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgridalignplugin.min.js', true);\n
    • Grid-align objects
      scene.plugins.get('rexgridalignplugin').quad(gameObjects, config);\nscene.plugins.get('rexgridalignplugin').hexagon(gameObjects, config);\n
    "},{"location":"gridalign/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GridAlignPlugin from 'phaser3-rex-plugins/plugins/gridalign-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGridAlign',\nplugin: GridAlignPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Grid-align objects
      scene.plugins.get('rexGridAlign').quad(gameObjects, config);\nscene.plugins.get('rexGridAlign').hexagon(gameObjects, config);\n
    "},{"location":"gridalign/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { QuadGridAlign, HexagonGridAlign } from 'phaser3-rex-plugins/plugins/gridalign.js';\n
    • Grid-align objects
      QuadGridAlign(gameObjects, config);\nHexagonGridAlign(gameObjects, config);\n
    "},{"location":"gridalign/#quadrilateral-grid","title":"Quadrilateral grid","text":"
    scene.plugins.get('rexGridAlign').quad(gameObjects, {\nwidth: -1,\nheight: -1,\ncellWidth: 1,\ncellHeight: 1,\ntype: 0,\nposition: Phaser.Display.Align.CENTER,\nx: 0,\ny: 0\n});\n
    • width : The width of the grid in items (not pixels). -1 means lay all items out horizontally, regardless of quantity.
    • height : The height of the grid in items (not pixels). -1 means lay all items out vertically, regardless of quantity.
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • type
      • 0, or orthogonal
      • 1, or isometric
    • position : The alignment position.
      • 0, or Phaser.Display.Align.TOP_LEFT
      • 1, or Phaser.Display.Align.TOP_CENTER
      • 2, or Phaser.Display.Align.TOP_RIGHT
      • 3, or Phaser.Display.Align.LEFT_TOP
      • 4, or Phaser.Display.Align.LEFT_CENTER
      • 5, or Phaser.Display.Align.LEFT_BOTTOM
      • 6, or Phaser.Display.Align.CENTER
      • 7, or Phaser.Display.Align.RIGHT_TOP
      • 8, or Phaser.Display.Align.RIGHT_CENTER
      • 9, or Phaser.Display.Align.RIGHT_BOTTOM
      • 10, or Phaser.Display.Align.BOTTOM_LEFT
      • 11, or Phaser.Display.Align.BOTTOM_CENTER
      • 12, or Phaser.Display.Align.BOTTOM_RIGHT
    • x, y : Position of first item.
    "},{"location":"gridalign/#hexagon-grid","title":"Hexagon grid","text":"
    scene.plugins.get('rexGridAlign').hexagon(gameObjects, {\nwidth: -1,\nheight: -1,\ncellWidth: 1,\ncellHeight: 1,\nstaggeraxis: 'x',\nstaggerindex: 'odd',\nposition: Phaser.Display.Align.CENTER,\nx: 0,\ny: 0\n});\n
    • width : The width of the grid in items (not pixels). -1 means lay all items out horizontally, regardless of quantity.
    • height : The height of the grid in items (not pixels). -1 means lay all items out vertically, regardless of quantity.
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • staggeraxis
      • 0, or y
      • 1, or x
    • staggerindex
      • 0, or even
      • 1, or odd
    • position : The alignment position.
      • 0, or Phaser.Display.Align.TOP_LEFT
      • 1, or Phaser.Display.Align.TOP_CENTER
      • 2, or Phaser.Display.Align.TOP_RIGHT
      • 3, or Phaser.Display.Align.LEFT_TOP
      • 4, or Phaser.Display.Align.LEFT_CENTER
      • 5, or Phaser.Display.Align.LEFT_BOTTOM
      • 6, or Phaser.Display.Align.CENTER
      • 7, or Phaser.Display.Align.RIGHT_TOP
      • 8, or Phaser.Display.Align.RIGHT_CENTER
      • 9, or Phaser.Display.Align.RIGHT_BOTTOM
      • 10, or Phaser.Display.Align.BOTTOM_LEFT
      • 11, or Phaser.Display.Align.BOTTOM_CENTER
      • 12, or Phaser.Display.Align.BOTTOM_RIGHT
    • x, y : Position of first item.
    "},{"location":"gridalign/#types-of-hexagon-grid","title":"Types of hexagon grid","text":"

    Reference

    • odd-r : staggeraxis = x, staggerindex = odd
    • even-r : staggeraxis = x, staggerindex = even
    • odd-q : staggeraxis = y, staggerindex = odd
    • even-q :staggeraxis = y, staggerindex = even
    "},{"location":"gridcutimage/","title":"Grid cut image","text":""},{"location":"gridcutimage/#introduction","title":"Introduction","text":"

    Grid cut image texture to frames, then create image game objects from these frames.

    • Author: Rex
    • Methods
    "},{"location":"gridcutimage/#live-demos","title":"Live demos","text":"
    • Cut image
    • Cut rendertexture
    "},{"location":"gridcutimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gridcutimage/#install-plugin","title":"Install plugin","text":""},{"location":"gridcutimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgridcutimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgridcutimageplugin.min.js', true);\n
    • Create images
      var images = scene.plugins.get('rexgridcutimageplugin').gridCut(gameObjects, columns, rows, config);\n
    "},{"location":"gridcutimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GridCutImagePlugin from 'phaser3-rex-plugins/plugins/gridcutimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGridCutImage',\nplugin: GridCutImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create images
      var images = scene.plugins.get('rexGridCutImage').gridCut(gameObjects, columns, rows, config);\n
    "},{"location":"gridcutimage/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import GridCutImage from 'phaser3-rex-plugins/plugins/gridcutimage.js';\n
    • Create images
      var images = GridCutImage(gameObjects, columns, rows, config);\n
    "},{"location":"gridcutimage/#grid-cut","title":"Grid cut","text":"
    var cellImages = scene.plugins.get('rexGridCutImage').gridCut(gameObjects, columns, rows, {\n// createImageCallback: undefined,\n// ImageClass: Phaser.GameObjects.Image,\n\n// originX: 0.5,\n// originY: 0.5,\n// add: true,\n// align: true,\n// objectPool: undefined\n})\n
    • gameObjects : Target game object which has a texture, ex Image, RenderTexture.
    • columns, rows : Cut texture in columns x rows grids
    • createImageCallback : Custom callback to return an image game object, optional.
      function(scene, texture, frame) {\nreturn gameObject;\n}\n
      • texture : A texture object.
      • frame : Frame name.
    • ImageClass : Create image game object from this class. Default value is built-in Image class. Used when createImageCallback is undefined.
    • originX, originY : Origin of created image game objects
    • add :
      • true : Add these created image game objects to scene. Default value.
      • false : Don't add created image game objects to scene.
    • align :
      • true : Align position of created image game objects to target game object (gameObjects). Default value when add is set to true.
      • false : Don't set position of created image game objects. Default value when add is set to false.
    • objectPool : An array of image game objects, will reuse image game objects from this pool. Optional.
    • cellImages : Return image game objects.
    "},{"location":"gridtable/","title":"Grid table","text":""},{"location":"gridtable/#introduction","title":"Introduction","text":"

    Viewer of grid table, to manipulate game object of each visible cell.

    • Author: Rex
    • Game object
    "},{"location":"gridtable/#live-demos","title":"Live demos","text":"
    • Grid table
    • Grid table & slider
    • Grid table & scroller
    • Grid table & slider & scroller
    • Horizontal scrolling
    • Varying cell height
    "},{"location":"gridtable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"gridtable/#install-plugin","title":"Install plugin","text":""},{"location":"gridtable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgridtableplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgridtableplugin.min.js', true);\n
    • Add table object
      var table = scene.add.rexGridTable(x, y, width, height, config);\n
    "},{"location":"gridtable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GridTablePlugin from 'phaser3-rex-plugins/plugins/gridtable-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGridTablePlugin',\nplugin: GridTablePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add table object
      var table = scene.add.rexGridTable(x, y, width, height, config);\n
    "},{"location":"gridtable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import GridTable from 'phaser3-rex-plugins/plugins/gridtable.js';\n
    • Add table object
      var table = new GridTable(scene, x, y, width, height, config);\nscene.add.existing(table);\n
    "},{"location":"gridtable/#create-instance","title":"Create instance","text":"
    var table = scene.add.rexGridTable(x, y, width, height, {\nscrollMode: 0,        // 0|'v'|'vertical'|1|'h'|'horizontal'\ncellsCount: 0,\ncolumns: 1,\n// rows: 1,\ncellHeight: 30,\ncellWidth: 30,\n// fixedCellSize: false,\n\ncellVisibleCallback: null,\n// cellVisibleCallback: function (cell, cellContainer, table) {},\ncellVisibleCallbackScope: undefined,\nreuseCellContainer: false,\n\ncellInvisibleCallback: null,\n// cellInvisibleCallback: function(cell) {},\ncellInvisibleCallbackScope: undefined,\nclampTableOXY: true,\n\nmask: {\npadding: 0, // or {left, right, top, bottom}\n// updateMode: 0,\n// layer: undefined,\n},\n// enableLayer: false\n});\n
    • scrollMode :
      • 0, or 'v', or 'vertical' : Scroll table vertically.
      • 1, or 'h', or 'horizontal' : Scroll table horizontally.
    • cellsCount : Total cells count.
    • columns : Columns count of each row. Can be used in vertical or horizontal scroll mode.
    • rows : Rows count of each column. Can be used in horizontal scroll mode.
    • cellHeight : Default height of each cell.
      • Expand cell height to fit table height : set cellHeight to undefined, and scrollMode is 'horizontal'.
    • cellWidth : Width of each cell.
      • Expand cell width to fit table width : set cellWidth to undefined, and scrollMode is 'vertical'.
    • fixedCellSize : Assign columns according to cellWidth (if scrollMode is 0) or cellHeight (if scrollMode is 1) , when initialize and resizing. \u3000\u3000- false : Ignore this parameter. Default behavior.
      • true : Set columns according to cellWidth/cellHeight.
    • cellVisibleCallback , cellVisibleCallbackScope : Callback when cell begins visible.
      function (cell, cellContainer, table) {\nif (cellContainer === null) { // No reusable cell container, create a new one\nvar scene = cell.scene;\n// cellContainer = scene.add.container();\n}\n// Set child properties of cell container ...\ncell.setContainer(cellContainer); // Assign cell container\n}\n
    • reuseCellContainer : Set true to reuse cell container when cell is visible.
    • cellInvisibleCallback, cellInvisibleCallbackScope: Callback when cell begins invisible
      function (cell) {\n// var container = cell.popContainer();\n}\n
    • clampTableOXY : Set true to clamp tableOX, tableOY when out-of-bound,
      • Set false when dragging by scroller
    • mask : A rectangle mask of cells
      • mask.padding :
        • A number : Extra left/right/top/bottom padding spacing of this rectangle mask. Default value is 0.
        • A plain object {left, right, top, bottom}
      • mask.updateMode : When to update cells mask
        • 0, or update : Apply mask to cell container only when table.updateTable() is invoked. Default behavior.
        • 1, or everyTick : Apply mask to cell container every tick. Use this mode if game objects of cell are moved after table.updateTable() and still been masked.
      • mask.layer :
        • undefined, false, null : Disable this feature, default behavior
        • Layer game object : Draw children game object of panel on this layer game object, then apply mask on this layer game object.
      • false : No mask.
    • enableLayer :
      • false : Add cell game objects into scene's display list. Default behavior.
      • true : Add cell game objects into an internal layer game object. See also.

    Add grid table from JSON

    var table = scene.make.rexGridTable({\nx: 0,\ny: 0,\nwidth: 256,\nheight: 256,\n\n// cellsCount: 0,   // total cells count\n// ...\n// origin: {x: 0.5, y: 0.5},\n});\n
    "},{"location":"gridtable/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGridTable extends GridTable {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var table = new MyGridTable(scene, x, y, width, height, config);\n
    "},{"location":"gridtable/#cell-begins-visible","title":"Cell begins visible","text":"

    Add container of cell when it begins visible in event cellvisible.

    table.on('cellvisible', function(cell, cellContainer, table){\nif (cellContainer === null) { // No reusable cell container, create a new one\nvar scene = cell.scene;\n// cellContainer = scene.add.container();\n}\n// Set child properties of cell container ...\ncell.setContainer(cellContainer); // Assign cell container\n})\n

    It is equal to cellVisibleCallback in configuration.

    {\n// ...\ncellVisibleCallback: function(cell, cellContainer, table) {\ncell.setContainer(cellContainer); // Assign cell container\n},\n// ...\n}\n
    • cell
      • Scene object of grid table.
        var scene = cell.scene;\n
      • Index of cell.
        var index = cell.index;\n
      • Size of cell.
        var cellWidth = cell.width;\nvar cellHeight = cell.height;\n
        • Change size of cell :
          • Change cell height in scoll-vertical mode.
            cell.setHeight(newHeight);\n// cell.height = newHeight;\n
            or
            cell.setDeltaHeight(deltaHeight);\n// cell.deltaHeight = deltaHeight;\n
          • Reset cell height in scoll-vertical mode.
            cell.setDeltaHeight(0);\n// cell.deltaHeight = 0;\n
          • Change cell width in scroll-horizontal mode.
            cell.setWidth(newWidth);\n// cell.width = newWidth;\n
            or
            cell.setDeltaWidth(deltaWidth);\n// cell.deltaWidth = deltaWidth;\n
          • Reset cell height in scroll-horizontal mode.
            cell.setDeltaWidth(0);\n// cell.deltaWidth = 0;\n
      • Assign cell container. Set origin point of this cell container to (0,0).
        cell.setContainer(cellContainer);\n
      • Alignment of cellContainer :
        cell.setCellContainerAlign(align);\n
        • align :
          • undefined : Set position of cellContainer to left-top of cell space. Default behavior.
          • 'center', or Phaser.Display.Align.CENTER : Align game object at center of cell space.
          • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center of cell space.
          • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center of cell space.
          • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center of cell space.
          • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center of cell space.
    • cellContainer : Cell container picked from object pool for reusing. Set reuseCellContainer to true to enable this feature.
      • null : No cell container available.
      • Game object : Reusable cell container.
    • table : Grid table.

    Each cell only has one container gameObject, old container will be destroyed when assigning a new container.

    "},{"location":"gridtable/#cell-begins-invisible","title":"Cell begins invisible","text":"

    Container of an invisible cell will be destroyed automatically.

    To resue container gameObject

    • Set reuseCellContainer to true to put invisible cell container into object pool.
    • Or, pop that container by cell.popContainer() in event cellinvisible.
    table.on('cellinvisible', function(cell){\n// var container = cell.popContainer();\n})\n

    It is equal to cellInvisibleCallback in configuration.

    {\n// ...\ncellInvisibleCallback: function(cell) {\n// var container = cell.popContainer();\n},\n// ...\n}\n
    "},{"location":"gridtable/#scroll-table-content","title":"Scroll table content","text":"
    • Set
      table.setTableOY(oy).updateTable();\ntable.addTableOY(dy).updateTable();\n
      table.setTableOX(ox).updateTable();\ntable.addTableOX(dx).updateTable();\n
      table.setTableOXY(ox, oy).updateTable();\ntable.addTableOXY(dx, dy).updateTable();\n
      or
      table.tableOY = oy;  // include table.updateTable()\ntable.tableOX = ox;\n
      • These will trigger cellvisible, or cellinvisible events.
    • Get
      var tableOY = table.tableOY;\nvar tableOX = table.tableOX;\n

    Use case

    Scroll table by scroller behavior.

    "},{"location":"gridtable/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      table.setTableOYByPercentage(t).updateTable();  // t: 0~1\n
      or
      table.t = t;  // include table.updateTable()\n
    • Get
      var t = table.getTableOYPercentage();\n//var t = table.t;\n

    Use case

    Scroll table by slider behavior.

    "},{"location":"gridtable/#scroll-to-bottom","title":"Scroll to bottom","text":"
    table.scrollToBottom();\n
    "},{"location":"gridtable/#scroll-to-row","title":"Scroll to row","text":"
    • Scroll to next row
      table.scrollToNextRow();\n
    • Scroll to next n row
      table.scrollToNextRow(n);\n
    • Scroll to row
      table.scrollToRow(rowIndex);\n
    • Get current row index
      var rowIndex = table.startRowIndex;\n
    "},{"location":"gridtable/#refresh-table-content","title":"Refresh table content","text":"
    • Refresh all visible cells.
      table.updateTable(true);\n
    • Update a visible cell
      table.updateVisibleCell(cellIndex);\n
    "},{"location":"gridtable/#table-size-in-cells","title":"Table size in cells","text":"
    • Set table size
      table.setGridSize(colCount, rowCount).updateTable();\n
    "},{"location":"gridtable/#total-cells-count","title":"Total cells count","text":"
    • Get
      var count = table.cellsCount;\n
    • Set
      table.setCellsCount(count).updateTable();\n
    "},{"location":"gridtable/#columns-count","title":"Columns count","text":"
    • Get
      var columnCount = table.columnCount;\n
    • Set
      table.setColumnCount(count).updateTable(true);\n
    "},{"location":"gridtable/#table-size-in-pixels","title":"Table size in pixels","text":"
    • Table height in pixels
      var tableHeight = table.tableHeight;\n
    • Table width in pixels
      var tableWidth = table.tableWidth;\n
    "},{"location":"gridtable/#bounds-of-tableox-tableoy","title":"Bounds of tableOX, tableOY","text":"
    • Top bound of tableOY
      var topTableOY = table.topTableOY;  // 0\n
    • Bottom bound of tableOY
      var bottomTableOY = table.bottomTableOY; // A negative number\n
    • Left bound of tableOX
      var leftTableOX = table.leftTableOX;  // 0\n
    • Right bound of tableOX
      var rightTableOX = table.rightTableOX; // A negative number\n

    Use case

    Set bounds of scroller

    "},{"location":"gridtable/#resize-table","title":"Resize table","text":"
    table.resize(width, height);\n
    "},{"location":"gridtable/#cell","title":"Cell","text":""},{"location":"gridtable/#get-cell","title":"Get cell","text":"
    var cell = table.getCell(cellIndex);\n
    "},{"location":"gridtable/#get-cell-from-position","title":"Get cell from position","text":"
    var cellIndex = table.pointToCellIndex(x, y);\nvar cell = table.getCell(cellIndex);\n
    "},{"location":"gridtable/#cell-height","title":"Cell height","text":"
    • Get
      var height = cell.height;\n
    • Set cell height, only worked in scoll-vertical mode.
      cell.height = height;\n// cell.setHeight(height);\n
      or
      table.setCellHeight(cellIndex, cellHeight);\n
      • Refresh table after the cell size is changed.
        table.updateTable(true);\n
      • Emit 'cellheightchange' event.
        table.on('cellheightchange', function (cell, cellContainer, table) {\n});\n
    "},{"location":"gridtable/#cell-width","title":"Cell width","text":"
    • Get
      var width = cell.width;\n
    • Set cell width, only worked in scoll-horizontal mode.
      cell.width = width;\n// cell.setWidth(width);\n
      or
      table.setCellWidth(cellIndex, cellWidth);\n
      • Refresh table after the cell size is changed.
        table.updateTable(true);\n
      • Emit 'cellwidthchange' event.
        table.on('cellwidthchange', function (cell, cellContainer, table) {\n});\n
    "},{"location":"gridtable/#reset-size-of-all-cells","title":"Reset size of all cells","text":"
    table.resetAllCellsSize(width, height);\n
    "},{"location":"gridtable/#fore-each-visible-cell","title":"Fore each visible cell","text":"
    • For when you absolutely know this Set won't be modified during the iteration
      table.iterateVisibleCell(function(cell){\n// ...\n});\n
    • For when you know this Set will be modified during the iteration.
      table.eachVisibleCell(function(cell){\n// ...\n});\n
    "},{"location":"gridtable/#container","title":"Container","text":"
    • Get
      var container = cell.getContainer();\n
    • Pop (get and remove)
      var container = cell.popContainer();\n
    • Set
      cell.setContainer(container);\n
    • Remove
      cell.destroyContainer();\n
    "},{"location":"gridtable/#properties","title":"Properties","text":"
    var cellIndex = cell.index;\n
    "},{"location":"gridtable/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"group/","title":"Group","text":""},{"location":"group/#introduction","title":"Introduction","text":"

    Objects pool, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"group/#usage","title":"Usage","text":""},{"location":"group/#add-group-object","title":"Add group object","text":"
    var group = scene.add.group(config);\n// var group = scene.add.group(gameObjects, config);  // Add game objects into group\n
    • config
      {\nclassType: Phaser.GameObjects.Sprite,\ndefaultKey: null,\ndefaultFrame: null,\nactive: true,\nmaxSize: -1,\nrunChildUpdate: false,\ncreateCallback: null,\nremoveCallback: null,\ncreateMultipleCallback: null\n}\n
      • classType :
        • Sprite : Phaser.GameObjects.Sprite
        • Image : Phaser.GameObjects.Image
      • runChildUpdate : Set true to run gameObject.update() every tick.
      • createCallback : A function to be called when adding or creating group members.
        var callback = function(gameObject) {\n}\n
      • removeCallback : A function to be called when removing group members.
        var callback = function(gameObject) {\n}\n
      • createMultipleCallback : A function to be called when creating several group members at once.
        var callback = function(gameObjects) {\n}\n
    "},{"location":"group/#add-game-object","title":"Add game object","text":"
    group.add(gameObject);\n// group.add(gameObject, true);  // add this game object to display and update list of scene\n
    group.addMultiple(gameObjects);   // array of game objects\n// group.addMultiple(gameObjects, true);\n
    • Game object will only be added once.
    • Game object will be removed automatically when destroyed.
    "},{"location":"group/#remove-game-object","title":"Remove game object","text":"
    group.remove(gameObject);\n// group.remove(gameObject, true);  // also remove this game object from display and update list of scene\n

    Remove all game objects

    group.clear();\n// group.clear(removeFromScene, destroyChild);\n
    "},{"location":"group/#get-game-objects","title":"Get game objects","text":"
    • Get all game objects.
      var gameObjects = group.getChildren();  // array of game objects\n
    • Get all matching game objects
      var gameObjects = group.getMatching(property, value);\n// var gameObjects = group.getMatching(property, value, startIndex, endIndex);\n
    • Amount of game objects.
      var len = group.getLength();\n
    • Group is full. Maximun size is set in maxSize.
      var isFull = group.isFull();\n
    • Game object is in group.
      var isInGroup = group.contains(child);\n
    "},{"location":"group/#group-actions","title":"Group actions","text":""},{"location":"group/#property","title":"Property","text":"
    • Set property
      group.propertyValueSet(key, value);\n// group.propertyValueSet(key, value, step, index, direction);\n
      • direction :
        • 1 : From beginning to end
        • -1 : From end to beginning
    • Increase property
      group.propertyValueInc(key, value);\n// group.propertyValueInc(key, value, step, index, direction);\n
      • direction :
        • 1 : From beginning to end
        • -1 : From end to beginning
    "},{"location":"group/#position","title":"Position","text":"
    • Set Position
      group.setX(value);\n// group.setX(value, step);\ngroup.setX(value);\n// group.setY(value, step);\ngroup.setXY(x, y);\n// group.setXY(x, y, stepX, stepY);\n
    • Increase Position
      group.incX(value);\n// group.incX(value, step);\ngroup.incY(value);\n// group.incY(value, step);\ngroup.incXY(x, y);\n// group.incXY(x, y, stepX, stepY);\n
    • Shift position
      group.shiftPosition(x, y);\n// group.shiftPosition(x, y, direction);\n
      • direction :
        • 0 : First to last
        • 1 : Last to first
    "},{"location":"group/#angle","title":"Angle","text":"
    • Set angle
      group.angle(value);\n// group.angle(value, step);\n
      group.rotate(value);\n// group.rotate(value, step);\n
    • Rotate around
      group.rotateAround(point, angle);\n
      group.rotateAroundDistance(point, angle, distance);\n
    "},{"location":"group/#visible","title":"Visible","text":"
    • Set visible
      group.setVisible(value);\n// group.setVisible(value, index, direction);\n
      • index : An optional offset to start searching from within the items array.
      • direction : The direction to iterate through the array.
        • 1 : From beginning to end
        • -1 : From end to beginning
    • Toggle visible
      group.toggleVisible();\n
    "},{"location":"group/#alpha","title":"Alpha","text":"
    • Set alpha
      group.setAlpha(value);\n// group.setAlpha(value, step);\n
    "},{"location":"group/#tint","title":"Tint","text":"
    • Set tint
      group.setTint(value);\n// group.setTint(topLeft, topRight, bottomLeft, bottomRight);\n
    "},{"location":"group/#blend-mode","title":"Blend mode","text":"
    • Set blend mode
      group.setBlendMode(value);\n
    "},{"location":"group/#scale","title":"Scale","text":"
    • Set scale
      group.scaleX(value);\n// group.scaleX(value, step);\ngroup.scaleY(value);\n// group.scaleY(value, step);\ngroup.scaleXY(scaleX, scaleY);\n// group.scaleXY(scaleX, scaleY, stepX, stepY);\n
    "},{"location":"group/#origin","title":"Origin","text":"
    • Set origin
      group.setOrigin(originX, originY);\n// group.setOrigin(originX, originY, stepX, stepY);\n
    "},{"location":"group/#depth","title":"Depth","text":"
    • Set depth
      group.setDepth(value, step);\n
    "},{"location":"group/#animation","title":"Animation","text":"
    • Play animation
      group.playAnimation(key, startFrame);\n
    "},{"location":"group/#hit-area","title":"Hit area","text":"
    • Set hit-area
      group.setHitArea();\n// group.setHitArea(hitArea, hitAreaCallback);\n
    "},{"location":"group/#shuffle","title":"Shuffle","text":"
    • Shuffle array
      group.shuffle();\n
    "},{"location":"group/#activeinactive-game-objects","title":"Active/inactive game objects","text":"
    • Set inactive
      group.kill(gameObject);         // gameObject.setActive(false)\ngroup.killAndHide(gameObject);  // gameObject.setActive(false).setVisible(false)\n
    • Amount of active game objects
      var activeCount = group.countActive();\n
      or
      var activeCount = group.getTotalUsed();\n
    • Amount of active game objects
      var inactiveCount = group.countActive(false);\n
    • Amount of free (maxSize - activeCount) game objects
      var freeCount = group.getTotalFree();  // group.maxSize - group.getTotalUsed()\n
    • Get first active/inactive game object,
      • Return null if no game object picked.
        var gameObject = group.getFirst(active);  // active = true/false\nvar gameObject = group.getFirstAlive(); // Equal to group.getFirst(true, ...)\nvar gameObject = group.getFirstDead(); // Equal to group.getFirst(false, ...)\n
      • Create one if no game object picked.
        var gameObject = group.getFirst(active, true, x, y, key, frame, visible);  // active = true/false\nvar gameObject = group.getFirstAlive(true, x, y, key, frame, visible); // Equal to group.getFirst(true, ...)\nvar gameObject = group.getFirstDead(true, x, y, key, frame, visible); // Equal to group.getFirst(false, ...)\nvar gameObject = group.get(x, y, key, frame, visible); // Equal to group.getFirst(false, true, ...)\n
        • Use (x, y, key, frame) to create Image/Sprite game object.
          var newGameObject = new GameObjectClass(x, y, key, frame);\n
    "},{"location":"group/#create-game-objects","title":"Create game objects","text":"
    var gameObjects = group.createFromConfig(config);\nvar gameObjects = group.createMultiple(config);    // config in array\n
    • config
      {\nclassType: this.classType,\nkey: undefined,             // Required\nframe: null,\nvisible: true,\nactive: true,\nrepeat: 0,                  // Create (1 + repeat) game objects\ncreateCallback: undefined,  // Override this.createCallback if not undefined\n\n// Position\nsetXY: {\nx:0,\ny:0,\nstepX:0,\nstepY:0\n},\n// Actions.SetXY(gameObjects, x, y, stepX, stepY)\ngridAlign: false,\n// {\n//     width: -1,\n//     height: -1,\n//     cellWidth: 1,\n//     cellHeight: 1,\n//     position: Phaser.Display.Align.TOP_LEFT,\n//     x: 0,\n//     y: 0\n// }\n// Actions.GridAlign(gameObjects, gridAlign)\n\n// Angle\nsetRotation: {\nvalue: 0,\nstep:\n},\n// Actions.SetRotation(gameObjects, value, step)\n\n// Scale\nsetScale: {\nx:0,\ny:0,\nstepX:0,\nstepY:0\n},\n// Actions.SetScale(gameObjects, x, y, stepX, stepY)\n\n// Alpha\nsetAlpha: {\nvalue: 0,\nstep:\n},\n// Actions.SetAlpha(gameObjects, value, step)\n\nsetOrigin: {\nx:0,\ny:0,\nstepX:0, stepY:0\n},\n\n// Input\nhitArea: null,\nhitAreaCallback: null,\n// Actions.SetHitArea(gameObjects, hitArea, hitAreaCallback)\n}\n
      • classType :
        • Sprite: Phaser.GameObjects.Sprite
        • Image: Phaser.GameObjects.Image
    "},{"location":"group/#destroy","title":"Destroy","text":"
    • Destroy group only
      group.destroy();\n
    • Destroy group and children
      group.destroy(true);\n
    "},{"location":"groupactions/","title":"Group actions","text":""},{"location":"groupactions/#introduction","title":"Introduction","text":"

    Set properties of game objects, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"groupactions/#usage","title":"Usage","text":""},{"location":"groupactions/#call-function","title":"Call function","text":"
    Phaser.Actions.Call(gameObjects, function(gameObject) {\n\n}, scope);\n
    "},{"location":"groupactions/#set-any-property","title":"Set any property","text":"
    Phaser.Actions.PropertyValueSet(gameObjects, key, value, step, index, direction);\n
    • gameObjects : An array of game objects.
    • key : The property to be updated.
    • value : The amount to be added to the property.
    • step : This is added to the value amount, multiplied by the iteration counter.
    • index : An optional offset to start searching from within the items array.
    • direction :
      • 1 : from beginning to end.
      • -1: from end to beginning.
    Phaser.Actions.PropertyValueInc(gameObjects, key, value, step, index, direction);\n
    Phaser.Actions.SmootherStep(gameObjects, key, min, max, inc));\n
    Phaser.Actions.SmoothStep(gameObjects, key, min, max, inc));\n
    Phaser.Actions.Spread(gameObjects, key, min, max, inc));\n
    "},{"location":"groupactions/#position","title":"Position","text":"
    Phaser.Actions.SetX(gameObjects, value, step, index, direction);\n
    Phaser.Actions.IncX(gameObjects, value, step, index, direction);\n
    Phaser.Actions.SetY(gameObjects, value, step, index, direction);\n
    Phaser.Actions.IncY(gameObjects, value, step, index, direction);\n
    Phaser.Actions.SetXY(gameObjects, x, y, stepX, stepY, index, direction);\n
    Phaser.Actions.IncXY(gameObjects, x, y, stepX, stepY, index, direction);\n
    "},{"location":"groupactions/#shift-position","title":"Shift position","text":"

    Set the position of first game object to (x, y), others to the position of previous game object.

    Phaser.Actions.ShiftPosition(gameObjects, x, y, direction, output);\n
    "},{"location":"groupactions/#position-on-shape","title":"Position on shape","text":""},{"location":"groupactions/#grid-align","title":"Grid align","text":"
    Phaser.Actions.GridAlign(gameObjects, {\nwidth: -1,\nheight: -1,\ncellWidth: 1,\ncellHeight: 1,\nposition: Phaser.Display.Align.TOP_LEFT,\nx: 0,\ny: 0\n});\n
    • width : The width of the grid in items (not pixels). -1 means lay all items out horizontally, regardless of quantity.
    • height : The height of the grid in items (not pixels). -1 means lay all items out vertically, regardless of quantity.
    • cellWidth : The width of the cell, in pixels.
    • cellHeight : The height of the cell, in pixels.
    • position : The alignment position.
      • 0, or Phaser.Display.Align.TOP_LEFT
      • 1, or Phaser.Display.Align.TOP_CENTER
      • 2, or Phaser.Display.Align.TOP_RIGHT
      • 3, or Phaser.Display.Align.LEFT_TOP
      • 4, or Phaser.Display.Align.LEFT_CENTER
      • 5, or Phaser.Display.Align.LEFT_BOTTOM
      • 6, or Phaser.Display.Align.CENTER
      • 7, or Phaser.Display.Align.RIGHT_TOP
      • 8, or Phaser.Display.Align.RIGHT_CENTER
      • 9, or Phaser.Display.Align.RIGHT_BOTTOM
      • 10, or Phaser.Display.Align.BOTTOM_LEFT
      • 11, or Phaser.Display.Align.BOTTOM_CENTER
      • 12, or Phaser.Display.Align.BOTTOM_RIGHT
    • x, y : Position of first item.
    "},{"location":"groupactions/#line","title":"Line","text":"

    Line :

    var line = new Phaser.Geom.Line(x1, y1, x2, y2);\n
    Phaser.Actions.PlaceOnLine(gameObjects, line);\n// Phaser.Actions.PlaceOnLine(gameObjects, line, ease);\n
    • ease :
      • A string
      • A function object.
    Phaser.Actions.RandomLine(gameObjects, line);\n
    "},{"location":"groupactions/#circle","title":"Circle","text":"

    Circle :

    var circle = new Phaser.Geom.Circle(x, y, radius);\nPhaser.Actions.PlaceOnCircle(gameObjects, circle, startAngle, endAngle);\n
    Phaser.Actions.RandomCircle(gameObjects, circle);\n
    "},{"location":"groupactions/#ellipse","title":"Ellipse","text":"

    Ellipse :

    var ellipse = new Phaser.Geom.Ellipse(x, y, width, height);\nPhaser.Actions.PlaceOnEllipse(gameObjects, ellipse, startAngle, endAngle);\n
    "},{"location":"groupactions/#triangle","title":"Triangle","text":"

    Triangle :

    var triangle = new Phaser.Geom.Triangle(x1, y1, x2, y2, x3, y3);\nPhaser.Actions.PlaceOnTriangle(gameObjects, triangle, stepRate);\n
    Phaser.Actions.RandomTriangle(gameObjects, triangle);\n
    "},{"location":"groupactions/#rectangle","title":"Rectangle","text":"

    Rectangle :

    var rect = new Phaser.Geom.Rectangle(x, y, width, height);\nPhaser.Actions.PlaceOnRectangle(gameObjects, rect, shift;\n
    Phaser.Actions.RandomRectangle(gameObjects, rect);\n
    Phaser.Actions.WrapInRectangle(gameObjects, rect, padding);\n
    "},{"location":"groupactions/#angle","title":"Angle","text":"
    Phaser.Actions.Angle(gameObjects, value, step, index, direction);\n// value: angle in radians\n
    Phaser.Actions.Rotate(gameObjects, value, step, index, direction);\n// value: angle in degree\n
    Phaser.Actions.RotateAround(gameObjects, point, angle);\n// point: {x, y}, angle: angle in radians\n
    Phaser.Actions.RotateAroundDistance(gameObjects, point, angle, distance);\n// point: {x, y}, angle: angle in radians\n
    "},{"location":"groupactions/#visible","title":"Visible","text":"
    Phaser.Actions.SetVisible(gameObjects, value, index, direction);\n
    Phaser.Actions.ToggleVisible(gameObjects);\n
    "},{"location":"groupactions/#alpha","title":"Alpha","text":"
    Phaser.Actions.SetAlpha(gameObjects, value, step, index, direction);\n
    "},{"location":"groupactions/#tint","title":"Tint","text":"
    Phaser.Actions.setTint(gameObjects, value);\n//Phaser.Actions.setTint(gameObjects, topLeft, topRight, bottomLeft, bottomRight);\n
    "},{"location":"groupactions/#origin","title":"Origin","text":"
    Phaser.Actions.SetOrigin(gameObjects, originX, originY, stepX, stepY, index, direction);\n
    "},{"location":"groupactions/#scale","title":"Scale","text":"
    Phaser.Actions.ScaleX(gameObjects, value, step, index, direction);\n
    Phaser.Actions.ScaleY(gameObjects, value, step, index, direction);\n
    Phaser.Actions.ScaleXY(gameObjects, x, y, stepX, stepY, index, direction);\n
    "},{"location":"groupactions/#scroll-factor","title":"Scroll factor","text":"
    Phaser.Actions.SetScrollFactorX(gameObjects, value, step, index, direction);\n
    Phaser.Actions.SetScrollFactorY(gameObjects, value, step, index, direction);\n
    Phaser.Actions.SetScrollFactor(gameObjects, x, y, stepX, stepY, index, direction);\n
    "},{"location":"groupactions/#depth","title":"Depth","text":"
    Phaser.Actions.SetDepth(gameObjects, value, step, index, direction);\n
    "},{"location":"groupactions/#hit-area","title":"Hit area","text":"
    Phaser.Actions.SetHitArea(gameObjects, hitArea, hitAreaCallback);\n
    "},{"location":"groupactions/#blend-mode","title":"Blend mode","text":"
    Phaser.Actions.SetBlendMode(gameObjects, blendMode, index, direction);\n
    • blendMode : Blend mode
    "},{"location":"groupactions/#play-animation","title":"Play animation","text":"
    Phaser.Actions.PlayAnimation(gameObjects, key, ignoreIfPlaying);\n
    "},{"location":"groupactions/#shuffle","title":"Shuffle","text":"
    Phaser.Actions.Shuffle(gameObjects);\n
    "},{"location":"groupnavigator/","title":"Group navigator","text":""},{"location":"groupnavigator/#introduction","title":"Introduction","text":"

    Navigate between existing game objects, focus on next/previous/next-row/previous row game object.

    • Author: Rex
    • Member of scene
    "},{"location":"groupnavigator/#live-demos","title":"Live demos","text":"
    • 1D targets
    • 2D targets
    "},{"location":"groupnavigator/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"groupnavigator/#install-plugin","title":"Install plugin","text":""},{"location":"groupnavigator/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgroupnavigatorplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgroupnavigatorplugin.min.js', true);\n
    • Create navigator
      var navigator = scene.plugins.get('rexgroupnavigatorplugin').add(config);\n
    "},{"location":"groupnavigator/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GroupNavigatorPlugin from 'phaser3-rex-plugins/plugins/groupnavigator-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGroupNavigator',\nplugin: GroupNavigatorPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create navigator
      var navigator = scene.plugins.get('rexGroupNavigator').add(config);\n
    "},{"location":"groupnavigator/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import GroupNavigator from 'phaser3-rex-plugins/plugins/groupnavigator.js';\n
    • Create navigator
      var navigator = new GroupNavigator(config);\n
    "},{"location":"groupnavigator/#create-navigator","title":"Create navigator","text":"
    var navigator = scene.plugins.get('rexGroupNavigator').add({\n// enable: true,\n\ntargets: gameObjects,\n// columns: undefined,\n\n// getFocusEnableCallback(gameObject) { \n//     return focusEnable;\n// }\n// focusEnableDataKey: undefined,\n// focusEnableKey: undefined\n});\n
    • enable :
      • true : Can navigate between game objects. Default behavior.
      • false : Ignore navigation actions (navigator.next(), navigator.previous(), navigator.nextRow(), navigator.previousRow())
    • targe1ts :
      • 1D array of game objects for navigator.next(), or navigator.previous()
      • 2D array of game objects for navigator.next(), navigator.previous(), navigator.nextRow(), navigator.previousRow()
    • columns : A number : Convert 1D targets array to 2D array, each row has columns game objects.
      • undefined : Ignore this parameter. Default behavior.
    • Focus enable : Get focus enable of game object by one of these parameter.
      • getFocusEnableCallback : A callback to return focus enable of this game object.
        function(gameObject) {\nreturn focusEnable;\n}\n
      • focusEnableDataKey : Get focus enable from private data of this game object.
      • focusEnableKey : Get focus enable from property of this game object.
      • Focus enable is always true if none of these parameter is given. Default behavior.
    "},{"location":"groupnavigator/#enable","title":"Enable","text":"
    • Get
      var enable = navigator.enable;\n
    • Set
      navigator.setEnable(enable);\n
    "},{"location":"groupnavigator/#navigate","title":"Navigate","text":"
    • Focus on next/previous game object, for 1D and 2D array of targets
      navigator.next();\n
      navigator.previous();\n
      Will fire blur and focus events
    • Focus on next row/previous row game object, for 2D array of targets
      navigator.nextRow();\n
      navigator.previousRow();\n
      Will fire blur and focus events
    • Focus on first/last game object
      navigator.first();\n
      navigator.last();\n
      Will fire blur and focus events
    "},{"location":"groupnavigator/#current-focused-game-object","title":"Current focused game object","text":"
    • Get current focused game object
      var gameObject = navigator.getFocusedTarget();\n// var gameObject = navigator.focusedTarget;\n
    • Focus on game object. Do nothing if that game object is not focus-enable.
      navigator.focus(gameObject);\n
      Will fire blur and focus events.
    • Blur
      navigator.blur();\n
      Will fire blur event.
    "},{"location":"groupnavigator/#target-game-objects","title":"Target game objects","text":"
    • Get
      var gameObjects = navigator.targets;\n
      • gameObjects : 1D/2D array of game objects
    • Set
      navigator.setTargets(targets);\n// navigator.setTargets(targets, columns);\n
    • Modify
      navigator.targets.push(newGameObject);    
      Phaser.Utils.Array.AddAt(navigator.targets, newGameObject, index);\n
      Phaser.Utils.Array.Remove(navigator.targets, gameObject);\n
    "},{"location":"groupnavigator/#events","title":"Events","text":"
    • On focus
      navigator.on('focus', function(gameObject){\n\n})\n
    • On blur
      navigator.on('blur', function(gameObject){\n\n})\n
    "},{"location":"handlebars/","title":"Handlebars","text":""},{"location":"handlebars/#introduction","title":"Introduction","text":"

    Format string with variables, largely compatible with Mustache templates. Reference

    "},{"location":"handlebars/#usage","title":"Usage","text":"
    var template = 'hello, {{name}}';\nvar view = {\nname: 'rex'\n};\nvar result = Mustache.render(template, view);\n
    "},{"location":"handlebars/#pre-compile","title":"Pre-compile","text":"
    const template = Handlebars.compile(\"{{foo}}\");\ntemplate({}, {\n// allowProtoPropertiesByDefault: false,\n// allowProtoMethodsByDefault: false\n});\n
    "},{"location":"hiddeninputtext/","title":"Hidden edit","text":""},{"location":"hiddeninputtext/#introduction","title":"Introduction","text":"

    An invisible Input DOM element to receive character input and display on text, bbocodetext, or tagtext.

    Inspirited from CanvasInput.

    • Author: Rex
    • Behavior of text object
    "},{"location":"hiddeninputtext/#live-demos","title":"Live demos","text":"
    • With Text
    • With BBCodeText
    • With rexui-Label
    • With bitmaptext
    • Number input
    "},{"location":"hiddeninputtext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"hiddeninputtext/#install-plugin","title":"Install plugin","text":""},{"location":"hiddeninputtext/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexhiddeninputtextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexhiddeninputtextplugin.min.js', true);\n
    • Add text-edit behavior
      var hiddenInputText = scene.plugins.get('rexhiddeninputtextplugin').add(textGameObject, config);\n
    "},{"location":"hiddeninputtext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import HiddenInputTextPlugin from 'phaser3-rex-plugins/plugins/hiddeninputtext-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexHiddenInputTextPlugin',\nplugin: HiddenInputTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-edit behavior
      var hiddenInputText = scene.plugins.get('rexHiddenInputTextPlugin').add(textGameObject, config);\n
    "},{"location":"hiddeninputtext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import HiddenInputText from 'phaser3-rex-plugins/plugins/hiddeninputtext.js';\n
    • Add text-edit behavior
      var hiddenInputText = new HiddenInputText(textGameObject, config);\n
    "},{"location":"hiddeninputtext/#add-input-text-object","title":"Add input text object","text":"
    var hiddenInputText = scene.plugins.get('rexHiddenInputTextPlugin').add(textGameObject, {\n// inputType: 'text',    // 'text'|'password'|'textarea'|...\n// type: 'text',    // 'text'|'password'|'textarea'|...\n\ncursor: '|',\ncursorFlashDuration: 1000,\n\n// enterClose: true,\n\n// onOpen: function (textObject, hiddenInputText) {   // Or onFocus:\n// },\n// onClose: function (textObject, hiddenInputText) {  // Or onBlur:\n// },\n// onUpdate: function (text, textObject, hiddenInputText) {\n//     return text;\n// },\n});\n
    • textGameObject :
    • inputType, or type : Type of element
      • 'text', 'password', 'textarea', ...
    • cursor : Cursor character used in default update text callback.
      • null, or '' : Don't insert cursor character.
    • cursorFlashDuration : Display cursor character or a space string to create a flash cursor.
    • enterClose :
      • true : Close input text when enter-key was pressed. Default value is true if inputType is not 'textarea'.
      • false : If inputType is set to 'textarea', default value will be false.
    • onOpen, or onFocuse : Callback invoked when focus on this hidden input text.
      function (textObject, hiddenInputText) {\n}\n
    • onClose, or onBlur : Callback invoked when blur.
      function (textObject, hiddenInputText) {\n}\n
    • onUpdate :
      • A callback invoked in each tick of editing.
        function (text, textObject, hiddenInputText) {\n// return text;\n}\n
        • Can return a new string for text game object displaying.
      • 'number' : Only output number string.

    Note

    This hiddenInputText will be destroyed when textGameObject is destroyed.

    "},{"location":"hiddeninputtext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyHiddenText extends HiddenInputText {\nconstructor(textGameObject, config) {\nsuper(textGameObject, config) {\n// ...            \n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var hiddenInputText = new MyHiddenText(textGameObject, config);\n
    "},{"location":"hiddeninputtext/#cursor","title":"Cursor","text":"
    • Set
      hiddenInputText.setCursor(s);\n
    • Get
      var cursor = hiddenInputText.cursor;\n
    "},{"location":"hiddeninputtext/#open-editor","title":"Open editor","text":"
    hiddenInputText.open();\n
    "},{"location":"hiddeninputtext/#close-editor","title":"Close editor","text":"
    hiddenInputText.close();\n
    "},{"location":"hiddeninputtext/#is-opened","title":"Is opened","text":"
    var isOpened = hiddenInputText.isOpened;\n
    "},{"location":"hiddeninputtext/#select-text","title":"Select text","text":"

    This feature does not support.

    "},{"location":"hiddeninputtext/#bypass-key-input","title":"Bypass key input","text":"

    Registered keyboard events might capture key input.

    var keyObj = scene.input.keyboard.addKey('W', enableCapture, emitOnRepeat);\n

    Set enableCapture to false to bypass key input to this input-text game objecct.

    "},{"location":"hiddeninputtext/#event","title":"Event","text":"
    • On text change
      hiddenInputText.on('textchange', function(text, textGameObject){\n})\n
    • Not a number input
      hiddenInputText.on('nan', function(text){\n\n})\n
    • Close editor by ENTER key down
      hiddenInputText.on('keydown-ENTER', function(){\n})\n
    "},{"location":"i18next/","title":"i18next","text":""},{"location":"i18next/#introduction","title":"Introduction","text":"

    i18next is a very popular internationalization framework for browser or any other javascript environment.

    • Author: i18next
    • Application plugin : Text translation
    "},{"location":"i18next/#usage","title":"Usage","text":""},{"location":"i18next/#import-class","title":"Import class","text":"
    • Install i18next, i18next-http-backend from npm
      npm i i18next\nnpm i i18next-http-backend\n
    • Import i18next
      import i18next from 'i18next';\nimport Backend from 'i18next-http-backend';\n
    • Initialize
      i18next.use(Backend).init(config);\n
    • Translation
      var result = i18next.t(key);\n
    "},{"location":"i18next/#initialize","title":"Initialize","text":"
    i18next\n.use(Backend)\n.init({\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n})\n
    • lng : Language to use. Will fallback to 'dev'.
    • ns : String or array of namespaces to load. Default value is 'translation'.
    • debug : Logs info level to console output. Helps finding issues with loading not working. Default value is false.
    • resources : Resources to initialize with.
    • backend.loadPath : Path where resources get loaded from, or a function returning a path.
      function(lngs, namespaces) { return customPath; }\n
    • backend.parse : Parse data after it has been fetched. Optional.
      function(data) { return JSON.parse(data); }\n

    See also Configuration Options, and Backend Options

    "},{"location":"i18next/#change-language","title":"Change language","text":"
    i18next.changeLanguage(\"en\");\n

    Fire event 'languageChanged'.

    "},{"location":"i18next/#set-default-namespace","title":"Set default namespace","text":"
    i18next.setDefaultNamespace(namespace);\n
    "},{"location":"i18next/#translate","title":"Translate","text":"
    var result = i18next.t(key);\n// var result = i18next.t(key, interpolation);\n
    "},{"location":"i18next/#events","title":"Events","text":"
    • On language changed, triggered by i18next.changeLanguage(lng).
      i18next.on('languageChanged', function (lng) {\n});\n
    "},{"location":"image/","title":"Image","text":""},{"location":"image/#introduction","title":"Introduction","text":"

    Display of static images, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"image/#usage","title":"Usage","text":""},{"location":"image/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"image/#add-image-object","title":"Add image object","text":"
    var image = scene.add.image(x, y, key);\n// var image = scene.add.image(x, y, key, frame);\n

    Add image from JSON

    var image = scene.make.image({\nx: 0,\ny: 0,\nkey: '',\n// frame: '',\n\n// angle: 0,\n// alpha: 1,\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    • key, frame :
      • A string
      • An array of string to pick one element at random
    • x, y, scale.x, scale.y :
      • A number
      • A callback to get return value
        function() { return 0; }\n
      • Random integer between min and max
        { randInt: [min, max] }\n
      • Random float between min and max
        { randFloat: [min, max] }\n
    "},{"location":"image/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImage extends Phaser.GameObjects.Image {\nconstructor(scene, x, y, texture, frame) {\nsuper(scene, x, y, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImage(scene, x, y, key);\n
    "},{"location":"image/#texture","title":"Texture","text":"

    See game object - texture

    "},{"location":"image/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"image/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"imagebox/","title":"Image box","text":""},{"location":"imagebox/#introduction","title":"Introduction","text":"

    Keep aspect ratio of image game object when scale-down resizing. A containerLite game object with 1 image game object.

    • Author: Rex
    • Game object
    "},{"location":"imagebox/#live-demos","title":"Live demos","text":"
    • Resize
    "},{"location":"imagebox/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"imagebox/#install-plugin","title":"Install plugin","text":""},{"location":"imagebox/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('reximageboxplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/reximageboxplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexImageBox(x, y, texture, frame, config);\n
    "},{"location":"imagebox/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ImageBoxPlugin from 'phaser3-rex-plugins/plugins/imagebox-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexImageBoxPlugin',\nplugin: ImageBoxPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexImageBox(x, y, texture, frame, config);\n
    "},{"location":"imagebox/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ImageBox from 'phaser3-rex-plugins/plugins/imagebox.js';\n
    • Add image object
      var image = new ImageBox(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"imagebox/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexImageBox(x, y, texture, frame, {\n// scaleUp: false,\n// width: undefined,\n// height: undefined,\n\n// background: undefined,\n// image: undefined\n});\n
    • scaleUp : Scale up or keep original size of image when size of imageBox is larger.
      • true : Scale up image when size of imageBox is larger.
      • false : Keep original size of image size of imageBox is larger. Default behavior.
    • width, height : Resize this game object.
      • undefined : Use original size. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of imageBox.
    • image : Custom image game object instance.
      • undefined : Use built-in image game object. Default behavior.

    Add imagebox from JSON

    var image = scene.make.rexImageBox({\nx: 0,\ny: 0,\nkey: null,\nframe: null,\n\n// width: undefined,\n// height: undefined,\n\n// background: undefined,\n// image: undefined\n\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"imagebox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImageBox extends ImageBox {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImageBox(scene, x, y, texture, frame, config);\n
    "},{"location":"imagebox/#resize","title":"Resize","text":"
    image.resize(width, height);\n

    Note

    • If new size is bigger than original size, uses original size. (i.e won't scale up)
    • If new size is smaller than original size, scales down and keeps aspect ratio.
    "},{"location":"imagebox/#set-texture","title":"Set texture","text":"
    image.setTexture(key, frame);\n
    "},{"location":"imagebox/#current-texture","title":"Current texture","text":"
    var textureKey = image.texture.key;\nvar frameName = image.frame.name;\n
    "},{"location":"imagebox/#clear-texture","title":"Clear texture","text":"
    image.setTexture();\n

    Will set internal image game object to invisible.

    "},{"location":"imagebox/#scale-image","title":"Scale image","text":"
    image.scaleImage();\n

    image.resize(width, height), or image.setTexture(key, frame) will invoke this method internally.

    "},{"location":"imagebox/#internal-image-game-object","title":"Internal image game object","text":"
    var internalImageGO = image.image;\n
    "},{"location":"imagebox/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"imagebox/#create-mask","title":"Create mask","text":"

    Create mask from internal image game object (image.image).

    var mask = image.image.createBitmapMask();\n

    See mask

    "},{"location":"imagebox/#shader-effects","title":"Shader effects","text":"

    Internal image game object (image.image) support preFX and postFX effects

    "},{"location":"imageuriloader/","title":"Imageuriloader","text":"

    Note

    Phaser3.80 can load image by uri (base64 string) in preload stage.

    "},{"location":"imageuriloader/#introduction","title":"Introduction","text":"

    Load image by uri (base64 string) in preload stage.

    Built-in image loader dosen't support loading local image uri.

    • Author: Rex
    • Custom File of loader
    "},{"location":"imageuriloader/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"imageuriloader/#install-plugin","title":"Install plugin","text":""},{"location":"imageuriloader/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      var sceneConfig = {\n// ....\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'reximageuriloaderplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/reximageuriloaderplugin.min.js',\nstart: true\n}]\n}\n};\nclass MyScene extends Phaser.Scene {\nconstructor() {\nsuper(sceneConfig)\n}\n// ....\n\npreload() {\n// reximageuriloaderplugin will be installed before preload(), but not added to loader yet\n// Call addToScene(scene) to add this await loader to loader of this scene\nthis.plugins.get('reximageuriloaderplugin').addToScene(this);\n\nthis.load.rexImageURI(key, uri);\n}\n}\n
    "},{"location":"imageuriloader/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ImageURILoaderPlugin from 'phaser3-rex-plugins/plugins/imageuriloader-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexImageURILoader',\nplugin: ImageURILoaderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In preload stage
      scene.load.rexImageURI(key, uri);\n
    "},{"location":"imageuriloader/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ImageURILoader from 'phaser3-rex-plugins/plugins/imageuriloader.js';\n
    • Start loading task
      ImageURILoader.call(scene.load, key, uri);\n
    "},{"location":"imageuriloader/#load-image","title":"Load image","text":"

    In preload stage:

    this.load.rexImageURI(key, uri);\n
    • key : Texture key.
    • uri : URI, a base64 string.
    "},{"location":"imageuriloader/#load-sprite-sheet","title":"Load sprite sheet","text":"

    In preload stage:

    this.load.rexImageURI(key, uri, frameConfig);\n
    • key : Texture key.
    • uri : URI, a base64 string.
    • frameConfig :
      • frameWidth : The width of the frame in pixels.
      • frameHeight : The height of the frame in pixels. Uses the frameWidth value if not provided.
      • startFrame : The first frame to start parsing from.
      • endFrame : The frame to stop parsing at. If not provided it will calculate the value based on the image and frame dimensions.
      • margin : The margin in the image. This is the space around the edge of the frames.
      • spacing : The spacing between each frame in the image.
    "},{"location":"input-to-camera/","title":"Control by input","text":""},{"location":"input-to-camera/#introduction","title":"Introduction","text":"

    Control camera's scroll by pan/cursor-at-bounds(scroll), and zoom by pinch/mouse-wheel.

    • Author: Rex
    • Member of scene
    "},{"location":"input-to-camera/#live-demos","title":"Live demos","text":"
    • Camera controller
    "},{"location":"input-to-camera/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"input-to-camera/#install-plugin","title":"Install plugin","text":""},{"location":"input-to-camera/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcameracontrollerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcameracontrollerplugin.min.js', true);\n
    • Add camera-controller object
      var cameraController = scene.plugins.get('rexcameracontrollerplugin').add(scene, config);\n
    "},{"location":"input-to-camera/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CameraControllerPlugin from 'phaser3-rex-plugins/plugins/cameracontroller-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCameraController',\nplugin: CameraControllerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add camera-controller object
      var cameraController = scene.plugins.get('rexCameraController').add(scene, config);\n
    "},{"location":"input-to-camera/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CameraController from 'phaser3-rex-plugins/plugins/cameracontroller.js';\n
    • Add camera-controller object
      var cameraController = new CameraController(scene, config);\n
    "},{"location":"input-to-camera/#create-instance","title":"Create instance","text":"
    var cameraController = scene.plugins.get('rexCameraController').add(scene, {\n// camera: scene.cameras.main,\n// minZoom: undefined,\n// maxZoom: undefined,\n\n// panScroll: true,\n// panScrollEnable: true,\n\n// pinchZoom: true,\n// pinchZoomEnable: true,\n// pinchZoomMin: undefined,\n// pinchZoomMax: undefined,\n\n// inputTarget: undefined,\n\n// boundsScroll: true,\n// boundsScrollEnable: true,\n\n// mouseWheelZoom: truem\n// mouseWheelZoomEnable: true,\n// mouseWheelZoomStep: 0.01,\n// mouseWheelZoomMin: undefined,\n// mouseWheelZoomMax: undefined,\n\n// enable: true\n});\n
    • scene : Target scene.
    • camera :
      • undefined : Default camera of this scene.
      • A camera object : Control this camera object.
    • minZoom, maxZoom : Minumun/maximum camera zoom value for pinchZoom and mouseWheelZoom behaviors.
      • undefined : No max/min constraint. Default behavior.
    • Pan scroll:
      • panScroll : Set to false will discard pan-scroll controller. Default is true.
      • panScrollEnable : Set to true to enable pan-scroll behavior. Default value is true.
      • inputTarget :
        • undefined : Receive pan/pinch input by scene's input event. Default behavior.
        • A game object : Receive pan/pinch input only on this game object.
    • Pinch zoom:
      • pinchZoom : Set to false will discard pinch-zoom controller. Default is true.
      • pinchZoomEnable : Set to true to enable pinch-zoom behavior. Default value is true.
      • pinchZoomMin, pinchZoomMax : Minumun/maximum camera zoom value. Default value is minZoom, maxZoom.
      • inputTarget :
        • undefined : Receive pan/pinch input by scene's input event. Default behavior.
        • A game object : Receive pan/pinch input only on this game object.
    • cursor-at-bounds scroll :
      • boundsScroll : Set to false will discard cursor-at-bounds-scroller controller. Default is true.
      • boundsScrollEnable : Set to true to enable bounds-scroll behavior. Default value is true.
    • mouse-wheel zoom :
      • mouseWheelZoom : Set to false will discard mouse-wheel-zoom controller. Default is true.
      • mouseWheelZoomEnable : Set to true to enable mouse-wheel-zoom behavior. Default value is true.
      • mouseWheelZoomStep : Camera zoom incremental. Default value is 0.1.
      • mouseWheelZoomMin, mouseWheelZoomMax : Minumun/maximum camera zoom value. Default value is minZoom, maxZoom.
    • enable :
      • false : Disable all camera-controller temporary.
      • true : Restore all camera-controller's enable state to previous value. Default behavior.
    "},{"location":"input-to-camera/#set-target-camera","title":"Set target camera","text":"
    cameraController.setCamera(camera);\n
    "},{"location":"input-to-camera/#enable-controller-behavior","title":"Enable controller behavior","text":"
    • Pan-scroll
      cameraController.setPanScrollEnable(enable);\n// cameraController.panScrollEnable = enable;\n
    • Pinch-zoom
      cameraController.setPinchZoomEnable(enable);\n// cameraController.pinchZoomEnable = enable;\n
    • Bounds-scroll
      cameraController.setBoundsScrollEnable(enable);\n// cameraController.boundsScrollEnable = enable;\n
    • Wheel-zoom
      cameraController.setMouseWheelZoomEnable(enable);\n// cameraController.mouseWheelZoomEnable = enable;\n
    • Disable all behaviors
      cameraController.setEnable(false);\n// cameraController.enable = false;\n
    • Restore enable state of all behaviors
      cameraController.setEnable();\n// cameraController.enable = true;\n
    • Toggle enable state
      cameraController.toggleEnable();\n// cameraController.enable = !cameraController.enable;\n
    "},{"location":"input/","title":"Input","text":""},{"location":"input/#introduction","title":"Introduction","text":"

    Input system of each scene, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"input/#usage","title":"Usage","text":""},{"location":"input/#enabledisable","title":"Enable/disable","text":"
    scene.input.enabled = enabled; // enabled: true/false\n
    "},{"location":"inputtext/","title":"Input text","text":""},{"location":"inputtext/#introduction","title":"Introduction","text":"

    Input DOM element.

    • Author: Rex
    • DOM Game object
    "},{"location":"inputtext/#live-demos","title":"Live demos","text":"
    • Input text
    • Number input
    • In fullscreen
    "},{"location":"inputtext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"inputtext/#install-plugin","title":"Install plugin","text":""},{"location":"inputtext/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexinputtextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexinputtextplugin.min.js', true);\n
    • Add input-text object
      var inputText = scene.add.rexInputText(x, y, width, height, config);\n
    "},{"location":"inputtext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import InputTextPlugin from 'phaser3-rex-plugins/plugins/inputtext-plugin.js';\nvar config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexInputTextPlugin',\nplugin: InputTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add input-text object
      var inputText = scene.add.rexInputText(x, y, width, height, config);\n
    "},{"location":"inputtext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import InputText from 'phaser3-rex-plugins/plugins/inputtext.js';\n
    • Add input-text object
      var inputText = new InputText(scene, x, y, width, height, config);\nscene.add.existing(inputText);\n
    "},{"location":"inputtext/#add-input-text-object","title":"Add input text object","text":"
    var inputText = scene.add.rexInputText(x, y, width, height, config);\n// var inputText = scene.add.rexInputText(x, y, config);\n// var inputText = scene.add.rexInputText(config);\n

    Default configuration

    {\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\ntype: 'text',    // 'text'|'password'|'textarea'|'number'|'color'|...\n\n// Element properties\nid: undefined,\ntext: undefined,\nmaxLength: undefined,\nminLength: undefined,    placeholder: undefined,\ntooltip: undefined,\nreadOnly: false,\nspellCheck: false,\nautoComplete: 'off',\n\n// Style properties\nalign: undefined,\npaddingLeft: undefined,\npaddingRight: undefined,\npaddingTop: undefined,\npaddingBottom: undefined,\nfontFamily: undefined,\nfontSize: undefined,\ncolor: '#ffffff',\nborder: 0,\nbackgroundColor: 'transparent',\nborderColor: 'transparent',\nborderRadius: undefined,\noutline: 'none',\ndirection: 'ltr',\n\nselectAll: false\n}\n
    • x, y : Position
    • width, height : Size of element
    • type : Type of element
      • 'text', 'password', 'textarea', 'number', 'color', ...
    • Element properties
      • id : id element property.
      • text : value element property.
      • maxLength : maxLength element property.
      • minLength : minLength element property.
      • placeholder : placeholder element property.
      • tooltip : title element property.
      • readOnly : readonly element property.
      • spellCheck : spellcheck element property.
      • autoComplete : autocomplete element property.
    • Element style properties
      • align : text-align style property.
      • paddingLeft, paddingRight, paddingTop, paddingBottom : padding-left, padding-right, padding-top, padding-bottom style property.
      • fontFamily : font-family style property.
      • fontSize : font-size style property.
      • color : color style property.
      • backgroundColor : backgroundColor style property.
      • border, borderColor, borderRadius : border, borderColor, border-radius style property.
      • outline : outline style property.
      • direction : direction style property.
    • selectAll : Set true to select all text.
    "},{"location":"inputtext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends InputText {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var inputText = new MyText(scene, x, y, width, height, config);\n
    "},{"location":"inputtext/#text","title":"Text","text":"
    • Get
      var text = inputText.text;\n
    • Set
      inputText.setText(text);\n// inputText.text = text;\n
    • Scroll to bottom
      inputText.scrollToBottom();\n
    "},{"location":"inputtext/#style","title":"Style","text":"
    • Get
      var value = inputText.getStyle(key);\n
    • Set
      inputText.setStyle(key, value)\n
    "},{"location":"inputtext/#focus","title":"Focus","text":"
    • Focus
      inputText.setFocus();\n
    • Blur
      inputText.setBlur();\n
    • Is focused
      var isFocused = inputText.isFocused;\n
    "},{"location":"inputtext/#font-color","title":"Font color","text":"
    • Get
      var color = inputText.fontColor;\n// var color = inputText.node.style.color;\n
    • Set
      inputText.fontColor = color;  // CSS color string\n// inputText.node.style.color = color;\n
      or
      inputText.setFontColor(color);  // CSS color string\n
    "},{"location":"inputtext/#max-length","title":"Max length","text":"
    • Get
      var value = inputText.maxLength;\n
    • Set
      inputText.maxLength = value;\n
      or
      inputText.setMaxLength(value);\n
    "},{"location":"inputtext/#min-length","title":"Min length","text":"
    • Get
      var value = inputText.minLength;\n
    • Set
      inputText.minLength = value;\n
      or
      inputText.setMinLength(value);\n
    "},{"location":"inputtext/#placeholder","title":"Placeholder","text":"
    • Get
      var value = inputText.placeholder;\n
    • Set
      inputText.placeholder = value;\n
      or
      inputText.setPlaceholder(value);\n
    "},{"location":"inputtext/#tooltip","title":"Tooltip","text":"
    • Get
      var value = inputText.tooltip;\n
    • Set
      inputText.tooltip = value;\n
      or
      inputText.setTooltip(value);\n
    "},{"location":"inputtext/#readonly","title":"Readonly","text":"
    • Get
      var readOnly = inputText.readOnly;\n
    • Set
      inputText.readOnly = value;\n
      inputText.setReadOnly();\n// inputText.setReadOnly(value);\n
    "},{"location":"inputtext/#resize","title":"Resize","text":"
    inputText.resize(width, height);\n
    "},{"location":"inputtext/#select-text","title":"Select text","text":"
    • Select all text
      inputText.selectText();\n// inputText.selectAll();\n
    • Select sub-string
      inputText.selectText(selectionStart, selectionEnd);\n
    "},{"location":"inputtext/#cursor-position","title":"Cursor position","text":"
    • Get
      var cursorPosition = inputText.cursorPosition;\n
      • Equal to inputText.selectionStart.
    • Set
      inputText.setCursorPosition(cursorPosition);\ninputText.cursorPosition = cursorPosition;\n
      • Equal to inputText.setSelectionRange(cursorPosition, cursorPosition)
    "},{"location":"inputtext/#events","title":"Events","text":"
    • On text changed
      inputText.on('textchange', function(inputText, e){ }, scope);\n
    • On focus
      inputText.on('focus', function(inputText, e){ }, scope);\n
    • On blur
      inputText.on('blur', function(inputText, e){ }, scope);\n
    • On click, double click
      inputText.on('click', function(inputText, e){ }, scope);\n
      inputText.on('dblclick', function(inputText, e){ }, scope);\n
      • Touch/mouse events on input text object won't be propagated to game canvas.
    • On keydown, keyup
      inputText.on('keydown', function(inputText, e){ }, scope);\n
      inputText.on('keyup', function(inputText, e){ }, scope);\n
      • Keyboard events on input text object won't be propagated to game canvas.
    • On pointerdown, pointermove, pointerup
      inputText.on('pointerdown', function(inputText, e){ }, scope);\n
      inputText.on('pointermove', function(inputText, e){ }, scope);\n
      inputText.on('pointerup', function(inputText, e){ }, scope);\n
      • Mouse/touch events on input text object won't be propagated to game canvas.
    • On select
      inputText.on('select', function(inputText, e){ var selectedString = inputText.selectedText;\nvar selectionStart = inputText.selectionStart;\nvar selectionEnd = inputText.selectionEnd;\n}, scope);\n
    • On composition inpit
      inputText.on('compositionStart', function(inputText, e){ }, scope);\n
      inputText.on('compositionEnd', function(inputText, e){ }, scope);\n
      inputText.on('compositionUpdate', function(inputText, e){ }, scope);\n
    "},{"location":"inputtext/#bypass-key-input","title":"Bypass key input","text":"

    Registered keyboard events might capture key input.

    var keyObj = scene.input.keyboard.addKey('W', enableCapture, emitOnRepeat);\n

    Set enableCapture to false to bypass key input to this input-text game objecct.

    "},{"location":"inputtext/#other-properties","title":"Other properties","text":"

    See dom game object, game object

    "},{"location":"inputtext/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"inputtext/#close-editing","title":"Close editing","text":"
    • Close editing (set blur) when pointerdown outside
      scene.input.on('pointerdown', function () {\ninputText.setBlur();\n})\n
    • Close editing (set blur) when ENTER key press
      inputText.on('keydown', function (inputText, e) {\nif ((inputText.inputType !== 'textarea') && (e.key === 'Enter')) {\ninputText.setBlur();\n}\n})\n
      • inputType : 'text', 'textarea', ...
    "},{"location":"interception/","title":"Interception","text":""},{"location":"interception/#introduction","title":"Introduction","text":"

    Predict the intersection position of two game objects with constant moving speed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"interception/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"interception/#install-plugin","title":"Install plugin","text":""},{"location":"interception/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexinterceptionplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexinterceptionplugin.min.js', true);\n
    • Add interception behavior
      var interception = scene.plugins.get('rexinterceptionplugin').add(gameObject, config);\n
    "},{"location":"interception/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import InterceptionPlugin from 'phaser3-rex-plugins/plugins/interception-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexInterception',\nplugin: InterceptionPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add interception behavior
      var interception = scene.plugins.get('rexInterception').add(gameObject, config);\n
    "},{"location":"interception/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Interception from 'phaser3-rex-plugins/plugins/interception.js';\n
    • Add interception behavior
      var interception = new Interception(gameObject, config);\n
    "},{"location":"interception/#create-instance","title":"Create instance","text":"
    var interception = scene.plugins.get('rexInterception').add(gameObject, {\n// target: undefined,\n// enable: true\n});\n
    • target : Game object.
    • enable : Set true to enable predicting.
    "},{"location":"interception/#target","title":"Target","text":"
    • Set
      interception.setTarget(gameObject);\n
      or
      interception.target = gameObject;\n
    • Disalbe
      interception.setTarget(undefined);\n
      or
      interception.target = undefined;\n
    • Get
      var target = interception.target;\n
    "},{"location":"interception/#enable-predicting","title":"Enable predicting","text":"
    • Enable
      interception.setEnable();\n
    • Disable, uses target position as predicted position
      interception.setEnable(false);\n
    "},{"location":"interception/#predicted-result","title":"Predicted result","text":"
    • Predicted position
      var position = interception.predictedPosition; // {x, y}\n
    • Angle to predicted position
      var rotation = interception.predictedAngle; // Angle in radian\n
    "},{"location":"interpolation/","title":"Interpolation","text":""},{"location":"interpolation/#introduction","title":"Introduction","text":"

    Calculates interpolation value over t (0~1), built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"interpolation/#usage","title":"Usage","text":"
    • Linear interpolation (lerp) two values
      var result = Phaser.Math.Linear(p0, p1, t);\n
    • Linear interpolation (lerp) two Vectors
      var result = Phaser.Math.LinearXY(vector0, vector1, t);\n
      • vector0, vector1 : Phaser.Math.Vector2
    • Smooth interpolation
      var result = Phaser.Math.Interpolation.SmoothStep(t, min, max);\n
      • t : 0~1
    • Smoother interpolation
      var result = Phaser.Math.Interpolation.SmootherStep(t, min, max);\n
      • t : 0~1
    • Quadratic bezier interpolation
      var result = Phaser.Math.Interpolation.QuadraticBezier(t, p0, p1, p2);\n
      • t : 0~1
      • p0 : The start point.
      • p1 : The control point.
      • p2 : The end point.
    • Cubic bezier interpolation
      var result = Phaser.Math.Interpolation.CubicBezier(t, p0, p1, p2, p3);\n
      • t : 0~1
      • p0 : The start point.
      • p1 : The first control point.
      • p2 : The second control point.
      • p3 : The end point.
    "},{"location":"intouching/","title":"In touching","text":""},{"location":"intouching/#introduction","title":"Introduction","text":"

    Fires 'intouch' event every tick when pressing on a game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"intouching/#live-demos","title":"Live demos","text":"
    • Cooldown
    • Is in touching
    "},{"location":"intouching/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"intouching/#install-plugin","title":"Install plugin","text":""},{"location":"intouching/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexintouchingplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexintouchingplugin.min.js', true);\n
    • Add intouching behavior
      var intouching = scene.plugins.get('rexintouchingplugin').add(gameObject, config);\n
    "},{"location":"intouching/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import InTouchingPlugin from 'phaser3-rex-plugins/plugins/intouching-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexInTouchingn',\nplugin: InTouchingPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add intouching behavior
      var intouching = scene.plugins.get('rexInTouchingn').add(gameObject, config);\n
    "},{"location":"intouching/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import InTouching from 'phaser3-rex-plugins/plugins/intouching.js';\n
    • Add intouching behavior
      var intouching = new InTouching(gameObject, config);\n
    "},{"location":"intouching/#create-instance","title":"Create instance","text":"
    var intouching = scene.plugins.get('rexInTouching').add(gameObject, {\n// enable: true,\n// cooldown: undefined\n});\n
    • enable : Can touch.
    • cooldown : Fire 'intouch' event every tick, or periodically.
      • undefined : Fire 'intouch' event every tick.
    "},{"location":"intouching/#events","title":"Events","text":"
    • In-touching
      intouching.on('intouch', function (intouching, gameObject, pointer) {\n// ...\n}, scope);\n
    • Touching-start
      intouching.on('touchstart', function (intouching, gameObject) {\n// ...\n}, scope);\n
    • Touching-end
      intouching.on('touchend', function (intouching, gameObject) {\n// ...\n}, scope);\n
    "},{"location":"intouching/#in-touching","title":"In touching","text":"
    var isInTouching = intouching.isInTouching;\n
    "},{"location":"intouching/#enable","title":"Enable","text":"
    • Get
      var enabled = intouching.enable;  // enabled: true, or false\n
    • Set
      intouching.setEnable(enabled);  // enabled: true, or false\n// intouching.enable = enabled;\n
    • Toggle
      intouching.toggleEnable();\n
    "},{"location":"intouching/#cooldown","title":"Cooldown","text":"
    • Get
      var cooldownTime = intouching.cooldownTime;\n
    • Set
      intouching.setCooldown(time);\n
      or
      intouching.cooldownTime = cooldownTime;\n
    "},{"location":"keyboardcombo/","title":"Combo events","text":""},{"location":"keyboardcombo/#introduction","title":"Introduction","text":"

    Combo-keys events.

    • Author: Richard Davey
    "},{"location":"keyboardcombo/#usage","title":"Usage","text":"
    1. Create combo
      var keyCombo = scene.input.keyboard.createCombo(keys, {\n// resetOnWrongKey: true,\n// maxKeyDelay: 0,\n// resetOnMatch: false,\n// deleteOnMatch: false,\n});\n
      • keys : Array of keyCodes
        • In strings. ex: ['up', 'up', 'down', 'down'], or ['UP', 'UP', 'DOWN', 'DOWN']
        • In key map. ex: [Phaser.Input.Keyboard.KeyCodes.UP, ... ]
        • In numbers. ex: [38, 38, 40, 40]
      • resetOnWrongKey : Set true to reset the combo when press the wrong key.
      • maxKeyDelay : The max delay in ms between each key press. Set 0 to disable this feature.
      • resetOnMatch : Set true to reset the combo when previously matched.
      • deleteOnMatch : Set true to delete this combo when matched.
    2. Listen combo matching event
      scene.input.keyboard.on('keycombomatch', function (keyCombo, keyboardEvent) { /* ... */ });\n
    "},{"location":"keyboardevents/","title":"Keyboard events","text":""},{"location":"keyboardevents/#introduction","title":"Introduction","text":"

    Built-in keyboard events of phaser.

    • Author: Richard Davey
    "},{"location":"keyboardevents/#usage","title":"Usage","text":""},{"location":"keyboardevents/#quick-start","title":"Quick start","text":"
    • Is key-down/is key-up
      var keyObject = scene.input.keyboard.addKey('W');  // Get key object\nvar isDown = keyObject.isDown;\nvar isUp = keyObject.isUp;\nvar shiftKey = keyObject.shiftKey;\n
    • Key is down after a duration
      var keyObject = scene.input.keyboard.addKey('W');  // Get key object\nvar isDown = scene.input.keyboard.checkDown(keyObject, duration);\n
    • On key-down/on key-up
      var keyObject = scene.input.keyboard.addKey('W');  // Get key object\nkeyObject.on('down', function(event) { /* ... */ });\nkeyObject.on('up', function(event) { /* ... */ });\n
      or
      scene.input.keyboard.on('keydown-' + 'W', function (event) { /* ... */ });\nscene.input.keyboard.on('keyup-' + 'W', function (event) { /* ... */ });\n
    • Any key-down/any key-up
      scene.input.keyboard.on('keydown', function (event) { /* ... */ });\nscene.input.keyboard.on('keyup', function (event) { /* ... */ });\n
      • event : KeyboardEvent
        • event.code : 'Key' + 'W'
    "},{"location":"keyboardevents/#key-object","title":"Key object","text":"
    • Get key object
      var keyObject = scene.input.keyboard.addKey('W');  // see `Key map` section\n// var keyObject = scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W);\n
      or
      var keyObject = scene.input.keyboard.addKey('W', enableCapture, emitOnRepeat);\n
      • enableCapture : Automatically call preventDefault on the native DOM browser event for the key codes being added.
      • emitOnRepeat : Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default).
    • Get key objects
      var keyObjects = scene.input.keyboard.addKeys('W,S,A,D');  // keyObjects.W, keyObjects.S, keyObjects.A, keyObjects.D\n// var keyObjects = scene.input.keyboard.addKeys('W,S,A,D', enableCapture, emitOnRepeat);\n
      or
      var keyObjects = scene.input.keyboard.addKeys({\nup: 'W',\ndown: 'S',\nleft: 'A',\nright: 'D'\n});  // keyObjects.up, keyObjects.down, keyObjects.left, keyObjects.right\n
    • Remove key object
      scene.input.keyboard.removeKey('W');\n// scene.input.keyboard.removeKey(Phaser.Input.Keyboard.KeyCodes.W);\n// scene.input.keyboard.removeKey(key, destroy, removeCapture);\n
      • destroy : Call Key.destroy on each removed Key object
      • removeCapture : Remove all key captures for Key objects owened by this plugin?
    • Remove all key objects
      scene.input.keyboard.removeAllKeys(true);\n// scene.input.keyboard.removeAllKeys(destroy, removeCapture);\n
      • destroy : Call Key.destroy on each removed Key object
      • removeCapture : Remove all key captures for Key objects owened by this plugin?
    • Key-down/key-up state
      var isDown = keyObject.isDown;\nvar isUp = keyObject.isUp;\n
    • Duration of key-down
      var duration = keyObject.getDuration(); // ms\n
    • Enable/disable
      keyObject.enabled = enabled; // Set false to disable key event\n
    "},{"location":"keyboardevents/#key-object-of-cursorkeys","title":"Key object of cursorkeys","text":"
    1. Get key state object
      var cursorKeys = scene.input.keyboard.createCursorKeys();\n
    2. Get key state
      var isUpDown = cursorKeys.up.isDown;\nvar isDownDown = cursorKeys.down.isDown;\nvar isLeftDown = cursorKeys.left.isDown;\nvar isRightDown = cursorKeys.right.isDown;\nvar isSpaceDown = cursorKeys.space.isDown;\nvar isShiftDown = cursorKeys.shift.isDown;\n
    "},{"location":"keyboardevents/#order-of-key-downkey-up-events","title":"Order of key-down/key-up events","text":"
    1. Key-down/key-up events of key object
      var keyObject = scene.input.keyboard.addKey('W');  // Get key object\nkeyObject.on('down', function(event) { /* ... */ });\nkeyObject.on('up', function(event) { /* ... */ });\n
      • event.stopImmediatePropagation() : Stop any further listeners from being invoked in the current Scene.
      • event.stopPropagation() : Stop it reaching any other Scene.
    2. On key-down/on key-up
      scene.input.keyboard.on('keydown-' + 'W', function (event) { /* ... */ });\nscene.input.keyboard.on('keyup-' + 'W', function (event) { /* ... */ });\n
      • event.stopImmediatePropagation() : Stop any further listeners from being invoked in the current Scene.
      • event.stopPropagation() : Stop it reaching any other Scene.
      • Invoke event.preventDefault() to stop event propagation to native DOM.
    3. Any key-down/on key-up
      scene.input.keyboard.on('keydown', function (event) { /* ... */ });\nscene.input.keyboard.on('keyup', function (event) { /* ... */ });\n
      • event.key : 'a'
      • event.keyCode : 65
      • event.code : 'KeyA'
      • event.stopImmediatePropagation() : Stop any further listeners from being invoked in the current Scene.
      • event.stopPropagation() : Stop it reaching any other Scene.
    "},{"location":"keyboardevents/#destroy-key-object","title":"Destroy key object","text":"
    keyObject.destroy();\n
    "},{"location":"keyboardevents/#key-map","title":"Key map","text":"
    • A ~ Z
    • F1 ~ F12
    • BACKSPACE
    • TAB
    • ENTER
    • SHIFT
    • CTRL. ALT
    • PAUSE
    • CAPS_LOCK
    • ESC
    • SPACE
    • PAGE_UP, PAGE_DOWN
    • END, HOME
    • LEFT, UP, RIGHT,DOWN
    • PRINT_SCREEN
    • INSERT, DELETE
    • ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE
    • NUMPAD_ZERO, NUMPAD_ONE, NUMPAD_TWO, NUMPAD_THREE, NUMPAD_FOUR, NUMPAD_FIVE, NUMPAD_SIX, NUMPAD_SEVEN, NUMPAD_EIGHT, NUMPAD_NINE, NUMPAD_ADD, NUMPAD_SUBTRACT
    • OPEN_BRACKET, CLOSED_BRACKET
    • SEMICOLON_FIREFOX, COLON, COMMA_FIREFOX_WINDOWS, COMMA_FIREFOX, BRACKET_RIGHT_FIREFOX, BRACKET_LEFT_FIREFOX
    "},{"location":"keyshub/","title":"Keys hub","text":""},{"location":"keyshub/#introduction","title":"Introduction","text":"

    Key object interface mapping from multiple source of key objects.

    • Author: Rex
    • Member of scene
    "},{"location":"keyshub/#live-demos","title":"Live demos","text":"
    • Multiple mode
    • Single mode
    • Define key
    "},{"location":"keyshub/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"keyshub/#install-plugin","title":"Install plugin","text":""},{"location":"keyshub/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexkeyshubplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexkeyshubplugin.min.js', true);\n
    • Add keys-hub object
      var keysHub = scene.plugins.get('rexkeyshubplugin').add(scene, config);\n
    "},{"location":"keyshub/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import KeysHubPlugin from 'phaser3-rex-plugins/plugins/keyshub-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexKeysHub',\nplugin: KeysHubPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add keys-hub object
      var keysHub = scene.plugins.get('rexKeysHub').add(scene, config);\n
    "},{"location":"keyshub/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import KeysHub from 'phaser3-rex-plugins/plugins/keyshub.js';\n
    • Add keys-hub object
      var keysHub = new KeysHub(scene, config);\n
    "},{"location":"keyshub/#create-instance","title":"Create instance","text":"
    var keysHub = scene.plugins.get('rexKeysHub').add(scene, {\n// singleMode: false,\n});\n
    • singleMode :
      • true : Unplug old key object then plug new key object.
      • false : Plug new key object without unplug previous key object. Default behavior.
    "},{"location":"keyshub/#destroy","title":"Destroy","text":"
    keysHub.destroy();\n
    "},{"location":"keyshub/#plug-key-object","title":"Plug key object","text":"
    • Plug a set of key objects
      keysHub.plugKeyObject({\nkeyCode0: keyObject0,\nkeyCode1: keyObject1,\n// ...\n});\n
      for example :
      var keyObjects = scene.input.keyboard.addKeys({\nup: 'W',\ndown: 'S',\nleft: 'A',\nright: 'D'\n});\nkeysHub.plugKeyObject(keyObjects);\n
      var keyObjects = scene.input.keyboard.createCursorKeys();\nkeysHub.plugKeyObject(keyObjects);\n
      or
      var keyObjects = joystick.createCursorKeys();\nkeysHub.plugKeyObject(keyObjects);\n
      • keyObjects : {keyCode : keyObject}
      • joystick : Virtual joystick
    • Plug a key object
      keysHub.plugKeyObject(keyObject, keyCode);\n
    "},{"location":"keyshub/#unplug-key-object","title":"Unplug key object","text":"
    • Unplug a set of key objects
      keysHubunplugKeyObjects(keyObjects);\n
      • keyObjects : {keyCode : keyObject}
    • Unplugin a key object
      keysHub.unplugKeyObject(keyObject);\n
    "},{"location":"keyshub/#key-object-interfacee","title":"Key object interfacee","text":"
    • Get key object
      var keyObject = keysHub.addKey('W');  // see `Key map` section\n// var keyObject = keysHub.addKey(Phaser.Input.Keyboard.KeyCodes.W);\n
      or
      var keyObject = keysHub.addKey('W');\n
    • Get key objects
      var keyObjects = keysHub.addKeys('W,S,A,D');  // keyObjects.W, keyObjects.S, keyObjects.A, keyObjects.D\n
      or
      var keyObjects = keysHub.addKeys({\nup: 'W',\ndown: 'S',\nleft: 'A',\nright: 'D'\n});  // keyObjects.up, keyObjects.down, keyObjects.left, keyObjects.right\n
    • Get curor key objects
      var cursorKeys = keysHub.createCursorKeys();\n
    "},{"location":"keyshub/#get-plugged-key-objects","title":"Get plugged key objects","text":"
    var keyObject = keysHub.getKeyObjects(key);\n
    • key : Key string, or keyCode number.
    • keyObject :
      • A key object if singleMode is set to true
      • A list of key objects if if singleMode is set to false
    "},{"location":"keyshub/#re-define-key-map","title":"Re-define key map","text":"

    Set singleMode to ture when creating keysHub instance.

    "},{"location":"keyshub/#start-definition-task","title":"Start definition task","text":"
    keysHub.defineKeyStart(key);  // key: key string\n
    • Fire 'definekey.start' event
    "},{"location":"keyshub/#listen-key-input","title":"Listen key input","text":"
    • From keyboard
      keysHub.listenFromKeyboard();\n
    "},{"location":"keyshub/#cancel-definition-task","title":"Cancel definition task","text":"
    keysHub.defineKeyCancel();\n
    • Fire 'definekey.complete' event.
    "},{"location":"keyshub/#complete-definition-task","title":"Complete definition task","text":"

    Complete when any key input

    • Fire 'definekey.complete' event.
    "},{"location":"keyshub/#events","title":"Events","text":"
    • On key object plug
      keysHub.on('plug', function(key, keyObject) {\n\n})\n
    • On key object unplug
      keysHub.on('unplug', function(key, keyObject) {\n\n})\n
    • On define-key start
      keysHub.on('definekey.start', function(key) {\n\n})\n
    • On define-key complete
      keysHub.on('definekey.complete', function(key, keyObject) {\n\n})\n
      • key :
        • A string : Plug new key object to that Key object interface.
        • undefined : Cancel define-key task.
      • keyObject :
        • A key object : New plugged key object.
        • undefined : Remove current plugged key.
    "},{"location":"layer/","title":"Layer","text":""},{"location":"layer/#introduction","title":"Introduction","text":"

    A local display list, built-in game object of phaser.

    Layers have no position or size

    Layers have no position or size within the Scene

    • Cannot enable a Layer for physics or input.
    • Cannot change the position, rotation or scale of a Layer.
    • No scroll factor, texture, tint, origin, crop or bounds.

    Layers cannot be added to Containers

    Containers can be added to Layers, but Layers cannot be added to Containers.

    • Author: Richard Davey
    "},{"location":"layer/#usage","title":"Usage","text":""},{"location":"layer/#add-layer","title":"Add layer","text":"
    var layer = scene.add.layer();\n// var layer = scene.add.layer(children);\n
    • children : Array of game objects added to this layer.
    "},{"location":"layer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLayer extends Phaser.GameObjects.Layer {\nconstructor(scene, children) {\nsuper(scene, children);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var layer = new MyLayer(scene, children);\n
    "},{"location":"layer/#add-child","title":"Add child","text":"
    • Add child
      layer.add(gameObject);\n// layer.add(gameObjects);\n
      • gameObject : A game object, or an array of game objects.
    • Add child at
      layer.addAt(gameObject, index);\n
    • Replace child
      layer.replace(oldGameObject, newGameObject);\n
    "},{"location":"layer/#remove-child","title":"Remove child","text":"
    • Remove child
      var removed = layer.remove(gameObject);\n
    • Remove child at
      var removed = layer.removeAt(index);\n
    • Remove children between indexes
      var removed = layer.removeBetween(startIndex, endIndex);\n
    • Remove all children
      layer.removeAll();\n

    Removed game object won't be added to display list of scene, use

    gameObject.addToDisplayList();\n

    to add it back to scene's display list.

    "},{"location":"layer/#get-child","title":"Get child","text":"
    • Get child at
      var gameObject = layer.getAt(index);\n
    • Get first child by name
      var gameObject = layer.getByName(name);\n
    • Get first child by property
      var gameObject = layer.getFirst(property, value);\n// var gameObject = layer.getFirst(property, value, startIndex, endIndex);\n
    • Get random child
      var gameObject = layer.getRandom();\n// var gameObject = layer.getRandom(startIndex, length);\n
    • Get all children
      var gameObjects = layer.getAll();\n
    • Get index of child
      var index = layer.getIndex(gameObject);\n
    • Get child count
      var count = layer.count(property, value);\n
    • Get total children count
      var count = layer.length;\n
    • Has child
      var hasChild = layer.exists(gameObject);\n
    "},{"location":"layer/#iterate","title":"Iterate","text":"
    • Get first child (set iterator index to 0)
      var gameObject = layer.first;\n
    • Get last child (set iterator index to last)
      var gameObject = layer.last;\n
    • Get next child (increase iterator index, until last)
      var gameObject = layer.next;\n
    • Get previous child (decrease iterator index, until 0)
      var gameObject = layer.previous;\n
    "},{"location":"layer/#move-child","title":"Move child","text":"
    • Swap
      layer.swap(gameObject1, gameObject2);\n
    • Move to
      layer.moveTo(gameObject, index);\n
    • Bring to top
      layer.bringToTop(gameObject);\n
    • Send to back
      layer.sendToBack(gameObject);\n
    • Move up
      layer.moveUp(gameObject);\n
    • Move down
      layer.moveDown(gameObject);\n
    • Move child1 above child2
      layer.moveAbove(child1, child2);\n
    • Move child1 below child2
      layer.moveBelow(child1, child2);\n
    • Sort
      layer.sort(property);\n
      or
      layer.sort('', function(gameObject1, gameObject2) { return 1; // 0, or -1\n});\n
    • Reverse
      layer.reverse();\n
    • Shuffle
      layer.shuffle();\n

    Note

    Children game objects also sort by depth.

    "},{"location":"layer/#for-each-child","title":"For each child","text":"
    layer.each(function(gameObject) {\n\n}, scope);\n
    "},{"location":"layer/#set-property","title":"Set property","text":"
    layer.setAll(property, value);\n// layer.setAll(property, value, startIndex, endIndex);\n
    "},{"location":"layer/#events","title":"Events","text":"
    • On add game object
      layer.events.on('addedtoscene', function(gameObject, scene) {\n\n})\n
    • On remove game object
      layer.events.on('removedfromscene', function(gameObject, scene) {\n\n})\n

    layer.events references to scene.events.

    "},{"location":"layer/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"layer/#create-mask","title":"Create mask","text":"
    var mask = layer.createBitmapMask();\n

    See mask

    "},{"location":"layer/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"layermanager/","title":"Layer manager","text":""},{"location":"layermanager/#introduction","title":"Introduction","text":"

    A dictionary to store Layer game objects. Each layer can have a dedicate camera.

    • Author: Rex
    • Container of game objects
    "},{"location":"layermanager/#relationship-diagram","title":"Relationship diagram","text":"

    Camera - layer - game object

    graph RL\n\n    subgraph Cameras\n      cameraBG[BG]\n      cameraGO[GO]\n      cameraUI[UI]\n    end\n\n    subgraph Layers\n      subgraph BG\n        layerBGBottom[BG-bottom]\n        layerBG[BG]\n        layerBGTop[BG-top]\n      end\n\n      subgraph GO\n        layerGOBottom[GO-bottom]\n        layerGO[GO]\n        layerGOTop[GO-top]\n      end\n\n      subgraph UI\n        layerUIBottom[UI-bottom]\n        layerUI[UI]\n        layerUITop[UI-top]\n      end\n    end\n\n    layerBGBottom --> cameraBG\n    layerBG --> cameraBG\n    layerBGTop --> cameraBG\n\n    layerGOBottom --> cameraGO\n    layerGO --> cameraGO\n    layerGOTop --> cameraGO\n\n    layerUIBottom --> cameraUI\n    layerUI --> cameraUI\n    layerUITop --> cameraUI\n\n    subgraph GameObjects\n      goBG0[\"Background\"] --> layerBG\n      goBG1[\"Background\"] --> layerBG\n\n      go0[GameObject] --> layerGO\n      go1[GameObject] --> layerGO\n      go2[GameObject] --> layerGO\n      go3[GameObject] --> layerGO\n\n      goUI0[Panel] --> layerUI\n      goUI1[Panel] --> layerUI\n      goSYSUI[System dialog] --> layerUITop\n    end
    "},{"location":"layermanager/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"layermanager/#install-plugin","title":"Install plugin","text":""},{"location":"layermanager/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlayermanagerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlayermanagerplugin.min.js', true);\n
    • Add layer manager
      var layerManager = scene.plugins.get('rexlayermanagerplugin').add(scene, config);\n
    "},{"location":"layermanager/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LayerManagerPlugin from 'phaser3-rex-plugins/plugins/layermanager-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLayerManager',\nplugin: LayerManagerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add layer manager
      var layerManager = scene.plugins.get('rexLayerManager').add(scene, config);\n
    "},{"location":"layermanager/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LayerManager from 'phaser3-rex-plugins/plugins/layermanager.js';\n
    • Add move-to behavior
      var layerManager = new LayerManager(scene, config);\n
    "},{"location":"layermanager/#create-instance","title":"Create instance","text":"
    var layerManager = scene.plugins.get('rexLayerManager').add(scene, {\n// layers: ['layer0', 'layer1', ...]\n// layers: [{name, cameraName, scrollFactor}, ...]\n\n// depth: undefined,\n// rootLayer: undefined,\n});\n

    or

    var layerManager = scene.plugins.get('rexLayerManager').add(scene, ['layer0', 'layer1', ...]\n// [{name, cameraName, scrollFactor}, ...]\n);\n
    • layers : Add some initial layers
      • A string array : Add layers by string name
      • A array of plain object { name, cameraName, scrollFactor }
        1. Add layer by string name
        2. Apply scroll factor to all children of this layer.
        3. Bind this layer to dedicate camera (indexed by cameraName), ignore other cameras Add a new camera if this target camera is not existing
    • depth : Set depth to each layer game object.
      • undefined : Keep default depth value (0)
    • rootLayer : Add all layer game objects created by this layer-manager into this root layer.
    "},{"location":"layermanager/#destroy","title":"Destroy","text":"
    layerManager.destroy()\n

    Also destroy all layers in this layer manager.

    "},{"location":"layermanager/#add-layer","title":"Add layer","text":"
    layerManager.add(name);\n// layerManager.add(name, depth);\n
    "},{"location":"layermanager/#add-game-object-to-layer","title":"Add game object to layer","text":"
    layerManager.addToLayer(name, gameObject);\n
    • name : Name of layer
    • gameObject : Any kind of game object, include containerLite and related game objects.

    Note

    Print a warn message if specific layer is not existed.

    "},{"location":"layermanager/#get-layer","title":"Get layer","text":"
    • Get layer by name
      var layer = layerManager.getLayer(name);\n
    • Get all layers in this layer manager
      var layers = layerManager.getLayers();\n// var out = layerManager.getLayers(out);\n
    "},{"location":"layermanager/#has-layer","title":"Has layer","text":"
    var hasLayer = layerManager.has(name);\n// var hasLayer = layerManager.exists(name);\n
    "},{"location":"layermanager/#clear-layer","title":"Clear layer","text":"
    • Destroy all children at layer
      layerManager.clearLayer(name);\n
    • Move all children from layer to scene's display list
      layerManager.clearLayer(name, false);\n
    "},{"location":"layermanager/#change-depth","title":"Change depth","text":"
    • Bring a layer (layerName) to top of displayList
      layerManager.bringLayerToTop(layerName);\n
    • Send a layer (layerName) to bottom of displayList
      layerManager.sendLayerToBack(layerName);\n
    • Move a layer (layerName) above another layer (baseLayerName)
      layerManager.moveLayerAbove(layerName, baseLayerName)\n
    • Move a layer (layerName) below another layer (baseLayerName)
      layerManager.moveLayerBelow(layerName, baseLayerName)\n
    "},{"location":"layermanager/#set-scroll-factor","title":"Set scroll factor","text":"
    layerManager.setScrollFactor(scrollFactor);\n// layerManager.setScrollFactor(scrollFactorX, scrollFactorY);\n

    Apply scroll factor to all children of this layer.

    "},{"location":"layermanager/#bind-camera","title":"Bind camera","text":"
    • Set camera
      layerManager.setCamera(layerName, cameraName);\n
      Bind this layer to dedicate camera (indexed by cameraName), ignore other cameras Add a new camera if this target camera is not existing
    • Get camera
      var camera = layerManager.getCamera(layerName);\n
    "},{"location":"levelcounter/","title":"Level counter","text":""},{"location":"levelcounter/#introduction","title":"Introduction","text":"

    Map level value from experience value, by callback or a number array.

    • Author: Rex
    • Object
    "},{"location":"levelcounter/#live-demos","title":"Live demos","text":"
    • Exp-bar
    "},{"location":"levelcounter/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"levelcounter/#install-plugin","title":"Install plugin","text":""},{"location":"levelcounter/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlevelcounterplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlevelcounterplugin.min.js', true);\n
    • Add level-counter object
      var levelCounter = scene.plugins.get('rexlevelcounterplugin').add(config);\n
    "},{"location":"levelcounter/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LevelCounterPlugin from 'phaser3-rex-plugins/plugins/levelcounter-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLevelCounter',\nplugin: LevelCounterPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add level-counter object
      var levelCounter = scene.plugins.get('rexLevelCounter').add(config);\n
    "},{"location":"levelcounter/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LevelCounter from 'phaser3-rex-plugins/plugins/levelcounter.js';\n
    • Add level-counter object
      var levelCounter = new LevelCounter(config);\n
    "},{"location":"levelcounter/#create-instance","title":"Create instance","text":"
    var levelCounter = scene.plugins.get('rexLevelCounter').add({\ntable: function(level) { return level * 100; },\n// table: [0, 100, 200, 300,],\n\n// maxLevel: -1,\n\n// exp: 0,\n});\n
    • table : Level table, return experience value from level value. Level value starts from 0.
      • A callback
        function(level) {\nreturn experience;\n}\n
      • A number array : Experience value of each level.
    • maxLevel :
      • undefined : Default value
        • No upper limit for callback level table.
        • (table.length - 1) for number array level table.
      • A number : Maximum level value
    • exp : Initial experience value. Default value is 0.
    "},{"location":"levelcounter/#accumulate-experience","title":"Accumulate experience","text":"
    • Accumulate experience
      levelCounter.gainExp(incExp);\n// levelCounter.exp += incExp;\n
      or
      levelCounter.gainExp(incExp, callback, scope);\n
      • Will fire 'levelup' event, or invoke callback many times.
        function(level, fromExp, toExp, levelStartExp, levelEndExp){        }\n
        • level : To next level
        • fromExp, toExp : Experience increment from fromExp to toExp.
        • levelStartExp, levelEndExp : Range of this level.
    • Reset experience value
      levelCounter.resetExp(exp);\n
      • Won't fire 'levelup' event.
    • Force level up
      levelCounter.setLevel(level);\n
      or
      levelCounter.setLevel(level, callback, scope);\n
      • Will fire 'levelup' event, or invoke callback many times.
        function(level, fromExp, toExp, levelStartExp, levelEndExp){        }\n
        • level : To next level
        • fromExp, toExp : Experience increment from fromExp to toExp.
        • levelStartExp, levelEndExp : Range of this level.
    "},{"location":"levelcounter/#level-and-experience","title":"Level and experience","text":"
    • Get current experience
      var exp = levelCounter.getExp();\n// var exp = levelCounter.exp;\n
    • Get current level
      var level = levelCounter.getLevel();\n// var level = levelCounter.level;\n
    • Get current required experience to next level
      var exp = levelCounter.requiredExp;\n
    • Get experience of level
      var exp = levelCounter.getExp(level);\n
    • Get level from experience
      var level = levelCounter.getLevel(exp);\n
    • Get required experience to level
      var exp = levelCounter.getRequiredExpToNextLevel(level);\n// var exp = levelCounter.getRequiredExpToNextLevel(level, exp);\n
    "},{"location":"levelcounter/#events","title":"Events","text":"
    • Level-up when accumulating experience
      levelCounter.on('levelup', function(level, fromExp, toExp, levelStartExp, levelEndExp){        }, scope);\n
      • level : To next level
      • fromExp, toExp : Experience increment from fromExp to toExp.
      • levelStartExp, levelEndExp : Range of this level.
    "},{"location":"lifetime/","title":"Life time","text":""},{"location":"lifetime/#introduction","title":"Introduction","text":"

    Destroy game object when time-out.

    • Author: Rex
    • Behavior of game object
    "},{"location":"lifetime/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"lifetime/#install-plugin","title":"Install plugin","text":""},{"location":"lifetime/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlifetimeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlifetimeplugin.min.js', true);\n
    • Add life-time behavior
      var lifeTime = scene.plugins.get('rexlifetimeplugin').add(gameObject, config);\n
    "},{"location":"lifetime/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LifeTimePlugin from 'phaser3-rex-plugins/plugins/lifetime-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLifeTime',\nplugin: LifeTimePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add life-time behavior
      var lifeTime = scene.plugins.get('rexLifeTime').add(gameObject, config);\n
    "},{"location":"lifetime/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LifeTime from 'phaser3-rex-plugins/plugins/lifetime.js';\n
    • Add life-time behavior
      var lifeTime = new LifeTime(gameObject, config);\n
    "},{"location":"lifetime/#create-instance","title":"Create instance","text":"
    var lifeTime = scene.plugins.get('rexLifeTime').add(gameObject, {\nlifeTime: 1000,\n// destroy: true,\n// start: true\n});\n
    • lifeTime : Life time in ms.
    • destroy : Set true to destroy game object when time-out.
    • start: Set true to starting counting now.
    "},{"location":"lifetime/#events","title":"Events","text":"
    • On time-out
      lifeTime.on('complete', function(gameObject, lifeTime){});\n// lifeTime.once('complete', function(gameObject, lifeTime){});\n
    "},{"location":"lifetime/#life-time","title":"Life-time","text":"
    • Set
      lifeTime.setLifeTime(time);\n
    • Add to
      lifeTime.addToLifeTime(time);\n
    • Get life-time
      var time = lifeTime.lifeTime;\n
    • Get remainder time
      var time = lifeTime.remainder;\n
    • Is alive
      var isAlive = lifeTime.isAlive;\n
    "},{"location":"lifetime/#startstoppauseresume","title":"Start/Stop/Pause/Resume","text":"
    • Start
      lifeTime.start();\n
    • Stop
      lifeTime.stop();\n
    • Pause
      lifeTime.pause();\n
    • Resume
      lifeTime.resume();\n
    "},{"location":"light/","title":"Light","text":""},{"location":"light/#introduction","title":"Introduction","text":"

    lighting system from normal map.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"light/#usage","title":"Usage","text":""},{"location":"light/#light-system","title":"Light system","text":""},{"location":"light/#enable","title":"Enable","text":"
    • Enable
      scene.lights.enable();\n
    • Disable
      scene.lights.disable();\n
      or
      scene.lights.active = false;\n
    "},{"location":"light/#ambient-color","title":"Ambient color","text":"
    scene.lights.setAmbientColor(color);\n
    • color : Integer color value.
    "},{"location":"light/#light","title":"Light","text":"
    • Add
      var light = scene.lights.addLight(x, y, radius);\n// var light = scene.lights.addLight(x, y, radius, color, intensity);\n
      • x, y : The horizontal/vertical position of the Light.
      • radius : The radius of the Light.
      • color : The integer RGB color of the light. Default is 0xffffff.
      • intensity : The intensity of the Light.
    • Remove
      scene.lights.removeLight(light);\n
    "},{"location":"light/#position","title":"Position","text":"
    • Set
      light.setPosition(x, y);\n
      or
      light.x = x;\nlight.y = y;\n
    • Get
      var x = light.x;\nvar y = light.y;\n
    "},{"location":"light/#color","title":"Color","text":"
    • Set
      • Red, green, blue
        light.color.set(red, green, blue);\n
        or
        light.color.r = red;\nlight.color.g = green;\nlight.color.b = blue;\n
      • Integer value
        light.setColor(colorInteger);\n
    • Get
      • Red, green, blue
        var red = light.color.r;\nvar green = light.color.g;\nvar blue = light.color.b;\n
    "},{"location":"light/#size","title":"Size","text":"
    • Set
      light.setRadius(radius);\n// light.radius = radius;\n
      or
      light.diameter = diameter;\n// light.width = diameter;\n// light.height = diameter;\n// light.displayWidth = diameter;\n// light.displayHeight = diameter;\n
    • Get
      var radius = light.radius;\n
      or
      var diameter = light.diameter;\n// var diameter = light.displayWidth;\n// var diameter = light.displayHeight;\n// var diameter = light.width;\n// var diameter = light.height;\n
    "},{"location":"light/#intensity","title":"Intensity","text":"
    • Set
      light.setIntensity(intensity);\n
      or
      light.intensity = intensity;\n
    • Get
      var intensity = light.intensity;\n
    "},{"location":"light/#game-object","title":"Game object","text":""},{"location":"light/#load-texture-with-normal-map","title":"Load texture with normal map","text":"
    scene.load.image(key, [url, normalMapUrl]);\n
    • url : Url of texture.
    • url : Url of texture.
    • normalMapUrl : Url of normal map.
    "},{"location":"light/#apply-light-pipeline","title":"Apply light pipeline","text":"
    gameObject.setPipeline('Light2D');\n
    "},{"location":"line/","title":"Line","text":""},{"location":"line/#introduction","title":"Introduction","text":"

    Draw a line with start/end/body textures, extended from RenderTexture game object.

    • Author: Rex
    • Game object
    "},{"location":"line/#live-demos","title":"Live demos","text":"
    • Line
    "},{"location":"line/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"line/#install-plugin","title":"Install plugin","text":""},{"location":"line/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlineplugin.min.js', true);\n
    • Add line object
      var line = scene.add.rexLine(config);\n
    "},{"location":"line/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LinePlugin from 'phaser3-rex-plugins/plugins/line-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLinePlugin',\nplugin: LinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add line object
      var line = scene.add.rexLine(config);\n
    "},{"location":"line/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Line from 'phaser3-rex-plugins/plugins/line.js';\n
    • Add line object
      var line = new Line(scene, config);\nscene.add.existing(line);\n
    "},{"location":"line/#create-instance","title":"Create instance","text":"
    var line = scene.add.rexLine({\nstart: {\nx: 0, y: 0,\nkey: undefined, frame: undefined, origin: 0.5,\n},\n// start: key,\n// start: undefined,\n\nend: {\nx: 0, y: 0,\nkey: undefined, frame: undefined, origin: 1,\n},\n// end: key,\n// end: undefined,\n\nbody: {\nkey: undefined, frame: undefined, extendMode: 1,\nwidth: undefined,\n},\n// body: key,\n});\n
    • start : Configuration of line-start. Or texture key of line-start.
      • start.x, start.y : Position of line-start.
      • start.key, start.frame : Texrure of line-start.
      • start.origin : Origin of line-start. Default is 0.5.
    • end : Configuration of line-end. Or texture key of line-end.
      • end.x, end.y : Position of line-end.
      • end.key, end.frame : Texrure of line-end.
      • end.origin : Origin of line-end. Default is 1.
    • body : Configuration of line-body. Or texture key of line-body.
      • body.key, body.frame : Texrure of line-body. Line-body will be drawn repeatedly.
      • body.extendMode : Extend mode of line-body.
        • 0, or 'scale' : Draw line-body with scaled image game object.
        • 1, or 'repeat' : Draw line-body with tile-sprute game object. (Default value)
      • body.width : Line width.
    "},{"location":"line/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLine extends Line {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var line = new MyLine(scene, config);\n
    "},{"location":"line/#position-of-line-startline-end","title":"Position of line-start/line-end","text":"
    • Line start
      • Get
        var x0 = line.x0;\nvar y0 = line.y0;\n
      • Set
        line.setLineStartPosition(x, y);\n
        or
        line.x0 = x;\nline.y0 = y;\n
    • Line end
      • Get
        var x1 = line.x1;\nvar y1 = line.y1;\n
      • Set
        line.setLineEndPosition(x, y);\n
        or
        line.x1 = x;\nline.y1 = y;\n
    "},{"location":"line/#set-textures","title":"Set textures","text":"
    • Line-start
      • Set line-start texture
        line.setLineStartTexture(key, frameName);\n
      • Set origin of line-start texture
        line.setLineStartOrigin(origin);\n
        • origin : 0~1. Default is 0, to align the left side of line-start texture with start position.
    • Line-end
      • Set line-end texture
        line.setLineEndTexture(key, frameName);\n
      • Set origin of line-end texture
        line.setLineEndOrigin(origin);\n
        • origin : 0~1. Default is 1, to align the right side of line-end texture with end position.
    • Line-body
      • Set line-body texture
        line.setLineBodyTexture(key, frameName);\n
      • Set line-body extend mode
        line.setLineBodyExtendMode(mode);\n
        • mode :
          • 0, or 'scale' : Draw line-body with scaled image game object.
          • 1, or 'repeat' : Draw line-body with tile-sprute game object.
      • Set line-body width
        line.setLineBodyWidth(width);\n
    "},{"location":"line/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"line/#create-mask","title":"Create mask","text":"
    var mask = line.createBitmapMask();\n

    See mask

    "},{"location":"line/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"list-inputtext/","title":"Input text","text":"

    Solutions of single or multiple line(s) input text.

    • Input text game object (Display: dom / Edit: dom) :
      • Demo
        • type or inputType :
          • 'text' : Single line input.
          • 'textarea' : Multiple line input.
    • Text game object with Text edit behavior (Display: text / Edit: dom) :
      • Demo
        • type :
          • 'text' : Single line input.
          • 'textarea' : Multiple line input.
    • Text game object with Hidden text edit behavior (Display: text / Edit: text, invisible dom) :
      • Demo
        • type or inputType :
          • 'text' : Single line input.
          • 'textarea' : Multiple line input.
    • Canvas input game object (Display: canvas-input / Edit: canvas-input, invisible dom) :
      • Single line input
      • Multiple line input, Text area input
        • textArea : Set true for multiple line input.
    "},{"location":"live2d/","title":"Live2d","text":""},{"location":"live2d/#introduction","title":"Introduction","text":"

    Display live2d model.

    • Author: Rex
    • Game object
    "},{"location":"live2d/#live-demos","title":"Live demos","text":"
    • Transform and hit area
    • Change model

    The example Live2D models, Haru and Hiyori, are redistributed under Live2D's Free Material License.

    "},{"location":"live2d/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"live2d/#install-plugin","title":"Install plugin","text":""},{"location":"live2d/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlive2dplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlive2dplugin.min.js', true);\n
    • Load live2d core script, in preload stage
      scene.load.rexLive2dCoreScript(coreScriptURL);\n
    • Load model assets, in preload stage
      scene.load.rexLive2d(key, modelSettingURL);\n
    • Add live2d object
      var live2dGameObject = scene.add.rexLive2d(x, y, key, config);\n
    "},{"location":"live2d/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import Live2dPlugin from 'phaser3-rex-plugins/plugins/live2d-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLive2dPlugin',\nplugin: Live2dPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Load live2d core script, in preload stage
      scene.load.rexLive2dCoreScript(coreScriptURL);\n
    • Load model assets, in preload stage
      scene.load.rexLive2d(key, modelSettingURL);\n
    • Add live2d object
      var live2dGameObject = scene.add.rexLive2d(x, y, key, config);\n
    "},{"location":"live2d/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import {\nLive2dCoreScriptFileCallback,\nLive2dFileCallback,\nLive2dGameObject\n} from 'phaser3-rex-plugins/plugins/live2d.js';\n
    • Load live2d core script, in preload stage
      Live2dCoreScriptFileCallback.call(scene.load, coreScriptURL);\n
    • Load model assets, in preload stage
      Live2dFileCallback.call(scene.load, key, modelSettingURL);\n
    • Add live2d object
      var live2dGameObject = new Live2dGameObject(scene, x, y, key, config);\nscene.add.existing(live2dGameObject);\n
    "},{"location":"live2d/#create-instance","title":"Create instance","text":"
    var live2dGameObject = scene.add.rexLive2d(x, y, key, {\n// autoPlayIdleMotion: motionGroupName\n});\n
    • autoPlayIdleMotion : Start motion when idle (i.e. all motions are finished).

    Add live2d from JSON

    var live2d = scene.make.rexLive2d({\nx: 0,\ny: 0,\nkey: 256,\n// autoPlayIdleMotion: motionGroupName,\n\nadd: true\n});\n
    "},{"location":"live2d/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLive2d extends Live2d {\nconstructor(scene, x, y, key, config) {\nsuper(scene, x, y, key, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var live2dGameObject = new MyLive2d(scene, x, y, key, config);\n
    "},{"location":"live2d/#change-model","title":"Change model","text":"
    live2dGameObject.setModel(key);\n

    or

    live2dGameObject.setModel(key, {\n// autoPlayIdleMotion: motionGroupName\n})\n
    "},{"location":"live2d/#expression","title":"Expression","text":"
    • Set expression
      live2dGameObject.setExpression(name);\n
    • Get expression names
      var names = live2dGameObject.getExpressionNames();\n
      • names : Array of expression names
    "},{"location":"live2d/#motion","title":"Motion","text":"
    • Start motion
      live2dGameObject.startMotion(group, no);\n// live2dGameObject.startMotion(group, no, priority);\n
      • group : Group name of motion
      • no : Number of motion in group
      • priority : Priority of this motion
        • 'idle', or 1
        • 'normal', or 2, default value
        • 'force' or 3
    • Start random motion
      live2dGameObject.startMotion(group);\n// live2dGameObject.startMotion(group, undefined, priority);\n
    • Stop all motions
      live2dGameObject.stopAllMotions();\n
    • Get motion names
      var names = live2dGameObject.getMotionNames();\n
    • Get motion names of a group
      var names = live2dGameObject.getMotionNames(group);\n
      • group : Group name of motion
    • Get motion group names
      var names = live2dGameObject.getMotionGroupNames();\n
    • Get current playing motion names
      var names = live2dGameObject.getPlayinigMotionNames();\n
    • Is any motion playing?
      var isPlaying = live2dGameObject.isAnyMotionPlaying();\n
    • Start motion when idle (i.e. all motions are finished)
      live2dGameObject.autoPlayIdleMotion(group);\n
      • group : Group name of motion
    • Set time-scale
      live2dGameObject.setTimeScale(timeScale);\n
      or
      live2dGameObject.timeScale = timeScale;\n
    "},{"location":"live2d/#look-at","title":"Look at","text":"
    • Look at
      live2dGameObject.lookAt(x, y, {\n// camera: scene.cameras.main,\n\n// eyeBallX: 1, eyeBallY: 1,\n// angleX: 30, angleY: 30, angleZ: 30,\n// bodyAngleX: 10\n})\n
      • x, y : Look at position.
      • camera : Default value is scene.cameras.main.
      • eyeBallX, eyeBallY : Weight of parameter ParamEyeBallX, ParamEyeBallY.
      • angleX, angleY, angleZ : Weight of parameter ParamAngleX, ParamAngleY, ParamAngleZ.
      • bodyAngleX : Weight of parameter ParamBodyAngleX.
    • Look forward
      live2dGameObject.lookForward();\n
    "},{"location":"live2d/#lip-sync","title":"Lip sync","text":"
    • Set lip sync value
      live2dGameObject.setLipSyncValue(value);\n
      or
      live2dGameObject.lipSyncValue = value;\n
    • Get lip sync value
      var value = live2dGameObject.lipSyncValue;\n
    "},{"location":"live2d/#hit-test","title":"Hit test","text":""},{"location":"live2d/#touch-events","title":"Touch events","text":"
    1. Set interactive
      live2dGameObject.setInteractive();\n
    2. Register touch events of hit area
      • On pointer down
        live2dGameObject.on('pointerdown-' + hitAreaName, function(pointer, localX, localY, event){\n\n}, scope);\n
        or
        live2dGameObject.on('pointerdown', function(pointer, localX, localY, event){\nvar hitTestResult = live2dGameObject.getHitTestResult(); // {hitAreaName: isHit}\n}, scope);\n
      • On pointer up
        live2dGameObject.on('pointerup-' + hitAreaName, function(pointer, localX, localY, event){\n\n}, scope);\n
        or
        live2dGameObject.on('pointerup', function(pointer, localX, localY, event){\nvar hitTestResult = live2dGameObject.getHitTestResult(); // {hitAreaName: isHit}\n}, scope);\n
      • On pointer move
        live2dGameObject.on('pointermove-' + hitAreaName, function(pointer, localX, localY, event){\n\n}, scope);\n
        or
        live2dGameObject.on('pointermove', function(pointer, localX, localY, event){\nvar hitTestResult = live2dGameObject.getHitTestResult(); // {hitAreaName: isHit}\n}, scope);\n
    "},{"location":"live2d/#is-hit","title":"Is hit","text":"
    var isHit = live2dGameObject.hitTest(hitAreaName, x, y);\n// var isHit = live2dGameObject.hitTest(hitAreaName, x, y, camera);\n
    "},{"location":"live2d/#parameter","title":"Parameter","text":"
    1. Register parameter
      live2dGameObject.registerParameter(name);\n
      • name : Register parameter id = Param + capitalize(name)
    2. Reset and add value
      live2dGameObject\n.resetParameterValue(name)\n.addParameterValue(name, value);\n
      or
      var parameters = live2dGameObject.getParameters();  // {name: value}\nparameters[name] = value;\n
    "},{"location":"live2d/#limitation","title":"Limitation","text":"
    • alpha, tint properties does not work
    • Can't apply any post-fx effect or blend mode.
    "},{"location":"loader/","title":"Loader","text":""},{"location":"loader/#introduction","title":"Introduction","text":"

    Load assets, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"loader/#usage","title":"Usage","text":""},{"location":"loader/#loading-in-preload-stage","title":"Loading in preload stage","text":"
    scene.load.image(key, url);\n// scene.load.image(config); // config: {key, url}\n

    Loader in preload stage will start loading automatically by scene.

    "},{"location":"loader/#loading-after-preload-stage","title":"Loading after preload stage","text":"
    scene.load.image(key, url);   // add task\n// scene.load.image(config); // config: {key, url}\nscene.load.once('complete', callback, scope);  // add callback of 'complete' event\nscene.load.start();                     // start loading\n
    "},{"location":"loader/#set-path","title":"Set path","text":"
    scene.load.setPath(path)\n
    "},{"location":"loader/#more-configurations","title":"More configurations","text":"

    More configurations in game config

    loader:{\nbaseURL: '',\npath: '',\nenableParallel: true,\nmaxParallelDownloads: 4,\ncrossOrigin: undefined,\nresponseType: '',\nasync: true,\nuser: '',\npassword: '',\ntimeout: 0,\nmaxRetries: 2,\nwithCredentials: false,\nimageLoadType: 'XHR',    // 'HTMLImageElement' \nlocalScheme: [ 'file://', 'capacitor://' ]\n},\n
    "},{"location":"loader/#events","title":"Events","text":"
    • Load file complete event
      scene.load.on('filecomplete', function(key, type, data) {}, scope);\n
      scene.load.on('filecomplete-' + type + '-' + key, function(key, type, data) {}, scope);\n
    • Add loading file event
      scene.load.on('addfile', function(key, type, file) {}, scope);\n
    • Start loading
      scene.load.once('start', function(){}, scope);\n
    • Loading progressing
      scene.load.on('progress', function(progress){}, scope);\n
      • progress value will increase when a file is loaded, and decrease when a new file loading request is added.
        var loader = scene.load;\nvar total = loader.totalToLoad;\nvar remainder = loader.list.size + loader.inflight.size;\nvar progress = 1 - (remainder / total);\n
    • Loading file progressing
      scene.load.on('fileprogress', function(file, progress){\n// var key = file.key;\n}, scope);\n
    • Loading a file object successful
      scene.load.once('load', function(fileObj){}, scope);\n
    • Loading a file object failed
      scene.load.once('loaderror', function(fileObj){}, scope);\n
    • All loading completed
      • Before releasing resources
        scene.load.once('postprocess', function(loader){}, scope);\n
      • After releasing resources
        scene.load.once('complete', function(loader){}, scope);\n
    • Scene's 'preupdate', 'update', 'postupdate', 'render' events will be triggered during preload stage.
    "},{"location":"loader/#status-of-loader","title":"Status of loader","text":"
    • Ready to start loading
      var isReady = scene.load.isReady();\n
    • Is loading
      var isLoading = scene.load.isLoading();\n
    "},{"location":"loader/#file-types","title":"File types","text":""},{"location":"loader/#image","title":"Image","text":"
    • Image
      scene.load.image(key, url);\n// scene.load.image(key, url, xhrSettings);\n
      • url : Url of texture, or base64 string of Uri.
    • Image and normal map
      scene.load.image(key, [url, normalMapUrl]);\n// scene.load.image(key, [url, normalMapUrl], xhrSettings);\n
      • url : Url of texture, or base64 string of Uri.
      • normalMapUrl : Url of normal map.
    • SVG
      scene.load.svg(key, url);\n// scene.load.svg(key, url, svgConfig);\n// scene.load.svg(key, url, svgConfig, xhrSettings);\n
      • svgConfig : {width, height}, or {scale}
    • Html texture
      scene.load.htmlTexture(key, url, width, height);\n// scene.load.htmlTexture(key, url, width, height, xhrSettings);\n

    Get data from texture cache

    var cache = scene.textures;\nvar data = cache.get(key);\n
    "},{"location":"loader/#sprite-sheet","title":"Sprite sheet","text":"
    scene.load.spritesheet(key, url, {\n// frameWidth: frameWidth,\n// frameHeight: frameHeight,\n// startFrame: startFrame,\n// endFrame: endFrame,\n// margin: margin,\n// spacing: spacing\n});\n// scene.load.spritesheet(key, url, frameConfig, xhrSettings);\n

    Get data from texture cache

    var cache = scene.textures;\nvar data = cache.get(key);\n
    "},{"location":"loader/#texture-atlas","title":"Texture atlas","text":"
    scene.load.atlas(key, textureURL, atlasURL);\n// scene.load.atlas(key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings);\n

    Get data from texture cache

    var cache = scene.textures;\nvar data = cache.get(key);\n

    On load complete

    scene.load.on('filecomplete-atlasjson-' + key, function(key, type, data) {}, scope);\n
    "},{"location":"loader/#multi-file-texture-atlas","title":"Multi file texture atlas","text":"
    scene.load.multiatlas(key, atlasURL);\n// scene.load.multiatlas(key, atlasURL, path, baseURL, atlasXhrSettings);\n
    • atlasURL : The absolute or relative URL to load the texture atlas json data file from.
    • path : Optional path to use when loading the textures defined in the atlas data.
    • baseURL : Optional Base URL to use when loading the textures defined in the atlas data.
    "},{"location":"loader/#unity-texture-atlas","title":"Unity texture atlas","text":"
    scene.load.unityAtlas(key, textureURL, atlasURL);\n// scene.load.unityAtlas(key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings);\n
    "},{"location":"loader/#animation","title":"Animation","text":"
    scene.load.animation(key, url);\n// scene.load.animation(key, url, dataKey, xhrSettings);\n

    Get data from json cache

    var cache = scene.json;\nvar data = cache.get(key);\n
    "},{"location":"loader/#audio","title":"Audio","text":"
    scene.load.audio(key, urls);\n// scene.load.audio(key, urls, {instances: 1}, xhrSettings);\n
    • urls : The absolute or relative URL to load the audio files from, or a blob, or a base64 string of Uri.
    • config.instances : Number of audio instances for HTML5Audio. Defaults to 1.

    Get data from cache

    var cache = scene.cache.audio;\nvar data = cache.get(key);\n
    "},{"location":"loader/#audio-sprite","title":"Audio sprite","text":"
    scene.load.audioSprite(key, jsonURL, audioURL, audioConfig);\n// scene.load.audioSprite(key, jsonURL, audioURL, audioConfig, audioXhrSettings, jsonXhrSettings);\n
    • jsonURL : The absolute or relative URL to load the json file from.
    • audioURL : The absolute or relative URL to load the audio file from.
    • audioConfig : An object containing an instances property for HTML5Audio. Defaults to 1.
    "},{"location":"loader/#video","title":"Video","text":"
    scene.load.video(key, url, noAudio);\n// scene.load.video(key, url, noAudio, xhrSettings);\n
    • url : The absolute or relative URL to load the video files from, or a blob.
    • loadEvent : The load event to listen for when not loading as a blob.
      • 'loadeddata' : Data for the current frame is available. Default value.
      • 'canplay' : The video is ready to start playing.
      • 'canplaythrough' : The video can be played all the way through, without stopping.
    • asBlob : Load the video as a data blob, or via the Video element? Default value is false.
    • noAudio : Does the video have an audio track? If not you can enable auto-playing on it.
    • false : Has audio track, default behavior.

    Get data from video cache

    var cache = scene.video;\nvar data = cache.get(key);\n
    "},{"location":"loader/#bitmap-font","title":"Bitmap font","text":"
    scene.load.bitmapFont(key, textureURL, fontDataURL);\n// scene.load.bitmapFont(key, textureURL, fontDataURL, textureXhrSettings, fontDataXhrSettings);\n
    • textureURL : The absolute or relative URL to load the font image file from.
    • fontDataURL : The absolute or relative URL to load the font xml data file from, which created by software such as
      • Angelcode Bitmap Font Generator
      • Littera
      • Glyph Designer

    Get data from cache

    var cache = scene.cache.bitmapFont;\nvar data = cache.get(key);\n
    "},{"location":"loader/#tile-map","title":"Tile map","text":"
    • JSON : Created using the Tiled Map Editor and selecting JSON as the export format
      scene.load.tilemapTiledJSON(key, url);\n// scene.load.tilemapTiledJSON(key, url, xhrSettings);\n
    • CSV : Created in a text editor, or a 3rd party app that exports as CSV.
      scene.load.tilemapCSV(key, url);\n// scene.load.tilemapCSV(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.tilemap;\nvar data = cache.get(key);\n
    "},{"location":"loader/#text","title":"Text","text":"
    scene.load.text(key, url);\n// scene.load.text(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.text;\nvar data = cache.get(key);\n
    "},{"location":"loader/#json","title":"JSON","text":"
    scene.load.json(key, url);\n// scene.load.json(key, url, dataKey, xhrSettings);\n
    • dataKey : When the JSON file loads only this property will be stored in the Cache.

    Get data from cache

    var cache = scene.cache.json;\nvar data = cache.get(key);\n
    "},{"location":"loader/#xml","title":"XML","text":"
    scene.load.xml(key, url);\n// scene.load.xml(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.xml;\nvar data = cache.get(key);\n
    "},{"location":"loader/#html","title":"HTML","text":"
    scene.load.html(key, url);\n// scene.load.html(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.html;\nvar data = cache.get(key);\n
    "},{"location":"loader/#css","title":"CSS","text":"
    scene.load.css(key, url);\n// scene.load.css(key, url, xhrSettings);\n

    Get data from cache

    var cache = scene.cache.css;\nvar data = cache.get(key);\n
    "},{"location":"loader/#scene","title":"Scene","text":"
    scene.load.sceneFile(key, url);\n// scene.load.sceneFile(key, url, xhrSettings);\n

    The key matches the class name in the JavaScript file.

    "},{"location":"loader/#script","title":"Script","text":"
    scene.load.script(key, url);\n// scene.load.script(key, url, type, xhrSettings);\n
    • type :\u3000'script', or 'module'.
    "},{"location":"loader/#scripts","title":"Scripts","text":"
    scene.load.scripts(key, urlArray);\n// scene.load.scripts(key, urlArray, xhrSettings);\n

    Add scripts in the exact order of urlArray.

    "},{"location":"loader/#glsl","title":"GLSL","text":"
    scene.load.glsl(key, url);\n// scene.load.glsl(key, url, shaderType, xhrSettings);\n
    • shaderType : The type of shader.
      • 'fragment' : Fragment shader. Default value.
      • 'vertex' : Vertex shader.

    Get data from cache

    var cache = scene.cache.shader;\nvar data = cache.get(key);\n

    A glsl file can contain multiple shaders, all separated by a frontmatter block.

    ---\nname: type: ---\n\nvoid main(void)\n{\n}\n
    "},{"location":"loader/#binary","title":"Binary","text":"
    scene.load.binary(key, url, dataType);  // dataType: Uint8Array\n// scene.load.binary(key, url, dataType, xhrSettings);\n
    • dataType : Optional type to cast the binary file to once loaded.
      • Uint8Array, Uint8ClampedArray, Uint16Array Uint32Array
      • Int8Array, Int16Array, Int32Array
      • Float32Array, Float64Array
      • BigInt64Array, BigUint64Array

    Get data from cache

    var cache = scene.cache.binary;\nvar data = cache.get(key);\n
    "},{"location":"loader/#plugin","title":"Plugin","text":"
    scene.load.plugin(key, url, true); // start plugin when loaded\n// scene.load.plugin(key, url, true, undefined, xhrSettings);\n
    • url : File url or class instance.
    "},{"location":"loader/#scene-plugin","title":"Scene plugin","text":"
    scene.load.scenePlugin(key, url, systemKey, sceneKey);\n// scene.load.scenePlugin(key, url, systemKey, sceneKey, xhrSettings);\n
    • url : File url or class instance.
    "},{"location":"loader/#file-pack","title":"File pack","text":"

    Load files in JSON format.

    scene.load.pack(key, url);\n// scene.load.pack(key, url, dataKey, xhrSettings);\n

    or

    scene.load.pack(key, json);\n// scene.load.pack(key, json, dataKey);\n
    • dataKey : When the JSON file loads only this property will be stored in the Cache.

    JSON pack file:

    {\n'dataKey': {\n// \"prefix\": \"...\",          // optional, extend key by prefix\n// \"path\": \"...\",            // optional, extend url by path\n// \"defaultType\": \"image\",   // optional, default file type\n'files': [\n{\n'type': 'image',\n'key': '...',\n'url': '...'\n},\n{\n'type': 'image',\n'key': '...',\n'url': '...'\n}\n// ...\n]\n},\n\n'node0': {\n'node1': {\n'node2': {\n'files': [\n// ....\n]\n}\n}\n}\n// dataKey: 'node0.node1.node2'\n}\n

    File type:

    • audio
    • binary
    • glsl
    • html
    • htmlTexture
    • image
    • json
    • script
    • spritesheet
    • svg
    • text
    • tilemapCSV
    • tilemapJSON
    • xml

    Get pack json data from cache

    var cache = scene.cache.json;  // pack json is stored in json cache\nvar data = cache.get(key);\n

    Event name in 'filecomplete' event : 'filecomplete-packfile-' + key

    "},{"location":"loader/#remove-pack-assets","title":"Remove pack assets","text":"
    scene.load.removePack(key);\n// scene.load.removePack(key, dataKey);\n
    "},{"location":"loader/#replace","title":"Replace","text":"
    1. Remove key.
    2. Load file again.
    "},{"location":"loader/#cache","title":"Cache","text":""},{"location":"loader/#get-data","title":"Get data","text":"
    var cache = scene.cache.text;\nvar data = cache.get(key);\n
    "},{"location":"loader/#add-data","title":"Add data","text":"
    var cache = scene.cache.text;\nvar data = cache.add(key);\n
    "},{"location":"loader/#release-data","title":"Release data","text":"
    var cache = scene.cache.text;\ncache.remove(key);\n
    "},{"location":"loader/#data-in-cache","title":"Data in cache","text":"
    var cache = scene.cache.text;\nvar hasData = cache.exists(key);\n// var hasData = cache.has(key);\n
    "},{"location":"loader/#cache-events","title":"Cache events","text":"
    • Add any item
      cache.events.on('add', function(cache, key, item){\n\n})\n
    • Remove any item
      cache.events.on('remove', function(cache, key, item){\n\n})\n
    "},{"location":"loader/#xhr-settings-object","title":"XHR Settings Object","text":"

    Parameter xhrSettings

    {\nasync: true,\nuser: '',\npassword: '',\ntimeout: 0,\nheaders: undefined,\nheader: undefined,\nheaderValue: undefined,\nrequestedWith: undefined,\noverrideMimeType: undefined,\nwithCredentials: false\n}\n
    • user : Optional username for the XHR request.
    • password : Optional password for the XHR request.
    • timeout : Optional XHR timeout value.
    • headers, header, headerValue, requestedWith : This value is used to populate the XHR setRequestHeader
    • overrideMimeType : Provide a custom mime-type to use instead of the default.
    • withCredentials : Whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates. Setting withCredentials has no effect on same-site requests.
    "},{"location":"loading-animation-scene/","title":"Loading animation scene","text":""},{"location":"loading-animation-scene/#introduction","title":"Introduction","text":"

    Start loading animation scene, stop this scene when loading complete.

    • Author: Rex
    • Methods
    "},{"location":"loading-animation-scene/#live-demos","title":"Live demos","text":"

    Loading animation scene

    "},{"location":"loading-animation-scene/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"loading-animation-scene/#install-plugin","title":"Install plugin","text":""},{"location":"loading-animation-scene/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexloadinganimationsceneplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexloadinganimationsceneplugin.min.js', true);\n
    • In mainScene, start loading animation scene, or in animation scene, monitor loading status of mainScene.
      scene.plugins.get('rexloadinganimationsceneplugin').startScene(scene, animationSceneKey);\n
    • This plugin will also install AwaitLoader.
    "},{"location":"loading-animation-scene/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LoadingAnimationScenePlugin from 'phaser3-rex-plugins/plugins/loadinganimationscene-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLoadingAnimationScene',\nplugin: LoadingAnimationScenePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In mainScene, start loading animation scene, or in animation scene, monitor loading status of mainScene.
      scene.plugins.get('rexLoadingAnimationScene').startScene(config);\n
    • This plugin will also install AwaitLoader.
    "},{"location":"loading-animation-scene/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import StartLoadingAnimationScene from 'phaser3-rex-plugins/plugins/loadinganimationscene.js';\n
    • In mainScene, start loading animation scene, or in animation scene, monitor loading status of mainScene.
      StartLoadingAnimationScene(config);\n
    "},{"location":"loading-animation-scene/#start-loading-animation-scene","title":"Start loading animation scene","text":"

    In mainScene, start loading animation scene, or in animation scene, monitor loading status of mainScene.

    scene.plugins.get('rexLoadingAnimationScene').startScene({\nmainScene: animationScene:\n\nonLoadingComplete: undefined\nonLoadingProgress: undefined\n});\n
    • mainScene : Scene instaance of main scene.
    • animationScene : Scene instance or scene-key of animation scene.
      • This animation scene will be stopped wheen main scene's loading complete totally.
    • onLoadingComplete : Custom task invoked when loading complete.
      function(finishLoading, animationScene) {\n// finishLoading();\n}\n
      • Invoke finishLoading() method (later) to finish loading progress totally.
    • onLoadingProgress : Callback when loading progress is changing.
      function(progress, animationScene) {\n\n}\n
    "},{"location":"loadingprogress/","title":"Loading progress","text":""},{"location":"loadingprogress/#introduction","title":"Introduction","text":"

    Pop-up dialog for loading-progress, then scale-down this dialog.

    • Author: Rex
    • Behavior of game object
    "},{"location":"loadingprogress/#live-demos","title":"Live demos","text":"
    • Loading progress
    • Custom transit
    "},{"location":"loadingprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"loadingprogress/#install-plugin","title":"Install plugin","text":""},{"location":"loadingprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexloadingprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexloadingprogressplugin.min.js', true);\n
    • Add loading-progress behavior
      var loadingProgress = scene.plugins.get('rexloadingprogressplugin').add(gameObject, config);\n
    "},{"location":"loadingprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add loading-progress behavior
      var loadingProgress = scene.plugins.get('rexLoadingProgress').add(gameObject, config);\n
    "},{"location":"loadingprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LoadingProgress from 'phaser3-rex-plugins/plugins/loadingprogress.js';\n
    • Add loadingprogress behavior
      var loadingProgress = new LoadingProgressBehavoir(gameObject, config);\n
    "},{"location":"loadingprogress/#create-instance","title":"Create instance","text":"
    var loadingProgress = scene.plugins.get('rexLoadingProgress').add(gameObject, {\n// duration: {\n//     in: 200,\n//     out: 200\n// }\n\n// progress: function(gameObject, progress) {},\n// transitIn: function(gameObject, duration) {},\n// transitOut: function(gameObject, duration) {},\n});\n
    • gameObject : Game object for presenting loading-progress.
    • duration : Duration of transition-in, trantion-out.
      • duration.in : Duration of transition-in (open dialog).
        • 0 : No transition, open dialog immediately.-
      • duration.out : Duration of transition-out (close dialog). Game object will be destroyed after transiting out.
        • 0 : No transition, close dialog immediately.
    • progress : Callback of loading-progress
      function(gameObject, progress) {\n\n}\n
      • progress : Number between 0 to 1.
    • transitIn : Tween behavior of opening dialog.
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • transitOut : Tween behavior of closing dialog.
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    "},{"location":"loadingprogress/#events","title":"Events","text":"
    • On progress
      loadingProgress.on('progress', function(progress) {\n})\n
    • On opened dialog
      loadingProgress.on('open', function(gameObject, loadingProgress) {\n})\n
    • On closed dialog
      loadingProgress.on('close', function() {\n})\n
    "},{"location":"localforage-files/","title":"Files","text":""},{"location":"localforage-files/#introduction","title":"Introduction","text":"

    Save JSON data, using localforage.

    Each file contains header and content indexed by fileID.

    • Author: Rex
    • Member of scene
    "},{"location":"localforage-files/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"localforage-files/#install-plugin","title":"Install plugin","text":""},{"location":"localforage-files/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlocalforagefilesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlocalforagefilesplugin.min.js', true);\n
    • Add localforage-files object
      var fileManager = scene.plugins.get('rexlocalforagefilesplugin').add(config);\n
    "},{"location":"localforage-files/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FilesPlugin from 'phaser3-rex-plugins/plugins/localforagefiles-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFiles',\nplugin: FilesPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add localforage-files object
      var fileManager = scene.plugins.get('rexFiles').add(config);\n
    "},{"location":"localforage-files/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Files from 'phaser3-rex-plugins/plugins/localforagefiles.js';\n
    • Add localforage-files object
      var fileManager = new Files(config);\n
    "},{"location":"localforage-files/#create-instance","title":"Create instance","text":"
    var fileManager = scene.plugins.get('rexFiles').add.files({\n// name: 'files',\n// zip: true\n});\n
    • name : Storage name.
    • zip :
      • true : Save compressed stringify json data.
      • false : Save json data directly
    "},{"location":"localforage-files/#save-file","title":"Save file","text":"
    • Overwrite
      fileManager.save(fileID, header, content);\n
      • fileID : Unique ID of this file.
      • header : Header data for indexing, a JSON object.
        • Reserve keys : fileID.
      • content : Content/body, a JSON object.
        • Reserve keys : fileID.
    • Update
      fileManager.save(fileID, header, content, true);\n
    "},{"location":"localforage-files/#load-headers","title":"Load headers","text":"
    fileManager.loadHeaders()\n.then(function(result) { // var headers = result.headers;\n})\n.catch(function(result) {\n// var error = result.error;\n})\n
    • headers : Get header by headers[fileID], each header contains
      • header.fileID : Unique ID of this file.
    "},{"location":"localforage-files/#load-file","title":"Load file","text":"
    fileManager.load(fileID)\n.then(function(result) { // var header = result.header;\n// var content = result.content;\n// var fileID = result.fileID;\n})\n.catch(function(result) {\n// var error = result.error;\n// var fileID = result.fileID;\n})\n
    • header, content : Header/content of this file.
    • fileID : Unique ID of this file.
    • userID : User ID of file owner.
    "},{"location":"localforage/","title":"LocalForage","text":""},{"location":"localforage/#introduction","title":"Introduction","text":"

    Offline storage, improved.

    • Author: Mozilla
    "},{"location":"localforage/#usage","title":"Usage","text":"

    Official document

    Sample code

    By default, LocalForage selects backend drivers for the datastore in this order:

    1. IndexedDB
    2. WebSQL
    3. localStorage
    "},{"location":"localforage/#save-data","title":"Save data","text":"
    • Callback
      localforage.setItem(key, value, function(){ /* ... */ });\n
    • Promise
      localforage.setItem(key, value)\n.then(function(value){ /* ... */ })\n.catch(function(err){ /* ... */ });\n
    "},{"location":"localforage/#read-data","title":"Read data","text":"
    • Callback
      localforage.getItem(key, function(err, value){ /* ... */ });\n
    • Promise
      localforage.getItem(key)\n.then(function(value){ /* ... */ })\n.catch(function(err){ /* ... */ });\n
    "},{"location":"localforage/#remove-data","title":"Remove data","text":"
    • Callback
      localforage.removeItem(key, function(){ /* ... */ });\n
    • Promise
      localforage.removeItem(key)\n.then(function(value){ /* ... */ })\n.catch(function(err){ /* ... */ });\n
    "},{"location":"localstorage-data/","title":"Data manager","text":""},{"location":"localstorage-data/#introduction","title":"Introduction","text":"

    Sync data from data manager to local-storage.

    • Author: Rex
    • Member of scene

    Max Size

    5MB per app per browser.

    "},{"location":"localstorage-data/#live-demos","title":"Live demos","text":"
    • Extend game registry
    • New local storage data manager
    "},{"location":"localstorage-data/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"localstorage-data/#install-plugin","title":"Install plugin","text":""},{"location":"localstorage-data/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlocalstoragedataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlocalstoragedataplugin.min.js', true);\n
    • Extend existed data object (game.registry, or scene.data)
      var data = scene.plugins.get('rexlocalstoragedataplugin').extend(game.registry, config);\n// var data = scene.plugins.get('rexlocalstoragedataplugin').extend(scene.data, config);\n
    • New local storage data manager
      var data = scene.plugins.get('rexlocalstoragedataplugin').add(parent, config);\n
    "},{"location":"localstorage-data/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LocalStorageDataPlugin from 'phaser3-rex-plugins/plugins/localstoragedata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLocalStorageData',\nplugin: LocalStorageDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Extend existed data object (game.registry, or scene.data)
      var data = scene.plugins.get('rexLocalStorageData').extend(game.registry, config);\n// var data = scene.plugins.get('rexLocalStorageData').extend(scene.data, config);\n
    • New local storage data manager
      var data = scene.plugins.get('rexLocalStorageData').add(parent, config);\n
    "},{"location":"localstorage-data/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LocalStorageData from 'phaser3-rex-plugins/plugins/localstoragedata.js';\n
    • New local storage data manager
      var data = new LocalStorageData(parent, config);\n
    "},{"location":"localstorage-data/#create-instance","title":"Create instance","text":"
    var data = scene.plugins.get('rexLocalStorageData').add({\n// name: '',\n// load: true,\n// default: undefined,\n// reset: false\n});\n// var data = scene.plugins.get('rexLocalStorageData').add(parent, config);\n// var data = scene.plugins.get('rexRData').add(parent, eventEmitter, config);\n
    • name : Prefix of key in local storage.
    • load :
      • true : Load data from local storage. Default behavior.
      • false : Don't load data now.
    • default : Define valid keys and default values of loaded data.
      • undefined : Load all keys from local storage.
    • reset :
      • true : Reset all data to default values (default), clear keys which are not in defaultData.
    • parent : The object (a scene, or a game object) that this DataManager belongs to.
    • eventEmitter : The DataManager's event emitter.
    "},{"location":"localstorage-data/#load","title":"Load","text":"
    data.load(defaultData);\n// data.load(defaultData, reset);\n
    • defaultData : Define valid keys and default values of loaded data.
      • undefined : Load all keys from local storage. reset will be false in this case.
    • reset :
      • true : Reset all data to default values (defaultData), clear keys which are not in defaultData.

    Note

    Data loaded from local storage already, if load is true.

    "},{"location":"localstorage-data/#getsetremove-value","title":"Get/set/remove value","text":"

    See built-in data manager.

    "},{"location":"localstorage-data/#reserved-keys","title":"Reserved keys","text":"

    '__keys__' is used internally by this plugin.

    "},{"location":"localstorage-data/#get-default-value","title":"Get default value","text":"
    var value = data.getDefaultValue(key);\n
    "},{"location":"localstorage/","title":"LocalStorage","text":""},{"location":"localstorage/#introduction","title":"Introduction","text":"

    Store small data in key-value pairs locally within the user's browser.

    • Author: Built-in javascript function

    Max Size

    5MB per app per browser.

    "},{"location":"localstorage/#usage","title":"Usage","text":"

    Reference

    Sample code

    "},{"location":"localstorage/#save-data","title":"Save data","text":"
    localStorage.setItem(key, value);\n
    "},{"location":"localstorage/#read-data","title":"Read data","text":"
    var value = localStorage.getItem(key);\n

    Note

    The keys and the values are always strings. Objects, integer keys will be automatically converted to strings.

    "},{"location":"localstorage/#remove-data","title":"Remove data","text":"
    localStorage.removeItem(key);\n
    "},{"location":"lokijs/","title":"LokiJs","text":""},{"location":"lokijs/#introduction","title":"Introduction","text":"

    In-memory JavaScript Datastore with Persistence.

    • Reference
    • Document
    "},{"location":"lokijs/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"lokijs/#create-database","title":"Create database","text":"
    var db = new loki();\n// var db = new loki('loki.json', config);  // load database from file\n
    "},{"location":"lokijs/#create-collection","title":"Create collection","text":"
    var collection = db.addCollection(name);\n// var collection = db.addCollection(name, config);\n
    "},{"location":"lokijs/#get-collection","title":"Get collection","text":"
    var collection = db.getCollection(name);\n
    "},{"location":"lokijs/#insert-document","title":"Insert document","text":"
    var docInColl = collection.insert(doc);  // doc: an object\n

    Get Id

    var id = docInColl.$loki;\n
    "},{"location":"lokijs/#insert-documents","title":"Insert documents","text":"
    collection.insert(docArray);  // documents in array\n
    "},{"location":"lokijs/#query","title":"Query","text":""},{"location":"lokijs/#get-document-by-id","title":"Get document by id","text":"
    var doc = collection.get(id);  // id: `$loki`\n
    "},{"location":"lokijs/#get-doc-by-unique-index","title":"Get doc by unique index","text":"
    var doc = collection.by(key, value);\n
    "},{"location":"lokijs/#filter-documents","title":"Filter documents","text":"
    • $eq : filter for document(s) with property of (strict) equality
      var docArray = collection.find({key: value});\n// var docArray = collection.find({key: {'$eq': value});\n
    • $aeq : filter for document(s) with property of abstract (loose) equality
      var docArray = collection.find({key: {'$aeq': value}});\n
      For example
      var results = coll.find({age: {'$aeq': 20}});  // age == '20' or age == 20\n
    • $ne : filter for document(s) with property not equal to provided value
      var docArray = collection.find({key: {'$ne': value}});\n
    • $gt : filter for document(s) with property greater than provided value
      var docArray = collection.find({key: {'$gt': value}});\n
    • $gte : filter for document(s) with property greater or equal to provided value
      var docArray = collection.find({key: {'$gte': value}});\n
    • $lt : filter for document(s) with property less than provided value
      var docArray = collection.find({key: {'$lt': value}});\n
    • $lte : filter for document(s) with property less than or equal to provided value
      var docArray = collection.find({key: {'$lte': value}});\n
    • $between : filter for documents(s) with property between provided values
      var docArray = collection.find({key: {'$between': [value0, value1]}});\n
    • $in : filter for document(s) with property matching any of the provided array values
      var docArray = collection.find({key: {'$in': [value0, value1, ...]}});\n
      Your property should not be an array but your compare values should be.
    • $nin : filter for document(s) with property not matching any of the provided array values
      var docArray = collection.find({key: {'$nin': [value0, value1, ...]}});\n
    • $contains : filter for document(s) with property containing the provided value
      var docArray = collection.find({key: {'$contains': value}});\n
      Use this when your property contains an array but your compare value is not an array
    • $containsAny : filter for document(s) with property containing any of the provided values
      var docArray = collection.find({key: {'$containsAny': [value0, value1, ...]}});\n
    • $containsNone : filter for documents(s) with property containing none of the provided values
      var docArray = collection.find({key: {'$containsNone': [value0, value1, ...]}});\n
    • $regex : filter for document(s) with property matching provided regular expression
      var docArray = collection.find({key: {'$regex': pattern}});\n// var docArray = collection.find({key: {'$regex': [pattern, options]});\n
      For example
      var docArray = collection.find({key: { '$regex': 'din' }});\nvar docArray = collection.find({key: { '$regex': ['din', 'i'] }});\n
    • $dteq: filter for document(s) with date property equal to provided date value
      var docArray = collection.find({key: {'$dteq': new Date('1/1/2017')}});\n
    • $type : filter for documents which have a property of a specified type
      var docArray = collection.find({key: {'$type': value}}); // 'string', or 'number', ...\n
    • $size : filter for documents which have array property of specified size
      var docArray = collection.find({key: {'$size': value}});\n
      (does not work for strings)
    • $len : filter for documents which have string property of specified length
      var docArray = collection.find({key: {'$len': value}});\n
    • $or : filter for documents which meet any of the nested subexpressions
      var docArray = collection.find({'$or': [\n{key0: {'$lt': value0}},\n{key1: {'$gte': value1}},\n// ...\n]});\n
    "},{"location":"lokijs/#find-one-document","title":"Find one document","text":"
    var doc = collection.findOne({});\n
    "},{"location":"lokijs/#filter-by-function","title":"Filter by function","text":"
    var docArray = collection.where(function(doc){\n// ...\nreturn isPicked;  // true to pick this document\n})\n
    "},{"location":"lokijs/#sort","title":"Sort","text":"
    • Sort with a key
      var docArray = collection.chain().find({}).simplesort(key).data();  // ascending\n// var docArray = collection.chain().find({}).simplesort(key, {desc: true}).data();  // descending\n
    • Sort with mutiple keys
      var docArray = collection.chain().find({}).compoundsort([key0, key1]).data();  // key0, key1: ascending\n// var docArray = collection.chain().find({}).compoundsort([key0, [key1, true]]).data(); // key0: ascending, key1: descending\n
    • Sort with function
      var docArray = collection.chain().find({}).sort(\nfunction(doc1, doc2) {\nreturn result; // 0, 1, -1\n})\n.data();\n
      result:
      • 0: equal
      • 1: greater
      • -1: less
    "},{"location":"lokijs/#pagination","title":"Pagination","text":"

    Get documents from start to start+count-1.

    var docArray = collection.chain().find({}).offset(start).limit(count).data();\n
    "},{"location":"lokijs/#update","title":"Update","text":"

    Update each filtered documents.

    var docArray = collection.chain().find({}).update(\nfunction(doc) { //\nreturn doc;\n});\n
    "},{"location":"lokijs/#remove","title":"Remove","text":"

    Remove filtered documents.

    collection.chain().find({}).remove();\n
    "},{"location":"lokijs/#map","title":"Map","text":"

    Map document into a new anonymous collection, won't affect original collection.

    var docArray = collection.chain().find({}).map(\nfunction(doc) {\n// ...\nreturn doc\n})\n.data();\n
    "},{"location":"lokijs/#map-reduce","title":"Map-reduce","text":"
    1. Map document into a new anonymous collection
    2. Run reduceFn to get final result value from result set of step 1.
    var mapFn = function(doc) {\n// ...\nreturn doc\n};\nvar reduceFn = function(docArray) {\n// ...\nreturn result;\n}\nvar result = collection.chain().find({}).mapReduce(mapFn, reduceFn);\n
    "},{"location":"lokijs/#clone-result-set","title":"Clone result set","text":"
    var resultSet = collection.chain().find({});\nvar resultSetClone = resultSet.branch();\n\n// resultSetClone.find({}).data();\n
    "},{"location":"lokijs/#dynamic-view","title":"Dynamic view","text":"
    1. Create dynamic view
      var view = children.addDynamicView(name);\n
    2. Add filters
      • find
        view.applyFind({});\n
      • where
        view.applyWhere(function(doc) { return true; });\n
      • simple sort
        view.applySimpleSort(key);\n
      • sort by multiple keys
        view.applySortCriteria([key0, key1]);\n// view.applySortCriteria([key0, [key1, true]]);\n
      • sort function
        view.applySort(function(doc1, doc2) {\nreturn result; // 0, 1, -1\n});\n
        result:
        • 0: equal
        • 1: greater
        • -1: less
    3. Get result data
      var docArray = view.data();\n

    Add new filters

    var docArray = view.branchResultset().find({}).data();\n

    "},{"location":"lokijs/#speed-up-quering","title":"Speed-up quering","text":""},{"location":"lokijs/#custom-unique-index","title":"Custom unique index","text":"
    1. Define custom unique index
      var collection = db.addCollection(name, {\nunique: [key0]\n});\n
    2. Get document by custom unique index
      var doc = collection.by(key0, value);\n
    "},{"location":"lokijs/#binary-indices","title":"Binary indices","text":"
    1. Define binary index
      var collection = db.addCollection(name, {\nindices: [key0]\n});\n
      Or
      collection.ensureIndex(key);\n
    2. Get documents by normal filters
      var docArray = collection.find({key0: {'$gt': value}});\n
    "},{"location":"lokijs/#methods-of-collection","title":"Methods of collection","text":"
    • Average value of a property
      var avgValue = collection.avg(key);\n
    • Maximum value of a property
      var maxValue = collection.max(key);\n
    • Minimum value of a property
      var minValue = collection.min(key);\n
    • Median value of a property
      var medianValue = collection.median(key);\n
    • Amount of documents
      var amount = collection.count(query);  // {key: {'$gt': value}}\n
    "},{"location":"lokijs/#serialize-deserialize","title":"Serialize & Deserialize","text":"
    • Database as string
      var s = db.serialize();\n
    • Load database from string
      db.loadJSON(s);\n
    "},{"location":"luxon/","title":"Luxon","text":""},{"location":"luxon/#introduction","title":"Introduction","text":"

    Parse, validate, manipulate, and display dates and times. Reference

    "},{"location":"luxon/#usage","title":"Usage","text":"
    • Install
    • Getting started
      • Demo
      • A quick tour
      • API
    "},{"location":"luxon/#creating-a-datetime","title":"Creating a DateTime","text":"
    const dt = DateTime.local(2017, 5, 15, 8, 30);\n

    or

    var dt = DateTime.fromISO('2017-05-15');\n// var dt = DateTime.fromISO('2017-05-15T17:36');\n// var dt = DateTime.fromISO('2017-W33-4');\n// var dt = DateTime.fromISO('2017-W33-4T04:45:32.343');\n
    "},{"location":"luxon/#current-date-and-time","title":"Current date and time","text":"
    const now = DateTime.now();\n// const now = DateTime.local();\n
    "},{"location":"luxon/#json","title":"JSON","text":"
    • To JSON
      var json = dt.toObject();\n
    • From JSON
      var dt = DateTime.fromObject(json);\n// var dt = DateTime.fromObject({year: 2017, month: 5, day: 15, hour: 17, minute: 36});\n
    "},{"location":"luxon/#math","title":"Math","text":"
    var dt1 = dt0.plus({ hours: 3, minutes: 2 });\nvar dt1 = dt0.minus({ days: 7 });\nvar dt1 = dt0.startOf('day');\nvar dt1 = dt0.endOf('hour');\n
    "},{"location":"luxon/#difference","title":"Difference","text":"
    var i1 = DateTime.fromISO('1982-05-25T09:45'),\ni2 = DateTime.fromISO('1983-10-14T10:30');\ni2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\ni2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\ni2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\ni2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n
    "},{"location":"luxon/#durations","title":"Durations","text":"
    var dur = Duration.fromObject({ hours: 2, minutes: 7 });\n// dt.plus(dur);\n\ndur.as('seconds') //=> 7620\ndur.toObject()    //=> { hours: 2, minutes: 7 }\ndur.toISO()       //=> 'PT2H7M'\n
    "},{"location":"luxon/#parseformat","title":"Parse/Format","text":"
    • Parse
      var dt = DateTime.fromFormat('12-16-2017', 'MM-dd-yyyy');\n// var dt = DateTime.fromFormat('May 25, 1982', 'MMMM dd, yyyy');\n// var dt = DateTime.fromFormat('mai 25, 1982', 'MMMM dd, yyyy', { locale: 'fr' });\n
    • Format
      var s = dt.toFormat('MM-dd-yyyy');\n// var s = dt.toFormat('MMMM dd, yyyy')\n// var s = dt.setLocale('fr').toFormat('MMMM dd, yyyy')\n
    "},{"location":"luxon/#relative-time","title":"Relative time","text":"

    Returns a string representation of this date relative to today.

    var s = dt.toRelativeCalendar();\n
    var s = dt.toRelativeCalendar({\nbase: dt0,\nlocale: string,\nunit: string\n});\n
    • base : The DateTime to use as the basis to which this time is compared. Defaults to now.
    • locale : Override the locale of this DateTime.
    • unit : Use a specific unit; if omitted, the method will pick the unit. Use one of 'years', 'quarters', 'months', 'weeks', or 'days'
    "},{"location":"lzstring/","title":"LZ string","text":""},{"location":"lzstring/#introduction","title":"Introduction","text":"

    Compress string using LZ-based compression algorithm. Reference

    • Author: Rex
    • Member of scene
    "},{"location":"lzstring/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"lzstring/#install-plugin","title":"Install plugin","text":""},{"location":"lzstring/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlzstringplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlzstringplugin.min.js', true);\n
    • Add lz-string object
      var lzstring = scene.plugins.get('rexlzstringplugin').add(config);\n
    "},{"location":"lzstring/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LZStringPlugin from 'phaser3-rex-plugins/plugins/lzstring-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLZString',\nplugin: LZStringPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add lz-string object
      var lzstring = scene.plugins.get('rexLZString').add(config);\n
    "},{"location":"lzstring/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LZString from 'phaser3-rex-plugins/plugins/lzstring.js';\n
    • Add lz-string object
      var lzstring = new LZString(config);\n
    "},{"location":"lzstring/#create-instance","title":"Create instance","text":"
    var lzstring = scene.plugins.get('rexLZString').add({\n// encoding: 'none'     // 'none'|0, 'base64'|1, 'utf16'|2, 'uri'|3\n});\n
    • encoding :
      • 'none', or 0 : no encoding.
      • 'base64', or 1 : base64 encoding.
      • 'utf16', or 2 : UTF16 encoding.
      • 'uri', or 3 : URI encoding.
    "},{"location":"lzstring/#compression","title":"Compression","text":"
    var compressionResult = lzstring.compress(src);\n
    "},{"location":"lzstring/#decompression","title":"Decompression","text":"
    var decompressionResult = lzstring.decompress(compressionResult);\n
    "},{"location":"lzstring/#set-encoding","title":"Set encoding","text":"
    lzstring.setEncoding(m);  // 0|'none'|1|'base64'|2|'utf16'|3|'uri'\n
    "},{"location":"mainloop/","title":"Main loop","text":"
    1. game.events prestep event. Global Managers like Input and Sound update.
      1. trigger game.sound.update()
    2. game.events step event. User-land code and plugins
      • Register event
        scene.game.events.on('step', function(time, delta){\n//\n}, scope);\n
    3. Update the Scene Manager and all active Scenes
      1. scene.events preupdate event
        • Register event
          scene.events.on('preupdate', function(time, delta){\n//\n}, scope);\n
        • InputPlugin.preUpdate()
        • TweenManager.preUpdate() to arrange active targets
        • UpdateList.preUpdate(), to arrange game objects in UpdateList
      2. scene.events update event
        • Register event
          scene.events.on('update', function(time, delta){\n//\n}, scope);\n
        • TweenManager.update(), to run active tweens
        • UpdateList.update
          • gameObject.preUpdate
        • Update arcade world
      3. scene.update()
      4. scene.events postupdate event
        • Register event
          scene.events.on('postupdate', function(time, delta){\n//\n}, scope);\n
    4. game.events poststep event. Final event before rendering starts.
      • Register event
        scene.game.events.on('poststep', function(time, delta){\n//\n}, scope);\n
    5. game.renderer.preRender()
    6. game.events prerenderclear event
      • Register event
        scene.game.events.on('prerenderclear', function(){\n//\n}, scope);\n
    7. game.events prerender event
      • Register event
        scene.game.events.on('prerender', function(){\n//\n}, scope);\n
    8. SceneManager.render()
      1. Sort display list
      2. scene.events prerender event
        • Register event
          scene.events.on('prerender', function(renderer){\n//\n}, scope);\n
      3. Render cameras
      4. scene.events render event
        • Register event
          scene.events.on('render', function(renderer){\n//\n}, scope);\n
    9. game.renderer.postRender()
    10. game.events postrender event. Final event before the step repeats.
      • Register event
        scene.game.events.on('postrender', function(renderer, time, delta){\n//\n}, scope);\n

    Note

    Each scene is a standalone system.

    "},{"location":"mainloop/#flow-chart","title":"Flow chart","text":""},{"location":"mainloop/#game-loop","title":"Game loop","text":"
    graph TB\n\nsubgraph Render\nGameRenderPreRender[\"game.renderer.preRender()\"]\nGameEventPreRenderClear>\"game.events: prerenderclear\"]\nGameEventPreRender>\"game.events: prerender\"]\nSceneManagerRender[\"SceneManager.render()<br>...See 'Scene steps'...\"]\nGameRenderPostRender[\"game.renderer.postRender()\"]\nGameEventPostRender>\"game.events: postrender\"]\nend\n\nsubgraph Step\nGameEventPreStep>\"game.events: prestep<br><br>sound.update()\"]\nGameEventStep>\"game.events: step\"]\nSceneManagerUpdate[\"SceneManager.update()<br>...See 'Scene steps'...\"]\nGameEventPostStep>\"game.events: poststep\"]\nend\n\n\nGameEventPreStep --> GameEventStep\nGameEventStep --> SceneManagerUpdate\nSceneManagerUpdate --> GameEventPostStep\nGameEventPostStep --> GameRenderPreRender\nGameRenderPreRender --> GameEventPreRenderClear\nGameEventPreRenderClear --> GameEventPreRender\nGameEventPreRender --> SceneManagerRender\nSceneManagerRender --> GameRenderPostRender\nGameRenderPostRender --> GameEventPostRender\nGameEventPostRender --> GameEventPreStep
    "},{"location":"mainloop/#scene-steps","title":"Scene steps","text":"
    graph TB\n\nsubgraph Render\nSceneEventPreRender>\"scene.events: prerender\"]\nSceneCameraRender[\"scene.cameras.render()\"]\nSceneEventRender>\"scene.events: render\"]\nend\n\nsubgraph Update\nSceneEventPreUpdate>\"scene.events: preupdate<br><br>InputPlugin.preUpdate()<br>TweenManager.preUpdate()<br>UpdateList.preUpdate()\"]\nSceneEventUpdate>\"scene.events: update<br><br>TweenManager.update()<br>UpdateList.update()<br>gameObject.preUpdate()\"]\nSceneUpdate[\"scene.update()\"]\nSceneEventPostUpdate>\"scene.events: postupdate\"]\nend\n\n\nSceneEventPreUpdate --> SceneEventUpdate\nSceneEventUpdate --> SceneUpdate\nSceneUpdate --> SceneEventPostUpdate\n\nSceneEventPostUpdate -.-> SceneEventPreRender\nSceneEventPreRender --> SceneCameraRender\nSceneCameraRender --> SceneEventRender
    "},{"location":"mainloop/#rendering-order","title":"Rendering order","text":"
    • For each scene from bottom to top, in game
      • For each camera from bottom to top, in scene
        • For each game object from bottom to top in scene's displayList
          • Render this game object
            • Render children game objects, if game object is a container or a layer

    Note

    A game object can be seen by all cameras of this scene, therefore game object could be rendering more than one times.

    See also Ignore game object

    "},{"location":"markedeventsheet/","title":"Markdown event sheets","text":""},{"location":"markedeventsheet/#introduction","title":"Introduction","text":"

    Event sheets contains main condition(s) and actions, in simple markdown format (headings, code block).

    • Author: Rex
    • Member of scene
    "},{"location":"markedeventsheet/#live-demos","title":"Live demos","text":"
    • Command executor
    "},{"location":"markedeventsheet/#usage","title":"Usage","text":"
    • Sample code
    • Event sheets
    "},{"location":"markedeventsheet/#install-plugin","title":"Install plugin","text":""},{"location":"markedeventsheet/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmarkedeventsheetsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmarkedeventsheetsplugin.min.js', true);\n
    • Add event-sheet-manager object
      var eventSheetManager = scene.plugins.get('rexmarkedeventsheetsplugin').add(config);\n
    "},{"location":"markedeventsheet/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import MarkedEventSheetsPlugin from 'phaser3-rex-plugins/plugins/markedeventsheets-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexMarkedEventSheets',\nplugin: MarkedEventSheetsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add event-sheet-manager object
      var eventSheetManager = scene.plugins.get('rexMarkedEventSheets').add(config);\n
    "},{"location":"markedeventsheet/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import MarkedEventSheets from 'phaser3-rex-plugins/plugins/markedeventsheets.js';\n
    • Add event-sheet-manager object
      var eventSheetManager = new MarkedEventSheets(config);\n
    "},{"location":"markedeventsheet/#create-instance","title":"Create instance","text":"
    var eventSheetManager = scene.plugins.get('rexMarkedEventSheets').add({\ncommandExecutor: Object,\nparallel: false\n});\n
    • commandExecutor : Command executor of actions.
      • This plugin provides a built-in command executor.
    • parallel :
      • false : Test condition then execute event sheet one by one. Default behavior.
      • true : Test all condition of event sheets then execute event sheets one by one.
    "},{"location":"markedeventsheet/#add-event-sheet","title":"Add event sheet","text":"

    Each event sheet belong a group.

    eventSheetManager.addEventSheet(content, {\ncommentLineStart: '\\/\\/',\nlineBreak: '\\\\',\nparallel: undefined,\nactive: true,\nonce: false\n})\n

    or

    eventSheetManager.addEventSheet(content, groupName, {\ncommentLineStart: '\\/\\/',\nlineBreak: '\\\\',\nparallel: undefined,\nactive: true,\nonce: false\n})\n

    or

    eventSheetManager.addEventSheet(content, {\ngroupName: '_'\ncommentLineStart: '\\/\\/',\nlineBreak: '\\\\',\nparallel: undefined,\nactive: true,\nonce: false\n})\n
    • content : See structure of event sheet
    • commentLineStart : Content line start by this symobl (default value is //) will be ignored as a comment line.
    • lineBreak : Markdown will use \\ as line break. So the last character \\ will be discarded.
    • parallel :
      • undefined : Use default parallel property.
    • active :
      • true : Eval condition of this event sheet every round. Default behavior.
      • false : Skip this event sheet.
    • once :
      • true : Set active of this event sheet to false when exection of this event sheet is complete.
      • false : Do nothing when exection of this event sheet is complete. Default behavior.
    • groupName : Each event sheet belong a group. Ignore this parameter to use default group.
      • '_' : Default group name.
    "},{"location":"markedeventsheet/#remove-event-sheet","title":"Remove event sheet","text":"
    • Remove an event sheet in default group
      eventSheetManager.removeEventSheet(title);\n
    • Remove an event sheet in a specific group
      eventSheetManager.removeEventSheet(title, groupName);\n
    • Remove all event sheets in default group
      eventSheetManager.removeAllEventSheets();\n
    • Remove all event sheets in a specific group
      eventSheetManager.removeAllEventSheets(groupName);\n
    "},{"location":"markedeventsheet/#start-running","title":"Start running","text":"

    Starting command will be ignored if group is running.

    "},{"location":"markedeventsheet/#start-running-a-group-of-event-sheets","title":"Start running a group of event sheets","text":"
    • Start running default group
      eventSheetManager.startGroup();\n
    • Start running a specific group of event sheets
      eventSheetManager.startGroup(groupName);\n
    "},{"location":"markedeventsheet/#flow-chart","title":"Flow chart","text":"
    graph TD\n\n    startGroup{{\"startGroup()\"}}  ------>  eventstart>Fire event\\nstart]\n    eventstart --> foreacheventsheet((For each\\nevent sheet))\n    foreacheventsheet --> |Next| activate{activate}\n\n    subgraph Event sheet\n    activate --> |True| condition{\"Test\\n[condition]\"}\n    condition --> |True| enterevent>Fire event\\neventsheet.enter]\n    condition --> |False| eventcatch>Fire event\\neventsheet.catch] \n\n    subgraph Run\n    enterevent --> actions[Run\\nactions\\n...\\n...]\n    actions --> exitevent>Fire event\\neventsheet.exit]    \n    end\n\n    subgraph Catch\n    eventcatch --> catch[\"Run\\n[catch]\"]\n    end\n\n    end\n\n    exitevent --> foreacheventsheet\n    catch --> foreacheventsheet\n\n    activate --> |False| foreacheventsheet\n\n    foreacheventsheet --> eventcomplete>Fire event\\ncomplete]\n    eventcomplete --> endnode{{End}}
    "},{"location":"markedeventsheet/#start-running-a-event-sheet-in-a-group","title":"Start running a event sheet in a group","text":"
    • Start running default group
      eventSheetManager.start();\n
    • Start running an event sheet (indexed by title) without condition testing, in default group.
      eventSheetManager.start(title);\n
    • Start running an event sheet (indexed by title) without condition testing, in a specific group.
      eventSheetManager.start(title, groupName);\n
    • Start running an event sheet (indexed by title) with condition testing, in default group.
      eventSheetManager.start(title, false);\n
    • Start running an event sheet (indexed by title) with condition testing, in a specific group.
      eventSheetManager.start(title, groupName, false);\n
    "},{"location":"markedeventsheet/#start-running-a-group-by-event","title":"Start running a group by event","text":"
    eventSheetManager.startGroup(eventName, groupName);\n// eventSheetManager.startGroup(eventName, groupName, once);\n

    or

    eventSheetManager.startGroup({\neventName:\ngroupName:\nonce: false\n});\n
    "},{"location":"markedeventsheet/#round-counter","title":"Round counter","text":"

    Round counter is started from 0.

    • Increase round counter
      eventSheetManager.updateRoundCounter();\n// eventSheetManager.$roundCounter += 1;\n
    • Set round counter
      eventSheetManager.updateRoundCounter(value);\n// eventSheetManager.$roundCounter = value;\n
    • Get round counter
      var roundCounter = eventSheetManager.getRoundCounter();\n// var roundCounter = eventSheetManager.$roundCounter;\n
    "},{"location":"markedeventsheet/#active","title":"Active","text":"
    • Activate state of event sheet (indexed by title)
      eventSheetManager.setEventSheetActiveState(title);\n// eventSheetManager.setEventSheetActiveState(title, true);\n
    • Inactivate state of event sheet (indexed by title)
      eventSheetManager.setEventSheetActiveState(title, false);\n
    • Get active state of event sheet (indexed by title)
      var active = eventSheetManager.getEventSheetActiveState(title);\n

    Note

    Event sheet which has once property will set active property to false when exection of this event sheet is complete.

    "},{"location":"markedeventsheet/#stop-running","title":"Stop running","text":"

    Stop running a group of event sheet, also fires 'eventsheet.exit' event. And game objects with 'autoClear' will be destroyed.

    • Stop running default group
      eventSheetManager.stopGroup();\n
      or
      eventSheetManager.stop();\n
    • Stop running a specific group of event sheets
      eventSheetManager.stopGroup(groupName);\n
      or
      eventSheetManager.stop(groupName);\n
    "},{"location":"markedeventsheet/#local-memory","title":"Local memory","text":"

    Local memory is shared for all event sheets.

    • Set value
      eventSheetManager.setData(key, value);\n
      or
      eventSheetManager.setData(data);  // data : a plain json object\n
    • Toggle value
      eventSheetManager.toggleData(key, value);\n
    • Increase value
      eventSheetManager.incData(key, inc);\n
    • Get value
      var value = eventSheetManager.getData(key);\n
    • Has key
      var hasData = eventSheetManager.hasData(key);\n
    • Local memory as a dictionary
      var data = eventSheetManager.memory;\n
    "},{"location":"markedeventsheet/#custom-expression","title":"Custom expression","text":"
    eventSheetManager.addExpression(name, callback);\n
    • name : A string value
    • callback : A function object retuen a number
      function(a, b, c, ...) { return x; }\n

    For example :

    eventSheetManager.addExpression('randomInt', function (a, b) {\nreturn Math.floor(a + Math.random() * (b - a + 1));\n});\n

    Expression will store at local memory

    "},{"location":"markedeventsheet/#states","title":"States","text":"
    • Dump state of event sheets of all groups
      var states = eventSheetManager.dumpState();\n
    • Load state of event sheet of all groups
      eventSheetManager.loadState(states);\n
    "},{"location":"markedeventsheet/#events","title":"Events","text":"
    • Start A group of event sheets
      eventSheetManager.on('start', function(groupName, eventSheetManager){ });\n
    • A group of event sheets has been executed completed
      eventSheetManager.on('complete', function(groupName, eventSheetManager){ });\n
    • Enter an event sheet
      eventSheetManager.on('eventsheet.enter', function(title, groupName, eventSheetManager){ });\n
    • Exit an event sheet
      eventSheetManager.on('eventsheet.exit', function(title, groupName, eventSheetManager){ });\n
    • Enter a label (any heading) an event sheet
      eventSheetManager.on('label.enter', function(headingTitle, eventSheetTitle, groupName, eventSheetManager){ });\n
    • Exit a label (any heading) of an event sheet
      eventSheetManager.on('label.exit', function(headingTitle, eventSheetTitle, groupName, eventSheetManager){ });\n
    • Test condition of an event sheet failed
      eventSheetManager.on('eventsheet.catch', function(title, groupName, eventSheetManager){ });\n
    "},{"location":"markedeventsheet/#structure-of-event-sheet","title":"Structure of event sheet","text":"

    Sample

    "},{"location":"markedeventsheet/#main-headings","title":"Main headings","text":"
    # Title\n\ngroupName\nparallel\nactive=false\nonce\n\n## [Condition]\n\ncoin > 5\n\n## Script\n\n## [Catch]\n
    • H1 heading : Title of this event sheet
    • Content under Title (H1 heading) : Setting of this event sheet, optional.
      • groupName : Assign groupName in event sheet, put this event sheet in to that group.
      • parallel : Set parallel property of this event sheet to true.
      • active=false : Set active property of this event sheet to false.
      • once : Set once property of this event sheet to true.
    • H2 heading with [Condition] : Main condition.
      • Each line under [Condition] is a boolean equation, composed of AND logic.
      • Can have many [Condition] heading, each [Condition] heading will be composed of OR logic.
      • Read data from local memory
    • H2/H3/... headings between [Condition] and [Catch] : Actions when main condition is true.
      • Flow control instructions of headings
      • Actions : Custom command
    • H2 heading with [Catch] : Actions when main condition is false.
    "},{"location":"markedeventsheet/#flow-control-instructions","title":"Flow control instructions","text":""},{"location":"markedeventsheet/#if-else-if-else","title":"If, Else if, Else","text":"
    ### [If coin > 10]\n\nactions...\n\n### [Else If (coin > 5) && (coin <10)]\n\nactions...\n\n### [Else]\n\nactions...\n
    • H2/H3/... heading with [If expression], or [Else if expression] : If/Else If condition with expression
      • Read data from local memory
      • Boolean expression AND/OR : &&.
      • Boolean expression OR : ||.
      • Actions when expression is true.
    • H2/H3/... heading with [Else] :
      • Actions when previous expressions are all false.
    ## [If]\n\ncoin > 10\n\n### Label\n\nactions...\n\n## [Else If]\n\ncoin > 5\ncoin < 10\n\n### Label\n\nactions...\n\n## [Else]\n\n### Label\n\nactions...\n
    • H2/H3/... heading with [If], or [Else if] : If, Else If condition
      • Each line under [If], [Else If] is a boolean equation, composed of AND logic.
      • Read data from local memory
    • H3/H4/... heading under [If], [Else if] : - Actions when previous expressions are all false.
    "},{"location":"markedeventsheet/#repeat-loop","title":"Repeat loop","text":"
    ## [Repeat 3]\n\nactions...\n

    or

    ## [Repeat loopCount]\n\nactions...\n

    or

    ## [Repeat 3]\n\n### Label\n\nactions...\n
    • H2/H3/... heading with [Repeat N], or [Repeat var] : Repeat loop N times
    "},{"location":"markedeventsheet/#while-loop","title":"While loop","text":"
    ## [While loopCount > 0]\n\nactions...\n
    • H2/H3/... heading with [While expression] : While loop with expression
      • Read data from local memory
      • Actions when expression is true.
    ## [While]\n\nloopCount > 0\n\n### Label\n\nactions...\n
    • H2/H3/... heading with [While] : While loop
      • Each line under [While] is a boolean equation, composed of AND logic.
      • Read data from local memory
    • H3/H4/... heading under [While] : Actions running when condition is true
    "},{"location":"markedeventsheet/#break","title":"Break","text":"
    [break]\n
    • Action line with [break] : Ignore remainder actions in current label (heading).
    "},{"location":"markedeventsheet/#exit","title":"Exit","text":"
    [exit]\n
    • Action line with [exit] : Skip remainder label (heading) and actions.
    "},{"location":"markedeventsheet/#deactivate","title":"Deactivate","text":"
    [deactivate]\n

    or

    [deactivate title]\n
    • Action line with [deactivate], or [deactivate title] : Deactivate this event sheet, or deactivate event sheet by title in the same tree group. i.e. Set active property of this event shhet to false.
    "},{"location":"markedeventsheet/#activate","title":"Activate","text":"
    [activate]\n

    or

    [activate title]\n
    • Action line with [activate], or [activate title] : Activate this event sheet, or activate event sheet by title in the same tree group. i.e. Set active property of this event shhet to true.
    "},{"location":"markedeventsheet/#custom-command","title":"Custom command","text":"
    commandName\n  param0=value\n  param1=value\n
    • Each command is divided by space line. i.e. add space lines above and below command.
    • First line is the command name.
      1. Invoke commandExecutor.commandName method if this commandName method is existed.
        commandName(config, eventSheetManager) {\n// var resumeCallback = eventSheetManager.pauseEventSheet();\n// ... \n// resumeCallback()\n}\n
        • config : Parameter and value in a dictionary.
        • eventSheetManager : This event mangager.
          • Pause running of current event sheet
            var resumeCallback = eventSheetManager.pauseEventSheet();  //  resumeCallback();  // Resume running of current event sheet      \n
          • Pause running of current event sheet until another eventName firing from eventEmitter
            eventSheetManager.pauseEventSheetUnitlEvent(eventEmitter, eventName);\n
      2. Otherwise, invoke commandExecutor.defaultHandler.
        defaultHandler(commandName, config, eventSheetManager) {\n// var resumeCallback = eventSheetManager.pauseEventSheet();\n// ... \n// resumeCallback()\n}\n
        • commandName : Command name.
        • config : Parameter and value in a dictionary.
        • eventSheetManager : This event mangager.
          • Pause running of current event sheet
            var resumeCallback = eventSheetManager.pauseEventSheet(); //  resumeCallback();  // Resume running of current event sheet\n
          • Pause running of current event sheet until another eventName firing from eventEmitter
            eventSheetManager.pauseEventSheetUnitlEvent(eventEmitter, eventName);\n
    • Remainder lines are parameter composed of parameter name and value, with =
      • Space characters at line start will be discarded.
      • Value will be parsed to number, boolean, or string.
        • String value contains {{, and }} will be interpolation by mustache template syntax, return a string value.
        • String value wrapped by #( ) will be treated as expression, return a number value.
    • Any line start with // will be ignored as comment line.

    For multiple lines parameter :

    ```commandName,param0=value,param1=value\nline0\nline1\nline2\n```\n
    • Lines in code block will be assigned to text parameter.

    So it will be equal to

    commandName\n  text=...\n  param0=value\n  param1=value\n
    • '\\n'
    "},{"location":"markedeventsheet/#command-executor","title":"Command executor","text":"

    A command executor for phaser3 engine.

    "},{"location":"markedeventsheet/#create-command-executor-instance","title":"Create command executor instance","text":"
    var commandExecutor = scene.plugins.get('rexMarkedEventSheets').addCommandExecutor(scene, {\n// layers: ['layer0', 'layer1', ...]\n// layers: [{name, cameraName}, ...]\n\n// layerDepth: undefined,\n// rootLayer: undefined,\n\nlog: {\ndelimiters: '[]'\nenable: true\n}\n});\n\n// Add to event sheet manager\n// var eventSheetManager = scene.plugins.get('rexMarkedEventSheets').add({\n//     commandExecutor: commandExecutor\n// });\n

    or

    // import MarkedEventSheets from 'phaser3-rex-plugins/plugins/markedeventsheets.js';\n// import CommandExecutor from 'phaser3-rex-plugins/plugins/commandexecutor.js';\n\nvar commandExecutor = new CommandExecutor(scene, config);\n\n// var eventSheetManager = new MarkedEventSheets({\n//     commandExecutor: commandExecutor\n// });\n
    • layers : Add some initial layers
      • A string array : Add layers by string name
      • A array of plain object { name, cameraName }
        1. Add layer by string name
        2. Bind this layer to dedicate camera (indexed by cameraName), ignore other cameras Add a new camera if this target camera is not existing
    • layerDepth : Set depth to each layer game object.
      • undefined : Keep default depth value (0)
    • rootLayer : Add all layer game objects created by layer-manager into this root layer.
    • log : Configuration of BBCodeLog
      • log.delimiters : String of left-delimiter and right-delimiter.
        • A single string with 2 characters. Default value is '[]'.
        • A array with 2 strings
      • log.enable :
        • true : Can print message on console. Default behavior.
        • false : Don't print any message on console.
    "},{"location":"markedeventsheet/#local-memory-of-event-sheet-manager","title":"Local memory of event sheet manager","text":"
    • Set value by key
      setData\n  key=value\n
    • Increase value of key
      incData\n  key=value\n
      or
      setData\n  key=#(key+value)\n
    • Toggle value of key
      toggleData\n  key\n

    See Local memory

    "},{"location":"markedeventsheet/#bbcode-log","title":"BBCode Log","text":""},{"location":"markedeventsheet/#print-message-on-console","title":"Print message on console","text":"
    log\n  text=...\n

    or

    log\n  text=...\n  // logType='log'\n  // showTitle=true\n  // title\n  // titleColor='green'\n
    • text : Message with bbcode format.
      • [color=gold]...[/color]
      • [bgcolor=green]...[/bgcolor]
      • [b]...[/b]
      • [i]...[/i]
      • [u]...[/u]
    • logType :
      • 'log' : console.log. Default value.
      • 'warn': console.warn
    • showTitle
      • true : Show title before text message. Default behavior.
      • false : Don't show title.
    • title
      • undefined : Using title of current event sheet. Default behavior.
      • A string, custom string before text message.
    • titleColor : Background color of title block, default value is 'green'
    "},{"location":"markedeventsheet/#disable-console-message","title":"Disable console message","text":"
    log.disable\n
    • Disable console message of current event sheet.

    or

    log.disable\n  title=...\n
    • title : Disable console message of event sheet by title.
    "},{"location":"markedeventsheet/#enable-console-message","title":"Enable console message","text":"
    log.enable\n
    • Enable console message of current event sheet.

    or

    log.enable\n  title=...\n
    • title : Enable console message of event sheet by title.
    "},{"location":"markedeventsheet/#dump-memory","title":"Dump memory","text":"
    log.memory\n
    • Dump all key in memory

    or

    log.memory\n  text=...\n  keys=a,b,c\n
    • keys : Dump part of memory by keys.
    • text : Message with bbcode format.
    "},{"location":"markedeventsheet/#game-object","title":"Game object","text":""},{"location":"markedeventsheet/#register-custom-game-object","title":"Register custom game object","text":"
    commandExecutor.addGameObjectManager({\nname: GOTYPE,\n\nviewportCoordinate: false,\n// viewportCoordinate: { viewport: new Phaser.Geom.Rectangle() },\n\nfade: 500,\n// fade: {mode: 'tint', time: 500},\n\ndefaultLayer: layerName,\n\nautoClear: true,\n\ncommands: {\ncommandName(gameObject, config, commandExecutor, eventSheetManager, eventSheet) {\n// commandExecutor.waitEvent(eventEmitter, eventName);\n}\n}\n})\n
    • name : A string name of game object's type. Will register command GOTYPE to this command executor.
    • createGameObject : A callback for creating game object
      function(scene, config) {\nreturn gameObject;\n}\n
      • config : Parameters passed from event sheet.
        • id, layer, autoClear, eventSheetManager, eventsheet : These parameters are reserved.
        • eventSheetManager : This event sheet manager.
    • viewportCoordinate : Apply viewportCoordinate behavior to game object.
      • true : Attach vpx, vpy, vp to sprite game object.
        • vpx, vpy : Number between 0~1. Proportion of viewport.
        • vp : Viewport in rectangle
      • false : Do nothing, default behavior.
    • fade :
      • 0 : No fade-in or fade-out when adding or removing a sprite.
      • A number : Duration of fading. Default value is 500.
      • A plain object contains mode, time
        • fade.mode : Fade mode
          • 'tint', or 0 : Fade-in or fade-out via tint property.
          • 'alpha', or 1 : Fade-in or fade-out via alpha property.
          • 'revealUp', or 2 : Reveal up for fade-in.
          • 'revealDown', or 3 : Reveal down for fade-in.
          • 'revealLeft', or 4 : Reveal left for fade-in.
          • 'revealRight', or 5 : Reveal right for fade-in.
        • fade.time : Duration of fading. Default value is 500.
    • defaultLayer : A layer name defined in layers parameter of addCommandExecutor method
    • autoClear :
      • true : Clear game objects when exiting current event sheet. Default behavior.
      • false : Ignore this behavior.
    • commands : Custom commands, each command is a callback indexed by command name
      commandName: function(gameObject, config, commandExecutor, eventSheetManager) {\n// commandExecutor.waitEvent(eventEmitter, eventName);\n}\n
      • commandName : Command name. These command names are reserved : to, yoyo, destroy
      • gameObject : Game object instance.
      • config : Parameters passed from event sheet.
      • commandExecutor : This command executor instance. See also
      • eventSheetManager : This event sheet manager instance.
        • Store variable into blackboard of eventSheetManager : eventSheetManager.setData(key, value)
    "},{"location":"markedeventsheet/#create-custom-game-object","title":"Create custom game object","text":"
    GOTYPE\n  id=NAME\n  layer=\n  autoClear=\n  param0=value\n  param1=value\n
    • Create custom game object GOTYPE with config {param0, param1}, indexed by id
    • layer : Put this game object at layer.
      • undefined : Put this game object at default layer
    • autoClear : Clear game objects when exiting current event sheet.
      • undefined : Use default value of autoClear

    Reserved id : time, click, key, bgm, bgm2, se, se2, camera.

    Will store reference of this game object into memory at key @NAME, can see it by log.memory, or get property of game object via #(@NAME.x + 3).

    "},{"location":"markedeventsheet/#set-properties-of-custom-game-object","title":"Set properties of custom game object","text":"
    • Set properties of a game object indexing by NAME
      NAME.set\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n
      • vpx, vpy : viewportCoordinate properties injected if viewportCoordinate is true.
      • Add empty line above and below this command block.
    • Set properties of all game objects belong GOTYPE
      GOTYPE.set\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n
    • Set properties of all game objects belong GOTYPE excluding NAME
      !NAME.set\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n
    "},{"location":"markedeventsheet/#ease-properties-of-custom-game-object","title":"Ease properties of custom game object","text":"
    • Ease properties of a game object indexing by NAME
      NAME.to\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      NAME.from\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      NAME.yoyo\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      • These properties are reserved : id, duration, delay, ease, repeat, yoyo, wait
      • wait :
        • false : Run next command immediately. Default behavior.
        • true : Run next command after playing sound complete.
      • Add empty line above and below this command block.
    • Ease properties of all game objects belong GOTYPE
      GOTYPE.to\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      GOTYPE.from\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      GOTYPE.yoyo\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
    • Ease properties of all game objects belong GOTYPE excluding NAME
      !NAME.to\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      !NAME.from\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
      !NAME.yoyo\n  x=\n  vpx=\n  y=\n  vpy=\n  alpha=\n  duration=1000\n  delay=0\n  ease=Linear\n  repeat=0\n  wait=\n
    "},{"location":"markedeventsheet/#invoke-custom-command","title":"Invoke custom command","text":"
    • Invoke custom command of a game object indexing by NAME
      NAME.commandName\n  param0=value\n  param1=value\n
      • Invoke custom command commandName method with these parameters
        • gameObject : Indexed by NAME
        • config : {param0, param1}
      • Add empty line above and below this command block.
      • value :
        • For string value, characters \\n (2 characters) will be replaced by \\n new line character (1 character)
    • Invoke custom command of all game objects belong GOTYPE
      GOTYPE.commandName\n  param0=value\n  param1=value\n
    • Invoke custom command of all game objects belong GOTYPE excluding NAME
      !NAME.commandName\n  param0=value\n  param1=value\n

    Do nothing if gameObject or commandName is not found.

    "},{"location":"markedeventsheet/#destroy-custom-game-object","title":"Destroy custom game object","text":"
    • Destroy game object indexing by NAME
      NAME.destroy\n
    • Destroy all game objects belong GOTYPE
      GOTYPE.destroy\n
    • Destroy all game objects belong GOTYPE excluding NAME
      !NAME.destroy\n
    "},{"location":"markedeventsheet/#methods-used-in-command","title":"Methods used in command","text":"
    • Hold command execution until eventEmitter emits eventName event.
      commandExecutor.waitEvent(eventEmitter, eventName);\n
    • Apply value to property of
      commandExecutor.setGOProperty({\ngoType, id, property, ... });\n
      • goType : GameObject type assigned by commandExecutor.addGameObjectManager({name...}).
      • id : NAME of game object, which will store in gameObject.name.
        • gameObject.name : Apply value to property of this game object.
        • '!' + gameObject.name : Apply value to property of all game objects exclude this game object.
        • undefined : All game objects.
      • propertyName: value : Assign value to property. Can assign one or many properties.
    • Ease value of game object(s)' property
      if (wait) {\ncommandExecutor.setWaitEventFlag();\n}\ncommandExecutor.easeGOProperty({\ngoType, id, duration, ease, repeat, yoyo, wait, property, ... });\n
      • goType : GameObject type assigned by commandExecutor.addGameObjectManager({name...}).
      • id : NAME of game object, which will store in gameObject.name.
        • gameObject.name : Apply value to property of this game object.
        • '!' + gameObject.name : Apply value to property of all game objects exclude this game object.
        • undefined : All game objects.
      • duration : Duration of easing task.
      • ease : Ease function
      • repeat : Repeat times.
      • yoyo : Yoyo flag.
      • wait : Wait until easing task complete.
        • Invoke commandExecutor.setWaitEventFlag().
      • propertyName: value : Ease value of property. Can assign one or many properties.
    "},{"location":"markedeventsheet/#wait","title":"Wait","text":""},{"location":"markedeventsheet/#wait-click","title":"Wait click","text":"
    click\n
    • Run next command after clicking.
    "},{"location":"markedeventsheet/#wait-any","title":"Wait any","text":"

    Run next command after...

    wait\n  click\n  key=keyName\n  time=\n  GONAME.destroy\n  GONAME.PROPNAME\n  GONAME.DATAKEY\n  GONAME.EVTNAME\n  event=EVENTNAME\n
    • click : Run next command after clicking.
    • key : Run next command after key down
    • time : Run next command after time-out.
    • GONAME.destroy : Run next command after game object has destroyed.
    • GONAME.PROPNAME (ex. GONAME.x) : Run next command after game object's property tween complete
    • GONAME.DATAKEY, GONAME.!DATAKEY (ex. GONAME.!hp) : Run next command after game object's data is true (or > 0) or false (or <= 0). Will check PROPNAME first.
    • GONAME.EVTNAME : Run next command after game object's EVTNAME firing. Will check PROPNAME and DATAKEY first.
    • event : Run next command after eventSheetManager firing EVENTNAME event.

    Emit these events from eventSheetManager

    • Wait click or key down
      eventSheetManager.on('pause.input', function(){ });\n
      • Resume (run next command)
        eventSheetManager.on('resume.input', function(){ });\n
    • Wait click only
      eventSheetManager.on('pause.click', function(){ });\n
    • Wait key down only
      eventSheetManager.on('pause.key', function(keyName){ });\n
    "},{"location":"markedeventsheet/#sound","title":"Sound","text":"

    This command executor provides

    • 2 background music tracks : bgm, bgm2
    • 2 sound effects : se, se2.
    "},{"location":"markedeventsheet/#sound-properties","title":"Sound properties","text":"
    bgm.set\n  volume\n  mute\n  unmute\n
    • Command name : bgm, bgm2, se, se2
    "},{"location":"markedeventsheet/#play-sound","title":"Play sound","text":"
    bgm.play\n  key=\n  // volume\n  // detune\n  // rate\n  fadeIn=0\n  // loop\n  wait=false\n
    • Command name : bgm.play, bgm2.play, se.play, se2.play
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after playing sound complete.
    "},{"location":"markedeventsheet/#cross-fade-in-sound","title":"Cross fade in sound","text":"
    bgm.cross\n  key=\n  duration=500\n  wait=false\n
    • Command name : bgm.cross, bgm2.cross
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after playing sound complete.
    "},{"location":"markedeventsheet/#stop-sound","title":"Stop sound","text":"
    bgm.stop\n
    • Command name : bgm.stop, bgm2.stop, se.stop, se2.stop
    "},{"location":"markedeventsheet/#fade-out-sound","title":"Fade out sound","text":"
    bgm.fadeOut\n  duration=500\n  stop=true\n  wait=false\n
    • Command name : bgm.fadeOut, bgm2.fadeOut, se.fadeOut, se2.fadeOut
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after playing sound complete.
    "},{"location":"markedeventsheet/#fade-in-sound","title":"Fade in sound","text":"
    bgm.fadeIn\n  duration=500\n
    • Command name : bgm.fadeIn, bgm2.fadeIn
    "},{"location":"markedeventsheet/#pause-sound","title":"Pause sound","text":"
    bgm.pause\n
    • Command name : bgm.pause, bgm2.pause
    "},{"location":"markedeventsheet/#resume-sound","title":"Resume sound","text":"
    bgm.resume\n
    • Command name : bgm.resume, bgm2.resume
    "},{"location":"markedeventsheet/#mute-sound","title":"Mute sound","text":"
    bgm.mute\n
    • Command name : bgm.mute, bgm2.mute, se.mute, se2.mute
    "},{"location":"markedeventsheet/#unmute-sound","title":"Unmute sound","text":"
    bgm.unmute\n
    • Command name : bgm.unmute, bgm2.unmute, se.unmute, se2.unmute
    "},{"location":"markedeventsheet/#camera","title":"Camera","text":""},{"location":"markedeventsheet/#camera-properties","title":"Camera properties","text":"
    camera.set\n  x=\n  y=\n  rotate=\n  zoom=\n  name\n
    • x, y : Scroll
    • rotate : Rotate in degree
    • zoom : Zoom
    • name : Target camera indexed by name. Default is main camera.

    Run next command immediately.

    "},{"location":"markedeventsheet/#fade-in","title":"Fade in","text":"
    camera.fadeIn\n  duration=1000\n  red\n  green\n  blue\n  name\n  wait=false\n
    • duration, red, green, blue : See fade effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#fade-out","title":"Fade out","text":"
    camera.fadeOut\n  duration=1000\n  red\n  green\n  blue\n  name\n  wait=false\n
    • duration, red, green, blue : See fade effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#flash","title":"Flash","text":"
    camera.flash\n  duration=1000\n  red\n  green\n  blue\n  name\n  wait=false\n
    • duration, red, green, blue : See flash effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#shake","title":"Shake","text":"
    camera.shake\n  duration=1000\n  intensity\n  name\n  wait=false\n
    • duration, intensity : See shake effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#zoom","title":"Zoom","text":"
    camera.zoomTo\n  duration=1000\n  zoom\n  name\n  wait=false\n
    • duration, zoom : See zoom effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#rotate-to","title":"Rotate to","text":"
    camera.rotateTo\n  duration=1000\n  rotate\n  ease\n  name\n  wait=false\n
    • duration, rotate, ease : See rotateTo effect
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#scroll-to","title":"Scroll to","text":"
    camera.scrollTo\n  duration=1000\n  x\n  y\n  ease\n  name\n  wait=false\n
    • duration, x, y, ease : Scroll to position.
    • name : Target camera indexed by name. Default is main camera.
    • wait :
      • false : Run next command immediately. Default behavior.
      • true : Run next command after effect complete.
    "},{"location":"markedeventsheet/#add-custom-command","title":"Add custom command","text":"
    commandExecutor.addCommand(commandName, function(config, eventSheetManager){\n// var resumeCallback = eventSheetManager.pauseEventSheet();\n// ... \n// resumeCallback()\n}, scope);\n
    • config : Parameters passed from event sheet.
    • eventSheetManager : This event mangager.
      • Pause running of current event sheet
        var resumeCallback = eventSheetManager.pauseEventSheet();\n//  resumeCallback();  // Resume running of current event sheet\n
      • Pause running of current event sheet until another eventName firing from eventEmitter
        eventSheetManager.pauseEventSheetUnitlEvent(eventEmitter, eventName);\n
    "},{"location":"mask/","title":"Mask","text":""},{"location":"mask/#introduction","title":"Introduction","text":"

    Apply mask on game object. Built-in render of phaser.

    • Author: Richard Davey
    "},{"location":"mask/#usage","title":"Usage","text":""},{"location":"mask/#add-mask","title":"Add mask","text":""},{"location":"mask/#create-mask-object","title":"Create mask object","text":""},{"location":"mask/#bitmap-mask","title":"Bitmap mask","text":"
    1. Create image (image, sprite, bitmap text, particles, text),or shader
      var shape = scene.add.image(x, y, key).setVisible(false);\n
    2. Create mask
      var mask = shape.createBitmapMask();\n
      or
      var mask = scene.add.bitmapMask(shape);\n

    or

    var mask =  scene.add.bitmapMask(undefined, x, y, key, frame);\n
    "},{"location":"mask/#geometry-mask","title":"Geometry mask","text":"

    The mask is essentially a clipping path which can only make a masked pixel fully visible or fully invisible without changing its alpha (opacity).

    1. Create graphics
      var shape = scene.make.graphics();\n
    2. Create mask
      var mask = shape.createGeometryMask();\n
    "},{"location":"mask/#apply-mask-object","title":"Apply mask object","text":"
    gameObject.setMask(mask); // image.mask = mask;\n

    A mask object could be added to many game objects.

    Error

    Don't put game object and its mask into a container together. See this testing, enable line 22-24.

    Note

    Bitmap Mask is WebGL only.

    Note

    Can combine Geometry Masks and Blend Modes on the same Game Object, but Bitmap Masks can't.

    "},{"location":"mask/#clear-mask","title":"Clear mask","text":"
    • Clear mask
      image.clearMask();\n
    • Clear mask and destroy mask object
      image.clearMask(true);\n
    "},{"location":"mask/#invert-alpha","title":"Invert alpha","text":"

    Only GeometryMask has inverse alpha feature.

    • Inverse alpha
      mask.setInvertAlpha();\n// mask.invertAlpha = true;\n
    • Disable
      mask.setInvertAlpha(false);\n// mask.invertAlpha = false;\n
    "},{"location":"mask/#get-shape-game-object","title":"Get shape game object","text":"
    • Bitmap mask
      var shape = mask.bitmapMask;\n
    • Geometry mask
      var shape = mask.geometryMask;\n
    "},{"location":"matterjs-attractor/","title":"Attractor","text":""},{"location":"matterjs-attractor/#introduction","title":"Introduction","text":"

    Apply continual forces on bodies.

    • Reference
    "},{"location":"matterjs-attractor/#usage","title":"Usage","text":""},{"location":"matterjs-attractor/#system-configuration","title":"System configuration","text":"
    • Game config
      var config = {\n// ...\nphysics: {\nmatter: {\n// ...\nplugins: {\nattractors: true,\n// ...\n}\n// ...\n}\n}\n// ...\n}\nvar game = new Phaser.Game(config);\n
    • Runtime
      scene.matter.system.enableAttractorPlugin();\n
    "},{"location":"matterjs-attractor/#matter-object-configuration","title":"Matter object configuration","text":"
    var options = {\n// ...\nplugin: {\nattractors: [\ncallback,\n// ...\n]\n},\n// ...\n}\n
    • callback :
      • Retuen a force ({x,y}), which will be applied to bodyB
        function(bodyA, bodyB) {\nreturn {x, y}; // Force\n}\n
        • bodyA : Attractor matter object.
        • bodyB : Other matter object.
      • Apply forece to bodies directly.
        function(bodyA, bodyB) {\nbodyA.gameObject.applyForce({x, y});\nbodyB.gameObject.applyForce({x, y});\n}\n
        • bodyA : Attractor matter object.
          • bodyA.gameObject : Game object.
        • bodyB : Other matter object.
          • bodyB.gameObject : Game object.
    "},{"location":"matterjs-gameobject/","title":"Game object","text":""},{"location":"matterjs-gameobject/#introduction","title":"Introduction","text":"

    Matterjs physics Image/Sprite/Group object.

    • Author: Richard Davey
    "},{"location":"matterjs-gameobject/#usage","title":"Usage","text":""},{"location":"matterjs-gameobject/#add-physics-object","title":"Add physics object","text":"

    Enable physics world

    "},{"location":"matterjs-gameobject/#image-object","title":"Image object","text":"
    var image = scene.matter.add.image(x, y, key, frame);\n// var image = scene.matter.add.image(x, y, key, frame, config);\n
    • config : Config object
    "},{"location":"matterjs-gameobject/#sprite-object","title":"Sprite object","text":"
    var image = scene.matter.add.sprite(x, y, key, frame);\n// var image = scene.matter.add.sprite(x, y, key, frame, config);\n
    • config : Config object
    "},{"location":"matterjs-gameobject/#any-game-object","title":"Any game object","text":"
    var gameObject = scene.matter.add.gameObject(gameObject);\n// var gameObject = scene.matter.add.gameObject(gameObject, config);\n
    • config : Config object
    "},{"location":"matterjs-gameobject/#image-composite","title":"Image composite","text":"

    Create a new composite containing Matter Image objects created in a grid arrangement.

    var composite = scene.matter.add.imageStack(key, frame, x, y, columns, rows);\n// var composite = scene.matter.add.imageStack(key, frame, x, y, columns, rows, columnGap, rowGap, options);\n
    • key, frame : Texture key and frame name.
    • x, y : Top-left position of these game objects.
    • columns, rows : The number of columns/rows in the grid.
    • columnGap, rowGap : The distance between each column/row.
    • config : Config object
    • composite : Composite matter object.
      • composite.bodies : An array of bodies.
    "},{"location":"matterjs-gameobject/#config","title":"Config","text":"
    {\nlabel: 'Body',\nshape: 'rectangle',\nchamfer: null,\n\nisStatic: false,\nisSensor: false,\nisSleeping: false,\nignoreGravity: false,\nignorePointer: false,\n\nsleepThreshold: 60,\ndensity: 0.001,\nrestitution: 0,\nfriction: 0.1,\nfrictionStatic: 0.5,\nfrictionAir: 0.01,\n\nforce: { x: 0, y: 0 },\nangle: 0,\ntorque: 0,\n\ncollisionFilter: {\ngroup: 0,\ncategory: 0x0001,\nmask: 0xFFFFFFFF,\n},\n\n// parts: [],\n\n// plugin: {\n//     attractors: [\n//         (function(bodyA, bodyB) { return {x, y}}),\n//     ]\n// },\n\nslop: 0.05,\n\ntimeScale: 1,\n}\n
    • label : An arbitrary String name to help the user identify and manage bodies.
    • shape :
      • A string : 'rectangle', 'circle', 'trapezoid', 'polygon', 'fromVertices', 'fromPhysicsEditor'
      • An object :
        • Rectangle shape
          {\ntype: 'rectangle',\n// width: gameObject.width\n// height: gameObject.height\n}\n
        • Circle shape
          {\ntype: 'circle',\n// radius: (Math.max(gameObject.width, gameObject.height) / 2),\n// maxSides: 25\n}\n
        • Trapezoid shape
          {\ntype: 'trapezoid',\n// slope: 0.5,\n}\n
        • Polygon shape
          {\ntype: 'polygon',\n// radius: (Math.max(gameObject.width, gameObject.height) / 2),\n// sides: 5,\n}\n
        • Vertices
          {\ntype: 'fromVertices',\nverts: points,\n// flagInternal: false,\n// removeCollinear: 0.01,\n// minimumArea: 10,\n}\n
          • points :
            • A string : 'x0 y0 x1 y1 ...'
            • An array of points : [{x:x0, y:y0}, {x:x1, y:y1}, ...]
    • chamfer :
      • null
      • A number
      • {radius: value}
      • {radius: [topLeft, topRight, bottomRight, bottomLeft]}
    • isStatic : A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed.
    • isSensor : A flag that indicates whether a body is a sensor. Sensor triggers collision events, but doesn't react with colliding body physically.
    • isSleeping : A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken.
    • sleepThreshold : The number of updates in which this body must have near-zero velocity before it is set as sleeping.
    • density : Density of the body, that is its mass per unit area.
    • restitution : The restitution/bounce/elasticity of the body. The value is always positive and is in the range (0, 1).
      • 0 : Collisions may be perfectly inelastic and no bouncing may occur.
      • 0.8 : The body may bounce back with approximately 80% of its kinetic energy.
    • friction : Friction of the body. The value is always positive and is in the range (0, 1).
      • 0 : The body may slide indefinitely.
      • 1 : The body may come to a stop almost instantly after a force is applied.
    • frictionStatic : The static friction of the body (in the Coulomb friction model).
      • 0 : The body will never 'stick' when it is nearly stationary and only dynamic friction is used.
      • 10 : The higher the value, the more force it will take to initially get the body moving when nearly stationary.
    • frictionAir : The air friction of the body (air resistance).
      • 0 : The body will never slow as it moves through space.
      • The higher the value, the faster a body slows when moving through space.
    • force : The force to apply in the current step.
    • angle : Angle of the body, in radians.
    • torque : the torque (turning force) to apply in the current step.
    • collisionFilter : An Object that specifies the collision filtering properties of this body.
      • collisionFilter.group
      • collisionFilter.category : A bit field that specifies the collision category this body belongs to.
      • collisionFilter.mask : A bit mask that specifies the collision categories this body may collide with.
    • slop : A tolerance on how far a body is allowed to 'sink' or rotate into other bodies.
      • The default should generally suffice, although very large bodies may require larger values for stable stacking.
    "},{"location":"matterjs-gameobject/#collision","title":"Collision","text":"

    Collisions between two bodies will obey the following rules:

    • (grpupA > 0) && (groupB > 0) :
      • Collision = (groupA == groupB)
    • (grpupA == 0) || (groupB == 0) :
      • Collision = ((categoryA & maskB) !== 0) && ((categoryB & maskA) !== 0)
    "},{"location":"matterjs-gameobject/#movement","title":"Movement","text":""},{"location":"matterjs-gameobject/#velocity","title":"Velocity","text":"
    gameObject.setVelocity(x, y);\n
    gameObject.setVelocityX(x);\n
    gameObject.setVelocityY(x);\n
    "},{"location":"matterjs-gameobject/#acceleration","title":"Acceleration","text":""},{"location":"matterjs-gameobject/#force","title":"Force","text":"
    • Applies a force to a body.
      gameObject.applyForce(force);\n
      • force : {x, y}
    • Applies a force to a body from a given position.
      gameObject.applyForceFrom(position, force); // position, force: {x, y}\n
      • position : {x, y}
      • force : {x, y}
    • Apply thrust to the forward position of the body.
      gameObject.thrust(speed);\n
      • speed : A number.
    • Apply thrust to the left position of the body.
      gameObject.thrustLeft(speed);\n
      • speed : A number.
    • Apply thrust to the right position of the body.
      gameObject.thrustRight(speed);\n
      • speed : A number.
    • Apply thrust to the back position of the body.
      gameObject.thrustBack(speed);\n
      • speed : A number.
    • Apply thrust to the back position of the body.
      gameObject.thrustBack(speed);\n
      • speed : A number.
    "},{"location":"matterjs-gameobject/#gravity","title":"Gravity","text":"
    • Ignore world gravity
      gameObject.setIgnoreGravity(ignore);\n
      • ignore : Set to true to ignore the effect of world gravity
    "},{"location":"matterjs-gameobject/#friction","title":"Friction","text":"
    gameObject.setFriction(value, air, fstatic);\n
    gameObject.setFrictionAir(v);\n
    gameObject.setFrictionStatic(v);\n
    "},{"location":"matterjs-gameobject/#rotation","title":"Rotation","text":""},{"location":"matterjs-gameobject/#fixed-rotation","title":"Fixed rotation","text":"
    gameObject.setFixedRotation();\n
    "},{"location":"matterjs-gameobject/#angular-velocity","title":"Angular velocity","text":"
    gameObject.setAngularVelocity(v);\n
    "},{"location":"matterjs-gameobject/#collision_1","title":"Collision","text":""},{"location":"matterjs-gameobject/#enable","title":"Enable","text":"
    • Get
      var isSensor = gameObject.isSensor();\n
    • Set
      gameObject.setSensor(value);\n
      • value : Set true to enable sensor.
    "},{"location":"matterjs-gameobject/#collision-group","title":"Collision group","text":"
    • Collision grpup
      gameObject.setCollisionGroup(value);\n
    • Collision category
      1. Get new collision category
        var category = scene.matter.world.nextCategory();\n
        • category : An one-shot number (1, 2, 4, 8, ...., 2147483648 (1<<31))
      2. Set collision category of game object
        gameObject.setCollisionCategory(category);\n
      3. Set category mask
        gameObject.setCollidesWith([categoryA, categoryB, ...]);\n// gameObject.setCollidesWith(categoryA);\n
    "},{"location":"matterjs-gameobject/#collision-event","title":"Collision event","text":"
    scene.matter.world.on('collisionstart', function (event, bodyA, bodyB) {\n// var pairs = event.pairs;\n});\n
    • event :
      • event.pairs : An array of collision pairs
        • event.pairs[i].bodyA, event.pairs[i].bodyB : Matter body object.
          • body.gameObject : Game object of matter body.
    • bodyA, bodyB : Equal to event.pairs[0].bodyA, event.pairs[0].bodyB.
    "},{"location":"matterjs-gameobject/#collision-bound","title":"Collision bound","text":"
    • Rectangle
      gameObject.setRectangle(width, height, options);\n
    • Circle
      gameObject.setCircle(radius, options);\n
    • Polygon
      gameObject.setPolygon(radius, sides, options);\n
    • Trapezoid
      gameObject.setTrapezoid(width, height, slope, options);\n
    • Any
      gameObject.setBody(config, options);\n
      • config :
        • Rectangle shape
          {\ntype: 'rectangle',\n// width: gameObject.width\n// height: gameObject.height\n}\n
        • Circle shape
          {\ntype: 'circle',\n// radius: (Math.max(gameObject.width, gameObject.height) / 2),\n// maxSides: 25\n}\n
        • Trapezoid shape
          {\ntype: 'trapezoid',\n// slope: 0.5,\n}\n
        • Polygon shape
          {\ntype: 'polygon',\n// radius: (Math.max(gameObject.width, gameObject.height) / 2),\n// sides: 5,\n}\n
    "},{"location":"matterjs-gameobject/#bounce","title":"Bounce","text":"
    gameObject.setBounce(v);\n
    • restitution
    "},{"location":"matterjs-gameobject/#mass","title":"Mass","text":"
    gameObject.setMass(v);\n
    gameObject.setDensity(v);\n
    "},{"location":"matterjs-gameobject/#sleep","title":"Sleep","text":""},{"location":"matterjs-gameobject/#enable_1","title":"Enable","text":"
    var config = {\n// ...\nphysics: {\nmatter: {\n// ...\nenableSleeping: true\n// ...\n}\n}\n\n}\n
    "},{"location":"matterjs-gameobject/#sleep-threshold","title":"Sleep threshold","text":"
    gameObject.setSleepThreshold(value);\n
    "},{"location":"matterjs-gameobject/#sleep-events","title":"Sleep events","text":"
    • Sleeping start
      scene.matter.world.on('sleepstart', function (event, body) {\n});\n
    • Sleeping end
      scene.matter.world.on('sleepend', function (event, body) {\n});\n
    "},{"location":"matterjs-world/","title":"World","text":""},{"location":"matterjs-world/#introduction","title":"Introduction","text":"

    Matter physics engine in phaser.

    • Author: Richard Davey
    "},{"location":"matterjs-world/#usage","title":"Usage","text":""},{"location":"matterjs-world/#configuration","title":"Configuration","text":"
    var config = {\n// ...\nphysics: {\ndefault: 'matter',\nmatter: {\n//    enabled: true,\n//    positionIterations: 6,\n//    velocityIterations: 4,\n//    constraintIterations: 2,\n//    enableSleeping: false,\n//    plugins: {\n//        attractors: false,\n//        wrap: false,\n//    },\n//    gravity: {\n//        x: 0,\n//        y: 0,\n//    }\n//    setBounds: {\n//        x: 0,\n//        y: 0,\n//        width: scene.sys.scale.width,\n//        height: scene.sys.scale.height,\n//        thickness: 64,\n//        left: true,\n//        right: true,\n//        top: true,\n//        bottom: true,\n//    },\n//    timing: {\n//        timestamp: 0,\n//        timeScale: 1,\n//    },\n//    correction: 1,\n//    getDelta: (function() { return 1000 / 60; }),\n//    autoUpdate: true,\n//    debug: false,\n//    debug: {\n//        showAxes: false,\n//        showAngleIndicator: false,\n//        angleColor: 0xe81153,\n//        showBroadphase: false,\n//        broadphaseColor: 0xffb400,\n//        showBounds: false,\n//        boundsColor: 0xffffff,\n//        showVelocity: false,\n//        velocityColor: 0x00aeef,\n//        showCollisions: false,\n//        collisionColor: 0xf5950c,\n//        showSeparations: false,\n//        separationColor: 0xffa500,\n//        showBody: true,\n//        showStaticBody: true,\n//        showInternalEdges: false,\n//        renderFill: false,\n//        renderLine: true,\n//        fillColor: 0x106909,\n//        fillOpacity: 1,\n//        lineColor: 0x28de19,\n//        lineOpacity: 1,\n//        lineThickness: 1,\n//        staticFillColor: 0x0d177b,\n//        staticLineColor: 0x1327e4,\n//        showSleeping: false,\n//        staticBodySleepOpacity: 0.7,\n//        sleepFillColor: 0x464646,\n//        sleepLineColor: 0x999a99,\n//        showSensors: true,\n//        sensorFillColor: 0x0d177b,\n//        sensorLineColor: 0x1327e4,\n//        showPositions: true,\n//        positionSize: 4,\n//        positionColor: 0xe042da,\n//        showJoint: true,\n//        jointColor: 0xe0e042,\n//        jointLineOpacity: 1,\n//        jointLineThickness: 2,\n//        pinSize: 4,\n//        pinColor: 0x42e0e0,\n//        springColor: 0xe042e0,\n//        anchorColor: 0xefefef,\n//        anchorSize: 4,\n//        showConvexHulls: false,\n//        hullColor: 0xd703d0\n//    }\n}\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"matterjs-world/#control","title":"Control","text":""},{"location":"matterjs-world/#pause","title":"Pause","text":"
    scene.matter.world.pause();\n
    "},{"location":"matterjs-world/#resume","title":"Resume","text":"
    scene.matter.world.resume();\n
    "},{"location":"matterjs-world/#drag-object","title":"Drag object","text":"
    scene.matter.add.mouseSpring();\n// scene.matter.add.mouseSpring(options);\n
    • options
      {\nlength: 0.01,\nstiffness: 0.1,\ndamping: 0,\nangularStiffness: 1,\ncollisionFilter: {\ncategory: 0x0001,\nmask: 0xFFFFFFFF,\ngroup: 0\n}\n}\n
      • collisionFilter : Drag filter, see collision.
    "},{"location":"matterjs-world/#world-bounds","title":"World bounds","text":""},{"location":"matterjs-world/#enable","title":"Enable","text":"
    • World :
      • Set bounds
        scene.matter.world.setBounds(x, y, width, height);\n// scene.matter.world.setBounds(x, y, width, height, thickness, left, right, top, bottom);\n
        • thickness : The thickness of each wall, in pixels.
        • left, right, top, bottom : If true will create the left/right/top/bottom bounds wall.
    "},{"location":"matterjs-world/#gravity","title":"Gravity","text":"
    • Set
      scene.matter.world.setGravity(x, y);\n// scene.matter.world.setGravity(x, y, scale);\n
    • Disable
      scene.matter.world.disableGravity();\n
    "},{"location":"matterjs-world/#constraint","title":"Constraint","text":""},{"location":"matterjs-world/#constraint-of-2-game-objects","title":"Constraint of 2 game objects","text":"
    var constraint = scene.matter.add.constraint(gameObjectA, gameObjectB);\n// var constraint = scene.matter.add.constraint(gameObjectA, gameObjectB, length, stiffness, options);\n
    • gameObjectA, gameObjectB : Matter game object, or matter body object.
    • length : The target resting length of the constraint.
      • undefined : Current distance between gameObjectA and gameObjectB. (Default value)
    • stiffness : The stiffness of the constraint.
      • 1 : Very stiff. (Default value)
      • 0.2 : Acts as a soft spring.
    • options :
      {\npointA: {\nx: 0,\ny: 0,\n},\npointB: {\nx: 0,\ny: 0,\n},\ndamping: 0,\nangularStiffness: 0,\n// render: {\n//     visible: true\n// }\n}\n
      • pointA, pointB : Offset position of gameObjectA, gameObjectB.

    Alias:

    var constraint = scene.matter.add.spring(gameObjectA, gameObjectB, length, stiffness, options);\nvar constraint = scene.matter.add.joint(gameObjectA, gameObjectB, length, stiffness, options);\n
    "},{"location":"matterjs-world/#constraint-to-world-position","title":"Constraint to world position","text":"
    var constraint = scene.matter.add.worldConstraint(gameObjectB, length, stiffness, options);\n
    • gameObjectB : Matter game object, or matter body object.
    • length : The target resting length of the constraint.
      • undefined : Current distance between gameObjectA and gameObjectB. (Default value)
    • stiffness : The stiffness of the constraint.
      • 1 : Very stiff. (Default value)
      • 0.2 : Acts as a soft spring.
    • options :
      {\npointA: {\nx: 0,\ny: 0,\n},\npointB: {\nx: 0,\ny: 0,\n},\ndamping: 0,\nangularStiffness: 0,\n// render: {\n//     visible: true\n// }\n}\n
      • pointA : World position.
      • pointB : Offset position of gameObjectB.
    "},{"location":"matterjs-world/#chain-game-objects","title":"Chain game objects","text":"
    var composite = scene.matter.add.chain(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options);\n
    • composite : Image composite
    • xOffsetA, yOffsetA : Offset position of gameObjectA, in scale.
      • xOffset = (Offset distance / width)
      • yOffset = (Offset distance / height)
    • xOffsetB, yOffsetB : Offset position of gameObjectB, in scale.
    • options :
      {\nlength: undefined,\nstiffness: 1,\ndamping: 0,\nangularStiffness: 0,\n// render: {\n//     visible: true\n// }\n}\n
      • length : The target resting length of the constraint.
        • undefined : Current distance between gameObjectA and gameObjectB. (Default value)
      • stiffness : The stiffness of the constraint.
        • 1 : Very stiff. (Default value)
        • 0.2 : Acts as a soft spring.
    • composite
      • composite.bodies : An array of bodies.
      • composite.constraints : An array of constraints
    "},{"location":"matterjs-world/#remove-constraint","title":"Remove constraint","text":"
    scene.matter.world.removeConstraint(constraint);\n
    "},{"location":"matterjs-wrap/","title":"Wrap","text":""},{"location":"matterjs-wrap/#introduction","title":"Introduction","text":"

    Automatically wrap the position of bodies and composites such that they always stay within the given bounds.

    • Reference
    "},{"location":"matterjs-wrap/#usage","title":"Usage","text":""},{"location":"matterjs-wrap/#system-configuration","title":"System configuration","text":"
    • Game config
      var config = {\n// ...\nphysics: {\nmatter: {\n// ...\nplugins: {\nwrap: true,\n// ...\n}\n// ...\n}\n}\n// ...\n}\nvar game = new Phaser.Game(config);\n
    • Runtime
      scene.matter.system.enableWrapPlugin();\n
    "},{"location":"matterjs-wrap/#matter-object-configuration","title":"Matter object configuration","text":"
    var options = {\n// ...\nplugin: {\nwrap: {\nmin: {\nx: 0,\ny: 0\n},\nmax: {\nx: 1024,\ny: 1024\n}\n}\n},\n// ...\n}\n
    "},{"location":"mesh/","title":"Mesh","text":""},{"location":"mesh/#introduction","title":"Introduction","text":"

    Render a group of textured vertices and manipulate the view of those vertices, such as rotation, translation or scaling.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"mesh/#usage","title":"Usage","text":""},{"location":"mesh/#quad","title":"Quad","text":"

    Note

    See also Plane

    1. Load texture
      scene.load.image(key, url);\n
    2. Add mesh object
      var mesh = scene.add.mesh(x, y, texture, frame);\n
      or
      var mesh = scene.make.mesh({\nx: 0,\ny: 0,\nadd: true,\n\nkey: null,\nframe: null\n});\n
    3. Set perspective or orthographic projection
      • Perspective projection
        mesh.setPerspective(width, height, fov);\n// mesh.setPerspective(width, height, fov, near, far);\n
        • width, height : The width/height of the projection matrix. Typically the same as the Mesh and/or Renderer.
        • fov : The field of view, in degrees.
        • near, far : The near/far value of the view. Default value are 0.01/1000.
      • Orthographic projection
        mesh.setOrtho(mesh.width/mesh.height, 1);\n// mesh.setOrtho(scaleX, scaleY, near, far);\n
        • scaleX, scaleY : The default horizontal/vertical scale in relation to the Mesh / Renderer dimensions.
        • near, far : The near/far value of the view. Default value are 0.01/1000.
    4. Creates a grid of vertices
      Phaser.Geom.Mesh.GenerateGridVerts({\nmesh: mesh,\ntexture: textureKey,\nframe: frameName,\nwidth: 1,\nheight: 1,\nwidthSegments: 1,\nheightSegments: 1,\n\n// x: 0,\n// y: 0,\n// colors: 0xffffff,\n// alphas: 1,\n// tile: false,\n// isOrtho: false\n})\n
      • mesh : The vertices of the generated grid will be added to this Mesh Game Object.
      • texture : The texture to be used for this Grid.
      • frame : The name or index of the frame within the Texture.
      • width , height : The width/height of the grid in 3D units.
        {\n// ...\nwidth: (frameWidth/frameHeight),\nheight: (frameHeight/frameHeight)\n// ...\n}\n
      • widthSegments, heightSegments : The number of segments to split the grid horizontally/vertically in to.
      • colors : An array of colors, one per vertex, or a single color value applied to all vertices.
      • alphas An array of alpha values, one per vertex, or a single alpha value applied to all vertices.
      • tile :
        • false : Display as a single texture. Default value.
        • true : Texture tile (repeat) across the grid segments.
    "},{"location":"mesh/#model","title":"Model","text":"
    1. Load model
      scene.load.obj(key, url, objURL, matURL);\n
      • objURL : URL to load the obj file.
      • matURL : URL to load the material file.
    2. Add mesh object
      var mesh = scene.add.mesh(x, y);\n
      or
      var mesh = scene.make.mesh({\nx: 0,\ny: 0,\nadd: true\n});\n
    3. Add model
      mesh.addVerticesFromObj(key, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp);\n
      • key : The key of the model data in the OBJ Cache to add to this Mesh.
      • scale : An amount to scale the model data by. Default is 1.
      • x, y, z : Translate the model x/y/z position by this amount.
      • rotateX, rotateY, rotateZ : Rotate the model on the x/y/z axis by this amount, in radians.
      • zIsUp :
        • true : Z axis is up.
        • false : Y axis is up.
    "},{"location":"mesh/#custom-mesh-class","title":"Custom mesh class","text":"
    • Define class
      class MyMesh extends Phaser.GameObjects.mesh {\nconstructor(scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) {\nsuper(scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var mesh = new MyMesh(scene, x, y, texture, frame);\n
    "},{"location":"mesh/#control","title":"Control","text":""},{"location":"mesh/#view","title":"View","text":"
    • Translates the view position of this Mesh on the x/y/z axis by the given amount.
      mesh.panX(x);\nmesh.panY(y);\nmesh.panZ(z);\n
    "},{"location":"mesh/#model_1","title":"Model","text":"
    • Position
      mesh.modelPosition.x = x;\nmesh.modelPosition.y = y;\nmesh.modelPosition.z = z;\n
      • x, y, z : Offset position.
        • z+ : Near
        • z- : Far
        • x- : Left
        • x+ : Right
        • y+ : Up
        • y- : Down
    • Rotation
      mesh.modelRotation.x = radiansX;\nmesh.modelRotation.y = radiansY;\nmesh.modelRotation.z = radiansZ;\n
      or
      mesh.rotateX = degreesX;\nmesh.rotateY = degreesY;\nmesh.rotateZ = degreesZ;\n
      • radiansX, radiansY, radiansZ : Rotation angle in radians.
      • degreesX, degreesY, degreesZ : Rotation angle in degrees.
    • Scale
      mesh.modelScale.x = scaleX;\nmesh.modelScale.y = scaleY;\nmesh.modelScale.z = scaleZ;\n
      • scaleX, scaleY, scaleZ : Scale value, 1 is origin size.
    "},{"location":"mesh/#backward-facing-faces","title":"Backward facing Faces","text":"
    • Hide backward facing Faces. Default behavior.
      mesh.hideCCW = true;\n
    • Show backward facing Faces
      mesh.hideCCW = false;\n
    "},{"location":"mesh/#faces","title":"Faces","text":"

    Mesh is composed of triangle faces.

    var faces = mesh.faces;\n
    "},{"location":"mesh/#contains","title":"Contains","text":"
    • Has any face which contains point
      var isHit = mesh.hasFaceAt(worldX, worldY);\n// var isHit = mesh.hasFaceAt(worldX, worldY, camera);\n
    • Get face contains point
      var face = mesh.getFaceAt(worldX, worldY);\n// var face = mesh.getFaceAt(worldX, worldY, camera);\n
    "},{"location":"mesh/#properties","title":"Properties","text":"
    • Alpha
      • Get
        var alpha = face.alpha;\n
      • Set
        face.alpha = alpha;\n
    • Angle
      • Rotate
        Phaser.Geom.Mesh.RotateFace(face, radians);\n
    • Center position
      • Get
        var x = face.x;\nvar y = face.y;\n
        • x : 0(left) ~ 1(right)
        • y : 1(top) ~ 0(bottom)
      • Set
        face.x = x;\nface.y = y;\n
        or
        face.translate(x, y);\n
        • x : 0(left) ~ 1(right)
        • y : 1(top) ~ 0(bottom)
    "},{"location":"mesh/#vertices","title":"Vertices","text":"

    Each face has 3 vertices.

    var vertices = mesh.vertices;\n
    • vertices : Array of vertex.
    "},{"location":"mesh/#properties_1","title":"Properties","text":"
    • Alpha
      • Get
        var alpha = vertex.alpha;\n
      • Set
        vertex.alpha = alpha;\n
    • Tint
      • Get
        var color = vertex.color;\n
      • Set
        vertex.color = color;\n
    "},{"location":"mesh/#update-properties","title":"Update properties","text":"
    • Start updating
      mesh.ignoreDirtyCache = true;\n
    • Stop updating
      mesh.ignoreDirtyCache = false;\n
    "},{"location":"mesh/#interactive","title":"Interactive","text":"

    To test if pointer is at any face of this mesh game object.

    mesh.setInteractive();\n
    "},{"location":"mesh/#debug","title":"Debug","text":"
    1. Set debug Graphics
      var debugGraphics = scene.add.graphics();\nmesh.setDebug(debugGraphics);\n
    2. Update Graphics in scene.update() method.
      debugGraphics.clear();\ndebugGraphics.lineStyle(1, 0x00ff00);\n
    "},{"location":"mesh/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"mesh/#create-mask","title":"Create mask","text":"
    var mask = mesh.createBitmapMask();\n

    See mask

    "},{"location":"mesh/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"modal-promise/","title":"Modal promise","text":""},{"location":"modal-promise/#introduction","title":"Introduction","text":"

    Modal behavior wrapped into promise.

    • Author: Rex
    • Promise
    "},{"location":"modal-promise/#live-demos","title":"Live demos","text":"
    • Manual
    • Timeout
    • Modal dialog
    "},{"location":"modal-promise/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"modal-promise/#install-plugin","title":"Install plugin","text":""},{"location":"modal-promise/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmodalplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmodalplugin.min.js', true);\n
    • Add modal behavior
      scene.plugins.get('rexmodalplugin').promise(gameObject, config)\n.then(function(closeEventData) {\n})\n
    "},{"location":"modal-promise/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add modal behavior
      scene.plugins.get('rexModal').promise(gameObject, config)\n.then(function(closeEventData) {\n})\n
    "},{"location":"modal-promise/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ModalPromise } from 'phaser3-rex-plugins/plugins/modal.js';\n
    • Add modal behavior
      ModalPromise(gameObject, config)\n.then(function(closeEventData) {\n})\n
    "},{"location":"modal-promise/#promise","title":"Promise","text":"
    scene.plugins.get('rexModal').promise(gameObject, config)\n.then(function(closeEventData) {\n})\n
    • config : See Modal behavior
    "},{"location":"modal-promise/#close","title":"Close","text":"

    scene.plugins.get('rexModal').close(gameObject);\n// scene.plugins.get('rexModal').close(gameObject, closeEventData);\n
    or
    gameObject.emit('modal.requestClose');\n// gameObject.emit('modal.requestClose', closeEventData);\n

    • Fire 'modal.requestClose' event on game object, which will invoke modal.requestClose() method. After closing dialog, resolve part of promise will be triggered.
    graph TB\n\nPromise[\"promose('gameObject, config)\"]\nOnOpen[\"gameObject.on('modal.open')\"]\nRequestCloseEvent[\"gameObject.emit('modal.requestClose', closeEventData)\"]\nTimeOut[\"Timeout<br>Any touch\"]\nOnClose[\"gameObject.on('modal.close')\"]\nResolve[\"then(function(closeEventData) { })\"]\n\nPromise --> |Transition-in| OnOpen\nOnOpen --> |manualClose| RequestCloseEvent\nOnOpen --> |Not manualClose| TimeOut\nRequestCloseEvent --> |Transition-out| OnClose\nTimeOut --> |Transition-out| OnClose\nOnClose --> Resolve
    "},{"location":"modal-promise/#events","title":"Events","text":"
    • To invoke modal.requestClose() method
      gameObject.emit('modal.requestClose', closeEventData);\n
    • On opened dialog
      gameObject.on('modal.open', function(modalBehavior) {\n})\n
    • On closed dialog
      gameObject.on('modal.close', function(closeEventData, modalBehavior) {\n})\n
    "},{"location":"modal/","title":"Modal behavior","text":""},{"location":"modal/#introduction","title":"Introduction","text":"

    Pop-up modal dialog, then scale-down this dialog.

    • Author: Rex
    • Behavior of game object
    "},{"location":"modal/#live-demos","title":"Live demos","text":"
    • Manual
    • Timeout
    • Touch outside
    • Custom transit
    "},{"location":"modal/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"modal/#install-plugin","title":"Install plugin","text":""},{"location":"modal/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmodalplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmodalplugin.min.js', true);\n
    • Add modal behavior
      var modal = scene.plugins.get('rexmodalplugin').add(gameObject, config);\n
    "},{"location":"modal/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add modal behavior
      var modal = scene.plugins.get('rexModal').add(gameObject, config);\n
    "},{"location":"modal/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ModalBehavoir } from 'phaser3-rex-plugins/plugins/modal.js';\n
    • Add modal behavior
      var modal = new ModalBehavoir(gameObject, config);\n
    "},{"location":"modal/#create-instance","title":"Create instance","text":"
    var modal = scene.plugins.get('rexModal').add(gameObject, {\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0,\n// transitOut: 0,\n\n// destroy: true,\n// openOnStart: true\n});\n
    • cover : Configuration of Cover -- A rectangle shape covered full window, and block all touch events.
      • false : Don't create cover game object.
      • cover.transitIn : Custom callback. Default behavior is fade-in.
        function(gameObject, duration) {\n\n}\n
      • cover.transitOut : Custom callback. Default behavior is fade-out.
        function(gameObject, duration) {\n\n}\n
    • touchOutsideClose : Set to true to close modal dialog when clicking out side of gameObject.
      • Default value is false. Will be set to false if anyTouchClose is set to true.
    • anyTouchClose : Set to true to close modal dialog when any clicking.
      • Default value is false.
    • timeOutClose : Set to true to close modal dialog when holding time out (duration.hold).
      • If duration.hold is given, default value is true. Otherwise default value is false.
    • manualClose : Set to true to close modal dialog via modal.requestClose() method.
      • Default value is false. When this parameter is true, other closing methods will be disabled.
      • If touchOutsideClose, anyTouchClose, and timeOutClose are false, it is equal to manualClose.
    • duration : Duration of transition-in, hold, trantion-out.
      • duration.in : Duration of transition-in (open dialog).
        • 0 : No transition, open dialog immediately.
      • duration.out : Duration of transition-out (close dialog).
        • 0 : No transition, close dialog immediately.
      • duration.hold : Duration of hold.
        • -1 : Disable timeOutClose.
    • transitIn : Transition behavior of opening dialog.
      • 0, 'popUp' : Pop up dialog from 0 to current scale.
      • 1, 'fadeIn' : Fade in dialog
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • transitOut : Tween behavior of closing dialog.
      • 0, 'scaleDown' : Scale down dialog
      • 1, 'fadeOut' : Fade out dialog
      • Custom callback
        function(gameObject, duration) {\n\n}\n
    • destroy
      • true : Destroy dialog game object and this behavior when closing completed. Default behavior.
      • fasle : Keep dialog game object and this behavior when closing completed. Could reuse it later.
    • openOnStart:
      • true : Open dialog game object (modal.requestOpen()) at beginning. Default behavior.
      • false : Open dialog game object manually.
    "},{"location":"modal/#open","title":"Open","text":"
    • Will open modal dialog game object (run transition-in callback) when creating this behavior, if openOnStart is set to true.
    • Invoke modal.requestOpen() to open modal dialog game object again, after closing modal dialog.
      • Set destroy to false to reuse dialog game object and this behavior.
    "},{"location":"modal/#close","title":"Close","text":"
    modal.requestClose();\n// modal.requestClose(closeEventData);\n
    • closeEventData : Emit 'close' event when closed dialog complete, pass closeEventData to callback of this event.
      modal.on('close', function(closeEventData) {\n})\n
    "},{"location":"modal/#events","title":"Events","text":"
    • On opened dialog
      modal.on('open', function(gameObject, modal) {\n})\n
    • On closed dialog
      modal.on('close', function(closeEventData) {\n})\n
    "},{"location":"mousewheel/","title":"Mouse wheel","text":""},{"location":"mousewheel/#introduction","title":"Introduction","text":"

    Mouse wheel events of phaser.

    • Author: Richard Davey
    "},{"location":"mousewheel/#usage","title":"Usage","text":""},{"location":"mousewheel/#mouse-wheel-events","title":"Mouse wheel events","text":"
    1. Events on touched Game object
      gameObject.on('wheel', function(pointer, dx, dy, dz, event){ /* ... */ });\n
    2. Event on input plugin for each touched Game object
      scene.input.on('gameobjectwheel', function(pointer, gameObject, dx, dy, dz, event){ /* ... */ });\n
    3. Events to get all touched Game Objects
      scene.input.on('wheel', function(pointer, currentlyOver, dx, dy, dz, event){ /* ... */ });\n
    "},{"location":"mousewheel/#mouse-wheel-properties","title":"Mouse wheel properties","text":"
    • pointer.deltaX : The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device.
    • pointer.deltaY : The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device.
    • pointer.deltaZ : The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device.
    "},{"location":"mousewheelscroller/","title":"Mouse wheel scroller","text":""},{"location":"mousewheelscroller/#introduction","title":"Introduction","text":"

    Emit scroll event when mouse-wheeling.

    • Author: Rex
    • Member of scene
    "},{"location":"mousewheelscroller/#live-demos","title":"Live demos","text":"
    • Scroller
    "},{"location":"mousewheelscroller/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"mousewheelscroller/#install-plugin","title":"Install plugin","text":""},{"location":"mousewheelscroller/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmousewheelscrollerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmousewheelscrollerplugin.min.js', true);\n
    • Add mouse-wheeling-to-cursor-key object
      var scroller = scene.plugins.get('rexmousewheelscrollerplugin').add(gameObject, config);\n
    "},{"location":"mousewheelscroller/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import MouseWheelScrollerPlugin from 'phaser3-rex-plugins/plugins/mousewheelscroller-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexMouseWheelScroller',\nplugin: MouseWheelScrollerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add mouse-wheeling-to-cursor-key object
      var scroller = scene.plugins.get('rexMouseWheelScroller').add(gameObject, config);\n
    "},{"location":"mousewheelscroller/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import MouseWheelScroller from 'phaser3-rex-plugins/plugins/mousewheelscroller.js';\n
    • Add mouse-wheeling-to-cursor-key object
      var scroller = new MouseWheelScroller(gameObject, config);\n
    "},{"location":"mousewheelscroller/#create-instance","title":"Create instance","text":"
    var scroller = scene.plugins.get('rexMouseWheelScroller').add(gameObject, {\n// focus: true,\n// speed: 0.1,\n// enable: true,\n});\n
    • focus : Fire 'scroll' event when mouse-wheeling --
      • false, or 0 : Without checking if cursor is over game object or not.
      • true, or 1 : Cursor is over game object. Default behavior.
      • 2 : Cursor is inside the rectangle bounds of game object.
    • speed : Scrolling speed. Default value is 0.1.
    • enable : Set true to enable 'scroll' event.
    "},{"location":"mousewheelscroller/#event","title":"Event","text":"
    • Scroll
      scroller.on('scroll', function(inc, gameObject, scroller) {\n\n}, scope)\n
      • inc : Scroll value,
        • Positive value : Mouse-wheeling down
        • Negative value : Mouse-wheeling up
    "},{"location":"mousewheelscroller/#speed","title":"Speed","text":"
    • Set
      scroller.setSpeed(speed);\n// scroller.speed = speed;\n
    • Get
      var speed = scroller.speed;\n
    "},{"location":"mousewheelscroller/#enable","title":"Enable","text":"
    • Set
      scroller.setEnable(enable);\n// scroller.enable = enable;\n
    • Get
      var enable = scroller.enable;\n
    "},{"location":"mousewheeltoupdown/","title":"Mouse-wheel to up/down","text":""},{"location":"mousewheeltoupdown/#introduction","title":"Introduction","text":"

    Map mouse-wheeling to (up/down) cursor key state.

    • Author: Rex
    • Member of scene
    "},{"location":"mousewheeltoupdown/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"mousewheeltoupdown/#install-plugin","title":"Install plugin","text":""},{"location":"mousewheeltoupdown/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmousewheeltoupdownplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmousewheeltoupdownplugin.min.js', true);\n
    • Add mouse-wheeling-to-cursor-key object
      var mouseWheelToUpDown = scene.plugins.get('rexmousewheeltoupdownplugin').add(scene);\n
    "},{"location":"mousewheeltoupdown/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import MouseWheelToUpDownPlugin from 'phaser3-rex-plugins/plugins/mousewheeltoupdown-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexMouseWheelToUpDown',\nplugin: MouseWheelToUpDownPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add mouse-wheeling-to-cursor-key object
      var mouseWheelToUpDown = scene.plugins.get('rexMouseWheelToUpDown').add(scene);\n
    "},{"location":"mousewheeltoupdown/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import MouseWheelToUpDown from 'phaser3-rex-plugins/plugins/mousewheeltoupdown.js';\n
    • Add mouse-wheeling-to-cursor-key object
      var mouseWheelToUpDown = new MouseWheelToUpDown(scene);\n
    "},{"location":"mousewheeltoupdown/#create-instance","title":"Create instance","text":"
    var mouseWheelToUpDown = scene.plugins.get('rexMouseWheelToUpDown').add(scene);\n
    "},{"location":"mousewheeltoupdown/#state-of-cursor-keys","title":"State of cursor keys","text":"
    var cursorKeys = mouseWheelToUpDown.createCursorKeys();\n\nvar upKeyDown = cursorKeys.up.isDown;\nvar downKeyDown = cursorKeys.down.isDown;\n

    Or

    var upKeyDown = mouseWheelToUpDown.up;\nvar downKeyDown = mouseWheelToUpDown.down;\nvar noKeyDown = mouseWheelToUpDown.noKey;\n
    "},{"location":"mousewheeltoupdown/#destroy","title":"Destroy","text":"
    mouseWheelToUpDown.destroy();\n
    "},{"location":"moveto/","title":"Move to","text":""},{"location":"moveto/#introduction","title":"Introduction","text":"

    Move game object towards target position with a steady speed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"moveto/#live-demos","title":"Live demos","text":"
    • Move-to
    "},{"location":"moveto/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"moveto/#install-plugin","title":"Install plugin","text":""},{"location":"moveto/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexmovetoplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexmovetoplugin.min.js', true);\n
    • Add move-to behavior
      var moveTo = scene.plugins.get('rexmovetoplugin').add(gameObject, config);\n
    "},{"location":"moveto/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import MoveToPlugin from 'phaser3-rex-plugins/plugins/moveto-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexMoveTo',\nplugin: MoveToPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add move-to behavior
      var moveTo = scene.plugins.get('rexMoveTo').add(gameObject, config);\n
    "},{"location":"moveto/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import MoveTo from 'phaser3-rex-plugins/plugins/moveto.js';\n
    • Add move-to behavior
      var moveTo = new MoveTo(gameObject, config);\n
    "},{"location":"moveto/#create-instance","title":"Create instance","text":"
    var moveTo = scene.plugins.get('rexMoveTo').add(gameObject, {\n// speed: 400,\n// rotateToTarget: false\n});\n
    • speed : Moving speed, pixels in second.
    • rotateToTarget : Set true to change angle towards path.
    "},{"location":"moveto/#start-moving","title":"Start moving","text":"
    • Move to target position
      moveTo.moveTo(x, y);\n
      or
      moveTo.moveTo({\nx: 0,\ny: 0,\n// speed: 0\n});\n
      • x , y : Target position
    • Move from start position to current position
      moveTo.moveFrom(x, y);\n
      or
      moveTo.moveFrom({\nx: 0,\ny: 0,\n// speed: 0\n});\n
      • x , y : Start position
    • Move toward angle
      moveTo.moveToward(angle, distance);\n
      • angle : Angle in radian.
    "},{"location":"moveto/#target-position","title":"Target position","text":"
    var targetX = moveTo.targetX;\nvar targetY = moveTo.targetY;\n
    "},{"location":"moveto/#enable","title":"Enable","text":"
    • Enable (default)
      moveTo.setEnable();\n
      or
      moveTo.enable = true;\n
    • Disable
      moveTo.setEnable(false);\n
      or
      moveTo.enable = false;\n
    "},{"location":"moveto/#pause-resume-stop-moving","title":"Pause, Resume, stop moving","text":"
    moveTo.pause();\nmoveTo.resume();\nmoveTo.stop();\n
    "},{"location":"moveto/#set-speed","title":"Set speed","text":"
    moveTo.setSpeed(speed);\n// moveTo.speed = speed;\n
    "},{"location":"moveto/#set-rotate-to-target","title":"Set rotate-to-target","text":"
    moveTo.setRotateToTarget(rotateToTarget);\n
    • rotateToTarget : Set true to change angle towards target
    "},{"location":"moveto/#events","title":"Events","text":"
    • On start moving
      moveTo.on('start', function(gameObject, moveTo){});\n
    • On reached target
      moveTo.on('complete', function(gameObject, moveTo){});\n// moveTo.once('complete', function(gameObject, moveTo){});\n
    "},{"location":"moveto/#status","title":"Status","text":"
    • Is moving
      var isRunning = moveTo.isRunning;\n
    "},{"location":"mustache/","title":"Mustache","text":""},{"location":"mustache/#introduction","title":"Introduction","text":"

    Format string with variables. Reference

    "},{"location":"mustache/#usage","title":"Usage","text":"
    var template = 'hello, {{name}}';\nvar view = {\nname: 'rex'\n};\nvar result = Mustache.render(template, view);\n
    "},{"location":"ninepatch/","title":"Nine patch","text":""},{"location":"ninepatch/#introduction","title":"Introduction","text":"

    Stretchable image, extended from RenderTexture game object.

    • Author: Rex
    • Game object
    "},{"location":"ninepatch/#live-demos","title":"Live demos","text":"
    • 3x3, 3x3
    • 5x5
    • Custom frame name
    • Custom base frame name
    • Preserve ratio
    • Max-fixed-part-scale
    "},{"location":"ninepatch/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ninepatch/#install-plugin","title":"Install plugin","text":""},{"location":"ninepatch/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexninepatchplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexninepatchplugin.min.js', true);\n
    • Add nine-patch object
      var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import NinePatchPlugin from 'phaser3-rex-plugins/plugins/ninepatch-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexNinePatchPlugin',\nplugin: NinePatchPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add nine-patch object
      var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import NinePatch from 'phaser3-rex-plugins/plugins/ninepatch.js';\n
    • Add nine-patch object
      var ninePatch = new NinePatch(scene, x, y, width, height, key, baseFrame, columns, rows, config);\nscene.add.existing(ninePatch);\n
    "},{"location":"ninepatch/#create-instance","title":"Create instance","text":"
    var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, baseFrame, columns, rows, {\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, columns, rows, {\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch(x, y, width, height, key, {\ncolumns: undefined, // leftWidth: undefined, right: undefined,\nrows: undefined,    // topHeight: undefined, bottomHeight: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch(x, y, width, height, {\nkey: undefined,\ncolumns: undefined, // leftWidth: undefined, right: undefined,\nrows: undefined,    // topHeight: undefined, bottomHeight: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch(x, y, {\nwidth: 1, height: 1,\nkey: undefined,\ncolumns: undefined, // leftWidth: undefined, right: undefined,\nrows: undefined,    // topHeight: undefined, bottomHeight: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch({\nx: 0, y: 0,\nwidth: 1, height: 1,\nkey: undefined,\ncolumns: undefined, // leftWidth: undefined, rightWidth: undefined,\nrows: undefined,    // topHeight: undefined, bottomHeight: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,  // frame: undefined,\ngetFrameNameCallback: undefined\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • key : Texture key of source image.
    • baseFrame, or frame : Frame name of base texture.
      • undefined : Use default base frame '__BASE'.
    • columns : Configuration of columns.
      • A number array, like [20, 20, 20], or [20, undefined, 20] : Width of each column. undefined value will be replaced by remainder value from texture width.
        • Width of odd columns (column 0, column 2, ...) will be origin width.
        • Width of even columns (column 1, column 3, ...) will be stretched.
    • leftWidth, rightWidth : Set columns to [leftWidth, undefined, rightWidth], if columns is undefined.
    • rows : Configuration of rows.
      • A number array, like [20, 20, 20], or [20, undefined, 20] : Height of each row. undefined value will be replaced by remainder value from texture width.
        • Height of odd rows (row 0, row 2, ...) will be origin height.
        • Height of odd rows (row 1, row 3, ...) will be stretched.
    • topHeight, bottomHeight : Set rows to [topHeight, undefined, bottomHeight], if rows is undefined.
    • preserveRatio : Preserve ratio of fixed parts (i.e. displaying in origin size). Default is true.
    • maxFixedPartScale : Max scale value of fixed-part.
    • stretchMode : Stretch mode of edges and internal cells.
      • A number (0, or 1), or a string ('scale', or 'repeat'):
        • 0, or 'scale' : Stretch each edge and internal cell by scaled image. Default value.
        • 1, or 'repeat' : Stretch each edge and internal cell by repeated image (tile-sprite).
      • An object :
        {\nedge: 0, // 'scale', or 1, 'repeat'\ninternal: 0, // 'scale', or 1, 'repeat'\n}\n
    • getFrameNameCallback : Callback to get frame name of each cell.
      • undefined : Use default callback.
        • If baseFrame is '__BASE' : return ${colIndex},${rowIndex}
        • Else : return ${baseFrame}_${colIndex},${rowIndex}
      • Function object : Return a string, or undefined.
        function(colIndex, rowIndex, baseFrame) {\nreturn `${colIndex},${rowIndex}`;\n}\n
    "},{"location":"ninepatch/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNinePatch extends NinePatch {\nconstructor(scene, x, y, width, height, key, baseFrame, columns, rows, config) {\nsuper(scene, x, y, width, height, key, baseFrame, columns, rows, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var ninePatch = new MyNinePatch(scene, x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch/#resize","title":"Resize","text":"
    ninePatch.resize(width, height);\n

    Will update texture

    "},{"location":"ninepatch/#set-base-texture-of-source-image","title":"Set base texture of source image","text":"
    ninePatch.setBaseTexture(key, baseFrame, columns, rows);\n

    or

    ninePatch.setBaseTexture(key, baseFrame, leftWidth, rightWidth, topHeight, bottomHeight);\n

    or

    ninePatch.setBaseTexture(key, baseFrame);\n
    • key : Texture key of source image.
    • baseFrame : Frame name of base texture.
      • undefined, or null : Use default base frame '__BASE'. Default value.
    • columns : Configuration of columns.
      • A number array, like [20, 20, 20] : Width of each column.
        • Width of odd columns (column 0, column 2, ...) will be origin width.
        • Width of even columns (column 1, column 3, ...) will be stretched.
      • undefined : If columns and rows are undefined, it will use current configuration of columns and rows.
    • rows : Configuration of rows.
      • A number array, like [20, 20, 20] : Height of each row.
        • Height of odd rows (row 0, row 2, ...) will be origin height.
        • Height of odd rows (row 1, row 3, ...) will be stretched.
      • undefined : If columns and rows are undefined, it will use current configuration of columns and rows.
    • leftWidth, rightWidth : Set columns to [leftWidth, undefined, rightWidth].
    • topHeight, bottomHeight : Set rows to [topHeight, undefined, bottomHeight].

    Will update texture

    "},{"location":"ninepatch/#set-stretch-mode","title":"Set stretch mode","text":"
    ninePatch.setStretchMode(mode);\n
    • mode :
      • A number (0, or 1), or a string ('scale', or 'repeat'):
        • 0, or 'scale' : Stretch each edge and internal cell by scaled image. Default value.
        • 1, or 'repeat' : Stretch each edge and internal cell by repeated image (tile-sprite).
      • An object :
        {\nedge: 0, // 'scale', or 1, 'repeat'\ninternal: 0, // 'scale', or 1, 'repeat'\n}\n
    "},{"location":"ninepatch/#set-get-frame-name-callback","title":"Set get-frame-name callback","text":"
    ninePatch.setGetFrameNameCallback(callback);\n
    • callback : Return a string, or undefined.
      function(colIndex, rowIndex, baseFrame) {\nreturn `${colIndex},${rowIndex}`\n}\n
    "},{"location":"ninepatch/#fixed-part-scale","title":"Fixed-part scale","text":"
    • Fixed-part scale
      • Get
        var scaleX = ninePatch.fixedPartScaleX;\nvar scaleY = ninePatch.fixedPartScaleY;\n
    • Max fixed-part scale
      • Get
        var scaleX = ninePatch.maxFixedPartScaleX;\nvar scaleY = ninePatch.maxFixedPartScaleY;\n
      • Set
        ninePatch.setMaxFixedPartScale(scale);\n// ninePatch.setMaxFixedPartScale(scaleX, scaleY);\n
        or
        ninePatch.maxFixedPartScaleX = scaleX;\nninePatch.maxFixedPartScaleY = scaleY;\n
    "},{"location":"ninepatch/#update-texture","title":"Update texture","text":"
    ninePatch.updateTexture();\n
    "},{"location":"ninepatch/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"ninepatch/#create-mask","title":"Create mask","text":"
    var mask = ninePatch.createBitmapMask();\n

    See mask

    "},{"location":"ninepatch/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"ninepatch/#compare-with-nine-slice","title":"Compare with nine-slice","text":"
    • Nine-slice is a built-in game object.
    • Nine-slice has better render performance.
      • Nine-patch extends from render-texture, which will create a new texture, then draw frames on it.
    • Nine-slice is webgl mode only.
    • Nine-slice does not have flip, crop methods.
    "},{"location":"ninepatch2/","title":"Nine patch2","text":""},{"location":"ninepatch2/#introduction","title":"Introduction","text":"

    Stretchable image. Has better performance than nine-patch.

    • Author: Rex
    • Game object
    "},{"location":"ninepatch2/#live-demos","title":"Live demos","text":"
    • 3x3
    • Performance test
    "},{"location":"ninepatch2/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ninepatch2/#install-plugin","title":"Install plugin","text":""},{"location":"ninepatch2/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexninepatch2plugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexninepatch2plugin.min.js', true);\n
    • Add nine-patch object
      var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch2/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import NinePatch2Plugin from 'phaser3-rex-plugins/plugins/ninepatch2-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexNinePatch2Plugin',\nplugin: NinePatch2Plugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add nine-patch object
      var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch2/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import NinePatch2 from 'phaser3-rex-plugins/plugins/ninepatch2.js';\n
    • Add nine-patch object
      var ninePatch = new NinePatch2(scene, x, y, width, height, key, baseFrame, columns, rows, config);\nscene.add.existing(ninePatch);\n
    "},{"location":"ninepatch2/#create-instance","title":"Create instance","text":"
    var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, baseFrame, columns, rows, {\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, columns, rows, {\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2(x, y, width, height, key, {\ncolumns: undefined,\nrows: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2(x, y, width, height, {\nkey: undefined,\ncolumns: undefined,\nrows: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2(x, y, {\nwidth: 1, height: 1,\nkey: undefined,\ncolumns: undefined,\nrows: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n

    or

    var ninePatch = scene.add.rexNinePatch2({\nx: 0, y: 0,\nwidth: 1, height: 1,\nkey: undefined,\ncolumns: undefined,\nrows: undefined,\n\n// preserveRatio: true,\n// maxFixedPartScale: 1,\n// stretchMode: 0,\nbaseFrame: undefined,\ngetFrameNameCallback: undefined\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • key : Texture key of source image.
    • baseFrame : Frame name of base texture.
      • undefined : Use default base frame '__BASE'.
    • columns : Configuration of columns.
      • A number array, like [20, 20, 20], or [20, undefined, 20] : Width of each column. undefined value will be replaced by remainder value from texture width.
        • Width of odd columns (column 0, column 2, ...) will be origin width.
        • Width of even columns (column 1, column 3, ...) will be stretched.
    • rows : Configuration of rows.
      • A number array, like [20, 20, 20], or [20, undefined, 20] : Height of each row. undefined value will be replaced by remainder value from texture width.
        • Height of odd rows (row 0, row 2, ...) will be origin height.
        • Height of odd rows (row 1, row 3, ...) will be stretched.
    • preserveRatio : Preserve ratio of fixed parts (i.e. displaying in origin size). Default is true.
    • maxFixedPartScale : Max scale value of fixed-part.
    • stretchMode : Stretch mode of edges and internal cells.
      • A number (0, or 1), or a string ('scale', or 'repeat'):
        • 0, or 'scale' : Stretch each edge and internal cell by scaled image. Default value.
        • 1, or 'repeat' : Stretch each edge and internal cell by repeated image (tile-sprite).
      • An object :
        {\nedge: 0, // 'scale', or 1, 'repeat'\ninternal: 0, // 'scale', or 1, 'repeat'\n}\n
    • getFrameNameCallback : Callback to get frame name of each cell.
      • undefined : Use default callback.
        • If baseFrame is '__BASE' : return ${colIndex},${rowIndex}
        • Else : return ${baseFrame}:${colIndex},${rowIndex}
      • Function object : Return a string, or undefined.
        function(colIndex, rowIndex, baseFrame) {\nreturn `${colIndex},${rowIndex}`;\n}\n
    "},{"location":"ninepatch2/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNinePatch extends NinePatch2 {\nconstructor(scene, x, y, width, height, key, baseFrame, columns, rows, config) {\nsuper(scene, x, y, width, height, key, baseFrame, columns, rows, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var ninePatch = new MyNinePatch(scene, x, y, width, height, key, baseFrame, columns, rows, config);\n
    "},{"location":"ninepatch2/#resize","title":"Resize","text":"
    ninePatch.resize(width, height);\n

    Will update texture

    "},{"location":"ninepatch2/#tint","title":"Tint","text":"
    • Set tint
      ninePatch.setTint(tint);\n
    • Clear tint
      ninePatch.clearTint();\n
    • Set tint fill
      ninePatch.setTintFill(tint);\n
    • Get tint
      var tint = ninePatch.tint;\nvar tintFill = ninePatch.tintFill;\n
      • tintFill :
        • false : Solid tint + texture alpha
        • true : Solid tint, no texture
    "},{"location":"ninepatch2/#set-texture-of-source-image","title":"Set texture of source image","text":"
    ninePatch.setBaseTexture(key, baseFrame, columns, rows);\n// ninePatch.setBaseTexture(key, columns, rows);\n
    • key : Texture key of source image.
    • baseFrame : Frame name of base texture.
      • undefined : Use default base frame '__BASE'. Default value.
    • columns : Configuration of columns.
      • A number array, like [20, 20, 20] : Width of each column.
        • Width of odd columns (column 0, column 2, ...) will be origin width.
        • Width of even columns (column 1, column 3, ...) will be stretched.
    • rows : Configuration of rows.
      • A number array, like [20, 20, 20] : Height of each row.
        • Height of odd rows (row 0, row 2, ...) will be origin height.
        • Height of odd rows (row 1, row 3, ...) will be stretched.

    Will update texture

    "},{"location":"ninepatch2/#set-stretch-mode","title":"Set stretch mode","text":"
    ninePatch.setStretchMode(mode);\n
    • mode :
      • A number (0, or 1), or a string ('scale', or 'repeat'):
        • 0, or 'scale' : Stretch each edge and internal cell by scaled image. Default value.
        • 1, or 'repeat' : Stretch each edge and internal cell by repeated image (tile-sprite).
      • An object :
        {\nedge: 0, // 'scale', or 1, 'repeat'\ninternal: 0, // 'scale', or 1, 'repeat'\n}\n
    "},{"location":"ninepatch2/#set-get-frame-name-callback","title":"Set get-frame-name callback","text":"
    ninePatch.setGetFrameNameCallback(callback);\n
    • callback : Return a string, or undefined.
      function(colIndex, rowIndex, baseFrame) {\nreturn `${colIndex},${rowIndex}`\n}\n
    "},{"location":"ninepatch2/#fixed-part-scale","title":"Fixed-part scale","text":"
    • Fixed-part scale
      • Get
        var scaleX = ninePatch.fixedPartScaleX;\nvar scaleY = ninePatch.fixedPartScaleY;\n
    • Max fixed-part scale
      • Get
        var scaleX = ninePatch.maxFixedPartScaleX;\nvar scaleY = ninePatch.maxFixedPartScaleY;\n
      • Set
        ninePatch.setMaxFixedPartScale(scale);\n// ninePatch.setMaxFixedPartScale(scaleX, scaleY);\n
        or
        ninePatch.maxFixedPartScaleX = scaleX;\nninePatch.maxFixedPartScaleY = scaleY;\n
    "},{"location":"ninepatch2/#update-texture","title":"Update texture","text":"
    ninePatch.updateTexture();\n
    "},{"location":"ninepatch2/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"ninepatch2/#create-mask","title":"Create mask","text":"
    var mask = ninePatch.createBitmapMask();\n

    See mask

    "},{"location":"ninepatch2/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"ninepatch2/#compare-with-nine-patch","title":"Compare with nine-patch","text":"
    • Nine-patch2 has better performance.
      • Nine-patch extends from render-texture, which will create a new texture, then draw frames on it.
      • Nine-patch2 draws frames directly.
    • Nine-patch2 does not have flip, crop methods.
    • Nine-patch2 can't apply custom spriteFx pipeline.
    "},{"location":"nineslice/","title":"Nine slice","text":""},{"location":"nineslice/#introduction","title":"Introduction","text":"

    Display a texture-based object that can be stretched both horizontally and vertically, but that retains fixed-sized corners, built-in game object of phaser.

    • Author: Richard Davey

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"nineslice/#usage","title":"Usage","text":""},{"location":"nineslice/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"nineslice/#add-nine-slice-object","title":"Add nine slice object","text":"
    var nineSlice = scene.add.nineslice(x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n

    or

    var nineSlice = scene.add.nineslice(x, y, texture, frame, width, height);\n// var nineSlice = scene.add.nineslice(x, y, texture, frame);\n
    • If that frame (indexed by texture, frame) is generated by Texture Packer.

    Add nine slice from JSON

    var nineSlice = scene.make.nineslice({\nx: 0,\ny: 0,\nkey: '',\n// frame: '',\n\n// width: 256,\n// height: 256,\n// leftWidth: 10,\n// rightWidth: 10,\n// topHeight: 0,\n// bottomHeight: 0,\n\n// angle: 0,\n// alpha: 1,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"nineslice/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNineSlice extends Phaser.GameObjects.NineSlice {\nconstructor(scene, x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight) {\nsuper(scene, x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var nineSlice = new MyNineSlice(scene, x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n
    "},{"location":"nineslice/#resize","title":"Resize","text":"
    nineSlice.setSize(width, height);\n
    "},{"location":"nineslice/#set-texture-of-source-image","title":"Set texture of source image","text":"
    nineSlice.setTexture(texture, frame);\nnineSlice.setSlices(width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n
    "},{"location":"nineslice/#texture","title":"Texture","text":"

    See game object - texture

    "},{"location":"nineslice/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"nineslice/#create-mask","title":"Create mask","text":"
    var mask = nineSlice.createBitmapMask();\n

    See mask

    "},{"location":"nineslice/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"nineslice/#compare-with-nine-patch","title":"Compare with nine-patch","text":"
    • Nine-slice is a built-in game object.
    • Nine-slice has better render performance.
      • Nine-patch extends from render-texture, which will create a new texture, then draw frames on it.
    • Nine-slice is webgl mode only.
    • Nine-slice does not have flip, crop methods.
    "},{"location":"orientation/","title":"Orientation","text":""},{"location":"orientation/#introduction","title":"Introduction","text":"

    Get oriention, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"orientation/#usage","title":"Usage","text":""},{"location":"orientation/#orientation","title":"Orientation","text":"
    var orientation = scene.scale.orientation;\n
    "},{"location":"orientation/#events","title":"Events","text":"
    • On orientation change
      scene.scale.on('orientationchange', function(orientation) {\nswitch (orientation) {\ncase Phaser.Scale.PORTRAIT:\ncase Phaser.Scale.PORTRAIT_SECONDARY:\n// ...\nbreak;\n\ndefault:  // Phaser.Scale.LANDSCAPE or Phaser.Scale.LANDSCAPE_SECONDARY\n// ...\nbreak;\n}\n});\n
    "},{"location":"orientation/#lock-orientation","title":"Lock orientation","text":"
    scene.scale.lockOrientation(orientation)\n
    • orientation :
      • 'portrait'
      • 'landscape'
      • 'portrait-primary'
      • 'portrait-secondary'
      • 'landscape-primary'
      • 'landscape-secondary'
      • 'default'
    "},{"location":"pad/","title":"Pad","text":""},{"location":"pad/#introduction","title":"Introduction","text":"

    Takes the given string and pads it out, to the length required, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"pad/#usage","title":"Usage","text":"
    var result = Phaser.Utils.String.Pad(str, len, pad, dir);\n
    • str : String, or number.
    • len : Length or result string.
    • pad : The string to pad it out.
    • dir :
      • 1 : Left
      • 2 : Right
      • 3 : Both
    "},{"location":"particles-along-bounds/","title":"Particles along bounds","text":""},{"location":"particles-along-bounds/#introduction","title":"Introduction","text":"

    Emit particles along bounds of game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"particles-along-bounds/#live-demos","title":"Live demos","text":"
    • Particles-along-bounds
    "},{"location":"particles-along-bounds/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"particles-along-bounds/#install-plugin","title":"Install plugin","text":""},{"location":"particles-along-bounds/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexparticlesalongboundsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexparticlesalongboundsplugin.min.js', true);\n
    • Start emit particles along bounds of game object
      var particles = scene.plugins.get('rexparticlesalongboundsplugin').startEffect(gameObject, config);\n
    "},{"location":"particles-along-bounds/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DragPlugin from 'phaser3-rex-plugins/plugins/particlesalongbounds-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexParticlesAlongBounds',\nplugin: ParticlesAlongBoundsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Start emit particles along bounds of game object
      var particles = scene.plugins.get('rexParticlesAlongBounds').startEffect(gameObject, config);\n
    "},{"location":"particles-along-bounds/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ParticlesAlongBounds from 'phaser3-rex-plugins/plugins/particlesalongbounds.js';\n
    • Start emit particles along bounds of game object
      var particles = ParticlesAlongBounds(gameObject, config);\n
    "},{"location":"particles-along-bounds/#create-instance","title":"Create instance","text":"
    var particles = scene.plugins.get('rexParticlesAlongBounds').startEffect(gameObject, {\ntextureKey: key,\n// textureFrames: undefined,\n// padding: 0,\n// blendMode: 'ADD',\n// lifespan: 1000,\n// stepRate: 10,\n// spread: 10,\n\n// scale: undefined,\n// alpha: undefined,\n// tint: undefined,\n\n// repeat: 0,\n// gravityX: 0,\n// gravityY: 0,\n// duration: undefined\n});\n
    • padding : Extra padded space around bounds of game object. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • textureKey : Texture key of particles.
    • textureFrames : : One or more texture frames, or a configuration object.
      • String or number value.
      • Array of string or number value.
      • Configuration object :
        {\nframes: [],\ncycle: false,\nquantity: 1\n}\n
    • blendMode : Blend mode of particles. Default value is ADD.
    • lifespan : Lifespan of particle.
    • stepRate : Step length between each particle's initial position along bounds of game object.
    • spread : Moving speed of particle.
    • scale : Scale changing of particle.
    • alpha : Alpha changing of particle.
    • tint : Tint changing of particle.
    • repeat : Fire particles around bounds repeatly.
      • 0 : Fire particles around bounds one time, default value.
    • gravityX, gravityY : Gravity vector of world axis. This vector will rotate back if game object is rotated.
    • duration : Total duration from firing of 1st particle to destroy last particle.
      • undefined : Use default behavior of particles
      • Less or equal to lifespan : Fires all particles at begining.

    Format of spread, scale, alpha, tint parameters :

    • {min, max} : Pick a random value between min and max
    • {start, end} : Pick values incremented continuously across a range. (ease='Linear')
      • {start, end, ease}
    • {start, end, steps} : Pick values incremented by steps across a range.
    • {start, end, random}
      • random: true or false
    • {min, max, steps} : Pick values between min to max, with steps.
    • {onEmit: function(particle, key, t, value) {return value}} : Get return value from a function invoking.
    "},{"location":"particles-along-bounds/#is-running","title":"Is running","text":"
    var isRunning = particles.isRunning;\n
    "},{"location":"particles-along-bounds/#events","title":"Events","text":"
    • On fire completed, i.e. last particle is dead
      particles.on('complete', function(gameObject, particles){\n\n}, scope);\n
    "},{"location":"particles/","title":"Particles","text":""},{"location":"particles/#introduction","title":"Introduction","text":"

    Particles uses its own lightweight physics system, and can interact only with its Emitter's bounds and zones. Built-in game object of phaser.

    • Author: Richard Davey

    Note

    API is not compatible with 3.55.x

    "},{"location":"particles/#usage","title":"Usage","text":""},{"location":"particles/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"particles/#add-particle","title":"Add particle","text":"
    var particles = scene.add.particles(x, y, texture, {\n\n// EmitterOp\naccelerationX: 0,\naccelerationY: 0,\nalpha: 1,\nangle: { min: 0, max: 360 },\nbounce: 0,\ncolor: undefined,\ndelay: 0,\nhold: 0,\nlifespan: 1000,\nmaxVelocityX: 10000,\nmaxVelocityY: 10000,\nmoveToX: 0,\nmoveToY: 0,\nquantity: 1,\nrotate: 0,\nscaleX: 1,\nscaleY: 1,\n// scale:\nspeedX: 0,\nspeedY: 0,\nspeed: tint: 0xffffff,\nx: 0,\ny: 0,\n\n// Emitter properties\nactive:\nadvance:\nblendMode:\ncolorEase:\ndeathCallback:\ndeathCallbackScope:\nduration:\nemitCallback:\nemitCallbackScope:\n// callbackScope    \nfrequency:\ngravityX:\ngravityY:\nmaxAliveParticles:\nmaxParticles:\nname:\nemitting:\nparticleBringToTop:\nparticleClass:\nradial:\nsortCallback:\nsortOrderAsc:\nsortProperty:\nstopAfter:\ntintFill:\ntimeScale:\ntrackVisible:\nvisible:\n\n// Position\n// emitZone : random-zone, edge-zone\n// random-zone\nemitZone: {\ntype: 'random',\nsource: geom,\n},\n\n// edge-zone\nemitZone:{\ntype: 'edge',\nsource: geom,\nquantity: 1,\nstepRate: 0,\ntotal: -1,\nyoyo: false,\nseamless: true\n},\n\ndeathZone: {\ntype: 'onEnter', // 'onEnter', or 'onLeave'\nsource: geom,\n},\n\nbounds:               // {x, y, w, h}, or {x, y, width, height}, or Phaser.Geom.Rectangle\ncollideLeft: true,\ncollideRight: true,\ncollideTop: true,\ncollideBottom: true,\n\nfollow:\nfollowOffset:{\nx: 0,\ny: 0\n},\n\n// Texture\ntexture:\nframe:\nanim: [],  // string, or array of string\n\nreserve: 0,\nadvance: 0\n});\n
    • Parameters of EmitterOp : Number, Random Array, Custom Callback, Stepped start/end, Eased start/end, min/max, Random object, Custom onEmit onUpdate, Interpolation
      • A number
      • {min, max} : Pick a random value between min and max
      • {min, max, int}
      • {start, end} : Pick values incremented continuously across a range. (ease='Linear')
        • {start, end, ease}
        • {start, end, ease, easeParams}
      • {start, end, steps} : Pick values incremented by steps across a range.
      • {start, end, steps, yoyo: true}
      • {start, end, random}
        • random: true or false
      • {random: [start, end]} : Pick a random number between start and and.
      • [a, b, c, d] : Pick a random number from an array.
      • {min, max, steps} : Pick values between min to max, with steps.
      • { values: [ a, b, c, d ], interpolation: 'catmull', ease: 'linear' } : Interpolation (linear, bezier, catmull) in values array.
      • function(particle, key, t, value) { return value; }
      • {onEmit, onUpdate} : Get return value from a function invoking.
        function(particle, key, t, value) {\nreturn value;\n}\n
    • active : Whether this emitter updates itself and its particles.
      • false : Equal to pause.
    • advance : If you wish to fast forward the emitter in time, set this value to a number representing the amount of ms the emitter should advance.
    • blendMode : See blend mode
    • colorEase : The string-based name of the Easing function to use if you have enabled Particle color interpolation via the color property, otherwise has no effect.
    • deathCallback, deathCallbackScope
      function(particle) {\n\n}\n
    • emitCallback, emitCallbackScope
      function(particle, emitter) {\n\n}\n
    • duration : Limit the emitter to emit particles for a maximum of duration ms.
      • 0 : Forever, default behavior.
    • follow : A Game Object whose position is used as the particle origin.
    • followOffset : The offset of the particle origin from thefollow target.
    • frequency
      • 0 : One particle flow cycle for each logic update (the maximum flow frequency).
      • > 0 : The time interval between particle flow cycles in ms.
      • -1 : Exploding emitter.
    • hold : Frozen or 'held in place' after it has finished its lifespan for a set number of ms
    • gravityX, gravityY
    • maxAliveParticles
    • maxParticles
      • 0 : Unlimited.
      • > 0 : Hard limit the amount of particle objects.
    • frames : One or more texture frames, or a configuration object.
      • String or number value
      • Array of string or number value
      • Configuration object :
        {\nframes: [],\ncycle: false,\nquantity: 1\n}\n
    • anim :
      • String
      • Array of string
      • Configuration object :
        {\nanim: [],  // Array of string\ncycle: false,\nquantity: 1\n}\n
    • particleBringToTop :
      • true : Newly emitted particles are added to the top of the particle list, i.e. rendered above those already alive. Default behavior.
    • sortCallback : The callback used to sort the particles.
    • sortProperty : Optionally sort the particles before they render based on this property. The property must exist on the Particle class, such as y, lifeT, scaleX, etc.
    • sortOrderAsc : When sortProperty is defined this controls the sorting order, either ascending or descending.
    • stopAfter : The Particle Emitter will stop emitting particles once this total has been reached. It will then enter a 'stopped' state, firing the STOP event.
    • radial : A radial emitter will emit particles in all directions between angle min and max,
    • emitting : Controls if the emitter is currently emitting a particle flow (when frequency >= 0). Already alive particles will continue to update until they expire.
      • false : Equal to stop
    • tintFill :
    • timeScale : The time rate applied to active particles, affecting lifespan, movement, and tweens. Values larger than 1 are faster than normal.
    • trackVisible : Whether the emitter's visible state will track the follow target's visibility state.
    • emitZone :
      • Emit zone
        {\ntype: 'random',\nsource: geom,\n}            
      • Emit edge
        {\ntype: 'edge',\nsource: curve,\n\nquantity: 1,\nstepRate: 0,\nyoyo: false,\nseamless: true\n}            
    • deathZone
      {\ntype: 'onEnter', // 'onEnter', or 'onLeave'\nsource: geom\n}\n
    • bounds : {x, y, w, h}, or {x, y, width, height}, or Rectangle.
    • collideLeft, collideRight, collideTop, collideBottom : Whether particles interact with the left/right/top/bottom edge of the bounds.
    • name
    • particleClass
    "},{"location":"particles/#control","title":"Control","text":"
    • Start
      emitter.start();\n// emitter.start(advance, duration);\n
      • advance : Advance this number of ms in time through the emitter.
      • duration : Limit this emitter to only emit particles for the given number of ms. Setting this parameter will override any duration already set in the Emitter configuration object.
    • Stop
      emitter.stop();\n// emitter.stop(kill);\n
      • kill :
        • true : Kill all particles immediately
        • false : Leave them to die after their lifespan expires. Default behavior.
    • Pause
      emitter.pause();  // set `active` to false\n
    • Resume
      emitter.resume();  // set `active` to true\n
    • Starts (or restarts) a particle flow.
      emitter.flow(frequency, count, stopAfter);\n
      • frequency :
        • >= 0 : The time interval of each flow cycle, in ms
        • -1 : Explosion mode.
      • count : The number of particles to emit at each flow cycle.
      • stopAfter : Stop this emitter from firing any more particles once this value is reached.
        • Setting this parameter will override any stopAfter value already set in the Emitter configuration object.
        • 0 : Unlimited
    • Explode : Puts the emitter in explode mode (frequency = -1), stopping any current particle flow, and emits several particles all at once.
      emitter.explode();\n// emitter.explode(count, x, y);\n
      • count : The number of Particles to emit.
      • x, y : The x, y coordinate to emit the Particles from.
    • Emit : Emits particles at the given position. If no position is given, it will emit from this Emitters current location.
      emitter.emitParticleAt();\n// emitter.emitParticleAt(x, y, count);    \n
      or
      emitter.emitParticle(count, x, y);\n
      • count : The number of Particles to emit.
      • x, y : The x, y coordinate to emit the Particles from.
    • Fast forward
      emitter.fastForward(time, delta);\n
      • time : The number of ms to advance the Particle Emitter by.
      • delta : The amount of delta to use for each step. Defaults to 1000 / 60.
    • Kill all alive particles
      emitter.killAll()\n
    "},{"location":"particles/#follow-target","title":"Follow target","text":"
    • Start
      emitter.startFollow(target);\n// emitter.startFollow(target, offsetX, offsetY, trackVisible);\n
      • target : The Game Object to follow.
      • offsetX, offsetY : Horizontal/vertical offset of the particle origin from the Game Object.
      • trackVisible : Whether the emitter's visible state will track the target's visible state.
    • Stop
      emitter.stopFollow();\n
    "},{"location":"particles/#frame","title":"Frame","text":"

    emitter.setEmitterFrame(frames);\n// emitter.setEmitterFrame(frames, pickRandom, quantity);\n
    - frames : One or more texture frames, or a configuration object. - String or number value - Array of string or number value - Configuration object :
    {\nframes: [],\ncycle: false,\nquantity: 1\n}\n
    - pickRandom : - true : Whether frames should be assigned at random from frames. Default behavior. - quantity : The number of consecutive particles that will receive each frame. Default value is 1.

    "},{"location":"particles/#animation","title":"Animation","text":"

    emitter.setAnim(anims);\n// emitter.setAnim(anims, pickRandom, quantity);\n
    - anims : One or more animations, or a configuration object. - String - Array of string - Configuration object :
    {\nanims: [],\ncycle: false,\nquantity: 1\n}\n
    - anims : One or more animations names, or Play Animation Config objects. - String - Array of string - Animation config - Array of Animation config - pickRandom : - true : Whether frames should be assigned at random from frames. Default behavior. - quantity : The number of consecutive particles that will receive each frame. Default value is 1.

    "},{"location":"particles/#particle","title":"Particle","text":"
    • Speed
      emitter.setParticleSpeed(x, y);\n
      or
      emitter.speedX = x;\nemitter.speedY = y;\n
      • Changes the emitter from radial to a point emitter
    • Bounce
      emitter.bounce = value;\n
      • 0 : No bounce
      • 1 : Full rebound
    • Max velocity
      emitter.maxVelocityX = x;\nemitter.maxVelocityY = y;\n
    • Gravity
      emitter.setParticleGravity(x, y);\n
      or
      emitter.gravityX = x;\nemitter.gravityY = y;\n
    • Acceleration
      emitter.accelerationX = x;\nemitter.accelerationY = y;\n
    • Lifespan : Sets the lifespan of newly emitted particles in milliseconds.
      emitter.setParticleLifespan(time);\n
      or
      emitter.lifespan = time\n
    • The number of milliseconds to wait after emission before the particles start updating.
      emitter.delay = time;\n
    • The number of milliseconds to wait after a particle has finished its life before it will be removed.
      emitter.hold = time;\n
    • Tint
      emitter.setParticleTint(tint);\n
      or
      emitter.particleTint = tint;\n
      • Webgl only
    • Color
      emitter.particleColor = color;   // WebGL only.\nemitter.colorEase = easeName;\n
      • Webgl only
    • Alpha
      emitter.setParticleAlpha(alpha);\n
      or
      emitter.setAlpha(alpha);\n
      or
      emitter.particleAlpha = alpha;\n
    • Scale : Sets the vertical and horizontal scale of the emitted particles.
      emitter.setParticleScale(x, y);\n
      or
      emitter.setScale(x, y);\n
      or
      emitter.particleScaleX = x;\nemitter.particleScaleY = y;\n
    • Position
      emitter.particleX = x;\nemitter.particleY = y;\n
    • Position to move toward
      emitter.moveToX = x;\nemitter.moveToY = y;\n
    • The angle at which the particles are emitted.
      emitter.particleAngle = angle;  // degrees    \n
    • The rotation (or angle) of each particle when it is emitted.
      emitter.particleRotate = rotation; // degrees\n
    • The number of particles that are emitted each time an emission occurs
      emitter.quantity = quantity;\n
    • Hard limit the amount of particle objects
      var count = emitter.maxParticles;\n
      • Whether this emitter is at its limit
        var atLimit = emitter.atLimit();\n
    • Alive (active) particles
      • Amount of alive particles
        var count = emitter.getAliveParticleCount();\n
        or
        var count = emitter.alive.length;\n
      • Add callback for newly emitted particle
        var callback = function(particle, emitter) { /* ... */ }\nemitter.onParticleEmit(callback, context);\n
        • Clear callback
          emitter.onParticleEmit();\n
      • For each alive particle
        var callback = function(particle, emitter) { /* ... */ }\nemitter.forEachAlive(callback, context);\n
    • Dead (inactive) particles
      • Amount of dead particles
        var count = emitter.getDeadParticleCount();\n
        or
        var count = emitter.dead.length;\n
      • Add callback for each particle death
        var callback = function(particle, emitter) { /* ... */ }\nemitter.onParticleDeath(callback, context);\n
        • Clear callback
          emitter.onParticleDeath();\n
      • For each dead particle
        var callback = function(particle, emitter) { /* ... */ }\nemitter.forEachDead(callback, context);\n
      • Add dead particles into pool
        emitter.reserve(count);\n
    • Total (alive + dead) number of particles.
      var count = emitter.getParticleCount();\n
    • Active particles overlaps with a Rectangle Geometry object or an Arcade Physics Body.
      var particles = emitter.overlap(target);\n
      • target :
        • A Rectangle.
        • Arcade Physics Body.
      • particles : An array of Particles that overlap with the given target
    • Gets a bounds Rectangle calculated from the bounds of all currently active Particles
      emitter.getBounds(padding, advance, delta, output);\n
      • padding : The amount of padding, in pixels, to add to the bounds Rectangle.
      • advance, delta : Fast forward in time to try and allow the bounds to be more accurate.
      • output : The Rectangle to store the results in.
    • Gets the bounds of this particle as a Geometry Rectangle
      particle.getBounds();\n
    "},{"location":"particles/#render-order","title":"Render order","text":"
    • Sort by property
      emitter.setSortProperty(property, ascending);\n
      • property : The property on the Particle class to sort by.
      • ascending : Should the particles be sorted in ascending or descending order?
    • Sort by callback
      var callback = function(particleA, particleB) {\nreturn 1; // 0,1,-1\n}\nemitter.setSortCallback(callback);\n
    "},{"location":"particles/#emitter","title":"Emitter","text":"
    • Frequency
      emitter.setFrequency(frequency);\n// emitter.setFrequency(frequency, quantity);\n
      • frequency :
        • >= 0 : The time interval of each flow cycle, in ms
        • -1 : Explosion mode.
      • quantity : The number of particles to release at each flow cycle or explosion.
    • Quantity
      emitter.setQuantity(quantity);\n
      • quantity : The number of particles to release at each flow cycle or explosion.
    "},{"location":"particles/#zone","title":"Zone","text":""},{"location":"particles/#emit-zone","title":"Emit zone","text":""},{"location":"particles/#add-emit-zone","title":"Add emit zone","text":"
    var zone = emitter.addEmitZone({\ntype: 'random',\nsource: geom,\n});\n
    • source : Geom like Circle, Ellipse, Rectangle,Triangle, Polygon, BitmapZone, or Path or Curve, which has getRandomPoint(point) method
      • Custom zone
        {\ngetRandomPoint: function(point) {\n// point.x = ...\n// point.y = ...\nreturn point;\n}\n}\n
    "},{"location":"particles/#add-emit-edge","title":"Add emit edge","text":"
    var zone = emitter.addEmitZone({\ntype: 'edge',\nsource: curve,\n\nquantity: 1,\nstepRate: 0,\nyoyo: false,\nseamless: true,\ntotal: -1\n});\n
    • source : Geom like Circle, Ellipse, Rectangle,Triangle, Polygon, or Path or Curve, which has getPoints(quantity, stepRate) method
      • Custom edge
        {\ngetPoints: function(quantity, stepRate) {\n// output = [point0, point1, ...];  // point: Phaser.Math.Vector2, or {x, y}\nreturn output;\n}\n}\n
    • quantity : The number of particles to place on the source edge. Set to 0 to use stepRate instead.
    • stepRate : The distance between each particle. When set, quantity is implied and should be set to 0.
    • yoyo : Whether particles are placed from start to end and then end to start. Default is false.
    • seamless : Whether one endpoint will be removed if it's identical to the other. Default is true.
    • total : The total number of particles this zone will emit before passing over to the next emission zone in the Emitter.

    quantity or stepRate

    • Any geometry like circle, ellipse, kine, polygon, rectangle, triangle source has quantity, or stepRate
    • Curve source has quantity, or stepRate
    • Path source only has quantity
    "},{"location":"particles/#set-emit-zone","title":"Set emit zone","text":"
    emitter.setEmitZone(zone);\n
    • zone : The Emit Zone to set as the active zone.
      • A zone object
      • A number as index
    "},{"location":"particles/#zone-source","title":"Zone source","text":"
    • Get
      // var zone = emitter.emitZones[i];\nvar source = zone.source;    
    • (Edge type only) Update points of curve source
      zone.updateSource();\n
    • (Edge type only) Set source to another curve, also update points
      zone.changeSource(curve);\n
    "},{"location":"particles/#remove-emit-zone","title":"Remove emit zone","text":"
    emitter.removeEmitZone(zone)\n
    "},{"location":"particles/#clear-emit-zone","title":"Clear emit zone","text":"

    emitter.clearEmitZones();\n
    or
    emitter.emitZones.length = 0;\nemitter.zoneIndex = 0;\n

    "},{"location":"particles/#death-zone","title":"Death zone","text":"
    var zone = emitter.addDeathZone({\ntype: 'onEnter',\nsource: geom\n});\n
    • type : 'onEnter' or 'onLeave'
    • source : Geom like Circle, Ellipse, Rectangle,Triangle, Polygon
      • Custom source :
        {\ncontains: function (x, y) {\n// ...\nreturn bool;\n}\n}\n
    "},{"location":"particles/#remove-death-zone","title":"Remove death zone","text":"
    emitter.removeDeathZone(zone)\n
    "},{"location":"particles/#clear-death-zone","title":"Clear death zone","text":"

    emitter.clearDeathZones();\n
    or
    emitter.deathZones.length = 0;\n

    "},{"location":"particles/#update-configuration","title":"Update Configuration","text":"
    emitter.updateConfig(config)\n
    • config : See config parameter in constructor.
    "},{"location":"particles/#events","title":"Events","text":"
    • Starts emission of particles.
      emitter.on('start', function(emitter) {\n\n})\n
    • Explodes a set of particles.
      emitter.on('explode', function(emitter, particle) {\n\n})\n
    • Death Zone kills a Particle instance.
      emitter.on('deathzone', function(emitter, particle, zone) {\n\n})\n
    • Stops emission
      emitter.on('stop', function(emitter) {\n\n})\n
      • Directly call the ParticleEmitter.stop method.
      • Stop after a set time via the duration property.
      • Stop after a set number of particles via the stopAfter property.
    • Complete Event, no particles are still rendering at this point in time.
      emitter.on('complete', function(emitter) {\n\n})\n
    "},{"location":"particles/#bounds","title":"Bounds","text":"
    • Add bounds
      var bounds = emitter.addParticleBounds(x, y, width, height);\n// var bounds = emitter.addParticleBounds(x, y, width, height, collideLeft, collideRight, collideTop, collideBottom);\n
      or
      var bounds = emitter.addParticleBounds(rect);\n
      • x, y, width, height, {x, y, width, height}, or {x, y, w, h}, or Rectangle : Bounds
      • collideLeft, collideRight, collideTop, collideBottom : Whether particles interact with the left/right/top/bottom edge of the bounds.
    • Collide edges
      bounds.collideLeft = enabled;\nbounds.collideRight = enabled;\nbounds.collideTop = enabled;\nbounds.collideBottom = enabled;\n
    • Bound rectangle
      var rect = bounds.bounds;\n
      • rect : Rectangle
    "},{"location":"particles/#gravity-well","title":"Gravity well","text":"
    • Create a gravity well
      var well = particles.createGravityWell({\n// x: 0,\n// y: 0,\n// power: 0,\n// epsilon: 100,\n// gravity: 50\n});\n
    • Enable
      • Active
        well.active = true;\n
      • Inactive
        well.active = false;\n
    • Position
      well.x = x;\nwell.y = y;\n
    • Gravity
      well.gravity = value;\n
    • Power
      well.power = value;\n
    "},{"location":"particles/#custom-particle-processor","title":"Custom Particle Processor","text":"
    • Declare Particle Processor class
      class MyParticleProcessor extends Phaser.GameObjects.Particles.ParticleProcessor {\nconstructor() {\nsuper(x, y, active);\n// ...\n}\n\nupdate(particle, delta, step, t) {\n// particle : The Particle to update.\n// delta : The delta time in ms.\n// step : The delta value divided by 1000.\n// t : The current normalized lifetime of the particle, between 0 (birth) and 1 (death).\n}\n\ndestroy() {\nsuper.destroy();\n}\n}\n
      • Override update method
    • Add to emitter
      var myParticleProcessor = emitter.addParticleProcessor(new MyParticleProcessor);\n
    "},{"location":"particles/#custom-particle-class","title":"Custom particle class","text":"
    class MyParticle extends Phaser.GameObjects.Particles.Particle {\nconstructor (emitter) {\nsuper(emitter);\n/* ... */\n}\n\nupdate (delta, step, processors) {\nsuper.update(delta, step, processors);\n/* ... */\n}\n}\n
    "},{"location":"particles/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"particles/#create-mask","title":"Create mask","text":"
    var mask = emitter.createBitmapMask();\n

    See mask

    "},{"location":"particles/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"path/","title":"Path","text":""},{"location":"path/#introduction","title":"Introduction","text":"

    Path in curves, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"path/#usage","title":"Usage","text":""},{"location":"path/#add-path-object","title":"Add path object","text":"
    var path = scene.add.path();\n// var path = scene.add.path(x, y);  // curve start from (x, y)\n

    or

    var path = new Phaser.Curves.Path();\n// var path = new Phaser.Curves.Path(x, y);  // curve start from (x, y)\n
    "},{"location":"path/#add-path-object-with-curves","title":"Add path object with curves","text":"

    Curves in JSON

    var path = scene.add.path(json);\n
    or
    var path = new Phaser.Curves.Path(json);\n

    "},{"location":"path/#add-curve","title":"Add curve","text":""},{"location":"path/#line","title":"Line","text":"
    • Add line object
      1. Create line object
        var curve = new Phaser.Curves.Line({x: x0, y: y0}, {x: x1, y: y1});\n
        or
        var curve = new Phaser.Curves.Line([x0, y0, x1, y1]);\n
      2. Add to path
        path.add(curve);\n
    • Add line started from previous end point to next point
      path.lineTo(endX, endY);\n
      or
      path.lineTo(new Phaser.Math.Vector2({x, y}));\n

    Properties:

    • curve.p0 : The first endpoint.
      • curve.p0.x, curve.p0.y
    • curve.p1 : The second endpoint.
      • curve.p1.x, curve.p1.y
    "},{"location":"path/#circleellipsearc","title":"Circle/ellipse/arc","text":"
    • Add circle/ellipse/arc object
      1. Create circle/ellipse/arc object
        • Circle
          var curve = new Phaser.Curves.Ellipse(x, y, radius);\n
        • Ellipse
          var curve = new Phaser.Curves.Ellipse(x, y, xRadius, yRadius);\n
        • Arc
          var curve = new Phaser.Curves.Ellipse(x, y, xRadius, yRadius, startAngle, endAngle, clockwise,     rotation);\n
      2. Add to path
        path.add(curve);\n
    • Add circle/ellipse/arc started from previous end point to next point
      • Circle
        path.circleTo(radius);\n
      • Ellipse
        path.ellipseTo(xRadius, yRadius);\n
      • Arc
        path.ellipseTo(xRadius, yRadius, startAngle, endAngle, clockwise, rotation);\n

    Properties:

    • curve.p0 : Center point.
      • curve.p0.x, curve.p0.y
    • curve.xRadius, curve.yRadius : Horizontal/vertical radiuse.
    • curve.startAngle, curve.endAngle : Start/end angle, in degrees.
    • curve.clockwise : true if Clockwise, false if anti-clockwise.
    • curve.angle : Rotation, in degrees.
      • curve.rotation : Rotation, in radians.
    "},{"location":"path/#spline","title":"Spline","text":"
    • Add spline object
      1. Create spline object
        var curve = new Phaser.Curves.Spline([\np0,            // {x, y}, or [x, y]\np1,            // {x, y}, or [x, y]\n// ...\n]);\n
        or
        var curve = new Phaser.Curves.Spline([\nx0, y0,\nx1, y1,\n// ...\n]);\n
      2. Add to path
        path.add(curve);\n
    • Add spline started from previous end point to next point
      var points = ;\npath.splineTo([\np0,            // {x, y}, or [x, y]\np1,            // {x, y}, or [x, y]\n// ...\n]);\n
      or
      path.splineTo([\nx0, y0,\nx1, y1,\n// ...\n]);\n
    "},{"location":"path/#append-point","title":"Append point","text":"
    var point = curve.addPoint(x, y);\n
    "},{"location":"path/#quadratic-bezier-curve","title":"Quadratic bezier curve","text":"
    1. Create quadratic bezier curve object
      var curve = new Phaser.Curves.QuadraticBezier(startPoint, controlPoint, endPoint); // point: {x, y}\n
      or
      var points = [\nx0, y0,     // start point\nx1, y1,     // control point\nx2, y2      // end point\n];\nvar curve = new Phaser.Curves.QuadraticBezier(points);\n
    2. Add to path
      path.add(curve);\n

    Add quadratic bezier curve started from previous end point to next point

    path.quadraticBezierTo(endX, endY, controlX, controlY);\n
    or
    path.quadraticBezierTo(endPoint, controlPoint);  // point : Phaser.Math.Vector2\n

    "},{"location":"path/#cubic-bezier-curve","title":"Cubic bezier curve","text":"
    1. Create quadratic bezier curve object
      var curve = new Phaser.Curves.CubicBezier(startPoint, controlPoint1, controlPoint2, endPoint); // point: {x, y}\n
      or
      var points = [\nx0, y0,     // start point\nx1, y1,     // control point1\nx2, y2,     // control point2\nx3, y3      // end point\n];\nvar curve = new Phaser.Curves.CubicBezier(points);\n
    2. Add to path
      path.add(curve);\n

    Add cubic bezier curve started from previous end point to next point

    path.cubicBezierTo(endX, endY, control1X, control1Y, control2X, control2Y);\n
    or
    path.cubicBezierTo(endPoint, controlPoint1, controlPoint2);  // point : Phaser.Math.Vector2\n

    "},{"location":"path/#move-to-point","title":"Move to point","text":"
    path.moveTo(x, y);\n
    "},{"location":"path/#add-curves-from-json","title":"Add curves from JSON","text":"
    path.fromJSON(json);\n
    "},{"location":"path/#get-curves","title":"Get curves","text":"
    var curves = path.curves;\n
    "},{"location":"path/#get-curve-at-t","title":"Get curve at t","text":"
    var curve = path.getCurveAt(t);\n
    • t : The normalized location on the Path. Between 0 and 1
    "},{"location":"path/#draw-on-graphics","title":"Draw on graphics","text":"
    path.draw(graphics);\n// path.draw(graphics, pointsTotal);\n
    • pointsTotal : The number of points to draw for each Curve.

    or

    curve.draw(graphics);\n// curve.draw(graphics, pointsTotal);\n
    • pointsTotal : The resolution of the curve.
    "},{"location":"path/#point","title":"Point","text":"
    • Get point
      var out = path.getPoint(t);  // t: 0 ~ 1\n// var out = path.getPoint(t, out);  // modify out\n
      or
      var out = curve.getPoint(t);  // t: 0 ~ 1\n// var out = curve.getPoint(t, out);  // modify out\n
      Distance of path from start point to target point (out) might not linear with t.
    • Get random point
      var out = path.getRandomPoint();\n// var out = path.getRandomPoint(out);  // modify out\n
      or
      var out = curve.getRandomPoint();\n// var out = curve.getRandomPoint(out);  // modify out\n
    • Get n points
      • Path
        var points = path.getPoints(divisions);\n
        • divisions : The number of divisions per resolution per curve.
      • Curve
        var points = curve.getPoints(divisions);\n// var points = curve.getPoints(divisions, undefined, out);\n
        or
        var points = curve.getPoints(undefined, stepRate);\n// var points = curve.getPoints(undefined, stepRate, out);\n
        • divisions : The number of divisions in this curve.
          1. divisions, if divisions > 0, else
          2. this.getLength / stepRate, if stepRate > 0, else
          3. defaultDivisions
        • points : Return 1 + divisions points.
    • Get (n+1) points equally spaced out along the curve
      var points = path.getSpacedPoints(n);\n
      or
      var points = curve.getSpacedPoints(n);\n// var points = curve.getSpacedPoints(undefined, stepRate);\n// var points = curve.getSpacedPoints(divisions, stepRate, out);\n
    • Get points spaced out n distance pixels apart
      var points = curve.getDistancePoints(n)\n
      The smaller the distance, the larger the array will be. Path object does NOT support this feature yet.
    • Get start point
      var out = path.getStartPoint();\n// var out = path.getStartPoint(out);  // modify out\n
      or
      var out = curve.getStartPoint();\n// var out = curve.getStartPoint(out);  // modify out\n
    • Get end point
      var out = path.getEndPoint();\n// var out = path.getEndPoint(out);  // modify out\n
      or
      var out = curve.getEndPoint();\n// var out = curve.getEndPoint(out);  // modify out\n
    • Get t (0~1) from distance
      var t = curve.getTFromDistance(d);\n
      Path object does NOT support this feature yet.
    • Get tangent
      var out = path.getTangent(t);  // t: 0~1\n// var out = path.getTangent(t, out);  // modify out\n
      or
      var out = curve.getTangent(t);  // t: 0~1\n// var out = curve.getTangent(t, out);  // modify out\n
    "},{"location":"path/#length-of-path","title":"Length of path","text":"

    var l = path.getLength();\n
    or
    var l = curve.getLength();\n

    Length of path/curve will be cached.

    "},{"location":"path/#update-length","title":"Update length","text":"

    path.updateArcLengths();\n
    or
    curve.updateArcLengths();\n

    "},{"location":"path/#curves-to-json","title":"Curves to JSON","text":"

    var json = path.toJSON();\n
    or
    var json = curve.toJSON();\n

    "},{"location":"path/#bounds","title":"Bounds","text":"

    Get bounds

    var out = path.getBounds();    // accuracy = 16\n// var out = path.getBounds(out);\n// var out = path.getBounds(out, accuracy);\n
    or
    var out = curve.getBounds();    // accuracy = 16\n// var out = curve.getBounds(out);\n// var out = curve.getBounds(out, accuracy);\n

    • out : A rectangle object
    "},{"location":"path/#destroy","title":"Destroy","text":"
    path.destroy();\n
    "},{"location":"pathfollower/","title":"Path follower","text":""},{"location":"pathfollower/#introduction","title":"Introduction","text":"

    Set position of game object on a path.

    • Author: Rex
    • Behavior of game object
    "},{"location":"pathfollower/#live-demos","title":"Live demos","text":"
    • Path follower
    • Spaced points
    "},{"location":"pathfollower/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"pathfollower/#install-plugin","title":"Install plugin","text":""},{"location":"pathfollower/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexpathfollowerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexpathfollowerplugin.min.js', true);\n
    • Add path-follower behavior
      var pathFollower = scene.plugins.get('rexpathfollowerplugin').add(gameObject, config);\n
    "},{"location":"pathfollower/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PathFollowerPlugin from 'phaser3-rex-plugins/plugins/pathfollower-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPathFollower',\nplugin: PathFollowerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add path-follower behavior
      var pathFollower = scene.plugins.get('rexPathFollower').add(gameObject, config);\n
    "},{"location":"pathfollower/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import PathFollower from 'phaser3-rex-plugins/plugins/pathfollower.js';\n
    • Add path-follower behavior
      var pathFollower = new PathFollower(gameObject, config);\n
    "},{"location":"pathfollower/#create-instance","title":"Create instance","text":"
    // var path = scene.add.path();\nvar pathFollower = scene.plugins.get('rexPathFollower').add(gameObject, {\n// path: path,          // path object\n// t: 0,                // t: 0~1\n// rotateToPath: false,\n// rotationOffset: 0,\n// angleOffset: 0,\n\n// spacedPoints: false,\n// spacedPoints: {\n//     divisions: undefined,\n//     stepRate: 10,\n// }\n\n});\n
    • path : Path object
    • t : Initial value of property t (0~1)
    • rotateToPath: Set true to change angle towards path
    • rotationOffset : Rotation offset in radian, or angleOffset in degrees
    • spacedPoints :
      • false, or undefined : Get point by path.getPoint(t)
      • spacedPoints.divisions, spacedPoints.stepRate :
        1. Get points by path.getSpacedPoints(divisions, stepRate)
        2. Get point from linear interpolation of points in step1.
    "},{"location":"pathfollower/#move-along-path","title":"Move along path","text":"

    Set pathFollower.t (0~1) to move along path

    pathFollower.t = t;  // t: 0~1\n// pathFollower.setT(t);\n

    or tween pathFollower.t

    var tween = scene.tweens.add({\ntargets: pathFollower,\nt: 1,\nease: 'Linear', // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,\nyoyo: false\n});\n
    "},{"location":"pathfollower/#set-path","title":"Set path","text":"
    pathFollower.setPath(path);\n
    "},{"location":"pathfollower/#set-rotate-to-path","title":"Set rotate-to-path","text":"
    pathFollower.setRotateToPath(rotateToPath, rotationOffset);\n
    • rotateToPath : Set true to change angle towards path
    • rotationOffset : Rotation offset in radian
    "},{"location":"percentage/","title":"Percentage","text":""},{"location":"percentage/#introduction","title":"Introduction","text":"

    Work out what percentage value is of the range between min and max, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"percentage/#usage","title":"Usage","text":"
    var result = Phaser.Math.Percent(value, min, max);\n
    • result: Percentage/t (0~1).
    • value : The value to determine the percentage of.
    "},{"location":"perlin/","title":"Perlin","text":""},{"location":"perlin/#introduction","title":"Introduction","text":"

    Perlin2/Perlin3 noise and simplex2/simplex3 noise. (Reference)

    • Author: Rex
    • Method only
    "},{"location":"perlin/#live-demos","title":"Live demos","text":"
    • Perlin2
    • Terrain generator
    "},{"location":"perlin/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perlin/#install-plugin","title":"Install plugin","text":""},{"location":"perlin/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperlinplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperlinplugin.min.js', true);\n
    • Add perlin noise object
      var noise = scene.plugins.get('rexperlinplugin').add(seed);\n
    "},{"location":"perlin/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerlinPlugin from 'phaser3-rex-plugins/plugins/perlin-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerlin',\nplugin: PerlinPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add perlin noise object
      var noise = scene.plugins.get('rexPerlin').add(seed);\n
    "},{"location":"perlin/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Perlin from 'phaser3-rex-plugins/plugins/perlin.js';\n
    • Add perlin noise object
      var noise = new Perlin(seed);\n
    "},{"location":"perlin/#create-noise-instance","title":"Create noise instance","text":"
    var noise = scene.plugins.get('rexPerlin').add(seed);\n
    • seed : A seed for this noise, like Math.random()
    "},{"location":"perlin/#perlin","title":"Perlin","text":"
    • Perlin2
      var value = noise.perlin2(x, y);\n
      • value : -1 ~ 1
    • Perlin3
      var value = noise.perlin3(x, y, z);\n
      • value : -1 ~ 1
    "},{"location":"perlin/#simplex","title":"Simplex","text":"
    • Simplex2
      var value = noise.simplex2(x, y);\n
      • value : -1 ~ 1
    • Simplex3
      var value = noise.simplex3(x, y, z);\n
      • value : -1 ~ 1
    "},{"location":"perlin/#set-seed","title":"Set seed","text":"
    noise.setSeed(seed);\n
    "},{"location":"perspective-card/","title":"Card","text":""},{"location":"perspective-card/#introduction","title":"Introduction","text":"

    A container with two perspective-images.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-card/#live-demos","title":"Live demos","text":"
    • Flip card
    • Label front face
    • Change texture
    "},{"location":"perspective-card/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-card/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-card/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add card object
      var card = scene.add.rexPerspectiveCard(config);\n
    "},{"location":"perspective-card/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add card object
      var card = scene.add.rexPerspectiveCard(config);\n
    "},{"location":"perspective-card/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveCard } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add card object
      var card = new PerspectiveCard(scene, config);\nscene.add.existing(card);\n
    "},{"location":"perspective-card/#create-instance","title":"Create instance","text":"
    var card = scene.add.rexPerspectiveCard({\nx: 0, y: 0,\n\nback: {key, frame},\nfront: {key, frame},\nface: 0,\n\norientation: 0,\n\n// width,\n// height,\n\n// flip : {\n//     frontToBack: 0,\n//     backToFront: 1,\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n// flip: false\n});\n
    • front, back : Perspective image game object for front and back face.
      • {key, frame} : Texture key and frame name, to create perspective image
      • {width, height} : Width and height, to create perspective render texture.
      • Perspective image
      • Perspective render texture
    • face : Show front or back face.
      • 'front', or 0 : Show front face.
      • 'back', or 1 : Show back face.
    • orientation : Flipping orientation.
      • 'horizontal','h', 'x', or 0 : Flipping left-to-right, or right-to-left.
      • 'vertical','v', 'y', or 1 : Flipping top-to-bottom, or bottom-to-top.
    • width, height : Specific width and height of this card container.
      • undefined : Use width and height of front and back face.
    • flip : Configuration of flipping behavior.
      • flip.frontToBack, flip.backToFront : Flipping direction.
        • 'right', 'left-to-right', or 0 : Flipping from right to left.
        • 'left', 'right-to-left', or 1 : Flipping from left to right.
      • flip.duration : Duration of flipping, in millisecond.
      • flip.delay : Initial delay.
      • flip.ease : Ease function. Default value is 'Cubic'.
      • false : Don't add flipping behavior.

    Add card from JSON

    var card = scene.make.rexPerspectiveCard({\nx: 0,\ny: 0,\n\nfront,\nback,\nface: 0,\n\norientation: 0,\n\nwidth,\nheight,\n\nflip,\n\nadd: true\n});\n
    "},{"location":"perspective-card/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveCard extends PerspectiveCard {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var card = new MyPerspectiveCard(scene, config);\n
    "},{"location":"perspective-card/#face","title":"Face","text":"
    • Get
      var face = card.face;\n
      • face:
        • 0 : Show front face.
        • 1 : Show back face.
    • Set
      card.setFace(face)\n
      • face
        • 'front', or 0 : Show front face.
        • 'back', or 1 : Show back face.
    • Toggle
      card.toggleFace()\n
    "},{"location":"perspective-card/#face-instances","title":"Face instances","text":"
    • Front face
      var frontFace = card.frontFace;\n// var frontFace = card.faces.front;\n
    • Back face
      var backFace = card.backFace;\n// var backFace = card.faces.back;\n
    "},{"location":"perspective-card/#face-texture","title":"Face texture","text":"
    • Set texture of front face, assume that front face is a perspective image
      card.frontFace.setTexture(key);\n// card.frontFace.setTexture(key, frame);\n
    • Set texture of back face, assume that back face is a perspective image
      card.backFace.setTexture(key);\n// card.backFace.setTexture(key, frame);\n
    "},{"location":"perspective-card/#flip-behavior","title":"Flip behavior","text":""},{"location":"perspective-card/#start-flipping","title":"Start flipping","text":"
    card.flip.flip();\n// card.flip.flip(duration, repeat);\n
    • duration : Overwrite default duration value.
    • repeat : Number of flipping time (repeat + 1) during duration. Default value is 0.

    or

    • Flip-right
      card.flip.flipRight();\n// card.flip.flipRight(duration, repeat);\n
    • Flip-left
      card.flip.flipLeft();\n// card.flip.flipLeft(duration, repeat);\n
    "},{"location":"perspective-card/#stop-flipping","title":"Stop flipping","text":"
    card.flip.stop();\n
    "},{"location":"perspective-card/#set-duration","title":"Set duration","text":"
    card.flip.setDuration(duration);\n// card.flip.duration = duration;\n
    "},{"location":"perspective-card/#set-ease","title":"Set ease","text":"
    card.flip.setEase(ease);\n// card.flip.ease = ease;\n
    "},{"location":"perspective-card/#events","title":"Events","text":"
    • On flipping start
      card.flip.on('start', function(flip, card){\n// ...\n});\n
    • On flipping complete
      card.flip.on('complete', function(flip, card){\n// ...\n});\n
    "},{"location":"perspective-card/#status","title":"Status","text":"
    • Is flipping
      var isRunning = card.flip.isRunning;\n
    "},{"location":"perspective-card/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleX = card.angleX; // Angle in degrees\nvar angleY = card.angleY; // Angle in degrees\nvar angleZ = card.angleZ; // Angle in degrees\n
      or
      var rotationX = card.rotationX; // Angle in radians\nvar rotationY = card.rotationY; // Angle in radians\nvar rotationZ = card.rotationZ; // Angle in radians\n
    • Set rotation angle
      card.angleX = angleX; // Angle in degrees\ncard.angleY = angleY; // Angle in degrees\ncard.angleZ = angleZ; // Angle in degrees\n
      or
      card.rotationX = rotationX; // Angle in radians\ncard.rotationY = rotationY; // Angle in radians\ncard.rotationZ = rotationZ; // Angle in radians\n
    "},{"location":"perspective-card/#debug","title":"Debug","text":"
    1. Set debug Graphics
      var debugGraphics = scene.add.graphics();\ncard.setDebug(debugGraphics);\n
    2. Update Graphics in scene.update() method.
      debugGraphics.clear();\ndebugGraphics.lineStyle(1, 0x00ff00);\n
    "},{"location":"perspective-card/#other-properties","title":"Other properties","text":"

    See container, Mesh game object, game object

    "},{"location":"perspective-card/#create-mask","title":"Create mask","text":"
    var mask = card.createBitmapMask();\n

    See mask

    "},{"location":"perspective-card/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-carousel/","title":"Carousel","text":""},{"location":"perspective-carousel/#introduction","title":"Introduction","text":"

    A container with cards.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-carousel/#live-demos","title":"Live demos","text":"
    • Carousel
    • List
    • UI cards
    "},{"location":"perspective-carousel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-carousel/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-carousel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add carousel object
      var carousel = scene.add.rexPerspectiveCarousel(config);\n
    "},{"location":"perspective-carousel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add carousel object
      var carousel = scene.add.rexPerspectiveCarousel(config);\n
    "},{"location":"perspective-carousel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveCarousel } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add carousel object
      var carousel = new PerspectiveCarousel(scene, config);\nscene.add.existing(carousel);\n
    "},{"location":"perspective-carousel/#create-instance","title":"Create instance","text":"
    var carousel = scene.add.rexPerspectiveCarousel({\nx: 0, y: 0,\n\nfaces: [],\n// face: 0,\n// rtl: false,\n\n// width,\n// height,\n\n// faceWidth,\n// faceSpace: 0,\n\n// z: 1,\n// zEnd: 0,\n\n// roll : {\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n});\n
    • faces : Array of perspective-card, perspective-rendertexture, perspective-image, or null.
      • Assume that all faces have the same size
    • face : Index or name of current face (face at angle 0).
    • rtl
      • false : Place faces from left to right. Default behavior.
      • true : Place faces from right to left.
    • width, height : Specific width and height of this carousel container.
      • undefined : Use width and height of first face.
    • faceWidth : Width of face.
      • undefined : Use width of face. Assume that all faces have the same size.
    • faceSpace : Extra space of face width. Used when faceWidth is undefined.
    • z, zEnd : Range of faces' z-index. Default value is 1/0.
    • roll : Configuration of rolling behavior.
      • roll.duration : Duration of rolling, in millisecond.
      • roll.delay : Initial delay.
      • roll.ease : Ease function. Default value is 'Cubic'.
      • false : Don't add rolling behavior.

    Add carousel from JSON

    var carousel = scene.make.rexPerspectiveCarousel({\nx: 0,\ny: 0,\n\nfaces: [],\n\n// width,\n// height,\n\n// faceWidth,\n// faceSpace: 0,\n\n// z: 1,\n// zEnd: 0,\n\nadd: true\n});\n
    "},{"location":"perspective-carousel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveCarousel extends PerspectiveCarousel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var carousel = new MyPerspectiveCarousel(scene, config);\n
    "},{"location":"perspective-carousel/#face-instances","title":"Face instances","text":"
    var faces = carousel.faces;\n
    • faces : Array of face instances.
    "},{"location":"perspective-carousel/#face","title":"Face","text":"
    • Get
      var face = carousel.face;\n
      • face: Index of carousel.faces.
    • Set
      carousel.setFace(face)\n
      • face : Index or name of current face (face at angle 0).
    "},{"location":"perspective-carousel/#roll-behavior","title":"Roll behavior","text":""},{"location":"perspective-carousel/#start-rolling","title":"Start rolling","text":"
    • Roll to next face
      carousel.roll.toNext(duration);\n
      • duration : Overwrite default duration value.
    • Roll to previous face
      carousel.roll.toPrevious(duration);\n
      • duration : Overwrite default duration value.
    • Roll to right face
      carousel.roll.toRight(duration);\n
      • duration : Overwrite default duration value.
    • Roll to left face
      carousel.roll.toLeft(duration);\n
      • duration : Overwrite default duration value.
    • Roll to face
      carousel.roll.to(faceIndex, duration);\n
      • faceIndex :
        • A number : Index of face in carousel.faces
        • A string : Name of face (face.setName(name))
      • duration : Overwrite default duration value.
    "},{"location":"perspective-carousel/#stop-flipping","title":"Stop flipping","text":"
    carousel.roll.stop();\n
    "},{"location":"perspective-carousel/#set-duration","title":"Set duration","text":"
    carousel.roll.setDuration(duration);\n// carousel.roll.duration = duration;\n
    "},{"location":"perspective-carousel/#set-ease","title":"Set ease","text":"
    carousel.roll.setEase(ease);\n// carousel.roll.ease = ease;\n
    "},{"location":"perspective-carousel/#events","title":"Events","text":"
    • On rolling complete
      carousel.roll.on('complete', function(){\n// ...\n});\n
    "},{"location":"perspective-carousel/#status","title":"Status","text":"
    • Is rolling
      var isRunning = carousel.roll.isRunning;\n
    "},{"location":"perspective-carousel/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleY = carousel.angleY; // Angle in degrees\n
      or
      var rotationY = carousel.rotationY; // Angle in radians\n
    • Set rotation angle
      carousel.angleY = angleY; // Angle in degrees\n
      or
      carousel.rotationY = rotationY; // Angle in radians\n
    "},{"location":"perspective-carousel/#other-properties","title":"Other properties","text":"

    See container, Mesh game object, game object

    "},{"location":"perspective-carousel/#create-mask","title":"Create mask","text":"
    var mask = carousel.createBitmapMask();\n

    See mask

    "},{"location":"perspective-carousel/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-image/","title":"Image","text":""},{"location":"perspective-image/#introduction","title":"Introduction","text":"

    Image with perspective rotation.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-image/#live-demos","title":"Live demos","text":"
    • Flip image
    "},{"location":"perspective-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-image/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexPerspectiveImage(x, y, texture, frame, config);\n
    "},{"location":"perspective-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexPerspectiveImage(x, y, texture, frame, config);\n
    "},{"location":"perspective-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveImage } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add image object
      var image = new PerspectiveImage(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"perspective-image/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexPerspectiveImage(x, y, texture, frame, {\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    or

    var image = scene.add.rexPerspectiveImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    Add perspectiveimage from JSON

    var perspectiveimage = scene.make.rexPerspectiveImage({\nx: 0,\ny: 0,\n\nkey: null,\nframe: null,\n\n// hideCCW: false,\n// gridWidth: 32,\n// girdHeight: 32,\n\nadd: true\n});\n
    "},{"location":"perspective-image/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveImage extends PerspectiveImage {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyPerspectiveImage(scene, x, y, texture, frame, config);\n
    "},{"location":"perspective-image/#transform-vertices","title":"Transform vertices","text":"

    Offset then rotate all vertices.

    image.transformVerts(x, y, z, rotateX, rotateY, rotateZ);\n
    • x, y, z : Offset vertices
      • z+ : Near
      • z- : Far
      • x- : Left
      • x+ : Right
      • y+ : Up
      • y- : Down
    • rotateX, rotateY, rotateZ : Rotate vertices
    "},{"location":"perspective-image/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleX = image.angleX; // Angle in degrees\nvar angleY = image.angleY; // Angle in degrees\nvar angleZ = image.angleZ; // Angle in degrees\n
      or
      var rotationX = image.rotationX; // Angle in radians\nvar rotationY = image.rotationY; // Angle in radians\nvar rotationZ = image.rotationZ; // Angle in radians\n
    • Set rotation angle
      image.angleX = angleX; // Angle in degrees\nimage.angleY = angleY; // Angle in degrees\nimage.angleZ = angleZ; // Angle in degrees\n
      or
      image.rotationX = rotationX; // Angle in radians\nimage.rotationY = rotationY; // Angle in radians\nimage.rotationZ = rotationZ; // Angle in radians\n
    "},{"location":"perspective-image/#flip","title":"Flip","text":"
    scene.tweens.add({\ntargets: image,\nangleY: { start: 0, to: -180}\n})\n
    "},{"location":"perspective-image/#tint-color","title":"Tint color","text":"
    • Get
      var color = image.tint;\n
    • Set
      image.tint = color;\n
      or
      image.setTint(color);\n
    "},{"location":"perspective-image/#texture","title":"Texture","text":"
    image.setTexture(key);\n// image.setTexture(key, frame);\n
    "},{"location":"perspective-image/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"perspective-image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"perspective-image/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-imagecarousel/","title":"Image carousel","text":""},{"location":"perspective-imagecarousel/#introduction","title":"Introduction","text":"

    Display list of images.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-imagecarousel/#live-demos","title":"Live demos","text":"
    • List
    "},{"location":"perspective-imagecarousel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-imagecarousel/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-imagecarousel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add carousel object
      var carousel = scene.add.rexPerspectiveImageCarousel(config);\n
    "},{"location":"perspective-imagecarousel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add carousel object
      var carousel = scene.add.rexPerspectiveImageCarousel(config);\n
    "},{"location":"perspective-imagecarousel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveImageCarousel } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add carousel object
      var carousel = new PerspectiveImageCarousel(scene, config);\nscene.add.existing(carousel);\n
    "},{"location":"perspective-imagecarousel/#create-instance","title":"Create instance","text":"
    var carousel = scene.add.rexPerspectiveImageCarousel({\nx: 0, y: 0,\n\nimages: [],  // Array of {key, frame}\n// index: 0,\n// rtl: false,\n// repeat: true,\n\n// width,\n// height,\n// faceCount: 4,\n\n// z: 1,\n// zEnd: 0,\n\n// roll : {\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n});\n
    • images : Array of textures {key, frame}
      • Assume that all textures have the same size
    • index : Index of current image.
    • rtl
      • false : Place images from left to right. Default behavior.
      • true : Place images from right to left.
    • repeat : Set true to roll to first image from last, or last to first.
    • width, height : Specific width and height of this carousel container.
      • undefined : Use width and height of first image.
    • faceCount : Faces count of this carousel. A integer which >=3.
    • z, zEnd : Range of faces' z-index. Default value is 1/0.
    • roll : Configuration of rolling behavior.
      • roll.duration : Duration of rolling, in millisecond.
      • roll.delay : Initial delay.
      • roll.ease : Ease function. Default value is 'Cubic'.
      • false : Don't add rolling behavior.

    Add perspectiveimage from JSON

    var perspectiveimage = scene.make.rexPerspectiveImageCarousel({\nx: 0,\ny: 0,\n\nimages: [],  // Array of {key, frame}\n// index: 0,\n// rtl: false,\n// repeat: true,\n\n// width,\n// height,\n// faceCount: 4,\n\n// z: 1,\n// zEnd: 0,\n\n// roll : {\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n\nadd: true\n});\n
    "},{"location":"perspective-imagecarousel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveImageCarousel extends PerspectiveImageCarousel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var carousel = new MyPerspectiveImageCarousel(scene, config);\n
    "},{"location":"perspective-imagecarousel/#roll-behavior","title":"Roll behavior","text":""},{"location":"perspective-imagecarousel/#start-rolling","title":"Start rolling","text":"
    • Roll to next image
      carousel.roll.toNext(duration);\n
      • duration : Overwrite default duration value.
    • Roll to previous image
      carousel.roll.toPrevious(duration);\n
      • duration : Overwrite default duration value.
    • Roll to right image
      carousel.roll.toRight(duration);\n
      • duration : Overwrite default duration value.
    • Roll to left image
      carousel.roll.toLeft(duration);\n
      • duration : Overwrite default duration value.
    • Roll to image
      carousel.roll.to(faceIndex, duration);\n
      • faceIndex :
        • A number : Index of image.
      • duration : Overwrite default duration value.
    "},{"location":"perspective-imagecarousel/#set-duration","title":"Set duration","text":"
    carousel.roll.setDuration(duration);\n// carousel.roll.duration = duration;\n
    "},{"location":"perspective-imagecarousel/#set-ease","title":"Set ease","text":"
    carousel.roll.setEase(ease);\n// carousel.roll.ease = ease;\n
    "},{"location":"perspective-imagecarousel/#events","title":"Events","text":"
    • On rolling complete
      carousel.roll.on('complete', function(){\n// ...\n});\n
    "},{"location":"perspective-imagecarousel/#status","title":"Status","text":"
    • Is rolling
      var isRunning = carousel.roll.isRunning;\n
    "},{"location":"perspective-imagecarousel/#other-properties","title":"Other properties","text":"

    See container, Mesh game object, game object

    "},{"location":"perspective-imagecarousel/#create-mask","title":"Create mask","text":"
    var mask = carousel.createBitmapMask();\n

    See mask

    "},{"location":"perspective-imagecarousel/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-imagecarousel/#compare-with-plane-game-object","title":"Compare with Plane game object","text":"
    • Size
      • Size of Plane is equal to current render size.
      • Size of PerspectiveImage is equak to texture size, like normal Image game object.
    • Animation
      • Plane hae animation feature.
      • Useing PerspectiveSprite for animation feature, PerspectiveImage does not have this feature.
    • Checkerboard
      • Plane hae checkerboard feature.
      • PerspectiveImage does not have this feature.
    "},{"location":"perspective-rendertexture/","title":"Render texture","text":""},{"location":"perspective-rendertexture/#introduction","title":"Introduction","text":"

    Render texture with perspective rotation.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-rendertexture/#live-demos","title":"Live demos","text":"
    • RenderTexture
    "},{"location":"perspective-rendertexture/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-rendertexture/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-rendertexture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add render texture object
      var image = scene.add.rexPerspectiveRenderTexture(x, y, width, height, config);\n
    "},{"location":"perspective-rendertexture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add render texture object
      var image = scene.add.rexPerspectiveRenderTexturege(x, y, width, height, config);\n
    "},{"location":"perspective-rendertexture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveRenderTexture } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add render texture object
      var image = new PerspectiveRenderTexture(scene, x, y, width, height, config);\nscene.add.existing(image);\n
    "},{"location":"perspective-rendertexture/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexPerspectiveRenderTexturege(x, y, width, height, {\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    or

    var image = scene.add.rexPerspectiveRenderTexturege({\n// x: 0,\n// y: 0,\n// width: 32,\n// height: 32,\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    Add prespective render texture from JSON

    var image = scene.make.rexPerspectiveRenderTexturege({\nx: 0,\ny: 0,    width: 32,\nheight: 32,\n\n// hideCCW: false,\n// gridWidth: 32,\n// girdHeight: 32,\n\nadd: true\n});\n
    "},{"location":"perspective-rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveRenderTexturege extends PerspectiveRenderTexturege {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyPerspectiveRenderTexturege(scene, x, y, width, height, config);\n
    "},{"location":"perspective-rendertexture/#internal-render-texture","title":"Internal render texture","text":"
    var rt = image.rt;\n
    • rt : Render texture
    "},{"location":"perspective-rendertexture/#paste-texture","title":"Paste texture","text":"
    • Paste game object
      image.rt.draw(gameObject, x, y);\n// image.rt.draw(gameObject, x, y, alpha, tint);\n
    • gameObject : a game object, or an array of game objects
    • Paste game objects in a group
      image.rt.draw(group, x, y);\n// image.rt.draw(group, x, y, alpha, tint);\n
    • Paste game objects in a scene
      image.rt.draw(scene.children, x, y);\n// image.rt.draw(scene.children, x, y, alpha, tint);\n
    • Paste texture
      image.rt.draw(key, x, y);\n// image.rt.draw(key, x, y, alpha, tint);\n
      or
      image.rt.drawFrame(key, frame, x, y);\n// image.rt.drawFrame(key, frame, x, y, alpha, tint);\n
      • key : The key of the texture to be used, as stored in the Texture Manager.
    • Snapshop game objects
      image.snapshot(gameObjects);\n
      • gameObjects : Array of game objects.
    "},{"location":"perspective-rendertexture/#erase","title":"Erase","text":"
    image.rt.erase(gameObject, x, y);\n
    • gameObject : a game object, or an array of game objects
    "},{"location":"perspective-rendertexture/#clear","title":"Clear","text":"
    image.rt.clear();\n
    "},{"location":"perspective-rendertexture/#fill","title":"Fill","text":"
    image.rt.fill(rgb, alpha);\n// image.rt.fill(rgb, alpha, x, y, width, height);\n
    "},{"location":"perspective-rendertexture/#other-properties","title":"Other properties","text":"

    See Perspective image game object, Mesh game object, game object

    "},{"location":"perspective-rendertexture/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"perspective-rendertexture/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"perspective-sprite/","title":"Sprite","text":""},{"location":"perspective-sprite/#introduction","title":"Introduction","text":"

    Play animation on perspective-image.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"perspective-sprite/#live-demos","title":"Live demos","text":"
    • Play animation
    "},{"location":"perspective-sprite/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"perspective-sprite/#install-plugin","title":"Install plugin","text":""},{"location":"perspective-sprite/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexperspectiveimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexperspectiveimageplugin.min.js', true);\n
    • Add sprite object
      var sprite = scene.add.rexPerspectiveSprite(x, y, texture, frame, config);\n
    "},{"location":"perspective-sprite/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PerspectiveImagePlugin from 'phaser3-rex-plugins/plugins/perspectiveimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPerspectiveImagePlugin',\nplugin: PerspectiveImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sprite object
      var sprite = scene.add.rexPerspectiveSprite(x, y, texture, frame, config);\n
    "},{"location":"perspective-sprite/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveSprite } from 'phaser3-rex-plugins/plugins/perspectiveimage.js';\n
    • Add sprite object
      var sprite = new PerspectiveSprite(scene, x, y, texture, frame, config);\nscene.add.existing(sprite);\n
    "},{"location":"perspective-sprite/#create-instance","title":"Create instance","text":"
    var sprite = scene.add.rexPerspectiveSprite(x, y, texture, frame, {\n// width: undefined,\n// height: undefined,\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    or

    var sprite = scene.add.rexPerspectiveImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n// width: undefined,\n// height: undefined,\n// hideCCW: true,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    Add perspectiveimage from JSON

    var perspectiveimage = scene.make.rexPerspectiveImage({\nx: 0,\ny: 0,\n\nkey: null,\nframe: null,\n\n// width: undefined,\n// height: undefined,\n// hideCCW: false,\n// gridWidth: 32,\n// girdHeight: 32,\n\nadd: true\n});\n
    "},{"location":"perspective-sprite/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveSprite extends PerspectiveSprite {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var sprite = new MyPerspectiveSprite(scene, x, y, texture, frame, config);\n
    "},{"location":"perspective-sprite/#play-animation","title":"Play animation","text":"
    • Play
      sprite.play(key);\n// sprite.play(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
        • String key of animation
        • Animation config, to override default config
          {\nkey,\nframeRate,\nduration,\ndelay,\nrepeat,\nrepeatDelay,\nyoyo,\nshowOnStart,\nhideOnComplete,\nstartFrame,\ntimeScale\n}\n
    • Play in reverse
      sprite.playReverse(key);\n// sprite.playReverse(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
    • Play after delay
      sprite.playAfterDelay(key, delay);\n
      • key : Animation key string, or animation config
    • Play after repeat
      sprite.playAfterRepeat(key, repeatCount);\n
      • key : Animation key string, or animation config
    "},{"location":"perspective-sprite/#chain","title":"Chain","text":"
    • Chain next animation
      sprite.chain(key);\n
      • key : Animation key string, or animation config
    • Chain next and next animation
      sprite.chain(key0).chain(key1);\n
      • key0, key1 : Animation key string, or animation config
    "},{"location":"perspective-sprite/#stop","title":"Stop","text":"
    • Immediately stop
      sprite.stop();\n
    • Stop after delay
      sprite.stopAfterDelay(delay);\n
    • Stop at frame
      sprite.stopOnFrame(frame);\n
      • frame : Frame object in current animation.
        var currentAnim = sprite.anims.currentAnim;\nvar frame = currentAnim.getFrameAt(index);\n
    • Stop after repeat
      sprite.stopAfterRepeat(repeatCount);\n
    "},{"location":"perspective-sprite/#restart","title":"Restart","text":"
    sprite.anims.restart();\n// sprite.anims.restart(includeDelay, resetRepeats);\n
    "},{"location":"perspective-sprite/#other-properties","title":"Other properties","text":"

    See Perspective image game object, Mesh game object, game object

    "},{"location":"perspective-sprite/#create-mask","title":"Create mask","text":"
    var mask = sprite.createBitmapMask();\n

    See mask

    "},{"location":"perspective-sprite/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"plane/","title":"Plane","text":""},{"location":"plane/#introduction","title":"Introduction","text":"

    A Plane is a kind of Mesh game object with one-sided grid of cells. which can have a texture that is either repeated (tiled) across each cell, or applied to the full Plane.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"plane/#usage","title":"Usage","text":""},{"location":"plane/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"plane/#add-plane-object","title":"Add plane object","text":"
    var plane = scene.add.plane(x, y, key);\n// var plane = scene.add.plane(x, y, key, frame);\n// var plane = scene.add.plane(x, y, texture, frame, width, height, tile);\n
    • x, y : Position
    • key, frame : Texture key of
    • width, height : The width/height of this Plane, in cells, not pixels.
    • tile : Is the texture tiled? I.e. repeated across each cell.

    Add plane from JSON

    var plane = scene.make.plane({\nx: 0,\ny: 0,\nkey: '',\n// frame: '',\n// width: 8,\n// height: 8,\n// tile: false,\n// checkerboard: null,\n// checkerboard: { color1, color2, alpha1, alpha2, height }\n\n// angle: 0,\n// alpha: 1,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"plane/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPlane extends Phaser.GameObjects.Plane {\nconstructor(scene, x, y, texture, frame, width, height, tile) {\nsuper(scene, x, y, texture, frame, width, height, tile);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var plane = new MyPlane(scene, x, y, texture, frame, width, height, tile);\n
    "},{"location":"plane/#texture","title":"Texture","text":"

    See game object - texture

    "},{"location":"plane/#animation","title":"Animation","text":"

    See Sprite's animation section.

    "},{"location":"plane/#play-animation","title":"Play animation","text":"
    • Play
      plane.play(key);\n// plane.play(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
        • String key of animation
        • Animation config, to override default config
          {\nkey,\nframeRate,\nduration,\ndelay,\nrepeat,\nrepeatDelay,\nyoyo,\nshowOnStart,\nhideOnComplete,\nstartFrame,\ntimeScale\n}\n
    • Play in reverse
      plane.playReverse(key);\n// plane.playReverse(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
    • Play after delay
      plane.playAfterDelay(key, delay);\n
      • key : Animation key string, or animation config
    • Play after repeat
      plane.playAfterRepeat(key, repeatCount);\n
      • key : Animation key string, or animation config
    "},{"location":"plane/#stop","title":"Stop","text":"
    • Immediately stop
      plane.stop();\n
    • Stop after delay
      plane.stopAfterDelay(delay);\n
    • Stop at frame
      plane.stopOnFrame(frame);\n
      • frame : Frame object in current animation.
        var currentAnim = plane.anims.currentAnim;\nvar frame = currentAnim.getFrameAt(index);\n
    • Stop after repeat
      plane.stopAfterRepeat(repeatCount);\n
    "},{"location":"plane/#properties","title":"Properties","text":"
    • Has started
      var hasStarted = plane.anims.hasStarted;\n
    • Is playing
      var isPlaying = plane.anims.isPlaying;\n
    • Is paused
      var isPaused = plane.anims.isPaused;\n
    • Total frames count
      var frameCount = plane.anims.getTotalFrames();\n
    • Delay
      var delay = plane.anims.delay;\n
    • Repeat
      • Total repeat count
        var repeatCount = plane.anims.repeat;\n
      • Repeat counter
        var repeatCount = plane.anims.repeatCounter;\n
      • Repeat delay
        var repeatDelay = plane.anims.repeatDelay;\n
      • Yoyo
        var repeatDelay = plane.anims.yoyo;\n
    • Current animation key
      var key = plane.anims.getName();\n
      • key : Return '' if not playing any animation.
    • Current frame name
      var frameName = plane.anims.getFrameName();\n
      • frameName : Return '' if not playing any animation.
    • Current animation
      var currentAnim = plane.anims.currentAnim;\n
    • Current frame
      var currentFrame = plane.anims.currentFrame;\n
    "},{"location":"plane/#interactive","title":"Interactive","text":"

    To test if pointer is at any face of this mesh game object.

    plane.setInteractive();\n
    "},{"location":"plane/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"plane/#checkerboard","title":"Checkerboard","text":"

    Creates a checkerboard style texture, based on the given colors and alpha values and applies it to this Plane, replacing any current texture it may have.

    • Create
      plane.createCheckerboard(color1, color2, alpha1, alpha2, height)\n
    • Remove
      plane.removeCheckerboard();\n
    "},{"location":"plane/#other-properties_1","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"plane/#create-mask","title":"Create mask","text":"
    var mask = plane.createBitmapMask();\n

    See mask

    "},{"location":"plane/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"plugin-list/","title":"Plugin list","text":""},{"location":"plugin-list/#list-of-my-plugins","title":"List of my plugins","text":"

    Version of phaser3

    Please upgrade your phaser3 to version >= 3.80.0.

    1. Achievements: Achievements in a csv table.
    2. Alpha mask image: Load a texture, then apply an alpha mask from another texture.
    3. Anchor: Set size and position based on visible window.
    4. Arcade-TCRP/Player: Run commands on step of Arcade.
    5. Arcade-TCRP/Recorder: Store commands with step of Arcade.
    6. AwaitLoader: Await custom task in preload stage.
    7. Away time: Get time from previous closing application to now.
    8. BBCode-text: Drawing text with BBCode protocol.
    9. Board: Core object of Board system.
    10. Board/Image: Image chess object.
    11. Board/Field of view: Visible testing, to find field of view.
    12. Board/Hexagon map: Create tile positions in hexagon/triangle/parallelogram geometry in hexagon grid.
    13. Board/Match: Get matched chess.
    14. Board/Mini board: Chess Container, to rotate/mirror/drag chess together.
    15. Board/Monopoly: Move through path tiles.
    16. Board/Move To: Move chess towards target position with a steady speed.
    17. Board/Path finder: Find moveable area or moving path.
    18. Board/Shape: Grid (polygon) shape chess object.
    19. Board/Sprite: Sprite chess object.
    20. Board/Tilemap: Create board from tilemap.
    21. Board/Tile texture: Create canvas-texture of tile.
    22. Bounds: Clamp or wrap position of game object inside target bounds.
    23. Bracket parser: A lite-weight bracket parser.
    24. Bracket parser2: A lite-weight bracket parser.
    25. Buff data: Data manager with buffs.
    26. Build arcade object: Create arcade body, and inject arcade object methods.
    27. Bullet: Move game object toward current angle of game object, with a constant speed.
    28. Button: Fires 'click' event when touch releasd after pressed.
    29. Camera controller: Control camera's scroll by pan/cursor-at-bounds(scroll), and zoom by pinch/mouse-wheel.
    30. Canvas: Drawing on canvas.
    31. CanvasInput: An invisible Input DOM element to receive character input and display on DynamicText.
    32. Canvas/Circular progress: Circular progress bar on canvas.
    33. Canvas/Line progress: Horizontal line progress bar filled with gradient color on canvas.
    34. Canvas/Round rectangle: Round rectangle on canvas.
    35. Canvas image data: Get image data from texture, or text object.
    36. Circle mask image: Load a texture, then apply a circle mask.
    37. Click outside: Fires 'clickoutside' event when pointer-down or pointer-up outside of game object.
    38. Clock: A clock to count elapsed time.
    39. Character cache: Generate bitmapfont from text game object, or bbcode text game object.
    40. Color/TintRGB: Attach tintR, tintG, tintB, and tintGray properties to a game object.
    41. Conditions table: Check conditions to find passed tests listed in a csv table.
    42. ContainerLite: Control the position and angle of children game objects.
    43. Containerlite-perspective: Snapshot children of containerlite, to a perspective render texture.
    44. Containerlite-skew: Snapshot children of containerlite, to a skew render texture.
    45. CSV-scenario: Run script in csv format.
    46. CSV-to-hash-table: Hash table indexed by (col-key, row-key) from csv string.
    47. Cursor at bound: Map position pf cursor to cursor key state.
    48. Curve/Spiral: Spiral curve.
    49. Cut Jigsaw Image: Cut image into pieces for jigsaw application.
    50. Drag: Drag game object.
    51. Drag-rotate: Get dragging angle around a specific point.
    52. Drop down: Drop down game object below another target game object.
    53. Dynamic text: Control position, angle of each character drawn on a canvas.
    54. Ease-data: Easing data value of game object's data-manager.
    55. Ease-move: Ease-move game object.
    56. Effect properties: Attach properties to a game object or camera, to add/remove/control builtin preFX or postFX effects.
    57. Eight direction: Move game object by cursor keys, with a constant speed.
    58. Event promise: Return a promise of an event.
    59. Expression parser: Parse expression string into function.
    60. Fade-out-destroy: Fade out game object then destroy it.
    61. Fade-volume: Fade-in/fade-out volume of sound.
    62. File chooser: Create a transparent file chooser button.
    63. File drop zone: Create a div element for dropping file(s).
    64. Firebase/Broadcast: Broadcast real-time messages, using firebase-database.
    65. Firebase/Files: Save JSON data, using firebase-firestore.
    66. Firebase/ID-alias: Map an unique ID to another unique ID, using firebase-firestore.
    67. Firebase/Item-table: 1d/2d/3d table, using firebase-database.
    68. Firebase/Leaderboard: Descending sort scores, using firebase-firestore.
    69. Firebase/Messages: Store messages in firebase-firestore.
    70. Firebase/Online-user-list: Online user list, using firebase-database.
    71. Firebase/Single-room: Chat room, using firebase-database.
    72. Flash: Flashing (set invisible then visible) game object.
    73. Flip: Flipping game object to another face by scaling width/height.
    74. Frame manager: Draw frames on canvas texture, or dynamic texture.
    75. FSM: Finite state machine.
    76. Fuzzy: A wrap of fuzzy logic.
    77. Gashapon: Pick random item from box.
    78. Geom/Hexagon: Hexagon geometry object.
    79. Geom/Rhombus: Rhombus shape and methods.
    80. Gesture/Pan: Get pan events of a game object.
    81. Gesture/Pinch: Get scale factor from 2 dragging touch pointers.
    82. Gesture/Press: Get press events of a game object.
    83. Gesture/Rotate: Get spin angle from 2 dragging touch pointers.
    84. Gesture/Swipe: Get swipe events of a game object.
    85. Gesture/Tap: Get tap/multi-taps events of a game object.
    86. Grid align: Align objects on quadrilateral or hexagon grid.
    87. Grid cut image: Grid cut image texture to frames, then create image game objects from these frames.
    88. Grid table: Viewer of grid table, to manipulate game object of each visible cell.
    89. Group navigator: Navigate between existing game objects, focus on next/previous/next-row/previous row game object.
    90. Hidden input text: An invisible Input DOM element to receive character input and display on text game object.
    91. Image box: Keep aspect ratio of image game object after scale-down resizing.
    92. Input text: Input DOM element.
    93. Interception: Predict the intersection position of two game objects with constant moving speed.
    94. In touching: Fires 'intouch' event every tick when pressing on a game object.
    95. Keys hub: Key object interface mapping from multiple source of key objects.
    96. Layer manager: A container of Layer game objects.
    97. Level counter: Map level value from experience value, by callback or a number array.
    98. Life time: Destroy game object when time-out.
    99. Line: Draw a line with start/end/body textures.
    100. Live2d: Display live2d model.
    101. Loading animation scene: Start loading animation scene, stop this scene when loading complete.
    102. Loading-progress: Pop-up dialog for loading-progress, then scale-down this dialog.
    103. LocalForage/Files: Save JSON data, using localforage.
    104. LocalStorage/Data: Sync data from data manager to local-storage.
    105. LZ-string: Compress string using LZ-based compression algorithm.
    106. Markdown event sheets: Event sheets contains main condition(s) and actions, in simple markdown format (headings, code block).
    107. Modal promise: Modal behavior wrapped into promise.
    108. Mouse-wheel to up/down: Map mouse-wheeling to (up/down) cursor key state.
    109. Mouse-wheel scroller: Emit scroll event when mouse-wheeling.
    110. Move to: Move game object towards target position with a steady speed.
    111. Nine patch: Stretchable image.
    112. Nine patch2: Stretchable image. Has better performance than nine-patch.
    113. Particles-along-bounds: Emit particles along bounds of game object.
    114. Particles/Bitmap-zone: Particles' emitter zone from canvas bitmap of text/canvas game object.
    115. Path follower: Set position of game object on a path.
    116. Perlin: Perlin2/Perlin3 noise and simplex2/simplex3 noise.
    117. Perspective/Card: A container with two perspective-images.
    118. Perspective/Carousel: A container with cards.
    119. Perspective/Image: Image with perspective rotation.
    120. Perspective/ImageCarousel: Display list of images.
    121. Perspective/Render texture: Render texture with perspective rotation.
    122. Perspective/Sprite: Play animation on perspective-image..
    123. PNG appender: Append user data below tail of PNG data, or extract this user data from PNG data.
    124. polar-coordinate: Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties to a game object.
    125. Pop up: Scale up game object.
    126. Quad/Image: Image with 4 or 9 vertex control points.
    127. Quad/Render texture: Render texture with 4 or 9 vertex control points.
    128. Quest: Question manager.
    129. Raycaster: Raycaster between obstacles.
    130. Random place: Place objects randomly inside an area without overlapping.
    131. Real-time timers: Start and counting timer by real-time timestamp.
    132. Repeat Image: Stamp image repeatly on canvas.
    133. Restorable data: Restorable data manager.
    134. RotateTo: Rotate game object towards target position with a steady speed.
    135. Rotate: Rotate game object continually with a steady speed.
    136. Run-commands: Run commands in array.
    137. Scale-down-destroy: Scale down game object then destroy it.
    138. Scale outer: Scroll and zoom camera to make default game window fit the display area, in RESIZE scale mode.
    139. Script-tag loader: Load script tag in preload stage.
    140. Scroller: Drag content. Slow down when dragging released, pull back when out of bounds.
    141. Sequence: Run sequence commands in array.
    142. Shader/Barrel: Barrel post processing filter.
    143. Shader/Color-replace: Replace color post processing filter.
    144. Shader/Cross-stitching: Cross-stitching post processing filter.
    145. Shader/CRT: CRT post processing filter.
    146. Shader/Dissolve: Dissolve transition post processing filter.
    147. Shader/Drop-shadow: Drop-shadow post processing filter.
    148. Shader/Fish-eye: Fish-eye post processing filter.
    149. Shader/Glow-filter: Glow post processing filter.
    150. Shader/Glow-filter: Glow post processing filter, ported from pixi.
    151. Shader/Gray-scale: Gray scale post processing filter.
    152. Shader/Horri-fi: 6-in-1 post processing filter.
    153. Shader/Hsl-adjust: Adjust color in HSL domain, post processing filter.
    154. Shader/Inverse: Inverse color post processing filter.
    155. Shader/Kawaseblur: Kawase-blur post processing filter.
    156. Shader/Outline: Outline post processing filter, ported from pixi.
    157. Shader/Pixelation: Pixelation post processing filter.
    158. Shader/Shockwave: Shockwave post processing filter.
    159. Shader/Split: Split image into 4 parts.
    160. Shader/Swirl: Swirl post processing filter.
    161. Shader/Toonify: Draw outlines and quantize color in HSV domain, post processing filter.
    162. Shader/Warp: Warp post processing filter.
    163. Shake-position: Shake position of game object.
    164. Shape/Checkbox: Checkbox input with drawing checker path animation.
    165. Shape/Circular progress: Circular progress bar shape.
    166. Shape/Cover: Rectangle shape covered full window, and block all touch events.
    167. Shape/Custom progress: Custom progress bar shape.
    168. Shape/Custom shapes: Custom shapes on shape.
    169. Shape/Full window rectangle: Rectangle shape covered full window.
    170. Shape/Line progress: Horizontal line progress bar shape.
    171. Shape/Quad: Quad shape, offsets can be given on four vertices, and additional points can be added on the four sides.
    172. Shape/Round-Rectangle: Round rectangle shape.
    173. Shape/Round-Rectangle progress: Horizontal or vertical round rectangle progress bar shape.
    174. Shape/Spinner: Loading animations on shape.
    175. Shape/Toggle-switch: Toggle-switch input.
    176. Shape/Triangle: Trangle shape inside a rectangle bounds.
    177. Shatter/Image: Shatter image to triangle faces.
    178. Shatter/Render texture: Shatter render texture to triangle faces.
    179. Ship: Move game object as a space ship by cursor keys.
    180. Skew/Image: Skewable Image.
    181. Skew/RenderTexture: Skewable render texture.
    182. Slider: Drag thumb on a slider bar.
    183. State manager: Another version of Finite state machine.
    184. Step: Interpolate points between previous position and current position with fixed step length.
    185. Tag-player: Text commands to control sprites, texts, sound effect or backgroun music.
    186. Tag-text: Displays text with multi-color, font face, or font size with tags.
    187. TCRP/Player: Run commands on time.
    188. TCRP/Recorder: Store commands with time.
    189. Text/Edit: Create an input text object above a text object to edit string content.
    190. Text/Typing: Typing text on text object.
    191. Text/Page: Display text page by page on text object.
    192. Text/Translation: Apply translated string (i18next) to text object.
    193. Text/Truncator: Constraints text game object size by truncating text with padding symbol on text object.
    194. Text player: Typing characters on dynamic text, waiting click or key enter, play sound effect or backgroun music.
    195. Touch event stop: Stop touch events propagation.
    196. Touch state: Store current touch input properties.
    197. Transition image: Transit texture to another one.
    198. Transition image pack: Transit texture to another one, with some pre-build effects.
    199. UI/Badge label: A container with badges above a main item.
    200. UI/Buttons: A container with a group of buttons.
    201. UI/Chart: Draw chart on canvas.
    202. UI/Color components: Edit color value by RGB, or HSV input fields.
    203. UI/Color input: Color value input field.
    204. UI/Color picker: Pick color value from H and SV palettes.
    205. UI/Confirm action: Create a modal confirm dialog temporary, invoke callback after clicking button.
    206. UI/Confirm action button: Create a modal confirm dialog temporary, invoke callback after clicking button.
    207. UI/Confrim dialog: Using json style to create confirm dialog.
    208. UI/Dialog: A container with a title, content, buttons and backgrounds.
    209. UI/Drop down list: A label can open a drop-down list panel.
    210. UI/Exp bar: Disply experience bar on NameValueLabel.
    211. UI/File selector button: A transparent file chooser button above a Label.
    212. UI/Fixwidthbuttons: A container with a group of fix-width buttons.
    213. UI/Fixwidthsizer: Layout children game objects into lines.
    214. UI/Folder: A container with a title, foldable child, and background.
    215. UI/Grid buttons: A container with a group of buttons in grids.
    216. UI/Grid sizer: Layout children game objects in grids.
    217. UI/Gird table: A container with a grid table, slider, and scroller.
    218. UI/Holy grail: Layout elements in Holy grail style.
    219. UI/Image input label: A container with a canvas icon, text, and background. Click icon to popup a (image) file chooser dialog, display selected image on canvas.
    220. UI/Knob: A knob button based on circular progress.
    221. UI/Label: A game object container with an icon, text, and background.
    222. UI/Menu: A container with buttons and sub-menu.
    223. UI/Name-input dialog: Enter first name and last name via a dialog.
    224. UI/Name-value label: A container with name text, value text in a row, with a horizontal line progress bar, 1d an icon, background.
    225. UI/Number bar: A container with an icon, slider, text, and background.
    226. UI/Overlap sizer: Layout children game objects overlapped.
    227. UI/Pages: A container with pages, only current page is visible.
    228. UI/Perspective card: A container with front and back faces.
    229. UI/Scroll-able panel: A container with a panel, slider, and scroller.
    230. UI/Scroll bar: A container with slider, two buttons, and background.
    231. UI/Simple drop down list: Using plain object to create drop down list.
    232. UI/Simple label: Using json style to create label.
    233. UI/Simple title label: Using json style to create title label.
    234. UI/Simple text box: Using json style to create text box.
    235. UI/Sizer: Layout children game objects.
    236. UI/Slider: A container with a track, indicator, thumb and background.
    237. UI/Split panels: A container with left(top) panel, right(bottom) panel, splitter, and background. Drag splitter to resize with left(top) panel, right(bottom) panel.
    238. UI/Tab-pages: A container with tabs and pages, only current page is visible.
    239. UI/Tabs: A container with 4 groups of buttons around a center panel.
    240. UI/Text area: A container with a text, slider, and scroller.
    241. UI/Text area input: A container with a canvasInput, and slider.
    242. UI/Text box: A container with an icon, (typing and paging) text, and background.
    243. UI/Title label: A container with title, text in two rows, and an icon, background.
    244. UI/Toast: Show text message for a short while.
    245. UI/Toast queue: Queue messages for a short while.
    246. UI/Trees: A container with trees and leaf-nodes.
    247. UI/Tweaker: Fine-tuning properties of target object.
    248. Unique item list: List of unique items. Support array and set methods.
    249. Viewport-coordinate: Attach vpx, vpy properties to a game object, to set position according to proportion of viewport.
    250. Virtual joystick: Simulate cursor keys according to touch events.
    251. Wait events: Wait fired events or callbacks.
    252. Webfont-loader: Load web font by google webfont loader in preload stage.
    253. XOR: Encrypt or decrypt string by XOR algorithm.
    254. YML-Achievements: Achievements in a YAML table.
    255. YML-Conditions table: Check conditions to find passed tests listed in a YAML table.
    256. Youtube player: Play youtube video on iframe.
    "},{"location":"pluginsystem/","title":"Plugin system","text":""},{"location":"pluginsystem/#introduction","title":"Introduction","text":"

    Plugin system, built-in system of phaser.

    • Author: Richard Davey
    "},{"location":"pluginsystem/#usage","title":"Usage","text":""},{"location":"pluginsystem/#global-plugin","title":"Global plugin","text":""},{"location":"pluginsystem/#load-plugin","title":"Load plugin","text":"
    • Load plugin before any scene start In game configuration
      // import pluginKlass from '...';\nvar config = {\n// ...\nplugins: {\nglobal: [\n{\nkey: key,\nplugin: pluginKlass,\nstart: true\n// mapping: memberName  // member name in each scene instance, optional\n// data: undefined\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • pluginKlass : Class instance
      • start : Whether the plugin should be started automatically.
      • mapping : If this plugin is to be injected into the Scene Systems, this is the property key map used.
      • data : Arbitrary data passed to the plugin's init() method.
    • Load plugin in scene
      scene.load.plugin(key, url, true);\n// scene.load.plugin(key, url, true, mapping);\n
      • url : File url or class instance.
    "},{"location":"pluginsystem/#get-instance","title":"Get instance","text":"
    var pluginInst = scene.plugins.get(key);\n
    "},{"location":"pluginsystem/#scene-plugin","title":"Scene plugin","text":""},{"location":"pluginsystem/#load-plugin_1","title":"Load plugin","text":"
    • Load plugin before any scene start In game configuration
      // import pluginKlass from '...';\nvar config = {\n// ...\nplugins: {\nscene: [\n{\nkey: key,\nplugin: pluginKlass,\nmapping: sceneKey,    // member name in each scene instance\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • pluginKlass : Class instance
    • Load plugin in scene
      scene.load.scenePlugin(key, url, systemKey, sceneKey);\n
      • url : File url or class instance.
    "},{"location":"pluginsystem/#get-instance_1","title":"Get instance","text":"
    var pluginInst = scene[sceneKey];\n
    "},{"location":"pluginsystem/#plugin-cache","title":"Plugin cache","text":"
    • Has custom plugin
      var hasPlugin = Phaser.Plugins.PluginCache.hasCustom(key);\n
    "},{"location":"png-appender/","title":"PNG Appender","text":""},{"location":"png-appender/#introduction","title":"Introduction","text":"

    Append user data below tail of PNG data, or extract this user data from PNG data.

    • Author: Rex
    • Methods
    "},{"location":"png-appender/#live-demos","title":"Live demos","text":"
    • Append-extract
    "},{"location":"png-appender/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"png-appender/#install-plugin","title":"Install plugin","text":""},{"location":"png-appender/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexpngappenderplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexpngappenderplugin.min.js', true);\n
    • Append, or extract data
      var resultBuffer = scene.plugins.get('rexpngappenderplugin').append(pngBuffer, data);\nvar data = scene.plugins.get('rexpngappenderplugin').extract(pngBuffer);\n
    "},{"location":"png-appender/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PNGAppenderPlugin from 'phaser3-rex-plugins/plugins/pngappender-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPNGAppender',\nplugin: PNGAppenderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Append, or extract data
      var resultBuffer = scene.plugins.get('rexPNGAppender').append(pngBuffer, data);\nvar data = scene.plugins.get('rexPNGAppender').extract(pngBuffer);\n
    "},{"location":"png-appender/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import PNGAppender from 'phaser3-rex-plugins/plugins/pngappender.js';\n
    • Append, or extract data
      var resultBuffer = PNGAppender.append(pngBuffer, data);\nvar data = PNGAppender.extract(pngBuffer);\n
    "},{"location":"png-appender/#append-data","title":"Append data","text":"
    var resultBuffer = scene.plugins.get('rexPNGAppender').append(pngBuffer, data);\n
    • pngBuffer : PNG data loaded from binary loader.
    • data : JSON. dictionary, array, string, number, or Uint8Array.
    • resultBuffer : PNG data with custom data (data).
      • Can add to texture cache via scene.load.image(...)
        1. Create blob from resultBuffer : var blob = new Blob([buffer], { type: 'image/png' })
        2. Create object url from blob : var url = window.URL.createObjectURL(blob)
        3. Load texture from object url : scene.load.image(textureKey, url)
        4. Start loader if in create stage of scene : scene.load.start()
      • Can download and display on image viewer as normal PNG file.
    "},{"location":"png-appender/#extract-data","title":"Extract data","text":"
    var data = scene.plugins.get('rexPNGAppender').extract(pngBuffer);\n
    • pngBuffer : PNG data loaded from binary loader.
    • data : User data.
      • null : This pngBuffer does not have user data.
    "},{"location":"point-light/","title":"Point light","text":""},{"location":"point-light/#introduction","title":"Introduction","text":"

    A point light with gradient color in a circle.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"point-light/#usage","title":"Usage","text":""},{"location":"point-light/#add-point-light","title":"Add point light","text":"
    var pointLight = scene.add.pointlight(x, y, color, radius, intensity, attenuation);\n
    • x, y : The horizontal/vertical position of this Game Object in the world.
    • color : Color of this light.
    • radius : Radius of this light.
    • intensity : 0~1, intensity of color.
    • attenuation : 0~1, decay intensity along radius.
    "},{"location":"point-light/#position","title":"Position","text":"
    • Set
      pointLight.setPosition(x, y);\n
      or
      pointLight.x = x;\npointLight.y = y;\n
    • Get
      var x = pointLight.x;\nvar y = pointLight.y;\n
    "},{"location":"point-light/#color","title":"Color","text":"
    • Set
      • Red, green, blue
        pointLight.color.set(red, green, blue);\n
        or
        pointLight.color.r = red;\npointLight.color.g = green;\npointLight.color.b = blue;\n
        • red, green, blue : 0~1.
    • Get
      • Red, green, blue
        var red = pointLight.color.r;\nvar green = pointLight.color.g;\nvar blue = pointLight.color.b;\n
        • red, green, blue : 0~1.
    "},{"location":"point-light/#radius","title":"Radius","text":"
    • Set
      pointLight.radius = radius;\n
    • Get
      var radius = pointLight.radius;\n
    "},{"location":"point-light/#intensity","title":"Intensity","text":"
    • Set
      pointLight.intensity = intensity;\n
    • Get
      var intensity = pointLight.intensity;\n
    "},{"location":"point-light/#attenuation","title":"Attenuation","text":"
    • Set
      pointLight.attenuation = attenuation;\n
    • Get
      var attenuation = pointLight.attenuation;\n
    "},{"location":"polar-coordinate/","title":"Polar-coordinate","text":""},{"location":"polar-coordinate/#introduction","title":"Introduction","text":"

    Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties to a game object.

    • Author: Rex
    • Method only
    "},{"location":"polar-coordinate/#live-demos","title":"Live demos","text":"
    • Circle
    • Spiral
    "},{"location":"polar-coordinate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"polar-coordinate/#install-plugin","title":"Install plugin","text":""},{"location":"polar-coordinate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexpolarcoordinateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexpolarcoordinateplugin.min.js', true);\n
    • Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties.
      scene.plugins.get('rexpolarcoordinateplugin').add(gameObject, ox, oy, rotation, radius);\ngameObject.polarRadius = 200;\ngameObject.polarAngle = -45;\n
    "},{"location":"polar-coordinate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PolarCoordinatePlugin from 'phaser3-rex-plugins/plugins/polarcoordinate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPolarCoordinate',\nplugin: PolarCoordinatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties.
      scene.plugins.get('rexPolarCoordinate').add(gameObject, ox, oy, rotation, radius);\ngameObject.polarRadius = 200;\ngameObject.polarAngle = -45;\n
    "},{"location":"polar-coordinate/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import AddPolarCoordinateProperties from 'phaser3-rex-plugins/plugins/polarcoordinate.js';\n
    • Attach polarOX, polarOY, polarRotation, polarAngle, and polarRadius properties.
      AddPolarCoordinateProperties(gameObject, ox, oy, rotation, radius);\ngameObject.polarOX = 400;\ngameObject.polarOY = 300;\ngameObject.polarRadius = 200;\ngameObject.polarAngle = -45;\n
    "},{"location":"polar-coordinate/#attach-properties","title":"Attach properties","text":"
    scene.plugins.get('rexPolarCoordinate').add(gameObject, ox, oy, rotation, radius);\ngameObject.polarOX = 400;\ngameObject.polarOY = 300;\ngameObject.polarRadius = 200;\ngameObject.polarAngle = -45;\n
    • ox, oy : Position of origin point.
    • rotation : Polar angle, in radian.
    • radius : Polar radius.
    x = ( polarRadius * cos(polarRotation) ) + polarOX\ny = ( polarRadius * sin(polarRotation) ) + polarOY\n
    "},{"location":"polar-coordinate/#circle","title":"Circle","text":"
    scene.tweens.add({\ntargets: gameObject,\npolarAngle: 360,\nduration: 3000\n})\n
    "},{"location":"popup/","title":"Pop up","text":""},{"location":"popup/#introduction","title":"Introduction","text":"

    Scale up from 0 to current scale of game object.

    • Author: Rex
    • Method only
    "},{"location":"popup/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"popup/#install-plugin","title":"Install plugin","text":""},{"location":"popup/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexscaleplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscaleplugin.min.js', true);\n
    • Pop-up object
      scene.plugins.get('rexscaleplugin').popup(gameObject, duration);\n
    "},{"location":"popup/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ScalePlugin from 'phaser3-rex-plugins/plugins/scale-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexScale',\nplugin: ScalePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Pop-up object
      scene.plugins.get('rexScale').popup(gameObject, duration);\n
    "},{"location":"popup/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import PopUp from 'phaser3-rex-plugins/plugins/popup.js';\n
    • Pop-up object
      PopUp(gameObject, duration);\n
    "},{"location":"popup/#pop-up","title":"Pop up","text":"
    • Pop up width and height
      var scale = scene.plugins.get('rexScale').popup(gameObject, duration);\n// var scale = popUp(gameObject, duration, undefined, ease);\n
      • ease : Ease function, default is 'Cubic'.
    • Pop up width only
      var scale = scene.plugins.get('rexScale').popup(gameObject, duration, 'x');\n// var scale = popUp(gameObject, duration, 'x', ease);\n
      • ease : Ease function, default is 'Cubic'.
    • Pop up height only
      var scale = scene.plugins.get('rexScale').popup(gameObject, duration, 'y');\n// var scale = popUp(gameObject, duration, 'y', ease);\n
      • ease : Ease function, default is 'Cubic'.
    "},{"location":"popup/#events","title":"Events","text":"

    See Events of tween task

    • Scale completes or is stopped.
      scale.on('complete', function(gameObject, scale){\n\n}, scope);\n
    "},{"location":"postfx-pipeline/","title":"Post fx pipeline","text":""},{"location":"postfx-pipeline/#introduction","title":"Introduction","text":"

    Post fx pipelines for game objects or camera. A game object or a camera can stack many post-fx effect.

    • Author: Richard Davey

    WebGL only

    All kinds of post fx pipelines only work in WebGL render mode.

    "},{"location":"postfx-pipeline/#usage","title":"Usage","text":""},{"location":"postfx-pipeline/#post-fx-pipeline-class","title":"Post fx pipeline class","text":"
    class MyPostFxClass extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline {\nconstructor(game) {\nsuper({\ngame: game,\nrenderTarget: true,\nfragShader: '...',  // GLSL shader\nuniforms: []\n});\n}\n\nonPreRender() {\nthis.set1f('intensity', this._intensity);\n}\n\nonDraw(renderTarget) {\n}\n}\n
    "},{"location":"postfx-pipeline/#set-uniform-values","title":"Set uniform values","text":"
    • Property with 1 value
      • Float
        pipelineInstance.set1f(name, value0);\n// pipelineInstance.set1f(name, value0, shader);\n
      • uniform1fv
        pipelineInstance.set1fv(name, value0);\n// pipelineInstance.set1fv(name, value0, shader);\n
      • Int
        pipelineInstance.set1i(name, value0);\n// pipelineInstance.set1i(name, value0, shader);\n
    • Property with 2 values
      • Float
        pipelineInstance.set2f(name, value0, value1);\n// pipelineInstance.set2f(name, value0, value1, shader);\n
      • uniform2fv
        pipelineInstance.set2fv(name, value0, value1);\n// pipelineInstance.set2fv(name, value0, value1, shader);\n
      • Int
        pipelineInstance.set2i(name, value0, value1);\n// pipelineInstance.set2i(name, value0, value1, shader);\n
    • Property with 3 value
      • Float
        pipelineInstance.set3f(name, value0, value1, value2);\n// pipelineInstance.set3f(name, value0, value1, value2, shader);\n
      • uniform3fv
        pipelineInstance.set3fv(name, value0, value1, value2);\n// pipelineInstance.set3fv(name, value0, value1, value2, shader);\n
      • Int
        pipelineInstance.set3i(name, value0, value1, value2);\n// pipelineInstance.set3i(name, value0, value1, value2, shader);\n
    • Property with 4 values
      • Float
        pipelineInstance.set4f(name, value0, value1, value2, value3);\n// pipelineInstance.set4f(name, value0, value1, value2, value3, shader);\n
      • uniform4fv
        pipelineInstance.set4fv(name, value0, value1, value2, value3);\n// pipelineInstance.set4fv(name, value0, value1, value2, value3, shader);\n
      • Int
        pipelineInstance.set4i(name, value0, value1, value2, value3);\n// pipelineInstance.set4i(name, value0, value1, value2, value3, shader);\n
    "},{"location":"postfx-pipeline/#onprerender","title":"onPreRender","text":"
    • Set uniform values in onPreRender method.
    "},{"location":"postfx-pipeline/#ondraw","title":"onDraw","text":"
    • Ping-pong drawing
      • Variables :
        • renderTarget : Render target, parameter of onDraw method.
        • pipelineInstance.fullFrame1, pipelineInstance.fullFrame2 : Ping-pong render texture.
      • Steps
        1. Copy frame to pipelineInstance.fullFrame1
          pipelineInstance.copyFrame(source, target);\n// pipelineInstance.copyFrame(source, target, brightness, clear, clearAlpha);\n
        2. Set uniform values
        3. Bind and draw on pipelineInstance.fullFrame1, pipelineInstance.fullFrame2.
          pipelineInstance.bindAndDraw(source, target);\n// pipelineInstance.bindAndDraw(source, target, clear, clearAlpha, shader);\n
        4. Draw result back
          pipelineInstance.bindAndDraw(source);\n
    "},{"location":"postfx-pipeline/#register-post-fx-pipeline","title":"Register post-fx pipeline","text":"
    • Register post-fx pipeline in game config
      import MyPostFxClass from 'path';\nvar config = {\n// ...\npipeline: [MyPostFxClass]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Or register post-fx pipeline at runtime
      var pipelineManager = scene.sys.renderer.pipelines;\npipelineManager.addPostPipeline(PostFxName, MyPostFxClass);\n
    "},{"location":"postfx-pipeline/#apply-effect","title":"Apply effect","text":"

    gameObject.setPostPipeline(MyPostFxClass);\n
    camera.setPostPipeline(MyPostFxClass);\n

    Will create an effect instance then push it into postPipelines list.

    "},{"location":"postfx-pipeline/#get-post-fx-pipeline","title":"Get post-fx pipeline","text":"

    var pipelineInstance = gameObject.getPostPipeline(MyPostFxClass);\n
    var pipelineInstance = camera.getPostPipeline(MyPostFxClass);\n

    "},{"location":"postfx-pipeline/#remove-post-fx-pipeline","title":"Remove post-fx pipeline","text":"

    gameObject.removePostPipeline(MyPostFxClass);\n
    camera.removePostPipeline(MyPostFxClass);\n

    "},{"location":"postfx-pipeline/#unregister-post-fx-pipeline","title":"Unregister post-fx pipeline","text":"
    var pipelineManager = scene.sys.renderer.pipelines;\npipelineManager.remove(PostFxName);\n
    "},{"location":"postfx-pipeline/#color-matrix","title":"Color matrix","text":"

    Use color martix to change RGB render result, and more...

    class MyPostFxClass extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline {\nconstructor(game) {\nsuper({\ngame: game,\nrenderTarget: true,\nfragShader: '...',  // GLSL shader\nuniforms: []\n});\n}\n\nonPreRender() {\n// this.set1f('intensity', this._intensity);\nthis.colorMatrix.grayscale(this._intensity);\n}\n\nonDraw(renderTarget) {\nthis.colorMatrix.grayscale(this._intensity);\nthis.drawFrame(renderTarget, this.fullFrame1);\nthis.bindAndDraw(this.fullFrame1);\n}\n}\n
    "},{"location":"postfx-pipeline/#color-adjusting","title":"Color adjusting","text":"

    Invoke before drawFrame().

    • Grayscale
      this.colorMatrix.grayscale(value);\n// this.colorMatrix.grayscale(value, true); // Cascade\n
      • value : 0 ~ 1
    • Night vision tone
      this.colorMatrix.night(value);\n// this.colorMatrix.night(value, true); // Cascade\n
      • value : 0 ~ 1
    • Sepia tone
      this.colorMatrix.sepia();\n// this.colorMatrix.sepia(true); // Cascade\n
    • Trippy color tone
      this.colorMatrix.lsd();\n// this.colorMatrix.lsd(true); // Cascade\n
    • Brown tone
      this.colorMatrix.brown();\n// this.colorMatrix.brown(true); // Cascade\n
    • Vintage pinhole color effect
      this.colorMatrix.vintagePinhole();\n// this.colorMatrix.vintagePinhole(true); // Cascade\n
    • Kodachrome color effect
      this.colorMatrix.kodachrome();\n// this.colorMatrix.kodachrome(true); // Cascade\n
    • Technicolor color effect
      this.colorMatrix.technicolor();\n// this.colorMatrix.technicolor(true); // Cascade\n
    • Polaroid color effect
      this.colorMatrix.polaroid();\n// this.colorMatrix.polaroid(true); // Cascade\n
    • Brightness
      this.colorMatrix.brightness(value);\n// this.colorMatrix.brightness(value, true); // Cascade\n
      • value : 0(black) ~ 1
    • Saturation
      this.colorMatrix.saturate(value);\n// this.colorMatrix.saturate(value, true); // Cascade\n
      • value : -1 ~ 1
    • Desaturate
      this.colorMatrix.desaturate();\n// this.colorMatrix.desaturate(true); // Cascade\n
    • Hue
      this.colorMatrix.hue(rotation);\n// this.colorMatrix.hue(rotation, true); // Cascade\n
      • rotation : Hue rotation, in degree.
    • Black and white
      this.colorMatrix.blackWhite();\n// this.colorMatrix.blackWhite(true); // Cascade\n
    • Negative
      this.colorMatrix.negative();\n// this.colorMatrix.negative(true); // Cascade\n
    • Contrast
      this.colorMatrix.contrast(value);\n// this.colorMatrix.contrast(value, true); // Cascade\n
    • Desaturate luminance
      this.colorMatrix.desaturateLuminance();\n// this.colorMatrix.desaturateLuminance(true); // Cascade\n
    • Shifts RGB to BGR order
      this.colorMatrix.shiftToBGR();\n// this.colorMatrix.shiftToBGR(true); // Cascade\n
    "},{"location":"postfx-pipeline/#draw","title":"Draw","text":"

    Invoke under onDraw(renderTarget).

    this.drawFrame(renderTarget, this.fullFrame1);\nthis.bindAndDraw(this.fullFrame1);\n
    "},{"location":"prefx-pipeline/","title":"Pre fx pipeline","text":""},{"location":"prefx-pipeline/#introduction","title":"Introduction","text":"

    Pre fx pipelines for texture-base game objects. A texture-base game object has a pre-fx effect.

    • Author: Richard Davey

    WebGL only

    All kinds of post fx pipelines only work in WebGL render mode.

    "},{"location":"prefx-pipeline/#usage","title":"Usage","text":""},{"location":"prefx-pipeline/#post-fx-pipeline-class","title":"Post fx pipeline class","text":"
    class MyPreFxClass extends Phaser.Renderer.WebGL.Pipelines.PreFXPipeline {\nconstructor(game) {\nsuper({\ngame: game,\nfragShader: '...',  // GLSL shader\n});\n}\n\nonDraw(renderTarget) {\nvar sprite = this.tempSprite;\nthis.set1f('intensity', sprite._intensity);\n\nsuper.onDraw(renderTarget);\n}\n}\n
    "},{"location":"prefx-pipeline/#set-uniform-values","title":"Set uniform values","text":"
    • Property with 1 value
      • Float
        pipelineInstance.set1f(name, value0);\n// pipelineInstance.set1f(name, value0, shader);\n
      • uniform1fv
        pipelineInstance.set1fv(name, value0);\n// pipelineInstance.set1fv(name, value0, shader);\n
      • Int
        pipelineInstance.set1i(name, value0);\n// pipelineInstance.set1i(name, value0, shader);\n
    • Property with 2 values
      • Float
        pipelineInstance.set2f(name, value0, value1);\n// pipelineInstance.set2f(name, value0, value1, shader);\n
      • uniform2fv
        pipelineInstance.set2fv(name, value0, value1);\n// pipelineInstance.set2fv(name, value0, value1, shader);\n
      • Int
        pipelineInstance.set2i(name, value0, value1);\n// pipelineInstance.set2i(name, value0, value1, shader);\n
    • Property with 3 value
      • Float
        pipelineInstance.set3f(name, value0, value1, value2);\n// pipelineInstance.set3f(name, value0, value1, value2, shader);\n
      • uniform3fv
        pipelineInstance.set3fv(name, value0, value1, value2);\n// pipelineInstance.set3fv(name, value0, value1, value2, shader);\n
      • Int
        pipelineInstance.set3i(name, value0, value1, value2);\n// pipelineInstance.set3i(name, value0, value1, value2, shader);\n
    • Property with 4 values
      • Float
        pipelineInstance.set4f(name, value0, value1, value2, value3);\n// pipelineInstance.set4f(name, value0, value1, value2, value3, shader);\n
      • uniform4fv
        pipelineInstance.set4fv(name, value0, value1, value2, value3);\n// pipelineInstance.set4fv(name, value0, value1, value2, value3, shader);\n
      • Int
        pipelineInstance.set4i(name, value0, value1, value2, value3);\n// pipelineInstance.set4i(name, value0, value1, value2, value3, shader);\n
    "},{"location":"prefx-pipeline/#ondraw","title":"onDraw","text":"
    • Set uniform values in onDraw method.
    "},{"location":"prefx-pipeline/#add-pre-fx-pipeline-instance","title":"Add pre-fx pipeline instance","text":"
    var pipelineManager = scene.sys.renderer.pipelines;\nvar pipelineInstance = pipelineManager.add(PreFxName, new MyPreFxClass(scene.game));\n
    "},{"location":"prefx-pipeline/#apply-effect","title":"Apply effect","text":"
    gameObject.setPipeline(pipelineInstance);\n

    Will replace current effect instance.

    "},{"location":"prefx-pipeline/#get-pre-fx-pipeline","title":"Get pre-fx pipeline","text":"
    var pipelineInstance = gameObject.pipeline;\n
    "},{"location":"prefx-pipeline/#reset-to-default-effect","title":"Reset to default effect","text":"
    gameObject.resetPipeline();\n
    "},{"location":"prefx-pipeline/#unregister-pre-fx-pipeline","title":"Unregister pre-fx pipeline","text":"
    var pipelineManager = scene.sys.renderer.pipelines;\npipelineManager.remove(PreFxName);\n
    "},{"location":"quad-image/","title":"Image","text":""},{"location":"quad-image/#introduction","title":"Introduction","text":"

    Image with 4 or 9 vertex control points.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"quad-image/#live-demos","title":"Live demos","text":"
    • Quad image
    • Nine points
    "},{"location":"quad-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"quad-image/#install-plugin","title":"Install plugin","text":""},{"location":"quad-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexQuadImage(x, y, texture, frame, config);\n
    "},{"location":"quad-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexQuadImage(x, y, texture, frame, config);\n
    "},{"location":"quad-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { QuadImage } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add image object
      var image = new QuadImage(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"quad-image/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexQuadImage(x, y, texture, frame, {\n// ninePointMode: false,\n});\n

    or

    var image = scene.add.rexQuadImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n// ninePointMode: false,\n// rtl: false\n});\n
    • ninePointMode :
      • true : Add 9 vertex control points.
      • false : Add 4 vertex control points. Default behavior.
    • rtl : Diagonal direction in 4 vertices mode.
      • true : Diagonal from right to left
      • false : Diagonal from left to right. Default behavior.

    Add quadimage from JSON

    var quadimage = scene.make.rexQuadImage({\nx: 0,\ny: 0,\n\nkey: null,\nframe: null,\n\n// ninePointMode: false,\n// rtl: false\n\nadd: true\n});\n
    "},{"location":"quad-image/#custom-class","title":"Custom class","text":"
    • Define class
      class MyQuadImage extends QuadImage {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyQuadImage(scene, x, y, texture, frame, config);\n
    "},{"location":"quad-image/#vertex-control-points","title":"Vertex control points","text":"
    • Array of vertex control points
      var controlPoints = image.controlPoints;\n
      • 4, or 9 vertex control points
    • 4 vertex control points
      var topLeftPoint = image.topLeft;         // image.controlPoints[0]\nvar topRightPoint = image.topRight;       // image.controlPoints[1]\nvar bottomLeftPoint = image.bottomLeft;   // image.controlPoints[2]\nvar bottomRightPoint = image.bottomRight; // image.controlPoints[3]\n
    • 9 vertex control points
      var topLeft = image.topLeft;               // image.controlPoints[0]\nvar topCenter = image.topCenter;           // image.controlPoints[1]\nvar topRight = image.topRight;             // image.controlPoints[2]\nvar centerLeft = image.centerLeft;         // image.controlPoints[3]\nvar center = image.center;                 // image.controlPoints[4]\nvar centerRight = image.centerRight;       // image.controlPoints[5]\nvar bottomLeft = image.bottomLeft;         // image.controlPoints[6]\nvar bottomCenter = image.bottomCenter;     // image.controlPoints[7]\nvar bottomRight = image.bottomRight;       // image.controlPoints[8]\n
    "},{"location":"quad-image/#position","title":"Position","text":"
    • Get
      var worldXY = controlPoint.getWorldXY();\nvar x = worldXY.x;\nvar y = worldXY.y;\n
      or
      var x = controlPoint.x;\nvar y = controlPoint.y;\n
    • Set
      controlPoint.setPosition(x, y);\n// controlPoint.setWorldXY(x, y);\n
      or
      controlPoint.x = x;\ncontrolPoint.y = y;\n
    "},{"location":"quad-image/#tint-color","title":"Tint color","text":"
    • Get
      var color = image.tint;\n
    • Set
      image.tint = color;\n
      or
      image.setTint(color);\n
    "},{"location":"quad-image/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"quad-image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"quad-image/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"quad-rendertexture/","title":"Render texture","text":""},{"location":"quad-rendertexture/#introduction","title":"Introduction","text":"

    Render texture with 4 or 9 vertex control points.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"quad-rendertexture/#live-demos","title":"Live demos","text":"
    • RenderTexture
    "},{"location":"quad-rendertexture/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"quad-rendertexture/#install-plugin","title":"Install plugin","text":""},{"location":"quad-rendertexture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add render texture object
      var image = scene.add.rexQuadRenderTexture(x, y, width, height, config);\n
    "},{"location":"quad-rendertexture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add render texture object
      var image = scene.add.rexQuadRenderTexturege(x, y, width, height, config);\n
    "},{"location":"quad-rendertexture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { QuadRenderTexture } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add render texture object
      var image = new QuadRenderTexture(scene, x, y, width, height, config);\nscene.add.existing(image);\n
    "},{"location":"quad-rendertexture/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexQuadRenderTexturege(x, y, width, height, {\n// hideCCW: true,\n// ninePointMode: false,\n});\n

    or

    var image = scene.add.rexQuadRenderTexturege({\n// x: 0,\n// y: 0,\n// width: 32,\n// height: 32,\n// hideCCW: true,\n// ninePointMode: false,\n});\n
    • ninePointMode :
      • true : Add 9 vertex control points.
      • false : Add 4 vertex control points. Default behavior.

    Add prespective render texture from JSON

    var image = scene.make.rexQuadRenderTexturege({\nx: 0,\ny: 0,    width: 32,\nheight: 32,\n\n// hideCCW: false,\n// ninePointMode: false,\n\nadd: true\n});\n
    "},{"location":"quad-rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MyQuadRenderTexturege extends QuadRenderTexturege {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyQuadRenderTexturege(scene, x, y, width, height, config);\n
    "},{"location":"quad-rendertexture/#internal-render-texture","title":"Internal render texture","text":"
    var rt = image.rt;\n
    • rt : Render texture
    "},{"location":"quad-rendertexture/#paste-texture","title":"Paste texture","text":"
    • Paste game object
      image.rt.draw(gameObject, x, y);\n// image.rt.draw(gameObject, x, y, alpha, tint);\n
    • gameObject : a game object, or an array of game objects
    • Paste game objects in a group
      image.rt.draw(group, x, y);\n// image.rt.draw(group, x, y, alpha, tint);\n
    • Paste game objects in a scene
      image.rt.draw(scene.children, x, y);\n// image.rt.draw(scene.children, x, y, alpha, tint);\n
    • Paste texture
      image.rt.draw(key, x, y);\n// image.rt.draw(key, x, y, alpha, tint);\n
      or
      image.rt.drawFrame(key, frame, x, y);\n// image.rt.drawFrame(key, frame, x, y, alpha, tint);\n
      • key : The key of the texture to be used, as stored in the Texture Manager.
    • Snapshop game objects
      image.snapshot(gameObjects);\n
      • gameObjects : Array of game objects.
    "},{"location":"quad-rendertexture/#erase","title":"Erase","text":"
    image.rt.erase(gameObject, x, y);\n
    • gameObject : a game object, or an array of game objects
    "},{"location":"quad-rendertexture/#clear","title":"Clear","text":"
    image.rt.clear();\n
    "},{"location":"quad-rendertexture/#fill","title":"Fill","text":"
    image.rt.fill(rgb, alpha);\n// image.rt.fill(rgb, alpha, x, y, width, height);\n
    "},{"location":"quad-rendertexture/#other-properties","title":"Other properties","text":"

    See Quad image game object, Mesh game object, game object

    "},{"location":"quad-rendertexture/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"quad-rendertexture/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"quest/","title":"Quest","text":""},{"location":"quest/#introduction","title":"Introduction","text":"

    Question manager.

    • Author: Rex
    • Member of scene, or game object
    "},{"location":"quest/#live-demos","title":"Live demos","text":"
    • (CSV) Branch
    • (YAML) Branch
    • Shuffle
    "},{"location":"quest/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"quest/#install-plugin","title":"Install plugin","text":""},{"location":"quest/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquestplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquestplugin.min.js', true);\n
    • Add quest-manager object
      var questionManager = scene.plugins.get('rexquestplugin').add(config);\n
    "},{"location":"quest/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuestPlugin from 'phaser3-rex-plugins/plugins/quest-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuest',\nplugin: QuestPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add quest-manager object
      var questionManager = scene.plugins.get('rexQuest').add(config);\n
    "},{"location":"quest/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Quest from 'phaser3-rex-plugins/plugins/quest.js';\n
    • Add quest-manager object
      var questionManager = new Quest(config);\n
    "},{"location":"quest/#question-manager","title":"Question manager","text":""},{"location":"quest/#create-question-manager-instance","title":"Create question manager instance","text":"
    var questionManager = scene.plugins.get('rexQuest').add({\nquestions: undefined,\n// format: undefined,\n// delimiter: ',',\n// types: {\n//     question: 'q',\n//     option: '',\n// },\n// convert: true,\n\nquest: undefined,\n// quest: {\n//     shuffleQuestions: false,\n//     shuffleOptions: false,\n// }\n});\n
    • format : Input data (parameter question) format.
      • 'csv' : Input data is a csv string
      • 'yaml' : Input data is a yaml string represented multiple documents, or an array of yaml string for each document.
      • 'json' : Input data is a json string.
      • undefined : Input data is a plain array of questions, don' parse it.
    • questions : Input data of questions.
      • A plain array of questions. Parsing result of other input formats.
        [\n{\nkey: q0,\nparam0: value0,\nparam1: value1,\nparam2: value2,\noptions: [\n{\nkey: o0,\nparam0: value0,\nparam1: value1,\n// ...\n},\n{\nkey: o1,\nparam0: value0,\nparam1: value1,\n// ...\n}\n]\n},\n{\nkey: q1,\nparam0: value0,\nparam1: value1,\nparam2: value2,\noptions: [\n{\nkey: o0,\nparam0: value0,\nparam1: value1,\n// ...\n},\n{\nkey: o1,\nparam0: value0,\nparam1: value1,\n// ...\n}\n]\n},\n]\n
        • Question object : {key, options, param, ...}
          • key : An unique key string. Create a key string '_' + serialNumber if not given.
          • options : An array of option objects.
          • Other key-value parameters.
        • Option object : {key, param, ...}
          • key : An unique key string. Create a key string '_' + serialNumber if not given.
          • Other key-value parameters.
      • A yaml string represented multiple documents, will parse it to array of questions.
        key: q0\nparam0: value0\nparam1: value1\noptions:\n- key: o0\nparam0: value0\nparam1: value1\n- key: o1\nparam0: value0\nparam1: value1\n---\nkey: q1\nparam0: value0\nparam1: value1\noptions:\n- key: o0\nparam0: value0\nparam1: value1\n- key: o1\nparam0: value0\nparam1: value1\n
      • An array of yaml strings for each document, will parse them to array of questions.
      • A csv string, will parse it to array of questions.
        type,key,param0,param1,...\nq,q0,value0,value1,...\n,o0,value0,value1,...\n,o1,value0,value1,...\nq,q1,value0,value1,...\n,o0,value0,value1,...\n,o1,value0,value1,...\n
        • Fields in first row
          • type : Type of this row. These values can be redefined via types in configuration object.
          • q : A row of question object.
          • Empty string : A row of option object belong a question object.
          • key : Unique key string. Create a key string '_' + serialNumber if this field does not exist.
          • Other fields.
      • A json string, will parse it to array of questions.
    • delimiter : Delimiter of csv string. Default value is ','
    • types : Define value of row type.
      • types.question : Define value of question row. Default value is q.
      • types.option : Define value of option row. Default value is '' (empty string).
    • convert : Convert string values to other types.
      • Default type converting : Convert string to number, boolean, null, or string
        • '0', '1', ... (number string) -> number
        • 'true', or 'false' -> true or false
        • '' (empty string) -> null
        • Others : string.
      • Set false to ignore types converting, i.e. all values are string.
      • A custom type converting function :
        function(stringValue, key) {\n// return value;\n}\n
    • quest : Create a private quest task object.
      • undefined : Don't create a private quest task object.
      • true : Create a private quest task object with default configuration.
      • Configuration of quest task :
        • quest.shuffleQuestions : Set true to shuffle questions.
        • quest.shuffleOptions : Set true to shuffle options.
    "},{"location":"quest/#add-questions","title":"Add questions","text":"
    questionManager.add(questions, config);\n
    • questions : An array of question objects, or a csv string. See questions section in Create question manager instance section.
    • config :
      • delimiter : Delimiter of csv string. Default value is ','
      • types : Define value of row type.
        • types.question : Define value of question row. Default value is q.
        • types.option : Define value of option row. Default value is '' (empty string).
      • convert : Convert string values to other types.
        • Default type converting : Convert string to number, boolean, null, or string
          • '0', '1', ... (number string) -> number
          • 'true', or 'false' -> true or false
          • '' (empty string) -> null
          • Others : string.
        • Set false to ignore types converting, i.e. all values are string.
        • A custom type converting function :
          function(stringValue, key) {\n// return value;\n}\n
    "},{"location":"quest/#remove-question","title":"Remove question","text":"
    • Remove a question object
      questionManager.remove(key);\n
      • key : An unique key string.
    • Remove all question objects
      questionManager.removeAll();\n
    "},{"location":"quest/#get-question","title":"Get question","text":"
    • Get a question object
      var question = questionManager.get(key);\n
    • Get all keys of question objects
      var questionKeys = questionManager.getKeys();\n// var out = questionManager.getKeys(out);\n
      • questionKeys : Array of question key string.
    "},{"location":"quest/#question-is-existed","title":"Question is existed","text":"
    var isExisted = questionManager.has(key);\n
    "},{"location":"quest/#array-of-questions","title":"Array of questions","text":"
    var questions = questionManager.questions;\n

    Rearrange items of this questions array to reorder questions in quest task.

    "},{"location":"quest/#get-option","title":"Get option","text":"
    var option = questionManager.getOption(question, optionKey);\n
    • question : A question object, or a question key string.
    • optionKey : A option key string.
    "},{"location":"quest/#private-quest-task","title":"Private quest task","text":""},{"location":"quest/#create-private-quest-task","title":"Create private quest task","text":"

    Each question manager can hava a private quest task object, created when creating question manager, or

    questionManager.startQuest(config);\n
    • config :
      • shuffleQuestions : Set true to shuffle questions.
      • shuffleOptions : Set true to shuffle options.
    "},{"location":"quest/#get-next-question-object","title":"Get next question object","text":"
    • Get next question object
      var question = questionManager.getNextQuestion();\n
    • Get next question object via question key
      var question = questionManager.getNextQuestion(questionKey);\n
    "},{"location":"quest/#event","title":"Event","text":"
    • Fire 'quest' when calling questionManager.getNextQuestion()
      questionManager.on('quest', function(question, questionManager, quest){\n// questionManager.getNextQuestion();\n})\n
      • question : Question object.
        • question.options : Option objects of this question.
      • questionManager : Question manager.
      • quest : Quest task.
    "},{"location":"quest/#is-last-question","title":"Is last question","text":"
    var isLast = questionManager.isLastQuestion();\n
    "},{"location":"quest/#restart-quest-task","title":"Restart quest task","text":"
    questionManager.restartQuest();\n
    "},{"location":"quest/#private-data","title":"Private data","text":"
    • Get data
      var value = questionManager.getData(key, defaultValue);\n
    • Get all data
      var data = questionManager.getData();\n
    • Set value
      questionManager.setData(key, value);\n
    • Increase value
      questionManager.incData(key, inc, defaultValue);\n
    • Multiple value
      questionManager.mulData(key, mul, defaultValue);\n
    • Clear all data
      questionManager.clearData();\n
    "},{"location":"quest/#quest-task","title":"Quest task","text":"

    Create new quest task if user needs more then 1 quest task.

    "},{"location":"quest/#create-quest-task","title":"Create quest task","text":"
    var quest = questionManager.newQuest(config);\n
    • config :
      • shuffleQuestions : Set true to shuffle questions.
      • shuffleOptions : Set true to shuffle options.
    "},{"location":"quest/#get-next-question-object_1","title":"Get next question object","text":"
    • Get next question object
      var question = quest.getNextQuestion();\n
    • Get next question object via question key
      var question = quest.getNextQuestion(questionKey);\n
    "},{"location":"quest/#event_1","title":"Event","text":"
    • Fire 'quest' when calling questionManager.getNextQuestion()
      quest.on('quest', function(question, questionManager, quest){\n// questionManager.getNextQuestion();\n})\n
      • question : Question object.
        • question.options : Option objects of this question.
      • questionManager : Question manager.
      • quest : Quest task.
    "},{"location":"quest/#is-last-question_1","title":"Is last question","text":"
    var isLast = quest.isLastQuestion();\n
    "},{"location":"quest/#restart-quest-task_1","title":"Restart quest task","text":"
    quest.start();\n
    "},{"location":"quest/#private-data_1","title":"Private data","text":"
    • Get data
      var value = quest.getData(key, defaultValue);\n
    • Get all data
      var data = quest.getData();\n
    • Set value
      quest.setData(key, value);\n
    • Increase value
      quest.incData(key, inc, defaultValue);\n
    • Multiple value
      quest.mulData(key, inc, defaultValue);\n
    • Clear all data
      quest.clearData();\n
    "},{"location":"quest/#get-option_1","title":"Get option","text":"
    var option = quest.getOption(question, optionKey);\n
    • question : A question object, or a question key string, or undefined to get current question object.
    • optionKey : A option key string.
    "},{"location":"random-data-generator/","title":"Random data generator","text":""},{"location":"random-data-generator/#introduction","title":"Introduction","text":"

    Get random value from a random generator, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"random-data-generator/#usage","title":"Usage","text":""},{"location":"random-data-generator/#random-data-generator","title":"Random data generator","text":"
    • Pre-defined random data generator
      var rnd = Phaser.Math.RND;\n
    • New random generator
      var rnd = new Phaser.Math.RandomDataGenerator(seed);\n
    "},{"location":"random-data-generator/#set-seed","title":"Set seed","text":"
    • Set seed in game config for pre-defined random data generator
      var config = {\n// ...\nseed: seed,\n// ...\n}\nvar game = new Phaser.Game(config);\n
      • seed :
        • An array of string, like [(Date.now() * Math.random()).toString()]
    • Set seed
      rnd.init(seed);\n
      • seed : A string or an array of string.
    "},{"location":"random-data-generator/#get-random-value","title":"Get random value","text":"
    • Random real number between 0 and 1.
      var value = rnd.frac();\n
    • Random integer between 0 and 2^32.
      var value = rnd.integer();\n
    • Random real number between 0 and 2^32.
      var value = rnd.real();\n
    • Random integer between and including min and max.
      var value = rnd.between(min, max);\n// var value = rnd.integerInRange(min, max);\n
    • Random real number between min and max.
      var value = rnd.realInRange(min, max);\n
    • Random real number between -1 and 1.
      var value = rnd.normal();\n
    • Random angle between -180 and 180.
      var angle = rnd.angle();\n
    • Random rotation in radians, between -3.141 and 3.141.
      var angle = rnd.rotation();\n
    • Random timestamp between min and max.
      var timestamp = rnd.timestamp(min, max);\n
      • min : Default value is the beginning of 2000.
      • max : Default value is the end of 2020.
    • UUID
      var uuid = rnd.uuid();\n
    • Random sign value
      var sign = rnd.sign();\n
      • sign : -1 or 1
    "},{"location":"random-data-generator/#get-random-item","title":"Get random item","text":"
    • Random element from within the given array.
      var item = rnd.pick(arr);\n
    • Random element from within the given array, favoring the earlier entries.
      var item = rnd.weightedPick(arr);\n
    "},{"location":"random-data-generator/#shuffle-array","title":"Shuffle array","text":"
    var arr = rnd.shuffle(arr);\n
    "},{"location":"random/","title":"Random number","text":""},{"location":"random/#introduction","title":"Introduction","text":"

    Get random value, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"random/#usage","title":"Usage","text":""},{"location":"random/#get-random-value-between-min-max","title":"Get random value between (min, max)","text":"
    • Random integer
      var value = Phaser.Math.Between(min, max);\n
    • Random floating point number
      var value = Phaser.Math.FloatBetween(min, max);\n
    "},{"location":"random/#get-random-vector","title":"Get random vector","text":"
    • 2D vector
      var vec = Phaser.Math.RandomXY(vec);    // return vec {x, y}\n// var vec = Phaser.Math.RandomXY(vec, scale);\n
    • 3D vector
      var vec = Phaser.Math.RandomXYZ(vec);    // return vec {x, y, z}\n// var vec = Phaser.Math.RandomXYZ(vec, scale);\n
    • 4D vector
      var vec = Phaser.Math.RandomXYZW(vec);    // return vec {x, y, z, w}\n// var vec = Phaser.Math.RandomXYZW(vec, scale);\n
    "},{"location":"randomplace/","title":"Random place","text":""},{"location":"randomplace/#introduction","title":"Introduction","text":"

    Place objects randomly inside an area without overlapping.

    • Author: Rex
    • Methods
    "},{"location":"randomplace/#live-demos","title":"Live demos","text":"
    • Random place
    "},{"location":"randomplace/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"randomplace/#install-plugin","title":"Install plugin","text":""},{"location":"randomplace/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrandomplaceplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrandomplaceplugin.min.js', true);\n
    • Random place objects
      scene.plugins.get('rexrandomplaceplugin').randomPlace(gameObjects, config);\n
    "},{"location":"randomplace/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RandomPlacePlugin from 'phaser3-rex-plugins/plugins/randomplace-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRandomPlace',\nplugin: RandomPlacePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Random place objects
      scene.plugins.get('rexRandomPlace').randomPlace(gameObjects, config);\n
    "},{"location":"randomplace/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RandomPlace from 'phaser3-rex-plugins/plugins/randomplace.js';\n
    • Random place objects
      RandomPlace(gameObjects, config);\n
    "},{"location":"randomplace/#random-place","title":"Random place","text":"
    scene.plugins.get('rexRandomPlace').randomPlace(gameObjects, {\nradius: radius,\n\ngetPositionCallback: undefined,\narea: areaGeomObject,\n});\n
    • gameObjects : An array of gameObjects. Each item can be
      • A game objects.
      • A plain object contains
        {\ngameObject: gameObject,\nradius: radius,\n}\n
        • radius : Collision radius of this game object.
    • radius : Default collision radius of each game object.
    • getPositionCallback : A callback to get a random position.
      • undefined : Use area.getRandomPoint(out) as callback.
      • A function object :
        function(out) {\nout.x = 0;\nout.y = 0;\n}\n
    • area : A geom object, which has getRandomPoint method.
      • A circle : new Phaser.Geom.Circle(x, y, radius)
      • A rectangle : new Phaser.Geom.Rectangle(x, y, width, height)
      • A triangle : new Phaser.Geom.Triangle(x1, y1, x2, y2, x3, y3)
      • An ellipse : new Phaser.Geom.Ellipse(x, y, width, height)
      • undefined : A rectangle (0, 0, gameWidth, gameHeight)
    "},{"location":"raycaster/","title":"Raycaster","text":""},{"location":"raycaster/#introduction","title":"Introduction","text":"

    Raycaster between obstacles.

    • Author: Rex
    • Member of scene
    "},{"location":"raycaster/#live-demos","title":"Live demos","text":"
    • Reflaction
    "},{"location":"raycaster/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"raycaster/#install-plugin","title":"Install plugin","text":""},{"location":"raycaster/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexraycasterplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexraycasterplugin.min.js', true);\n
    • Add raycaster object
      var raycaster = scene.plugins.get('rexraycasterplugin').add(config);\n
    "},{"location":"raycaster/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RaycasterPlugin from 'phaser3-rex-plugins/plugins/raycaster-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRaycaster',\nplugin: RaycasterPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add raycaster object
      var raycaster = scene.plugins.get('rexRaycaster').add(config);\n
    "},{"location":"raycaster/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Raycaster from 'phaser3-rex-plugins/plugins/raycaster.js';\n
    • Add raycaster object
      var raycaster = new Raycaster(config);\n
    "},{"location":"raycaster/#create-instance","title":"Create instance","text":"
    var raycaster = scene.plugins.get('rexRaycaster').add({\n// maxRayLength: 10000\n});\n
    • maxRayLength : Max length of ray.
    "},{"location":"raycaster/#obstacle","title":"Obstacle","text":""},{"location":"raycaster/#add","title":"Add","text":"
    raycaster.addObstacle(gameObject);\n// raycaster.addObstacle(gameObject, polygon);\n
    • polygon : A polygon.
      • undefined : Created polygon from 4 vertics of game object.

    or

    raycaster.addObstacle(gameObjects);\n
    • gameObjects : Array of game object.
    "},{"location":"raycaster/#remove","title":"Remove","text":"
    raycaster.removeObstacle(gameObject);\n
    • gameObject : A game object, or an array of game objects.
    "},{"location":"raycaster/#clear","title":"Clear","text":"
    raycaster.clearObstacle();\n
    "},{"location":"raycaster/#update-shape","title":"Update shape","text":"
    raycaster.updateObstacle(gameObject);\n// raycaster.updateObstacle(gameObject, polygon);\n
    • polygon : A polygon.
      • undefined : Created polygon from 4 vertics of game object.
    "},{"location":"raycaster/#raycaster","title":"Raycaster","text":"
    var result = raycaster.rayToward(x, y, angle);\n
    • x, y : Emit ray from world-position.
    • angle : Emit ray toward to angle, in radian.
    • result :
      • false : Ray dose not hit any game object.
      • An object : Hit to a game object.
        {\ngameObject,\npolygon,\nsegment,\nx, y,\nreflectAngle\n}\n
        • gameObject : Hitting game object.
        • polygon : Polygon of hitting game object.
        • segment : Segment(line) of hitting polygon.
        • x, y : World position of hitting
        • reflectAngle : Reflect angle, in radian.

    Reflection

    Use result.x, result.y, result.reflectAngle for next reflection ray.

    raycaster.rayToward(result.x, result.y, result.reflectAngle)\n

    "},{"location":"realtimetimers/","title":"Real time timers","text":""},{"location":"realtimetimers/#introduction","title":"Introduction","text":"

    Start and counting timer by real-time timestamp.

    Note

    Not support pause, or timescale features.

    • Author: Rex
    • Member of scene, or game object
    "},{"location":"realtimetimers/#live-demos","title":"Live demos","text":"
    • Progress
    "},{"location":"realtimetimers/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"realtimetimers/#install-plugin","title":"Install plugin","text":""},{"location":"realtimetimers/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrealtimetimersplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrealtimetimersplugin.min.js', true);\n
    • Add real-time timers object
      var realTimeTimers = scene.plugins.get('rexrealtimetimersplugin').add(config);\n
    "},{"location":"realtimetimers/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RealTimeTimersPlugin from 'phaser3-rex-plugins/plugins/realtimetimers-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRealTimeTimers',\nplugin: RealTimeTimersPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add real-time timers object
      var realTimeTimers = scene.plugins.get('rexRealTimeTimers').add(config);\n
    "},{"location":"realtimetimers/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RealTimeTimers from 'phaser3-rex-plugins/plugins/realtimetimers.js';\n
    • Add real-time timers object
      var realTimeTimers = new RealTimeTimers(config);\n
    "},{"location":"realtimetimers/#create-instance","title":"Create instance","text":"
    var realTimeTimers = scene.plugins.get('rexRealTimeTimers').add({\n// startTimestamp: new Date().getTime(),\n// getTimestampCallback: functio() { return timestamp; }\n});\n
    • getTimestampCallback : Custom callback of get current timestamp, optional.
      • Default behavior is getting current timestamp from system.
    • startTimestamp : Start time, optional. Use this start-timestamp if getTimestampCallback is not given.
      • Default value is current timestamp new Date().getTime().
    "},{"location":"realtimetimers/#set-start-timestamp","title":"Set start timestamp","text":"

    Start-timestamp is set when creating this real-time timers object.

    User still can change Start-timestamp by

    realTimeTimers.setStartTimestamp(timestamp);\n

    This changing won't affect existed timers.

    "},{"location":"realtimetimers/#add-a-timer","title":"Add a timer","text":"
    realTimeTimers.addTimer(name, period);\n// realTimeTimers.addTimer(name, period, data);\n// realTimeTimers.addTimer(name, period, data, currentTimestamp);\n
    • name : Any name string of this timer.
    • period : Will expire after period time, in millisecond.
    • data : Any kind of custom data.
    • currentTimestamp : Start this time in current time, optional.
      • undefined : Get current timestamp from getTimestampCallback callback.

    or

    realTimeTimers.addTimer(name, {\nday: dayCount,        // d: dayCount,\nhour: hourCount,      // h: hourCount,\nminute: minuteCount,  // m: minuteCount,\nsecond: secondCount,  // s: secondCount,\n}, data, currentTimestamp);\n
    • Sum period by
      • day, or d : Day count
      • hour, or h : Hour count
      • minute, or m : Minute count
      • second, or s : Second count
    "},{"location":"realtimetimers/#increase-period","title":"Increase period","text":"
    realTimeTimers.incTimerPeriod(name, period);\n
    • name : Any name string of this timer.
    • period : Will expire after period time, in millisecond.

    or

    realTimeTimers.incTimerPeriod(name, {\nday: dayCount,        // d: dayCount,\nhour: hourCount,      // h: hourCount,\nminute: minuteCount,  // m: minuteCount,\nsecond: secondCount,  // s: secondCount,\n});\n

    Will trigger 'update' event.

    "},{"location":"realtimetimers/#expire-timers","title":"Expire timers","text":"
    • Get expired timers
      var timers = realTimeTimers.getExpiredTimers();\n// var timers = realTimeTimers.getExpiredTimers(currentTimestamp);\n
      • timers : Array of expired timers. Each timer include these properties -
        {\nname: name,\nstart: timestamp,\nperiod: time\n}\n
      • currentTimestamp : Start this time in current time, optional.
        • undefined : Get current timestamp from getTimestampCallback callback.
    • Pop(get and remove) expired timers
      var timers = realTimeTimers.popExpiredTimers();\n// var timers = realTimeTimers.popExpiredTimers(currentTimestamp);\n
      • currentTimestamp : Start this time in current time, optional.
        • undefined : Get current timestamp from getTimestampCallback callback.
    • Get progress of timer
      var result = realTimeTimers.getTimersProgress()\n// var result = realTimeTimers.getTimersProgress(currentTimestamp);\n
      • currentTimestamp : Start this time in current time, optional.
        • undefined : Get current timestamp from getTimestampCallback callback.
      • result : Array of timer's progress. Include these properties -
        {\nname: name,\nperiod: time,\nelapsed: time,\nprogress: t    // elapsed/period\ntimer: timerObject\n}\n
        • timer : Timer object, can remove this timer object by
          realTimeTimers.removeTimers(timer);\n
    "},{"location":"realtimetimers/#get-timers","title":"Get timers","text":"
    • Get last added timer
      var timer = realtimetimers.lastTimer;\n
    • Get all timers
      var timers = realtimetimers.getTimers();\n
    • Get timers by name.
      var timers = realtimetimers.getTimers(name);\n
    • Amount of total timers
      var amount = realtimetimers.length;\n
    "},{"location":"realtimetimers/#remove-timers","title":"Remove timers","text":"
    • Remove timers by name
      realtimetimers.removeTimers(name);\n
    • Remove timer object
      realtimetimers.removeTimers(timer);\n
      • timer : A timer object, or an array of timer objects.
    • Remove all timers
      realtimetimers.clearTimers();\n
    "},{"location":"realtimetimers/#states","title":"States","text":"
    • Get states in plain object
      var states = realtimetimers.toJSON();\n
    • Get states in JSON string. Can store this JSON string into webstorage or server.
      var s = JSON.stringify(realtimetimers);\n
    • Set states by plain object
      realtimetimers.resetFromJSON(states)\n
    "},{"location":"realtimetimers/#events","title":"Events","text":"
    • On add a timer
      realtimetimers.on('add', function(timer, timers){ })\n
      • timer : Added timer.
        {\nname: name,\nstart: timestamp,\nperiod: time\n}\n
      • timers : Total timers after adding.
    • On remove a timer
      realtimetimers.on('remove', function(timer, timers){ })\n
      • timer : Removed timer.
        {\nname: name,\nstart: timestamp,\nperiod: time\n}\n
      • timers : Total timers after removing.
    • On timers updated (add, remove, or increas period).
      realtimetimers.on('update', function(timers){ var s = JSON.stringify(realtimetimers);\n// Store current states to webstorage or server here.\n})\n
      • timers : Total timers after updating.
    "},{"location":"rendertexture/","title":"Render texture","text":""},{"location":"rendertexture/#introduction","title":"Introduction","text":"

    Paste game objects or textures on dynaimc texture, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"rendertexture/#usage","title":"Usage","text":""},{"location":"rendertexture/#add-render-texture-object","title":"Add render texture object","text":"
    • Create an empty render texture object.
      var rt = scene.add.renderTexture(x, y, width, height);\n

    Add render texture from JSON

    var rt = scene.make.renderTexture({\nx: 0,\ny: 0,\nwidth: 32,\nheight: 32,\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n

    Origin position

    Origin position of this render texture is (0,0) (top-left)

    "},{"location":"rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRenderTexture extends Phaser.GameObjects.RenderTexture {\nconstructor(scene, x, y, width, height) {\nsuper(scene, x, y, width, height);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rt = new MyRenderTexture(scene, x, y, width, height);\n
    "},{"location":"rendertexture/#set-size","title":"Set size","text":"
    rt.setSize(width, height);\n
    "},{"location":"rendertexture/#fill-color","title":"Fill color","text":"
    rt.fill(rgb);\n// rt.fill(rgb, alpha, x, y, width, height);\n
    • rgb : The number color to fill this Dynamic Texture with.
    • alpha : The alpha value used by the fill. Default value is 1.
    • x, y, width, height : The area of the fill rectangle. Default behavior is filling whole size.
    "},{"location":"rendertexture/#clear","title":"Clear","text":"
    rt.clear();\n
    rt.clear(x, y, width, height);\n
    "},{"location":"rendertexture/#draw-game-object","title":"Draw game object","text":"
    rt.draw(entries);\n// rt.draw(entries,x, y);\n// rt.draw(entries, x, y, alpha, tint);\n
    • entries :
      • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
      • Tilemap Layers.
      • A Group. The contents of which will be iterated and drawn in turn.
      • A Container. The contents of which will be iterated fully, and drawn in turn.
      • A Scene Display List. Pass in Scene.children to draw the whole list.
      • Another Dynamic Texture, or a Render Texture.
      • A Texture Frame instance.
      • A string. This is used to look-up the texture from the Texture Manager.
    • x, y : The x/y position to draw the Frame at, or the offset applied to the object.
      • If the object is a Group, Container or Display List, the coordinates are added to the positions of the children.
      • For all other types of object, the coordinates are exact.
    • alpha, tint : Only used by Texture Frames.
      • Game Objects use their own alpha and tint values when being drawn.
    "},{"location":"rendertexture/#erase","title":"Erase","text":"
    rt.erase(entries);\n// rt.erase(entries, x, y);\n
    • entries :
      • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
      • Tilemap Layers.
      • A Group. The contents of which will be iterated and drawn in turn.
      • A Container. The contents of which will be iterated fully, and drawn in turn.
      • A Scene Display List. Pass in Scene.children to draw the whole list.
      • Another Dynamic Texture, or a Render Texture.
      • A Texture Frame instance.
      • A string. This is used to look-up the texture from the Texture Manager.
    • x, y : The x/y position to draw the Frame at, or the offset applied to the object.
      • If the object is a Group, Container or Display List, the coordinates are added to the positions of the children.
      • For all other types of object, the coordinates are exact.
    "},{"location":"rendertexture/#draw-frame","title":"Draw frame","text":"
    rt.stamp(key, frame, x, y, {\nalpha: 1,\ntint: 0xffffff,\nangle: 0,\nrotation: 0,\nscale: 1,\nscaleX: 1,\nscaleY: 1,\noriginX: 0.5,\noriginY: 0.5,\nblendMode: 0,\nerase: false,\nskipBatch: false\n})\n

    or

    rt.drawFrame(key, frame, x, y);\n// rt.drawFrame(key, frame, x, y, alpha, tint);\n
    • x, y : Top-left position
    "},{"location":"rendertexture/#draw-repeat-frames","title":"Draw repeat frames","text":"
    • Repeat frames full of size
      rt.repeat(key, frame);\n
    • Repeat in an area
      rt.repeat(key, frame, x, y, width, height);\n// rt.repeat(key, frame, x, y, width, height, alpha, tint, skipBatch);\n
    "},{"location":"rendertexture/#batch-draw","title":"Batch draw","text":"
    1. Begin
      rt.beginDraw();\n
    2. Draw
      • Draw game object
        rt.batchDraw(entries, x, y, alpha, tint);\n
        • entries :
          • Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
          • Tilemap Layers.
          • A Group. The contents of which will be iterated and drawn in turn.
          • A Container. The contents of which will be iterated fully, and drawn in turn.
          • A Scene Display List. Pass in Scene.children to draw the whole list.
          • Another Dynamic Texture, or a Render Texture.
          • A Texture Frame instance.
          • A string. This is used to look-up the texture from the Texture Manager.
      • Draw frame
        rt.batchDrawFrame(key, frame, x, y, alpha, tint);\n
      • Draw image
        rt.stamp(key, frame, x, y, {\n// ...\nskipBatch: true\n})\n
      • Draw repeat images
        rt.repeat(key, frame, x, y, width, height, alpha, tint, true);\n
    3. End
      rt.endDraw();\n
    "},{"location":"rendertexture/#internal-camera","title":"Internal camera","text":"

    Internal camera rt.camera

    • Scroll (offset)
      rt.camera.setScroll(x, y);\n
    • Zoom (scale)
      rt.camera.setZoom(zoom);\n
    • Rotate
      rt.camera.setAngle(angle);  // angle in degrees\n
    "},{"location":"rendertexture/#snapshot","title":"Snapshot","text":""},{"location":"rendertexture/#snapshot-area","title":"Snapshot area","text":"
    texture.snapshot(callback);\n// texture.snapshot(callback, type, encoderOptions);\n

    or

    texture.snapshotArea(x, y, width, height, callback, type, encoderOptions);\n
    • callback : The Function to invoke after the snapshot image is created.
      function(imageElement) {\n}\n
      • imageElement : HTMLImageElement.
    • type : The format of the image to create, usually 'image/png' or 'image/jpeg'. Default value is 'image/png'.
    • encoderOptions : The image quality, between 0 and 1. Used for image formats with lossy compression, such as 'image/jpeg'. Default value is 0.92.
    • x, y, width, height : Snapshot area.
    "},{"location":"rendertexture/#get-color-of-a-pixel","title":"Get color of a pixel","text":"
    texture.snapshotPixel(x, y, callback);\n
    • x, y : The x/y coordinate of the pixel to get.
    • callback : The Function to invoke after the snapshot image is created.
      function(color) {        }\n
      • color : Color object.
    "},{"location":"rendertexture/#global-alpha","title":"Global alpha","text":"
    rt.setGlobalAlpha(alpha);\n// rt.globalAlpha = alpha;\n
    "},{"location":"rendertexture/#global-tint","title":"Global tint","text":"
    rt.setGlobalTint(tint);\n// rt.globalTint = tint;\n
    "},{"location":"rendertexture/#save-texture","title":"Save texture","text":"

    Stores a copy of this Render Texture in the Texture Manager using the given key.

    rt.saveTexture(key);\n

    Calling saveTexture again will not save another copy of the same texture, it will just rename the key of the existing copy.

    "},{"location":"rendertexture/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"rendertexture/#create-mask","title":"Create mask","text":"
    var mask = rt.createBitmapMask();\n

    See mask

    "},{"location":"rendertexture/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"repeatimage/","title":"Repeat image","text":""},{"location":"repeatimage/#introduction","title":"Introduction","text":"

    Stamp image repeatly on canvas, similar with TileSprite. It has better rendering result when the texture size is not power of 2, in WebGL and pixelArt mode.

    • Author: Rex
    • Game object
    "},{"location":"repeatimage/#live-demos","title":"Live demos","text":"
    • PixelArt, compared with TileSprite
    • Scroll
    "},{"location":"repeatimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"repeatimage/#install-plugin","title":"Install plugin","text":""},{"location":"repeatimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrepeatimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrepeatimageplugin.min.js', true);\n
    • Add repeat-image object
      var image = scene.add.rexRepeatImage(x, y, width, height, key, frame);\n
    "},{"location":"repeatimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RepeatImagePlugin from 'phaser3-rex-plugins/plugins/repeatimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRepeatImagePlugin',\nplugin: RepeatImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add repeat-image object
      var image = scene.add.rexRepeatImage(x, y, width, height, key, frame);\n
    "},{"location":"repeatimage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RepeatImage from 'phaser3-rex-plugins/plugins/repeatimage.js';\n
    • Add repeat-image object
      var image = new RepeatImage(scene, x, y, key, frame, config);\nscene.add.existing(image);\n
    "},{"location":"repeatimage/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRepeatImagePlugin',\nplugin: RepeatImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"repeatimage/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexRepeatImage(x, y, width, height, key, frame);\n

    Add image from JSON

    var image = scene.make.rexRepeatImage({\nx: 0,\ny: 0,\nwidth: 512,\nheight: 512,\nkey: '',\n\nadd: true\n});\n
    "},{"location":"repeatimage/#custom-class","title":"Custom class","text":"
    • Define class
      class MyImage extends RepeatImage {\nconstructor(scene, x, y, width, height, key, frame) {\nsuper(scene, x, y, width, height, key, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyImage(scene, x, y, width, height, key, frame);\n
    "},{"location":"repeatimage/#set-texture","title":"Set texture","text":"
    image.setTexture(key, frame);\n
    "},{"location":"repeatimage/#properties-of-tiles","title":"Properties of tiles","text":"
    • Position
      image.setTilePosition(x, y);\n
      or
      image.tilePositionX = x;\nimage.tilePositionY = y;\n
    • Scale
      image.setTileScale(scaleX, scaleY);\n
      or
      image.tileScaleX = scaleX;\nimage.tileScaleY = scaleY;\n
    "},{"location":"repeatimage/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"repeatimage/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"repeatimage/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"repeatimage/#compare-with-tilesprite","title":"Compare with TileSprite","text":"

    Using this RepeatImage when the texture size is not power of 2, in WebGL and pixelArt mode. Otherwise, using tileSprite

    "},{"location":"restorabledata/","title":"Restorable data","text":""},{"location":"restorabledata/#introduction","title":"Introduction","text":"

    Restorable data manager, extends from built-in data manager.

    • Author: Rex
    • Member of scene
    "},{"location":"restorabledata/#live-demos","title":"Live demos","text":"
    • Restorable canvas
    "},{"location":"restorabledata/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"restorabledata/#install-plugin","title":"Install plugin","text":""},{"location":"restorabledata/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrestorabledataplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrestorabledataplugin.min.js', true);\n
    • Add restorable data object
      var data = scene.plugins.get('rexrestorabledataplugin').add(parent);\n
    "},{"location":"restorabledata/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RestorableDataPlugin from 'phaser3-rex-plugins/plugins/restorabledata-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRestorableData',\nplugin: RestorableDataPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add restorable data object
      var data = scene.plugins.get('rexRestorableData').add(parent);\n
    "},{"location":"restorabledata/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RestorableData from 'phaser3-rex-plugins/plugins/restorabledata.js';\n
    • Add restorable data object
      var data = new RestorableData(parent);\n
    "},{"location":"restorabledata/#create-instance","title":"Create instance","text":"
    var data = scene.plugins.get('rexRData').add(parent);\n// var data = scene.plugins.get('rexRData').add(parent, eventEmitter);\n
    • parent : The object (a scene, or a game object) that this DataManager belongs to.
    • eventEmitter : The DataManager's event emitter.
    "},{"location":"restorabledata/#getsetremove-value","title":"Get/set/remove value","text":"

    See built-in data manager.

    "},{"location":"restorabledata/#commit","title":"Commit","text":"

    Commit current data status into repository, and increase current version number.

    data.commit();\n

    or

    data.commit(alias);\n
    • alias : A version alias string.
    "},{"location":"restorabledata/#restore","title":"Restore","text":"
    • Restore data status to a specific version.
      data.restore(version);\n
      or
      data.version = version;\n
      • version : Version number or version alias string.
    • Rebuild data status from version 0 to a specific version.
      data.restore(version, true);\n
      • version : Version number or version alias string.
    • Reverse data status to last version.
      data.restore();\n
    "},{"location":"restorabledata/#version","title":"Version","text":"
    • Get current version alias string
      var version = data.versionAlias;\n
    • Get all version alias strings
      var aliases = data.versionAliases;\n
    • Get current version number
      var version = data.version;\n
    • Get last version number
      var version = data.lastVersion;\n

    Version starts from 0 which has no data. Each data.commit() will increase this version number.

    "},{"location":"restorabledata/#saveload-status","title":"Save/load status","text":"
    • Get current status
      var o = data.toJSON();\n
    • Load status
      data.resetFromJSON(o);\n

    or

    • Get current status via JSON string
      var s = JSON.stringify(data);\n
    • Load status via JSON string
      data.resetFromJSON(JSON.parse(s));\n
    "},{"location":"reverse-string/","title":"Reverse","text":""},{"location":"reverse-string/#introduction","title":"Introduction","text":"

    Reverses string, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"reverse-string/#usage","title":"Usage","text":"
    var result = Phaser.Utils.String.ReverseString(str);\n
    "},{"location":"rexvideo/","title":"Rexvideo","text":"

    Warning

    This plugin is abandoned, please using built-in video.

    "},{"location":"rexvideo/#introduction","title":"Introduction","text":"

    Play video on DOM, or on canvas.

    • Author: Rex
    • DOM Game object, or Canvas Game object
    "},{"location":"rexvideo/#live-demos","title":"Live demos","text":""},{"location":"rexvideo/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"rexvideo/#install-plugin","title":"Install plugin","text":""},{"location":"rexvideo/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexvideoplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexvideoplugin.min.js', true);\n
    • Add video object
      var video = scene.add.rexVideoCanvas(x, y, width, height, config);    // var video = scene.add.rexVideo(x, y, width, height, config);\n
    "},{"location":"rexvideo/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import VideoPlugin from 'phaser3-rex-plugins/plugins/video-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexVideo',\nplugin: VideoPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add video object
      var video = scene.add.rexVideoCanvas(x, y, width, height, config);\n// var video = scene.add.rexVideo(x, y, width, height, config);\n
    "},{"location":"rexvideo/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import VideoCanvas from 'phaser3-rex-plugins/plugins/videocanvas/VideoCanvas.js';\n// import VideoDOM from 'phaser3-rex-plugins/plugins/videodom/VideoDOM.js';\n
    • Add text object
      var video = new VideoCanvas(scene, x, y, width, height, config);\nscene.add.existing(video);\n// var video = new VideoDOM(scene, x, y, width, height, config);\n// scene.add.existing(video);\n
    "},{"location":"rexvideo/#add-video-object","title":"Add video object","text":"
    • Video on DOM
      var video = scene.add.rexVideo(x, y, width, height, config);\n// var video = scene.add.rexVideo(x, y, config);\n// var video = scene.add.rexVideo(config);\n
    • Video on canvas
      var video = scene.add.rexVideoCanvas(x, y, width, height, config);\n// var video = scene.add.rexVideoCanvas(x, y, config);\n// var video = scene.add.rexVideoCanvas(config);\n

    Default configuration

    {\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\n// Element properties\nsrc: url,\n// src: {\n//     webm: webmFileURL,\n//     ogg: oggFileURL,\n//     mp4: mp4FileURL,\n//     h264: h264FileURL,\n// }\nid: undefined,\nautoPlay: true,\ncontrols: false,\nloop: false,\nmuted: false,\nplaysInline: true,\ncrossOrigin: 'anonymous',\nplaybackTimeChangeEventEnable: true,\n}\n
    • x, y : Position
    • width, height : Size of element
    • Element properties
      • src : Specifies the URL of the video file.
        • A string : url of the video file.
        • A plain object : { videoType: fileURL }
          1. Get webmFileURL if browser supports webm video format.
          2. Get oggFileURL if browser supports ogg video format.
          3. Get mp4FileURL if browser supports mp4 video format.
          4. Get h264FileURL if browser supports h264 video format.
      • id : id element property.
      • autoPlay : autoplay element property.
      • controls : controls element property.
      • loop : loop element property.
      • muted : muted element property.
      • playsInline : playsInline element property.
      • crossOrigin : crossOrigin element property.
    • playbackTimeChangeEventEnable : Set false to disable playbacktimechange event.
    "},{"location":"rexvideo/#different-between-rexvideo-and-rexvideocanvas","title":"Different between rexVideo and rexVideoCanvas","text":"
    • rexVideo plays video on DOM.
      • DOM object always above game canvas.
      • Won't be affected by webgl shader.
      • Right clicks to pop up a menu.
    • rexVideoCanvas plays video on canvas.
      • Can be placed between game objects via depth setting.
      • Can be affected by webgl shader.
    "},{"location":"rexvideo/#custom-class","title":"Custom class","text":"
    • Define class
      class MyVideo extends Video {  // or VideoCanvas\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     if (super.preUpdate) {\n//         super.preUpdate(time, delta)\n//     }\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var video = new MyVideo(scene, x, y, width, height, config);\n
    "},{"location":"rexvideo/#load","title":"Load","text":"
    video.load(src);\n
    • src : Specifies the URL of the video file.
      • A string : url of the video file.
      • A plain object : { videoType: fileURL }
        1. Get webmFileURL if browser supports webm video format.
        2. Get oggFileURL if browser supports ogg video format.
        3. Get mp4FileURL if browser supports mp4 video format.
        4. Get h264FileURL if browser supports h264 video format.
    "},{"location":"rexvideo/#play","title":"Play","text":"
    video.play();\n
    "},{"location":"rexvideo/#pause","title":"Pause","text":"
    video.pause();\n
    "},{"location":"rexvideo/#playback-time","title":"Playback time","text":"
    • Get
      var playbackTime = video.playbackTime; // time in seconds\n
      var t = video.t; // t: 0~1\n
    • Set
      video.setPlaybackTime(time); // time in seconds\n// video.playbackTime = time;\n
      video.setT(t); // t: 0~1\n// video.t = t;\n
    "},{"location":"rexvideo/#duration","title":"Duration","text":"
    var duration = video.duration;  // time in seconds\n
    "},{"location":"rexvideo/#volume","title":"Volume","text":"
    • Get
      var volume = video.volume;  // volume: 0~1\n
    • Set
      video.setVolume(volume);  // volume: 0~1\n// video.volume = volume;\n
    "},{"location":"rexvideo/#mute","title":"Mute","text":"
    • Get
      var muted = video.muted;  // muted: true/false\n
    • Set
      video.setMute(muted);  // muted: true/false\n// video.muted = muted;\n
    "},{"location":"rexvideo/#loop","title":"Loop","text":"
    • Get
      var loop = video.loop;  // loop: true/false\n
    • Set
      video.setLoop(loop);  // loop: true/false\n// video.loop = loop;\n
    "},{"location":"rexvideo/#resize","title":"Resize","text":"
    video.resize(width, height);\n
    "},{"location":"rexvideo/#status","title":"Status","text":"
    • Is playing
      var isPlaying = video.isPlaying;\n
    • Is paused
      var isPaused = video.isPaused;\n
    • Has end
      var hasEnded = video.hasEnded;\n
    • Ready state
      var readyState = video.readyState;\n
      • 0 = HAVE_NOTHING - no information whether or not the audio/video is ready
      • 1 = HAVE_METADATA - metadata for the audio/video is ready
      • 2 = HAVE_CURRENT_DATA - data for the current playback position is available, but not enough data to play next frame/millisecond
      • 3 = HAVE_FUTURE_DATA - data for the current and at least the next frame is available
      • 4 = HAVE_ENOUGH_DATA - enough data available to start playing
    "},{"location":"rexvideo/#events","title":"Events","text":"
    • Load start
      video.on('loadstart', function(video){ }, scope);\n
    • Can play
      video.on('canplay', function(video){ }, scope);\n
    • Can play through
      video.on('canplaythrough', function(video){ }, scope);\n
    • Playing
      video.on('playing', function(video){ }, scope);\n
    • Pause
      video.on('pause', function(video){ }, scope);\n
    • Stalled
      video.on('stalled', function(video){ }, scope);\n
    • Ended
      video.on('ended', function(video){ }, scope);\n
    • Error
      video.on('error', function(video){ }, scope);\n
    • Playback time changed
      video.on('playbacktimechange', function(video){ }, scope);\n
      • Set playbackTimeChangeEventEnable to true to enable this event.
    "},{"location":"rope/","title":"Rope","text":""},{"location":"rope/#introduction","title":"Introduction","text":"

    Manipulate the vertices of images, built-in game object of phaser.

    • Author: Richard Davey

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"rope/#usage","title":"Usage","text":""},{"location":"rope/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"rope/#add-object","title":"Add object","text":"
    var rope = scene.add.rope(x, y, texture, frame, points, horizontal);\n// var rope = scene.add.rope(x, y, texture, frame, points, horizontal, colors, alphas);\n
    • points :
      • A number : Segments to split the texture frame into.
      • An number array : An array containing the vertices data.
    • horizontal :
      • true : Vertices of this Rope be aligned horizontally.
      • false : Vertices of this Rope be aligned vertically.
    • colors : An optional array containing the color data for this Rope. One color value per pair of vertices.
    • alphas : An optional array containing the alpha data for this Rope. One alpha value per pair of vertices.

    Add rope from JSON

    var rope = scene.make.rope({\nx: 0,\ny: 0,\nkey: '',\nframe: null,\nhorizontal: true,\npoints: undefined,\ncolors: undefined,\nalphas: undefined,\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"rope/#custom-rope-class","title":"Custom rope class","text":"
    • Define class
      class MyRope extends Phaser.GameObjects.Rope {\nconstructor(scene, x, y, texture, frame, points, horizontal, colors, alphas) {\nsuper(scene, x, y, texture, frame, points, horizontal, colors, alphas);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rope = new MyRope(scene, x, y, texture, frame, points, horizontal);\n
    "},{"location":"rope/#origin","title":"Origin","text":"

    A Ropes origin is always 0.5 x 0.5 and cannot be changed.

    "},{"location":"rope/#set-vertices","title":"Set vertices","text":"

    Set vertices via

    rope.setPoints(points);\n// rope.setPoints(points, colors, alphas);\n
    • points :
      • A number : Segments to split the texture frame into.
      • An number array : An array containing the vertices data.
    • colors : An optional array containing the color data for this Rope. One color value per pair of vertices.
    • alphas : An optional array containing the alpha data for this Rope. One alpha value per pair of vertices.

    Also change horizontal mode :

    • Change vertical rope to horizontal rope, do nothing if rope is horizontal mode already
      rope.setHorizontal(points);\n// rope.setHorizontal(points, colors, alphas);\n
    • Change horizontal rope to vertical rope, do nothing if rope is vertical mode already
      rope.setVertical(points);\n// rope.setVertical(points, colors, alphas);\n

    Or set rope.points directly :

    1. Change rope.points
      • Horizontal rope : rope.points[i].y = newY
      • Vertical rope : rope.points[i].x = newX
    2. Call rope.setDirty(), or rope.updateVertices()

    Each point is relative to position of rope object, get points of world via

    var worldX = rope.points[i].x + rope.x;\nvar worldY = rope.points[i].y + rope.y;\n
    "},{"location":"rope/#play-animation","title":"Play animation","text":"
    rope.play(key);\n// rope.play(key, ignoreIfPlaying, startFrame);\n
    • ignoreIfPlaying : If an animation is already playing then ignore this call. Default value is false.
    • startFrame : Optionally start the animation playing from this frame index. Default value is 0.
    "},{"location":"rope/#alpha","title":"Alpha","text":"
    • Single alpha
      rope.setAlphas(alpha);\n
    • Top - bottom alpha
      rope.setAlphas(topAlpha, bottomAlpha);\n
    • Alpha array for each point
      rope.setAlphas(alphaArray);\n
      • alphaArray : Array of alpha value.
    "},{"location":"rope/#color-tint","title":"Color tint","text":"
    • Single color tint
      rope.setColors(color);\n
    • Color tint array for each point
      rope.setAlphas(colorArray);\n
      • colorArray : Array of color tint value.
    "},{"location":"rope/#tint-fill-mode","title":"Tint fill mode","text":"

    Sets the tint fill mode.

    rope.setTintFill(mode);\n
    • mode :
      • 0 : Additive tint, blends the vertices colors with the texture. Default behavior.
      • 1 : Fill tint with alpha.
      • 2 : Fill tint without alpha.
    "},{"location":"rope/#flip","title":"Flip","text":"
    rope.flipX = flip;\nrope.flipY = flip;\n

    If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.

    "},{"location":"rope/#debug","title":"Debug","text":"

    Draw debug mesh each render tick.

    rope.setDebug(graphic);\n// rope.setDebug(graphic, callback);\n
    • graphic : Graphics game object
    • callback : Callback of rendering debug graphics (default callback)
      function(rope, meshLength, verts) {\n// var graphic = rope.debugGraphic;\n}\n
      • rope : Rope instance.
        • rope.debugGraphic : Graphics game object
      • meshLength : The number of mesh vertices in total.
      • verts : An array of the translated vertex coordinates.

    Note

    Clear Debug graphics (rope.debugGraphic.clear()) during scene's update stage (scene.update() { })

    "},{"location":"rotate/","title":"Rotate","text":""},{"location":"rotate/#introduction","title":"Introduction","text":"

    Rotate game object continually with a steady speed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"rotate/#live-demos","title":"Live demos","text":"
    • Change speed
    "},{"location":"rotate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"rotate/#install-plugin","title":"Install plugin","text":""},{"location":"rotate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrotateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrotateplugin.min.js', true);\n
    • Add rotate behavior
      var rotate = scene.plugins.get('rexrotateplugin').add(gameObject, config);\n
    "},{"location":"rotate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RotatePlugin from 'phaser3-rex-plugins/plugins/rotate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRotate',\nplugin: RotatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add rotate behavior
      var rotate = scene.plugins.get('rexRotate').add(gameObject, config);\n
    "},{"location":"rotate/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Rotate from 'phaser3-rex-plugins/plugins/rotate.js';\n
    • Add rotate behavior
      var rotate = new Rotate(gameObject, config);\n
    "},{"location":"rotate/#create-instance","title":"Create instance","text":"
    var rotate = scene.plugins.get('rexRotate').add(gameObject, {\n// speed: 180,\n// enable: true,\n// timeScale: 1,\n});\n
    • speed : Turn speed, degrees in second
    "},{"location":"rotate/#enable","title":"Enable","text":"
    • Enable (default)
      rotate.setEnable();\n
      or
      rotate.enable = true;\n
    • Disable
      rotate.setEnable(false);\n
      or
      rotate.enable = false;\n
    "},{"location":"rotate/#set-speed","title":"Set speed","text":"
    rotate.setSpeed(speed);\n// rotate.speed = speed;\n
    • speed : Turn speed, degrees in second
    "},{"location":"rotate/#status","title":"Status","text":"
    • Is rotating
      var enable = rotate.enable;\n// var isRunning = rotate.isRunning;\n
    "},{"location":"rotateto/","title":"Rotate to","text":""},{"location":"rotateto/#introduction","title":"Introduction","text":"

    Rotate game object towards target position with a steady speed.

    • Author: Rex
    • Behavior of game object
    "},{"location":"rotateto/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"rotateto/#install-plugin","title":"Install plugin","text":""},{"location":"rotateto/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexrotatetoplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexrotatetoplugin.min.js', true);\n
    • Add rotate-to behavior
      var rotateTo = scene.plugins.get('rexrotatetoplugin').add(gameObject, config);\n
    "},{"location":"rotateto/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RotateToPlugin from 'phaser3-rex-plugins/plugins/rotateto-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRotateTo',\nplugin: RotateToPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add rotate-to behavior
      var rotateTo = scene.plugins.get('rexRotateTo').add(gameObject, config);\n
    "},{"location":"rotateto/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RotateTo from 'phaser3-rex-plugins/plugins/rotateto.js';\n
    • Add rotate-to behavior
      var rotateTo = new RotateTo(gameObject, config);\n
    "},{"location":"rotateto/#create-instance","title":"Create instance","text":"
    var rotateTo = scene.plugins.get('rexRotateTo').add(gameObject, {\n// speed: 180,\n// enable: true,\n// timeScale: 1,\n});\n
    • speed : Turn speed, degrees in second
    "},{"location":"rotateto/#start-moving","title":"Start moving","text":""},{"location":"rotateto/#rotate-game-object-towards-position","title":"Rotate game object towards position","text":"
    • Shortest angle
      rotateTo.rotateTowardsPosition(x, y);\n
      • x , y : Target position
    • Clockwise/counter-clockwise
      rotateTo.rotateTowardsPosition(x, y, dir);\n// rotateTo.rotateTowardsPosition(x, y, dir, speed);\n
      • dir :
        • 0 : Shortest angle
        • 1, or 'cw' : Clockwise
        • 2, or 'ccw' : Counter-clockwise
      • speed : Turn speed, degrees in second
    "},{"location":"rotateto/#rotate-game-object-to-angle","title":"Rotate game object to angle","text":"
    • Shortest angle
      rotateTo.rotateTo(angle);\n
      • angle : Target angle in degrees
    • Clockwise/counter-clockwise
      rotateTo.rotateTo(angle, dir);\n// rotateTo.rotateTo(angle, dir, speed);\n
      • dir :
        • 0 : Shortest angle
        • 1, or cw : Clockwise
        • 2, or ccw : Counter-clockwise
      • speed : Turn speed, degrees in second
    "},{"location":"rotateto/#enable","title":"Enable","text":"
    • Enable (default)
      rotateTo.setEnable();\n
      or
      rotateTo.enable = true;\n
    • Disable
      rotateTo.setEnable(false);\n
      or
      rotateTo.enable = false;\n
    "},{"location":"rotateto/#pause-resume-stop-rotating","title":"Pause, Resume, stop rotating","text":"
    rotateTo.pause();\nrotateTo.resume();\nrotateTo.stop();\n
    "},{"location":"rotateto/#set-speed","title":"Set speed","text":"
    rotateTo.setSpeed(speed);\n// rotateTo.speed = speed;\n
    • speed : Turn speed, degrees in second
    "},{"location":"rotateto/#events","title":"Events","text":"
    • On rotating start
      rotateTo.on('start', function(gameObject, rotateTo){});\n
    • On reached target
      rotateTo.on('complete', function(gameObject, rotateTo){});\n
    "},{"location":"rotateto/#status","title":"Status","text":"
    • Is moving
      var isRunning = rotateTo.isRunning;\n
    "},{"location":"round-to/","title":"Round to","text":""},{"location":"round-to/#introduction","title":"Introduction","text":"

    Round/ceil/floor to the given precision, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"round-to/#usage","title":"Usage","text":""},{"location":"round-to/#round-to","title":"Round to","text":"

    var result = Phaser.Math.RoundTo(value);\n
    or
    var result = Phaser.Math.RoundTo(value, place, base);\n

    • value : The value to round.
    • place : The place to round to. Positive to round the units, negative to round the decimal. Default is 0.
    • base : The base to round in. Default is 10 for decimal.

    Examples

    RoundTo(123.456789, 0) = 123\nRoundTo(123.456789, -1) = 123.5\nRoundTo(123.456789, -2) = 123.46\nRoundTo(123.456789, -3) = 123.457\n
    "},{"location":"round-to/#ceil-to","title":"Ceil to","text":"

    var result = Phaser.Math.CeilTo(value);\n
    or
    var result = Phaser.Math.CeilTo(value, place, base);\n

    • value : The value to round.
    • place : The place to round to. Positive to round the units, negative to round the decimal. Default is 0.
    • base : The base to round in. Default is 10 for decimal.
    "},{"location":"round-to/#floor-to","title":"Floor to","text":"

    var result = Phaser.Math.floorTo(value);\n
    or
    var result = Phaser.Math.floorTo(value, place, base);\n

    • value : The value to round.
    • place : The place to round to. Positive to round the units, negative to round the decimal. Default is 0.
    • base : The base to round in. Default is 10 for decimal.
    "},{"location":"runcommands/","title":"Run commands","text":""},{"location":"runcommands/#introduction","title":"Introduction","text":"

    Run commands in array.

    • Author: Rex
    • Method only
    "},{"location":"runcommands/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"runcommands/#install-plugin","title":"Install plugin","text":""},{"location":"runcommands/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexruncommandsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexruncommandsplugin.min.js', true);\n
    • Run commands
      scene.plugins.get('rexruncommandsplugin').run(commands, scope);\n
    "},{"location":"runcommands/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RunCommandsPlugin from 'phaser3-rex-plugins/plugins/runcommands-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRunCommands',\nplugin: RunCommandsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Run commands
      scene.plugins.get('rexRunCommands').run(commands, scope);\n
    "},{"location":"runcommands/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RunCommands from 'phaser3-rex-plugins/plugins/runcommands.js';\n
    • Run commands
      RunCommands(commands, scope);\n
    "},{"location":"runcommands/#run-commands","title":"Run commands","text":"
    scene.plugins.get('rexRunCommands').run(commands, scope);\n
    • Format of command :
      [fnName, param0, param1, ...]\n
      or
      [callback, param0, param1, ...]\n
    • Commands in nested array :
      [\ncommand0,\ncommand1\n[\ncommand2,\ncommand3\n]\n]\n
    • Run command :
      scope[fnName].call(scope, param0, param1 ...)\n
      or
      callback.call(scope, param0, param1 ...)\n
    "},{"location":"scaledowndestroy/","title":"Scale down destroy","text":""},{"location":"scaledowndestroy/#introduction","title":"Introduction","text":"

    Scale down (i.e. ease scaleX, scaleY to 0) game object then destroy it.

    • Author: Rex
    • Method only
    "},{"location":"scaledowndestroy/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"scaledowndestroy/#install-plugin","title":"Install plugin","text":""},{"location":"scaledowndestroy/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexscaleplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscaleplugin.min.js', true);\n
    • Scale down, then destroy object
      scene.plugins.get('rexscaleplugin').scaleDownDestroy(gameObject, duration);\n
    "},{"location":"scaledowndestroy/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ScalePlugin from 'phaser3-rex-plugins/plugins/scale-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexScale',\nplugin: ScalePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Scale down, then destroy object
      scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration);\n
    "},{"location":"scaledowndestroy/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ScaleDownDestroy from 'phaser3-rex-plugins/plugins/scale-down-destroy.js';\n
    • Scale down, then destroy object
      ScaleDownDestroy(gameObject, duration);\n
    "},{"location":"scaledowndestroy/#scale-down","title":"Scale down","text":"
    • Scale down width and height
      var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration);\n// var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, undefined, ease);\n
      • ease : Ease function, default is 'Linear'.
    • Scale down width only
      var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, 'x');\n// var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, 'x', ease);\n
    • Scale down height only
      var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, 'y');\n// var scale = scene.plugins.get('rexScale').scaleDownDestroy(gameObject, duration, 'y', ease);\n
    "},{"location":"scaledowndestroy/#events","title":"Events","text":"

    See Events of tween task

    • Scale completes or is stopped.
      scale.on('complete', function(gameObject, scale){\n\n}, scope);\n
    "},{"location":"scaledowndestroy/#inject-methods","title":"Inject methods","text":"
    • Inject methods into game object
      scene.plugins.get('rexScale').injectMethods(gameObject);\n
    • Inject methods into class of game object
      scene.plugins.get('rexScale').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexScale').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into class of game object
      scene.plugins.get('rexScale').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexScale').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into root class of game object
      scene.plugins.get('rexScale').injectMethodsToRootClass(e);\n// scene.plugins.get('rexScale').injectMethods(Phaser.GameObjects.GameObject.prototype);\n
    "},{"location":"scaledowndestroy/#injected-methods","title":"Injected methods","text":"
    • Scale up from 0 to current scale of game object.
      • Pop-up width and height
        gameObject\n//.setScale(scaleX, scaleY)\n.popUp(duration);\n\n// gameObject.popUp(duration, undefined, ease);\n
        or
        gameObject\n//.setScale(scaleX, scaleY)\n.popUpPromise(duration)\n.then(function() {\n// ....\n})\n
        • ease : Ease function, default is 'Cubic'.
      • Pop-up width only
        gameObject\n//.setScaleX(scaleX)\n.popUp(duration, 'x');\n\n// gameObject.popUp(duration, 'x', ease);\n
        or
        gameObject\n//.setScaleX(scaleX)\n.popUpPromise(duration, 'x')\n.then(function() {\n// ....\n})\n
      • Pop-up height only
        gameObject\n//.setScaleY(scaleY)\n.popUp(duration, 'y');\n\n// gameObject.popUp(duration, 'y', ease);\n
        or
        gameObject\n//.setScaleY(scaleY)\n.popUpPromise(duration, 'y')\n.then(function() {\n// ....\n})\n
      • Pop-up via config
        gameObject\n//.setScale(scaleX, scaleY)\n.popUp({\nduration: undefined,\norientation: undefined,\nease: undefined,\n})\n
        or
        gameObject\n//.setScale(scaleX, scaleY)\n.popUpPromise(config)\n.then(function() {\n// ....\n})\n
        • orientation : undefined, x, or y
    • Scale-down destroy
      • Scale-down width and height
        gameObject.scaleDownDestroy(duration);\n// gameObject.scaleDownDestroy(duration, undefined, ease);\n
        or
        gameObject.scaleDownDestroyPromise(duration)\n.then(function() {\n// ....\n})\n
        • ease : Ease function, default is 'Linear'.
      • Scale-down width only
        gameObject.scaleDownDestroy(duration, 'x');\n// gameObject.scaleDownDestroy(duration, 'x', ease);\n
        or
        gameObject.scaleDownDestroyPromise(duration, 'x');\n.then(function() {\n// ....\n})\n
      • Scale-down height only
        gameObject.scaleDownDestroy(duration, 'y');\n// gameObject.scaleDownDestroy(duration, 'y', ease);\n
        or
        gameObject.scaleDownDestroyPromise(duration, 'y')\n.then(function() {\n// ....\n})\n
    • Scale-down without destroy
      • Scale-down width and height
        gameObject.scaleDown(duration);\n// gameObject.scaleDown(duration, undefined, ease);\n
        or
        gameObject.scaleDownPromise(duration, undefined, ease)\n.then(function() {\n// ....\n})\n
      • Scale-down width only
        gameObject.scaleDowny(duration, 'x');\n// gameObject.scaleDowny(duration, 'x', ease);\n
        or
        gameObject.scaleDownPromise(duration, 'x', ease)\n.then(function() {\n// ....\n})\n
      • Scale-down height only
        gameObject.scaleDown(duration, 'y');\n// gameObject.scaleDown(duration, 'y', ease);\n
        or
        gameObject.scaleDownPromise(duration, 'y', ease)\n.then(function() {\n// ....\n})\n
    • Scale up/down, then scale back (yoyo)
      • Scale up/down, then scale back width and height
        gameObject\n//.setScale(scaleX, scaleY)\n.scaleYoyo(duration, peakValue);\n\n// gameObject.scaleYoyo(duration, peakValue, repeat, undefined, ease);\n
        or
        gameObject\n//.setScale(scaleX, scaleY)\n.scaleYoyoPromise(duration, peakValue, repeat)\n.then(function() {\n// ....\n})\n
        • peakValue : Scale to this peak value, then scale back
        • repeat : Yoyo repeat, default value is 0.
        • ease : Ease function, default is 'Cubic'.
      • Scale up/down, then scale back width only
        gameObject\n//.setScaleX(scaleX)\n.scaleYoyo(duration, peakValue, 0, 'x');\n\n// gameObject.popUp(duration, peakValue, repeat, 'x', ease);\n
        or
        gameObject\n//.setScaleX(scaleX)\n.scaleYoyoPromise(duration, peakValue, repeat, 'x')\n.then(function() {\n// ....\n})\n
      • Scale up/down, then scale back height only
        gameObject\n//.setScaleY(scaleY)\n.scaleYoyo(duration, peakValue, 0, 'y');\n\n// gameObject.popUp(duration, peakValue, repeat, 'y', ease);\n
        or
        gameObject\n//.setScaleY(scaleY)\n.scaleYoyoPromise(duration, peakValue, repeat, 'y')\n.then(function() {\n// ....\n})\n
      • Scale up/down via config
        gameObject\n//.setScale(scaleX, scaleY)\n.scaleYoyo({\nduration: undefined,\npeakValue: 1.2,\nrepeat: 0,\norientation: undefined,\nease: undefined,\n})\n
        or
        gameObject\n//.setScale(scaleX, scaleY)\n.scaleYoyoPromise(config)\n.then(function() {\n// ....\n})\n
        • orientation : undefined, x, or y
    • Events
      • Pop-up complete
        gameObject.on('popup.complete', function(gameObject) { });\n
      • Scale-down, scale-down destroy complete
        gameObject.on('scaledown.complete', function(gameObject) { });\n
      • Scale up/down, then scale back (yoyo)
        gameObject.on('scaleyoyo.complete', function(gameObject) { });\n
    "},{"location":"scalemanager/","title":"Scale manager","text":""},{"location":"scalemanager/#introduction","title":"Introduction","text":"

    Scale game window, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"scalemanager/#usage","title":"Usage","text":""},{"location":"scalemanager/#setup","title":"Setup","text":"

    Setup scale mode in game configuration.

    var config = {\n// ...\nparent: divId,\n\n// Game size\nwidth: 1024,\nheight: 768,\n\nscale: {\n// Or set parent divId here\nparent: divId,\n\nmode: Phaser.Scale.FIT,\nautoCenter: Phaser.Scale.CENTER_BOTH,\n\n// Or put game size here\n// width: 1024,\n// height: 768,\n\n// Minimum size\nmin: {\nwidth: 800,\nheight: 600\n},\n// Or set minimum size like these\n// minWidth: 800,\n// minHeight: 600,\n\n// Maximum size\nmax: {\nwidth: 1600,\nheight: 1200\n},\n// Or set maximum size like these\n// maxWidth: 1600,\n// maxHeight: 1200,\n\nzoom: 1,  // Size of game canvas = game size * zoom\n},\nautoRound: false\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • scale.mode :
      • Phaser.Scale.NONE : No scaling happens at all.
      • Phaser.Scale.FIT : The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered.
      • Phaser.Scale.ENVELOP : The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size.
      • Phaser.Scale.WIDTH_CONTROLS_HEIGHT : The height is automatically adjusted based on the width.
      • Phaser.Scale.HEIGHT_CONTROLS_WIDTH : The width is automatically adjusted based on the height.
      • Phaser.Scale.EXPAND : The Canvas's visible area is resized to fit all available parent space like RESIZE mode, and scale canvas size to fit inside the visible area like FIT mode.
      • Phaser.Scale.RESIZE : The Canvas is resized to fit all available parent space, regardless of aspect ratio.
    • scale.autoCenter :
      • Phaser.Scale.NO_CENTER : The game canvas is not centered within the parent by Phaser.
      • Phaser.Scale.CENTER_BOTH : The game canvas is centered both horizontally and vertically within the parent.
      • Phaser.Scale.CENTER_HORIZONTALLY : The game canvas is centered horizontally within the parent.
      • Phaser.Scale.CENTER_VERTICALLY : The game canvas is centered both vertically within the parent.
    "},{"location":"scalemanager/#resize-canvas-element","title":"Resize canvas element","text":"
    scene.scale.resize(width, height);\n

    Modify the size of the Phaser canvas element directly. You should only use this if you are using the NO_SCALE scale mode,

    "},{"location":"scalemanager/#set-game-size","title":"Set game size","text":"
    scene.scale.setGameSize(width, height);\n

    It should only be used if you're looking to change the base size of your game and are using one of the Scale Manager scaling modes, i.e. FIT. If you're using NO_SCALE and wish to change the game and canvas size directly, then please use the resize method instead.

    "},{"location":"scalemanager/#get-view-port","title":"Get view port","text":"
    var viewport = scene.scale.getViewPort();\n// var viewport = scene.scale.getViewPort(camera, out);\n
    • viewport : The Rectangle of visible area.
    • camera : The camera this viewport is respond upon.
    • out : The Rectangle of visible area.
    "},{"location":"scalemanager/#members","title":"Members","text":"
    • The un-modified game size, as requested in the game config (the raw width / height), as used for world bounds, cameras, etc
      var gameSize = scene.scale.gameSize;\n
      • gameSize.width, gameSize.height
    • The modified game size, which is the auto-rounded gameSize, used to set the canvas width and height (but not the CSS style)
      var baseSize = scene.scale.baseSize;\n
      • baseSize.width, baseSize.height
    • The size used for the canvas style, factoring in the scale mode, parent and other values.
      var displaySize = scene.scale.displaySize;\n
      • displaySize.width, displaySize.height
    • The size of parent dom element
      var parentSize = scene.scale.parentSize;\n
      • parentSize.width, parentSize.height
    "},{"location":"scalemanager/#events","title":"Events","text":"
    scene.scale.on('resize', function(gameSize, baseSize, displaySize, previousWidth, previousHeight) {});\n
    • gameSize : The un-modified game size, as requested in the game config (the raw width / height)
      • gameSize.width, gameSize.height
    • baseSize : The canvas width and height (actually size of canvas)
      • baseSize.width, baseSize.height
    • displaySize : Size used for the canvas style (display size of canvas)
      • displaySize.width, displaySize.height
    "},{"location":"scalemanager/#update-bounds","title":"Update bounds","text":"

    This method dose not have to be invoked, unless the canvas position, or visibility is changed via any other method (i.e. via an Angular route).

    scene.scale.updateBounds();\n
    "},{"location":"scalemanager/#full-screen","title":"Full screen","text":"

    Under 'pointerup' touch event :

    • Start full screen
      scene.scale.startFullscreen();\n
    • Stop full screen
      scene.scale.stopFullscreen();\n
    • Toggle full screen
      scene.scale.toggleFullscreen();\n
    • Is full screen
      var isFullscreen = scene.scale.isFullscreen;\n

    Games within an iframe will also be blocked from fullscreen unless the iframe has the allowfullscreen attribute.

    Performing an action that navigates to another page, or opens another tab, will automatically cancel fullscreen mode, as will the user pressing the ESC key.

    "},{"location":"scalemanager/#events_1","title":"Events","text":"
    • Enter full screen
      scene.scale.on('enterfullscreen', function() {}, scope);\n
    • Enter full screen failed
      scene.scale.on('fullscreenfailed', function(error) {}, scope);\n
    • Leave full screen
      scene.scale.on('leavefullscreen', function() {}, scope);\n
    • Full screen unsupport
      scene.scale.on('fullscreenunsupported', function() {}, scope);\n
    • Leave full screen
      scene.scale.on('leavefullscreen', function() {}, scope);\n
    "},{"location":"scalemanager/#orientation","title":"Orientation","text":""},{"location":"scalemanager/#properties","title":"Properties","text":"
    • Is portrait orientation
      var isPortrait = scene.scale.isPortrait;\n
    • Is landscape orientation
      var isLandscape = scene.scale.isLandscape;\n
    "},{"location":"scalemanager/#lock-orientation","title":"Lock orientation","text":"
    scene.scale.lockOrientation(orientation);\n
    • orientation : 'landscape', or 'portrait';
    "},{"location":"scalemanager/#events_2","title":"Events","text":"
    scene.scale.on('orientationchange', function(orientation) {\nif (orientation === Phaser.Scale.PORTRAIT) {\n\n} else if (orientation === Phaser.Scale.LANDSCAPE) {\n\n}\n}, scope);\n
    "},{"location":"scaleouter/","title":"Scale outer","text":""},{"location":"scaleouter/#introduction","title":"Introduction","text":"

    Scroll and zoom camera to make default game window fit the display area, in RESIZE scale mode.

    • Author: Rex
    • Member of scene
    "},{"location":"scaleouter/#live-demos","title":"Live demos","text":"
    • Viewport
    • Static camera
    • Tween camera
    "},{"location":"scaleouter/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"scaleouter/#install-plugin","title":"Install plugin","text":""},{"location":"scaleouter/#set-scale-mode-to-resize","title":"Set scale mode to RESIZE","text":"
    var config = {\n// ...\nscale: {\nparent: divId,\nmode: Phaser.Scale.RESIZE,\nwidth: 1024,    // Default game window width\nheight: 768,    // Default game window height\n// ...\n}\n}\nvar game = new Phaser.Game(config);\n
    "},{"location":"scaleouter/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexscaleouterplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscaleouterplugin.min.js', 'rexScaleOuter', 'rexScaleOuter');\n
    • Scale outer is created as a member of scene (scene.rexScaleOuter) for each scene. It will control main camera (scene.cameras.main) by default.
    "},{"location":"scaleouter/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install scene plugin in configuration of game
      import ScaleOuterPlugin from 'phaser3-rex-plugins/plugins/scaleouter-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexScaleOuter',\nplugin: ScaleOuterPlugin,\nmapping: 'rexScaleOuter'\n}]\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Scale outer is created as a member of scene (scene.rexScaleOuter) for each scene. It will control main camera (scene.cameras.main) by default.
    "},{"location":"scaleouter/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ScaleOuter from 'phaser3-rex-plugins/plugins/scaleouter.js';\n
    • Add scaleouter object
      var scaleouter = new ScaleOuter(scene);\n
    "},{"location":"scaleouter/#create-instance","title":"Create instance","text":"

    ScaleOuter plugin is a scene plugin, which created as a member of scene (scene.rexScaleOuter) for each scene. It does not have to create other scale outer instance.

    "},{"location":"scaleouter/#remove-instance","title":"Remove instance","text":"

    Invoke scene.rexScaleOuter.destroy() under scene.create() { ... }.

    "},{"location":"scaleouter/#add-camera","title":"Add camera","text":"
    • Add camera manually, under scene.create() { ... }
      scene.rexScaleOuter.add(camera);\n
    • Scale outer will control main camera (scene.cameras.main) if no camera added.
    "},{"location":"scaleouter/#viewport","title":"Viewport","text":"
    • Inner viewport, a recangle object, for area of default size in game config after camera zoom/scroll.
      var innerViewport = scene.rexScaleOuter.innerViewport;\n
    • Outer viewport, a recangle object, for the visible area after camera zoom/scroll.
      var outerViewport = scene.rexScaleOuter.outerViewport;\n
    "},{"location":"scaleouter/#manual-scale","title":"Manual scale","text":"
    1. Stop resize callback
      scene.rexScaleOuter.stop()\n
    2. Manual scale
      scene.rexScaleOuter.scale();\n
    "},{"location":"scene/","title":"Scene","text":""},{"location":"scene/#define-a-scene","title":"Define a scene","text":""},{"location":"scene/#configuration-of-scene","title":"Configuration of scene","text":"
    var config = {\nkey: \"\",\n// active: false,\n// visible: true,\n// pack: false,\n// cameras: null,\n// map: {},\n// physics: {},\n// loader: {},\n// plugins: false,\n// input: {}\n};\n
    • key : The unique key of this Scene. Must be unique within the entire Game instance.
    • active : Does the Scene start as active or not? An active Scene updates each step.
    • visible : Does the Scene start as visible or not? A visible Scene renders each step.
    • pack : An optional Loader Packfile to be loaded before the Scene begins.
    • cameras : An optional Camera configuration object.
      {\nname: '',\nx: 0,\ny: 0,\nwidth: scene.sys.scale.width,\nheight: scene.sys.scale.height,\nzoom: 1,\nrotation: 0,\nscrollX: 0,\nscrollY: 0,\nroundPixels: false,\nvisible: true,\nbackgroundColor: false,\nbounds: null, // {x, y, width, height}\n}\n
    • map : Overwrites the default injection map for a scene.
    • physics : The physics configuration object for the Scene.
      {\ndefault: 'arcade', // 'arcade', or 'matter'\narcade: {...},\nmatter: {...}\n}\n
    • arcade : Arcade Physics configuration.
    • matter : Matter Physics configuration.
    • loader : The loader configuration object for the Scene.
      {\nbaseURL: '',\npath: '',\nenableParallel: true,\nmaxParallelDownloads: 4,\ncrossOrigin: undefined,\nresponseType: '',\nasync: true,\nuser: '',\npassword: '',\ntimeout: 0\n}\n
    • plugins : The plugin configuration object for the Scene.
      {\nglobal: [\n//{key, plugin, start}\n],\nscene: [\n// ...\n]\n}\n
    • input : The input configuration object for the Scene.
      {\nkeyboard: {\ntarget: window\n},\nmouse: {\ntarget: null,\ncapture: true\n},\nactivePointers: 1,\ntouch: {\ntarget: null,\ncapture: true\n},\nsmoothFactor: 0,\ngamepad: false,\nwindowEvents: true,\n}\n
    "},{"location":"scene/#es6-class","title":"ES6 class","text":"
    class MyScene extends Phaser.Scene {\nconstructor(config) {\nsuper(config);\n}\n\ninit(data) {}\npreload() {}\ncreate(data) {}\nupdate(time, delta) {}\n}\n
    • data : Parameters passed from adding new scene, or starting scene
    "},{"location":"scene/#class","title":"Class","text":"
    var MyScene = new Phaser.Class({\nExtends: Phaser.Scene,\n\ninitialize: function MyScene(config) {\nPhaser.Scene.call(this, config);\n},\n\ninit: function (data) {},\npreload: function () {},\ncreate: function (data) {},\nupdate: function (time, delta) {},\n});\n
    • data : Parameters passed from adding new scene, or starting scene
    var MyGame = {};\n\nMyGame.Boot = function () {};\n\nMyGame.Boot.prototype.constructor = MyGame.Boot;\n\nMyGame.Boot.prototype = {\ninit: function (data) {},\npreload: function () {},\ncreate: function (data) {},\nupdate: function (time, delta) {},\n};\n
    • data : Parameters passed from adding new scene, or starting scene
    "},{"location":"scene/#override","title":"Override","text":"
    var demo = new Phaser.Scene(\"Demo\");\n\ndemo.init = function (data) {};\ndemo.preload = function () {};\ndemo.create = function (data) {};\ndemo.update = function (time, delta) {};\n
    • data : Parameters passed from adding new scene, or starting scene
    "},{"location":"scene/#flow-chart","title":"Flow chart","text":"
    graph TB\n\nsubgraph Stop\nSceneEventDestroy>\"scene.events: destroy\"]\nShutdown[\"Shutdown<br>Free game objects\"]\nend\n\nsubgraph Update\nSceneUpdate[\"Run: Every tick<br>scene.update()\"]\nSceneEventPauseSleep>\"scene.events: pause<br>scene.events: sleep\"]\nPause[\"Pause: render but no update<br>Sleep: no update, no render\"]\nSceneEventResumeWake>\"scene.events: resume<br>scene.events: wake\"]\nend\n\nsubgraph Create\nSceneEventStart>\"scene.events: start\"]\nSceneEventReady>\"scene.events: ready\"]\nSceneInit[\"scene.init()\"]\nScenePreLoad[\"Load assets<br>scene.preload()\"]\nSceneCreate[\"Create game objects<br>scene.create()\"]\nend\n\nStart((Start)) --> SceneEventStart\nSceneEventStart --> SceneEventReady\nSceneEventReady --> SceneInit\nSceneInit --> ScenePreLoad\nScenePreLoad --> SceneCreate\nSceneCreate --> SceneUpdate\nSceneUpdate --> SceneUpdate\nSceneUpdate --> |\"scene.scene.pause()<br>scene.scene.sleep()\"|SceneEventPauseSleep\nSceneEventPauseSleep --> Pause\nPause --> |\"scene.scene.resume()<br>scene.scene.wake()\"|SceneEventResumeWake\nSceneEventResumeWake --> SceneUpdate\n\nSceneUpdate --> |\"scene.scene.stop()<br>scene.scene.restart()\"|Stop\nPause --> |\"scene.scene.stop()<br>scene.scene.restart()\"|SceneEventDestroy\nSceneEventDestroy --> Shutdown\n\nShutdown --> |\"scene.scene.start()<br>scene.scene.launch()<br>scene.scene.restart()\"|SceneEventStart
    • Run : Update and render
    • Pause : Render but no update
    • Sleep : No update, no render
    • Stop : Shutdown

    See also

    • Pause/resume
    • Stop
    • Main loop
    "},{"location":"scene/#start","title":"Start","text":"
    1. Invoke scene.preload()
    2. Invoke scene.create()

    scene.scene.restart() is equal to

    scene.scene.stop();\nscene.scene.start();\n
    "},{"location":"scene/#stop","title":"Stop","text":"
    • All game objects will be destroyed.
    • Registered events on game objects will also be clear, too.
    • Touch, keyboard and GamePad events will be clear.
    • Cameras will be destroyed.
    • Loader will be stopped.
    • Assets will be stored in global cache.
    • Events registered on scene plugin (scene.events.on) won't be clear.
    "},{"location":"scene/#members","title":"Members","text":"
    • plugins
    • load : Loader
    • events : Local events
    • input : Touch, keyboard
    • tweens : Tween tasks
    • time : Timer
    • cameras : Camera
    • scene : scenePlugin
    • anims
    • physics : ArcadePhysics
    • matter :\u3000 MatterPhysics
    • registry : Global data manager across all scenes
      scene.registry.set(key, value);\nvar value = scene.registry.get(key);\n
    • data : Local data manager
      scene.data.set(key, value);\nvar value = scene.data.get(key);\n
    • sys
    • game
    • render
    • cache
    • sound
    • textures
    • add
    • make
    • children : DisplayList
      scene.children.bringToTop(child);\nscene.children.sendToBack(child);\nscene.children.moveUp(child);\nscene.children.moveDown(child);\nscene.children.moveUp(child);\nscene.children.moveTo(child, index);\nscene.children.moveAbove(child1, child2); // Move child1 above child2\nscene.children.moveBelow(child1, child2); // Move child1 below child2\nscene.children.swap(child1, child2);\n
    • lights

    Preserve word in a scene.

    "},{"location":"scene/#events","title":"Events","text":"
    • Start (Before scene.init())
      scene.events.on(\"start\", function () {});\n
    • Ready (After start)
      scene.events.on(\"ready\", function () {});\n
    • Every tick
      • Preupdate
        scene.events.on(\"preupdate\", function (time, delta) {});\n
      • Update
        scene.events.on(\"update\", function (time, delta) {});\n
      • Postupdate
        scene.events.on(\"postupdate\", function (time, delta) {});\n
      • Render
        scene.events.on(\"render\", function () {});\n
    • State changed
      • Pause (from scene.scene.pause())
        scene.events.on(\"pause\", function () {});\n
      • Resume (from scene.scene.resume())
        scene.events.on(\"resume\", function () {});\n
      • Sleep (from scene.scene.sleep())
        scene.events.on(\"sleep\", function () {});\n
      • Wake (from scene.scene.wake())
        scene.events.on(\"wake\", function () {});\n
      • Stop/shutdown (from scene.scene.stop())
        scene.events.on(\"shutdown\", function () {});\n
        • Free-up any resources that may be in use by this scene
    • Destroy (from scene.scene.remove())
      scene.events.on(\"destroy\", function () {});\n
    • Boot
      scene.events.on(\"boot\", function () {});\n
    • Game object added to scene
      • Add
        scene.events.on(\"addedtoscene\", function (gameObject, scene) {});\n
      • Remove
        scene.events.on(\"removedfromscene\", function (gameObject, scene) {});\n
    "},{"location":"scenemanager/","title":"Scene manager","text":"

    Scene manager plugin:

    • In each scene instance: scene.scene
    "},{"location":"scenemanager/#add-new-scene","title":"Add new scene","text":"
    var newScene = scene.scene.add(key, sceneConfig, autoStart, data);\n// var newScene = game.scene.add(key, sceneConfig, autoStart, data);\n
    • key : A unique key used to reference the Scene.
    • sceneConfig :
      • A scene class
      • A plain object
        {\ninit(data) {},\npreload() {},\ncreate(data) {},\nupdate(time, delta) {},\n\nextend: {\ndata: {},\n// ...\n},\n}\n
    • autoStart : Set true to start scene immediately after added.
    • data : Optional data object. This will be set as scene.settings.data and passed to scene.init.
    "},{"location":"scenemanager/#load-scene-from-external-files","title":"Load scene from external files","text":"
    1. load script
      scene.load.script(key, url);\n
    2. add new scene
      scene.scene.add(key, sceneConfig, autoStart);\n// game.scene.add(key, sceneConfig, autoStart);\n
    "},{"location":"scenemanager/#destroy-scene","title":"Destroy scene","text":"
    scene.scene.remove(key);\n
    • Fires scene.events destroy
    "},{"location":"scenemanager/#start-scene","title":"Start scene","text":"
    • Launch the given Scene and run it in parallel with this one
      scene.scene.launch(key, data);\n
    • Shutdown this Scene and run the given one
      scene.scene.start(key, data);\n
    • Restarts this Scene
      scene.scene.restart(data);\n
    "},{"location":"scenemanager/#pauseresume-scene","title":"Pause/Resume scene","text":"
    • Pause : stops the update step but still renders
      scene.scene.pause(key);\n// scene.scene.pause();  // pause myself\n
      • Fires scene.events pause
    • Resume : starts the update loop again
      scene.scene.resume(key);\n// scene.scene.resume();  // resume myself\n
      • Fires scene.events resume
    • Sleep : no update, no render but doesn't shutdown
      scene.scene.sleep(key);\n// scene.scene.sleep();  // sleep myself\n
      • Fires scene.events sleep
    • Wake-up: starts update and render
      scene.scene.wake(key);\n// scene.scene.wake();  // wake-up myself\n
      • Fires scene.events wake
    • Makes this Scene sleep then starts the Scene given
      scene.scene.switch(key, data);\n
    "},{"location":"scenemanager/#run-scene","title":"Run scene","text":"

    Runs the given Scene, but does not change the state of this Scene.

    If the given Scene is paused, it will resume it. If sleeping, it will wake it. If not running at all, it will be started.

    scene.scene.run(key, data);\n
    "},{"location":"scenemanager/#stop-scene","title":"Stop scene","text":"

    Shutdown the Scene, clearing display list, timers, etc.

    scene.scene.stop(key);\n// scene.scene.stop();  // stop myself\n
    "},{"location":"scenemanager/#set-visible","title":"Set visible","text":"
    scene.scene.setVisible(value, key);  // value: true/false\n// scene.scene.setVisible(value);    // set visible to myself\n
    "},{"location":"scenemanager/#read-status","title":"Read status","text":"
    var isSleep = scene.scene.isSleeping(key);\n// var isSleep = scene.scene.isSleeping();\n
    var isPaused = scene.scene.isPaused(key);\n// var isPaused = scene.scene.isPaused();\n
    var isActive = scene.scene.isActive(key);\n// var isActive = scene.scene.isActive();\n
    var isVisible = scene.scene.isVisible(key);\n// var isVisible = scene.scene.isVisible();\n
    Update/isActive Render/isVisible Run Pause Sleep

    Pause/Sleep/Stop

    • Pause: Pause update stage.
    • Sleep: Pause update stage, and set scene invisible.
    • Stop: Shoutdown, clearing display list, timers, etc.
    var status = scene.scene.getStatus(key);\n// var status = scene.scene.getStatus();\n
    • status :
      • Phaser.Scenes.PENDING, or 0
      • Phaser.Scenes.INIT, or 1
      • Phaser.Scenes.START, or 2
      • Phaser.Scenes.LOADING, or 3
      • Phaser.Scenes.CREATING, or 4
      • Phaser.Scenes.RUNNING, or 5
      • Phaser.Scenes.PAUSED, or 6
      • Phaser.Scenes.SLEEPING, or 7
      • Phaser.Scenes.SHUTDOWN, or 8
      • Phaser.Scenes.DESTROYED, or 9
    "},{"location":"scenemanager/#get-scene","title":"Get scene","text":"
    var scene = scene.scene.get(key);\n
    "},{"location":"scenemanager/#order-of-scenes","title":"Order of scenes","text":"

    Swaps the position of two scenes in the Scenes list.

    scene.scene.swapPosition(keyA, keyB);\n// scene.scene.stop(keyA);\n
    scene.scene.moveAbove(keyA, keyB);\n// scene.scene.moveAbove(keyA);\n

    Scene B is directly above Scene A.

    scene.scene.moveBelow(keyA, keyB);\n// scene.scene.moveBelow(keyA);\n

    Scene B is directly below Scene A.

    scene.scene.moveUp(keyA);\n// scene.scene.moveBelow();\n
    scene.scene.moveDown(keyA);\n// scene.scene.moveDown();\n
    scene.scene.bringToTop(keyA);\n// scene.scene.bringToTop();\n
    scene.scene.sendToBack(keyA);\n// scene.scene.sendToBack();\n
    "},{"location":"scenemanager/#transition","title":"Transition","text":"
    scene.scene.transition({\ntarget: key,\n// data: null,\n// moveAbove: false,\n// moveBelow: false,\n\nduration: 1000,\n\n// remove: false,\n// sleep: false,\n// allowInput: false,\n\n// onStart: null,\n// onStartScope: scene,\n\n// onUpdate: null,\n// onUpdateScope: scene,\n})\n
    • target : The Scene key to transition to.
    • data : An object containing any data you wish to be passed to the target scenes init / create methods.
    • moveAbove. moveBelow : Move the target Scene to be above/below this current scene before the transition starts.
    • duration : Transition duration, in ms.
    • remove : Set true to remove this scene.
    • sleep : Set true to sleep this scene, set false to stop this scene.
    • allowInput : Set true to enable input system of current scene and target scene.
    • onStart, onStartScope : Invoked when transition start
      function(fromScene, toScene, duration) {\n\n}\n
      • fromScene : Current scene instance
      • toScene : Target scene instance
      • duration : Transition duration, in ms.
    • onUpdate ,onUpdateScope : Transition callback in each tick.
      function(progress) {\n\n}\n
      • progress : 0 ~ 1
    "},{"location":"scenemanager/#execution-flow","title":"Execution flow","text":"
    1. Invoke scene.scene.transition method.
      • Current scene :
        • Fire 'transitionout' event.
          fromScene.events.on('transitionout', function(targetScene, duration){ });\n
        • Run transition's onUpdate callback every tick.
        • Current scene's update method is still running every tick.
      • Target scene :
        • Start target scene immediately.
        • Fire target scene's 'transitionstart' event. (Register this event in create stage)
          targetScene.events.on('transitionstart', function(fromScene, duration){ });\n
    2. When transition completed.
      • Current scene :
        • Remove or sleep current scene after transition completed.
      • Target scene :
        • Fire target scene's transitioncomplete event.
          targetScene.events.on('transitioncomplete', function(fromScene){ });\n
    "},{"location":"scenemanager/#events","title":"Events","text":"
    • boot
      scene.events.on('transitioninit', function(fromScene, duration)){ });\n
    • start
      scene.events.on('transitionstart', function(fromScene, duration){ });\n
    • transition-out
      scene.events.on('transitionout', function(targetScene){ });\n
    • complete
      scene.events.on('transitioncomplete', function(fromScene){ });\n
    • wake : wake-up target scene if it was previously asleep
      scene.events.on('transitionwake', function(fromScene, duration){ });\n
    "},{"location":"scenemanager/#system-scene","title":"System scene","text":"

    A default empty Scene that lives outside of the Scene list, but can be used by plugins and managers that need access to a live Scene, without being tied to one.

    var scene = scene.scene.get('__SYSTEM');\n

    or

    var scene = scene.scene.systemScene;\n
    "},{"location":"scripttagloader/","title":"Script tag loader","text":""},{"location":"scripttagloader/#introduction","title":"Introduction","text":"

    Load script tag in preload stage.

    • Author: Rex
    • Custom File of loader
    "},{"location":"scripttagloader/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"scripttagloader/#install-plugin","title":"Install plugin","text":""},{"location":"scripttagloader/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      var sceneConfig = {\n// ....\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'rexscripttagloaderplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscripttagloaderplugin.min.js',\nstart: true\n}]\n}\n};\nclass MyScene extends Phaser.Scene {\nconstructor() {\nsuper(sceneConfig)\n}\n// ....\n\npreload() {\n// rexscripttagloaderplugin will be installed before preload(), but not added to loader yet\n// Call addToScene(scene) to add this await loader to loader of this scene\nthis.plugins.get('rexscripttagloaderplugin').addToScene(this);\n\nthis.load.rexScriptTag(url);\n}\n}\n
    "},{"location":"scripttagloader/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ScriptTagLoaderPlugin from 'phaser3-rex-plugins/plugins/scripttagloader-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexScriptTagLoader',\nplugin: ScriptTagLoaderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In preload stage
      scene.load.rexScriptTag(url);\n
    "},{"location":"scripttagloader/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ScriptTagLoader from 'phaser3-rex-plugins/plugins/scripttagloader.js';\n
    • Start loading task
      ScriptTagLoader.call(scene.load, url);\n// ScriptTagLoader.call(scene.load, url, availableTest);\n
    "},{"location":"scripttagloader/#load-script-tag","title":"Load script tag","text":"

    In preload stage:

    this.load.rexScriptTag(url);\n// this.load.rexScriptTag(url, availableTest);\n

    or

    this.load.rexScriptTag({\nurl: url,\navailableTest: undefined\n});\n
    • availableTest : Callback invoked after loading script tag, optional.
      function() {        return true;\n}\n
      • Wait until availableTest return true.
    "},{"location":"scripttagloader/#compare-with-script-loader","title":"Compare with script loader","text":"
    • Built-in script loader uses AJAX to load text as script, which might have CORS issue.
    • Script tag loader uses <script> tag to load script.
    "},{"location":"scroller/","title":"Scroller","text":""},{"location":"scroller/#introduction","title":"Introduction","text":"

    Drag content. Slow down when dragging released, pull back when out of bounds.

    • Author: Rex
    • Behavior of game object
    "},{"location":"scroller/#live-demos","title":"Live demos","text":"
    • Scroller
    "},{"location":"scroller/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"scroller/#install-plugin","title":"Install plugin","text":""},{"location":"scroller/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexscrollerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexscrollerplugin.min.js', true);\n
    • Add scroller behavior
      var scroller = scene.plugins.get('rexscrollerplugin').add(gameObject, config);\n
    "},{"location":"scroller/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ScrollerPlugin from 'phaser3-rex-plugins/plugins/scroller-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexScroller',\nplugin: ScrollerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add scroller behavior
      var scroller = scene.plugins.get('rexScroller').add(gameObject, config);\n
    "},{"location":"scroller/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Scroller from 'phaser3-rex-plugins/plugins/scroller.js';\n
    • Add scroller behavior
      var scroller = new Scroller(gameObject, config);\n
    "},{"location":"scroller/#create-instance","title":"Create instance","text":"
    var scroller = scene.plugins.get('rexScroller').add(gameObject, {\nbounds: [\nbottomBound,\ntopBound\n],\nvalue: topBound,    // threshold: 10,\n// slidingDeceleration: 5000,\n// backDeceleration: 2000,\n\n// dragReverse: false,\n// dragRate: 1,\n\n// enable: true,\n// orientation: 'vertical',\n// pointerOutRelease: true,\n// rectBoundsInteractive: false,\n\n// valuechangeCallback: null,\n// valuechangeCallbackScope: null,\n\n// overmaxCallback: null,\n// overmaxCallbackScope: null,\n\n// overminCallback: null,\n// overminCallbackScope: null,\n});\n
    • bounds : An array of 2 values [bound0, bound1]
    • value : Initial value between bound0 and bound1
      • Map this value to position of content under event 'valuechange'
    • threshold : Minimal movement to scroll. Set 0 to scroll immediately.
    • slidingDeceleration : Deceleration of slow down when dragging released.
      • Set false to disable it.
    • backDeceleration : Deceleration of pull back when out of bounds.
      • Set false to disable it.
    • dragReverse :
      • false : Dragging up will decrease value, dragging down will increase value. Default behavior.
        • Use this mode when scrolling by position of game object.
      • true : Dragging up will increase value, dragging down will decrease value.
        • Use this mode when scrolling by camera.
    • dragRate : Rate of dragging distance/dragging speed. Default value is 1.
    • enable : Set true to get dragging events.
    • orientation :
      • 'vertical','v', 'y', or 0 : dragging on vertical/y axis.
      • 'horizontal','h', 'x', or 1 : dragging on horizontal/x axis.
    • pointerOutRelease : Set to true to release input control when pointer out of gameObject. Default value is true.
    • rectBoundsInteractive :
      • false : Detect scrolling by game object's touch input. Default behavior.
      • true : Detect scrolling by rectangle bounds of game object.
    • valuechangeCallback , valuechangeCallbackScope : Bind this callback to valuechange event
    • overminCallback , overmaxCallbackScope : Bind this callback to overmax event
    • overminCallback , overminCallbackScope : Bind this callback to overmin event
    "},{"location":"scroller/#set-bounds","title":"Set bounds","text":"
    this.setBounds(bounds);  // bounds: [bound0, bound1]\n// this.setBounds(bound0, bound1);\n
    "},{"location":"scroller/#set-deceleration","title":"Set deceleration","text":"
    • Deceleration of slow down when dragging released
      scroller.setSlidingDeceleration(dec);\n
      • Disable
        scroller.setSlidingDeceleration(false);\n
    • Deceleration of pull back when out of bounds
      scroller.setBackDeceleration(dec);\n
      • Disable
        scroller.setBackDeceleration(false);\n
    "},{"location":"scroller/#get-value","title":"Get value","text":"
    var value = scroller.value;\n
    "},{"location":"scroller/#set-value","title":"Set value","text":"
    • Set value
      scroller.value = newValue;\n// scroller.setValue(newValue);\n
    • Set value, clamp between minValue and maxValue
      scroller.setValue(newValue, true);\n
    • Add value
      scroller.value += inc;\n// scroller.addValue(inc);\n
    • Add value, clamp between minValue and maxValue
      scroller.addValue(inc, true);\n

    Fires valuechange event if new value is not equal to current value.

    "},{"location":"scroller/#events","title":"Events","text":"
    • Value changed
      scroller.on('valuechange', function(newValue, prevValue){ /* ... */ });\n
      • Set position of content under this event
    • Value out of max/min bound
      scroller.on('overmax', function(newValue, prevValue){ /* ... */ });\n
      scroller.on('overmin', function(newValue, prevValue){ /* ... */ });\n
    • On drag start
      scroller.on('dragstart', function() { /* ... */ });\n
    • On drag end
      scroller.on('dragend', function() { /* ... */ });\n
    "},{"location":"scroller/#drag","title":"Drag","text":""},{"location":"scroller/#drag-enable","title":"Drag enable","text":"
    • Get
      var enable = scroller.enable;\n
    • Set
      scroller.setEnable();\n// scroller.setEnable(enable);  // enable: true, or false\n
      or
      scroller.enable = enable; // enable: true, or false\n
    • Toggle
      scroller.toggleEnable();\n
    "},{"location":"scroller/#is-dragging","title":"Is dragging","text":"
    var isDragging = scroller.isDragging;\n
    "},{"location":"scroller/#state-machine","title":"State machine","text":"
    graph TB\n\nIDLE[\"Idle\"] --> |Drag| DRAG[\"Dragging<br>event 'valuechange'\"]\nDRAG --> |Release| OnRelease{\"Under bounds?\"}\n\nOnRelease --> |Yes| SLIDE[\"Sliding<br>Sliding-deceleration\"]\nSLIDE --> |Stop| IDLE\nSLIDE --> |Drag| DRAG\n\nOnRelease --> |No| BACK[\"Pull back to bounds<br>Back-deceleration\"]\nBACK --> |Stop| IDLE\nBACK --> |Drag| DRAG
    • Get state
      var state = scroller.state;\n
      • 'IDLE' : No dragging, no sliding
      • 'DRAG' : Dragging
      • 'SLIDE' : Sliding when dragging released
      • 'BACK' : Sliding back to bound when out of bound
    "},{"location":"sequence/","title":"Sequence","text":""},{"location":"sequence/#introduction","title":"Introduction","text":"

    Run sequence commands in array.

    • Author: Rex
    • Object
    "},{"location":"sequence/#live-demos","title":"Live demos","text":"
    • Sequence
    "},{"location":"sequence/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"sequence/#install-plugin","title":"Install plugin","text":""},{"location":"sequence/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexsequenceplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexsequenceplugin.min.js', true);\n
    • Create sequence instance
      var seq = this.plugins.get('rexsequenceplugin').add(config);\n
    "},{"location":"sequence/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SequencePlugin from 'phaser3-rex-plugins/plugins/sequence-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSequence',\nplugin: SequencePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create sequence instance
      var seq = this.plugins.get('rexSequence').add(config);\n
    "},{"location":"sequence/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Sequence from 'phaser3-rex-plugins/plugins/sequence.js';\n
    • Create sequence instance
      var seq = new Sequence(config);\n
    "},{"location":"sequence/#create-sequence-instance","title":"Create sequence instance","text":"
    var seq = this.plugins.get('rexSequence').add({\n// yoyo: false,\n// repeat: 0, \n// loop: false\n});\n
    • yoyo : Reverse sequence when it reaches the end
    • repeat : Repeat count
    • loop : Repeat forever
    "},{"location":"sequence/#load-commands","title":"Load commands","text":"
    seq.load(commands, actionScope);\n
    • Format of command :
      [fnName, param0, param1, ...]\n
    • Commands in nested array :
      [\ncommand0,\ncommand1\n[\ncommand2,\ncommand3\n]\n]\n
    • ActionScope

    Format of command is the same as run-command.

    "},{"location":"sequence/#run-commands","title":"Run commands","text":"
    seq.start();\n
    • Run command :
      var eventEmitter = actionScope[fnName].call(actionScope, param0, param1 ...);\n
      • Return an event emitter to pause the sequence, otherwise run next command
      • Sequence will continue when that event emitter fires complete event
    "},{"location":"sequence/#stop","title":"Stop","text":"
    seq.stop();\n
    "},{"location":"sequence/#events","title":"Events","text":"
    • On sequence completed :
      seq.on('complete', function(actionScope, seq){ });\n
    "},{"location":"sequence/#action-of-commands","title":"Action of commands","text":"

    Action of commands, extended from Phaser.Events.EventEmitter.

    class ActionKlass extends Phaser.Events.EventEmitter {\nconstructor(scene) {\nsuper();\n\nthis.scene = scene;\nthis.myConsole = scene.add.text(100, 100, '');\n\nthis['wait-click'] = this.waitClick;\nthis['wait-time'] = this.waitTime;\n}\n\n// callbacks\nprint(msg) {\nthis.myConsole.setText(msg);\n// return undefined to run next command\n}\n\nwaitClick() {\nthis.scene.input.once('pointerup', this.complete, this);\nreturn this;  // return eventEmitter to pause the sequence\n}\n\nwaitTime(delay) {\nthis.scene.time.delayedCall(delay * 1000, this.complete, [], this);\nreturn this;  // return eventEmitter to pause the sequence\n}\n\ncomplete() {\nthis.emit('complete');  // resume sequence\n}\n}\nvar actionScope = new ActionKlass(scene);\n

    Now this scope supports 3 commands

    • print(msg): ['print', msg]
    • waitClick(): ['wait-click']
    • waitTime(delay): ['wait-time', delay]
    "},{"location":"sequence/#state","title":"State","text":"
    var state = seq.state;\n
    • 0 : Idle
    • 1 : Run
    • 2 : Last command
    • 3 : Completed
    var completed = seq.completed; // seq.state === 3\n
    "},{"location":"sequence/#other-properties","title":"Other properties","text":"
    • Yoyo
      • Get
        var yoyo = seq.yoyo;\n
      • Set
        seq.setYoyo();\nseq.setYoyo(fals);\n// seq.yoyo = yoyo;\n
    • Repeat
      • Get
        var repeat = seq.repeat;\n
      • Set
        seq.setRepeat(count);\n
    • Loop
      • Get
        var loop = seq.loop;\n
      • Set
        seq.setLoop();\nseq.setLoop(fals);\n// seq.loop = loop;\n
    "},{"location":"shader-barrel/","title":"Barrel","text":"

    Note

    Phaser3.60 has a built-in barrel effect.

    "},{"location":"shader-barrel/#introduction","title":"Introduction","text":"

    Barrel post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-barrel/#live-demos","title":"Live demos","text":"
    • Barrel
    "},{"location":"shader-barrel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-barrel/#install-plugin","title":"Install plugin","text":""},{"location":"shader-barrel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexbarrelpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexbarrelpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexbarrelpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexbarrelpipelineplugin').add(camera, config);\n
    "},{"location":"shader-barrel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import BarrelPipelinePlugin from 'phaser3-rex-plugins/plugins/barrelpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexBarrelPipeline',\nplugin: BarrelPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexBarrelPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexBarrelPipeline').add(camera, config);\n
    "},{"location":"shader-barrel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import BarrelPostFx from 'phaser3-rex-plugins/plugins/barrelpipeline.js';\nvar config = {\n// ...\npipeline: [BarrelPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(BarrelPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(BarrelPostFx);\n
    "},{"location":"shader-barrel/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 barrel effect.
      var pipelineInstance = scene.plugins.get('rexBarrelPipeline').add(gameObject, {\n// shrink: false,\n// center: {\n//    x: windowWidth / 2,\n//    y: windowHeight / 2\n//}\n// radius: 0,\n// power: 0.5,\n// intensity: 1,\n\n// name: 'rexBarrelPostFx'\n});\n
      • shrink :
        • false : Fish-eye effect
        • true : Anti fish-eye effect.
      • center.x, center.y : Local position of barrel center.
      • radius : Barrel radius.
      • power : 0~1.
      • intensity : 0(original) ~ 1(barrel). Default value is 1.
    • Apply effect to camera. A camera only can add 1 barrel effect.
      var pipelineInstance = scene.plugins.get('rexBarrelPipeline').add(camera, config);\n
    "},{"location":"shader-barrel/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexBarrelPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexBarrelPipeline').remove(camera);\n
    "},{"location":"shader-barrel/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexBarrelPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexBarrelPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexBarrelPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexBarrelPipeline').get(camera);\n
    "},{"location":"shader-barrel/#shrink-mode","title":"Shrink mode","text":"
    • Get
      var shrinkMode = pipelineInstance.shrinkMode;\n
    • Set
      pipelineInstance.setShrinkMode(true);\n// pipelineInstance.setShrinkMode(false);\n
    "},{"location":"shader-barrel/#radius","title":"Radius","text":"
    • Get
      var radius = pipelineInstance.radius;\n
    • Set
      pipelineInstance.radius = radius;\n// pipelineInstance.radius += value;\n
      or
      pipelineInstance.setRadius(radius);\n
    "},{"location":"shader-barrel/#power","title":"Power","text":"
    • Get
      var power = pipelineInstance.power;\n
    • Set
      pipelineInstance.power = power;\n
      or
      pipelineInstance.setPower(power);\n
    "},{"location":"shader-barrel/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(radius);\n
      • intensity : 0(original) ~ 1(barrel)
    "},{"location":"shader-barrel/#center-position","title":"Center position","text":"

    Default value is center of window.

    • Get
      var x = pipelineInstance.centerX;\nvar y = pipelineInstance.centerY;\n
    • Set
      pipelineInstance.centerX = x;\npipelineInstance.centerY = y;\n
      or
      pipelineInstance.setCenter(x, y);\n// pipelineInstance.setCenter();   // set to center of window\n
    "},{"location":"shader-builtin/","title":"Effects","text":""},{"location":"shader-builtin/#introduction","title":"Introduction","text":"

    Built-in pre-fx, and post-fx shader effects.

    • Barrel Distortion : A nice pinch / bulge distortion effect.
    • Bloom : Add bloom to any Game Object, with custom offset, blur strength, steps and color.
    • Blur : 3 different levels of gaussian blur (low, medium and high) and custom distance and color.
    • Bokeh / Tilt Shift : A bokeh and tiltshift effect, with intensity, contrast and distance settings.
    • Circle Outline : Add a circular ring around any Game Object, useful for masking / avatar frames, with custom color, width and background color.
    • Color Matrix : Add a ColorMatrix to any Game Object with access to all of its methods, such as sepia, greyscale, lsd and lots more.
    • Glow : Add a smooth inner or outer glow, with custom distance, strength and color.
    • Displacement : Use a displacement texture, such as a noise texture, to drastically (or subtly!) alter the appearance of a Game Object.
    • Gradient : Draw a gradient between two colors across any Game Object, with optional 'chunky' mode for classic retro style games.
    • Pixelate : Make any Game Object appear pixelated, to a varying degree.
    • Shine : Run a 'shine' effect across a Game Object, either additively or as part of a reveal.
    • Shadow : Add a drop shadow behind a Game Object, with custom depth and color.
    • Vignette : Apply a vignette around a Game Object, with custom offset position, radius and color.
    • Wipe / Reveal : Set a Game Object to 'wipe' or 'reveal' with custom line width, direction and axis of the effect.

    Texture-based Game Objects also support Pre FX, including: Image, Sprite, TileSprite, Text, RenderTexture, Video.

    All Game Objects and camera support Post FX. These are effects applied after the Game Object has been rendered.

    • Author: Richard Davey
    • Pre-fx, and Post-fx shader effects

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-builtin/#live-demos","title":"Live demos","text":"
    • Official demos
    "},{"location":"shader-builtin/#usage","title":"Usage","text":""},{"location":"shader-builtin/#barrel","title":"Barrel","text":"
    • Add pre-fx to game object
      // gameObject.preFX.setPadding(padding);\nvar effect = gameObject.preFX.addBarrel(amount);\n
      • padding : The amount of padding to add to this Game Object, in pixels.
        • Used when amount is larger than 1.
      • amount : The amount of distortion applied to the barrel effect.
        • 1 : No distortion
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addBarrel(amount);\n
      var effect = camera.postFX.addBarrel(amount);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.amount = amount;\n
    "},{"location":"shader-builtin/#bloom","title":"Bloom","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addBloom(color, offsetX, offsetY, blurStrength, strength, steps);\n
      • color : The color of the Bloom, as a hex value.
      • offsetX, offsetY : The horizontal/vertical offset of the bloom effect. Default value is 1.
      • blurStrength , strength : The strength of the blur/blend process of the bloom effect. Default value is 1.
      • steps : The number of steps to run the Bloom effect for. This value should always be an integer. Default value is 4.
        • The higher the value, the smoother the Bloom, but at the cost of exponentially more gl operations.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addBloom(color, offsetX, offsetY, blurStrength, strength, steps);\n
      var effect = camera.postFX.addBloom(color, offsetX, offsetY, blurStrength, strength, steps);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.color = color;  // hex value\neffect.offsetX = offsetX;\neffect.offsetY = offsetY;\neffect.blurStrength = blurStrength;\neffect.strength = strength;\neffect.steps = steps; // integer\n
    "},{"location":"shader-builtin/#blur","title":"Blur","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addBlur(quality, x, y, strength, color, steps);\n
      • quality : The quality of the blur effect. Default value is 0.
        • 0 : Low Quality
        • 1 : Medium Quality
        • 2 : High Quality
      • x, y : The horizontal/vertical offset of the blur effect. Default value is 2
      • strength : The strength of the blur effect. Default value is 1.
      • color : The color of the blur, as a hex value. Default value is 0xffffff.
      • steps : The number of steps to run the blur effect for. This value should always be an integer.
        • The higher the value, the smoother the blur, but at the cost of exponentially more gl operations.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addBlur(quality, x, y, strength, color, steps);\n
      var effect = camera.postFX.addBlur(quality, x, y, strength, color, steps);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.quality = quality;\neffect.x = x;\neffect.y = y;\neffect.strength = strength;\neffect.color = color;\neffect.steps = steps;\n
    "},{"location":"shader-builtin/#bokeh","title":"Bokeh","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addBokeh(radius, amount, contrast);\n
      • radius : The radius of the bokeh effect. Default value is 0.5.
      • amount : The amount of the bokeh effect. Default value is 1.
      • contrast : The color contrast of the bokeh effect. Default value is 0.2.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addBlur(quality, x, y, strength, color, steps);\n
      var effect = camera.postFX.addBokeh(radius, amount, contrast);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.radius = radius;\neffect.amount = amount;\neffect.contrast = contrast;\n
    "},{"location":"shader-builtin/#tilt-shift","title":"Tilt Shift","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addTiltShift(radius, amount, contrast, blurX, blurY, strength);\n
      • radius : The radius of the bokeh effect. Default value is 0.5.
      • amount : The amount of the bokeh effect. Default value is 1.
      • contrast : The color contrast of the bokeh effect. Default value is 0.2.
      • blurX, blurY : The amount of horizontal/vertical blur.
      • strength : The strength of the blur.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addTiltShift(radius, amount, contrast, blurX, blurY, strength);\n
      var effect = camera.postFX.addTiltShift(radius, amount, contrast, blurX, blurY, strength);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.radius = radius;\neffect.amount = amount;\neffect.contrast = contrast;\neffect.blurX = blurX;\neffect.blurY = blurY;\neffect.strength = strength;\n
    "},{"location":"shader-builtin/#circle-outline","title":"Circle Outline","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addCircle(thickness, color, backgroundColor, scale, feather);\n
      • thickness : The width of the circle around the texture, in pixels. Default value is 8.
      • color : The color of the circular ring, given as a number value. Default value is 0xfeedb6.
      • backgroundColor : The color of the background, behind the texture, given as a number value. Default value is 0xff0000.
      • scale : The scale of the circle. Default value is 1.
        • 1 : Full size of the underlying texture.
      • feather : The amount of feathering to apply to the circle from the ring. Default value is 0.005.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addCircle(thickness, color, backgroundColor, scale, feather);\n
      var effect = camera.postFX.addCircle(thickness, color, backgroundColor, scale, feather);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.thickness = thickness;\neffect.color = color;\neffect.backgroundColor = backgroundColor;\neffect.backgroundAlpha = backgroundAlpha;\neffect.scale = scale;\neffect.feather = feather;\n
    "},{"location":"shader-builtin/#colormatrix","title":"ColorMatrix","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addColorMatrix();\n
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addColorMatrix();\n
      var effect = camera.postFX.addColorMatrix();\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Methods
      • Brightness : Changes the brightness of this ColorMatrix by the given amount.
        effect.brightness(value, multiply);\n
        • value : The amount of brightness to apply to this ColorMatrix. 0(black)~1. Default value is 0.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Saturate : Changes the saturation of this ColorMatrix by the given amount.
        effect.saturate(value, multiply);\n
        • value : The amount of saturation to apply to this ColorMatrix. Default value is 0.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Desaturate : Desaturates this ColorMatrix (removes color from it).
        effect.desaturate(value, multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Hue : Rotates the hues of this ColorMatrix by the value given.
        effect.hue(rotation, multiply);\n
        • rotation : The amount of hue rotation to apply to this ColorMatrix, in degrees. Default value is 0.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Grayscale : Sets this ColorMatrix to be grayscale.
        effect.grayscale(value, multiply);\n
        • value : The grayscale scale 0(black)~1. Default value is 1.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • BlackWhite : Sets this ColorMatrix to be black and white.
        effect.blackWhite(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Contrast : Change the contrast of this ColorMatrix by the amount given.
        effect.contrast(value, multiply);\n
        • value : The amount of contrast to apply to this ColorMatrix. Default value is 0.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Negative : Converts this ColorMatrix to have negative values.
        effect.negative(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • DesaturateLuminance : Apply a desaturated luminance to this ColorMatrix.
        effect.desaturateLuminance(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Sepia : Applies a sepia tone to this ColorMatrix.
        effect.sepia(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Night : Applies a night vision tone to this ColorMatrix.
        effect.night(intensity, multiply);\n
        • intensity : The intensity of this effect. Default value is 0.1.
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • LSD : Applies a trippy color tone to this ColorMatrix.
        effect.lsd(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Brown : Applies a brown tone to this ColorMatrix.
        effect.brown(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • VintagePinhole : Applies a vintage pinhole color effect to this ColorMatrix.
        effect.vintagePinhole(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Kodachrome : Applies a kodachrome color effect to this ColorMatrix.
        effect.kodachrome(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Technicolor : Applies a technicolor color effect to this ColorMatrix.
        effect.technicolor(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • Polaroid : Applies a polaroid color effect to this ColorMatrix.
        effect.polaroid(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
      • ShiftToBGR : Shifts the values of this ColorMatrix into BGR order.
        effect.shiftToBGR(multiply);\n
        • multiply : Multiply the resulting ColorMatrix (true), or set it (false) ?
          • true : Multiply the resulting.
          • false : Set the resulting. Default behavior.
    "},{"location":"shader-builtin/#displacement","title":"Displacement","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addDisplacement(texture, x, y);\n
      • texture : The unique string-based key of the texture to use for displacement, which must exist in the Texture Manager. Default value is '__WHITE'.
        • You can only use a whole texture, not a frame from a texture atlas or sprite sheet.
      • x, y : The amount of horizontal/vertical displacement to apply. Default value is 0.005.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addDisplacement(texture, x, y);\n
      var effect = camera.postFX.addDisplacement(texture, x, y);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.x = x;\neffect.y = y;    
    • Methods
      • Set texture
        effect.setTexture(key);\n
    "},{"location":"shader-builtin/#glow","title":"Glow","text":"
    • Add pre-fx to game object
      // gameObject.preFX.setPadding(padding);\nvar effect = gameObject.preFX.addGlow(color, outerStrength, innerStrength, knockout);\n
      • padding : The amount of padding to add to this Game Object, in pixels.
        • Used when amount is larger than 1.
      • color : The color of the glow effect as a number value. Default value is 0xffffff.
      • outerStrength, innerStrength : The strength of the glow outward/inward from the edge of the Sprite. Default value is 4/0.
      • knockout :
        • true : Only the glow is drawn
        • false : Draw glow and texture. Default behavior.
      • quality : Only available for PostFX. Sets the quality of this Glow effect. Default is 0.1. Cannot be changed post-creation.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addGlow(color, outerStrength, innerStrength, knockout, quality, distance);\n
      var effect = camera.postFX.addGlow(color, outerStrength, innerStrength, knockout, quality, distance);\n
      • quality : Sets the quality of this Glow effect. Default is 0.1. Cannot be changed post-creation.
      • distance : Sets the distance of this Glow effect. Default is 10. Cannot be changed post-creation.
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.color = color;\neffect.outerStrength = outerStrength;\neffect.innerStrength = innerStrength;\neffect.knockout = knockout;\n
    "},{"location":"shader-builtin/#gradient","title":"Gradient","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addGradient(color1, color2, alpha, fromX, fromY, toX, toY, size);\n
      • color1, color2 : The first/second gradient color, given as a number value. Default values are 0xff0000/0x00ff00.
      • alpha : The alpha value of the gradient effect.
      • fromX, fromY : The horizontal/vertical position the gradient will start from. Value between 0 and 1.
      • toX, toY : The horizontal/vertical position the gradient will end at. Value between 0 and 1.
      • size : How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture.
        • 0 : Smooth gradient. Default behavior.
        • Others : Retro chunky effect.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addGradient(color1, color2, alpha, fromX, fromY, toX, toY, size);\n
      var effect = camera.postFX.addGradient(color1, color2, alpha, fromX, fromY, toX, toY, size);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.color1 = color1;\neffect.color2 = color2;\neffect.alpha = alpha;\neffect.fromX = fromX;\neffect.fromY = fromY;\neffect.toX = toX;\neffect.toY = toY;\neffect.size = size;\n
    "},{"location":"shader-builtin/#pixelate","title":"Pixelate","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addPixelate(amount);\n
      • amount : The amount of pixelation to apply, in pixels.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addPixelate(amount);\n
      var effect = camera.postFX.addPixelate(amount);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.amount = amount;\n
    "},{"location":"shader-builtin/#shadow","title":"Shadow","text":"
    • Add pre-fx to game object
      // gameObject.preFX.setPadding(padding);\nvar effect = gameObject.preFX.addShadow(x, y, decay, power, color, samples, intensity);\n
      • padding : The amount of padding to add to this Game Object, in pixels.
        • Used when amount is larger than 1.
      • x, y : The horizontal/vertical offset of the shadow effect. Default value is 0.
      • decay : The amount of decay for shadow effect. Default value is 0.1.
      • power : The power of the shadow effect. Default value is 1.
      • color : The color of the shadow. Default value is 0x000000.
      • samples : The number of samples that the shadow effect will run for. An integer between 1 and 12.
      • intensity : The intensity of the shadow effect. Default value is 1.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addShadow(x, y, decay, power, color, samples, intensity);\n
      var effect = camera.postFX.addShadow(x, y, decay, power, color, samples, intensity);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.x = x;\neffect.y = y;\neffect.decay = decay;\neffect.power = power;\neffect.color = color;\neffect.samples = samples;\neffect.intensity = intensity;\n
    "},{"location":"shader-builtin/#shine","title":"Shine","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addShine(speed, lineWidth, gradient, reveal);\n
      • speed : The speed of the Shine effect. Default value is 0.5.
      • lineWidth : The line width of the Shine effect. Default value is 0.5.
      • gradient : The gradient of the Shine effect. Default value is 3.
      • reveal : Does this Shine effect reveal or get added to its target?
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addShine(speed, lineWidth, gradient, reveal);\n
      var effect = camera.postFX.addShine(speed, lineWidth, gradient, reveal);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.speed = speed;\neffect.lineWidth = lineWidth;\neffect.gradient = gradient;\neffect.reveal = reveal;\n
    "},{"location":"shader-builtin/#vignette","title":"Vignette","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addVignette(x, y, radius, strength);\n
      • x, y : The horizontal/vertical offset of the vignette effect. Value is between 0 and 1. Default value is 0.5.
      • radius : The radius of the vignette effect. Value is between 0 and 1. Default value is 0.5.
      • strength : The strength of the vignette effect. Default value is 0.5.
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addVignette(x, y, radius, strength);\n
      var effect = camera.postFX.addVignette(x, y, radius, strength);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.x = x;\neffect.y = y;\neffect.radius = radius;\neffect.strength = strength;\n
    "},{"location":"shader-builtin/#wipe","title":"Wipe","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addWipe(wipeWidth, direction, axis);\n
      • wipeWidth : The width of the wipe effect. Value is between 0 and 1. Default value is 0.1.
      • direction : The direction of the wipe effect.
        • 0 : Left to right, or top to bottom
        • 1 : Right to left, or bottom to top
      • axis : The axis of the wipe effect.
        • 0 : Left to right, or right to left
        • 1 : Bottom to top, or top to bottom
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addWipe(wipeWidth, direction, axis);\n
      var effect = camera.postFX.addWipe(wipeWidth, direction, axis);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.progress = t; // 0~1\neffect.wipeWidth = wipeWidth;\neffect.direction = direction;  // 0, 1\neffect.axis = axis;  // 0, 1    \n
    "},{"location":"shader-builtin/#reveal","title":"Reveal","text":"
    • Add pre-fx to game object
      var effect = gameObject.preFX.addReveal(wipeWidth, direction, axis);\n
      • wipeWidth : The width of the wipe effect. Value is between 0 and 1. Default value is 0.1.
      • direction : The direction of the wipe effect.
        • 0 : Left to right, or top to bottom
        • 1 : Right to left, or bottom to top
      • axis : The axis of the wipe effect.
        • 0 : Left to right, or right to left
        • 1 : Bottom to top, or top to bottom
    • Add post-fx to game object, or camera
      var effect = gameObject.postFX.addReveal(wipeWidth, direction, axis);\n
      var effect = camera.postFX.addReveal(wipeWidth, direction, axis);\n
    • Disable effect
      effect.setActive(false);\n// effect.active = false;\n
    • Remove effect
      gameObject.preFX.remove(effect);\n
      camera.postFX.remove(effect);\n
    • Properties
      effect.progress = t; // 0~1\neffect.wipeWidth = wipeWidth;\neffect.direction = direction;  // 0, 1\neffect.axis = axis;  // 0, 1\n
    "},{"location":"shader-builtin/#remove-all-effects","title":"Remove all effects","text":"

    gameObject.preFX.clear();\n
    gameObject.postFX.clear();\n
    camera.postFX.clear();\n

    "},{"location":"shader-builtin/#disable-all-effects","title":"Disable all effects","text":"

    gameObject.preFX.disable();\n// gameObject.preFX.disable(true);  // Also remove all effects\n
    gameObject.postFX.disable();\n// gameObject.postFX.disable(true);  // Also remove all effects\n
    camera.postFX.disable();\n// camera.postFX.disable(true);  // Also remove all effects\n

    "},{"location":"shader-colorreplace/","title":"Color replace","text":""},{"location":"shader-colorreplace/#introduction","title":"Introduction","text":"

    Replace color post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-colorreplace/#live-demos","title":"Live demos","text":"
    • Color replace
    "},{"location":"shader-colorreplace/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-colorreplace/#install-plugin","title":"Install plugin","text":""},{"location":"shader-colorreplace/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcolorreplacepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcolorreplacepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexcolorreplacepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexcolorreplacepipelineplugin').add(camera, config);\n
    "},{"location":"shader-colorreplace/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ColorReplacePipelinePlugin from 'phaser3-rex-plugins/plugins/colorreplacepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexColorReplacePipeline',\nplugin: ColorReplacePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').add(camera, config);\n
    "},{"location":"shader-colorreplace/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import ColorReplacePostFx from 'phaser3-rex-plugins/plugins/colorreplacepipeline.js';\nvar config = {\n// ...\npipeline: [ColorReplacePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(ColorReplacePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(ColorReplacePostFx);\n
    "},{"location":"shader-colorreplace/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 colorreplace effect.
      var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').add(gameObject, {\noriginalColor: 0xFF0000,\nnewColor: 0x000000,\n// epsilon: 0.4,\n\n// name: 'rexColorReplacePostFx'\n});\n
      • originalColor : The color (0xRRGGBB) that will be changed.
      • newColor : The resulting color (0xRRGGBB).
      • epsilon : Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive)
    • Apply effect to camera. A camera only can add 1 colorreplace effect.
      var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').add(camera, config);\n
    "},{"location":"shader-colorreplace/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexColorReplacePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexColorReplacePipeline').remove(camera);\n
    "},{"location":"shader-colorreplace/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexColorReplacePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexColorReplacePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexColorReplacePipeline').get(camera);\n
    "},{"location":"shader-colorreplace/#original-color","title":"Original color","text":"
    • Get
      var color = pipelineInstance.originalColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setOriginalColor(value);\n
      pipelineInstance.originalColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-colorreplace/#new-color","title":"New color","text":"
    • Get
      var color = pipelineInstance.newColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setNewColor(value);\n
      pipelineInstance.newColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-colorreplace/#epsilon","title":"Epsilon","text":"
    • Get
      var epsilon = pipelineInstance.epsilon;\n
    • Set
      pipelineInstance.epsilon = epsilon;\n// pipelineInstance.epsilon += value;\n
      or
      pipelineInstance.setEpsilon(value);\n
    "},{"location":"shader-crossstitching/","title":"Cross-stitching","text":""},{"location":"shader-crossstitching/#introduction","title":"Introduction","text":"

    Cross-stitching post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-crossstitching/#live-demos","title":"Live demos","text":"
    • Cross-stitching
    "},{"location":"shader-crossstitching/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-crossstitching/#install-plugin","title":"Install plugin","text":""},{"location":"shader-crossstitching/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcrossstitchingpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcrossstitchingpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexcrossstitchingpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexcrossstitchingpipelineplugin').add(camera, config);\n
    "},{"location":"shader-crossstitching/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CrossStitchingPipelinePlugin from 'phaser3-rex-plugins/plugins/crossstitchingpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCrossStitchingPipeline',\nplugin: CrossStitchingPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').add(camera, config);\n
    "},{"location":"shader-crossstitching/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import CrossStitchingPostFx from 'phaser3-rex-plugins/plugins/crossstitchingpipeline.js';\nvar config = {\n// ...\npipeline: [CrossStitchingPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(CrossStitchingPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(CrossStitchingPostFx);\n
    "},{"location":"shader-crossstitching/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 cross-stitching effect.
      var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').add(gameObject, {\n// stitchingWidth: 6,\n// stitchingHeight: 6,\n// brightness: 0,\n\n// name: 'rexCrossStitchingPostFx'\n});\n
      • stitchingWidth, stitchingHeight : Stitching size.
      • brightness : Brightness of stitching edges
    • Apply effect to camera. A camera only can add 1 cross-stitching effect.
      var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').add(camera, config);\n
    "},{"location":"shader-crossstitching/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexCrossStitchingPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexCrossStitchingPipeline').remove(camera);\n
    "},{"location":"shader-crossstitching/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexCrossStitchingPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexCrossStitchingPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexCrossStitchingPipeline').get(camera);\n
    "},{"location":"shader-crossstitching/#stitching-size","title":"Stitching size","text":"
    • Get
      var stitchingWidth = pipelineInstance.stitchingWidth;\nvar stitchingHeight = pipelineInstance.stitchingHeight;\n
    • Set
      pipelineInstance.stitchingWidth = stitchingWidth;\npipelineInstance.stitchingHeight = stitchingHeight;\n// pipelineInstance.stitchingWidth += value;\n// pipelineInstance.stitchingHeight += value;\n
      or
      pipelineInstance.setStitchingWidth(stitchingWidth);\npipelineInstance.setStitchingHeight(stitchingHeight);\npipelineInstance.setStitchingSize(stitchingWidth, stitchingHeight);\n
    "},{"location":"shader-crossstitching/#brightness","title":"Brightness","text":"
    • Get
      var brightness = pipelineInstance.brightness;\n
    • Set
      pipelineInstance.brightness = brightness;\n// pipelineInstance.brightness += value;\n
      or
      pipelineInstance.setBrightness(radius);\n
      • brightness : 0(black) ~ 1(white)
    "},{"location":"shader-crt/","title":"CRT","text":""},{"location":"shader-crt/#introduction","title":"Introduction","text":"

    CRT post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-crt/#live-demos","title":"Live demos","text":"
    • CRT
    "},{"location":"shader-crt/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-crt/#install-plugin","title":"Install plugin","text":""},{"location":"shader-crt/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcrtpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcrtpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexcrtpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexcrtpipelineplugin').add(camera, config);\n
    "},{"location":"shader-crt/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CrtPipelinePlugin from 'phaser3-rex-plugins/plugins/crtpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCrtPipeline',\nplugin: CrtPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexCrtPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexCrtPipeline').add(camera, config);\n
    "},{"location":"shader-crt/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import CrtPostFx from 'phaser3-rex-plugins/plugins/crtpipeline.js';\nvar config = {\n// ...\npipeline: [CrtPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(CrtPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(CrtPostFx);\n
    "},{"location":"shader-crt/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 crt effect.
      var pipelineInstance = scene.plugins.get('rexCrtPipeline').add(gameObject, {\n// warpX: 0.75,\n// warpY: 0.75,\n// scanLineStrength: 0.2,\n// scanLineWidth: 1024,\n\n// name: 'rexCrtPostFx'\n});\n
      • warpX, warpY : Horizontal and Vertical warp.
      • scanLineStrength, scanLineWidth : Scan line parameters.
    • Apply effect to camera. A camera only can add 1 crt effect.
      var pipelineInstance = scene.plugins.get('rexCrtPipeline').add(camera, config);\n
    "},{"location":"shader-crt/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexCrtPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexCrtPipeline').remove(camera);\n
    "},{"location":"shader-crt/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexCrtPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexCrtPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexCrtPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexCrtPipeline').get(camera);\n
    "},{"location":"shader-crt/#warp","title":"Warp","text":"
    • Get
      var warpX = pipelineInstance.warpX;\nvar warpY = pipelineInstance.warpY;\n
    • Set
      pipelineInstance.setWarp(warpX, warpY);\n
      or
      pipelineInstance.warpX = warpX;\npipelineInstance.warpY = warpY;\n
    "},{"location":"shader-crt/#scan-lines","title":"Scan lines","text":"
    • Get
      var scanLineStrength = pipelineInstance.scanLineStrength;\nvar scanLineWidth = pipelineInstance.scanLineWidth;\n
    • Set
      pipelineInstance.setScanStrength(scanLineStrength);\npipelineInstance.setScanLineWidth(scanLineWidth);\n
      or
      pipelineInstance.scanLineStrength = scanLineStrength;\npipelineInstance.scanLineWidth = scanLineWidth;\n
    "},{"location":"shader-dissolve/","title":"Dissolve","text":""},{"location":"shader-dissolve/#introduction","title":"Introduction","text":"

    Dissolve transition post processing filter. (Reference)

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-dissolve/#live-demos","title":"Live demos","text":"
    • Dissolve
    "},{"location":"shader-dissolve/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-dissolve/#install-plugin","title":"Install plugin","text":""},{"location":"shader-dissolve/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdissolvepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdissolvepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexdissolvepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexdissolvepipelineplugin').add(camera, config);\n
    "},{"location":"shader-dissolve/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DissolvePipelinePlugin from 'phaser3-rex-plugins/plugins/dissolvepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDissolvePipeline',\nplugin: DissolvePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexDissolvePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexDissolvePipeline').add(camera, config);\n
    "},{"location":"shader-dissolve/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import DissolvePostFx from 'phaser3-rex-plugins/plugins/dissolvepipeline.js';\nvar config = {\n// ...\npipeline: [DissolvePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(DissolvePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(DissolvePostFx);\n
    "},{"location":"shader-dissolve/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 dissolve effect.
      var pipelineInstance = scene.plugins.get('rexDissolvePipeline').add(gameObject, {\n// toTexture: textureKey,\n// toFrame: frameName,\n// resizeMode: 1,\n\n// noiseX: undefined,\n// noiseY: undefined,\n// noiseZ: undefined,\n// fromEdgeStart: 0.01,\n// fromEdgeWidth: 0.05,\n// toEdgeStart: 0.01,\n// toEdgeWidth: 0.05,\n\n// progress: 0,\n\n// name: 'rexDissolvePostFx'\n});\n
      • toTexture, toFrame : Texture key and frame name of transition target texture.
      • resizeMode : Resize mode of transition target texture.
        • 0, or 'stretch' : The target texture is stretched to the size of the source texture.
        • 1, or 'contain' : The target texture is resized to fit the source texture.
        • 2, or 'cover' : The target texture is resized to cover the source texture.
      • noiseX, noiseY, noiseZ : Parameter of Perline noise.
        • undefined : A random value.
      • fromEdgeStart, fromEdgeWidth : Dissolve edge start, edge width of from-texture (texture of game object, or render result of camera).
      • toEdgeStart, toEdgeWidth : Reveal edge start, edge width of to-texture.
    • Apply effect to camera. A camera only can add 1 dissolve effect.
      var pipelineInstance = scene.plugins.get('rexDissolvePipeline').add(camera, config);\n
    "},{"location":"shader-dissolve/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexDissolvePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexDissolvePipeline').remove(camera);\n
    "},{"location":"shader-dissolve/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexDissolvePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexDissolvePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexDissolvePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexDissolvePipeline').get(camera);\n
    "},{"location":"shader-dissolve/#transition-target-texture","title":"Transition target texture","text":"
    • Get
      var textureKey = pipelineInstance.toFrame.texture.key;\nvar frameName = pipelineInstance.toFrame.name;\n
    • Set
      pipelineInstance.setTransitionTargetTexture(textureKey, frameName);\n// pipelineInstance.setTransitionTargetTexture(textureKey, frameName, resizeMode);\n
    "},{"location":"shader-dissolve/#progress","title":"Progress","text":"
    • Get
      var progress = pipelineInstance.progress;\n
    • Set
      pipelineInstance.setProgress(value);  // value: 0~1\n
      or
      pipelineInstance.progress = value;  // value: 0~1\n
    "},{"location":"shader-dissolve/#resize-mode","title":"Resize mode","text":"
    • Get
      var mode = pipelineInstance.resizeMode;\n
    • Set
      pipelineInstance.setResizeMode(mode);\n
      • mode :
        • 0, or 'stretch' : The target texture is stretched to the size of the source texture.
        • 1, or 'contain' : The target texture is resized to fit the source texture.
        • 2, or 'cover' : The target texture is resized to cover the source texture.
    "},{"location":"shader-dissolve/#noise","title":"Noise","text":"
    • Get
      var noiseX = pipelineInstance.noiseX;\nvar noiseY = pipelineInstance.noiseY;\nvar noiseZ = pipelineInstance.noiseZ;\n
    • Set
      pipelineInstance.noiseX = noiseX;\npipelineInstance.noiseY = noiseY;\npipelineInstance.noiseZ = noiseZ;\n
      or
      pipelineInstance.setNoise(noiseX, noiseY, noiseZ);\n// pipelineInstance.setNoise(); // Passing 3 random float numbers\n
    "},{"location":"shader-dissolve/#edge","title":"Edge","text":"
    • Get
      • From texture (texture of game object, or render result of camera)
        var edgeStart = pipelineInstance.fromEdgeStart;\nvar edgeWidth = pipelineInstance.fromEdgeWidth;\n
      • To texture (transition target texture)
        var edgeStart = pipelineInstance.toEdgeStart;\nvar edgeWidth = pipelineInstance.toEdgeWidth;\n
    • Set
      • From texture (texture of game object, or render result of camera)
        pipelineInstance.fromEdgeStart = edgeStart;\npipelineInstance.fromEdgeWidth = edgeWidth;\n
        or
        pipelineInstance.setFromEdge(edgeStart, edgeWidth);\n
        • edgeStart : 0~1, default value is 0.01
        • edgeWidth : 0~1, default value is 0.05
      • To texture (transition target texture)
        pipelineInstance.toEdgeStart = edgeStart;\npipelineInstance.toEdgeWidth = edgeWidth;\n
        or
        pipelineInstance.setToEdge(edgeStart, edgeWidth);\n
        • edgeStart : 0~1, default value is 0.01
        • edgeWidth : 0~1, default value is 0.05
    "},{"location":"shader-dropshadow/","title":"Drop shadow","text":"

    Note

    Built-in preFX/postFX also provide shadow effect, might try these first.

    "},{"location":"shader-dropshadow/#introduction","title":"Introduction","text":"

    Drop-shadow post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-dropshadow/#live-demos","title":"Live demos","text":"
    • Drop-shadow
    "},{"location":"shader-dropshadow/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-dropshadow/#install-plugin","title":"Install plugin","text":""},{"location":"shader-dropshadow/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexdropshadowpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexdropshadowpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexdropshadowpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexdropshadowpipelineplugin').add(camera, config);\n
    "},{"location":"shader-dropshadow/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import DropShadowPipelinePlugin from 'phaser3-rex-plugins/plugins/dropshadowpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexDropShadowPipeline',\nplugin: DropShadowPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').add(camera, config);\n
    "},{"location":"shader-dropshadow/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import DropShadowPostFx from 'phaser3-rex-plugins/plugins/dropshadowpipeline.js';\nvar config = {\n// ...\npipeline: [DropShadowPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(DropShadowPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(DropShadowPostFx);\n
    "},{"location":"shader-dropshadow/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 dropshadow effect.
      var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').add(gameObject, {\n// ** Offset **\n// rotation: \n// angle: 45,      // degrees\n// distance: 5,\n\n// ** Shadow color **\n// shadowColor: 0xffffff,\n// alpha: 0.5,\n\n// shadowOnly: false,\n\n// ** Parameters of KawaseBlur **\n// blur: 4,\n// quality: 3,\n// pixelWidth: 1,\n// pixelHeight: 1,\n\n// name: 'rexDropShadowPostFx'\n});\n
      • Offset
        • rotation, angle : The angle of the shadow in radians/degrees.
        • distance : Distance of shadow.
      • Color
        • shadowColor : Color of the shadow.
        • alpha : Alpha of the shadow.
      • shadowOnly : Whether render shadow only.
      • Parameters of KawaseBlur
        • blur : The blur of the filter. Should be greater than 0. If value is an Array, setting kernels.
        • quality : The quality of the filter. Should be an integer greater than 1.
        • pixelWidth, pixelHeight : Sets the pixel size of the filter. Large size is blurrier. For advanced usage.
    • Apply effect to camera. A camera only can add 1 dropshadow effect.
      var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').add(camera, config);\n
    "},{"location":"shader-dropshadow/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexDropShadowPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexDropShadowPipeline').remove(camera);\n
    "},{"location":"shader-dropshadow/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexDropShadowPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexDropShadowPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexDropShadowPipeline').get(camera);\n
    "},{"location":"shader-dropshadow/#rotation","title":"Rotation","text":"
    • Get
      var rotation = pipelineInstance.rotation;  // radians\n// var angle = pipelineInstance.angle;     // degrees\n
    • Set
      pipelineInstance.rotation = rotation;   // radians\n// pipelineInstance.angle = angle;      // degrees\n
      or
      pipelineInstance.setRotation(radians);\npipelineInstance.setAngle(degrees);\n
    "},{"location":"shader-dropshadow/#distance","title":"Distance","text":"
    • Get
      var distance = pipelineInstance.distance;\n
    • Set
      pipelineInstance.distance = distance;\n// pipelineInstance.distance += value;\n
      or
      pipelineInstance.setDistance(distance);\n
    "},{"location":"shader-dropshadow/#shadow-color","title":"Shadow color","text":"
    • Get
      var color = pipelineInstance.shadowColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setShadowColor(value);\n
      pipelineInstance.shadowColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-dropshadow/#alpha","title":"Alpha","text":"
    • Get
      var alpha = pipelineInstance.alpha;\n
    • Set
      pipelineInstance.alpha = alpha;\n
      or
      pipelineInstance.setAlpha(alpha);\n
    "},{"location":"shader-dropshadow/#shadow-only","title":"Shadow-only","text":"
    • Get
      var enable = pipelineInstance.shadowOnly;\n
    • Set
      pipelineInstance.shadowOnly = enable;\n
      or
      pipelineInstance.setShadowOnly(enable);\n
    "},{"location":"shader-dropshadow/#blur","title":"Blur","text":"
    • Get
      var blur = pipelineInstance.blur;\n
    • Set
      pipelineInstance.blur = blur;\n// pipelineInstance.blur += value;\n
      or
      pipelineInstance.setBlur(value);\n
    "},{"location":"shader-dropshadow/#quality","title":"Quality","text":"
    • Get
      var quality = pipelineInstance.quality;\n
    • Set
      pipelineInstance.quality = quality;\n// pipelineInstance.quality += value;\n
      or
      pipelineInstance.setQuality(value);\n
    "},{"location":"shader-dropshadow/#pixel-size","title":"Pixel size","text":"
    • Get
      var pixelWidth = pipelineInstance.pixelWidth;\nvar pixelHeight = pipelineInstance.pixelHeight;\n
    • Set
      pipelineInstance.pixelWidth = pixelWidth;\npipelineInstance.pixelHeight = pixelHeight;\n
      or
      pipelineInstance.setPixelWidth(pixelWidth);\npipelineInstance.setPixelHeight(pixelHeight);\npipelineInstance.setPixelSize(pixelWidth, pixelHeight);\n
    "},{"location":"shader-fisheye/","title":"Fisheye","text":""},{"location":"shader-fisheye/#introduction","title":"Introduction","text":"

    Fish-eye post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-fisheye/#live-demos","title":"Live demos","text":"
    • FishEye
    "},{"location":"shader-fisheye/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-fisheye/#install-plugin","title":"Install plugin","text":""},{"location":"shader-fisheye/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfisheyepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfisheyepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexfisheyepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexfisheyepipelineplugin').add(camera, config);\n
    "},{"location":"shader-fisheye/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FishEyePipelinePlugin from 'phaser3-rex-plugins/plugins/fisheyepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFishEyePipeline',\nplugin: FishEyePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexFishEyePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexFishEyePipeline').add(camera, config);\n
    "},{"location":"shader-fisheye/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import FishEyePostFx from 'phaser3-rex-plugins/plugins/fisheyepipeline.js';\nvar config = {\n// ...\npipeline: [FishEyePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(FishEyePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(FishEyePostFx);\n
    "},{"location":"shader-fisheye/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 fisheye effect.
      var pipelineInstance = scene.plugins.get('rexFishEyePipeline').add(gameObject, {\n// center: {\n//    x: windowWidth / 2,\n//    y: windowHeight / 2\n//}\n// radius: 0,\n// intensity: 1,\n// mode:0,  // 0|1|'asin'|'sin'\n\n// name: 'rexFishEyePostFx'\n});\n
      • center.x, center.y : Local position of fisheye center.
      • radius : FishEye radius.
      • intensity : 0(original) ~ 1(fisheye). Default value is 1.
      • mode :
        • 0, or 'asin' : asin mode. Defaule value is 0.
        • 1, or 'sin' : sin mode.
    • Apply effect to camera. A camera only can add 1 fisheye effect.
      var pipelineInstance = scene.plugins.get('rexFishEyePipeline').add(camera, config);\n
    "},{"location":"shader-fisheye/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexFishEyePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexFishEyePipeline').remove(camera);\n
    "},{"location":"shader-fisheye/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexFishEyePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexFishEyePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexFishEyePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexFishEyePipeline').get(camera);\n
    "},{"location":"shader-fisheye/#radius","title":"Radius","text":"
    • Get
      var radius = pipelineInstance.radius;\n
    • Set
      pipelineInstance.radius = radius;\n// pipelineInstance.radius += value;\n
      or
      pipelineInstance.setRadius(radius);\n
    "},{"location":"shader-fisheye/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(intensity);\n
      • intensity : 0(original) ~ 1(fisheye)
    "},{"location":"shader-fisheye/#center-position","title":"Center position","text":"

    Default value is center of window.

    • Get
      var x = pipelineInstance.centerX;\nvar y = pipelineInstance.centerY;\n
    • Set
      pipelineInstance.centerX = x;\npipelineInstance.centerY = y;\n
      or
      pipelineInstance.setCenter(x, y);\n// pipelineInstance.setCenter();   // set to center of window\n
    "},{"location":"shader-fisheye/#mode","title":"Mode","text":"
    • Get
      var mode = pipelineInstance.fishEyeMode;\n
    • Set
      pipelineInstance.setFishEyeMode(mode);\n
      • 0, or 'asin' : asin mode.
      • 1, or 'sin' : sin mode.
    "},{"location":"shader-glowfilter/","title":"Glow","text":"

    Note

    Phaser3.60 has a built-in Glow effect.

    "},{"location":"shader-glowfilter/#introduction","title":"Introduction","text":"

    Glow post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-glowfilter/#live-demos","title":"Live demos","text":"
    • Glow filter
    "},{"location":"shader-glowfilter/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-glowfilter/#install-plugin","title":"Install plugin","text":""},{"location":"shader-glowfilter/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexglowfilterpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexglowfilterpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexglowfilterpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexglowfilterpipelineplugin').add(camera, config);\n
    "},{"location":"shader-glowfilter/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GlowFilterPipelinePlugin from 'phaser3-rex-plugins/plugins/glowfilterpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGlowFilterPipeline',\nplugin: GlowFilterPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(camera, config);\n
    "},{"location":"shader-glowfilter/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import GlowFilterPostFx from 'phaser3-rex-plugins/plugins/glowfilterpipeline.js';\nvar config = {\n// ...\npipeline: [GlowFilterPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(GlowFilterPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(GlowFilterPostFx);\n
    "},{"location":"shader-glowfilter/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 glow effect.
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(gameObject, {\n// intensity: 0\n});\n
      • intensity : 0(original color) ~ 1(white color)
        • Suggestion value : 0 ~ 0.02
    • Apply effect to camera. A camera only can add 1 glow effect.
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(camera, config);\n
    "},{"location":"shader-glowfilter/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexGlowFilterPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexGlowFilterPipeline').remove(camera);\n
    "},{"location":"shader-glowfilter/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexGlowFilterPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexGlowFilterPipeline').get(camera);\n
    "},{"location":"shader-glowfilter/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(radius);\n
      • intensity : 0(original color) ~ 1(white color)
        • Suggestion value : 0 ~ 0.02
    "},{"location":"shader-glowfilter2/","title":"Glow","text":"

    Note

    Phaser3.60 has a built-in Glow effect.

    "},{"location":"shader-glowfilter2/#introduction","title":"Introduction","text":"

    Glow post processing filter, port from pixi. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-glowfilter2/#live-demos","title":"Live demos","text":"
    • Glow filter
    "},{"location":"shader-glowfilter2/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-glowfilter2/#install-plugin","title":"Install plugin","text":""},{"location":"shader-glowfilter2/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexglowfilter2pipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexglowfilter2pipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexglowfilter2pipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexglowfilter2pipelineplugin').add(camera, config);\n
    "},{"location":"shader-glowfilter2/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GlowFilterPipelinePlugin from 'phaser3-rex-plugins/plugins/glowfilter2pipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGlowFilterPipeline',\nplugin: GlowFilterPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(camera, config);\n
    "},{"location":"shader-glowfilter2/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import GlowFilterPostFx from 'phaser3-rex-plugins/plugins/glowfilter2pipeline.js';\nvar config = {\n// ...\npipeline: [GlowFilterPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(GlowFilterPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(GlowFilterPostFx);\n
    "},{"location":"shader-glowfilter2/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 glowfilter effect.
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(gameObject, {    // outerStrength: 4,\n// innerStrength: 0,\n// glowColor: 0xffffff,\n// knockout: false,\n\n// distance: 10,\n// quality: 0.1,\n\n// name: 'rexGlowFilterPostFx'\n});\n
      • outerStrength : The strength of the glow outward from the edge of the texture.
      • innerStrength : The strength of the glow inward from the edge of the texture.
      • glowColor : The color of the glow.
      • knockout :
        • true : Only show effect.
        • false : Show content and effect.
      • distance : The distance of the glow. It can't be changed after filter creation.
      • quality : 0~1. The higher the number the less performant. It can't be changed after filter creation.
    • Apply effect to camera. A camera only can add 1 glowfilter effect.
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').add(camera, config);\n
    "},{"location":"shader-glowfilter2/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexGlowFilterPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexGlowFilterPipeline').remove(camera);\n
    "},{"location":"shader-glowfilter2/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexGlowFilterPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexGlowFilterPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexGlowFilterPipeline').get(camera);\n
    "},{"location":"shader-glowfilter2/#outer-strength","title":"Outer strength","text":"
    • Get
      var outerStrength = pipelineInstance.outerStrength;\n
    • Set
      pipelineInstance.outerStrength = outerStrength;\n// pipelineInstance.outerStrength += value;\n
      or
      pipelineInstance.setOuterStrength(value);\n
    "},{"location":"shader-glowfilter2/#inner-strength","title":"Inner strength","text":"
    • Get
      var innerStrength = pipelineInstance.innerStrength;\n
    • Set
      pipelineInstance.innerStrength = innerStrength;\n// pipelineInstance.innerStrength += value;\n
      or
      pipelineInstance.setInnerStrength(value);\n
    "},{"location":"shader-glowfilter2/#glow-color","title":"Glow color","text":"
    • Get
      var color = pipelineInstance.glowColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setGlowColor(value);\n
      pipelineInstance.glowColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-glowfilter2/#distance","title":"Distance","text":"

    The distance of the glow. Make it 2 times more for resolution=2. It can't be changed after filter creation.

    • Get
      var distance = pipelineInstance.distance;\n
    • Set
      pipelineInstance.setDistance(distance);\n
      or
      pipelineInstance.distance = distance;\n
      • distance : The distance of the glow.
    "},{"location":"shader-glowfilter2/#quality","title":"Quality","text":"

    A number between 0 and 1 that describes the quality of the glow. The higher the number the less performant.

    • Get
      var quality = pipelineInstance.quality;\n
    • Set
      pipelineInstance.setQuality(quality);\n
      or
      pipelineInstance.quality = quality;\n
      • quality : 0 ~ 1, default is 0.1.
        • 0.1 : 10 sample points.
        • 0.08 : 8 sample points.
        • 1 : 100 sample points.
    "},{"location":"shader-grayscale/","title":"Gray scale","text":"

    Note

    Phaser3.60 has a built-in Color Matrix effects.

    "},{"location":"shader-grayscale/#introduction","title":"Introduction","text":"

    Gray scale post processing filter.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-grayscale/#live-demos","title":"Live demos","text":"
    • Gray scale
    "},{"location":"shader-grayscale/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-grayscale/#install-plugin","title":"Install plugin","text":""},{"location":"shader-grayscale/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexgrayscalepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexgrayscalepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexgrayscalepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexgrayscalepipelineplugin').add(camera, config);\n
    "},{"location":"shader-grayscale/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import GrayScalePipelinePlugin from 'phaser3-rex-plugins/plugins/grayscalepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexGrayScalePipeline',\nplugin: GrayScalePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').add(camera, config);\n
    "},{"location":"shader-grayscale/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import GrayScalePostFx from 'phaser3-rex-plugins/plugins/grayscalepipeline.js';\nvar config = {\n// ...\npipeline: [GrayScalePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(GrayScalePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(GrayScalePostFx);\n
    "},{"location":"shader-grayscale/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 gray-scale effect.
      var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').add(gameObject, {\n// intensity: 1,\n\n// name: 'rexGrayScalePostFx'\n});\n
      • intensity : 0(original color) ~ 1(gray scale). Default value is 1.
    • Apply effect to camera. A camera only can add 1 gray-scale effect.
      var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').add(camera, config);\n
    "},{"location":"shader-grayscale/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexGrayScalePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexGrayScalePipeline').remove(camera);\n
    "},{"location":"shader-grayscale/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexGrayScalePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexGrayScalePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexGrayScalePipeline').get(camera);\n
    "},{"location":"shader-grayscale/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(radius);\n
      • intensity : 0(original color) ~ 1(gray scale)
    "},{"location":"shader-horrifi/","title":"Horri-fi","text":""},{"location":"shader-horrifi/#introduction","title":"Introduction","text":"

    6-in-1 post processing filter

    • Bloom
    • Chromatic Abberation
    • Scanlines
    • VHS Distortion
    • CRT TV Curve
    • Noise
    • Vignette

    Reference : Horri-fi shader effect

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-horrifi/#live-demos","title":"Live demos","text":"
    • Horrifi
    "},{"location":"shader-horrifi/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-horrifi/#install-plugin","title":"Install plugin","text":""},{"location":"shader-horrifi/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexhorrifipipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexhorrifipipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexhorrifipipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexhorrifipipelineplugin').add(camera, config);\n
    "},{"location":"shader-horrifi/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import HorrifiPipelinePlugin from 'phaser3-rex-plugins/plugins/horrifipipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexHorrifiPipeline',\nplugin: HorrifiPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').add(camera, config);\n
    "},{"location":"shader-horrifi/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import HorrifiPostFx from 'phaser3-rex-plugins/plugins/horrifipipeline.js';\nvar config = {\n// ...\npipeline: [HorrifiPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(HorrifiPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(HorrifiPostFx);\n
    "},{"location":"shader-horrifi/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 horrifi effect.
      var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').add(gameObject, {\nenable: false,\n\n// Bloom\nbloomEnable: false,\nbloomRadius: 0, bloomIntensity: 0, bloomThreshold: 0,\nbloomTexelWidth: 0, bloomTexelHeight: 0,\n\n// Chromatic abberation\nchromaticEnable: false,\nchabIntensity: 0,\n\n// Vignette\nvignetteEnable: false,\nvignetteStrength: 0, vignetteIntensity: 0,\n\n// Noise\nnoiseEnable: false,\nnoiseStrength: 0,\nnoiseSeed: 0,\n\n// VHS\nvhsEnable: false,\nvhsStrength: 0,\n\n// Scanlines\nscanlinesEnable: false,\nscanStrength: 0,\n\n// CRT\ncrtEnable: false,\ncrtWidth: 0, crtHeight: 0,\n\n// name: 'rexHorrifiPostFx'\n});\n
      • enable : Default enable value for all shader effects.
      • Bloom
        • bloomEnable : Set true to enable bloom effect.
        • bloomRadius, bloomIntensity, bloomThreshold
        • bloomTexelWidth, bloomTexelHeight
      • Chromatic abberation
        • chromaticEnable : Set true to enable chromatic abberation effect.
        • chabIntensity
      • Vignette
        • vignetteEnable : Set true to enable vignette effect.
        • vignetteStrength, vignetteIntensity
      • Noise
        • noiseEnable : Set true to enable noise effect.
        • noiseStrength
        • noiseSeed
      • VHS
        • vhsEnable : Set true to enable VHS effect.
        • vhsStrength
      • Scanlines
        • scanlinesEnable : Set true to enable Scanlines effect.
        • scanStrength
      • CRT
        • crtEnable : Set true to enable Scanlines effect.
        • crtWidth, crtHeight
    • Apply effect to camera. A camera only can add 1 horrifi effect.
      var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').add(camera, config);\n
    "},{"location":"shader-horrifi/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexHorrifiPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexHorrifiPipeline').remove(camera);\n
    "},{"location":"shader-horrifi/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexHorrifiPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexHorrifiPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexHorrifiPipeline').get(camera);\n
    "},{"location":"shader-horrifi/#bloom","title":"Bloom","text":""},{"location":"shader-horrifi/#enable","title":"Enable","text":"
    • Enable
      pipelineInstance.setBloomEnable();\n// pipelineInstance.setBloomEnable(true);\n
      or
      pipelineInstance.bloomEnable = true;\n
    • Disable
      pipelineInstance.setBloomEnable(false);\n
      or
      pipelineInstance.bloomEnable = false;\n
    • Get
      var bloomEnable = pipelineInstance.bloomEnable;\n
    "},{"location":"shader-horrifi/#parameters","title":"Parameters","text":"
    • Set
      pipelineInstance.setBloomRadius(value);\npipelineInstance.setBloomIntensity(value);\npipelineInstance.setBloomThreshold(value);\npipelineInstance.setBloomTexelSize(width, height);\n
      or
      pipelineInstance.bloomRadius = value;\npipelineInstance.bloomIntensity = value;\npipelineInstance.bloomThreshold = value;\npipelineInstance.bloomTexelWidth = width;\npipelineInstance.bloomTexelHeight = height;\n
    • Get
      var bloomRadius = pipelineInstance.bloomRadius;\nvar bloomIntensity = pipelineInstance.bloomIntensity;\nvar bloomThreshold = pipelineInstance.bloomThreshold;\nvar bloomTexelWidth = pipelineInstance.bloomTexelWidth;\nvar bloomTexelHeight = pipelineInstance.bloomTexelHeight;\n
    "},{"location":"shader-horrifi/#chromatic-abberation","title":"Chromatic abberation","text":""},{"location":"shader-horrifi/#enable_1","title":"Enable","text":"
    • Enable
      pipelineInstance.setChromaticEnable();\n// pipelineInstance.setChromaticEnable(true);\n
      or
      pipelineInstance.chromaticEnable = true;\n
    • Disable
      pipelineInstance.setChromaticEnable(false);\n
      or
      pipelineInstance.chromaticEnable = false;\n
    • Get
      var chromaticEnable = pipelineInstance.chromaticEnable;\n
    "},{"location":"shader-horrifi/#parameters_1","title":"Parameters","text":"
    • Set
      pipelineInstance.setChabIntensity(value);\n
      or
      pipelineInstance.chabIntensity = value;\n
    • Get
      var chabIntensity = pipelineInstance.chabIntensity;\n
    "},{"location":"shader-horrifi/#vignette","title":"Vignette","text":""},{"location":"shader-horrifi/#enable_2","title":"Enable","text":"
    • Enable
      pipelineInstance.setVignetteEnable();\n// pipelineInstance.setVignetteEnable(true);\n
      or
      pipelineInstance.vignetteEnable = true;\n
    • Disable
      pipelineInstance.setVignetteEnable(false);\n
      or
      pipelineInstance.vignetteEnable = false;\n
    • Get
      var vignetteEnable = pipelineInstance.vignetteEnable;\n
    "},{"location":"shader-horrifi/#parameters_2","title":"Parameters","text":"
    • Set
      pipelineInstance.setVignetteStrength(value);\npipelineInstance.setVignetteIntensity(value);\n
      or
      pipelineInstance.vignetteStrength = value;\npipelineInstance.vignetteIntensity = value;\n
    • Get
      var vignetteStrength = pipelineInstance.vignetteStrength;\nvar vignetteIntensity = pipelineInstance.vignetteIntensity;\n
    "},{"location":"shader-horrifi/#noise","title":"Noise","text":""},{"location":"shader-horrifi/#enable_3","title":"Enable","text":"
    • Enable
      pipelineInstance.setNoiseEnable();\n// pipelineInstance.setNoiseEnable(true);\n
      or
      pipelineInstance.noiseEnable = true;\n
    • Disable
      pipelineInstance.setNoiseEnable(false);\n
      or
      pipelineInstance.noiseEnable = false;\n
    • Get
      var noiseEnable = pipelineInstance.noiseEnable;\n
    "},{"location":"shader-horrifi/#parameters_3","title":"Parameters","text":"
    • Set
      pipelineInstance.setNoiseStrength(value);\npipelineInstance.setNoiseSeed(value);\n
      or
      pipelineInstance.noiseStrength = value;\npipelineInstance.noiseSeed = value;\n
    • Get
      var noiseStrength = pipelineInstance.noiseStrength;\nvar noiseSeed = pipelineInstance.noiseSeed;\n
    "},{"location":"shader-horrifi/#vhs","title":"VHS","text":""},{"location":"shader-horrifi/#enable_4","title":"Enable","text":"
    • Enable
      pipelineInstance.setVHSEnable();\n// pipelineInstance.setVHSEnable(true);\n
      or
      pipelineInstance.vhsEnable = true;\n
    • Disable
      pipelineInstance.setVHSEnable(false);\n
      or
      pipelineInstance.vhsEnable = false;\n
    • Get
      var vhsEnable = pipelineInstance.vhsEnable;\n
    "},{"location":"shader-horrifi/#parameters_4","title":"Parameters","text":"
    • Set
      pipelineInstance.setVhsStrength(value);\n
      or
      pipelineInstance.vhsStrength = value;\n
    • Get
      var vhsStrength = pipelineInstance.vhsStrength;\n
    "},{"location":"shader-horrifi/#scanlines","title":"Scanlines","text":""},{"location":"shader-horrifi/#enable_5","title":"Enable","text":"
    • Enable
      pipelineInstance.setScanlinesEnable();\n// pipelineInstance.setScanlinesEnable(true);\n
      or
      pipelineInstance.scanlinesEnable = true;\n
    • Disable
      pipelineInstance.setScanlinesEnable(false);\n
      or
      pipelineInstance.scanlinesEnable = false;\n
    • Get
      var scanlinesEnable = pipelineInstance.scanlinesEnable;\n
    "},{"location":"shader-horrifi/#parameters_5","title":"Parameters","text":"
    • Set
      pipelineInstance.setScanStrength(value);\n
      or
      pipelineInstance.scanStrength = value;\n
    • Get
      var scanStrength = pipelineInstance.scanStrength;\n
    "},{"location":"shader-horrifi/#crt","title":"CRT","text":""},{"location":"shader-horrifi/#enable_6","title":"Enable","text":"
    • Enable
      pipelineInstance.setCRTEnable();\n// pipelineInstance.setCRTEnable(true);\n
      or
      pipelineInstance.crtEnable = true;\n
    • Disable
      pipelineInstance.setCRTEnable(false);\n
      or
      pipelineInstance.crtEnable = false;\n
    • Get
      var crtEnable = pipelineInstance.crtEnable;\n
    "},{"location":"shader-horrifi/#parameters_6","title":"Parameters","text":"
    • Set
      pipelineInstance.setCrtSize(width, height);\n
      or
      pipelineInstance.crtWidth = width;\npipelineInstance.crtHeight = height;\n
    • Get
      var crtWidth = pipelineInstance.crtWidth;\nvar crtHeight = pipelineInstance.crtHeight;\n
    "},{"location":"shader-horrifi/#enable-all-effects","title":"Enable all effects","text":"
    • Enable all
      pipelineInstance.setEnable();\n// pipelineInstance.setEnable(true);\n
    • Disable all
      pipelineInstance.setEnable(false);\n
    "},{"location":"shader-hsladjust/","title":"HSL adjust","text":"

    Note

    Phaser3.60 has a built-in Color Matrix effects.

    "},{"location":"shader-hsladjust/#introduction","title":"Introduction","text":"

    Adjust color in HSL domain, post processing filter.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-hsladjust/#live-demos","title":"Live demos","text":"
    • HSL adjust
    "},{"location":"shader-hsladjust/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-hsladjust/#install-plugin","title":"Install plugin","text":""},{"location":"shader-hsladjust/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexhsladjustpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexhsladjustpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexhsladjustpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexhsladjustpipelineplugin').add(camera, config);\n
    "},{"location":"shader-hsladjust/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import HSLAdjustPipelinePlugin from 'phaser3-rex-plugins/plugins/hsladjustpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexHSLAdjustPipeline',\nplugin: HSLAdjustPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexHSLAdjustPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexHSLAdjustPipeline').add(camera, config);\n
    "},{"location":"shader-hsladjust/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import HSLAdjustPostFx from 'phaser3-rex-plugins/plugins/hsladjustpipeline.js';\nvar config = {\n// ...\npipeline: [HSLAdjustPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(HSLAdjustPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(HSLAdjustPostFx);\n
    "},{"location":"shader-hsladjust/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 hsl-adjust effect.
      var pipelineInstance = scene.plugins.get('rexHslAdjustPipeline').add(gameObject, {\n// hueRotate: 0,\n// satAdjust: 1,\n// lumAdjust: 0.5,\n\n// name: 'rexHslAdjustPostFx'\n});\n
      • hueRotate : Hue rotation
        • 0 : Rotate 0 degrees, original color (Default value)
        • 0.5 : Rotate 180 degrees
        • 1 : Rotate 360 degrees
      • satAdjust : Saturation adjustment
        • 0 : Gray
        • 1 : Original color (Default value)
        • 1 :

      • lumAdjust : Lumen adjustment
        • 0 : Dark
        • 0.5 : Original color (Default value)
        • 1 : White
    • Apply effect to camera. A camera only can add 1 hsl-adjust effect.
      var pipelineInstance = scene.plugins.get('rexHslAdjustPipeline').add(camera, config);\n
    "},{"location":"shader-hsladjust/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexHslAdjustPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexHslAdjustPipeline').remove(camera);\n
    "},{"location":"shader-hsladjust/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexHslAdjustPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexHslAdjustPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexHslAdjustPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexHslAdjustPipeline').get(camera);\n
    "},{"location":"shader-hsladjust/#hue-rotation","title":"Hue rotation","text":"
    • Get
      var hueRotate = pipelineInstance.hueRotate;\n
    • Set
      pipelineInstance.hueRotate = hueRotate;\n// pipelineInstance.hueRotate += value;\n
      or
      pipelineInstance.setHueRotate(value);\n
      • 0 : Rotate 0 degrees, original color
      • 0.5 : Rotate 180 degrees
      • 1 : Rotate 360 degrees
    "},{"location":"shader-hsladjust/#saturation-adjustment","title":"Saturation adjustment","text":"
    • Get
      var satAdjust = pipelineInstance.satAdjust;\n
    • Set
      pipelineInstance.satAdjust = satAdjust;\n// pipelineInstance.satAdjust += value;\n
      or
      pipelineInstance.setSatAdjust(value);\n
      • 0 : Gray
      • 1 : Original color
      • 1 :

    "},{"location":"shader-hsladjust/#lumen-adjustment","title":"Lumen adjustment","text":"
    • Get
      var lumAdjust = pipelineInstance.lumAdjust;\n
    • Set
      pipelineInstance.lumAdjust = lumAdjust;\n// pipelineInstance.lumAdjust += value;\n
      or
      pipelineInstance.setLumAdjust(value);\n
      • 0 : Dark
      • 0.5 : Original color
      • 1 : White
    "},{"location":"shader-inverse/","title":"Inverse","text":"

    Note

    Phaser3.60 has a built-in Color Matrix effects.

    "},{"location":"shader-inverse/#introduction","title":"Introduction","text":"

    Inverse color post processing filter.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-inverse/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-inverse/#install-plugin","title":"Install plugin","text":""},{"location":"shader-inverse/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexinversepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexinversepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexinversepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexinversepipelineplugin').add(camera, config);\n
    "},{"location":"shader-inverse/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import InversePipelinePlugin from 'phaser3-rex-plugins/plugins/inversepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexInversePipeline',\nplugin: InversePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexInversePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexInversePipeline').add(camera, config);\n
    "},{"location":"shader-inverse/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import InversePostFx from 'phaser3-rex-plugins/plugins/inversepipeline.js';\nvar config = {\n// ...\npipeline: [InversePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(InversePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(InversePostFx);\n
    "},{"location":"shader-inverse/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 inverse effect.
      var pipelineInstance = scene.plugins.get('rexInversePipeline').add(gameObject, {\n// intensity: 1,\n\n// name: 'rexInversePostFx'\n});\n
      • intensity : 0(original color) ~ 1(inverse scale). Default value is 1.
    • Apply effect to camera. A camera only can add 1 inverse effect.
      var pipelineInstance = scene.plugins.get('rexInversePipeline').add(camera, config);\n
    "},{"location":"shader-inverse/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexInversePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexInversePipeline').remove(camera);\n
    "},{"location":"shader-inverse/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexInversePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexInversePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexInversePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexInversePipeline').get(camera);\n
    "},{"location":"shader-inverse/#intensity","title":"Intensity","text":"
    • Get
      var intensity = pipelineInstance.intensity;\n
    • Set
      pipelineInstance.intensity = intensity;\n// pipelineInstance.intensity += value;\n
      or
      pipelineInstance.setIntensity(radius);\n
      • intensity : 0(original color) ~ 1(inverse color)
    "},{"location":"shader-kawaseblur/","title":"Kawase blur","text":"

    Note

    Phaser3.60 has a built-in blur effect.

    "},{"location":"shader-kawaseblur/#introduction","title":"Introduction","text":"

    Kawase-blur post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-kawaseblur/#live-demos","title":"Live demos","text":"
    • Kawase-blur
    "},{"location":"shader-kawaseblur/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-kawaseblur/#install-plugin","title":"Install plugin","text":""},{"location":"shader-kawaseblur/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexkawaseblurpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexkawaseblurpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexkawaseblurpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexkawaseblurpipelineplugin').add(camera, config);\n
    "},{"location":"shader-kawaseblur/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import KawaseBlurPipelinePlugin from 'phaser3-rex-plugins/plugins/kawaseblurpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexKawaseBlurPipeline',\nplugin: KawaseBlurPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').add(camera, config);\n
    "},{"location":"shader-kawaseblur/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import KawaseBlurPostFx from 'phaser3-rex-plugins/plugins/kawaseblurpipeline.js';\nvar config = {\n// ...\npipeline: [KawaseBlurPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(KawaseBlurPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(KawaseBlurPostFx);\n
    "},{"location":"shader-kawaseblur/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 kawaseblur effect.
      var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').add(gameObject, {\n// blur: 4,\n// quality: 3,\n// pixelWidth: 1,\n// pixelHeight: 1,\n\n// name: 'rexKawaseBlurPostFx'\n});\n
      • blur : The blur of the filter. Should be greater than 0. If value is an Array, setting kernels.
      • quality : The quality of the filter. Should be an integer greater than 1.
      • pixelWidth, pixelHeight : Sets the pixel size of the filter. Large size is blurrier. For advanced usage.
    • Apply effect to camera. A camera only can add 1 kawaseblur effect.
      var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').add(camera, config);\n
    "},{"location":"shader-kawaseblur/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexKawaseBlurPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexKawaseBlurPipeline').remove(camera);\n
    "},{"location":"shader-kawaseblur/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexKawaseBlurPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexKawaseBlurPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexKawaseBlurPipeline').get(camera);\n
    "},{"location":"shader-kawaseblur/#blur","title":"Blur","text":"
    • Get
      var blur = pipelineInstance.blur;\n
    • Set
      pipelineInstance.blur = blur;\n// pipelineInstance.blur += value;\n
      or
      pipelineInstance.setBlur(value);\n
    "},{"location":"shader-kawaseblur/#quality","title":"Quality","text":"
    • Get
      var quality = pipelineInstance.quality;\n
    • Set
      pipelineInstance.quality = quality;\n// pipelineInstance.quality += value;\n
      or
      pipelineInstance.setQuality(value);\n
    "},{"location":"shader-kawaseblur/#pixel-size","title":"Pixel size","text":"
    • Get
      var pixelWidth = pipelineInstance.pixelWidth;\nvar pixelHeight = pipelineInstance.pixelHeight;\n
    • Set
      pipelineInstance.pixelWidth = pixelWidth;\npipelineInstance.pixelHeight = pixelHeight;\n
      or
      pipelineInstance.setPixelWidth(pixelWidth);\npipelineInstance.setPixelHeight(pixelHeight);\npipelineInstance.setPixelSize(pixelWidth, pixelHeight);\n
    "},{"location":"shader-outline/","title":"Outline","text":""},{"location":"shader-outline/#introduction","title":"Introduction","text":"

    Outline post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-outline/#live-demos","title":"Live demos","text":"
    • Outline
    "},{"location":"shader-outline/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-outline/#install-plugin","title":"Install plugin","text":""},{"location":"shader-outline/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexoutlinepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexoutlinepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexoutlinepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexoutlinepipelineplugin').add(camera, config);\n
    "},{"location":"shader-outline/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import OutlinePipelinePlugin from 'phaser3-rex-plugins/plugins/outlinepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexOutlinePipeline',\nplugin: OutlinePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexOutlinePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexOutlinePipeline').add(camera, config);\n
    "},{"location":"shader-outline/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import OutlinePostFx from 'phaser3-rex-plugins/plugins/outlinepipeline.js';\nvar config = {\n// ...\npipeline: [OutlinePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(OutlinePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(OutlinePostFx);\n
    "},{"location":"shader-outline/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 outline effect.
      var pipelineInstance = scene.plugins.get('rexOutlinePipeline').add(gameObject, {\n// thickness: 3,\n// outlineColor: 0x000000,\n\n// quality: 0.1,\n\n// name: 'rexOutlinePostFx'\n});\n
      • thickness : Thickness of outline.
      • outlineColor : Color of outline.
      • quality : 0~1. The higher the number the less performant. It can't be changed after filter creation.
    • Apply effect to camera. A camera only can add 1 outline effect.
      var pipelineInstance = scene.plugins.get('rexOutlinePipeline').add(camera, config);\n
    "},{"location":"shader-outline/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexOutlinePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexOutlinePipeline').remove(camera);\n
    "},{"location":"shader-outline/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexOutlinePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexOutlinePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexOutlinePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexOutlinePipeline').get(camera);\n
    "},{"location":"shader-outline/#thickness","title":"Thickness","text":"
    • Get
      var thickness = pipelineInstance.thickness;\n
    • Set
      pipelineInstance.thickness = thickness;\n// pipelineInstance.thickness += value;\n
      or
      pipelineInstance.setThickness(value);\n
    "},{"location":"shader-outline/#outline-color","title":"Outline color","text":"
    • Get
      var color = pipelineInstance.outlineColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setOutlineColor(value);\n
      pipelineInstance.outlineColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-outline/#quality","title":"Quality","text":"

    The quality of the outline from 0 to 1, using a higher quality setting will result in slower performance and more accuracy.

    • Get
      var quality = pipelineInstance.quality;\n
    • Set
      pipelineInstance.setQuality(quality);\n
      or
      pipelineInstance.quality = quality;\n
      • quality : 0 ~ 1, default is 0.1.
        • 0.1 : 10 sample points.
        • 0.08 : 8 sample points.
        • 1 : 100 sample points.
    "},{"location":"shader-pixelation/","title":"Pixelation","text":"

    Note

    Phaser3.60 has a built-in pixelate effect.

    "},{"location":"shader-pixelation/#introduction","title":"Introduction","text":"

    Pixelation post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-pixelation/#live-demos","title":"Live demos","text":"
    • Pixelation
    "},{"location":"shader-pixelation/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-pixelation/#install-plugin","title":"Install plugin","text":""},{"location":"shader-pixelation/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexpixelationpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexpixelationpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexpixelationpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexpixelationpipelineplugin').add(camera, config);\n
    "},{"location":"shader-pixelation/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import PixelationPipelinePlugin from 'phaser3-rex-plugins/plugins/pixelationpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexPixelationPipeline',\nplugin: PixelationPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexPixelationPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexPixelationPipeline').add(camera, config);\n
    "},{"location":"shader-pixelation/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import PixelationPostFx from 'phaser3-rex-plugins/plugins/pixelationpipeline.js';\nvar config = {\n// ...\npipeline: [PixelationPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(PixelationPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(PixelationPostFx);\n
    "},{"location":"shader-pixelation/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 pixelation effect.
      var pipelineInstance = scene.plugins.get('rexPixelationPipeline').add(gameObject, {\n// pixelWidth: 0,\n// pixelHeight: 0,\n\n// name: 'rexPixelationPostFx'\n});\n
      • pixelWidth, pixelHeight : Pixel size.
    • Apply effect to camera. A camera only can add 1 pixelation effect.
      var pipelineInstance = scene.plugins.get('rexPixelationPipeline').add(camera, config);\n
    "},{"location":"shader-pixelation/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexPixelationPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexPixelationPipeline').remove(camera);\n
    "},{"location":"shader-pixelation/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexPixelationPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexPixelationPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexPixelationPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexPixelationPipeline').get(camera);\n
    "},{"location":"shader-pixelation/#pixel-size","title":"Pixel size","text":"
    • Get
      var pixelWidth = pipelineInstance.pixelWidth;\nvar pixelHeight = pipelineInstance.pixelHeight;\n
    • Set
      pipelineInstance.pixelWidth = pixelWidth;\npipelineInstance.pixelHeight = pixelHeight;\n// pipelineInstance.pixelWidth += value;\n// pipelineInstance.pixelHeight += value;\n
      or
      pipelineInstance.setPixelWidth(pixelWidth);\npipelineInstance.setPixelHeight(pixelHeight);\npipelineInstance.setPixelSize(pixelWidth, pixelHeight);\n
    "},{"location":"shader-shockwave/","title":"Shockwave","text":""},{"location":"shader-shockwave/#introduction","title":"Introduction","text":"

    Shockwave post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-shockwave/#live-demos","title":"Live demos","text":"
    • Shockwave
    "},{"location":"shader-shockwave/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-shockwave/#install-plugin","title":"Install plugin","text":""},{"location":"shader-shockwave/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshockwavepipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshockwavepipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexshockwavepipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexshockwavepipelineplugin').add(camera, config);\n
    "},{"location":"shader-shockwave/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ShockwavePipelinePlugin from 'phaser3-rex-plugins/plugins/shockwavepipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShockwavePipeline',\nplugin: ShockwavePipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexShockwavePipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexShockwavePipeline').add(camera, config);\n
    "},{"location":"shader-shockwave/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import ShockwavePostFx from 'phaser3-rex-plugins/plugins/shockwavepipeline.js';\nvar config = {\n// ...\npipeline: [ShockwavePostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(ShockwavePostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(ShockwavePostFx);\n
    "},{"location":"shader-shockwave/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 shockwave effect.
      var pipelineInstance = scene.plugins.get('rexShockwavePipeline').add(gameObject, {\n// center: {\n//    x: windowWidth / 2,\n//    y: windowHeight / 2\n//}\n// waveRadius: 0,\n// waveWidth: 20,\n// powBaseScale: 0.8,\n// powExponent: 0.1,\n\n// name: 'rexShockwavePostFx'\n});\n
      • waveRadius : Radius of shockwave, in pixels.
      • waveWidth : Width of shockwave, in pixels.
      • powBaseScale, powExponent : Parameters of shockwave.
    • Apply effect to camera. A camera only can add 1 shockwave effect.
      var pipelineInstance = scene.plugins.get('rexShockwavePipeline').add(camera, config);\n
    "},{"location":"shader-shockwave/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexShockwavePipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexShockwavePipeline').remove(camera);\n
    "},{"location":"shader-shockwave/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexShockwavePipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexShockwavePipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexShockwavePipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexShockwavePipeline').get(camera);\n
    "},{"location":"shader-shockwave/#wave-radius","title":"Wave radius","text":"
    • Get
      var waveRadius = pipelineInstance.waveRadius;\n
    • Set
      pipelineInstance.waveRadius = waveRadius;\n
      or
      pipelineInstance.setWaveRadius(waveRadius);\n
    "},{"location":"shader-shockwave/#wave-width","title":"Wave width","text":"
    • Get
      var waveWidth = pipelineInstance.waveWidth;\n
    • Set
      pipelineInstance.waveWidth = waveWidth;\n
      or
      pipelineInstance.setWaveWidth(waveWidth);\n
    "},{"location":"shader-split/","title":"Split","text":""},{"location":"shader-split/#introduction","title":"Introduction","text":"

    Split image into 4 parts.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-split/#live-demos","title":"Live demos","text":"
    • Split
    "},{"location":"shader-split/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-split/#install-plugin","title":"Install plugin","text":""},{"location":"shader-split/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexsplitpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexsplitpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexsplitpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexsplitpipelineplugin').add(camera, config);\n
    "},{"location":"shader-split/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SplitPipelinePlugin from 'phaser3-rex-plugins/plugins/splitpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSplitPipeline',\nplugin: SplitPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexSplitPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexSplitPipeline').add(camera, config);\n
    "},{"location":"shader-split/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import SplitPostFx from 'phaser3-rex-plugins/plugins/splitpipeline.js';\nvar config = {\n// ...\npipeline: [SplitPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(SplitPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(SplitPostFx);\n
    "},{"location":"shader-split/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 split effect.
      var pipelineInstance = scene.plugins.get('rexSplitPipeline').add(gameObject, {\n// x: undefined,  // renderer.width / 2\n// y: undefined,  // renderer.height / 2\n\n// width: undefined,\n// left: 0,\n// right: 0,\n// height: undefined,\n// top: 0,\n// bottom: 0,\n\n// angle: undefined,  // Degrees\n// rotation: 0,       // Radian\n\n// shiftEnable: true,\n\n// name: 'rexSplitPostFx'\n});\n
      • x : Vertical split position. Default value is center of render width.
      • y : Horizontal split position. Default value is center of render height.
      • width, height : Vertical/Horizontal split length.
      • left, right : Specify left/right part length of vertical split. Default value is half Vertical split length.
      • top, bottom : Specify top/bottom part length of horizontal split. Default value is half Horizontal split length.
      • angle, rotation : Rotation of split axis. Default value is 0.
      • shiftEnable :
        • true : Shift splitted parts out. Default value.
        • false : Don't shift splitted parts. Equal to apply mask on this image.
    • Apply effect to camera. A camera only can add 1 split effect.
      var pipelineInstance = scene.plugins.get('rexSplitPipeline').add(camera, config);\n
    "},{"location":"shader-split/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexSplitPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexSplitPipeline').remove(camera);\n
    "},{"location":"shader-split/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexSplitPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexSplitPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexSplitPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexSplitPipeline').get(camera);\n
    "},{"location":"shader-split/#split-position","title":"Split position","text":"
    • Get
      var splitX = pipelineInstance.splitX;\nvar splitY = pipelineInstance.splitY;\n
    • Set
      pipelineInstance.splitX = splitX;\npipelineInstance.splitY = splitY;\n
      or
      pipelineInstance.setSplit(x, y);\n
    "},{"location":"shader-split/#split-at-center-of-render","title":"Split at center of render","text":"
    pipelineInstance.splitAtCenter();\n// pipelineInstance.splitAtCenter(width, height);\n
    "},{"location":"shader-split/#split-length","title":"Split length","text":"
    • Get
      var splittedWidth = pipelineInstance.splittedWidth;\nvar splittedHeight = pipelineInstance.splittedHeight;\n
    • Set
      pipelineInstance.splittedWidth = splittedWidth;\npipelineInstance.splittedHeight = splittedHeight;\n
      or
      pipelineInstance.setSplittedWidth(splittedWidth);\npipelineInstance.setSplittedHeight(splittedHeight);\n

    or specify left/right/top/bottom of split length

    • Get
      var left = pipelineInstance.spaceLeft;\nvar right = pipelineInstance.spaceRight;\nvar top = pipelineInstance.spaceTop;\nvar bottom = pipelineInstance.spaceBottom;\n
    • Set
      pipelineInstance.spaceLeft = left;\npipelineInstance.spaceRight = right;\npipelineInstance.spaceTop = top;\npipelineInstance.spaceBottom = bottom;\n
      or
      pipelineInstance.setSpace(left, right, top, bottom);\n
    "},{"location":"shader-split/#rotation-axis-of-split-edge","title":"Rotation Axis of Split edge","text":"
    • Get
      var rotation = pipelineInstance.rotation;  // radians\n// var angle = pipelineInstance.angle;     // degrees\n
    • Set
      pipelineInstance.rotation = rotation;\npipelineInstance.rotation += value;\n// pipelineInstance.angle = angle;\n// pipelineInstance.angle += value;\n
      or
      pipelineInstance.setRotation(rotation);\n// pipelineInstance.setAngle(angle);\n
    "},{"location":"shader-split/#shift-enable","title":"Shift enable","text":"
    • Get
      var enable = pipelineInstance.shiftEnable;\n
    • Set
      pipelineInstance.shiftEnable = enable;\n
      or
      pipelineInstance.setShiftEnable(enable);\n
    "},{"location":"shader-swirl/","title":"Swirl","text":""},{"location":"shader-swirl/#introduction","title":"Introduction","text":"

    Swirl post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-swirl/#live-demos","title":"Live demos","text":"
    • Swirl
    "},{"location":"shader-swirl/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-swirl/#install-plugin","title":"Install plugin","text":""},{"location":"shader-swirl/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexswirlpipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexswirlpipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexswirlpipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexswirlpipelineplugin').add(camera, config);\n
    "},{"location":"shader-swirl/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SwirlPipelinePlugin from 'phaser3-rex-plugins/plugins/swirlpipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSwirlPipeline',\nplugin: SwirlPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexSwirlPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexSwirlPipeline').add(camera, config);\n
    "},{"location":"shader-swirl/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import SwirlPostFx from 'phaser3-rex-plugins/plugins/swirlpipeline.js';\nvar config = {\n// ...\npipeline: [SwirlPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(SwirlPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(SwirlPostFx);\n
    "},{"location":"shader-swirl/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 swirl effect.
      var pipelineInstance = scene.plugins.get('rexSwirlPipeline').add(gameObject, {\n// center: {\n//    x: windowWidth / 2,\n//    y: windowHeight / 2\n//}\n// radius: 0,\n// rotation: 0,  // or angle: 0,\n\n// name: 'rexSwirlPostFx'\n});\n
      • center.x, center.y : Local position of swirl center.
      • radius : Swirl radius.
      • rotation (angle) : Swirl angle.
    • Apply effect to camera. A camera only can add 1 swirl effect.
      var pipelineInstance = scene.plugins.get('rexSwirlPipeline').add(camera, config);\n
    "},{"location":"shader-swirl/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexSwirlPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexSwirlPipeline').remove(camera);\n
    "},{"location":"shader-swirl/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexSwirlPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexSwirlPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexSwirlPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexSwirlPipeline').get(camera);\n
    "},{"location":"shader-swirl/#radius","title":"Radius","text":"
    • Get
      var radius = pipelineInstance.radius;\n
    • Set
      pipelineInstance.radius = radius;\n// pipelineInstance.radius += value;\n
      or
      pipelineInstance.setRadius(radius);\n
    "},{"location":"shader-swirl/#rotation","title":"Rotation","text":"
    • Get
      var rotation = pipelineInstance.rotation;  // radians\n// var angle = pipelineInstance.angle;     // degrees\n
    • Set
      pipelineInstance.rotation = rotation;\npipelineInstance.rotation += value;\n// pipelineInstance.angle = angle;\n// pipelineInstance.angle += value;\n
      or
      pipelineInstance.setRotation(rotation);\n// pipelineInstance.setAngle(angle);\n
    "},{"location":"shader-swirl/#center-position","title":"Center position","text":"

    Default value is center of window.

    • Get
      var x = pipelineInstance.centerX;\nvar y = pipelineInstance.centerY;\n
    • Set
      pipelineInstance.centerX = x;\npipelineInstance.centerY = y;\n
      or
      pipelineInstance.setCenter(x, y);\n// pipelineInstance.setCenter();   // set to center of window\n
    "},{"location":"shader-toonify/","title":"Toonify","text":""},{"location":"shader-toonify/#introduction","title":"Introduction","text":"

    Draw outlines and quantize color in HSV domain, post processing filter. Reference

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-toonify/#live-demos","title":"Live demos","text":"
    • Toonify
    "},{"location":"shader-toonify/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-toonify/#install-plugin","title":"Install plugin","text":""},{"location":"shader-toonify/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextoonifypipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextoonifypipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rextoonifypipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rextoonifypipelineplugin').add(camera, config);\n
    "},{"location":"shader-toonify/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ToonifyPipelinePlugin from 'phaser3-rex-plugins/plugins/toonifypipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexToonifyPipeline',\nplugin: ToonifyPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexToonifyPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexToonifyPipeline').add(camera, config);\n
    "},{"location":"shader-toonify/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import ToonifyPostFx from 'phaser3-rex-plugins/plugins/toonifypipeline.js';\nvar config = {\n// ...\npipeline: [ToonifyPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(ToonifyPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(ToonifyPostFx);\n
    "},{"location":"shader-toonify/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 toonify effect.
      var pipelineInstance = scene.plugins.get('rexToonifyPipeline').add(gameObject, {\n// edgeThreshold: 0.2,\n// hueLevels: 0,\n// sLevels: 0,\n// vLevels: 0,\n// edgeColor: 0,\n\n// name: 'rexToonifyPostFx'\n});\n
      • edgeThreshold : Threshold of edge. Set 1.1 (or any number larger then 1) to disable this feature.
      • hueLevels : Amount of hue levels. Set 0 to disable this feature.
      • sLevels : Amount of saturation levels. Set 0 to disable this feature.
      • vLevels : Amount of value levels. Set 0 to disable this feature.
      • edgeColor : Color of edge, could be a number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    • Apply effect to camera. A camera only can add 1 toonify effect.
      var pipelineInstance = scene.plugins.get('rexToonifyPipeline').add(camera, config);\n
    "},{"location":"shader-toonify/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexToonifyPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexToonifyPipeline').remove(camera);\n
    "},{"location":"shader-toonify/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexToonifyPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexToonifyPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexToonifyPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexToonifyPipeline').get(camera);\n
    "},{"location":"shader-toonify/#edge-threshold","title":"Edge threshold","text":"
    • Get
      var edgeThreshold = pipelineInstance.edgeThreshold;\n
    • Set
      pipelineInstance.edgeThreshold = edgeThreshold;\n
      or
      pipelineInstance.setEdgeThreshold(value);\n
      • Set 1.1 (or any number larger then 1) to disable this feature.
    "},{"location":"shader-toonify/#hue-levels","title":"Hue levels","text":"
    • Get
      var hueLevels = pipelineInstance.hueLevels;\n
    • Set
      pipelineInstance.hueLevels = hueLevels;\n
      or
      pipelineInstance.setHueLevels(value);\n
      • Set 0 to disable this feature.
    "},{"location":"shader-toonify/#saturation-levels","title":"Saturation levels","text":"
    • Get
      var satLevels = pipelineInstance.satLevels;\n
    • Set
      pipelineInstance.satLevels = satLevels;\n
      or
      pipelineInstance.setSatLevels(value);\n
      • Set 0 to disable this feature.
    "},{"location":"shader-toonify/#value-levels","title":"Value levels","text":"
    • Get
      var valLevels = pipelineInstance.valLevels;\n
    • Set
      pipelineInstance.valLevels = valLevels;\n
      or
      pipelineInstance.setValLevels(value);\n
      • Set 0 to disable this feature.
    "},{"location":"shader-toonify/#edge-color","title":"Edge color","text":"
    • Get
      var color = pipelineInstance.edgeColor;\n
      • color : Color object.
        • Red: color.red, 0~255.
        • Green: color.green, 0~255.
        • Blue: color.blue, 0~255.
    • Set
      pipelineInstance.setEdgeColor(value);\n
      or
      pipelineInstance.edgeColor = value;\n
      • value : A number 0xRRGGBB, or a JSON object {r:255, g:255, b:255}
    "},{"location":"shader-warp-transition/","title":"Warp","text":""},{"location":"shader-warp-transition/#introduction","title":"Introduction","text":"

    Warp transition post processing filter.

    • Author: Richard Davey
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-warp-transition/#usage","title":"Usage","text":"

    Reference

    "},{"location":"shader-warp-transition/#install-plugin","title":"Install plugin","text":""},{"location":"shader-warp-transition/#import-class","title":"Import class","text":"
    • Get minify file from github
    • Add to game config
      import { WarpPostFX } from './dist/WarpPostFX.js';  // Path to your minify file\nvar config = {\n// ...\npipeline: { WarpPostFX }\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(WarpPostFX);\n
      • Apply effect to camera
        camera.setPostPipeline(WarpPostFX);\n
    "},{"location":"shader-warp-transition/#remove-effect","title":"Remove effect","text":"
    gameObject.removePostPipeline(WarpPostFX); // WarpPostFX class\n
    "},{"location":"shader-warp-transition/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = gameObject.getPostPipeline(WarpPostFX); // WarpPostFX class\n
    • Get effect from camera
      var pipelineInstance = camera.getPostPipeline(WarpPostFX); // WarpPostFX class\n
    "},{"location":"shader-warp-transition/#set-texture","title":"Set texture","text":"
    pipelineInstance.setTexture(textureKey, resizeMode);\n
    • textureKey : The key of the texture to use.
    • resizeMode :
      • 0, or 'stretch' : The target texture is stretched to the size of the source texture.
      • 1, or 'contain' : The target texture is resized to fit the source texture.
      • 2, or 'cover' : The target texture is resized to cover the source texture.
    "},{"location":"shader-warp-transition/#progress","title":"Progress","text":"
    • Get
      var progress = pipelineInstance.progress;\n
    • Set
      pipelineInstance.setProgress(value);  // value: 0~1\n
      or
      pipelineInstance.progress = value;  // value: 0~1\n
    "},{"location":"shader-warp-transition/#direction","title":"Direction","text":"
    • Get
      var direction = pipelineInstance.direction;  // {x, y}\n
      • Default value is {x:-1, y:1}
    • Set
      pipelineInstance.setDirection(x, y);  // x, y : 1, or -1\n
    "},{"location":"shader-warp-transition/#smoothness","title":"Smoothness","text":"
    • Get
      var smoothness = pipelineInstance.smoothness;\n
    • Set
      pipelineInstance.setSmoothness(value);  // value: 0~1\n
      or
      pipelineInstance.smoothness = value;  // value: 0~1\n
    "},{"location":"shader-warp-transition/#resize-mode","title":"Resize mode","text":"
    • Get
      var mode = pipelineInstance.resizeMode;\n
    • Set
      pipelineInstance.setResizeMode(mode);\n
      • mode :
        • 0, or 'stretch' : The target texture is stretched to the size of the source texture.
        • 1, or 'contain' : The target texture is resized to fit the source texture.
        • 2, or 'cover' : The target texture is resized to cover the source texture.
    "},{"location":"shader-warp/","title":"Warp","text":""},{"location":"shader-warp/#introduction","title":"Introduction","text":"

    Warp post processing filter.

    • Author: Rex
    • A post-fx shader effect

    WebGL only

    Only work in WebGL render mode.

    "},{"location":"shader-warp/#live-demos","title":"Live demos","text":"
    • Warp
    "},{"location":"shader-warp/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shader-warp/#install-plugin","title":"Install plugin","text":""},{"location":"shader-warp/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexwarppipelineplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexwarppipelineplugin.min.js', true);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexwarppipelineplugin').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexwarppipelineplugin').add(camera, config);\n
    "},{"location":"shader-warp/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import WarpPipelinePlugin from 'phaser3-rex-plugins/plugins/warppipeline-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexWarpPipeline',\nplugin: WarpPipelinePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        var pipelineInstance = scene.plugins.get('rexWarpPipeline').add(gameObject, config);\n
      • Apply effect to camera
        var pipelineInstance = scene.plugins.get('rexWarpPipeline').add(camera, config);\n
    "},{"location":"shader-warp/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Add to game config
      import WarpPostFx from 'phaser3-rex-plugins/plugins/warppipeline.js';\nvar config = {\n// ...\npipeline: [WarpPostFx]\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Apply effect
      • Apply effect to game object
        gameObject.setPostPipeline(WarpPostFx);\n
      • Apply effect to camera
        camera.setPostPipeline(WarpPostFx);\n
    "},{"location":"shader-warp/#apply-effect","title":"Apply effect","text":"
    • Apply effect to game object. A game object only can add 1 warp effect.

      var pipelineInstance = scene.plugins.get('rexWarpPipeline').add(gameObject, {\n// frequencyX: 10,\n// frequencyY: 10,\n\n// amplitudeX: 10,\n// amplitudeY: 10,\n\n// speedX: 0,\n// speedY: 0,\n// speedEnable: \n\n// name: 'rexWarpPostFx'\n});\n

      • frequencyX, frequencyY : Horizontal/vertical frequency, in pixel.
      • amplitudeX, amplitudeY : Horizontal/vertical amplitude, in pixel.
      • speedX, speedY : Horizontal/vertical speed.
      • speedEnable
        • true : Enable speed. Default value if speedX or speedY is not 0.
        • false : Disable speed. Default value if speedX and speedY are both 0.
    • Apply effect to camera. A camera only can add 1 warp effect.

      var pipelineInstance = scene.plugins.get('rexWarpPipeline').add(camera, config);\n

    "},{"location":"shader-warp/#remove-effect","title":"Remove effect","text":"
    • Remove effect from game object
      scene.plugins.get('rexWarpPipeline').remove(gameObject);\n
    • Remove effect from camera
      scene.plugins.get('rexWarpPipeline').remove(camera);\n
    "},{"location":"shader-warp/#get-effect","title":"Get effect","text":"
    • Get effect from game object
      var pipelineInstance = scene.plugins.get('rexWarpPipeline').get(gameObject)[0];\n// var pipelineInstances = scene.plugins.get('rexWarpPipeline').get(gameObject);\n
    • Get effect from camera
      var pipelineInstance = scene.plugins.get('rexWarpPipeline').get(camera)[0];\n// var pipelineInstances = scene.plugins.get('rexWarpPipeline').get(camera);\n
    "},{"location":"shader-warp/#frequency","title":"Frequency","text":"

    Horizontal/vertical frequency, in pixel.

    • Get
      var frequencyX = pipelineInstance.frequencyX;\nvar frequencyY = pipelineInstance.frequencyY;\n
    • Set
      pipelineInstance.frequencyX = frequencyX;\npipelineInstance.frequencyY = frequencyY;\n// pipelineInstance.frequencyX += value;\n// pipelineInstance.frequencyY += value;\n
      or
      pipelineInstance.setFrequencyX(frequencyX);\npipelineInstance.setFrequencyY(frequencyY);\npipelineInstance.setFrequency(frequencyX, frequencyY);\n
    "},{"location":"shader-warp/#amplitude","title":"Amplitude","text":"

    Horizontal/vertical amplitude, in pixel.

    • Get
      var amplitudeX = pipelineInstance.amplitudeX;\nvar amplitudeY = pipelineInstance.amplitudeY;\n
    • Set
      pipelineInstance.amplitudeX = amplitudeX;\npipelineInstance.amplitudeY = amplitudeY;\n// pipelineInstance.amplitudeX += value;\n// pipelineInstance.amplitudeY += value;\n
      or
      pipelineInstance.setAmplitudeX(amplitudeX);\npipelineInstance.setAmplitudeY(amplitudeY);\npipelineInstance.setAmplitude(amplitudeX, amplitudeY);\n
    "},{"location":"shader-warp/#speed","title":"Speed","text":"

    Horizontal/vertical speed.

    • Eanble/resume
      pipelineInstance.setSpeedEnable();\n
    • Pause
      pipelineInstance.setSpeedEnable(false);\n
    • Get
      var speedX = pipelineInstance.speedX;\nvar speedY = pipelineInstance.speedY;\n
    • Set
      pipelineInstance.speedX = speedX;\npipelineInstance.speedY = speedY;\n// pipelineInstance.speedX += value;\n// pipelineInstance.speedY += value;\n
      or
      pipelineInstance.setSpeedX(speedX);\npipelineInstance.setSpeedY(speedY);\npipelineInstance.setSpeed(speedX, speedY);\n
    "},{"location":"shader/","title":"Shader","text":""},{"location":"shader/#introduction","title":"Introduction","text":"

    A quad with its own shader, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shader/#usage","title":"Usage","text":""},{"location":"shader/#load-glsl","title":"Load GLSL","text":"
    scene.load.glsl(key, url);\n

    Reference: load glsl

    "},{"location":"shader/#add-shader-object","title":"Add shader object","text":"
    var shader = scene.add.shader(key, x, y, width, height, textures);\n
    • key : The key of the shader to use from the shader cache, or a BaseShader instance.
    • x, y : Position.
    • width, height : Size.
    • textures : Optional array of texture keys to bind to the iChannel0, iChannel1, iChannel2, iChannel3 uniforms.

    Note

    Lots of shaders expect textures to be power-of-two sized.

    Add shader object from JSON

    var shader = scene.make.shader({\nx: 0,\ny: 0,\nkey: '',\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    • key : The key of the shader to use from the shader cache, or a BaseShader instance.
      • A string
      • An array of string to pick one element at random
    • x, y, scale.x, scale.y :
      • A number
      • A callback to get return value
        function() { return 0; }\n
      • Random integer between min and max
        { randInt: [min, max] }\n
      • Random float between min and max
        { randFloat: [min, max] }\n
    "},{"location":"shader/#custom-class","title":"Custom class","text":"
    • Define class
      class MyShader extends Phaser.GameObjects.Shader {\nconstructor(scene, key, x, y, width, height, textures) {\nsuper(scene, key, x, y, width, height, textures);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var shader = new MyShader(scene, key, x, y, width, height, textures);\n
    "},{"location":"shader/#sampler2d-uniform","title":"Sampler2D uniform","text":"
    • Default uniform mappings :
      • resolution (2f) - Set to the size of this shader.
        • uniform vec2 resolution; in GLSL.
      • time (1f) - The elapsed game time, in seconds.
        • uniform float time; in GLSL.
      • mouse (2f) - If a pointer has been bound (with setPointer), this uniform contains its position each frame.
        • uniform vec2 mouse; in GLSL.
      • date (4fv) - A vec4 containing the year, month, day and time in seconds.
        • uniform vec4 date; in GLSL.
      • sampleRate (1f) - Sound sample rate. 44100 by default.
        • uniform float sampleRate; in GLSL.
      • iChannel0...3 (sampler2D) - Input channels 0 to 3. null by default. uniform sampler2D iChannel0; in GLSL.
    • Get uniform object
      var uniform = shader.getUniform(key);\n
      • Texture key
        var textureKey = uniform.textureKey;\n
      • Get texture key of iChannel0, iChannel1, iChannel2, iChannel3 sampler2D uniform.
        var textureKey = shader.getUniform('iChannel0').textureKey;\nvar textureKey = shader.getUniform('iChannel1').textureKey;\nvar textureKey = shader.getUniform('iChannel2').textureKey;\nvar textureKey = shader.getUniform('iChannel3').textureKey;\n
    • Sets a property of a uniform already present on this shader.
      shader.setUniform(key, value);\n
      • key : The key of the uniform to modify. Use dots for deep properties, i.e. resolution.value.x.
    • Sets a sampler2D uniform from texture manager.
      shader.setChannel0(textureKey);\nshader.setChannel1(textureKey);\nshader.setChannel2(textureKey);\nshader.setChannel3(textureKey);\n// shader.setChannel0(textureKey, textureData);\n// shader.setChannel1(textureKey, textureData);\n// shader.setChannel2(textureKey, textureData);\n// shader.setChannel3(textureKey, textureData);\n
      or
      shader.setSampler2D(uniformKey, textureKey, textureIndex);\n// shader.setSampler2D(uniformKey, textureKey, textureIndex, textureData);\n
      • uniformKey : 'iChannel0', 'iChannel1', 'iChannel2', or 'iChannel3'.
      • textureIndex : 0(for iChannel0), 1(for iChannel1), 2(for iChannel2), 3(for iChannel3).
      • textureData : Additional texture data.
      • textureKey: Key from the Texture Manager cache. It cannot be a single frame from a texture, only the full image. Lots of shaders expect textures to be power-of-two sized.
    • Sets a sampler2D uniform from a webgl texture.
      shader.setSampler2DBuffer(uniformKey, texture, width, height, textureIndex);\n// shader.setSampler2DBuffer(uniformKey, texture, width, height, textureIndex, textureData);\n
      • uniformKey : 'iChannel0', 'iChannel1', 'iChannel2', or 'iChannel3'.
      • width, height : The width, height of the texture.
      • textureIndex : 0(for iChannel0), 1(for iChannel1), 2(for iChannel2), 3(for iChannel3).
      • textureData : Additional texture data.
    "},{"location":"shader/#other-uniforms","title":"Other uniforms","text":"
    • mouse, a pointer parameter.
      • Get
        var pointer = shader.pointer;\n
      • Set
        shader.setPointer(pointer);\n
        • pointer : {x, y}
    • time, the elapsed game time, in seconds.
      • Get
        var time = shader.getUniform('time').value;\n// var time = shader.uniforms.time.value\n
      • Set
        shader.setUniform('time.value', time);\n
    "},{"location":"shader/#output","title":"Output","text":"
    • Render to Display list, by default.
    • Redirect render result to internal webgl texture.
      shader.setRenderToTexture();\nvar texture = shader.glTexture;\n
    • Redirect render result to internal webgl texture, and sample2D from buffer.
      shader.setRenderToTexture(undefined, true);\nvar texture = shader.glTexture;\n
    • Redirect render result to texture manager, for texture-based game object.
      shader.setRenderToTexture(textureKey);\n// var texture = shader.glTexture;\n
    • Redirect render result to texture manager, and Sample2D from buffer.
      shader.setRenderToTexture(textureKey, true);\n// var texture = shader.glTexture;\n
    "},{"location":"shader/#texture-routing","title":"Texture routing","text":"
    graph TB\n\nTextureManagerIn[\"Texture manager\"] --> |\"shader.setSampler2D()\"| Sampler2D[\"Samplers:<br>iChannel0<br>iChannel1<br>iChannel2<br>iChannel3\"]\nSampler2D--> Shader[\"shader<br>Shader game object\"]\nShader --> DisplayList[\"Display list\"]\nShader --> |\"shader.setRenderToTexture()\"| InternalTexture[\"shader.glTexture\"]\nInternalTexture -.-> |\"Texture key\"| TextureManagerOut[\"Texture manager\"]\nTextureManagerOut -.-> GameObject[\"Image game object\"]\nGameObject -.-> DisplayList\n\nWebGLTexture[\"WebGl texture<br>gameObject.glTexture\"] --> |\"shader.setSampler2DBuffer()\"| Sampler2D\nInternalTexture --> WebGLTexture\n\nsubgraph Output\nDisplayList\nGameObject\nTextureManagerOut\nend\n\nsubgraph Input\nTextureManagerIn\nWebGLTexture\nend
    "},{"location":"shader/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shader/#create-mask","title":"Create mask","text":"
    var mask = shader.createBitmapMask();\n

    See mask

    "},{"location":"shader/#baseshader","title":"BaseShader","text":"
    var baseShader = new Phaser.Display.BaseShader(key, fragmentSrc, vertexSrc, uniforms);\n
    • key : The key of this shader
    • fragmentSrc : The fragment source for the shader.
    • vertexSrc : The vertex source for the shader.
      • undefined, or '' : Use default vertex source.
    • uniforms : Optional object defining the uniforms the shader uses.
      {\nuniformName : {type: uniformType, value: initValue},\n...\n}\n
      • uniformName : Uniform name in fragment source.
      • uniformType, initValue : Type and initial value of uniform.
        • '1f' : initValue is a single float value.
          • Example : time: { type: '1f', value: 0 }
        • '2f' : initValue is float numbers {x, y}.
          • Example : resolution: { type: '2f', value: { x: this.width, y: this.height } }
        • '3f' : initValue is float numbers {x, y, z}.
          • Example : color: { type: '3f', value: {x: 0, y: 0, z: 0}}
        • '4f' : initValue is float numbers {x, y, z, w}.
    "},{"location":"shake-position/","title":"Shake position","text":""},{"location":"shake-position/#introduction","title":"Introduction","text":"

    Shake position of game object.

    • Author: Rex
    • Behavior of game object
    "},{"location":"shake-position/#live-demos","title":"Live demos","text":"
    • Shake position
    • Shake position on mutliple game objects
    "},{"location":"shake-position/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shake-position/#install-plugin","title":"Install plugin","text":""},{"location":"shake-position/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshakepositionplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshakepositionplugin.min.js', true);\n
    • Add shake-position behavior
      var shakePosition = scene.plugins.get('rexshakepositionplugin').add(gameObject, config);\n
    "},{"location":"shake-position/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ShakePositionPlugin from 'phaser3-rex-plugins/plugins/shakeposition-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShakePosition',\nplugin: ShakePositionPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shake-position behavior
      var shakePosition = scene.plugins.get('rexShakePosition').add(gameObject, config);\n
    "},{"location":"shake-position/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ShakePosition from 'phaser3-rex-plugins/plugins/shakeposition.js';\n
    • Add shake-position behavior
      var shakePosition = new ShakePosition(gameObject, config);\n
    "},{"location":"shake-position/#create-instance","title":"Create instance","text":"
    var shake = scene.plugins.get('rexShake').add(gameObject, {\n// mode: 1, // 0|'effect'|1|'behavior'\n// duration: 500,\n// magnitude: 10,\n// magnitudeMode: 1, // 0|'constant'|1|'decay'\n// axis: 0,      //0|'both'|'h&v'|1|'horizontal'|'h'|2|'vertical'|'v'\n});\n
    • mode :
      • 'effect', or 0 : Shake position in 'poststep' game event, and restore in 'prestep' game event.
      • 'behavior', or 1 : Shake position in 'preupdate' scene event.
    • duration : Duration of shaking, in millisecond.
    • magnitude : The strength of the shake, in pixels.
    • magnitudeMode :
      • 'constant', or 0 : Constant strength of the shake.
      • 'decay', or 1 : Decay the strength of the shake.
    • axis :
      • 'both','h&v', 'x&y', or 0 : Changing position on all directions.
      • 'horizontal','h', 'x', or 1 : Changing position on horizontal/x axis.
      • 'vertical','v', 'y', or 2 : Changing position on vertical/y axis.
    "},{"location":"shake-position/#start-shaking","title":"Start shaking","text":"
    shake.shake();\n// shake.shake(duration, magnitude);\n

    or

    shake.shake({\nduration: 500,\nmagnitude: 10\n});\n
    "},{"location":"shake-position/#stop-shakeing","title":"Stop shakeing","text":"
    shake.stop();\n
    "},{"location":"shake-position/#enable","title":"Enable","text":"
    • Enable/resume (default)
      shake.setEnable();\n
      or
      shake.enable = true;\n
    • Disable/pause
      shake.setEnable(false);\n
      or
      shake.enable = false;\n
    "},{"location":"shake-position/#set-updating-mode","title":"Set updating mode","text":"
    shake.setMode(mode);\n
    • mode :
      • 'effect', or 0 : Shake position in post-update stage, and restore in pre-update stage.
      • 'behavior', or 1 : Shake position in pre-update stage.
    "},{"location":"shake-position/#set-duration","title":"Set duration","text":"
    shake.setDuration(duration);\n// shake.duration = duration;\n
    "},{"location":"shake-position/#set-magnitude","title":"Set magnitude","text":"
    shake.setMagnitude(magnitude);\nshake.magnitude = magnitude;\n
    • magnitude : The strength of the shake, in pixels.
    "},{"location":"shake-position/#set-magnitude-mode","title":"Set magnitude mode","text":"
    shake.setMagnitudeMode(magnitudeMode);\n// shake.magnitudeMode = magnitudeMode;\n
    • magnitudeMode :
      • 'constant', or 0 : Constant strength of the shake.
      • 'decay', or 1 : Decay the strength of the shake.
    "},{"location":"shake-position/#set-axis-mode","title":"Set axis mode","text":"
    shake.setAxisMode(axis);\n
    • axis :
      • 'both','h&v', 'x&y', or 0 : Dragging on all directions.
      • 'horizontal','h', 'x', or 1 : Dragging on horizontal/x axis.
      • 'vertical','v', 'y', or 2 : Dragging on vertical/y axis.
    "},{"location":"shake-position/#events","title":"Events","text":"
    • On reached target
      shake.on('complete', function(gameObject, shake){});\n
    "},{"location":"shake-position/#status","title":"Status","text":"
    • Is shakeing
      var isRunning = shake.isRunning;\n
    "},{"location":"shape-arc/","title":"Arc","text":""},{"location":"shape-arc/#introduction","title":"Introduction","text":"

    Arc shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-arc/#usage","title":"Usage","text":""},{"location":"shape-arc/#create-shape","title":"Create shape","text":"
    var arc = scene.add.arc(x, y, radius, startAngle, endAngle, anticlockwise, fillColor);\n// var arc = scene.add.arc(x, y, radius, startAngle, endAngle, anticlockwise, fillColor, fillAlpha);\n
    "},{"location":"shape-arc/#custom-class","title":"Custom class","text":"
    • Define class
      class MyArc extends Phaser.GameObjects.Arc {\nconstructor(scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor) {\nsuper(scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var arc = new MyArc(scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor);\n
    "},{"location":"shape-arc/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = arc.fillColor;\nvar alpha = arc.fillAlpha;\n
      • Set
        arc.setFillStyle(color, alpha);\n
      • Clear
        arc.setFillStyle();\n
    • Stroke color
      • Get
        var color = arc.strokeColor;\n
      • Set
        arc.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        arc.setStrokeStyle();\n

    No tint methods

    Uses arc.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-arc/#alpha","title":"Alpha","text":"
    • Get
      var alpha = arc.alpha;\n
    • Set
      arc.setAlpha(alpha);\n// arc.alpha = alpha;\n
    "},{"location":"shape-arc/#angle","title":"Angle","text":"
    • Start angle, in degrees.
      • Get
        var startAngle = arc.startAngle;\n
      • Set
        arc.setStartAngle(startAngle);\n// arc.setStartAngle(startAngle, anticlockwise);\n
        or
        arc.startAngle = startAngle;\n
    • End angle, in degrees.
      • Get
        var endAngle = arc.endAngle;\n
      • Set
        arc.seEndAngle(endAngle);\n
        or
        arc.endAngle = endAngle;\n
    • Anticlockwise (true, or false)
      • Get
        var anticlockwise = arc.anticlockwise;\n
      • Set
        arc.anticlockwise = anticlockwise;\n
    "},{"location":"shape-arc/#radius","title":"Radius","text":"
    • Radius
      • Get
        var radius = arc.radius;\n
      • Set
        arc.setRadius(radius);\n
        or
        arc.radius = radius;\n
    • Iterations: Increase this value for smoother arcs, at the cost of more polygons being rendered. Default is 0.01
      • Get
        var iterations = arc.iterations;\n
      • Set
        arc.iterations = iterations;\n
    "},{"location":"shape-arc/#display-size","title":"Display size","text":"
    • Get
      var width = arc.displayWidth;\nvar height = arc.displayHeight;\n
    • Set
      arc.setDisplaySize(width, height);\n
      or
      arc.displayWidth = width;\narc.displayHeight = height;\n
    "},{"location":"shape-arc/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-arc/#create-mask","title":"Create mask","text":"
    var mask = arc.createGeometryMask();\n

    See mask

    "},{"location":"shape-arc/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-checkbox/","title":"Checkbox","text":""},{"location":"shape-checkbox/#introduction","title":"Introduction","text":"

    Checkbox input with drawing checker path animation.

    • Author: Rex
    • Game object
    "},{"location":"shape-checkbox/#live-demos","title":"Live demos","text":"
    • Checkbox
    "},{"location":"shape-checkbox/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-checkbox/#install-plugin","title":"Install plugin","text":""},{"location":"shape-checkbox/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcheckboxplugin', 'https://raw.githubusercontent.com/rexrainbow/    phaser3-rex-notes/master/dist/rexcheckboxplugin.min.js', true);\n
    • Add checkbox input
      var checkbox = scene.add.rexCheckbox(x, y, width, height, color, config);\n
    • Add checkbox shape (without click input)
      var checkbox = scene.add.rexCheckboxShape(x, y, width, height, color, config);\n
    "},{"location":"shape-checkbox/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CheckboxPlugin from 'phaser3-rex-plugins/plugins/checkbox-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCheckboxPlugin',\nplugin: CheckboxPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add checkbox input
      var checkbox = scene.add.rexCheckbox(x, y, width, height, color, config);\n
    • Add checkbox shape (without click input)
      var checkbox = scene.add.rexCheckboxShape(x, y, width, height, color, config);\n
    "},{"location":"shape-checkbox/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Checkbox from 'phaser3-rex-plugins/plugins/checkbox.js';\n
    • Add checkbox input
      var checkbox = new Checkbox(scene, x, y, width, height, color, config);\nscene.add.existing(checkbox);\n
    • Add checkbox shape (without click input)
      // import CheckboxShape from 'phaser3-rex-plugins/plugins/checkboxshape.js';\nvar checkbox = new CheckboxShape(scene, x, y, width, height, color, config);\nscene.add.existing(checkbox);\n
    "},{"location":"shape-checkbox/#create-checkbox-input","title":"Create checkbox input","text":"
    var checkbox = scene.add.rexCheckbox(x, y, width, height, color, config);\n

    or

    var checkbox = scene.add.rexCheckbox({\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\ncolor: 0x005cb2,\nboxFillAlpha: 1,\nuncheckedColor: null,\nuncheckedBoxFillAlpha: 1,\n\nboxLineWidth: 4,\nboxStrokeColor: 0x005cb2,\nboxStrokeAlpha: 1,\nuncheckedBoxStrokeColor: 0x005cb2,\nuncheckedBoxStrokeAlpha: 1,\n\ncheckerColor: 0xffffff,\ncheckerAlpha: 1,\n\n// boxSize: 1,\n// checkerSize: 1,\n\ncircleBox: false,\n\nanimationDuration: 150,\n\nchecked: false, // or value: false,\n\nclick: undefined,\n// click: {\n//     mode: 1,            // 0|'press'|1|'release'\n//     clickInterval: 100  // ms\n//     threshold: undefined\n// },\nreadOnly: false,\n});\n
    • width, height : Size of checkbox.
    • Box fill style
      • color, boxFillAlpha : Box color and alpha of checked
      • uncheckedColor, uncheckedBoxFillAlpha : Box color and alpha of unchecked
    • Box stroke style
      • boxLineWidth, boxStrokeColor, boxStrokeAlpha : Box stroke color and alpha of checked.
      • uncheckedBoxStrokeColor, uncheckedBoxStrokeAlpha : Box stroke color and alpha of unchecked.
    • Checker style
      • checkerColor, checkerAlpha : Checker color and alpha
    • circleBox : Shape of box
      • false : Rectangle shape box. Default behavior.
      • true : Circle shape box
    • boxSize, checkerSize : Size ratio of box, and checker. Default value is 1.
    • animationDuration : Duration of drawing path of checker.
    • checked : Initial value of checked.
    • click : Configuration of click input
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
      • click.threshold : Cancel clicking detecting when dragging distance is larger then this threshold.
        • undefined : Ignore this feature. Default behavior.
    • readOnly : Set ture to disable input.
    "},{"location":"shape-checkbox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCheckbox extends RexPlugins.GameObjects.Checkbox {\nconstructor(scene, x, y, width, height, color, config) {\nsuper(scene, x, y, width, height, color, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var checkbox = new MyCheckbox(scene, x, y, width, height, color, config);\n
    "},{"location":"shape-checkbox/#check","title":"Check","text":"
    • Get
      var checked = checkbox.checked;\n// var checked = checkbox.value;\n
    • Set
      • Check
        checkbox.setChecked();\n// checkbox.setChecked(true);\n// checkbox.setValue(true);\n
        or
        checkbox.checked = true;\n// checkbox.value = true;\n
      • Uncheck
        checkbox.setChecked(false);\n// checkbox.setValue(false);\n
        or
        checkbox.checked = false;\n// checkbox.value = false;\n
      • Toggle
        checkbox.toggleChecked();\n// checkbox.setValue(!checkbox.checked);\n
        or
        checkbox.checked = !checkbox.checked;\n// checkbox.value = !checkbox.value;\n
    "},{"location":"shape-checkbox/#read-only","title":"Read only","text":"
    • Get
      var readOnly = checkbox.readOnly;\n
    • Set
      checkbox.setReadOnly();\n// checkbox.setReadOnly(true);\n
      or
      checkbox.readOnly = true;\n
    "},{"location":"shape-checkbox/#box-fill-style","title":"Box fill style","text":"
    • Get
      var color = checkbox.boxFillColor;\nvar alpha = checkbox.boxFillAlpha;\n
      var color = checkbox.uncheckedBoxFillColor;\nvar alpha = checkbox.uncheckedBoxFillAlpha;\n
    • Set
      checkbox.setBoxFillStyle(color, alpha);\n// checkbox.boxFillColor = color;\n// checkbox.boxFillAlpha = alpha;\n
      checkbox.setUncheckedBoxFillStyle(color, alpha);\n// checkbox.uncheckedBoxFillColor = color;\n// checkbox.uncheckedBoxFillAlpha = alpha;\n
    "},{"location":"shape-checkbox/#box-stroke-style","title":"Box stroke style","text":"
    • Get
      var lineWidth = checkbox.boxLineWidth;\nvar color = checkbox.boxStrokeColor;\nvar alpah = checkbox.boxStrokeAlpha;\n
      var lineWidth = checkbox.uncheckedBoxLineWidth;\nvar color = checkbox.uncheckedBoxStrokeColor;\nvar alpah = checkbox.uncheckedBoxStrokeAlpha;\n
    • Set
      checkbox.setBoxStrokeStyle(lineWidth, color, alpha);\n// checkbox.boxLineWidth = lineWidth;\n// checkbox.boxStrokeColor = color;\n// checkbox.boxStrokeAlpha = alpha;\n
      checkbox.setUncheckedBoxStrokeStyle(lineWidth, color, alpha);\n// checkbox.uncheckedBoxLineWidth = lineWidth;\n// checkbox.uncheckedBoxStrokeColor = color;\n// checkbox.uncheckedBoxStrokeAlpha = alpha;\n
    "},{"location":"shape-checkbox/#checker-style","title":"Checker style","text":"
    • Get
      var color = checkbox.checkerColor;\nvar alpha = checkbox.checkAlpha;\n
    • Set
      checkbox.setCheckerStyle(color, alpha);\n// checkbox.checkerColor = color;\n// checkbox.checkAlpha = alpha;\n
    "},{"location":"shape-checkbox/#checker-animation","title":"Checker animation","text":"
    • Duration
      • Get
        var duration = checkbox.checkerAnimDuration;\n
      • Set
        checkbox.setCheckerAnimDuration(duration);\ncheckbox.checkerAnimDuration = duration;\n
    "},{"location":"shape-checkbox/#size","title":"Size","text":"
    • Get
      var width = checkbox.width;\nvar height = checkbox.height;\n
    • Set
      checkbox.setSize(width, height);\n
      or
      checkbox.width = width;\ncheckbox.height = height;\n
    "},{"location":"shape-checkbox/#display-size","title":"Display size","text":"
    • Get
      var width = checkbox.displayWidth;\nvar height = checkbox.displayHeight;\n
    • Set
      checkbox.setDisplaySize(width, height);\n
      or
      checkbox.displayWidth = width;\ncheckbox.displayHeight = height;\n
    "},{"location":"shape-checkbox/#size-ratio","title":"Size ratio","text":"
    • Get
      var boxSize = checkbox.boxSize;\nvar checkerSize =checkbox.checkerSize;\n
      • boxSize, checkerSize : Size ratio of box, and checker
    • Set
      checkbox.setBoxSize(sizeRatio);\ncheckbox.setCheckerSize(sizeRatio);\n
    "},{"location":"shape-checkbox/#events","title":"Events","text":"
    • On value change
      checkbox.on('valuechange', function(value) {\n// value: checked\n})\n
    "},{"location":"shape-checkbox/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-checkbox/#create-mask","title":"Create mask","text":"
    var mask = checkbox.createGeometryMask();\n

    See mask

    "},{"location":"shape-checkbox/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-circle/","title":"Circle","text":""},{"location":"shape-circle/#introduction","title":"Introduction","text":"

    Circle shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-circle/#usage","title":"Usage","text":""},{"location":"shape-circle/#create-shape-object","title":"Create shape object","text":"
    var circle = scene.add.circle(x, y, radius, fillColor);\n// var circle = scene.add.circle(x, y, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-circle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCircle extends Phaser.GameObjects.Arc {\nconstructor(scene, x, y, radius, fillColor, fillAlpha) {\nsuper(scene, x, y, radius, 0, 360, false, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var circle = new MyCircle(scene, x, y, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-circle/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = circle.fillColor;\nvar alpha = circle.fillAlpha;\n
      • Set
        circle.setFillStyle(color, alpha);\n
      • Clear
        circle.setFillStyle();\n
    • Stroke color
      • Get
        var color = circle.strokeColor;\n
      • Set
        circle.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        circle.setStrokeStyle();\n

    No tint methods

    Uses circle.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-circle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = circle.alpha;\n
    • Set
      circle.setAlpha(alpha);\n// circle.alpha = alpha;\n
    "},{"location":"shape-circle/#radius","title":"Radius","text":"
    • Radius
      • Get
        var radius = circle.radius;\n
      • Set
        circle.setRadius(radius);\n
        or
        circle.radius = radius;\n
    • Iterations: Increase this value for smoother arcs, at the cost of more polygons being rendered. Default is 0.01
      • Get
        var iterations = circle.iterations;\n
      • Set
        circle.iterations = iterations;\n
    "},{"location":"shape-circle/#display-size","title":"Display size","text":"
    • Get
      var width = circle.displayWidth;\nvar height = circle.displayHeight;\n
    • Set
      circle.setDisplaySize(width, height);\n
      or
      circle.displayWidth = width;\ncircle.displayHeight = height;\n
    "},{"location":"shape-circle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-circle/#create-mask","title":"Create mask","text":"
    var mask = circle.createGeometryMask();\n

    See mask

    "},{"location":"shape-circle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-circularprogress/","title":"Circular progress","text":""},{"location":"shape-circularprogress/#introduction","title":"Introduction","text":"

    Circular progress bar shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-circularprogress/#live-demos","title":"Live demos","text":"
    • Circular-progress
    • Pie bar
    "},{"location":"shape-circularprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-circularprogress/#install-plugin","title":"Install plugin","text":""},{"location":"shape-circularprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcircularprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcircularprogressplugin.min.js', true);\n
    • Add circular-progress object
      var circularProgress = scene.add.rexCircularProgress(x, y, radius, color, value, config);\n
    "},{"location":"shape-circularprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CircularProgressPlugin from 'phaser3-rex-plugins/plugins/circularprogress-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircularProgressPlugin',\nplugin: CircularProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add circular-progress object
      var circularProgress = scene.add.rexCircularProgress(x, y, radius, color, value, config);\n
    "},{"location":"shape-circularprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CircularProgress from 'phaser3-rex-plugins/plugins/circularprogress.js';\n
    • Add circular-progress object
      var circularProgress = new CircularProgress(scene, x, y, radius, color, value, config);\nscene.add.existing(image);\n
    "},{"location":"shape-circularprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCircularProgressPlugin',\nplugin: CircularProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"shape-circularprogress/#create-instance","title":"Create instance","text":"
    var circularProgress = scene.add.rexCircularProgress(x, y, radius, barColor, value, {    trackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nanticlockwise: false,\n// iterations: 128,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n

    or

    var circularProgress = scene.add.rexCircularProgress({\nx: 0,\ny: 0,\nradius: 1,\n\nbarColor: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nanticlockwise: false,\n// iterations: 128,\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},  });\n
    • x, y : Position of this object.
    • radius : Radius of this circle. Size will be (radius*2, radius*2).
    • barColor : Color of circular bar, in number or css string value.
    • trackColor : Color of circular track, in number or css string value.
    • centerColor : Color of center circle, in number or css string value.
    • thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
    • startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
    • anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
    • iterations : Iterations of curve, set larger value to get more smooth rendering result. Default value is 128.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, circularProgress) {\n}\n

    Add circular-progress from JSON

    var circularProgress = scene.make.rexCircularProgress({\nx: 0,\ny: 0,\nradius: 1,\n\nbarColor: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nanticlockwise: false,\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},  add: true\n});\n
    "},{"location":"shape-circularprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCircularProgress extends CircularProgress {\nconstructor(scene, x, y, radius, color, value, config) {\nsuper(scene, x, y, radius, color, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var circularProgress = new MyCircularProgress(scene, x, y, radius, color, value, config);\n
    "},{"location":"shape-circularprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = circularProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = circularProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = circularProgress.value; // value: 0 ~ 1\n
    • Set value
      circularProgress.setValue(value, min, max); // value: min ~ max\n
      or
      circularProgress.setValue(value); // value: 0 ~ 1\n
      or
      circularProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      circularProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      circularProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      circularProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"shape-circularprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      circularProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      circularProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      circularProgress.stopEaseValue();\n
    • Set ease duration
      circularProgress.setEaseValueDuration(duration);\n
    • Set ease function
      circularProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"shape-circularprogress/#radius","title":"Radius","text":"
    • Get
      var radius = circularProgress.radius;\n
    • Set
      circularProgress.setRadius(radius);\n// circularProgress.radius = radius;\n
      • Also resize this game object to (radius*2, radius*2)
    "},{"location":"shape-circularprogress/#circular-track","title":"Circular track","text":"
    • Color
      • Get
        var trackColor = circularProgress.trackColor;\n
      • Set
        circularProgress.setTrackColor(trackColor);\n// circularProgress.trackColor = trackColor;\n
    • Thickness : radius*thickness
      circularProgress.setThickness(thickness);\n
      • thickness : 0~1.
    "},{"location":"shape-circularprogress/#circular-bar","title":"Circular bar","text":"
    • Color
      • Get
        var barColor = circularProgress.barColor;\n
      • Set
        circularProgress.setBarColor(barColor);\n// circularProgress.barColor = barColor;\n
    • Thickness : radius*thickness
      circularProgress.setThickness(thickness);\n
      • thickness : 0~1.
    • Start angle
      • Get
        var startAngle = circularProgress.startAngle;\n
      • Set
        circularProgress.setStartAngle(startAngle);\ncircularProgress.startAngle = startAngle;\n
        • startAngle : Start angle of circular bar, in radians.
    • Anticlockwise
      • Get
        var anticlockwise = circularProgress.anticlockwise;\n
      • Set
        circularProgress.setAnticlockwise(anticlockwise);\n// circularProgress.anticlockwise = anticlockwise;\n
    "},{"location":"shape-circularprogress/#center-circle","title":"Center circle","text":"
    • Color
      • Get
        var centerColor = circularProgress.centerColor;\n
      • Set
        circularProgress.setCenterColor(centerColor);\n// circularProgress.centerColor = centerColor;\n
    "},{"location":"shape-circularprogress/#events","title":"Events","text":"
    • On value changed
      circularProgress.on('valuechange', function(newValue, oldValue, circularProgress){\n//\n}, scope);\n
    "},{"location":"shape-circularprogress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = circularProgress.alpha;\n
    • Set
      circularProgress.setAlpha(alpha);\n// circularProgress.alpha = alpha;\n
    "},{"location":"shape-circularprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-circularprogress/#create-mask","title":"Create mask","text":"
    var mask = circularProgress.createGeometryMask();\n

    See mask

    "},{"location":"shape-circularprogress/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-circularprogress/#compare-with-circular-progress-canvas","title":"Compare with Circular-progress canvas","text":"
    • Circular-progress canvas creates a canvas then draw on that canvas, circular progress shape draw on GRAPHICS pipeline like Shape or Graphics game object.
    • Circular-progress canvas can draw text directly, circular progress shape can't draw any text.
    "},{"location":"shape-cover/","title":"Cover","text":""},{"location":"shape-cover/#introduction","title":"Introduction","text":"

    Rectangle shape covered full window, and block all touch events.

    • Author: Rex
    • Game object
    "},{"location":"shape-cover/#live-demos","title":"Live demos","text":"
    • Cover
    "},{"location":"shape-cover/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-cover/#install-plugin","title":"Install plugin","text":""},{"location":"shape-cover/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcoverplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcoverplugin.min.js', true);\n
    • Add cover object
      var cover = scene.add.rexCover(config);\n
    "},{"location":"shape-cover/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CoverPlugin from 'phaser3-rex-plugins/plugins/cover-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCoverPlugin',\nplugin: CoverPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add cover object
      var cover = scene.add.rexCover(config);\n
    "},{"location":"shape-cover/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Cover from 'phaser3-rex-plugins/plugins/cover.js';\n
    • Add cover object
      var cover = new Cover(scene, config);\nscene.add.existing(cover);\n
    "},{"location":"shape-cover/#create-cover-object","title":"Create cover object","text":"
    var cover = scene.add.rexCover({\n// color: 0x0,\n// alpha: 0.8\n});\n
    • color : Color of cover.
    • alpha : Alpha value of cover.
    "},{"location":"shape-cover/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCover extends RexPlugins.GameObjects.Cover {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var cover = new MyCover(scene, config);\n
    "},{"location":"shape-cover/#color","title":"Color","text":"
    • Tint
      • Get
        var tint = cover.tint;\n
      • Set
        cover.tint = tint;\n
    • Alpha
      • Get
        var alpha = cover.alpha;\n
      • Set
        cover.alpha = alpha;\n
    • Fill color
      • Get
        var color = cover.fillColor;\nvar alpha = cover.fillAlpha;\n
      • Set
        cover.setFillStyle(color, alpha);\n
      • Clear
        cover.setFillStyle();\n
    "},{"location":"shape-cover/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-cover/#create-mask","title":"Create mask","text":"
    var mask = cover.createGeometryMask();\n

    See mask

    "},{"location":"shape-cover/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-curve/","title":"Curve","text":""},{"location":"shape-curve/#introduction","title":"Introduction","text":"

    Curve shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-curve/#usage","title":"Usage","text":""},{"location":"shape-curve/#create-shape-object","title":"Create shape object","text":"
    var curve = scene.add.curve(x, y, path, fillColor);\n// var curve = scene.add.curve(x, y, path, fillColor, fillAlpha);\n
    • path : Path object.
    "},{"location":"shape-curve/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCurve extends Phaser.GameObjects.Curve {\nconstructor(scene, x, y, path, fillColor, fillAlpha) {\nsuper(scene, x, y, path, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var curve = new MyCurve(scene, x, y, path, fillColor, fillAlpha);\n
    "},{"location":"shape-curve/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = curve.fillColor;\nvar alpha = curve.fillAlpha;\n
      • Set
        curve.setFillStyle(color, alpha);\n
      • Clear
        curve.setFillStyle();\n
    • Stroke color
      • Get
        var color = curve.strokeColor;\n
      • Set
        curve.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        curve.setStrokeStyle();\n

    No tint methods

    Uses curve.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-curve/#alpha","title":"Alpha","text":"
    • Get
      var alpha = curve.alpha;\n
    • Set
      curve.setAlpha(alpha);\n// curve.alpha = alpha;\n
    "},{"location":"shape-curve/#smoothness","title":"Smoothness","text":"

    The number of points used when rendering it. Increase this value for smoother curves, at the cost of more polygons being rendered.

    curve.setSmoothness(smoothness);\n
    or
    curve.smoothness = smoothness;\n

    "},{"location":"shape-curve/#display-size","title":"Display size","text":"
    • Get
      var width = curve.displayWidth;\nvar height = curve.displayHeight;\n
    • Set
      curve.setDisplaySize(width, height);\n
      or
      curve.displayWidth = width;\ncurve.displayHeight = height;\n
    "},{"location":"shape-curve/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-curve/#create-mask","title":"Create mask","text":"
    var mask = curve.createGeometryMask();\n

    See mask

    "},{"location":"shape-curve/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-custom-progress/","title":"Custom progress","text":""},{"location":"shape-custom-progress/#introduction","title":"Introduction","text":"

    Custom progress bar based on custom-shapes.

    • Author: Rex
    • Game object
    "},{"location":"shape-custom-progress/#live-demos","title":"Live demos","text":"
    • React-circle-progress-bar
    • Round rectangle
    • Orb
    • Trapezoid Mask
    • Round rectangles mask
    • Slash effect with rexUI
    • Path segment animation
    "},{"location":"shape-custom-progress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-custom-progress/#install-plugin","title":"Install plugin","text":""},{"location":"shape-custom-progress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcustomprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcustomprogressplugin.min.js', true);\n
    • Add custom shapes object
      var customProgress = scene.add.rexCustomProgress(x, y, width, height, config);\n
    "},{"location":"shape-custom-progress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CustomProgressPlugin from 'phaser3-rex-plugins/plugins/customprogress-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCustomProgressPlugin',\nplugin: CustomProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add custom shapes object
      var customProgress = scene.add.rexCustomProgress(x, y, width, height, config);\n
    "},{"location":"shape-custom-progress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CustomProgress from 'phaser3-rex-plugins/plugins/bbcodetext.js';\n
    • Add custom shapes object
      var customProgress = new CustomProgress(scene, x, y, width, height, config);\nscene.add.existing(customProgress);\n
    "},{"location":"shape-custom-progress/#add-custom-shapes-object","title":"Add custom shapes object","text":"
    var customProgress = scene.add.rexCustomProgress(x, y, width, height, {\n// type: 'rexCustomProgress',\n\ncreate: [\n{ name: name0, type: shapeType},\n{ name: name1, type: shapeType},\n...\n],\n\n// create: {\n//     shapeType: [name0, name1, ...],\n//     shapeType: number,\n//     shapeType: name,\n// },\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n

    or

    var customProgress = scene.add.rexCustomProgress({\n// x: 0,\n// y: 0,\n// width: 64,\n// height: 64,\n// type: 'rexCustomProgress',\n\ncreate: [\n{ name: name0, type: shapeType},\n{ name: name1, type: shapeType},\n...\n],\n\n// create: {\n//     shapeType: [name0, name1, ...],\n//     shapeType: number,\n//     shapeType: name,\n// },\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n\nvalue: 0,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\n\nvaluechangeCallback: function(newValue, oldValue, circularProgress) {\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • create : Callback to create shapes
      • An array of object with name and type
        { name: name0, type: shapeType }\n
        • shapeType :
          • 'arc' : Create Arc shape.
          • 'circle' : Create Circle shape.
          • 'ellipse' : Create Ellipse shape.
          • 'line' : Create Line shape.
          • 'lines' : Create Lines shape.
          • 'rectangle' : Create Rectangle shape.
          • 'roundRectangle' : Create Round rectangle shape.
          • 'triangle' : Create Triangle shape.
      • A plain object with shapeType: name, or shapeType: number
        • shapeType : arc, circle, ellipse, line, rectangle, triangle
        • nameArray : An array of unique string name for each shape.
        • name : An unique string name of this shape.
        • number : Amount of shapes to create.
      • A callback
        function() {\n// this : This custom shapes game object\nvar shape = this.createShape(shapeType, name);\nthis.addShape(shape);\n}\n
        • this.createShape(shapeType, name) : Crate a shape instance, with an unique name.
        • this.addShape(shape) : Add this shape instance to this custom custom shapes.
    • update : Callback when refresh
      function() {\n// this : This custom shapes game object     \nvar shapes = this.getShapes();\nvar shape = this.getShape(name);\n// ...\n// var isSizeChanged = this.isSizeChanged;\n\n// var fillColor = this.fillColor;\n// var fillAlpha = this.fillAlpha;\n// var lineWidth = this.lineWidth;\n// var strokeColor = this.strokeColor;\n// var strokeAlpha = this.strokeAlpha;\n// ...\n// var value = this.value;\n}\n
      • Shape instances : Change properties of shape instances.
        • this.getShapes() : Return all shapes in an array.
        • this.getShape(name) : Return a shape by the unique string name.
      • Is size changed : this.isSizeChanged
      • Fill style : this.fillColor, this.fillAlpha
      • Stroke style : this.strokeColor, this.strokeAlpha, this.lineWidth
      • Current progress value : this.value
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, customProgress) {\n}\n
    "},{"location":"shape-custom-progress/#set-update-shape-callback","title":"Set update shape callback","text":"

    See Shape class

    "},{"location":"shape-custom-progress/#size","title":"Size","text":"

    See Size

    "},{"location":"shape-custom-progress/#styles","title":"Styles","text":"

    See Styles

    "},{"location":"shape-custom-progress/#recreate-shapes","title":"Recreate shapes","text":"

    See Shape class

    "},{"location":"shape-custom-progress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = customProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = customProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = customProgress.value; // value: 0 ~ 1\n
    • Set value
      customProgress.setValue(value, min, max); // value: min ~ max\n
      or
      customProgress.setValue(value); // value: 0 ~ 1\n
      or
      customProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      customProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      customProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      customProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"shape-custom-progress/#ease-progress-value","title":"Ease progress value","text":"
    • Set ease duration
      customProgress.setEaseValueDuration(duration);\n
    • Set ease function
      customProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    • Ease value to
      customProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      customProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Ease value repeat
      customProgress.easeValueRepeat(from, to);  // from, to: 0 ~ 1\n// customProgress.easeValueRepeat(from, to, repeat, repeatDelay);\n
    • Stop ease
      customProgress.stopEaseValue();\n
    "},{"location":"shape-custom-progress/#refresh","title":"Refresh","text":"

    Redraw shapes when

    • Value changed : customProgress.setValue(newValue), customProgress.easeValueTo(newValue)
    • Resize : customProgress.resize(width, height)
    • Set dirty : customProgress.setDirty()
    • Set update shape callback : customProgress.setUpdateShapesCallback(callback)
    "},{"location":"shape-custom-progress/#shape-class","title":"Shape class","text":"

    See Shape class

    "},{"location":"shape-custom-progress/#events","title":"Events","text":"
    • On value changed
      customProgress.on('valuechange', function(newValue, oldValue, customProgress){\n//\n}, scope);\n
    "},{"location":"shape-custom-progress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = customProgress.alpha;\n
    • Set
      customProgress.setAlpha(alpha);\n// customProgress.alpha = alpha;\n
    "},{"location":"shape-custom-progress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-custom-progress/#create-mask","title":"Create mask","text":"
    var mask = customProgress.createGeometryMask();\n

    See mask

    "},{"location":"shape-custom-progress/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-custom-shapes/","title":"Custom shapes","text":""},{"location":"shape-custom-shapes/#introduction","title":"Introduction","text":"

    Custom shapes on shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-custom-shapes/#live-demos","title":"Live demos","text":"
    • Speech bubble
    • Jigsaw
    • Checkbox
    • World to localXY
    "},{"location":"shape-custom-shapes/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-custom-shapes/#install-plugin","title":"Install plugin","text":""},{"location":"shape-custom-shapes/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexcustomshapesplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexcustomshapesplugin.min.js', true);\n
    • Add custom shapes object
      var customShapes = scene.add.rexCustomShapes(x, y, width, height, config);\n
    "},{"location":"shape-custom-shapes/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import CustomShapesPlugin from 'phaser3-rex-plugins/plugins/customshapes-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexCustomShapesPlugin',\nplugin: CustomShapesPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add custom shapes object
      var customShapes = scene.add.rexCustomShapes(x, y, width, height, config);\n
    "},{"location":"shape-custom-shapes/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import CustomShapes from 'phaser3-rex-plugins/plugins/bbcodetext.js';\n
    • Add custom shapes object
      var customShapes = new CustomShapes(scene, x, y, width, height, config);\nscene.add.existing(customShapes);\n
    "},{"location":"shape-custom-shapes/#add-custom-shapes-object","title":"Add custom shapes object","text":"
    var customShapes = scene.add.rexCustomShapes(x, y, width, height, {\n// type: 'rexCustomShapes',\n\ncreate: [\n{ name: name0, type: shapeType},\n{ name: name1, type: shapeType},\n...\n],\n\n// create: {\n//     shapeType: [name0, name1, ...],\n//     shapeType: number,\n//     shapeType: name,\n// },\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n});\n

    or

    var customShapes = scene.add.rexCustomShapes({\n// x: 0,\n// y: 0,\n// width: 64,\n// height: 64,\n// type: 'rexCustomShapes',\n\ncreate: [\n{ name: name0, type: shapeType},\n{ name: name1, type: shapeType},\n...\n],\n\n// create: {\n//     shapeType: [name0, name1, ...],\n//     shapeType: number,\n//     shapeType: name,\n// },\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • create : Callback to create shapes
      • An array of object with name and type
        { name: name0, type: shapeType }\n
        • shapeType :
          • 'arc' : Create Arc shape.
          • 'circle' : Create Circle shape.
          • 'ellipse' : Create Ellipse shape.
          • 'line' : Create Line shape.
          • 'lines' : Create Lines shape.
          • 'rectangle' : Create Rectangle shape.
          • 'roundRectangle' : Create Round rectangle shape.
          • 'triangle' : Create Triangle shape.
      • A plain object with shapeType: name, or shapeType: number
        • shapeType : arc, circle, ellipse, line, rectangle, triangle
        • nameArray : An array of unique string name for each shape.
        • name : An unique string name of this shape.
        • number : Amount of shapes to create.
      • A callback
        function() {\n// this : This custom shapes game object\nvar shape = this.createShape(shapeType, name);\nthis.addShape(shape);\n}\n
        • this.createShape(shapeType, name) : Crate a shape instance, with an unique name.
        • this.addShape(shape) : Add this shape instance to this custom custom shapes.
    • update : Callback when refresh
      function() {\n// this : This custom shapes game object     \nvar shapes = this.getShapes();\nvar shape = this.getShape(name);\n// ...\n// var isSizeChanged = this.isSizeChanged;\n\n// var fillColor = this.fillColor;\n// var fillAlpha = this.fillAlpha;\n// var lineWidth = this.lineWidth;\n// var strokeColor = this.strokeColor;\n// var strokeAlpha = this.strokeAlpha;\n}\n
      • Shape instances : Change properties of shape instances.
        • this.getShapes() : Return all shapes in an array.
        • this.getShape(name) : Return a shape by the unique string name.
      • Is size changed : this.isSizeChanged
      • Fill style : this.fillColor, this.fillAlpha
      • Stroke style : this.strokeColor, this.strokeAlpha, this.lineWidth
    "},{"location":"shape-custom-shapes/#set-update-shape-callback","title":"Set update shape callback","text":"
    customShapes.setUpdateShapesCallback(callback);\n
    • callback :
      function() {\n// this : This custom shapes game object     \nvar shapes = this.getShapes();\nvar shape = this.getShape(name);\n// ...\n// var isSizeChanged = this.isSizeChanged;\n}\n
      • Shape instances : Change properties of shape instances.
        • this.getShapes() : Return all shapes in an array.
        • this.getShape(name) : Return a shape by the unique string name.
      • Is size changed: this.isSizeChanged
    "},{"location":"shape-custom-shapes/#size","title":"Size","text":"

    customShapes.setSize(width, height);\n
    or
    customShapes.resize(width, height);\n
    or
    customShapes.width = width;\ncustomShapes.height = height;\n

    Will set dirty and redraw shapes

    "},{"location":"shape-custom-shapes/#styles","title":"Styles","text":"
    • Fill style
      customShapes.setFillStyle(color, alpha);\n
      or
      customShapes.fillColor = color;\ncustomShapes.fillAlpha = alpha;\n
    • Stroke style
      customShapes.setStrokeStyle(lineWidth, color, alpha);\n
      or
      customShapes.lineWidth = lineWidth;\ncustomShapes.strokeColor = color;\ncustomShapes.strokeAlpha = alpha;\n

    Will set dirty and redraw shapes. Apply styles to shapes in update callback.

    "},{"location":"shape-custom-shapes/#world-position-to-local-position","title":"World position to local position","text":"
    var localXY = customShapes.worldToLocalXY(worldX, worldY); // localXY: {x, y}\n

    or

    var out = customShapes.worldToLocalXY(worldX, worldY, camera, out);\n
    "},{"location":"shape-custom-shapes/#recreate-shapes","title":"Recreate shapes","text":"
    • Clear all shapes
      customShapes.clear();\n
    • Add new shape
      customShapes.createShape(shapeType, name);\n
      • shapeType :
        • 'arc' : Create Arc shape.
        • 'circle' : Create Circle shape.
        • 'ellipse' : Create Ellipse shape.
        • 'line' : Create Line shape.
        • 'lines' : Create Lines shape.
        • 'rectangle' : Create Rectangle shape.
        • 'roundRectangle' : Create Round rectangle shape.
        • 'triangle' : Create Triangle shape.
      • name : A string name of this shape.
    "},{"location":"shape-custom-shapes/#refresh","title":"Refresh","text":"

    Redraw shapes when

    • Resize : customShapes.resize(width, height)
      • customShapes.isSizeChanged will also be true.
    • Set fill color : customShapes.setFillStyle(color, alpha)
    • Set stroke color : customShapes.setStrokeStyle(lineWidth, color, alpha)
    • Set dirty : customShapes.setDirty()
    • Set update shape callback : customShapes.setUpdateShapesCallback(callback)
    "},{"location":"shape-custom-shapes/#update-shape-data","title":"Update shape data","text":"

    Shape data will be updated during rendering, or call shape.updateData() to update shape data before rendering.

    "},{"location":"shape-custom-shapes/#shape-class","title":"Shape class","text":""},{"location":"shape-custom-shapes/#common-properties","title":"Common properties","text":"
    • Style
      • Get
        var fillColor = shape.fillColor;\nvar fillAlpha = shape.fillAlpha;\nvar lineWidth = shape.lineWidth;\nvar strokeColor = shape.strokeColor;\nvar strokeAlpha = shape.strokeAlpha;\n
      • Set
        shape.fillStyle(color, alpha);\nshape.lineStyle(lineWidth, color, alpha);\n
      • Clear
        shape.fillStyle().lineStyle();\n
    • Visible
      • Get
        var visible = shape.visible;\n
      • Set javascript shape.setVisible(visible);
    • Private data
      • Get
        var data = shape.getData(key);\n// var data = shape.getData(key, defaultValue);\n
      • Set
        shape.setData(key, value);\n
        or
        shape.setData({key:value, ...});\n
      • Inc
        shape.incData(key, incValue);\n// shape.incData(key, incValue, defaultValue);\n
      • Mul
        shape.mulData(key, mulValue);\n// shape.mulData(key, mulValue, defaultValue);\n
      • Clear
        shape.clearData();\n
    • Name
      • Get
        var name = shape.name;\n
    "},{"location":"shape-custom-shapes/#line","title":"Line","text":"
    • End points
      • Get
        var x0 = line.x0;\nvar y0 = line.y0;\nvar x1 = line.x1;\nvar y1 = line.y1;\n
      • Set
        line.setP0(x, y);\nline.setP1(x, y);\n
        or
        line.x0 = x0;\nline.y0 = y0;\nline.x1 = x1;\nline.y1 = y1;\n
    "},{"location":"shape-custom-shapes/#lines","title":"Lines","text":""},{"location":"shape-custom-shapes/#create-path","title":"Create path","text":"
    • Start, clear points data
      lines.start();\n
    • Start at position, clear points data
      lines.startAt(x, y);\n
    • Line to
      • To position
        lines.lineTo(x, y);\n
      • To relative position
        lines.lineTo(x, y, true);\n
      • To vertical position
        lines.verticalLineTo(x);\n
      • To relative vertical position
        lines.verticalLineTo(x, true);\n
      • To horizontal position
        lines.horizontalLineTo(y);\n
      • To relative horizontal position
        lines.horizontalLineTo(y, true);\n
    • Add arc composed of lines
      lines.arc(centerX, centerY, radius, startAngle, endAngle, anticlockwise);\n
      • startAngle, endAngle : Start and end angle in degrees.
    • Add elliptical arc composed of lines
      lines.ellipticalArc(centerX, centerY, radiusX, radiusY, startAngle, endAngle, anticlockwise);\n
      • startAngle, endAngle : Start and end angle in degrees.
    • Add quadratic bezier of lines
      lines.quadraticBezierTo(cx, cy, x, y);\n
      • cx, cy : Control point
      • x, y : End point
    • Add smooth quadratic bezier of lines
      lines.smoothQuadraticBezierTo(x, y);\n
      • x, y : End point
    • Add cubic bezier of lines
      lines.cubicBezierCurveTo(cx0, cy0, cx1, cy1, x, y);\n
      • cx0, cy0 : Control point0
      • cx1, cy1 : Control point1
      • x, y : End point
    • Add smooth cubic bezier of lines
      lines.smoothCubicBezierCurveTo(cx1, cy1, x, y);\n
      • cx1, cy1 : Control point1
      • x, y : End point
    • End commands
      • Close path, to fill color
        lines.close();\n
      • End path, to draw lines only
        lines.end();\n
    • Copy path from another lines
      lines.copyPathFrom(srcLine);\n
      or
      lines.copyPathFrom(srcLine, startT, endT);\n
    • Append path from another lines
      lines.appendPathFrom(srcLine);\n
      or
      lines.appendPathFrom(srcLine, startT, endT);\n
    "},{"location":"shape-custom-shapes/#transform","title":"Transform","text":"
    • Offset all points
      lines.offset(x, y);\n
    • Rotation all points
      lines.rotateAround(centerX, centerY, angle);\n
      • angle : Rotate angle in degrees.
    "},{"location":"shape-custom-shapes/#display-path-segment","title":"Display path segment","text":"
    1. Create path, under customShapes.isSizeChanged condition.
    2. Display segment of path
      lines.setDisplayPathSegment(startT, endT);\n
      or
      lines.setDisplayPathSegment(endT);  // startT = 0\n
      • startT, endT : 0~1. Start, end position on path, in percentage of path.
        • 0 : Start position of path
        • 1 : End position of path
    "},{"location":"shape-custom-shapes/#misc","title":"Misc","text":"
    • Get polygon
      var polygon = lines.toPolygon();\n
      • Can be used in setInteractive method
        shape.setInteractive({\nhitArea: shape.getShapes()[0].toPolygon(),\nhitAreaCallback: Phaser.Geom.Polygon.Contains,\n})\n
    • Position of first or last point
      var p0x = lines.firstPointX;\nvar p0y = lines.firstPointY;\nvar pNx = lines.lastPointX;\nvar pNy = lines.lastPointY;\n
    "},{"location":"shape-custom-shapes/#rectangle","title":"Rectangle","text":"
    • Top-left
      • Get
        var left = rectangle.x;\nvar top = rectangle.y;\n
      • Set
        rectangle.setTopLeftPosition(x, y);\n
        or
        rectangle.x = left;\nrectangle.y = top;\n
    • Center
      • Get
        var centerX = rectangle.centerX;\nvar centerY = rectangle.centerY;\n
      • Set
        rectangle.setCenterPosition(x, y);\n
        or
        rectangle.centerX = centerX;\nrectangle.centerY = centerY;\n
        • Will change rectangle.x, rectangle.y
    • Size
      • Get
        var width = rectangle.width;\nvar height = rectangle.height;\n
      • Set
        rectangle.setSize(width, height);\n
        or
        rectangle.width = width;\nrectangle.height = height;\n
    "},{"location":"shape-custom-shapes/#round-rectangle","title":"Round rectangle","text":"
    • Top-left
      • Get
        var left = roundRectangle.x;\nvar top = roundRectangle.y;\n
      • Set
        roundRectangle.setTopLeftPosition(x, y);\n
        or
        roundRectangle.x = left;\nroundRectangle.y = top;\n
    • Center
      • Get
        var centerX = roundRectangle.centerX;\nvar centerY = roundRectangle.centerY;\n
      • Set
        roundRectangle.setCenterPosition(x, y);\n
        or
        roundRectangle.centerX = centerX;\nroundRectangle.centerY = centerY;\n
        • Will change roundRectangle.x, roundRectangle.y
    • Size
      • Get
        var width = roundRectangle.width;\nvar height = roundRectangle.height;\n
      • Set
        roundRectangle.setSize(width, height);\n
        or
        roundRectangle.width = width;\nroundRectangle.height = height;\n
    • Radius
      • Get
        var radius = roundRectangle.radius;\n
        or
        var radiusTL = roundRectangle.radiusTL;\nvar radiusTR = roundRectangle.radiusTR;\nvar radiusBL = roundRectangle.radiusBL;\nvar radiusBR = roundRectangle.radiusBR;\n
      • Set
        roundRectangle.setRadius(radius);\n// roundRectangle.radius = radius;\n
        or
        roundRectangle.setRadius({\ntl: radiusTL, tr: radiusTR,\nbl: radiusBL, br: radiusBR,\n});\n// roundRectangle.radiusTL = radiusTL;\n// roundRectangle.radiusTR = radiusTR;\n// roundRectangle.radiusBL = radiusBL;\n// roundRectangle.radiusBR = radiusBR;\n
        • radius :
          • 0 : No round corner
          • > 0 : Convex round corner
          • < 0 : Concave round corner
    "},{"location":"shape-custom-shapes/#triangle","title":"Triangle","text":"
    • Vertices
      • Get
        var x0 = triangle.x0;\nvar y0 = triangle.x0;\nvar x1 = triangle.x1;\nvar y1 = triangle.x1;\nvar x2 = triangle.x2;\nvar y2 = triangle.x2;\n
      • Set
        triangle.setP0(x, y);\ntriangle.setP1(x, y);\ntriangle.setP2(x, y);\n
        or
        triangle.x0 = x0;\ntriangle.x0 = y0;\ntriangle.x1 = x1;\ntriangle.x1 = y1;\ntriangle.x2 = x2;\ntriangle.x2 = y2;\n
    "},{"location":"shape-custom-shapes/#arc","title":"Arc","text":"
    • Center position
      • Get
        var x = arc.x;\nvar y = arc.y;\n
      • Set
        arc.setCenterPosition(x, y);\n
        or
        arc.x = x;\narc.y = y;\n
    • Radius
      • Get
        var radiusX = arc.radiusX;\nvar radiusY = arc.radiusY;\n
      • Set
        arc.setRadius(radiusX, radiusY);\n// arc.setRadius(radius);\n
        or
        arc.radiusX = radiusX;\narc.radiusY = radiusY;\n
    • Angles
      • Get
        var startAngle = arc.startAngle;\nvar endAngle = arc.endAngle;\nvar anticlockwise = arc.anticlockwise; // boolean        \n
      • Set
        arc.setAngle(startAngle, endAngle);  // anticlockwise = false\n// arc.setAngle(startAngle, endAngle, anticlockwise);\n
        or
        arc.startAngle = startAngle;\narc.endAngle = endAngle;\narc.anticlockwise = anticlockwise; // boolean\n
        • startAngle, endAngle : Start/end angle in degrees.
    • Pie
      • Get
        var pie = arc.pie; // boolean\n
      • Set
        arc.setPie();\n
        or
        arc.pie = true;\n
    "},{"location":"shape-custom-shapes/#circle","title":"Circle","text":"
    • Center position
      • Get
        var x = circle.x;\nvar y = circle.y;\n
      • Set
        circle.setCenterPosition(x, y);\n
        or
        circle.x = x;\ncircle.y = y;\n
    • Radius
      • Get
        var radiusX = circle.radiusX;\nvar radiusY = circle.radiusY;\n
      • Set
        circle.setRadius(radiusX, radiusY);\n// arc.setRadius(radius);\n
        or
        circle.radiusX = radiusX;\ncircle.radiusY = radiusY;\n
    "},{"location":"shape-custom-shapes/#ellipse","title":"Ellipse","text":"

    The same as Circle.

    "},{"location":"shape-custom-shapes/#alpha","title":"Alpha","text":"
    • Get
      var alpha = shape.alpha;\n
    • Set
      shape.setAlpha(alpha);\n// shape.alpha = alpha;\n
    "},{"location":"shape-custom-shapes/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-custom-shapes/#create-mask","title":"Create mask","text":"
    var mask = shape.createGeometryMask();\n

    See mask

    "},{"location":"shape-custom-shapes/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-custom-shapes/#compare-with-similar-plugins","title":"Compare with similar plugins","text":"
    • Custom Shapes : Draw shapes.
    • Custom Porgress : Similar with custom-shapes, plus a value property
    • Custom Spinner : Similar with custom-progress, plus a value tween task.
    "},{"location":"shape-ellipse/","title":"Ellipse","text":""},{"location":"shape-ellipse/#introduction","title":"Introduction","text":"

    Ellipse shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-ellipse/#usage","title":"Usage","text":""},{"location":"shape-ellipse/#create-shape-object","title":"Create shape object","text":"
    var ellipse = scene.add.ellipse(x, y, width, height, fillColor);\n// var ellipse = scene.add.ellipse(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-ellipse/#custom-class","title":"Custom class","text":"
    • Define class
      class MyEllipse extends Phaser.GameObjects.Ellipse {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var ellipse = new MyEllipse(scene, x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-ellipse/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = ellipse.fillColor;\nvar alpha = ellipse.fillAlpha;\n
      • Set
        ellipse.setFillStyle(color, alpha);\n
      • Clear
        ellipse.setFillStyle();\n
    • Stroke color
      • Get
        var color = ellipse.strokeColor;\n
      • Set
        ellipse.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        ellipse.setStrokeStyle();\n

    No tint methods

    Uses ellipse.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-ellipse/#alpha","title":"Alpha","text":"
    • Get
      var alpha = ellipse.alpha;\n
    • Set
      ellipse.setAlpha(alpha);\n// ellipse.alpha = alpha;\n
    "},{"location":"shape-ellipse/#size","title":"Size","text":"
    • Get
      var width = ellipse.width;\nvar height = ellipse.height;\n
    • Set
      ellipse.setSize(width, height);\n
    "},{"location":"shape-ellipse/#display-size","title":"Display size","text":"
    • Get
      var width = ellipse.displayWidth;\nvar height = ellipse.displayHeight;\n
    • Set
      ellipse.setDisplaySize(width, height);\n
      or
      ellipse.displayWidth = width;\nellipse.displayHeight = height;\n
    "},{"location":"shape-ellipse/#smoothness","title":"Smoothness","text":"

    The number of points used when rendering it. Increase this value for smoother curves, at the cost of more polygons being rendered.

    ellipse.setSmoothness(smoothness);\n
    or
    ellipse.smoothness = smoothness;\n

    "},{"location":"shape-ellipse/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-ellipse/#create-mask","title":"Create mask","text":"
    var mask = ellipse.createGeometryMask();\n

    See mask

    "},{"location":"shape-ellipse/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-fullwindowrectangle/","title":"Full window rectangle","text":""},{"location":"shape-fullwindowrectangle/#introduction","title":"Introduction","text":"

    Rectangle shape covered full window.

    • Author: Rex
    • Game object
    "},{"location":"shape-fullwindowrectangle/#live-demos","title":"Live demos","text":"
    • Cover
    "},{"location":"shape-fullwindowrectangle/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-fullwindowrectangle/#install-plugin","title":"Install plugin","text":""},{"location":"shape-fullwindowrectangle/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexfullwindowrectangleplugin', 'https://raw.githubusercontent.com/rexrainbow/    phaser3-rex-notes/master/dist/rexfullwindowrectangleplugin.min.js', true);\n
    • Add shape object
      var rect = scene.add.rexFullWindowRectangle(fillColor, fillAlpha);\n
    "},{"location":"shape-fullwindowrectangle/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FullWindowRectanglePlugin from 'phaser3-rex-plugins/plugins/fullwindowrectangle-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexFullWindowRectanglePlugin',\nplugin: FullWindowRectanglePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shape object
      var rect = scene.add.rexFullWindowRectangle(fillColor, fillAlpha);\n
    "},{"location":"shape-fullwindowrectangle/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import FullWindowRectangle from 'phaser3-rex-plugins/plugins/fullwindowrectangle.js';\n
    • Add shape object
      var rect = new FullWindowRectangle(scene, fillColor, fillAlpha);\nscene.add.existing(rect);\n
    "},{"location":"shape-fullwindowrectangle/#create-shape-object","title":"Create shape object","text":"
    var rect = scene.add.rexFullWindowRectangle(fillColor, fillAlpha);\n
    "},{"location":"shape-fullwindowrectangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFullWindowRectangle extends RexPlugins.GameObjects.FullWindowRectangle {\nconstructor(scene, fillColor, fillAlpha) {\nsuper(scene, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rect = new MyFullWindowRectangle(scene, fillColor, fillAlpha);\n
    "},{"location":"shape-fullwindowrectangle/#color","title":"Color","text":"
    • Tint
      • Get
        var tint = rect.tint;\n
      • Set
        rect.tint = tint;\n
    • Alpha
      • Get
        var alpha = rect.alpha;\n
      • Set
        rect.alpha = alpha;\n
    • Fill color
      • Get
        var color = rect.fillColor;\nvar alpha = rect.fillAlpha;\n
      • Set
        rect.setFillStyle(color, alpha);\n
      • Clear
        rect.setFillStyle();\n
    "},{"location":"shape-fullwindowrectangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-fullwindowrectangle/#create-mask","title":"Create mask","text":"
    var mask = rect.createGeometryMask();\n

    See mask

    "},{"location":"shape-fullwindowrectangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-grid/","title":"Grid","text":""},{"location":"shape-grid/#introduction","title":"Introduction","text":"

    Grid shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-grid/#usage","title":"Usage","text":""},{"location":"shape-grid/#create-shape-object","title":"Create shape object","text":"
    var grid = scene.add.grid(x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha);\n
    "},{"location":"shape-grid/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGrid extends Phaser.GameObjects.Grid {\nconstructor(scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha) {\nsuper(scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var grid = new MyGrid(scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha);\n
    "},{"location":"shape-grid/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = grid.fillColor;\nvar alpha = grid.fillAlpha;\n
      • Set
        grid.setFillStyle(color, alpha);\n
      • Clear
        grid.setFillStyle();\n
    • Stroke color
      • Get
        var color = grid.strokeColor;\n
      • Set
        grid.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        grid.setStrokeStyle();\n
    • Alternating color
      • Get
        var color = grid.altFillColor;\n
      • Set
        grid.setAltFillStyle(color, alpha);\n
      • Clear
        grid.setAltFillStyle();\n
    • Outline color
      • Get
        var color = grid.outlineFillColor;\n
      • Set
        grid.setOutlineStyle(color, alpha;\n
      • Clear
        grid.setOutlineStyle();\n

    No tint methods

    Uses grid.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-grid/#alpha","title":"Alpha","text":"
    • Get
      var alpha = grid.alpha;\n
    • Set
      grid.setAlpha(alpha);\n// grid.alpha = alpha;\n
    "},{"location":"shape-grid/#display-size","title":"Display size","text":"
    • Get
      var width = grid.displayWidth;\nvar height = grid.displayHeight;\n
    • Set
      grid.setDisplaySize(width, height);\n
      or
      grid.displayWidth = width;\ngrid.displayHeight = height;\n
    "},{"location":"shape-grid/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-grid/#create-mask","title":"Create mask","text":"
    var mask = grid.createGeometryMask();\n

    See mask

    "},{"location":"shape-grid/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-isobox/","title":"Iso box","text":""},{"location":"shape-isobox/#introduction","title":"Introduction","text":"

    Iso-box shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-isobox/#usage","title":"Usage","text":""},{"location":"shape-isobox/#create-shape-object","title":"Create shape object","text":"
    var isoBox = scene.add.isobox(x, y, width, height, fillTop, fillLeft, fillRight);\n
    "},{"location":"shape-isobox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyIsoBox extends Phaser.GameObjects.IsoBox {\nconstructor(scene, x, y, width, height, fillTop, fillLeft, fillRight) {\nsuper(scene, x, y, width, height, fillTop, fillLeft, fillRight);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var isoBox = new MyIsoBox(scene, x, y, width, height, fillTop, fillLeft, fillRight);\n
    "},{"location":"shape-isobox/#set-color","title":"Set color","text":"
    • Fill color
      isoBox.setFillStyle(fillTop, fillLeft, fillRight);\n
    • Show face
      isoBox.setFaces(showTop, showLeft, showRight);\n
      • showTop, showLeft, showRight: Set true to show that face

    No tint methods

    Uses isoBox.setFillStyle(fillTop, fillLeft, fillRight) to change color.

    "},{"location":"shape-isobox/#alpha","title":"Alpha","text":"
    • Get
      var alpha = isoBox.alpha;\n
    • Set
      isoBox.setAlpha(alpha);\n// isoBox.alpha = alpha;\n
    "},{"location":"shape-isobox/#projection","title":"Projection","text":"
    • Get
      var projection = isoBox.projection;\n
    • Set
      isoBox.setProjection(value)\n
      or
      isoBox.projection = value;\n
    "},{"location":"shape-isobox/#display-size","title":"Display size","text":"
    • Get
      var width = isoBox.displayWidth;\nvar height = isoBox.displayHeight;\n
    • Set
      isoBox.setDisplaySize(width, height);\n
      or
      isoBox.displayWidth = width;\nisoBox.displayHeight = height;\n
    "},{"location":"shape-isobox/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-isobox/#create-mask","title":"Create mask","text":"
    var mask = isoBox.createGeometryMask();\n

    See mask

    "},{"location":"shape-isobox/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-isotriangle/","title":"Iso triangle","text":""},{"location":"shape-isotriangle/#introduction","title":"Introduction","text":"

    Iso-triangle shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-isotriangle/#usage","title":"Usage","text":""},{"location":"shape-isotriangle/#create-shape-object","title":"Create shape object","text":"
    var isoTriangle = scene.add.isotriangle(x, y, width, height, reversed, fillTop, fillLeft, fillRight);\n
    "},{"location":"shape-isotriangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyIsoTriangle extends Phaser.GameObjects.IsoTriangle {\nconstructor(scene, x, y, width, height, reversed, fillTop, fillLeft, fillRight) {\nsuper(scene, x, y, width, height, reversed, fillTop, fillLeft, fillRight);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var isoTriangle = new MyIsoTriangle(scene, x, y, width, height, reversed, fillTop, fillLeft, fillRight);\n
    "},{"location":"shape-isotriangle/#set-color","title":"Set color","text":"
    • Fill color
      isoTriangle.setFillStyle(fillTop, fillLeft, fillRight);\n
    • Show face
      isoTriangle.setFaces(showTop, showLeft, showRight);\n
      • showTop, showLeft, showRight: Set true to show that face

    No tint methods

    Uses isoTriangle.setFillStyle(fillTop, fillLeft, fillRight) to change color.

    "},{"location":"shape-isotriangle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = isoTriangle.alpha;\n
    • Set
      isoTriangle.setAlpha(alpha);\n// isoTriangle.alpha = alpha;\n
    "},{"location":"shape-isotriangle/#projection","title":"Projection","text":"
    • Get
      var projection = isoTriangle.projection;\n
    • Set
      isoTriangle.setProjection(value)\n
      or
      isoTriangle.projection = value;\n
    "},{"location":"shape-isotriangle/#reverse","title":"Reverse","text":"
    • Get
      var isReversed = isoTriangle.isReversed;\n
    • Set
      isoTriangle.setReversed(reversed);\n
      or
      isoTriangle.reversed = reversed;\n
    • Set true to render upside down.
    "},{"location":"shape-isotriangle/#display-size","title":"Display size","text":"
    • Get
      var width = isoTriangle.displayWidth;\nvar height = isoTriangle.displayHeight;\n
    • Set
      isoTriangle.setDisplaySize(width, height);\n
      or
      isoTriangle.displayWidth = width;\nisoTriangle.displayHeight = height;\n
    "},{"location":"shape-isotriangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-isotriangle/#create-mask","title":"Create mask","text":"
    var mask = isoTriangle.createGeometryMask();\n

    See mask

    "},{"location":"shape-isotriangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-line/","title":"Line","text":""},{"location":"shape-line/#introduction","title":"Introduction","text":"

    Line shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-line/#usage","title":"Usage","text":""},{"location":"shape-line/#create-shape-object","title":"Create shape object","text":"
    var line = scene.add.line(x, y, x1, y1, x2, y2, strokeColor);\n// var line = scene.add.line(x, y, x1, y1, x2, y2, strokeColor, strokeAlpha);\n
    "},{"location":"shape-line/#custom-class","title":"Custom class","text":"
    • Define class
      class MyCurve extends Phaser.GameObjects.Line {\nconstructor(scene, x, y, x1, y1, x2, y2, strokeColor) {\nsuper(scene, x, y, x1, y1, x2, y2, strokeColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var line = new MyLine(scene, x, y, x1, y1, x2, y2, strokeColor);\n
    "},{"location":"shape-line/#set-color","title":"Set color","text":"
    • Fill color
      • Get
        var color = line.fillColor;\nvar alpha = line.fillAlpha;\n
      • Set
        line.setFillStyle(color, alpha);\n
      • Clear
        line.setFillStyle();\n
    • Stroke color
      • Get
        var color = line.strokeColor;\n
      • Set
        line.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        line.setStrokeStyle();\n

    No tint methods

    Uses line.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-line/#alpha","title":"Alpha","text":"
    • Get
      var alpha = line.alpha;\n
    • Set
      line.setAlpha(alpha);\n// line.alpha = alpha;\n
    "},{"location":"shape-line/#set-end-points","title":"Set end points","text":"
    line.setTo(x1, y1, x2, y2);\n
    "},{"location":"shape-line/#line-width","title":"Line width","text":"
    line.setLineWidth(startWidth, endWidth);\n
    • endWidth : The end width of the line. Only used in WebGL.
    "},{"location":"shape-line/#display-size","title":"Display size","text":"
    • Get
      var width = line.displayWidth;\nvar height = line.displayHeight;\n
    • Set
      line.setDisplaySize(width, height);\n
      or
      line.displayWidth = width;\nline.displayHeight = height;\n
    "},{"location":"shape-line/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-line/#create-mask","title":"Create mask","text":"
    var mask = line.createGeometryMask();\n

    See mask

    "},{"location":"shape-line/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-lineprogress/","title":"Line progress","text":""},{"location":"shape-lineprogress/#introduction","title":"Introduction","text":"

    Horizontal line progress bar shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-lineprogress/#live-demos","title":"Live demos","text":"
    • Line-progress
    "},{"location":"shape-lineprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-lineprogress/#install-plugin","title":"Install plugin","text":""},{"location":"shape-lineprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexlineprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexlineprogressplugin.min.js', true);\n
    • Add line-progress object
      var lineProgress = scene.add.rexLineProgress(x, y, width, height, barColor, value, config);\n
    "},{"location":"shape-lineprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import LineProgressPlugin from 'phaser3-rex-plugins/plugins/lineprogress-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLineProgressPlugin',\nplugin: LineProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add line-progress object
      var lineProgress = scene.add.rexLineProgress(x, y, width, height, barColor, value, config);\n
    "},{"location":"shape-lineprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import LineProgress from 'phaser3-rex-plugins/plugins/lineprogress.js';\n
    • Add line-progress object
      var lineProgress = new LineProgress(scene, x, y, width, height, barColor, value, config);\nscene.add.existing(lineProgress);\n
    "},{"location":"shape-lineprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexLineProgressPlugin',\nplugin: LineProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"shape-lineprogress/#create-instance","title":"Create instance","text":"
    var lineProgress = scene.add.rexLineProgress(x, y, width, height, barColor, value, {    trackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n});\n

    or

    var lineProgress = scene.add.rexLineProgress({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\nbarColor: undefined,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • barColor : Fill color of line bar, in number or css string value.
    • trackColor : Fill color of line track, in number or css string value.
    • trackStrokeColor : Stroke color of track, in number or css string value.
    • trackStrokeThickness : Stroke line width of track.
    • skewX : Horizontal skew of track and bar.
    • rtl :
      • false : Bar starts from left side. Default behavior.
      • true : Bar starts from right side.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, lineProgress) {\n}\n

    Add line-progress from JSON

    var lineProgress = scene.make.rexLineProgress({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\nbarColor: undefined,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nskewX:0,\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, lineProgress) {\n},\n\nadd: true\n});\n
    "},{"location":"shape-lineprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLineProgress extends LineProgress {\nconstructor(scene, x, y, width, height, barColor, value, config) {\nsuper(scene, x, y, width, height, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var lineProgress = new MyLineProgress(scene, x, y, width, height, barColor, value, config);\n
    "},{"location":"shape-lineprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = lineProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = lineProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = lineProgress.value; // value: 0 ~ 1\n
    • Set value
      lineProgress.setValue(value, min, max); // value: min ~ max\n
      or
      lineProgress.setValue(value); // value: 0 ~ 1\n
      or
      lineProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      lineProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      lineProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      lineProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"shape-lineprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      lineProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      lineProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      lineProgress.stopEaseValue();\n
    • Set ease duration
      lineProgress.setEaseValueDuration(duration);\n
    • Set ease function
      lineProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"shape-lineprogress/#track","title":"Track","text":"
    • Color
      • Get
        var trackColor = lineProgress.trackColor;\n
      • Set
        lineProgress.setTrackColor(trackColor);\n// lineProgress.trackColor = trackColor;\n
    • Stroke
      • Get
        var trackStrokeColor = lineProgress.trackStrokeColor;\nvar trackStrokeThickness = lineProgress.trackStrokeThickness;\n
      • Set
        lineProgress.setTrackColor(color);\nlineProgress.setTrackStroke(lineWidth, color);\n
    "},{"location":"shape-lineprogress/#bar","title":"Bar","text":"
    • Color
      • Get
        var barColor = lineProgress.barColor;\n
      • Set
        lineProgress.setBarColor(barColor);\n// lineProgress.barColor = barColor;\n
    "},{"location":"shape-lineprogress/#horizontal-skew","title":"Horizontal skew","text":"
    • Get
      var skewX = lineProgress.skewX;\n
    • Set
      lineProgress.setSkewX(skewX);\n// lineProgress.skewX = skewX;\n
    "},{"location":"shape-lineprogress/#right-to-left","title":"Right-to-left","text":"
    • Get
      var rtl = lineProgress.rtl;\n
    • Set
      lineProgress.setRTL(rtl);\n// lineProgress.rtl = rtl;\n
    "},{"location":"shape-lineprogress/#events","title":"Events","text":"
    • On value changed
      lineProgress.on('valuechange', function(newValue, oldValue, lineProgress){\n//\n}, scope);\n
    "},{"location":"shape-lineprogress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = lineProgress.alpha;\n
    • Set
      lineProgress.setAlpha(alpha);\n// lineProgress.alpha = alpha;\n
    "},{"location":"shape-lineprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-lineprogress/#create-mask","title":"Create mask","text":"
    var mask = lineProgress.createGeometryMask();\n

    See mask

    "},{"location":"shape-lineprogress/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-polygon/","title":"Polygon","text":""},{"location":"shape-polygon/#introduction","title":"Introduction","text":"

    Polygon shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-polygon/#usage","title":"Usage","text":""},{"location":"shape-polygon/#create-shape-object","title":"Create shape object","text":"
    var polygon = scene.add.polygon(x, y, points, fillColor);\n// var polygon = scene.add.polygon(x, y, points, fillColor, fillAlpha);\n
    • points :
      • An array of number : [x0, y0, x1, y1, ...]
      • An array of points : [{x:x0, y:y0}, {x:x1, y:y1}, ...]
      • A string : 'x0 y0 x1 y1 ...'

    Note

    Shift given points to align position (0, 0)

    "},{"location":"shape-polygon/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPolygon extends Phaser.GameObjects.Polygon {\nconstructor(scene, x, y, points, fillColor) {\nsuper(scene, x, y, points, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var polygon = new MyPolygon(scene, x, y, points, fillColor);\n
    "},{"location":"shape-polygon/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = polygon.fillColor;\nvar alpha = polygon.fillAlpha;\n
      • Set
        polygon.setFillStyle(color, alpha);\n
      • Clear
        polygon.setFillStyle();\n
    • Stroke color
      • Get
        var color = polygon.strokeColor;\n
      • Set
        polygon.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        polygon.setStrokeStyle();\n

    No tint methods

    Uses polygon.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-polygon/#alpha","title":"Alpha","text":"
    • Get
      var alpha = polygon.alpha;\n
    • Set
      polygon.setAlpha(alpha);\n// polygon.alpha = alpha;\n
    "},{"location":"shape-polygon/#smooth","title":"Smooth","text":"

    Smooths the polygon over the number of iterations specified.

    polygon.smooth(iterations);\n
    "},{"location":"shape-polygon/#set-points","title":"Set points","text":"
    polygon.setTo(points);\n
    • point :
      • A string containing paired values separated by a single space : '40 0 40 20 100 20 100 80 40 80 40 100 0 50'
      • An array of Point objects : [new Phaser.Point(x1, y1), ...]
      • An array of objects with public x/y properties : [obj1, obj2, ...]
      • An array of paired numbers that represent point coordinates : [x1,y1, x2,y2, ...]
      • An array of arrays with two elements representing x/y coordinates : [[x1, y1], [x2, y2], ...]
    "},{"location":"shape-polygon/#display-size","title":"Display size","text":"
    • Get
      var width = polygon.displayWidth;\nvar height = polygon.displayHeight;\n
    • Set
      polygon.setDisplaySize(width, height);\n
      or
      polygon.displayWidth = width;\npolygon.displayHeight = height;\n
    "},{"location":"shape-polygon/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-polygon/#create-mask","title":"Create mask","text":"
    var mask = polygon.createGeometryMask();\n

    See mask

    "},{"location":"shape-polygon/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-quad/","title":"Quad","text":""},{"location":"shape-quad/#introduction","title":"Introduction","text":"

    Quad shape, offsets can be given on four vertices, and additional points can be added on the four sides.

    • Author: Rex
    • Game object
    "},{"location":"shape-quad/#live-demos","title":"Live demos","text":"
    • Ease vertices
    • Ease side-points
    "},{"location":"shape-quad/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-quad/#install-plugin","title":"Install plugin","text":""},{"location":"shape-quad/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadshapeplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadshapeplugin.min.js', true);\n
    • Add shape object
      var quad = scene.add.rexQuadShape(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-quad/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadShapePlugin from 'phaser3-rex-plugins/plugins/quadshape-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadShapePlugin',\nplugin: QuadShapePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shape object
      var quad = scene.add.rexQuadShape(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-quad/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import QuadShape from 'phaser3-rex-plugins/plugins/quadshape.js';\n
    • Add shape object
      var quad = new QuadShape(scene, x, y, width, height, fillColor, fillAlpha);\nscene.add.existing(quad);\n
    "},{"location":"shape-quad/#create-shape-object","title":"Create shape object","text":"
    var quad = scene.add.rexQuadShape(x, y, width, height, fillColor, fillAlpha);\n

    or

    var quad = scene.add.rexQuadShape({\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\ncolor: undefined,\nalpha: undefined,\n\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: 2,\n\ntlx: 0,\ntly: 0,\ntrx: 0,\ntry: 0,\nblx: 0,\nbly: 0,\nbrx: 0,\nbry: 0,\n\nleftSidePoints: [\n// {t, x, y, key},\n// {t, x, y, key},\n// ...\n],\nrightSidePoints: [\n// {t, x, y, key},\n// {t, x, y, key},\n// ...\n],\ntopSidePoints: [\n// {t, x, y, key},\n// {t, x, y, key},\n// ...\n],\nbottomSidePoints: [\n// {t, x, y, key},\n// {t, x, y, key},\n// ...\n],\n});\n
    • width, height : Size of quadangle.
      • undefined : Set ot undefined to draw a circle.
    • tlx, tly : Offset of top-left vertex.
    • trx, try : Offset of top-right vertex.
    • blx, bly : Offset of bottom-left vertex.
    • brx, bry : Offset of bottom-right vertex.
    • leftSidePoints, rightSidePoints, topSidePoints, bottomSidePoints : A list of points, additional points on left-side/right-side/top-side/bottom-side.
      {\nt, x, y, key\n}\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key :
        • undefined : Ignore this feature. Default value.
        • A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    "},{"location":"shape-quad/#custom-class","title":"Custom class","text":"
    • Define class
      class MyQuadShape extends RexPlugins.GameObjects.QuadShape {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var quad = new MyQuadShape(scene, x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-quad/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = quad.fillColor;\nvar alpha = quad.fillAlpha;\n
      • Set
        quad.setFillStyle(color, alpha);\n
      • Clear
        quad.setFillStyle();\n
    • Stroke color
      • Get
        var color = quad.strokeColor;\n
      • Set
        quad.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        quad.setStrokeStyle();\n

    No tint methods

    Uses quad.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-quad/#alpha","title":"Alpha","text":"
    • Get
      var alpha = quad.alpha;\n
    • Set
      quad.setAlpha(alpha);\n// quad.alpha = alpha;\n
    "},{"location":"shape-quad/#size","title":"Size","text":"
    • Get
      var width = quad.width;\nvar height = quad.height;\n
    • Set
      quad.setSize(width, height);\n
      or
      quad.width = width;\nquad.height = height;\n
    "},{"location":"shape-quad/#display-size","title":"Display size","text":"
    • Get
      var width = quad.displayWidth;\nvar height = quad.displayHeight;\n
    • Set
      quad.setDisplaySize(width, height);\n
      or
      quad.displayWidth = width;\nquad.displayHeight = height;\n
    "},{"location":"shape-quad/#position-of-vertices","title":"Position of vertices","text":"
    • Top-left vertex
      • Get
        var x = quad.tlx;\nvar y = quad.tly;\n
      • Set
        quad.setTLPosition(x, y);\n
        or
        quad.tlx = x;\nquad.tly = y;\n
    • Top-right vertex
      • Get
        var x = quad.trx;\nvar y = quad.try;\n
      • Set
        quad.setTRPosition(x, y);\n
        or
        quad.trx = x;\nquad.try = y;\n
    • Bottom-left vertex
      • Get
        var x = quad.blx;\nvar y = quad.bly;\n
      • Set
        quad.setBLPosition(x, y);\n
        or
        quad.blx = x;\nquad.bly = y;\n
    • Bottom-right vertex
      • Get
        var x = quad.brx;\nvar y = quad.bry;\n
      • Set
        quad.setBRPosition(x, y);\n
        or
        quad.brx = x;\nquad.bry = y;\n
    "},{"location":"shape-quad/#position-of-side-points","title":"Position of side points","text":"
    • Top side
      quad.insertTopSidePoint(t, x, y);\n// quad.insertTopSidePoint(t, x, y, key);\n// quad.insertTopSidePoint({t, x, y, key});\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key : - undefined : Ignore this feature. Default value. - A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    • Right side
      quad.insertRightSidePoint(t, x, y);\n// quad.insertRightSidePoint(t, x, y, key);\n// quad.insertRightSidePoint({t, x, y, key});\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key : - undefined : Ignore this feature. Default value. - A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    • Bottom side
      quad.insertBottomSidePoint(t, x, y);\n// quad.insertBottomSidePoint(t, x, y, key);\n// quad.insertBottomSidePoint({t, x, y, key});\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key : - undefined : Ignore this feature. Default value. - A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    • Left side
      quad.insertLeftSidePoint(t, x, y);\n// quad.insertLeftSidePoint(t, x, y, key);\n// quad.insertLeftSidePoint({t, x, y, key});\n
      • t : Position in percent of edge.
      • x, y : Offset of this point on edge.
      • key : - undefined : Ignore this feature. Default value. - A string: Inject key+'\uff38', key+'Y', key+'T' properties into this quad shape game object.
    "},{"location":"shape-quad/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-quad/#create-mask","title":"Create mask","text":"
    var mask = quad.createGeometryMask();\n

    See mask

    "},{"location":"shape-quad/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-rectangle/","title":"Rectangle","text":""},{"location":"shape-rectangle/#introduction","title":"Introduction","text":"

    Rectangle shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-rectangle/#usage","title":"Usage","text":""},{"location":"shape-rectangle/#create-shape-object","title":"Create shape object","text":"
    var rect = scene.add.rectangle(x, y, width, height, fillColor);\n// var rect = scene.add.rectangle(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-rectangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRectangle extends Phaser.GameObjects.Rectangle {\nconstructor(scene, x, y, width, height, fillColor) {\nsuper(scene, x, y, width, height, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rect = new MyRectangle(scene, x, y, width, height, fillColor);\n
    "},{"location":"shape-rectangle/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = rect.fillColor;\nvar alpha = rect.fillAlpha;\n
      • Set
        rect.setFillStyle(color, alpha);        
      • Clear
        rect.setFillStyle();\n
    • Stroke color
      • Get
        var color = rect.strokeColor;\n
      • Set
        rect.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        rect.setStrokeStyle();\n

    No tint methods

    Uses rect.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-rectangle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = rect.alpha;\n
    • Set
      rect.setAlpha(alpha);\n// rect.alpha = alpha;\n
    "},{"location":"shape-rectangle/#size","title":"Size","text":"
    • Get
      var width = rect.width;\nvar height = rect.height;\n
    • Set
      rect.setSize(width, height);\n
      or
      rect.width = width;\nrect.height = height;\n
    "},{"location":"shape-rectangle/#display-size","title":"Display size","text":"
    • Get
      var width = rect.displayWidth;\nvar height = rect.displayHeight;\n
    • Set
      rect.setDisplaySize(width, height);\n
      or
      rect.displayWidth = width;\nrect.displayHeight = height;\n
    "},{"location":"shape-rectangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-rectangle/#create-mask","title":"Create mask","text":"
    var mask = rect.createGeometryMask();\n

    See mask

    "},{"location":"shape-rectangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-roundrectangle/","title":"Round Rectangle","text":""},{"location":"shape-roundrectangle/#introduction","title":"Introduction","text":"

    Round rectangle shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-roundrectangle/#live-demos","title":"Live demos","text":"
    • Round rectangle
    "},{"location":"shape-roundrectangle/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-roundrectangle/#install-plugin","title":"Install plugin","text":""},{"location":"shape-roundrectangle/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexroundrectangleplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexroundrectangleplugin.min.js', true);\n
    • Add shape object
      var rect = scene.add.rexRoundRectangle(x, y, width, height, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-roundrectangle/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RoundRectanglePlugin from 'phaser3-rex-plugins/plugins/roundrectangle-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRoundRectanglePlugin',\nplugin: RoundRectanglePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add shape object
      var rect = scene.add.rexRoundRectangle(x, y, width, height, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-roundrectangle/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RoundRectangle from 'phaser3-rex-plugins/plugins/roundrectangle.js';\n
    • Add shape object
      var rect = new RoundRectangle(scene, x, y, width, height, radius, fillColor, fillAlpha);\nscene.add.existing(rect);\n
    "},{"location":"shape-roundrectangle/#create-shape-object","title":"Create shape object","text":"
    var rect = scene.add.rexRoundRectangle(x, y, width, height, radius, fillColor, fillAlpha);\n

    or

    var rect = scene.add.rexRoundRectangle({\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\nradius: 0,\n\ncolor: undefined,\nalpha: undefined,\n\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: 2\n});\n
    • width, height : Size of rectangle.
      • undefined : Set ot undefined to draw a circle.
    • radius : Radius of four corners.
      • 0, or undefined : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
        • Radius and iteration
          {\nradius: radius,\niteration: 0\n}\n
          or
          {\nradius: {x: radiusX, y: radiusY},\niteration: 0\n}\n
          or
          {\nradius: {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n},\niteration: 0\n}\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
          • iteration : Number of interpolation points in each round corner. Default value is 4.
            • 0 : Draw a straight line instead of arc.
    "},{"location":"shape-roundrectangle/#deform","title":"Deform","text":"
    • Rectangle, set radius of 4 corners to 0.
      var rect = scene.add.rexRoundRectangle(x, y,  width, height, 0, fillColor, fillAlpha);\n
    • Circle, set width and height to undefined.
      var rect = scene.add.rexRoundRectangle(x, y, undefined, undefined, radius, fillColor, fillAlpha);\n
    • Ellipse, set width and height to undefined, and radiusX/radiusY.
      var rect = scene.add.rexRoundRectangle(x, y, undefined, undefined, {x: radiusX, y: radiusY}, fillColor, fillAlpha);\n
    • Rhombus, set width and height to undefined, and assign iteration to 0
      var rect = scene.add.rexRoundRectangle(x, y, undefined, undefined, {\nradius: radius,\niteration: 0\n}, fillColor, fillAlpha);\n
    • Octagon, assign iteration to 0
      var rect = scene.add.rexRoundRectangle(x, y, width, height, {\nradius: radius,\niteration: 0\n}, fillColor, fillAlpha);\n
    "},{"location":"shape-roundrectangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRoundRectangle extends RexPlugins.GameObjects.RoundRectangle {\nconstructor(scene, x, y, width, height, radius, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, radius, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var rect = new MyRoundRectangle(scene, x, y, width, height, radius, fillColor, fillAlpha);\n
    "},{"location":"shape-roundrectangle/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = rect.fillColor;\nvar alpha = rect.fillAlpha;\n
      • Set
        rect.setFillStyle(color, alpha);\n
      • Clear
        rect.setFillStyle();\n
    • Stroke color
      • Get
        var color = rect.strokeColor;\n
      • Set
        rect.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        rect.setStrokeStyle();\n

    No tint methods

    Uses rect.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-roundrectangle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = rect.alpha;\n
    • Set
      rect.setAlpha(alpha);\n// rect.alpha = alpha;\n
    "},{"location":"shape-roundrectangle/#size","title":"Size","text":"
    • Get
      var width = rect.width;\nvar height = rect.height;\n
    • Set
      rect.setSize(width, height);\n
      or
      rect.width = width;\nrect.height = height;\n
    "},{"location":"shape-roundrectangle/#display-size","title":"Display size","text":"
    • Get
      var width = rect.displayWidth;\nvar height = rect.displayHeight;\n
    • Set
      rect.setDisplaySize(width, height);\n
      or
      rect.displayWidth = width;\nrect.displayHeight = height;\n
    "},{"location":"shape-roundrectangle/#radius","title":"Radius","text":"
    • Get
      var radius = rect.radius;\nvar radiusTL = rect.radiusTL;\nvar radiusTR = rect.radiusTR;\nvar radiusBL = rect.radiusBL;\nvar radiusBR = rect.radiusBR;\n
      or
      var cornerRadius = rect.cornerRadius;\n
      • radius : Number, maximum radius of 4 corners.
      • cornerRadius : JSON object of 4 corners.
        {\ntl: {x : radiusX, y: radiusY, convex : true},\ntr: {x : radiusX, y: radiusY, convex : true},\nbl: {x : radiusX, y: radiusY, convex : true},\nbr: {x : radiusX, y: radiusY, convex : true},\n}\n
    • Set
      rect.setRadius(value);\nrect.setRadiusTL(value);  // number, or {x,y}\nrect.setRadiusTR(value);  // number, or {x,y}\nrect.setRadiusBL(value);  // number, or {x,y}\nrect.setRadiusBR(value);  // number, or {x,y}\n
      or
      rect.radius = radius;\nrect.radiusTL = radius;  // number, or {x,y}\nrect.radiusTR = radius;  // number, or {x,y}\nrect.radiusBL = radius;  // number, or {x,y}\nrect.radiusBR = radius;  // number, or {x,y}\n
      • radius :
        • Number : 4 corners with the same radius.
          • 0 : No round corner
          • > 0 : Convex round corner
          • < 0 : Concave round corner
        • JSON
          • 4 corners with the same radius X/Y
            {\nx: radiusX,\ny: radiusY\n}\n
          • Eeach radius of corner
            {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
            or ```javascript { tl: {x : radiusX, y: radiusY}, tr: {x : radiusX, y: radiusY}, bl: {x : radiusX, y: radiusY}, br: {x : radiusX, y: radiusY}, }
    "},{"location":"shape-roundrectangle/#iteration","title":"Iteration","text":"
    • Get
      var iteration = rect.iteration;\n
    • Set
      rect.setIteration(value);\n
      or
      rect.iteration = value;\n

    Number of interpolation points in each round corner. Default value is 4.

    • 0 : Draw a straight line instead of arc.
    "},{"location":"shape-roundrectangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-roundrectangle/#create-mask","title":"Create mask","text":"
    var mask = rect.createGeometryMask();\n

    See mask

    "},{"location":"shape-roundrectangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-roundrectangleprogress/","title":"Round rectangle progress","text":""},{"location":"shape-roundrectangleprogress/#introduction","title":"Introduction","text":"

    Horizontal or vertical round rectangle progress bar shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-roundrectangleprogress/#live-demos","title":"Live demos","text":"
    • RoundRectangle-progress
    "},{"location":"shape-roundrectangleprogress/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-roundrectangleprogress/#install-plugin","title":"Install plugin","text":""},{"location":"shape-roundrectangleprogress/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexroundrectangleprogressplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexroundrectangleprogressplugin.min.js', true);\n
    • Add roundrectangle-progress object
      var roundRectangleProgress = scene.add.rexRoundRectangleProgress(x, y, width, height, radius, barColor, value, config);\n
    "},{"location":"shape-roundrectangleprogress/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import RoundRectangleProgressPlugin from 'phaser3-rex-plugins/plugins/roundrectangleprogress-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRoundRectangleProgressPlugin',\nplugin: RoundRectangleProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add roundrectangle-progress object
      var roundRectangleProgress = scene.add.rexRoundRectangleProgress(x, y, width, height, radius, barColor, value, config);\n
    "},{"location":"shape-roundrectangleprogress/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import RoundRectangleProgress from 'phaser3-rex-plugins/plugins/roundrectangleprogress.js';\n
    • Add roundrectangle-progress object
      var roundRectangleProgress = new RoundRectangleProgress(scene, x, y, width, height, radius, barColor, value, config);\nscene.add.existing(roundRectangleProgress);\n
    "},{"location":"shape-roundrectangleprogress/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexRoundRectangleProgressPlugin',\nplugin: RoundRectangleProgressPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"shape-roundrectangleprogress/#create-instance","title":"Create instance","text":"
    var roundRectangleProgress = scene.add.rexRoundRectangleProgress(x, y, width, height, radius, barColor, value, {    trackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nrtl: false,\norientation: 0,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, roundRectangleProgress) {\n},\n});\n

    or

    var roundRectangleProgress = scene.add.rexRoundRectangleProgress({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\nradius: 0,\n\nbarColor: undefined,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nrtl: false,\norientation: 0,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, roundRectangleProgress) {\n},\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • radius : Radius of four corners.
      • 0, or undefined : Disable round corner.
      • Number: 4 corners with the same radius.
      • JSON
        • 4 corners with the same radius X/Y
          {\nx: radiusX,\ny: radiusY\n}\n
        • Eeach radius of corner
          {\ntl: radius,\ntr: radius,\nbl: radius,\nbr: radius\n}\n
          or
          {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n}\n
        • Radius and iteration
          {\nradius: radius,\niteration: 0\n}\n
          or
          {\nradius: {x: radiusX, y: radiusY},\niteration: 0\n}\n
          or
          {\nradius: {\ntl: {x : radiusX, y: radiusY},\ntr: {x : radiusX, y: radiusY},\nbl: {x : radiusX, y: radiusY},\nbr: {x : radiusX, y: radiusY},\n},\niteration: 0\n}\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
          • iteration : Number of interpolation points in each round corner. Default value is 4.
            • 0 : Draw a straight line instead of arc.
    • barColor : Fill color of line bar, in number or css string value.
    • trackColor : Fill color of line track, in number or css string value.
    • trackStrokeColor : Stroke color of track, in number or css string value.
    • trackStrokeThickness : Stroke line width of track.
    • orientation : Orientation of the bar.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right. Default value is 0.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    • rtl :
      • false : Bar starts from left side. Default behavior.
      • true : Bar starts from right side.
    • value : 0 ~ 1, progress value. Default is 0.
    • easeValue : Parameters of easing value.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, roundRectangleProgress) {\n}\n

    Add roundrectangle-progress from JSON

    var roundRectangleProgress = scene.make.rexRoundRectangleProgress({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\nradius: 0,\n\nbarColor: undefined,\ntrackColor: undefined,\ntrackStrokeColor: undefined,\ntrackStrokeThickness: 2,\n\nrtl: false,\norientation: 0,\n\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvalue: 0,\nvaluechangeCallback: function(newValue, oldValue, roundRectangleProgress) {\n},\n\nadd: true\n});\n
    "},{"location":"shape-roundrectangleprogress/#custom-class","title":"Custom class","text":"
    • Define class
      class MyRoundRectangleProgress extends RoundRectangleProgress {\nconstructor(scene, x, y, width, height, radius, barColor, value, config) {\nsuper(scene, x, y, width, height, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var roundRectangleProgress = new MyRoundRectangleProgress(scene, x, y, width, height, radius, barColor, value, config);\n
    "},{"location":"shape-roundrectangleprogress/#progress-value","title":"Progress value","text":"
    • Get value
      var value = roundRectangleProgress.getValue(min, max); // value : min ~ max\n
      or
      var value = roundRectangleProgress.getValue(); // value: 0 ~ 1\n
      or
      var value = roundRectangleProgress.value; // value: 0 ~ 1\n
    • Set value
      roundRectangleProgress.setValue(value, min, max); // value: min ~ max\n
      or
      roundRectangleProgress.setValue(value); // value: 0 ~ 1\n
      or
      roundRectangleProgress.value = value; // value: 0 ~ 1\n
    • Increase value
      roundRectangleProgress.addValue(inc, min, max); // inc: min ~ max\n
      or
      roundRectangleProgress.addValue(inc); // inc: 0 ~ 1\n
      or
      roundRectangleProgress.value += inc; // inc: 0 ~ 1\n
    "},{"location":"shape-roundrectangleprogress/#ease-progress-value","title":"Ease progress value","text":"
    • Ease value to
      roundRectangleProgress.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      roundRectangleProgress.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      roundRectangleProgress.stopEaseValue();\n
    • Set ease duration
      roundRectangleProgress.setEaseValueDuration(duration);\n
    • Set ease function
      roundRectangleProgress.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"shape-roundrectangleprogress/#track","title":"Track","text":"
    • Color
      • Get
        var trackColor = roundRectangleProgress.trackColor;\n
      • Set
        roundRectangleProgress.setTrackColor(trackColor);\n// roundRectangleProgress.trackColor = trackColor;\n
    • Stroke
      • Get
        var trackStrokeColor = roundRectangleProgress.trackStrokeColor;\nvar trackStrokeThickness = roundRectangleProgress.trackStrokeThickness;\n
      • Set
        roundRectangleProgress.setTrackColor(color);\nroundRectangleProgress.setTrackStroke(lineWidth, color);\n
    "},{"location":"shape-roundrectangleprogress/#bar","title":"Bar","text":"
    • Color
      • Get
        var barColor = roundRectangleProgress.barColor;\n
      • Set
        roundRectangleProgress.setBarColor(barColor);\n// roundRectangleProgress.barColor = barColor;\n
    "},{"location":"shape-roundrectangleprogress/#orientation","title":"Orientation","text":"
    • Get
      var orientation = roundRectangleProgress.orientation;\n
      • orientation :
        • 0 : Horizontal
        • 1 : Vertical
    • Set
      roundRectangleProgress.setOrientation(orientation);\n// roundRectangleProgress.orientation = orientation;\n
      • orientation : Orientation of the bar.
        • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right.
        • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    "},{"location":"shape-roundrectangleprogress/#right-to-left","title":"Right-to-left","text":"

    Right-to-left, or bottom-to-top

    • Get
      var rtl = roundRectangleProgress.rtl;\n
    • Set
      roundRectangleProgress.setRTL(rtl);\n// roundRectangleProgress.rtl = rtl;\n
    "},{"location":"shape-roundrectangleprogress/#events","title":"Events","text":"
    • On value changed
      roundRectangleProgress.on('valuechange', function(newValue, oldValue, roundRectangleProgress){\n//\n}, scope);\n
    "},{"location":"shape-roundrectangleprogress/#alpha","title":"Alpha","text":"
    • Get
      var alpha = roundRectangleProgress.alpha;\n
    • Set
      roundRectangleProgress.setAlpha(alpha);\n// roundRectangleProgress.alpha = alpha;\n
    "},{"location":"shape-roundrectangleprogress/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-roundrectangleprogress/#create-mask","title":"Create mask","text":"
    var mask = roundRectangleProgress.createGeometryMask();\n

    See mask

    "},{"location":"shape-roundrectangleprogress/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-spinner/","title":"Spinner","text":""},{"location":"shape-spinner/#introduction","title":"Introduction","text":"

    Loading animations on shape.

    • Author: Rex
    • Game object
    "},{"location":"shape-spinner/#live-demos","title":"Live demos","text":"
    • Spinners
      • Arrow
      • AIO
    • Custom spinner
    • Loading animation
    "},{"location":"shape-spinner/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-spinner/#install-plugin","title":"Install plugin","text":""},{"location":"shape-spinner/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin(\n\"rexspinnerplugin\",\n\"https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexspinnerplugin.min.js\",\n\"rexSpinner\",\n\"rexSpinner\"\n);\n
    • Add spinner object
      var aio = scene.rexSpinner.add.aio(config);\nvar arrow = scene.rexSpinner.add.arrow(config);\nvar downArrow = scene.rexSpinner.add.downArrow(config);\nvar leftArrow = scene.rexSpinner.add.leftArrow(config);\nvar rightArrow = scene.rexSpinner.add.rightArrow(config);\nvar upArrow = scene.rexSpinner.add.upArrow(config);\nvar audio = scene.rexSpinner.add.audio(config);\nvar ball = scene.rexSpinner.add.ball(config);\nvar bars = scene.rexSpinner.add.bars(config);\nvar box = scene.rexSpinner.add.box(config);\nvar clock = scene.rexSpinner.add.clock(config);\nvar cube = scene.rexSpinner.add.cube(config);\nvar dots = scene.rexSpinner.add.dots(config);\nvar facebook = scene.rexSpinner.add.facebook(config);\nvar grid = scene.rexSpinner.add.grid(config);\nvar hearts = scene.rexSpinner.add.hearts(config);\nvar ios = scene.rexSpinner.add.ios(config);\nvar orbit = scene.rexSpinner.add.orbit(config);\nvar oval = scene.rexSpinner.add.oval(config);\nvar pie = scene.rexSpinner.add.pie(config);\nvar puff = scene.rexSpinner.add.puff(config);\nvar radio = scene.rexSpinner.add.radio(config);\nvar rings = scene.rexSpinner.add.rings(config);\nvar spinner = scene.rexSpinner.add.spinner(config);\n
    "},{"location":"shape-spinner/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SpinnerPlugin from \"phaser3-rex-plugins/templates/spinner/spinner-plugin.js\";\nvar config = {\n// ...\nplugins: {\nscene: [\n{\nkey: \"rexSpinner\",\nplugin: SpinnerPlugin,\nmapping: \"rexSpinner\",\n},\n// ...\n],\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add spinner object
      var aio = scene.rexSpinner.add.aio(config);\nvar arrow = scene.rexSpinner.add.arrow(config);\nvar downArrow = scene.rexSpinner.add.downArrow(config);\nvar leftArrow = scene.rexSpinner.add.leftArrow(config);\nvar rightArrow = scene.rexSpinner.add.rightArrow(config);\nvar upArrow = scene.rexSpinner.add.upArrow(config);  var audio = scene.rexSpinner.add.audio(config);\nvar ball = scene.rexSpinner.add.ball(config);\nvar bars = scene.rexSpinner.add.bars(config);\nvar box = scene.rexSpinner.add.box(config);\nvar clock = scene.rexSpinner.add.clock(config);\nvar cube = scene.rexSpinner.add.cube(config);\nvar dots = scene.rexSpinner.add.dots(config);\nvar facebook = scene.rexSpinner.add.facebook(config);\nvar grid = scene.rexSpinner.add.grid(config);\nvar hearts = scene.rexSpinner.add.hearts(config);\nvar ios = scene.rexSpinner.add.ios(config);\nvar orbit = scene.rexSpinner.add.orbit(config);\nvar oval = scene.rexSpinner.add.oval(config);\nvar pie = scene.rexSpinner.add.pie(config);\nvar puff = scene.rexSpinner.add.puff(config);\nvar radio = scene.rexSpinner.add.radio(config);\nvar rings = scene.rexSpinner.add.rings(config);\nvar spinner = scene.rexSpinner.add.spinner(config);    
    "},{"location":"shape-spinner/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { AIO, Arrow, Audio, Ball, Bars, Box, Clock, Cube, Custom, Dots, Facebook, Grid, Hearts, Ios, Orbit, Oval, Puff, Radio, Rings, Spinner\n} from \"phaser3-rex-plugins/templates/spinner/spinner-components.js\";\n
    • Add spinner object
      var spinner = new Audio(scene, config);\nscene.add.existing(spinner);\n
    "},{"location":"shape-spinner/#add-spinner-object","title":"Add spinner object","text":""},{"location":"shape-spinner/#general","title":"General","text":"
    var spinner = scene.rexSpinner.add.audio({\n// x: 0,\n// y: 0,\n// width: 64,\n// height: 64,\n// color: 0xffffff,\n\n// duration: 1000,\n// start: true,\n// delay: 0,\n// repeatDelay: 0,\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • color : Fill color, or stroke color. Default value is 0xffffff
    • duration : Duration of animation.
    • start : Start animation when object created.
    • false : Don't play animation at beginning.
    • delay : Delay time in ms before running.
    • repeatDelay : Delay time between 2 periods.
    "},{"location":"shape-spinner/#arrow","title":"Arrow","text":"
    var spinner = scene.rexSpinner.add.audio({\n// ...\n// direction: 'down'\n});\n
    • direction :
      • 0, 'right' : Arrow from left to right.
      • 1, 'down' : Arrow from up to down. Default behavior.
      • 2, 'left' : Arrow from right to left.
      • 3, 'up' : Arrow from down to up.
    "},{"location":"shape-spinner/#aio","title":"AIO","text":"

    All-in-one

    var spinner = scene.rexSpinner.add.aio({\n// ...\n// animationMode: undefined\n});\n
    • animationMode :
      • undefined : Play random spinner animation.
      • 'leftArrow' : Play leftArrow spinner animation.
      • 'rightArrow' : Play rightArrow spinner animation.
      • 'upArrow' : Play upArrow spinner animation.
      • 'downArrow' : Play dowbArrow spinner animation.
      • 'audio' : Play audio spinner animation.
      • 'ball' : Play ball spinner animation.
      • 'bars' : Play bars spinner animation.
      • 'box' : Play box spinner animation.
      • 'clock' : Play clock spinner animation.
      • 'cube' : Play cube spinner animation.
      • 'dots' : Play dots spinner animation.
      • 'facebook' : Play facebook spinner animation.
      • 'grid' : Play grid spinner animation.
      • 'hearts' : Play hearts spinner animation.
      • 'ios' : Play ios spinner animation.
      • 'oribit' : Play oribit spinner animation.
      • 'oval' : Play oval spinner animation.
      • 'pie' : Play pie spinner animation.
      • 'puff' : Play puff spinner animation.
      • 'radio' : Play radio spinner animation.
      • 'rings' : Play rings spinner animation.
      • 'spinner' : Play spinner spinner animation.
    "},{"location":"shape-spinner/#play-animation","title":"Play animation","text":""},{"location":"shape-spinner/#start","title":"Start","text":"
    • Start playing, won't restart when playing
      spinner.start();\n
    • Restart with new duration
      spinner.start(duration);\n
    "},{"location":"shape-spinner/#pause","title":"Pause","text":"
    spinner.pause();\n
    "},{"location":"shape-spinner/#resume","title":"Resume","text":"
    spinner.resume();\n
    "},{"location":"shape-spinner/#stop","title":"Stop","text":"
    spinner.stop();\n
    "},{"location":"shape-spinner/#play-animation-manually","title":"Play animation manually","text":"
    1. Set start to false in config
    2. Set progress manually
      spinner.setValue(t);\n
      or
      spinner.value = t;\n
      • t : 0 ~ 1
    "},{"location":"shape-spinner/#is-running","title":"Is running","text":"
    var isRunning = spinner.isRunning;\n
    "},{"location":"shape-spinner/#color","title":"Color","text":"
    • Get
      var color = spinner.color;\n
    • Set
      spinner.setColor(color);\n
      or
      spinner.color = color;\n
      • color : Fill color, or stroke color, in number.
    "},{"location":"shape-spinner/#alpha","title":"Alpha","text":"
    • Get
      var alpha = spinner.alpha;\n
    • Set
      spinner.setAlpha(alpha);\n// spinner.alpha = alpha;\n
    "},{"location":"shape-spinner/#duration","title":"Duration","text":"
    • Get
      var duration = spinner.duration;\n
    • Set, will apply to next animation playing.
      spinner.setDuration(duration);\n
      or
      spinner.duration = duration;\n
    "},{"location":"shape-spinner/#ease","title":"Ease","text":"
    • Get
      var ease = spinner.ease;\n
    • Set, will apply to next animation playing.
      spinner.setEasen(ease);\n
      or
      spinner.ease = ease;\n
    "},{"location":"shape-spinner/#set-animation-mode","title":"Set animation mode","text":"

    AIO-spinner only

    aioSpinner.setAnimationMode(mode);\n
    • mode :
      • undefined : Play random spinner animation.
      • 'leftArrow' : Play leftArrow spinner animation.
      • 'rightArrow' : Play rightArrow spinner animation.
      • 'upArrow' : Play upArrow spinner animation.
      • 'downArrow' : Play dowbArrow spinner animation.
      • 'audio' : Play audio spinner animation.
      • 'ball' : Play ball spinner animation.
      • 'bars' : Play bars spinner animation.
      • 'box' : Play box spinner animation.
      • 'clock' : Play clock spinner animation.
      • 'cube' : Play cube spinner animation.
      • 'dots' : Play dots spinner animation.
      • 'facebook' : Play facebook spinner animation.
      • 'grid' : Play grid spinner animation.
      • 'hearts' : Play hearts spinner animation.
      • 'ios' : Play ios spinner animation.
      • 'oribit' : Play oribit spinner animation.
      • 'oval' : Play oval spinner animation.
      • 'pie' : Play pie spinner animation.
      • 'puff' : Play puff spinner animation.
      • 'radio' : Play radio spinner animation.
      • 'rings' : Play rings spinner animation.
      • 'spinner' : Play spinner spinner animation.
    aioSpinner.setRandomAnimationMode();\n
    "},{"location":"shape-spinner/#custom-spinner","title":"Custom spinner","text":"
    var customSpinner = scene.rexSpinner.add.custom({\n// x: 0,\n// y: 0,\n// width: 64,\n// height: 64,\n// color: 0xffffff,\n\n// duration: 1000,\n// start: true,\n\ncreate: {\n// shapeType: [name0, name1, ...],\n// shapeType: number,\n// shapeType: name,\n},\n\n// create: function() {\n// \n// },\n\nupdate: function() {\n\n},\n})\n
    • create : Callback to create shapes
      • A plain object with shapeType: name, or shapeType: number
        • shapeType :
          • 'arc' : Create Arc shape.
          • 'circle' : Create Circle shape.
          • 'ellipse' : Create Ellipse shape.
          • 'line' : Create Line shape.
          • 'lines' : Create Lines shape.
          • 'rectangle' : Create Rectangle shape.
          • 'roundRectangle' : Create Round rectangle shape.
          • 'triangle' : Create Triangle shape.
        • nameArray : An array of unique string name for each shape.
        • name : An unique string name of this shape.
        • number : Amount of shapes to create.
      • A callback
        function() {\n// this : This spinner game object\nvar shape = this.createShape(shapeType, name);\nthis.addShape(shape);\n}\n
        • this.createShape(shapeType, name) : Crate a shape instance, with an unique name.
        • this.addShape(shape) : Add this shape instance to this custom spinner.
    • update : Callback when porgressing
      function() {\n// this : This spinner game object\nvar centerX = this.centerX;\nvar centerY = this.centerY;\nvar radius = this.radius;\nvar color = this.color;\nvar shapes = this.getShapes();\nvar shape = this.getShape(name);\nvar t = this.value;\n// ...\n}\n
      • this.value : Progress, 0~1.
      • Position :
        • this.centerX, this.centerY : Center position of this spinner. The coordinate of top-left point is (0,0)
        • this.radius : Minimun value of this.centerX, this.centerY, to draw shape at square.
      • Color :
        • this.color : Color property of this spinner.
      • Shape instances : Change properties of shape instances.
        • this.getShapes() : Return all shapes in an array.
        • this.getShape(name) : Return a shape by the unique string name.
    "},{"location":"shape-spinner/#shape-class","title":"Shape class","text":"

    See Shape class

    "},{"location":"shape-spinner/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-spinner/#create-mask","title":"Create mask","text":"
    var mask = customSpinner.createGeometryMask();\n

    See mask

    "},{"location":"shape-spinner/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-star/","title":"Star","text":""},{"location":"shape-star/#introduction","title":"Introduction","text":"

    Star shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-star/#usage","title":"Usage","text":""},{"location":"shape-star/#create-shape-object","title":"Create shape object","text":"
    var star = scene.add.star(x, y, points, innerRadius, outerRadius, fillColor);\n// var star = scene.add.star(x, y, points, innerRadius, outerRadius, fillColor, fillAlpha);\n
    • points : The number of points on the star. Default is 5.
    • innerRadius : The inner radius of the star. Default is 32.
    • outerRadius : The outer radius of the star. Default is 64.
    "},{"location":"shape-star/#custom-class","title":"Custom class","text":"
    • Define class
      class MyStar extends Phaser.GameObjects.Star {\nconstructor(scene, x, y, points, innerRadius, outerRadius, fillColor) {\nsuper(scene, x, y, points, innerRadius, outerRadius, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var star = new MyStar(scene, x, y, points, innerRadius, outerRadius, fillColor);\n
    "},{"location":"shape-star/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = star.fillColor;\nvar alpha = star.fillAlpha;\n
      • Set
        star.setFillStyle(color, alpha);\n
      • Clear
        star.setFillStyle();\n
    • Stroke color
      • Get
        var color = star.strokeColor;\n
      • Set
        star.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        star.setStrokeStyle();\n

    No tint methods

    Uses star.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-star/#alpha","title":"Alpha","text":"
    • Get
      var alpha = star.alpha;\n
    • Set
      star.setAlpha(alpha);\n// star.alpha = alpha;\n
    "},{"location":"shape-star/#radius","title":"Radius","text":"
    • Inner radius
      • Get
        var innerRadius = star.innerRadius;\n
      • Set
        star.setInnerRadius(innerRadius);\n
        or
        star.innerRadius = innerRadius;\n
    • Outer radius
      • Get
        var outerRadius = star.outerRadius;\n
      • Set
        star.setOuterRadius(outerRadius);\n
        or
        star.outerRadius = outerRadius;\n
    • Points
      • Get
        var points = star.points;\n
      • Set
        star.setPoints(points);\n
        or
        star.points = points;\n
    "},{"location":"shape-star/#display-size","title":"Display size","text":"
    • Get
      var width = star.displayWidth;\nvar height = star.displayHeight;\n
    • Set
      star.setDisplaySize(width, height);\n
      or
      star.displayWidth = width;\nstar.displayHeight = height;\n
    "},{"location":"shape-star/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-star/#create-mask","title":"Create mask","text":"
    var mask = star.createGeometryMask();\n

    See mask

    "},{"location":"shape-star/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-toggleswitch/","title":"Toggle switch","text":""},{"location":"shape-toggleswitch/#introduction","title":"Introduction","text":"

    Toggle-switch input.

    • Author: Rex
    • Game object
    "},{"location":"shape-toggleswitch/#live-demos","title":"Live demos","text":"
    • Toggle-switch
    "},{"location":"shape-toggleswitch/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-toggleswitch/#install-plugin","title":"Install plugin","text":""},{"location":"shape-toggleswitch/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextoggleswitchplugin', 'https://raw.githubusercontent.com/rexrainbow/    phaser3-rex-notes/master/dist/rextoggleswitchplugin.min.js', true);\n
    • Add toggle-switch input
      var toggleSwitch = scene.add.rexToggleSwitch(x, y, width, height, color, config);\n
    • Add toggle-switch shape (without click input)
      var toggleSwitch = scene.add.rexToggleSwitchShape(x, y, width, height, color, config);\n
    "},{"location":"shape-toggleswitch/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ToggleSwitchPlugin from 'phaser3-rex-plugins/plugins/toggleswitch-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexToggleSwitchPlugin',\nplugin: ToggleSwitchPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add toggle-switch input
      var toggleSwitch = scene.add.rexToggleSwitch(x, y, width, height, color, config);\n
    • Add toggle-switch shape (without click input)
      var toggleSwitch = scene.add.rexToggleSwitchShape(x, y, width, height, color, config);\n
    "},{"location":"shape-toggleswitch/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ToggleSwitch from 'phaser3-rex-plugins/plugins/toggleswitch.js';\n
    • Add toggle-switch input
      var toggleswitch = new ToggleSwitch(scene, x, y, width, height, color, config);\nscene.add.existing(toggleSwitch);\n
    • Add toggle-switch shape (without click input)
      // import ToggleSwitchShape from 'phaser3-rex-plugins/plugins/toggleswitchshape.js';\nvar toggleSwitch = new ToggleSwitchShape(scene, x, y, width, height, color, config);\nscene.add.existing(toggleSwitch);\n
    "},{"location":"shape-toggleswitch/#create-toggle-switch-input","title":"Create toggle-switch input","text":"
    var toggleSwitch = scene.add.rexToggleSwitch(x, y, width, height, color, config);\n

    or

    var toggleSwitch = scene.add.rexToggleSwitch({\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\ncolor: 0x005cb2,\ntrackFillAlpha: 1,\nfalseValueTrackColor: undefined,\nfalseValueTrackFillAlpha: 1,\n\nthumbColor: 0xffffff,\nthumbAlpha: 1,\n\ntrackWidth: 0.9,\ntrackHeight: 0.5,\ntrackCornerRadius: (trackHeight * 0.5),\n\nthumbHeight: (trackHeight * 0.9),\nthumbWidth: (thumbHeight),\nthumbCornerRadius: (thumbHeight * 0.5),\n\nthumbLeft: 0.3,\nthumbRight: (1 - thumbLeft),\nrtl: false,\n\nanimationDuration: 150,\n\nvalue: false,\n\nclick: undefined,\n// click: {\n//     mode: 1,            // 0|'press'|1|'release'\n//     clickInterval: 100  // ms\n//     threshold: undefined\n// },\nreadOnly: false,\n});\n
    • width, height : Size of toggleswitch.
    • Track fill style
      • color, trackFillAlpha : Track color and alpha when value is true.
      • falseValueTrackColor, falseValueTrackFillAlpha : Track color and alpha when value is false.
        • Default value of falseValueTrackColor is the grayscale of color.
    • Thumb fill style
      • thumbColor, thumbAlpha : Thumb color and alpha
    • Track size
      • trackWidth : Width ration of track. Default value is 0.9.
      • thumbWidth : Height ratio of track. Default value is 0.5.
      • trackCornerRadius : Ratio of track corner. Default value is half of trackHeight.
    • Thumb size
      • thumbWidth : Width ration of thumb. Default value is equal to thumbHeight.
      • thumbHeight : Height ratio of thumb. Default value trackHeight * 0.5.
      • thumbCornerRadius : Ratio of thumb corner. Default value is half of thumbHeight.
    • Thumb position
      • thumbLeft : Thumb position if value is false. Default value is 0.3.
      • thumbRight : Thumb position if value is true. Default value is 1 - thumbLeft.
      • rtl : Moving direction of thumb when when value changes from false to true.
        • false : Thumb moves from left to right. Default behavior.
        • true : Thumb moves from right to left.
    • animationDuration : Duration of drawing path of checker.
    • value : Initial value.
    • click : Configuration of click input
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
      • click.threshold : Cancel clicking detecting when dragging distance is larger then this threshold.
        • undefined : Ignore this feature. Default behavior.
    • readOnly : Set ture to disable input.
    "},{"location":"shape-toggleswitch/#custom-class","title":"Custom class","text":"
    • Define class
      class MyToggleSwitch extends RexPlugins.GameObjects.ToggleSwitch {\nconstructor(scene, x, y, width, height, color, config) {\nsuper(scene, x, y, width, height, color, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var toggleSwitch = new MyToggleSwitch(scene, x, y, width, height, color, config);\n
    "},{"location":"shape-toggleswitch/#value","title":"Value","text":"
    • Get
      var value = toggleSwitch.value;\n// var value = toggleSwitch.value;\n
    • Set
      toggleSwitch.setValue(value);\n// toggleSwitch.setValue(value, duration);\n
      or
      toggleSwitch.value = value;\n
    • Toggle
      toggleSwitch.toggleValue();\n// toggleSwitch.toggleValue(duration);\n
      or
      toggleSwitch.value = !toggleSwitch.value;\n// toggleSwitch.value = !toggleSwitch.value;\n
    "},{"location":"shape-toggleswitch/#read-only","title":"Read only","text":"
    • Get
      var readOnly = toggleSwitch.readOnly;\n
    • Set
      toggleSwitch.setReadOnly();\n// toggleSwitch.setReadOnly(true);\n
      or
      toggleSwitch.readOnly = true;\n
    "},{"location":"shape-toggleswitch/#track-fill-style","title":"Track fill style","text":"
    • Get
      var color = toggleSwitch.trackFillColor;\nvar alpha = toggleSwitch.trackFillAlpha;\n
      var color = toggleSwitch.falseValueTrackColor;\nvar alpha = toggleSwitch.falseValueTrackFillAlpha;\n
    • Set
      toggleSwitch.setTrackFillStyle(color, alpha);\n// toggleSwitch.trackFillColor = color;\n// toggleSwitch.trackFillAlpha = alpha;\n
      toggleSwitch.setFalseValueTrackFillStyle(color, alpha);\n// toggleSwitch.falseValueTrackColor = color;\n// toggleSwitch.falseValueTrackFillAlpha = alpha;\n
    "},{"location":"shape-toggleswitch/#thumb-fill-style","title":"Thumb fill style","text":"
    • Get
      var color = toggleSwitch.thumbColor;\nvar alpha = toggleSwitch.thumbAlpha;\n
    • Set
      toggleSwitch.setThumbStyle(color, alpha);\n// toggleSwitch.thumbColor = color;\n// toggleSwitch.thumbAlpha = alpha;\n
    "},{"location":"shape-toggleswitch/#toggle-animation","title":"Toggle animation","text":"
    • Duration
      • Get
        var duration = toggleSwitch.toggleAnimProgress;\n
      • Set
        toggleSwitch.setToggleAnimationDuration(duration);\ntoggleSwitch.toggleAnimProgress = duration;\n
    "},{"location":"shape-toggleswitch/#size","title":"Size","text":"
    • Get
      var width = toggleSwitch.width;\nvar height = toggleSwitch.height;\n
    • Set
      toggleSwitch.setSize(width, height);\n
      or
      toggleSwitch.width = width;\ntoggleSwitch.height = height;\n
    "},{"location":"shape-toggleswitch/#display-size","title":"Display size","text":"
    • Get
      var width = toggleSwitch.displayWidth;\nvar height = toggleSwitch.displayHeight;\n
    • Set
      toggleSwitch.setDisplaySize(width, height);\n
      or
      toggleSwitch.displayWidth = width;\ntoggleSwitch.displayHeight = height;\n
    "},{"location":"shape-toggleswitch/#track-size-ratio","title":"Track size ratio","text":"
    • Get
      var trackWidth = toggleSwitch.trackWidth;\nvar trackHeight = toggleSwitch.trackHeight;\n
      • trackWidth, trackHeight : Size ratio of track
    • Set
      toggleSwitch.setTrackSize(trackWidth, trackHeight);\n// toggleSwitch.trackWidth = trackWidth;\n// toggleSwitch.trackHeight = trackHeight;\n
    "},{"location":"shape-toggleswitch/#track-corner-ratio","title":"Track corner ratio","text":"
    • Get
      var trackRadius = toggleSwitch.trackRadius;\n
      • trackRadius : Corner ratio of track
    • Set
      toggleSwitch.setTrackRadius(trackRadius);\n// toggleSwitch.trackRadius = trackRadius;\n
    "},{"location":"shape-toggleswitch/#thumb-size-ratio","title":"Thumb size ratio","text":"
    • Get
      var thumbWidth = toggleSwitch.thumbWidth;\nvar thumbHeight = toggleSwitch.thumbHeight;\n
      • trackWidth, trackHeight : Size ratio of thumb
    • Set
      toggleSwitch.setThumbSize(thumbWidth, thumbHeight);\n// toggleSwitch.thumbWidth = thumbWidth;\n// toggleSwitch.thumbHeight = thumbHeight;\n
    "},{"location":"shape-toggleswitch/#thumb-corner-ratio","title":"Thumb corner ratio","text":"
    • Get
      var thumbRadius = toggleSwitch.thumbRadius;\n
      • thumbRadius : Corner ratio of track
    • Set
      toggleSwitch.setThumbRadius(thumbRadius);\n// toggleSwitch.thumbRadius = thumbRadius;\n
    "},{"location":"shape-toggleswitch/#thumb-position-ratio","title":"Thumb position ratio","text":"
    • Get
      var thumbLeft = toggleSwitch.thumbLeftX;\nvar thumbRight = toggleSwitch.thumbRightX;\n
      var rtl = toggleSwitch.rtl;\n
    • Set
      toggleSwitch.setThumbPosition(thumbLeft, thumbRight);\n// toggleSwitch.thumbLeftX = thumbLeft;\n// toggleSwitch.thumbRightX = thumbRight;\n
      toggleSwitch.setRTL(rtl);\n// toggleSwitch.rtl = rtl;\n
    "},{"location":"shape-toggleswitch/#events","title":"Events","text":"
    • On value change
      toggleSwitch.on('valuechange', function(value) {\n// value: checked\n})\n
    "},{"location":"shape-toggleswitch/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-toggleswitch/#create-mask","title":"Create mask","text":"
    var mask = toggleSwitch.createGeometryMask();\n

    See mask

    "},{"location":"shape-toggleswitch/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-triangle/","title":"Triangle","text":""},{"location":"shape-triangle/#introduction","title":"Introduction","text":"

    Triangle shape, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"shape-triangle/#usage","title":"Usage","text":""},{"location":"shape-triangle/#create-shape-object","title":"Create shape object","text":"
    var triangle = scene.add.triangle(x, y, x1, y1, x2, y2, x3, y3, fillColor);\n// var triangle = scene.add.triangle(x, y, x1, y1, x2, y2, x3, y3, fillColor, fillAlpha);\n
    "},{"location":"shape-triangle/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTriangle extends Phaser.GameObjects.Triangle {\nconstructor(scene, x, y, x1, y1, x2, y2, x3, y3, fillColor) {\nsuper(scene, x, y, x1, y1, x2, y2, x3, y3, fillColor);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var triangle = new MyTriangle(scene, x, y, x1, y1, x2, y2, x3, y3, fillColor);\n
    "},{"location":"shape-triangle/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = triangle.fillColor;\nvar alpha = triangle.fillAlpha;\n
      • Set
        triangle.setFillStyle(color, alpha);\n
      • Clear
        triangle.setFillStyle();\n
    • Stroke color
      • Get
        var color = triangle.strokeColor;\n
      • Set
        triangle.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        triangle.setStrokeStyle();\n

    No tint methods

    Uses triangle.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-triangle/#alpha","title":"Alpha","text":"
    • Get
      var alpha = triangle.alpha;\n
    • Set
      triangle.setAlpha(alpha);\n// triangle.alpha = alpha;\n
    "},{"location":"shape-triangle/#set-vertices","title":"Set vertices","text":"
    triangle.setTo(x1, y1, x2, y2, x3, y3);\n
    "},{"location":"shape-triangle/#triangle-width","title":"Triangle width","text":"
    triangle.setLineWidth(startWidth, endWidth);\n
    • endWidth : The end width of the triangle. Only used in WebGL.
    "},{"location":"shape-triangle/#display-size","title":"Display size","text":"
    • Get
      var width = triangle.displayWidth;\nvar height = triangle.displayHeight;\n
    • Set
      triangle.setDisplaySize(width, height);\n
      or
      triangle.displayWidth = width;\ntriangle.displayHeight = height;\n
    "},{"location":"shape-triangle/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-triangle/#create-mask","title":"Create mask","text":"
    var mask = triangle.createGeometryMask();\n

    See mask

    "},{"location":"shape-triangle/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shape-triangle2/","title":"Triangle 2","text":""},{"location":"shape-triangle2/#introduction","title":"Introduction","text":"

    Trangle shape inside a rectangle bounds.

    • Author: Rex
    • Game object
    "},{"location":"shape-triangle2/#live-demos","title":"Live demos","text":"
    • Ease direction
    • Rotate
    "},{"location":"shape-triangle2/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shape-triangle2/#install-plugin","title":"Install plugin","text":""},{"location":"shape-triangle2/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextriangleplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextriangleplugin.min.js', true);\n
    • Add triangle object
      var triangle = scene.add.rexTriangle(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-triangle2/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TrianglePlugin from 'phaser3-rex-plugins/plugins/triangle-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTrianglePlugin',\nplugin: TrianglePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add triangle object
      var triangle = scene.add.rexTriangle(x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-triangle2/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Triangle from 'phaser3-rex-plugins/plugins/triangle.js';\n
    • Add triangle object
      var triangle = new Triangle(scene, x, y, width, height, fillColor, fillAlpha);\nscene.add.existing(triangle);\n
    "},{"location":"shape-triangle2/#install-plugin_1","title":"Install plugin","text":"

    Install plugin in configuration of game

    var config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTrianglePlugin',\nplugin: TrianglePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"shape-triangle2/#create-instance","title":"Create instance","text":"
    var triangle = scene.add.rexTriangle(x, y, width, height, fillColor, fillAlpha);\n

    or

    var triangle = scene.add.rexTriangle({\nx: 0,\ny: 0,\nwidth: 2,\nheight: 2,\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n\narrowOnly: false,\n\ndirection: 0,\neaseDuration: 0,\npadding: 0,\n// padding: {\n//     left: 0,\n//     right: 0,\n//     top: 0,\n//     bottom: 0,\n// },\n\nradius: undefined,\n});\n
    • x, y : Position of this object.
    • width, height : Size of this object.
    • arrowOnly :
      • false : Fill and stroke triangle shape. Default behavior.
      • true : Only stroke arrow of triangle shape.
    • direction : Direction of triangle's arrow.
      • 0, or 'right' : Arrow to right. Default value.
      • 1, or 'down' : Arrow to down.
      • 2, or 'left' : Arrow to left.
      • 3, or 'up' : Arrow to up.
    • easeDuration : Ease duration when direction changed.
      • 0 : No ease transform. Default value.
    • padding : Space around triagnle.
      • A number. Default value is 0.
      • A plain object
        {\nleft:0, right:0, top: 0, bottom: 0\n}\n
    • radius : Put 3 vertices of trangle in a circle.
      • undefined : Disable this mode. Default behavior.
      • 0~1 : Radius in ratio of min(half-width, half-height)
    "},{"location":"shape-triangle2/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTriangle extends Triangle {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var triangle = new MyTriangle(scene, x, y, width, height, fillColor, fillAlpha);\n
    "},{"location":"shape-triangle2/#color","title":"Color","text":"
    • Fill color
      • Get
        var color = triangle.fillColor;\nvar alpha = triangle.fillAlpha;\n
      • Set
        triangle.setFillStyle(color, alpha);\n
      • Clear
        triangle.setFillStyle();\n
    • Stroke color
      • Get
        var color = triangle.strokeColor;\n
      • Set
        triangle.setStrokeStyle(lineWidth, color, alpha);\n
      • Clear
        triangle.setStrokeStyle();\n

    No tint methods

    Uses triangle.setFillStyle(color, alpha) to change color.

    "},{"location":"shape-triangle2/#alpha","title":"Alpha","text":"
    • Get
      var alpha = triangle.alpha;\n
    • Set
      triangle.setAlpha(alpha);\n// triangle.alpha = alpha;\n
    "},{"location":"shape-triangle2/#size","title":"Size","text":"
    • Get
      var width = triangle.width;\nvar height = triangle.height;\n
    • Set
      triangle.setSize(width, height);\n
      or
      triangle.width = width;\ntriangle.height = height;\n
    "},{"location":"shape-triangle2/#display-size","title":"Display size","text":"
    • Get
      var width = triangle.displayWidth;\nvar height = triangle.displayHeight;\n
    • Set
      triangle.setDisplaySize(width, height);\n
      or
      triangle.displayWidth = width;\ntriangle.displayHeight = height;\n
    "},{"location":"shape-triangle2/#direction","title":"Direction","text":"
    • Get
      var direction = triangle.direction;\n
      • 0 : Arrow to right. Default value.
      • 1 : Arrow to down.
      • 2 : Arrow to left.
      • 3 : Arrow to up.
    • Set
      triangle.setDirection(direction);\n// triangle.direction = direction;\n
      or
      triangle.setDirection(direction, easeDuration);\n
      • direction :
        • 0, or 'right' : Arrow to right.
        • 1, or 'down' : Arrow to down.
        • 2, or 'left' : Arrow to left.
        • 3, or 'up' : Arrow to up.
      • easeDuration : Override current ease-duration time.
    • Toggle
      triangle.toggleDirection();\n// triangle.direction += 2;\n
      or
      triangle.toggleDirection(easeDuration);\n
    "},{"location":"shape-triangle2/#padding","title":"Padding","text":"
    • Get
      var padding = triangle.padding;\n
      • padding :
        { left, right, top, bottom }\n
    • Set
      triangle.setPadding(padding);\n
      or
      triangle.setPadding({\nleft, right, top, bottom\n});\n
      or
      triangle.setPadding({\nx, y\n});\n
    "},{"location":"shape-triangle2/#ease-duration","title":"Ease duration","text":"
    • Get
      var easeDuration = triangle.easeDuration;\n
    • Set
      triangle.setEaseDuration(easeDuration);\n
    "},{"location":"shape-triangle2/#arrow-only","title":"Arrow only","text":"
    • Get
      var arrowOnly = triangle.arrowOnly;\n
    • Set
      triangle.setArrowOnly(enable);\n// triangle.arrowOnly = enable;\n
    "},{"location":"shape-triangle2/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"shape-triangle2/#create-mask","title":"Create mask","text":"
    var mask = triangle.createGeometryMask();\n

    See mask

    "},{"location":"shape-triangle2/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shatter-image/","title":"Image","text":""},{"location":"shatter-image/#introduction","title":"Introduction","text":"

    Shatter image to triangle faces.

    Reference: Delaunay Triangulation

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"shatter-image/#live-demos","title":"Live demos","text":"
    • Shatter image
    "},{"location":"shatter-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shatter-image/#install-plugin","title":"Install plugin","text":""},{"location":"shatter-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshatterimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshatterimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexShatterImage(x, y, texture, frame, config);\n
    "},{"location":"shatter-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ShatterImagePlugin from 'phaser3-rex-plugins/plugins/shatterimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShatterImagePlugin',\nplugin: ShatterImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexShatterImage(x, y, texture, frame, config);\n
    "},{"location":"shatter-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ShatterImage } from 'phaser3-rex-plugins/plugins/shatterimage.js';\n
    • Add image object
      var image = new ShatterImage(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"shatter-image/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexShatterImage(x, y, texture, frame, {\n// ringRadiusList: [1 / 27, 3 / 27, 9 / 27],\n// ringRadiusList: function(width, height) {\n//    return [1 / 27, 3 / 27, 9 / 27];\n// },\n\n// samplesPerRing: 12\n// variation: 0.25,    \n});\n

    or

    var image = scene.add.rexShatterImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n\n// ringRadiusList: [1 / 27, 3 / 27, 9 / 27],\n// ringRadiusList: function(width, height) {\n//    return [1 / 27, 3 / 27, 9 / 27];\n// },\n\n// samplesPerRing: 12,\n// variation: 0.25,\n\n});\n
    • ringRadiusList :
      • A list of number. Default value is [1 / 27, 3 / 27, 9 / 27]
      • A callback to return a list of number
        function(width, height) {\nreturn [1 / 27, 3 / 27, 9 / 27];\n}\n

    Add perspectiveimage from JSON

    var perspectiveimage = scene.make.rexShatterImage({\nx: 0,\ny: 0,\nkey: null,\nframe: null,\n\n// ringRadiusList: [1 / 27, 3 / 27, 9 / 27],\n// ringRadiusList: function(width, height) {\n//    return [1 / 27, 3 / 27, 9 / 27];\n// },\n\n// samplesPerRing: 12,\n// variation: 0.25,\n\n\nadd: true\n});\n
    "},{"location":"shatter-image/#custom-class","title":"Custom class","text":"
    • Define class
      class MyShatterImage( extends ShatterImage( {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyShatterImage(scene, x, y, texture, frame, config);\n
    "},{"location":"shatter-image/#shatter-image","title":"Shatter image","text":"
    image.shatter(centerX, centerY);\n// image.shatter();\n

    or

    image.shatter(centerX, centerY, {\n// ringRadiusList:\n// samplesPerRing: \n// variation\n});\n

    or

    image.shatter({\n// centerX: \n// centerY: \n// ringRadiusList:\n// samplesPerRing: \n// variation\n});\n
    • centerX, centerY : Center position of shatter.
      • undefined : Default value is center of image.

    Shatter image into triangle faces.

    "},{"location":"shatter-image/#position-of-shatter-center","title":"Position of Shatter center","text":"
    var shatterCenter = image.shatterCenter; // {x, y}\n
    "},{"location":"shatter-image/#faces","title":"Faces","text":"
    var faces = image.faces;\n

    Faces will be sorted nearby shatter-center to far away.

    "},{"location":"shatter-image/#properties","title":"Properties","text":"
    • Alpha
      • Get
        var alpha = face.alpha;\n
      • Set
        face.alpha = alpha;\n
        or
        face.setAlpha(value);\n
    • Tint color
      • Get
        var color = face.tint;\n
      • Set
        face.tint = color;\n
        or
        face.setTint(color);\n
    • Angle
      • Get
        var radians = face.rotation;\n// var degree = face.angle;\n
      • Set
        face.rotation = radians;\n// face.angle = degree;\n
        or
        face.setRotation(radians);\n// face.setAngle(degree);\n
    • Center position
      • Get
        var x = face.x;\nvar y = face.y;\n
        • x : 0(left) ~ 1(right)
        • y : 1(top) ~ 0(bottom)
      • Set
        face.x = x;\nface.y = y;\n
        or
        face.translate(x, y);\n
        • x : 0(left) ~ 1(right)
        • y : 1(top) ~ 0(bottom)
    "},{"location":"shatter-image/#update-properties","title":"Update properties","text":"
    • Start updating
      image.startUpdate();\n
      or
      image.ignoreDirtyCache = true;\n
    • Stop updating
      image.stopUpdate();\n
      or
      image.ignoreDirtyCache = false;\n
    "},{"location":"shatter-image/#tween-properties","title":"Tween properties","text":"
    image.startUpdate();\nscene.tweens.add({\ntargets: image.faces,\nalpha: 0,\nangle: function () { return -90 + Math.random() * 180; },\ny: '-=0.5',\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\ndelay: scene.tweens.stagger(20),\nrepeat: 0,            // -1: infinity\nyoyo: false,\nonComplete: function () {\nimage.stopUpdate()\n}\n});\n
    "},{"location":"shatter-image/#reset-image","title":"Reset image","text":"

    Display original image with 2 faces.

    image.resetImage();\n
    "},{"location":"shatter-image/#tint-color","title":"Tint color","text":"
    • Get
      var color = image.tint;\n
    • Set
      image.tint = color;\n
      or
      image.setTint(color);\n
    "},{"location":"shatter-image/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"shatter-image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"shatter-image/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"shatter-rendertexture/","title":"Render texture","text":""},{"location":"shatter-rendertexture/#introduction","title":"Introduction","text":"

    Shatter render texture to triangle faces.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"shatter-rendertexture/#live-demos","title":"Live demos","text":"
    • RenderTexture
    "},{"location":"shatter-rendertexture/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"shatter-rendertexture/#install-plugin","title":"Install plugin","text":""},{"location":"shatter-rendertexture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshatterimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshatterimageplugin.min.js', true);\n
    • Add render texture object
      var image = scene.add.rexShatterRenderTexture(x, y, width, height, config);\n
    "},{"location":"shatter-rendertexture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ShatterImagePlugin from 'phaser3-rex-plugins/plugins/shatterimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShatterImagePlugin',\nplugin: ShatterImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add render texture object
      var image = scene.add.rexShatterRenderTexturege(x, y, width, height, config);\n
    "},{"location":"shatter-rendertexture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ShatterRenderTexture } from 'phaser3-rex-plugins/plugins/shatterimage.js';\n
    • Add render texture object
      var image = new ShatterRenderTexture(scene, x, y, width, height, config);\nscene.add.existing(image);\n
    "},{"location":"shatter-rendertexture/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexShatterRenderTexturege(x, y, width, height, {\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    or

    var image = scene.add.rexShatterRenderTexturege({\n// x: 0,\n// y: 0,\n// width: 32,\n// height: 32,\n// gridWidth: 32,\n// girdHeight: 32\n});\n

    Add prespective render texture from JSON

    var image = scene.make.rexShatterRenderTexturege({\nx: 0,\ny: 0,    width: 32,\nheight: 32,\n\n// gridWidth: 32,\n// girdHeight: 32,\n\nadd: true\n});\n
    "},{"location":"shatter-rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MyShatterRenderTexturege extends ShatterRenderTexturege {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyShatterRenderTexturege(scene, x, y, width, height, config);\n
    "},{"location":"shatter-rendertexture/#internal-render-texture","title":"Internal render texture","text":"
    var rt = image.rt;\n
    • rt : Render texture
    "},{"location":"shatter-rendertexture/#paste-texture","title":"Paste texture","text":"
    • Paste game object
      image.rt.draw(gameObject, x, y);\n// image.rt.draw(gameObject, x, y, alpha, tint);\n
    • gameObject : a game object, or an array of game objects
    • Paste game objects in a group
      image.rt.draw(group, x, y);\n// image.rt.draw(group, x, y, alpha, tint);\n
    • Paste game objects in a scene
      image.rt.draw(scene.children, x, y);\n// image.rt.draw(scene.children, x, y, alpha, tint);\n
    • Paste texture
      image.rt.draw(key, x, y);\n// image.rt.draw(key, x, y, alpha, tint);\n
      or
      image.rt.drawFrame(key, frame, x, y);\n// image.rt.drawFrame(key, frame, x, y, alpha, tint);\n
      • key : The key of the texture to be used, as stored in the Texture Manager.
    "},{"location":"shatter-rendertexture/#erase","title":"Erase","text":"
    image.rt.erase(gameObject, x, y);\n
    • gameObject : a game object, or an array of game objects
    "},{"location":"shatter-rendertexture/#clear","title":"Clear","text":"
    image.rt.clear();\n
    "},{"location":"shatter-rendertexture/#fill","title":"Fill","text":"
    image.rt.fill(rgb, alpha);\n// image.rt.fill(rgb, alpha, x, y, width, height);\n
    "},{"location":"shatter-rendertexture/#other-properties","title":"Other properties","text":"

    See Shatter image game object, Mesh game object, game object

    "},{"location":"shatter-rendertexture/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"shatter-rendertexture/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"ship/","title":"Ship","text":""},{"location":"ship/#introduction","title":"Introduction","text":"

    Move game object as a space ship by cursor keys.

    • Author: Rex
    • Arcade behavior of game object
    "},{"location":"ship/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ship/#install-plugin","title":"Install plugin","text":""},{"location":"ship/#load-minify-file","title":"Load minify file","text":"
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexshipplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexshipplugin.min.js', true);\n
    • Add ship behavior
      var ship = scene.plugins.get('rexshipplugin').add(gameObject, config);\n
    "},{"location":"ship/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine and install plugin in configuration of game
      import ShipPlugin from 'phaser3-rex-plugins/plugins/ship-plugin.js';\nvar config = {\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexShip',\nplugin: ShipPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add ship behavior
      var ship = scene.plugins.get('rexShip').add(gameObject, config);\n
    "},{"location":"ship/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable arcade physics engine in configuration of game
      var config = {\n// ...\nphysics: {\ndefault: 'arcade',\narcade: {\n// debug: true\n}\n}\n}\nvar game = new Phaser.Game(config);\n
    • Import class
      import Ship from 'phaser3-rex-plugins/plugins/ship.js';\n
    • Add ship behavior
      var ship = new Ship(gameObject, config);\n
    "},{"location":"ship/#create-instance","title":"Create instance","text":"
    var ship = scene.plugins.get('rexShip').add(gameObject, {\n// maxSpeed: 200,\n// acceleration: 200,\n// drag: 0.99,\n// turnSpeed: 300,\n// wrap: true,\n// padding: 0,\n// enable: true,\n// cursorKeys: scene.input.keyboard.createCursorKeys()\n});\n
    • Movement
      • maxSpeed
      • acceleration
      • drag
    • Rotation
      • turnSpeed : Angular velocity
    • Wrap
      • wrap : Set true to enable wrap mode. Default value is true.
      • padding
    • enable : set false to disable moving.
    • cursorKeys : CursorKey object, using keyboard's cursorKeys by default.
    "},{"location":"ship/#set-max-speed","title":"Set max speed","text":"
    ship.setMaxSpeed(speed);\n
    "},{"location":"ship/#set-acceleration","title":"Set acceleration","text":"
    ship.setAcceleration(acc);\n
    "},{"location":"ship/#set-drag","title":"Set drag","text":"
    ship.setDrag(drag);\n
    "},{"location":"ship/#set-turn-speed","title":"Set turn speed","text":"
    ship.setTurnSpeed(angularVelocity);\n
    "},{"location":"ship/#set-wrap-mode","title":"Set wrap mode","text":"
    ship.setWrapMode(wrap, padding);\n
    • wrap : Set true to enable wrap mode.
    "},{"location":"skew-image/","title":"Image","text":""},{"location":"skew-image/#introduction","title":"Introduction","text":"

    Skewable Image.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"skew-image/#live-demos","title":"Live demos","text":"
    • Skew image
    "},{"location":"skew-image/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"skew-image/#install-plugin","title":"Install plugin","text":""},{"location":"skew-image/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexSkewImage(x, y, texture, frame);\n
    "},{"location":"skew-image/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexSkewImage(x, y, texture, frame);\n
    "},{"location":"skew-image/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SkewImage } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add image object
      var image = new SkewImage(scene, x, y, texture, frame);\nscene.add.existing(image);\n
    "},{"location":"skew-image/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexSkewImage(x, y, texture, frame);\n

    or

    var image = scene.add.rexSkewImage({\n// x: 0,\n// y: 0,\nkey,\n// frame: null,\n});\n

    Add quadimage from JSON

    var quadimage = scene.make.rexSkewImage({\nx: 0,\ny: 0,\n\nkey: null,\nframe: null,\n\nadd: true\n});\n
    "},{"location":"skew-image/#custom-class","title":"Custom class","text":"
    • Define class
      class MySkewImage extends SkewImage {\nconstructor(scene, x, y, texture, frame) {\nsuper(scene, x, y, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MySkewImage(scene, x, y, texture, frame);\n
    "},{"location":"skew-image/#skew","title":"Skew","text":"
    • Set
      image.setSkewX(skewXRad);\nimage.setSkewXDeg(skewXDeg);\n
      image.setSkewY(skewXRad);\nimage.setSkewYDeg(skewXDeg);\n
      image.setSkew(skewXRad, skewYRad);\nimage.setSkewDeg(skewXDeg, skewYDeg);\n
      image.skewX = skewXRad;\nimage.skewXDeg = skewXDeg;\n
      image.skewY = skewYRad;\nimage.skewYDeg = skewYDeg;\n
    • Get
      var skewXRad = image.skewX;\nvar skewXDeg = image.skewXDeg;\n
      var skewYRad = image.skewY;\nvar skewYDeg = image.skewYDeg;\n
    "},{"location":"skew-image/#other-properties","title":"Other properties","text":"

    See Mesh game object, game object

    "},{"location":"skew-image/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"skew-image/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"skew-rendertexture/","title":"Render texture","text":""},{"location":"skew-rendertexture/#introduction","title":"Introduction","text":"

    Skewable render texture.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"skew-rendertexture/#live-demos","title":"Live demos","text":""},{"location":"skew-rendertexture/#usage","title":"Usage","text":""},{"location":"skew-rendertexture/#install-plugin","title":"Install plugin","text":""},{"location":"skew-rendertexture/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexquadimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexquadimageplugin.min.js', true);\n
    • Add render texture object
      var image = scene.add.rexSkewRenderTexture(x, y, width, height);\n
    "},{"location":"skew-rendertexture/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import QuadImagePlugin from 'phaser3-rex-plugins/plugins/quadimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexQuadImagePlugin',\nplugin: QuadImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add render texture object
      var image = scene.add.rexSkewRenderTexturege(x, y, width, height);\n
    "},{"location":"skew-rendertexture/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SkewRenderTexture } from 'phaser3-rex-plugins/plugins/quadimage.js';\n
    • Add render texture object
      var image = new SkewRenderTexture(scene, x, y, width, height);\nscene.add.existing(image);\n
    "},{"location":"skew-rendertexture/#create-instance","title":"Create instance","text":"
    var image = scene.add.rexSkewRenderTexturege(x, y, width, height);\n

    or

    var image = scene.add.rexSkewRenderTexturege({\n// x: 0,\n// y: 0,\n// width: 32,\n// height: 32,\n});\n

    Add prespective render texture from JSON

    var image = scene.make.rexSkewRenderTexturege({\nx: 0,\ny: 0,    width: 32,\nheight: 32,\n\nadd: true\n});\n
    "},{"location":"skew-rendertexture/#custom-class","title":"Custom class","text":"
    • Define class
      class MySkewRenderTexturege extends SkewRenderTexturege {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MySkewRenderTexturege(scene, x, y, width, height);\n
    "},{"location":"skew-rendertexture/#internal-render-texture","title":"Internal render texture","text":"
    var rt = image.rt;\n
    • rt : Render texture
    "},{"location":"skew-rendertexture/#paste-texture","title":"Paste texture","text":"
    • Paste game object
      image.rt.draw(gameObject, x, y);\n// image.rt.draw(gameObject, x, y, alpha, tint);\n
    • gameObject : a game object, or an array of game objects
    • Paste game objects in a group
      image.rt.draw(group, x, y);\n// image.rt.draw(group, x, y, alpha, tint);\n
    • Paste game objects in a scene
      image.rt.draw(scene.children, x, y);\n// image.rt.draw(scene.children, x, y, alpha, tint);\n
    • Paste texture
      image.rt.draw(key, x, y);\n// image.rt.draw(key, x, y, alpha, tint);\n
      or
      image.rt.drawFrame(key, frame, x, y);\n// image.rt.drawFrame(key, frame, x, y, alpha, tint);\n
      • key : The key of the texture to be used, as stored in the Texture Manager.
    "},{"location":"skew-rendertexture/#erase","title":"Erase","text":"
    image.rt.erase(gameObject, x, y);\n
    • gameObject : a game object, or an array of game objects
    "},{"location":"skew-rendertexture/#clear","title":"Clear","text":"
    image.rt.clear();\n
    "},{"location":"skew-rendertexture/#fill","title":"Fill","text":"
    image.rt.fill(rgb, alpha);\n// image.rt.fill(rgb, alpha, x, y, width, height);\n
    "},{"location":"skew-rendertexture/#other-properties","title":"Other properties","text":"

    See Skew image game object, Mesh game object, game object

    "},{"location":"skew-rendertexture/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"skew-rendertexture/#shader-effects","title":"Shader effects","text":"

    Support postFX effects

    Note

    No preFX effect support

    "},{"location":"slider/","title":"Slider","text":""},{"location":"slider/#introduction","title":"Introduction","text":"

    Drag thumb on a slider bar.

    • Author: Rex
    • Behavior of game object
    "},{"location":"slider/#live-demos","title":"Live demos","text":"
    • Slider
    • Color picker
    "},{"location":"slider/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"slider/#install-plugin","title":"Install plugin","text":""},{"location":"slider/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexsliderplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexsliderplugin.min.js', true);\n
    • Add slider behavior
      var slider = scene.plugins.get('rexsliderplugin').add(gameObject, config);\n
    "},{"location":"slider/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import SliderPlugin from 'phaser3-rex-plugins/plugins/slider-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexSlider',\nplugin: SliderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add slider behavior
      var slider = scene.plugins.get('rexSlider').add(gameObject, config);\n
    "},{"location":"slider/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Slider from 'phaser3-rex-plugins/plugins/slider.js';\n
    • Add slider behavior
      var slider = new Slider(gameObject, config);\n
    "},{"location":"slider/#create-instance","title":"Create instance","text":"
    var slider = scene.plugins.get('rexSlider').add(gameObject, {\n// endPoints: [\n//     {x:0, y:0},\n//     {x:0, y:0}\n// ],\n// value: 0,\n// enable: true,\n\n// valuechangeCallback: null,\n// valuechangeCallbackScope: null\n});\n
    • endPoints : An array of 2 end-points ([{x,y}, {x,y}])
    • value : Initial value between 0 to 1
    • enable : Set true to drag thumb
    • valuechangeCallback , valuechangeCallbackScope : Bind this callback to valuechange event
    "},{"location":"slider/#set-end-points","title":"Set end-points","text":"
    slider.setEndPoints(p0x, p0y, p1x, p1y);\n// slider.setEndPoints(p0, p1); // p0, p1: {x, y}\n// slider.setEndPoints(points); // points: [p0, p1]\n
    "},{"location":"slider/#get-value","title":"Get value","text":"
    var value = slider.value;          // value: between 0 to 1\n// var value = slider.getValue();  // value: between 0 to 1\n// var value = slider.getValue(min, max);  // value: between min to max\n
    "},{"location":"slider/#set-value","title":"Set value","text":"
    slider.value = newValue;       // newValue: between 0 to 1\n// slider.setValue(newValue);  // newValue: between 0 to 1\n// slider.setValue(newValue, min, max);  // newValue: between min to max\n
    slider.addValue(inc);  // inc: between 0 to 1\n// slider.addValue(inc, min, max);  // inc: between min to max\n

    Fires valuechange event if new value is not equal to current value.

    "},{"location":"slider/#events","title":"Events","text":"
    • Value changed
      slider.on('valuechange', function(newValue, prevValue){ /* ... */ });\n
      • newValue: between 0 to 1
      • prevValue: between 0 to 1
    "},{"location":"slider/#drag","title":"Drag","text":""},{"location":"slider/#drag-enable","title":"Drag enable","text":"
    • Get
      var enable = slider.enable;\n
    • Set
      slider.setEnable(enable);  // enable: true, or false\nslider.enable = enable;\n
    • Toggle
      slider.toggleEnable();\n
    "},{"location":"slider/#is-dragging","title":"Is dragging","text":"
    var isDragging = slider.isDragging;\n
    "},{"location":"snap/","title":"Snap","text":""},{"location":"snap/#introduction","title":"Introduction","text":"

    Snap a value to nearest grid slice, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"snap/#usage","title":"Usage","text":""},{"location":"snap/#round","title":"Round","text":"
    var out = Phaser.Math.Snap.To(value, gap);\n// var out = Phaser.Math.Snap.To(value, gap, start);\n

    Example: set gap to 5

    • Set value to 12, return 10
    • Set value to 14, return 15
    "},{"location":"snap/#ceil","title":"Ceil","text":"
    var out = Phaser.Math.Snap.Ceil(value, gap);\n// var out = Phaser.Math.Snap.Ceil(value, gap, start);\n

    Example: set gap to 5

    • Set value to 12, return 15
    • Set value to 14, return 15
    "},{"location":"snap/#floor","title":"Floor","text":"
    var out = Phaser.Math.Snap.Floor(value, gap);\n// var out = Phaser.Math.Snap.Floor(value, gap, start);\n

    Example: set gap to 5

    • Set value to 12, return 10
    • Set value to 14, return 10
    "},{"location":"snapshot/","title":"Snapshot","text":""},{"location":"snapshot/#introduction","title":"Introduction","text":"

    Get snapshot image, built-in methods of phaser.

    • Author: Richard Davey
    "},{"location":"snapshot/#usage","title":"Usage","text":""},{"location":"snapshot/#get-snapshot-image","title":"Get snapshot image","text":"
    • Whole canvas
      game.renderer.snapshot(callback);\n// game.renderer.snapshot(callback, type, encoderOptions);\n
    • A rectangle area
      game.renderer.snapshotArea(x, y, width, height, callback);\n// game.renderer.snapshot(x, y, width, height, callback, type, encoderOptions);\n
      • x, y, width, height : Top-left position and size based on game viewport. (not the world)
    • A pixel
      game.renderer.snapshotPixel(x, y, callback);\n

    Parameters:

    • type : 'image/png'
    • encoderOptions : 0.92
    • callback :
      function(image){ /* ... */};\n
      • image : Image element
    "},{"location":"sprite/","title":"Sprite","text":""},{"location":"sprite/#introduction","title":"Introduction","text":"

    Display of both static and animated images, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"sprite/#usage","title":"Usage","text":""},{"location":"sprite/#load-texture","title":"Load texture","text":"

    Texture for static image

    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"sprite/#load-atlas","title":"Load atlas","text":"

    Atlas for animation images

    scene.load.atlas(key, textureURL, atlasURL);\n

    Reference: load atlas

    "},{"location":"sprite/#add-sprite-object","title":"Add sprite object","text":"
    var sprite = scene.add.sprite(x, y, key);\n// var sprite = scene.add.sprite(x, y, key, frame);\n

    Add sprite from JSON

    var sprite = scene.make.sprite({\nx: 0,\ny: 0,\nkey: '',\n// frame: '',\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n\n// anims: {\n// key: ,\n// repeat: ,\n// ...\n// },\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    • key :
      • A string
      • An array of string to pick one element at random
    • x, y, scale.x, scale.y :
      • A number
      • A callback to get return value
        function() { return 0; }\n
      • Random integer between min and max
        { randInt: [min, max] }\n
      • Random float between min and max
        { randFloat: [min, max] }\n
    "},{"location":"sprite/#custom-class","title":"Custom class","text":"
    • Define class
      class MySprite extends Phaser.GameObjects.Sprite {\nconstructor(scene, x, y, texture, frame) {\nsuper(scene, x, y, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var sprite = new MySprite(scene, x, y, key);\n
    "},{"location":"sprite/#texture","title":"Texture","text":"

    See game object - texture

    "},{"location":"sprite/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"sprite/#create-mask","title":"Create mask","text":"
    var mask = sprite.createBitmapMask();\n

    See mask

    "},{"location":"sprite/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"sprite/#animation","title":"Animation","text":""},{"location":"sprite/#create-animation","title":"Create animation","text":"
    • Global animation for all sprites
      scene.anims.create(config);\n
    • Private animation for this sprite
      sprite.anims.create(config);\n

    config : See Add animation section.

    "},{"location":"sprite/#create-aseprite-animation","title":"Create Aseprite animation","text":"
    • Global Aseprite animation for all sprites
      scene.anims.createFromAseprite(key, tags);\n
    • Private Aseprite animation for this sprite
      sprite.anims.createFromAseprite(key, tags);\n
    "},{"location":"sprite/#remove-animation","title":"Remove animation","text":"
    • Remove from global animation manager
      scene.anims.remove(key);\n
      or
      sprite.anims.globalRemove(key);\n
    • Remove from private animation state
      sprite.anims.remove(key);\n
    "},{"location":"sprite/#get-animation","title":"Get animation","text":"
    • Get global animation object
      var anim = scene.anims.get(key);\n
    • Get private animation object
      var anim = sprite.anims.get(key);\n
    "},{"location":"sprite/#has-animation","title":"Has animation","text":"
    • Has global animation object
      var hasAnim = scene.anims.exists(key);\n
    • Get private animation object
      var hasAnim = sprite.anims.exists(key);\n
    "},{"location":"sprite/#play-animation","title":"Play animation","text":"
    • Play
      sprite.play(key);\n// sprite.play(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
        • String key of animation
        • Animation config, to override default config
          {\nkey,\nframeRate,\nduration,\ndelay,\nrepeat,\nrepeatDelay,\nyoyo,\nshowOnStart,\nhideOnComplete,\nstartFrame,\ntimeScale\n}\n
    • Play in reverse
      sprite.playReverse(key);\n// sprite.playReverse(key, ignoreIfPlaying);\n
      • key : Animation key string, or animation config
    • Play after delay
      sprite.playAfterDelay(key, delay);\n
      • key : Animation key string, or animation config
    • Play after repeat
      sprite.playAfterRepeat(key, repeatCount);\n
      • key : Animation key string, or animation config
    "},{"location":"sprite/#chain","title":"Chain","text":"
    • Chain next animation
      sprite.chain(key);\n
      • key : Animation key string, or animation config
    • Chain next and next animation
      sprite.chain(key0).chain(key1);\n
      • key0, key1 : Animation key string, or animation config
    "},{"location":"sprite/#stop","title":"Stop","text":"
    • Immediately stop
      sprite.stop();\n
    • Stop after delay
      sprite.stopAfterDelay(delay);\n
    • Stop at frame
      sprite.stopOnFrame(frame);\n
      • frame : Frame object in current animation.
        var currentAnim = sprite.anims.currentAnim;\nvar frame = currentAnim.getFrameAt(index);\n
    • Stop after repeat
      sprite.stopAfterRepeat(repeatCount);\n
    "},{"location":"sprite/#restart","title":"Restart","text":"
    sprite.anims.restart();\n// sprite.anims.restart(includeDelay, resetRepeats);\n
    "},{"location":"sprite/#time-scale","title":"Time scale","text":"
    • Get
      var timeScale = sprite.anims.globalTimeScale;\n
    • Set
      sprite.anims.globalTimeScale = timeScale;\n

    See also Global time scale

    "},{"location":"sprite/#properties","title":"Properties","text":"
    • Has started
      var hasStarted = sprite.anims.hasStarted;\n
    • Is playing
      var isPlaying = sprite.anims.isPlaying;\n
    • Is paused
      var isPaused = sprite.anims.isPaused;\n
    • Total frames count
      var frameCount = sprite.anims.getTotalFrames();\n
    • Delay
      var delay = sprite.anims.delay;\n
    • Repeat
      • Total repeat count
        var repeatCount = sprite.anims.repeat;\n
      • Repeat counter
        var repeatCount = sprite.anims.repeatCounter;\n
      • Repeat delay
        var repeatDelay = sprite.anims.repeatDelay;\n
      • Yoyo
        var repeatDelay = sprite.anims.yoyo;\n
    • Current animation key
      var key = sprite.anims.getName();\n
      • key : Return '' if not playing any animation.
    • Current frame name
      var frameName = sprite.anims.getFrameName();\n
      • frameName : Return '' if not playing any animation.
    • Current animation
      var currentAnim = sprite.anims.currentAnim;\n
    • Current frame
      var currentFrame = sprite.anims.currentFrame;\n
    "},{"location":"sprite/#events","title":"Events","text":"
    • On start
      sprite.on('animationstart', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationstart-' + key, function(currentAnim, currentFrame, sprite){});\n
    • On restart
      sprite.on('animationrestart', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationrestart-' + key, function(currentAnim, currentFrame, sprite){});\n
    • On complete
      sprite.on('animationcomplete', function(currentAnim, currentFramee, sprite){});\n
      sprite.on('animationcomplete-' + key, function(currentAnim, currentFramee, sprite){});\n
    • On stop
      sprite.on('animationstop', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationstop-' + key, function(currentAnim, currentFrame, sprite){});\n
    • On update
      sprite.on('animationupdate', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationupdate-' + key, function(currentAnim, currentFrame, sprite){});\n
    • On repeat
      sprite.on('animationrepeat', function(currentAnim, currentFrame, sprite){});\n
      sprite.on('animationrepeat-' + key, function(currentAnim, currentFrame, sprite){});\n
    "},{"location":"statemanager/","title":"State manager","text":""},{"location":"statemanager/#introduction","title":"Introduction","text":"

    Another version of Finite state machine.

    • Author: Rex
    • Object
    "},{"location":"statemanager/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"statemanager/#install-plugin","title":"Install plugin","text":""},{"location":"statemanager/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexstatemanagerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexstatemanagerplugin.min.js', true);\n
    • Add StateManager object
      var states = scene.plugins.get('rexstatemanagerplugin').add(config);\n
    "},{"location":"statemanager/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import StateManagerPlugin from 'phaser3-rex-plugins/plugins/statemanager-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexStateManager',\nplugin: StateManagerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add StateManager object
      var states = scene.plugins.get('rexStateManager').add(config);\n
    "},{"location":"statemanager/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import StateManager from 'phaser3-rex-plugins/plugins/statemanager.js';\n
    • Add StateManager object
      var states = new StateManager(config);\n
    "},{"location":"statemanager/#create-instance","title":"Create instance","text":"
    var states = scene.plugins.get('rexStateManager').add({\neventEmitter: undefined\n});\n
    • eventEmitter
      • undefined : Create a private event emitter, default value.
      • false : Don't add any event emitter, i.e. no event will be fired.
      • Event emitter object : Fire event through this event emitter.
    "},{"location":"statemanager/#custom-class","title":"Custom class","text":"
    • Define class
      class MyStates extends StateManager {\nconstructor(config) {\nsuper(config);\n\nthis.addStates({\nA: {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n},\n// ...\n});\n}\n}\n
    • Create instance
      var states = new MyStates(config);\n
    "},{"location":"statemanager/#add-new-state","title":"Add new state","text":"

    states.addState(name, {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n})\n
    states.addState({\nname: 'A',\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n})\n

    or

    states.addStates({\n'A' : {\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n},\n// ...\n})\n
    states.addStates([\n{\nname: 'A',\nnext: 'B',  // function() { return 'B'; }\nenter: function() {},\nexit: function() {}\n},\n// ...\n]);\n

    "},{"location":"statemanager/#read-state","title":"Read state","text":"
    • Current state
      var curState = state.state;\n
    • Previous state
      var preState = state.prevState;\n
    "},{"location":"statemanager/#start-at-state","title":"Start at state","text":"

    Set new state without triggering any state-changing callbacks or events.

    state.start(newState);\n
    "},{"location":"statemanager/#next-state","title":"Next state","text":"
    graph TB\n\nnext[\"states.next()\"] --> next_A[\"stateA.next()<br>return 'B'\"]\n\nnext_A --> eventStateChange[\"states.emit('statechange', states)<br>states.prevState -> states.state\"]\n\nsubgraph State changing\n\neventStateChange --> exit_A[\"stateA.exit()\"]\nexit_A --> eventExitA[\"states.emit('exit_A', states)\"]\n\neventExitA --> enter_B[\"stateB.enter()\"]\nenter_B --> eventEnterB[\"states.emit('enter_B', states)\"]\n\nsubgraph Exit\nexit_A\neventExitA\nend\n\nsubgraph Enter\nenter_B\neventEnterB\nend\n\nend\n\ngoto[\"states.goto('B')\"] --> eventStateChange\n\nsubgraph Request\n\nsubgraph Next\nnext\nnext_A\nend\n\nsubgraph Goto\ngoto\nend\n\nend
    "},{"location":"statemanager/#request","title":"Request","text":"
    • Get next state by callback
      states.next();    // nextState = stateA.next()    \n
    • Goto state
      states.goto(nextState);\n// states.state = nextState;\n
    "},{"location":"statemanager/#state-changing","title":"State-changing","text":"

    These callbacks or events will be triggered if state is changing.

    For example, state is changing from 'A' to 'B'.

    1. event statechange
      states.on('statechange', function(states) {\nconsole.log( states.prevState + '->' + states.state );\n});\n
    2. callback stateA.exit
    3. event exit_A
      states.on('exit_A', function(states) {\n/*...*/\n});\n
    4. callback stateB.enter
    5. event enter_B
      states.on('enter_B', function(states) {\n/*...*/\n});\n
    "},{"location":"statemanager/#enable","title":"Enable","text":"
    states.setEnable();\n// states.setEnable(false); // disable\n

    or

    states.toggleEnable();\n

    states.next() and states.goto() will be ignored if disabled.

    "},{"location":"statemanager/#update","title":"Update","text":"
    • Start
      states.startUpdate();\nstates.startPreUpdate();\nstates.startPostUpdate();\n// Assume that `scene` is assigned in config of constructor\n
      or
      states.startUpdate(scene);\nstates.startPreUpdate(scene);\nstates.startPostUpdate(scene);\n
      • scene : Scene object
    • Stop
      states.stopUpdate();\nstates.stopPreUpdate();\nstates.stopPostUpdate();\n
    • Get scene
      var scene = states.getScene();\n// var scene = states._scene;\n
    "},{"location":"statemanager/#remove-state","title":"Remove state","text":"
    • Remve a state
      states.removeState(stateName);\n
    • Remve all states
      states.removeAllStates();\n
    "},{"location":"step/","title":"Step","text":""},{"location":"step/#introduction","title":"Introduction","text":"

    Interpolate points between previous position and current position with fixed step length.

    • Author: Rex
    • Behavior of game object
    "},{"location":"step/#live-demos","title":"Live demos","text":"
    • Step
    "},{"location":"step/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"step/#install-plugin","title":"Install plugin","text":""},{"location":"step/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexstepplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexstepplugin.min.js', true);\n
    • Add step behavior
      var step = scene.plugins.get('rexstepplugin').add(gameObject, config);\n
    "},{"location":"step/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import StepPlugin from 'phaser3-rex-plugins/plugins/step-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexStep',\nplugin: StepPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add move-to behavior
      var step = scene.plugins.get('rexStep').add(gameObject, config);\n
    "},{"location":"step/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Step from 'phaser3-rex-plugins/plugins/step.js';\n
    • Add move-to behavior
      var step = new Step(gameObject, config);\n
    "},{"location":"step/#create-instance","title":"Create instance","text":"
    var step = scene.plugins.get('rexStep').add(gameObject, {\n// enable: true,\n// stepLength: 5,    \n});\n
    • enable : Set true to fire step event for each interpolate point.
    • stepLength : Fixed length between each interpolate point.
    "},{"location":"step/#enable","title":"Enable","text":"
    • Enable (default)
      step.setEnable();\n
      or
      step.enable = true;\n
    • Disable
      step.setEnable(false);\n
      or
      step.enable = false;\n
    "},{"location":"step/#set-step-length","title":"Set step length","text":"
    step.setStepLength(stepLength);\n// step.stepLength = stepLength;\n
    "},{"location":"step/#events","title":"Events","text":"
    • On each interpolate point
      step.on('step', function(gameObject, step, x, y){\n\n}, scope);\n
      • Invoke step.cancelStep() to cancel interpolation.
    • On interpolate points between previous position and current position
      step.on('steps', function(gameObject, step, points){\n\n}, scope);\n
      • points : Array of point {x, y}
    "},{"location":"step/#inject-methods","title":"Inject methods","text":"
    • Inject methods into game object
      scene.plugins.get('rexStep').injectMethods(gameObject);\n
    • Inject methods into class of game object
      scene.plugins.get('rexStep').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexStep').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into class of game object
      scene.plugins.get('rexStep').injectMethods(GameObjectClass.prototype);\n// scene.plugins.get('rexStep').injectMethods(Phaser.GameObjects.Sprite.prototype);\n
    • Inject methods into root class of game object
      scene.plugins.get('rexStep').injectMethodsToRootClass(e);\n// scene.plugins.get('rexStep').injectMethods(Phaser.GameObjects.GameObject.prototype);\n
    "},{"location":"step/#injected-methods","title":"Injected methods","text":"
    • Step start
      gameObject.stepStart(stepLength);\n// gameObject.stepStart({stepLength});\n
    • Step stop
      gameObject.stepStop();\n
    • Events
      • Step
        gameObject.on('step.step', function(gameObject, x, y) { });\n
    "},{"location":"structs-list/","title":"List","text":""},{"location":"structs-list/#introduction","title":"Introduction","text":"

    An ordered list, built-in data structure of phaser.

    • Author: Richard Davey
    "},{"location":"structs-list/#usage","title":"Usage","text":""},{"location":"structs-list/#create-instance","title":"Create instance","text":"
    var list = new Phaser.Structs.List();\n
    "},{"location":"structs-list/#add-child","title":"Add child","text":"
    list.add(child);\n
    list.addAt(child, index);\n
    "},{"location":"structs-list/#exist","title":"Exist","text":"
    var hasChild = list.exists(child);\n
    "},{"location":"structs-list/#get-child","title":"Get child","text":"
    var firstChild = list.first;\nvar nextChild = list.next;\nvar prevChild = list.previous;\nvar lastChild = list.last;\n
    var child = list.getByName(name);\n
    var child = list.getRandom(startIndex, length);\n
    var child = list.getFirst(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    var child = list.getAll(property, value, startIndex, endIndex);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    var child = list.count(property, value);\n// value: the value to test the property against. Must pass a strict (`===`) comparison check.\n
    "},{"location":"structs-list/#get-children","title":"Get children","text":"
    var children = list.list;\n
    "},{"location":"structs-list/#sort-children","title":"Sort children","text":"
    • Sort by property
      list.sort(property);\n// list.sort(property, handler);\n
      • property : The property to lexically sort by.
      • handler :
        function (childA, childB) {\nreturn 0; // 0, 1, -1\n}\n
    "},{"location":"structs-list/#remove-child","title":"Remove child","text":"
    list.remove(child);\n
    list.removeAt(index);\n
    list.removeBetween(startIndex, endIndex);\n
    list.removeAll();\n
    "},{"location":"structs-list/#order-of-child","title":"Order of child","text":"
    list.moveTo(child, index);\n
    list.bringToTop(child);\n
    list.sendToBack(child);\n
    list.moveUp(child);\n
    list.moveDown(child);\n
    list.moveAbove(child1, child2);  // Move child1 above child2\n
    list.moveBelow(child1, child2);  // Move child1 below child2\n
    list.swap(child1, child2);\n
    list.reverse();\n
    list.shuffle();\n
    "},{"location":"structs-list/#replace-child","title":"Replace child","text":"
    list.replace(oldChild, newChild);\n
    "},{"location":"structs-list/#set-properties","title":"Set properties","text":"
    list.setAll(property, value, startIndex, endIndex);\n
    "},{"location":"structs-list/#for-each-child","title":"For each child","text":"
    • Iterate current children list
      list.each(callback);\n// list.each(callback, context);\n// list.iterate(callback, context, arg0, arg1, ...);\n
      • callback :
        function(child, arg0, arg1, ...) {\n\n}\n
    "},{"location":"structs-list/#children-counts","title":"Children counts","text":"
    var size = list.length;\n
    "},{"location":"structs-set/","title":"Set","text":""},{"location":"structs-set/#introduction","title":"Introduction","text":"

    A collection of unique elements, built-in data structure of phaser.

    • Author: Richard Davey
    "},{"location":"structs-set/#usage","title":"Usage","text":""},{"location":"structs-set/#create-instance","title":"Create instance","text":"
    var set = new Phaser.Structs.Set();\n

    or

    var set = new Phaser.Structs.Set(elements);\n
    "},{"location":"structs-set/#add-an-element","title":"Add an element","text":"
    set.set(element);\n
    "},{"location":"structs-set/#remove-an-element","title":"Remove an element","text":"
    set.delete(element);\n
    "},{"location":"structs-set/#remove-all-elements","title":"Remove all elements","text":"
    set.clear();\n
    "},{"location":"structs-set/#has-element","title":"Has element","text":"
    set.contains(element);\n
    "},{"location":"structs-set/#get-elements","title":"Get elements","text":"
    var elements = set.entries;\n

    or get a shallow copy of elements

    var elements = set.getArray();\n
    "},{"location":"structs-set/#element-counts","title":"Element counts","text":"
    var size = set.size;\n
    "},{"location":"structs-set/#for-each-element","title":"For each element","text":"
    • For when you know this Set will be modified during the iteration.
      set.each(function(element, index) {\n// return false;  // return false to cancel iteration\n}, scope)\n
    • For when you absolutely know this Set won't be modified during the iteration.
      set.iterate(function(element, index) {\n// return false;  // return false to cancel iteration\n}, scope)\n
    "},{"location":"structs-set/#set-operations","title":"Set operations","text":"
    • C = A | B
      var setC = setA.union(setB);\n
    • C = A & B
      var setC = setA.intersect(setB);\n
    • C = A - B
      var setC = setA.difference(setB);\n
    "},{"location":"tagplayer/","title":"Tag player","text":""},{"location":"tagplayer/#introduction","title":"Introduction","text":"

    Text commands to control sprites, texts, sound effect or backgroun music.

    • Author: Rex
    • Member of scene
    "},{"location":"tagplayer/#live-demos","title":"Live demos","text":"
    • Sprite
    • Textbox
    • Custom game object
    • Viewport-coordinate
    "},{"location":"tagplayer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tagplayer/#install-plugin","title":"Install plugin","text":""},{"location":"tagplayer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextagplayerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextagplayerplugin.min.js', true);\n
    • Add tag-player object
      var tagPlayer = scene.plugins.get('rextagplayerplugin').add(scene, config);\n
    "},{"location":"tagplayer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TagPlayerPlugin from 'phaser3-rex-plugins/plugins/tagplayer-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTagPlayerPlugin',\nplugin: TagPlayerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tag-player object
      var tagPlayer = scene.plugins.get('rexTagPlayerPlugin').add(scene, config);\n
    "},{"location":"tagplayer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TagPlayer from 'phaser3-rex-plugins/plugins/tagplayer.js';\n
    • Add tag-player object
      var tagPlayer = new TagPlayer(scene, config);\n
    "},{"location":"tagplayer/#create-instance","title":"Create instance","text":"
    var tagPlayer = scene.plugins.get('rexTagPlayerPlugin').add(scene, {\nparser: {\ndelimiters: '[]',\ncomment: '//',\n// translateTagNameCallback: undefined,\n}\n\nsprites: {\n// createGameObject: 'sprite',\n// fade: 500,  \n// fade: {mode: 'tint', time: 500},\n// viewportCoordinate: false,\n// symbols: undefined,  // { key:value }\n}, // sprites: false,\n\ntexts: {\n// createGameObject: undefined,        \n// fade: 500,\n// fade: {mode: 'tint', time: 500},\n// viewportCoordinate: false,\n// symbols: undefined,  // { key:value }\n}\n// texts: false,\n\nlayers: undefined, // []\n\nsounds: {\nbgm: {\ninitial: undefinied,\nloop: true,\nfade: 500\n},\nbgm2: {\ninitial: undefinied,\nloop: true,\nfade: 500\n}\n},\n\nclickTarget: scene,\n});\n
    • parser : Configuration of parser.
      • parser.delimiters : Delimiters of tag.
        • A single string with 2 characters. Default value is '[]'.
        • A array with 2 strings. e.x. ['[[',']]'].
      • parser.comment : Start word of a comment line. Default value is '//'.
        • null, or false : No comment line.
      • parser.translateTagNameCallback : Callback to translate tag-name
        • undefined : Use original tag-name. Default behavior.
        • A function, return new tag name.
          function(tagName) {\nreturn newTagName;\n}\n
    • sprites : Configuration of sprites.
      • sprites.createGameObject :
        • 'sprite' : Create sprite game object. Default behavior.
        • 'image' : Create image game object.
        • Callback to return a game object
          function(scene, a, b, c) {\n// return gameObject;\n}\n
          • a, b, c : Parameters pass from [sprite.name=a,b,c]
      • sprites.fade :
        • 0 : No fade-in or fade-out when adding or removing a sprite.
        • A number : Duration of fading. Default value is 500.
        • A plain object contains mode, time
          • sprite.fade.mode : Fade mode
            • 'tint', or 0 : Fade-in or fade-out via tint property.
            • 'alpha', or 1 : Fade-in or fade-out via alpha property.
            • 'revealUp', or 2 : Reveal up for fade-in.
            • 'revealDown', or 3 : Reveal down for fade-in.
            • 'revealLeft', or 4 : Reveal left for fade-in.
            • 'revealRight', or 5 : Reveal right for fade-in.
          • sprite.fade.time : Duration of fading. Default value is 500.
      • sprites.viewportCoordinate : Apply viewportCoordinate behavior to sprite game object.
        • true : Attach vpx, vpy, vp to sprite game object.
          • vpx, vpy : Number between 0~1. Proportion of viewport.
          • vp : Viewport in rectangle
        • false : Do nothing, default behavior.
      • sprites.symbols : Convert string value to number value when Set or Ease property of game object.
        • A plain object contains string key and number value.
      • false, null : No sprite manager
    • texts : Configuration of texts.
      • texts.createGameObject :
        • undefined, or 'text' : Create text game object. Default behavior.
        • Callback to return a game object
          function(scene, a, b, c) {\n// return gameObject;\n}\n
          • a, b, c : Parameters pass from [text.name=a,b,c]
      • texts.fade :
        • 0 : No fade-in or fade-out when adding or removing a text game object.
        • A number : Duration of fading. Default value is 500.
        • A plain object contains mode, time
          • texts.fade.mode : Fade mode
            • 'tint', or 0 : Fade-in or fade-out via tint property.
            • 'alpha', or 1 : Fade-in or fade-out via alpha property.
            • 'revealUp', or 2 : Reveal up for fade-in.
            • 'revealDown', or 3 : Reveal down for fade-in.
            • 'revealLeft', or 4 : Reveal left for fade-in.
            • 'revealRight', or 5 : Reveal right for fade-in.
          • texts.fade.time : Duration of fading. Default value is 500.
      • texts.viewportCoordinate : Apply viewportCoordinate behavior to text game object.
        • true : Attach vpx, vpy, vp to sprite game object.
          • vpx, vpy : Number between 0~1. Proportion of viewport.
          • vp : Viewport in rectangle
        • false : Do nothing, default behavior.
      • texts.symbols : Convert string value to number value when Set or Ease property of game object.
        • A plain object contains string key and number value.
      • false, null : No text manager
    • layers :
      • undefined : Don't create layerManger.
      • Array of string : Pre-create layer game objects in layerManger.
    • sounds : Configuration of sound effect, or background music.
      • sounds.bgm.initial, sounds.bgm2.initial : Initial music instance created by scene.sound.add(key) before starting playing content.
        • undefined : No initial music instance, default value.
      • sounds.bgm.loop, sounds.bgm2.loop :
        • true : Loop background music, default behavior.
        • false : Play background music once.
      • sounds.bgm.fade, sounds.bgm2.fade :
        • 0 : No fade-in or fade-out when starting or stopping a background music.
        • A number : Fade-in or fade-out (cross-fade) when starting or stopping a background music. Default value is 500.
    • clickTarget : Click target.
      • scene : Any pointer down on this scene. Default target.
    "},{"location":"tagplayer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTagPlayer extends TagPlayer {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\n}\n// ...\n}\n
    • Create instance
      var tagPlayer = new MyTagPlayer(scene, config);\n
    "},{"location":"tagplayer/#game-object-manager","title":"Game object manager","text":"
    tagPlayer.addGameObjectManager({\nname: goType,\ncreateGameObject: function(scene, ...) {\nreturn gameObject\n},\n\n// fade: 500,\n// fade: {mode: 'tint', time: 500},\n\n// viewportCoordinate: false,\n// viewportCoordinate: { viewport: new Phaser.Geom.Rectangle() },\n\n// defaultLayer: layerName,\n\n// symbols: undefined,  // { key:value },\n})\n
    • name : Name of this game object manager, a string.
    • createGameObject : Callback to return a game object
      function(scene, a, b, c) {\n// return gameObject;\n}\n
      • a, b, c : Parameters pass from [goType.name=a,b,c]
    • fade : Tint-fade (if game object has tint property) or alpha-fade game object when creating or destroying a game object.
      • 0 : No fade-in or fade-out when adding or removing a game object.
      • A number : Duration of fading. Default value is 500.
      • A plain object contains mode, time
        • fade.mode : Fade mode
          • 'tint', or 0 : Fade-in or fade-out via tint property.
          • 'alpha', or 1 : Fade-in or fade-out via alpha property.
          • 'revealUp', or 2 : Reveal up for fade-in.
          • 'revealDown', or 3 : Reveal down for fade-in.
          • 'revealLeft', or 4 : Reveal left for fade-in.
          • 'revealRight', or 5 : Reveal right for fade-in.
        • fade.time : Duration of fading. Default value is 500.
    • viewportCoordinate : Apply viewportCoordinate behavior to sprite game object.
      • false : Do nothing, default behavior.
      • true, or an object :
        • viewport :
          • undefined : Rectangle of display area under main camera of current scene. Default value.
          • A rectangle
    • defaultLayer : Put this game object into layer inside of layerManager.
    • symbols : Convert string value to number value when Set or Ease property of game object.
      • A plain object contains string key and number value.
    "},{"location":"tagplayer/#built-in-commands","title":"Built-in commands","text":"

    goType : name parameter in config of tagPlayer.addGameObjectManager method

    • Add game object : [goType.name=a,b,c]
      • Tint-fade-in, or alpha-fade-in if fade is not 0
    • Remove game object : [/goType.name]
      • Tint-fade-out, or alpha-fade-out if fade is not 0
    • Remove all game objects : [/goType]
      • Tint-fade-out, or alpha-fade-out if fade is not 0
    • Call method : [goType.name.methodName=value0,value1,value2]
    • Set property : [goType.name.x=value], [goType.name.alpha=value], ....
    • Ease property :
      [goType.name.prop.easeMode=value,duration]\n[goType.name.prop.easeMode=value,duration,repeat]\n[goType.name.prop.easeMode=value,duration,easeFunction,repeat]\n[goType.name.prop.easeMode=value]\n
      • prop : Any number property of this sprite.
      • easeMode : One of these modes
        • to, toLeft, toRight, toUp, toDown
        • yoyo, yoyoLeft, yoyoRight, yoyoUp, yoyoDown
        • from, fromLeft, fromRight, fromUp, fromDown
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Wait ease task of game object's number property : [wait=goType.name.prop]
      • Also fire event 'wait.' + goType
        tagPlayer.on('wait.' + goType, function(name, prop) {\n})\n
    • Wait a game objects are destroyed : [wait=goType.name]
      • Also fire event 'wait.' + goType
        tagPlayer.on('wait.' + goType, function(name, prop) {\n// prop parameter are `undefined` here\n})\n
    • Wait all game objects are destroyed : [wait=goType]
      • Also fire event 'wait.' + goType
        tagPlayer.on('wait.' + goType, function(name, prop) {\n// name and prop parameter are `undefined` here\n})\n
    • Wait boolean data in game object's data manager set to true/false : [wait=goType.name.dataKey]/[wait=goType.name.!dataKey]
      • Also fire event 'wait.' + goType
        tagPlayer.on('wait.' + goType, function(name, prop) {\n})\n
    "},{"location":"tagplayer/#execute-commands","title":"Execute commands","text":"
    tagPlayer.play(commands);\n

    or

    tagPlayer.playPromise(commands)\n.then(function(){\n// Typing content complete\n})\n
    "},{"location":"tagplayer/#pause","title":"Pause","text":"
    • Pause
      tagPlayer.pause();\n
    • Pause until event
      tagPlayer.pauseUntilEvent(eventEmitter, eventName);\n
    • Is paused (not playing)
      var isPaused = !tagPlayer.isPlaying;\n

    Invoke this method during tag-start,tag-end, or content events to suspend parsing.

    "},{"location":"tagplayer/#resume","title":"Resume","text":"
    tagPlayer.resume();\n
    "},{"location":"tagplayer/#time-scale","title":"Time scale","text":"

    Time scale of typing, typing animation, sprite animation and easing of sprite's properties.

    • Get
      var timeScale = tagPlayer.timeScale;\n
    • Set
      tagPlayer.setTimeScale(timeScale);    
      tagPlayer.timeScale = timeScale;\n
    "},{"location":"tagplayer/#events","title":"Events","text":"
    • On typing content complete
      tagPlayer.on('complete', function() {\n\n})\n
    "},{"location":"tagplayer/#tags-of-content","title":"Tags of content","text":""},{"location":"tagplayer/#sprite","title":"Sprite","text":"
    • Add sprite : [sprite.name=textureKey,frameKey]
      • Tint-fade-in if sprite.fade is not 0
    • Remove sprite : [/sprite.name]
      • Tint-fade-out if sprite.fade is not 0
    • Remove all sprites : [/sprite]
      • Tint-fade-out if sprite.fade is not 0
    • Call method : [sprite.name.methodName=value0,value1,value2]
    • Set property : [sprite.name.x=value], [sprite.name.alpha=value], ....
    • Ease property :
      [sprite.name.prop.easeMode=value,duration]\n[sprite.name.prop.easeMode=value,duration,repeat]\n[sprite.name.prop.easeMode=value,duration,easeFunction,repeat]\n[sprite.name.prop.easeMode=value]\n
      • prop : Any number property of this sprite.
      • easeMode : One of these modes
        • to, toLeft, toRight, toUp, toDown
        • yoyo, yoyoLeft, yoyoRight, yoyoUp, yoyoDown
        • from, fromLeft, fromRight, fromUp, fromDown
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Set texture : [sprite.name.texture=textureKey,frameKey]
    • Play animation : [sprite.name.play=animationKey], or [sprite.name.play=animationKey0,animationKey1,...]
      • Can play animation without adding sprite first.
    • Stop animation : [/sprite.name.play], or [sprite.name.stop]
    • Pause animation : [sprite.name.pause]
    "},{"location":"tagplayer/#text","title":"Text","text":"
    • Add text : [text.name]
      • Tint-fade-in if text.fade is not 0
    • Remove text : [/text.name]
      • Tint-fade-out if text.fade is not 0
    • Remove all texts : [/text]
      • Tint-fade-out if text.fade is not 0
    • Call method : [text.name.methodName=value0,value1,value2]
    • Set property : [text.name.x=value], [text.name.alpha=value], ....
    • Ease property :
      [sprite.name.prop.easeMode=value,duration]\n[sprite.name.prop.easeMode=value,duration,repeat]\n[sprite.name.prop.easeMode=value,duration,easeFunction,repeat]\n[sprite.name.prop.easeMode=value]\n
      • prop : Any number property of this sprite.
      • easeMode : One of these modes
        • to, toLeft, toRight, toUp, toDown
        • yoyo, yoyoLeft, yoyoRight, yoyoUp, yoyoDown
        • from, fromLeft, fromRight, fromUp, fromDown
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Set text
      [text.name.text]\ncontent\\\\n\nnewline\\\\n\nnewline\n
    • Typing text
      [text.name.typing]\n// [text.name.typing=speed]\ncontent\\\\n\nnewline\\\\n\nnewline\n
    "},{"location":"tagplayer/#sound-effect","title":"Sound effect","text":"
    • Play : [se=key], [se2=key]
      • Sound effect will be destroyed when complete
    • Play with fade in volume : [se=key,1000], [se2=key,1000]
    • Fade in volume : [se.fadein=1000], [se2.fadein=1000]
    • Fade out volume : [se.fadeout=1000], [se2.fadeout=1000]
    • Fade out volume then stop : [se.fadeout=1000,stop], [se2.fadeout=1000,stop]
    • Set volume : [se.volume=1], [se2.volume=1]
    "},{"location":"tagplayer/#background-music","title":"Background music","text":"
    • Play, stop : [bgm=key], [/bgm], [bgm2=key], [/bgm2]
      • Previous background music will be stopped and destroyed.
      • Cross fade to next background music if sounds.bgm.fade/sounds.bgm2.fade is not 0
    • Play with fade in volume : [bgm=key,1000], [bgm2=key,1000]
    • Pause, resume : [bgm.pause], [/bgm.pause], [bgm2.pause], [/bgm2.pause]
    • Fade in volume : [bgm.fadein=1000], [bgm2.fadein=1000]
    • Fade out volume : [bgm.fadeout=1000], [bgm2.fadeout=1000]
    • Fade out volume then stop : [bgm.fadeout=1000,stop], [bgm2.fadeout=1000,stop]
    • Cross fade to another background music : [bgm.cross=key,10000], [bgm2.cross=key,10000]
    • Set volume : [bgm.volume=1], [bgm2.volume=1]
    • Mute : [bgm.mute], [bgm2.mute], [bgm.unmute], [bgm2.unmute]
    "},{"location":"tagplayer/#camera","title":"Camera","text":"
    • Fade-in effect : [camera.fadein], [camera.fadein=1000], or [camera.fadein=duration,red,green,blue]
    • Fade-out effect : [camera.fadeout], [camera.fadeout=1000], or [camera.fadeout=duration,red,green,blue]
    • Flash effect : [camera.flash], [camera.flash=1000], or [camera.flash=duration,red,green,blue]
    • Shake effect : [camera.shake], [camera.shake=1000], or [camera.shake=duration,intensity]
    • Zoom
      • Set zoom : [camera.zoom=2]
      • Zoom to : [camera.zoom.to=1,1000], or [camera.zoom.to=zoomValue,duration,Cubic]
    • Rotate
      • Set angle : [camera.rotate=90], angle in degrees
      • Rotate to : [camera.rotate.to=0,1000], or [camera.rotate.to=deg,duration,Cubic], angle in degrees
    • Scroll
      • Scroll x,y : [camera.scroll=0,200]
      • Scroll x,y to : [camera.scroll.to=0,200,1000], or [camera.rotate.to=x,y,duration,Cubic]
    "},{"location":"tagplayer/#wait-conditions","title":"Wait conditions","text":"
    • Wait click : [wait=click], [click]
      • Also fire event 'wait.click'
         tagPlayer.on('wait.click', function() {\n})\n
    • Wait key-down : [wait=enter], [wait=space], ....
      • Also fire event 'wait.keydown'
         tagPlayer.on('wait.keydown', function(keyName) {\n})\n
    • Wait time : [wait=1000]
      • Also fire event 'wait.time'
         tagPlayer.on('wait.time', function(time) {\n})\n
    • Wait sound effect : [wait=se], [wait=se2]
      • Also fire event 'wait.music'
         tagPlayer.on('wait.music', function(music) {\n// var key = music.key;\n})\n
    • Wait background music : [wait=bgm], [wait=bgm2]
      • Also fire event 'wait.music'
         tagPlayer.on('wait.music', function(music) {\n// var key = music.key;\n})\n
    • Wait camera effect : [wait=camera.fadein], [wait=camera.fadeout], [wait=camera.flash], [wait=camera.shake], [wait=camera.zoom], [wait=camera.rotate], [wait=camera.scroll]
      • Also fire event 'wait.camera'
         tagPlayer.on('wait.camera', function(effectName) {\n// effectName : 'camera.fadein', 'camera.fadeout', 'camera.flash', 'camera.shake', 'camera.zoom', 'camera.rotate', 'camera.scroll'\n})\n
    • Wait ease task of sprite's property : [wait=sprite.name.prop]
      • Also fire event 'wait.sprite'
        tagPlayer.on('wait.sprite', function(name, prop) {\n})\n
    • Wait a sprite are destroyed : [wait=sprite.name]
      • Also fire event 'wait.sprite'
        tagPlayer.on('wait.sprite', function(name, prop) {\n// prop parameter are `undefined` here\n})\n
    • Wait all sprites are destroyed : [wait=sprite]
      • Also fire event 'wait.sprite'
        tagPlayer.on('wait.sprite', function(name, prop) {\n// name and prop parameter are `undefined` here\n})\n
    • Wait boolean data in sprite's data manager set to true/false : [wait=sprite.name.dataKey]/[wait=sprite.name.!dataKey]
      • Also fire event 'wait.sprite'
        tagPlayer.on('wait.sprite', function(name, prop) {\n})\n
    • Wait callback : [wait], or [wait=xxx] (xxx is any string which not been used in above case)
      • Fire event 'wait'
        tagPlayer.on('wait', function(callback) {\n// Invoke `callback()` to continue typing\n})\n
      • Fire event 'wait.xxx'
        tagPlayer.on('wait.xxx', function(callback) {\n// Invoke `callback()` to continue typing\n})\n
    • Combine conditions : [wait=cond0|cond1|...]
      • Wait click, or enter key down : [wait=click|enter]
      • Wait click, enter key down, or 100ms : [wait=click|enter|1000]
    "},{"location":"tagplayer/#custom-tag","title":"Custom tag","text":"

    Assume that adding a custom tag : [custom=10,20][/custom]

    • On parse/execute a +custom tag, will add a custom command child
      tagPlayer.on('+custom', function(parser, a, b) {\n// console.log('Parse +custom tag:', a, b)\n})\n
      • a, b, ... : Parameters after =
      • Set content callback, will invoke this callback when getting a content
        var callback = function(content) {\n// ...\n}\ntagPlayer.setContentCallback(callback, scope);\n
    • On parse/execute a -custom tag, will add a custom command child
      tagPlayer.on('-custom', function(parser) {\n// console.log('Parse -custom tag')\n})\n
      • Clear content callback
        tagPlayer.setContentCallback();\n
    "},{"location":"tagplayer/#content","title":"Content","text":"

    These lines will be skipped :

    • Empty line, which only has space characters.
    • Comment line, start with '//'.

    New line symbol '\\n' will be removed, use \\\\n to insert a new line character.

    Content will pass to one of these callback/event

    1. Set content callback
      tagPlayer.setContentCallback(callback, scope);\n
      • Clear content callback
        tagPlayer.setContentCallback();\n
    2. On parse/execute a content, after a [custom] tag.
      tagPlayer.on('custom#content', function(content) {   })\n
    3. On parse/execute a content, after any tag.
      tagPlayer.on('content', function(content) {   })\n
    "},{"location":"tagplayer/#game-objects","title":"Game objects","text":"
    • Get game object by name
      var gameObject = tagPlayer.getGameObject(goType, name);\n
    • Get all game objects of a game object manager
      var gameObjects = tagPlayer.getGameObject(goType);\n
      • gameObjects : {name: gameObject}
    • Add existed game object into game object manager
      tagPlayer.addGameObject(goType, name, gameObject);\n
    "},{"location":"tagplayer/#data","title":"Data","text":"
    • Get
      var value = tagPlayer.getData(key);\nvar values = tagPlayer.getData(keys); // keys: an array of keys\nvar value = tagPlayer.data.values[key];\n
    • Set
      tagPlayer.setData(key, value);\ntagPlayer.incData(key, value);    tagPlayer.setData(obj); // obj: {key0:value0, key1:value1, ...}\ntagPlayer.data.values[key] = value;\ntagPlayer.data.values[key] += inc;\n
      or
      tagPlayer.toggleData(key);\n
    • Enable
      tagPlayer.setDataEnabled();\n
    • Events :
      • Set data evant
        tagPlayer.on('setdata', function(tagPlayer, key, value){ /* ... */ });\n
      • Change data event
        tagPlayer.on('changedata', function(tagPlayer, key, value, previousValue){ /* ... */ });\n
        tagPlayer.on('changedata-' + key, function(tagPlayer, value, previousValue){ /* ... */ });\n

    See data manager

    Note

    Ensure data manager is created before binding any data-changed events.

    "},{"location":"tagtext/","title":"Tag Text","text":""},{"location":"tagtext/#introduction","title":"Introduction","text":"

    Displays text with multi-color, font face, or font size with tags.

    • Author: Rex
    • Game object
    "},{"location":"tagtext/#live-demos","title":"Live demos","text":"
    • Tag text
    "},{"location":"tagtext/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tagtext/#install-plugin","title":"Install plugin","text":""},{"location":"tagtext/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextagtextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextagtextplugin.min.js', true);\n
    • Add text object
      var txt = scene.add.rexTagText(x, y, content, config);\n
    "},{"location":"tagtext/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TagTextPlugin from 'phaser3-rex-plugins/plugins/tagtext-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTagTextPlugin',\nplugin: TagTextPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text object
      var txt = scene.add.rexTagText(x, y, content, config);\n
    "},{"location":"tagtext/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TagText from 'phaser3-rex-plugins/plugins/tagtext.js';\n
    • Add text object
      var txt = new TagText(scene, x, y, content, config);\nscene.add.existing(txt);\n
    "},{"location":"tagtext/#add-text-object","title":"Add text object","text":"
    var tags = {\ntag0: {\ncolor: 'red'\n},\ntag1: {\ncolor: 'blue'\n}\n};\nvar txt = scene.add.rexTagText(x, y, '<class=\"tag0\">h</class>ello', {tags:tags});\n// var txt = scene.add.rexTagText(x, y, '<class=\"tag0\">h</class>ello', { fontFamily: 'Arial', fontSize: 64, color: '#00ff00', tags:tags });\n
    • tags : {tagName:tag}, see Properties of tag.

    Default style

    {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\nbackgroundColor2: null,\nbackgroundHorizontalGradient: true,\nbackgroundStrokeColor: null,\nbackgroundStrokeLineWidth: 2,\n\nbackgroundCornerRadius: 0,\n// 0   : no round corner, \n// > 0 : convex round corner\n// < 0 : concave round corner\n\nbackgroundCornerIteration: null, color: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nunderline: {\ncolor: '#000',\nthickness: 0,\noffset: 0\n},\nstrikethrough: {\ncolor: '#000',\nthickness: 0,\noffset: 0\n},    // align: 'left',  // Equal to halign\nhalign: 'left', // 'left'|'center'|'right'\nvalign: 'top',  // 'top'|'center'|'bottom'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\nlineSpacing: 0,\ntestString: '|M\u00c9qgy',\n\nwrap: {\nmode: 'none'     // 0|'none'|1|'word'|2|'char'|'character'\nwidth: null\n},\n// wordWrap: { width: 0 },   // Compatible with Text game object\n\n// rtl: false,\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n\n// images: {\n//    key: { y:-8 }\n// }\n\ntags: {\n//tag0: {\n//  color: 'red'\n//},\n//tag1: {\n//  color: 'blue'\n//}\n}\n}\n
    var txt = scene.add.rexTagText({\nx: 0,\ny: 0,\ntext: '',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',\nbackgroundColor: '#ff00ff',\ntags: {}\n}\n})\n

    or

    var txt = scene.make.rexTagText({\nx: 100,\ny: 100,\npadding: {\nleft: 64,\nright: 16,\ntop: 20,\nbottom: 40\n//x: 32,    // 32px padding on the left/right\n//y: 16     // 16px padding on the top/bottom\n},\ntext: 'Text\\nGame Object\\nCreated from config',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',\nbackgroundColor: '#ff00ff',\ntags: {}\n},\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    • Alignment
      • halign, or align : Horizontal alignment.
        • left, center, right
      • valign : Vertical alignment.
        • top, center, bottom
    • images : See Image
    "},{"location":"tagtext/#properties-of-tag","title":"Properties of tag","text":"
    {\nfontFamily: 'Courier',   // or 'family', 'font-family'\nfontSize: '16px',        // or 'size', 'font-size'\nfontStyle: 'bold italic',// or 'style', 'font-style'\ncolor: 'red',            // or 'font-color'\nstroke: {\ncolor: 'blue',\nthickness: 1\n},\nshadow: {\ncolor: 'black',\noffsetX: 2,\noffsetY: 2,\nblur: 2\n},\nunderline: {            // or 'u'\ncolor: 'blue',\nthickness: 3,\noffset: -1\n},\nstrikethrough: {        // or 's'\ncolor: 'red',\nthickness: 3,\noffset: -1\n},    y: 0,\nimg: textureKey,\narea: areaKey,\n}\n
    "},{"location":"tagtext/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends TagText {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, '<class=\"tag0\">h</class>ello', {tags:tags});\n
    "},{"location":"tagtext/#add-tag","title":"Add tag","text":"
    • Add a tag
      txt.addTag(name, prop);\n
      • name : Tag name.
      • prop : See Properties of tag
    • Add tags
      txt.addTags({\nname: prop\n});\n
    "},{"location":"tagtext/#wrap","title":"Wrap","text":"
    • Wrap by word or character.
      var txt = scene.make.text({\nx: 400,\ny: 100,\ntext: 'The sky above the port was the color of television, tuned to a dead channel.',\norigin: { x: 0.5, y: 0.5 },\nstyle: {\nfont: 'bold 25px Arial',\nfill: 'white',\nwrap: {\nmode: 'word'     // 0|'none'|1|'word'|2|'char'|'character'\nwidth: 300\n}\n}\n});\n
    • Wrap mode
      • Get
        var mode = txt.style.wrapMode;\n
      • Set
        txt.setWrapMode(mode);\n
        • 'none', or 0 : No wrap
        • 'word', or 1 : Word wrap
        • 'character', or 2 : Character wrap
    • Wrap width
      • Get
        var width = txt.style.wrapWidth;\n
      • Set
        txt.setWrapWidth(width);\n// txt.setWordWrapWidth(width);\n
    "},{"location":"tagtext/#content","title":"Content","text":"
    • Get source text
      var curContent = txt.text;\n
    • Get plain text
      var plainText = txt.getPlainText();\n
    • Get sub-string
      var text = txt.getText(start, end);\n
    • Set
      txt.setText('<class=\"name1\">wor</class>ld');\n// txt.text = '<class=\"name1\">wor</class>ld';\n
    • Append
      txt.appendText(text);\n// txt.text += '\\n' + text;\n
      or
      txt.appendText(text, false);\n// txt.text += text;\n
    "},{"location":"tagtext/#set-style","title":"Set style","text":"
    txt.setStyle(style);\ntxt.setFont(font);  // font: {fontFamily, fontSize, fontStyle}\ntxt.setFontFamily(family);\ntxt.setFontSize(size);\ntxt.setFontStyle(style);\n
    "},{"location":"tagtext/#color","title":"Color","text":"
    • Text color
      • Get
        var color = txt.style.color;\n
      • Set
        txt.setColor(color);\n
        or
        txt.setFill(color);\n
    • Stroke color, thickness
      • Get
        var color = txt.style.stroke;\nvar thickness = txt.style.strokeThickness;\n
      • Set
        txt.setStroke(color, thickness);\n
      • Clear
        txt.setStroke();\n
    • Underline color, thickness
      • Get
        var color = txt.style.underlineColor;\nvar thickness = txt.style.underlineThickness;\nvar offset = txt.style.underlineOffset;\n
      • Set
        txt.setUnderline(color, thickness, ofset);\ntxt.setUnderlineColor(color);\ntxt.setUnderlineThinkness(thickness);\ntxt.setUnderlineOffset(ofset);\n
    • Strikethrough color, thickness
      • Get
        var color = txt.style.strikethroughColor;\nvar thickness = txt.style.strikethroughThickness;\nvar offset = txt.style.strikethroughOffset;\n
      • Set
        txt.setStrikethrough(color, thickness, ofset);\ntxt.setStrikethroughColor(color);\ntxt.setStrikethroughThinkness(thickness);\ntxt.setStrikethroughOffset(ofset);\n
    • Background
      • Color, or gradient color
        • Get
          var color = txt.style.backgroundColor;\nvar color2 = txt.style.backgroundColor2;\nvar isHorizontalGradient = txt.style.backgroundHorizontalGradient;\n
        • Set
          txt.setBackgroundColor(color);\n// txt.setBackgroundColor(color, color2, isHorizontalGradient);\n
      • Stroke color
        • Get
          var color = txt.style.backgroundStrokeColor;\nvar lineWidth = txt.style.backgroundStrokeLineWidth;\n
        • Set
          txt.setBackgroundStrokeColor(color, lineWidth);\n
      • Round rectangle
        • Get
          var radius = txt.style.backgroundCornerRadius;\nvar iteration = txt.style.backgroundCornerIteration;\n
        • Set
          txt.setBackgroundCornerRadius(radius);\n// txt.setBackgroundCornerRadius(radius, iteration);\n
          • radius :
            • 0 : No round corner
            • > 0 : Convex round corner
            • < 0 : Concave round corner
          • iteration :
            • undefined : Round rectangle
            • 0 : Octagon
    • Shadow
      • Get
        var color = txt.style.shadowColor;\nvar offsetX = txt.style.shadowOffsetX;\nvar offsetY = txt.style.shadowOffsetY;\nvar blur = txt.style.shadowBlur;\nvar stroke = txt.style.shadowStroke;\nvar enabled = txt.style.shadowFill;\n
      • Set
        txt.setShadow(x, y, color, blur, shadowStroke, shadowFill);\ntxt.setShadowOffset(x, y);\ntxt.setShadowColor(color);\ntxt.setShadowBlur(blur);\ntxt.setShadowStroke(enabled);\ntxt.setShadowFill(enabled);\n
    "},{"location":"tagtext/#image","title":"Image","text":"
    • Uses texture key as image key by default.
    • Add image render information
      txt.addImage(imgKey, {\nkey: textureKey,\nframe: frameName,\nwidth: undefined,\nheight: undefined,\ny: 0,\nleft: 0,\nright: 0\n});\n
      • imgKey : Image key used in text content, i.e. [img=imgKey].
      • key : Texture key.
      • frame : Frame name.
      • width : Render width, set undefined to use the cut width of frame.
      • height : Render height, set undefined to use the cut height of frame.
      • y : Extra offset y.
      • left : Left padding space.
      • Right : Right padding space.
    • Add some image render informations
      txt.addImage(data);\n
      • data : {imgKey, config}
    "},{"location":"tagtext/#hit-area-of-words","title":"Hit area of words","text":""},{"location":"tagtext/#hitting-events","title":"Hitting events","text":"
    • Pointer down
      txt.on('areadown', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areadown-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    • Pointer up
      txt.on('areaup', function(key, pointer, localX, localY, event){\n\n}, scope)\n
      or
      txt.on('areaup-' + key, function(pointer, localX, localY, event){\n\n}, scope)\n
    "},{"location":"tagtext/#draw-hit-areas","title":"Draw hit-areas","text":"
    txt.drawAreaBounds(graphics, color);\n
    • graphics : Graphics game object
    • color : Default value is 0xffffff
    "},{"location":"tagtext/#line-spacing","title":"Line spacing","text":"

    This value is added to the height of the font when calculating the overall line height.

    • Get
      var lineSpacing = txt.style.lineSpacing;\n
    • Set
      txt.setLineSpacing(value);\n
    "},{"location":"tagtext/#padding","title":"Padding","text":"
    • Get
      var left = txt.padding.left;\nvar top = txt.padding.top;\nvar right = txt.padding.right;\nvar bottom = txt.padding.bottom;\n
    • Set
      txt.setPadding(left, top, right, bottom);\n// txt.setPadding(padding); // padding: {left, top, right, bottom}\n
    "},{"location":"tagtext/#max-lines","title":"Max lines","text":"
    • Get
      var maxLines = txt.style.maxLines;\n
    • Set
      txt.setMaxLines(max);\n
    "},{"location":"tagtext/#fixed-size","title":"Fixed size","text":"
    • Get
      var width = txt.style.fixedWidth;\nvar height = txt.style.fixedHeight;\n
    • Set
      txt.setFixedSize(width, height);\n
    "},{"location":"tagtext/#left-margin-of-text","title":"Left margin of text","text":"
    var leftMargin = txt.measureTextMargins(testString).left;\n
    • testString : Measure left margin of this text.
    "},{"location":"tagtext/#shift-start-position-of-text","title":"Shift start position of text","text":"
    txt.setXOffset(value);\n
    "},{"location":"tagtext/#resolution","title":"Resolution","text":"
    • Get
      var resolution = txt.style.resolution;\n
    • Set
      txt.setResolution(resolution);\n
    "},{"location":"tagtext/#inline-style","title":"Inline style","text":"

    Define style inline text.

    • <style='color:red'>Some text</style>
    • <style='size:30px'>Some text</style>
    • <style='y:-12;size:20px'>Some text</style>
    • <style='stroke:blue 1px'>Some text</style> (color thickness)
    • <style='shadow:blue 2px 2px 2px'>Some text</style> (color offsetX offsetY blur)
    • <style='underline:blue 3px -1px'>Some text</style> (color thickness offset)
    • <style='strikethrough:blue 3px -1px'>Some text</style> (color thickness offset)

    Or mix them

    • <style='color:red;size:30px'>Some text</style>
    "},{"location":"tagtext/#test-string","title":"Test string","text":"

    Set the test string to use when measuring the font.

    txt.setTestString(text);\n
    "},{"location":"tagtext/#save-texture","title":"Save texture","text":"
    txt.generateTexture(key);\n// txt.generateTexture(key, x, y, width, height);\n
    "},{"location":"tagtext/#rtl","title":"RTL","text":"
    • Set rtl in style config when creating this text game object
    • Change rtl during runtime
      txt.setRTL(rtl).setText(newContent);\n
      • Invoke setRTL method before setting new content.
    "},{"location":"tagtext/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"tagtext/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"tagtext/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"tcrp-player/","title":"Player","text":""},{"location":"tcrp-player/#introduction","title":"Introduction","text":"

    Player of T ime-C ommand-R ecorder-P layer, to run commands on time.

    • Author: Rex
    • Member of scene
    "},{"location":"tcrp-player/#live-demos","title":"Live demos","text":"
    • Replay drawing
    "},{"location":"tcrp-player/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tcrp-player/#install-plugin","title":"Install plugin","text":""},{"location":"tcrp-player/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextcrpplugin.min.js', true);\n
    • Create instance
      var player = scene.plugins.get('rextcrpplugin').addPlayer(scene, config);\n
    "},{"location":"tcrp-player/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/tcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var player = scene.plugins.get('rexTCRP').addPlayer(scene, config);\n
    "},{"location":"tcrp-player/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/tcrp.js';\n
    • Create instance
      var player = new TCRP.Player(scene, config);\n
    "},{"location":"tcrp-player/#create-instance","title":"Create instance","text":"
    var player = scene.plugins.get('rexTCRP').addPlayer(scene, {\n// timeUnit: 0,        // 'ms'|0|'s'|'sec'|1\n// dtMode: 0,          // 'abs'|'absolute'|0|'inc'|'increment'|1\n// commands: [],       // [[time, command], [time, command], ...]\n// timeScale: 1,\n// scope: undefined\n});\n
    • scene : A scene object, or a game object.
    • timeUnit : see next section
    • dtMode : see next section
    • commands : see next section
    • timeScale
    "},{"location":"tcrp-player/#load-commands","title":"Load commands","text":"
    player.load(commands, scope, {\n// timeUnit: 0,        // 'ms'|0|'s'|'sec'|1\n// dtMode: 0           // 'abs'|'absolute'|0|'inc'|'increment'|1\n});\n
    • Commands : see also Run commands
      [\n[time, command],\n[time, command],\n...\n]\n
      • Format of each row :
        [time, fnName, param0, param1, ...]\n// [time, callback, param0, param1, ...]\n
        [time, [fnName, param0, param1, ...]]\n// [time, [callback, param0, param1, ...]]\n
        [time, [command0, command1, ...]]\n
    • timeUnit: time-unit of time
      • 'ms', or 0 : time in millisecond
      • 's', 'sec', or 1 : time in second
    • dtMode: mode of counting time
      • 'abs', 'absolute', or 0 : timeout = time
      • 'inc', 'increment', 1 : timeout = time + previous-time
    "},{"location":"tcrp-player/#clear-all-commands","title":"Clear all commands","text":"
    player.clear();\n
    "},{"location":"tcrp-player/#append-command","title":"Append command","text":"
    player.append(time, fn, param0, param1, ...);\n
    • time : Delay time
    • fn :
      • A function (callback) object.
      • A string , to get function (callback) object from scope.
    • param0, param1 ... : Parameters of callback.
    "},{"location":"tcrp-player/#start-playing","title":"Start playing","text":"
    player.start();\n// player.start(startAt);  // Start-at time in ms\n
    "},{"location":"tcrp-player/#events","title":"Events","text":"
    • Start
      player.on('start', function(scene, player){});\n
    • Pause
      player.on('pause', function(scene, player){});\n
    • Resume
      player.on('resume', function(scene, player){});\n
    • Stop
      player.on('stop', function(scene, player){});\n
    • Complete
      player.on('complete', function(scene, player){});\n
    • Run command
      player.on('runcommand', function(commands, scope){});\n
    "},{"location":"tcrp-player/#pause-resume-stop-playing","title":"Pause, Resume, stop playing","text":"
    player.pause();\nplayer.resume();\nplayer.stop();\n
    "},{"location":"tcrp-player/#seek-elapsed-time","title":"Seek elapsed time","text":"
    player.seek(time);   // Elapsed time in ms\n
    "},{"location":"tcrp-player/#seek-to-next-command","title":"Seek to next command","text":"
    player.seekToNext();\n

    Seek to time of next command. i.e. run next command immediately.

    "},{"location":"tcrp-player/#state-of-player","title":"State of player","text":"
    var isPlaying = player.isPlaying;\nvar completed = player.completed;\nvar now = player.now;\n
    "},{"location":"tcrp-player/#time-scale","title":"Time-scale","text":"
    • Set
      player.setTimeScale(value);\n// player.timeScale = value;\n
    • Get
      var timeScale = player.timeScale;\n
    "},{"location":"tcrp-recoder/","title":"Recoder","text":""},{"location":"tcrp-recoder/#introduction","title":"Introduction","text":"

    Recorder of T ime-C ommand-R ecorder-P layer, to store commands with time.

    • Author: Rex
    • Member of scene
    "},{"location":"tcrp-recoder/#live-demos","title":"Live demos","text":"
    • Replay drawing
    "},{"location":"tcrp-recoder/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tcrp-recoder/#install-plugin","title":"Install plugin","text":""},{"location":"tcrp-recoder/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextcrpplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextcrpplugin.min.js', true);\n
    • Create instance
      var recorder = scene.plugins.get('rextcrpplugin').addRecorder(scene);\n
    "},{"location":"tcrp-recoder/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TCRPPlugin from 'phaser3-rex-plugins/plugins/tcrp-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTCRP',\nplugin: TCRPPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var recorder = scene.plugins.get('rexTCRP').addRecorder(scene);\n
    "},{"location":"tcrp-recoder/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TCRP from 'phaser3-rex-plugins/plugins/tcrp.js';\n
    • Create instance
      var recorder = new TCRP.Recorder(scene);\n
    "},{"location":"tcrp-recoder/#create-instance","title":"Create instance","text":"
    var recorder = scene.plugins.get('rexTCRP').addRecorder(scene);\n
    • Destroy when scene stopped

    or

    var recorder = scene.plugins.get('rexTCRP').addRecorder(gameObject);\n
    • Destroy when game object destroyed
    "},{"location":"tcrp-recoder/#start-recording","title":"Start recording","text":"
    recorder.start();\n// recorder.start(startAt);  // start-at time in ms\n
    "},{"location":"tcrp-recoder/#push-commands","title":"Push commands","text":"
    recorder.addCommand([fnName, param0, param1, ...]);\n// recorder.addCommand([command0, command1, ...]);\n// recorder.addCommand([fnName, param0, param1, ...], offset);  // time-offset in ms\n

    See also Run commands

    "},{"location":"tcrp-recoder/#get-commands","title":"Get commands","text":"
    var commands = recorder.getCommands();        // Get a shallow copy of commands\n// var commands = recorder.getCommands(true); // Get reference of commands\n

    Format of return commands:

    [\n[time, [command]],\n[time, [command0,command1]],\n...\n]\n
    "},{"location":"tcrp-recoder/#clear-commands","title":"Clear commands","text":"
    recorder.clear();\n
    "},{"location":"tcrp-recoder/#pause-resume-stop-recording","title":"Pause, Resume, stop recording","text":"
    recorder.pause();\nrecorder.resume();\nrecorder.stop();\n
    "},{"location":"tcrp-recoder/#seek-elapsed-time","title":"Seek elapsed time","text":"
    recorder.seek(time);   // elapsed time in ms\n
    "},{"location":"tcrp-recoder/#state-of-recorder","title":"State of recorder","text":"
    var isRecording = recorder.isRecording;\nvar now = recorder.now;\n
    "},{"location":"tcrp-recoder/#time-scale","title":"Time-scale","text":"
    • Set
      recorder.setTimeScale(value);\n// recorder.timeScale = value;\n
    • Get
      var timeScale = recorder.timeScale;\n
    "},{"location":"tcrp-recoder/#events","title":"Events","text":"
    • Start
      recorder.on('start', function(scene, recorder){});\n
    • Pause
      recorder.on('pause', function(scene, recorder){});\n
    • Resume
      recorder.on('resume', function(scene, recorder){});\n
    • Stop
      recorder.on('stop', function(scene, recorder){});\n
    "},{"location":"text/","title":"Text","text":""},{"location":"text/#introduction","title":"Introduction","text":"

    Drawing text on canvas, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"text/#usage","title":"Usage","text":""},{"location":"text/#add-text-object","title":"Add text object","text":"
    var txt = scene.add.text(x, y, 'hello');\n// var txt = scene.add.text(x, y, 'hello', { fontFamily: 'Arial', fontSize: 64, color: '#00ff00' });\n

    Default style

    {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nalign: 'left',  // 'left'|'center'|'right'|'justify'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\nrtl: false,\ntestString: '|M\u00c9qgy',\nwordWrap: {\nwidth: null,\ncallback: null,\ncallbackScope: null,\nuseAdvancedWrap: false\n},\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n}\n

    Add text from JSON

    var txt = scene.make.text({\nx: 100,\ny: 100,\npadding: {\nleft: 64,\nright: 16,\ntop: 20,\nbottom: 40\n//x: 32,    // 32px padding on the left/right\n//y: 16     // 16px padding on the top/bottom\n},\ntext: 'Text\\nGame Object\\nCreated from config',\nstyle: {\nfontSize: '64px',\nfontFamily: 'Arial',\ncolor: '#ffffff',\nalign: 'center',  // 'left'|'center'|'right'|'justify'\nbackgroundColor: '#ff00ff'\n},\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"text/#custom-class","title":"Custom class","text":"
    • Define class
      class MyText extends Phaser.GameObjects.Text {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyText(scene, x, y, 'hello');\n
    "},{"location":"text/#word-wrap","title":"Word wrap","text":"
    • Wrap by width
      var txt = scene.make.text({\nx: 400,\ny: 100,\ntext: 'The sky above the port was the color of television, tuned to a dead channel.',\norigin: { x: 0.5, y: 0.5 },\nstyle: {\nfont: 'bold 25px Arial',\nfill: 'white',\nwordWrap: { width: 300 }\n},\n// origin: {x: 0.5, y: 0.5},\n});\n
    • Wrap by callback
      var txt = scene.make.text({\nx: 400,\ny: 300,\ntext: 'The sky above the port was the color of television, tuned to a dead channel.',\norigin: 0.5,\nstyle: {\nfont: 'bold 30px Arial',\nfill: 'white',\nwordWrap: { callback: wordWrap, scope: this }\n},\n// origin: {x: 0.5, y: 0.5},\n});\n\nfunction wordWrap (text, textObject)\n{\n// First parameter will be the string that needs to be wrapped\n// Second parameter will be the Text game object that is being wrapped currently\n\n// This wrap just puts each word on a separate line, but you could inject your own\n// language-specific logic here.\nvar words = text.split(' ');\n\n// You can return either an array of individual lines or a string with line breaks (e.g. \\n) in\n// the correct place.\nreturn words;\n}\n
    • Wrap width
      • Get
        var width = txt.style.wordWrapWidth;\nvar useAdvancedWrap = txt.style.wordWrapUseAdvanced;\n
      • Set
        txt.setWordWrapWidth(width);\n// txt.setWordWrapWidth(width, useAdvancedWrap);\n
    • Wrap callback
      • Get
        var callback = txt.style.wordWrapCallback;\nvar scope = txt.style.wordWrapCallbackScope;\n
      • Set
        txt.setWordWrapCallback(callback, scope);\n
    "},{"location":"text/#content","title":"Content","text":"
    • Get
      var content = txt.text;\n
    • Set
      txt.setText(text);\n// txt.text = text;\n
    • Append
      txt.appendText(text);\n// txt.text += '\\n' + text;\n
      or
      txt.appendText(text, false);\n// txt.text += text;\n
    "},{"location":"text/#set-style","title":"Set style","text":"
    txt.setStyle(style);\ntxt.setFont(font);\ntxt.setFontFamily(family);\ntxt.setFontSize(size);\ntxt.setFontStyle(style);\n
    "},{"location":"text/#set-align","title":"Set align","text":"
    txt.setAlign(align);\n
    • align : 'left', 'center', 'right', 'justify'
    "},{"location":"text/#color","title":"Color","text":"
    • Text color
      • Get
        var color = txt.style.color;\n
      • Set
        txt.setColor(color);\n
        or
        txt.setFill(color);\n
    • Stroke color, thickness
      • Get
        var color = txt.style.stroke;\nvar thickness = txt.style.strokeThickness;\n
      • Set
        txt.setStroke(color, thickness);\n
      • Clear
        txt.setStroke();\n
    • Background color
      • Get
        var color = txt.style.backgroundColor;\n
      • Set
        txt.setBackgroundColor(color);\n
    • Shadow
      • Get
        var color = txt.style.shadowColor;\nvar offsetX = txt.style.shadowOffsetX;\nvar offsetY = txt.style.shadowOffsetY;\nvar blur = txt.style.shadowBlur;\nvar stroke = txt.style.shadowStroke;\nvar enabled = txt.style.shadowFill;\n
      • Set
        txt.setShadow(x, y, color, blur, shadowStroke, shadowFill);\ntxt.setShadowOffset(x, y);\ntxt.setShadowColor(color);\ntxt.setShadowBlur(blur);\ntxt.setShadowStroke(enabled);\ntxt.setShadowFill(enabled);\n
    "},{"location":"text/#line-spacing","title":"Line spacing","text":"

    This value is added to the height of the font when calculating the overall line height.

    • Get
      var lineSpacing = txt.lineSpacing;\n
    • Set
      txt.setLineSpacing(value);\n
    "},{"location":"text/#letter-spacing","title":"Letter spacing","text":"
    • Get
      var letterSpacing = txt.letterSpacing;\n
    • Set
      txt.setLetterSpacing(value);\n
    • value : Positive or negative value.

    Note

    Enabling this feature will cause Phaser to render each character in this Text object one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with either long strings, or lots of strings in total.

    "},{"location":"text/#padding","title":"Padding","text":"
    • Get
      var left = txt.padding.left;\nvar top = txt.padding.top;\nvar right = txt.padding.right;\nvar bottom = txt.padding.bottom;\n
    • Set
      txt.setPadding(left, top, right, bottom);\n// txt.setPadding(padding); // padding: {left, top, right, bottom}\n
    "},{"location":"text/#max-lines","title":"Max lines","text":"
    • Get
      var maxLines = txt.style.maxLines;\n
    • Set
      txt.setMaxLines(max);\n
    "},{"location":"text/#fixed-size","title":"Fixed size","text":"
    • Get
      var width = txt.style.fixedWidth;\nvar height = txt.style.fixedHeight;\n
    • Set
      txt.setFixedSize(width, height);\n
    "},{"location":"text/#test-string","title":"Test string","text":"

    Set the test string to use when measuring the font.

    txt.style.setTestString(text);\n
    "},{"location":"text/#rtl","title":"RTL","text":"
    • Set rtl in style config when creating this text game object
    • Change rtl during runtime
      txt.setRTL(rtl).setText(newContent);\n
      • Invoke setRTL method before setting new content.
    "},{"location":"text/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"text/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"text/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"textedit/","title":"Edit","text":""},{"location":"textedit/#introduction","title":"Introduction","text":"

    Create an input text object above a text object to edit string content.

    • Author: Rex
    • Behavior of text object
    "},{"location":"textedit/#live-demos","title":"Live demos","text":"
    • Text edit
    • Text area
    • Number edit
    • With rexui-Label
    • Text game object inside container
    "},{"location":"textedit/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"textedit/#install-plugin","title":"Install plugin","text":""},{"location":"textedit/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextexteditplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexteditplugin.min.js', true);\n
    • Open editor
      • Add text-edit behavior, will open editor under 'pointerdown' event.
        var editor = scene.plugins.get('rextexteditplugin').add(textGameObject, config);\n
      • Open editor directly
        var editor = scene.plugins.get('rextexteditplugin').edit(textGameObject, config);\n
    "},{"location":"textedit/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextEditPlugin from 'phaser3-rex-plugins/plugins/textedit-plugin.js';\nvar config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextEdit',\nplugin: TextEditPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Open editor
      • Add text-edit behavior, will open editor under 'pointerdown' event.
        var editor = scene.plugins.get('rexTextEdit').add(textGameObject, config);\n
      • Open editor directly
        var editor = scene.plugins.get('rexTextEdit').edit(textGameObject, config);\n
    "},{"location":"textedit/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { TextEdit, Edit } from 'phaser3-rex-plugins/plugins/textedit.js';\n
    • Open editor
      • Add text-edit behavior, will open editor under 'pointerdown' event.
        var editor = new TextEdit(textGameObject, config);\n
      • Open editor directly
        var editor = Edit(textGameObject, config);\n
    "},{"location":"textedit/#open-text-editor","title":"Open text editor","text":"

    Open editor directly.

    var editor = scene.plugins.get('rexTextEdit').edit(textObject, {\n// inputType: 'text',   // 'text'|'password'|'textarea'|...\n// type: 'text',    // 'text'|'password'|'textarea'|...\n\n// enterClose: true,\n// selectAll: false,\n\n// onOpen: undefined,\n// onTextChanged: undefined,\n// onClose: undefined,\n\n// text: '',\n});\n// var editor = scene.plugins.get('rexTextEdit').edit(textObject, config, onClose);\n
    • textObject : Text object, bbcode text object, or tag text object.
    • config :
      • config.inputType, or config.type :
        • 'text' (default), or
        • 'password'
        • 'number'
      • config.onOpen : Callback invoked when input text is created.
        function (textObject) {\n}\n
      • config.onTextChanged : Callback invoked when input text changed.
        function (textObject, text) {\ntextObject.text = text;\n}\n
      • config.onClose : Callback invoked when input text is closed. This parameter is valid only when onClose parameter is not given.
        function (textObject) {\n}\n
      • enterClose :
        • true : Close input text when enter-key was pressed. Default value is true if inputType is not 'textarea'.
        • false : If inputType is set to 'textarea', default value will be false.
      • config.selectAll : Set true to select all text.
      • config.text : Initial string content. Default is the string content of textObject.
      • More configuration parameters...
    • onClose : Callback invoked when input text is closed.
      var callback = function(textObject) {\n}\n

    Create a text editor (input element) above text object.

    • Size, font size, font family, font color, background color, background corner radius, padding-left, padding-right of text editor will be assigned from text object.
    • Text object will be invisible when text editor is opened.
    • Store reference of text editor at textObject._editor.
    • Text editor will be closed when
      • Press enter key and enterClose is set, or
      • Touch outside of editor, or
      • Open another text editor, or
      • Call editor.close()

    Limitation of text game object

    Don't assign height property of text game object. Because that text input element does not have vertical align setting, text will always align to middle/center.

    "},{"location":"textedit/#create-instance","title":"Create instance","text":"

    Add text-edit behavior, will open editor under 'pointerdown' event.

    var editor = scene.plugins.get('rexTextEdit').add(textGameObject, {\n// type: 'text',   //'text','password','number'\n// enterClose: true,\n// selectAll: false,\n\n// onOpen: undefined,\n// onTextChanged: undefined,\n// onClose: undefined,\n\n// text: '',\n});\n
    "},{"location":"textedit/#open-editor","title":"Open editor","text":"
    editor.open(config);\n// editor.open(config, onClose);\n
    • config
      • config.type :
        • text (default), or
        • password
      • config.text : Initial string content.
      • config.onTextChanged : Callback invoked when input text changed.
        function (textObject, text) {\ntextObject.text = text;\n}\n
      • More configuration parameters...
    • onClose : Callback invoked when text editor is closed.
      var callback = function(textObject) {\n}\n

    Create a text editor (input element) above text object.

    • Size, font size, font family, font color, background color of text editor will be equal to text object.
    • Text object will be invisible when text editor is opened.
    "},{"location":"textedit/#is-opened","title":"Is opened","text":"
    var isOpened = editor.isOpened;\n
    "},{"location":"textedit/#close-editor","title":"Close editor","text":"
    editor.close();\n

    Text editor will be closed when

    • Press enter key, or
    • Touch outside of editor, or
    • Open another text editor, or
    • Call editor.close()
    "},{"location":"textedit/#get-dom","title":"Get DOM","text":"
    var inputText = editor.inputText.node;\n
    "},{"location":"textedit/#bypass-key-input","title":"Bypass key input","text":"

    See InputText/Bypass key input

    "},{"location":"textedit/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"textpage/","title":"Page","text":""},{"location":"textpage/#introduction","title":"Introduction","text":"

    Display text page by page on text object, bbcode text object, or tag text object.

    • Author: Rex
    • Behavior of text object
    "},{"location":"textpage/#live-demos","title":"Live demos","text":"
    • BBCode text + page + typing
    "},{"location":"textpage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"textpage/#install-plugin","title":"Install plugin","text":""},{"location":"textpage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextextpageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextextpageplugin.min.js', true);\n
    • Add page behavior
      var page = scene.plugins.get('rextextpageplugin').add(textGameObject, config);\n
    "},{"location":"textpage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextPagePlugin from 'phaser3-rex-plugins/plugins/textpage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextPage',\nplugin: TextPagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add page behavior
      var page = scene.plugins.get('rexTextPage').add(textGameObject, config);\n
    "},{"location":"textpage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TextPage from 'phaser3-rex-plugins/plugins/textpage.js';\n
    • Add page behavior
      var page = new TextPage(textGameObject, config);\n
    "},{"location":"textpage/#create-instance","title":"Create instance","text":"
    var page = scene.plugins.get('rexTextPage').add(textGameObject, {\n// text: '',              // content in string or array\n// maxLines: undefined,\n// pageBreak: '\\f\\n',\n});\n
    • textObject : Text object, bbcode text object, tag text object, or bitmap text object
    • text : content in string or array, optional
    • maxLines : Max lines of a page.
      • undefined : Default value. For Text object, bbcode text object, tag text object
        • Use style property maxLines.
        • Count number of lines if it has fixedHeight setting.
      • A number : Max lines of a page, for bitmap text object
    • pageBreak : Symbol of page-break. Default value is '\\f\\n'. String after this page-break symbol will be placed to a new page.
    "},{"location":"textpage/#set-content","title":"Set content","text":"
    • Set content
      page.setText(content);\n
      • content : String, number, or string array. Can insert pageBreak symbol.
    • Append content
      page.appendText(content);\n
      • content : String, number, or string array. Can insert pageBreak symbol.
    • Clear content
      page.clearText()\n
    • Append page
      page.appendPage(content);   // content in string or array\n
      • content : String, number, or string array. Don't insert pageBreak symbol.
    "},{"location":"textpage/#show-page","title":"Show page","text":"
    • Display current page
      page.showPage();\n
    • Display next page
      page.showNextPage();\n
    • Display previous page
      page.showPreviousPage();\n
    • Display first page
      page.showFirstPage();\n
    • Display last page
      page.showLastPage();\n
    • Display page by index
      page.showPage(index);\n
    • Display page by line index
      page.showPageNyLineIndex(index);\n

    Note

    Initial page index is -1, so user could call page.showNextPage() to display first page.

    "},{"location":"textpage/#get-lines-of-page","title":"Get lines of page","text":""},{"location":"textpage/#page-by-page","title":"Page by page","text":"
    • Get lines of current page
      var lines = page.getPage();\n
    • Get lines of next page
      var lines = page.getNextPage();\n
    • Get lines of previous page
      var lines = page.getPreviousPage();\n
    • Get lines of first page
      var lines = page.getFirstPage();\n
    • Get lines of last page
      var lines = page.getLastPage();\n
    • Get lines of page by page index
      var lines = page.getPage(index);\n
    "},{"location":"textpage/#page-of-line","title":"Page of line","text":"
    • Get line of page by line index
      var lines = page.getPageByLineIndex(index);\n
    • Get page of next line
      var lines = page.getPageOfNextLine(index);\n
    • Get page of previous line
      var lines = page.getPageOfPreviousLine(index);\n
    "},{"location":"textpage/#other-properties","title":"Other properties","text":""},{"location":"textpage/#page-by-page_1","title":"Page by page","text":"
    • Is last page
      var isLastPage = page.isLastPage;\n
    • Is first page
      var isFirstPage = page.isFirstPage;\n
    • Current page index
      var pageIndex = page.pageIndex;\n
    • Number of pages
      var pageIndex = page.pageCount;\n
    "},{"location":"textpage/#page-of-line_1","title":"Page of line","text":"
    • Is last line
      var isLastLine = page.isLastLine;\n
    • Is first line
      var isFirstLine = page.isFirstLine;\n
    • Start line index
      var startLineIndex = page.startLineIndex;\n
    • End line index
      var endLineIndex = page.endLineIndex;\n
    • Number of lines
      var totalLinesCount = page.totalLinesCount;\n
    "},{"location":"textplayer/","title":"Text player","text":""},{"location":"textplayer/#introduction","title":"Introduction","text":"

    Typing characters on dynamic text, waiting click or key enter, play sound effect or backgroun music.

    • Author: Rex
    • Game object
    "},{"location":"textplayer/#live-demos","title":"Live demos","text":"
    • BBCode
    • Play
    • Sprite control
    • Show page
    • Fast typing
    • Custom game object
    • Fade out page
    • Choices
      • Custonm tag
      • Choice dailog
    • Resolution
    "},{"location":"textplayer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"textplayer/#install-plugin","title":"Install plugin","text":""},{"location":"textplayer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextextplayerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextextplayerplugin.min.js', true);\n
    • Add text-player object
      var txt = scene.add.rexTextPlayer(config);\n
    "},{"location":"textplayer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextPlayerPlugin from 'phaser3-rex-plugins/plugins/textplayer-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextPlayerPlugin',\nplugin: TextPlayerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-player object
      var txt = scene.add.rexTextPlayer(config);\n
    "},{"location":"textplayer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TextPlayer from 'phaser3-rex-plugins/plugins/textplayer.js';\n
    • Add text-player object
      var txt = new TextPlayer(scene, config);\nscene.add.existing(txt);\n
    "},{"location":"textplayer/#create-instance","title":"Create instance","text":"
    var txt = scene.add.rexTextPlayer({\nx: 0, y: 0,\nwidth: undefined, height: undefined,\nresolution: 1,\n\npadding: 0,  // {left: 0, right: 0, top: 0, bottom: 0}\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\noffsetX: 0,\noffsetY: 0,\nleftSpace: 0,\nrightSpace: 0,\n},\n\nparser: {\ndelimiters: '[]',\ncomment: '//',\n// translateTagNameCallback: undefined,\n}\n\nwrap: {\ncallback: undefined, // Default wrapping callback is dynamicText.runWordWrap()\nlineHeight:\n// maxLines: \npadding: { top: 0, left: 0, right: 0, bottom: 0 },\nletterSpacing: 0,\nwrapMode: 'word',  // 1|'word'|2|'char'|'character'|3|'mix'\nhAlign: 0, // 0|'left'|1|'center'|2|'right'|3|'justify'|'justify-left'|4|'justify-center'|5| justify-right'\nvAlign: 0, // 0|'top'|1|'center'|2|'bottom'\n\n},\n\ntyping: {\nspeed: 250,\nonTypingStart: function (children) {\nfor (var i = 0, cnt = children.length; i < cnt; i++) {\nchildren[i].setVisible(false);\n}\n},  // Default: set all children invisible\nanimation: undefined,  // Default: no typing animation, only invoke onStart callback\nanimation: {\nduration: 1000,\nyoyo: false,\nonStart: function(child) {\nchild.setVisible();\n},\nonProgress: function(child, t) {\n\n},\nonComplete: function(child) {\n\n}\n},\n\n// skipSpace: false,\n\n// minSizeEnable: false,\n\nfadeOutPage: undefined,  // Default: no fade-out-page animation\nfadeOutPage: function(children) {\nreturn eventEmitter;\nreturn promise;\n},\n\n},\n\nimages: {\n// key: {width, height}\n// key: {key, frame, width, height}\n},\n\nsprites: {\n// createCallback: 'sprite',\n// createCallback: function(scene, ...) { return gameObject; },\n\n// fade: 500,\n// fade: {mode: 'tint', time: 500},\n\n// viewportCoordinate: false,\n// viewportCoordinate: { viewport: new Phaser.Geom.Rectangle() },\n\n}, layers: undefined, // []\n\nsounds: {\nbgm: {\ninitial: undefinied,\nloop: true,\nfade: 500\n},\nbgm2: {\ninitial: undefinied,\nloop: true,\nfade: 500\n}\n},\n\nclickTarget: this,  // This text player    \nnextPageInput: null,\n// ignoreNextPageInput: false,\n\ntext: undefined\n});\n
    • x, y : Position of this text-player game object.
    • width : Fixed width.
      • A number : Width of this text-player game object.
        • Wrap-width is width - padding.left - padding.right.
      • undefined : Width of this text-player game object will be set after invoked runWordWrap method.
    • height : Fixed height.
      • A number : Height of this text-player game object.
      • undefined : Height of this text-player game object will be set after invoked runWordWrap method.
    • resolution : The resolution the content is rendered to its internal canvas at. Default value is 1.
    • padding : Padding of bounds.
      • A number
      • padding.left, padding.right, padding.top, padding.bottom
    • background : Properties of background round-rectangle.
      • background.color : Fill color.
        • null : No filling.
      • background.color2 : Gradient fill color.
        • null : No gradient filling.
      • background.horizontalGradient : Horizontal or vertical gradient filling.
        • true : Horizontal gradient filling.
        • false : Vertical gradient filling.
      • background.stroke : Stroke color.
        • null : No stroke.
      • background.strokeThickness : Line width of stroke.
      • background.cornerRadius : Corner-radius of round rectangle.
        • 0 : No round corner
        • > 0 : Convex round corner
        • < 0 : Concave round corner
      • background.cornerIteration : Iteration of corner-radius.
        • null : Draw corner-radius via arc directly.
        • A number : Draw corner-radius via lines
    • innerBounds : Properties of inner-bounds.
      • innerBounds.color : Fill color.
        • null : No filling.
      • innerBounds.color2 : Gradient fill color.
        • null : No gradient filling.
      • innerBounds.horizontalGradient : Horizontal or vertical gradient filling.
        • true : Horizontal gradient filling.
        • false : Vertical gradient filling.
      • innerBounds.stroke : Stroke color.
        • null : No stroke.
      • innerBounds.strokeThickness : Line width of stroke.
    • style : Initial text-style.
      • style.bold : Bold
      • style.italic : Italic
      • style.fontSize : Font size
      • style.fontFamily : Font family
      • style.color : Fill color
      • style.stroke : Stroke color
      • style.strokeThickness : Line width of stroke.
      • style.shadowColor : Shadow color.
        • null : No shadow.
      • style.shadowOffsetX : OffsetX of shadow.
      • style.shadowOffsetY : OffsetY of shadow.
      • style.shadowBlur : Blur of shadow.
      • style.offsetX : OffsetX.
      • style.offsetY : OffsetY.
      • style.leftSpace : Extra space between this character and previous character.
      • style.rightSpace : Extra space between this character and next character.
      • style.align : Override default line-alignment setting.
        • 0, 'left', 'top' : Align remainder lines to left/top.
        • 1, 'center' : Align remainder lines to center.
        • 2, 'right', 'bottom' : Align remainder lines to right/bottom.
        • undefined : Use default line-alignment setting.
    • wrap : Default configuration Horizontal/Vertical wrapping.
    • typing :
      • typing.speed : Default typing speed of each character.
      • typing.onTypingStart : Callback when typing start. Default is to set all children to invisible.
        function (children) {\nfor (var i = 0, cnt = children.length; i < cnt; i++) {\nchildren[i].setVisible(false);\n}\n
        • children : Array of child.
      • typing.animation : Configuration of typing animation
        • undefined : No typing animation, default behavior
      • typing.animation.duration : Duration of typing animation.
      • typing.animation.yoyo :
        • false : Mapping progress t to 0 - 1. Default behavior.
        • true : Mapping progress t to 0 - 1 - 0.
      • typing.animation.onStart : Callback when typing start of a character. Default is to set this child to visible.
        function(child) { child.setVisible(); }\n
        • child
      • typing.animation.onProgress : Callback when progress typing animation.
        function(child, t) {\n}\n
        • child
      • typing.animation.onComplete : Callback when typing animation complete.
        function(child) {\n}\n
        • child
      • typing.skipSpace :
        • false : Will have delay when typing space character. Default behavior.
        • true : Typing space character immediately.
      • typing.minSizeEnable :
        • true : Resize to minimun size for showing all visible characters.
        • false : Won't resize during typing. Default behavior.
      • typing.fadeOutPage : Callback to fade-out characters of previous page.
        • undefined : Default value, no fade-out-page animation.
        • Callback
          function(characters) {\nreturn tween;  // eventEmitter\nreturn promise;\n}\n
          • characters : Fade out targets.
          • Return value could be tween object (event emitter), or promise object.
            • Tween object : Wait until 'complete' event triggering.
            • Promise object : Wait until promoise resolving.
    • parser : Configuration of parser.
      • parser.delimiters : Delimiters of tag. Default value is '[]'.
      • parser.comment : Start word of a comment line. Default value is '//'.
        • null, or false : No comment line.
      • parser.translateTagNameCallback : Callback to translate tag-name
        • undefined : Use original tag-name. Default behavior.
        • A function, return new tag name.
          function(tagName) {\nreturn newTagName;\n}\n
    • images : Configuration of images.
    • sprites : Configuration of sprites.
      • sprites.createCallback :
        • 'sprite' : Create sprite game object. Default behavior.
        • 'image' : Create image game object.
        • Callback to return a game object
          function(scene, textureKey, frameName) {\n// return scene.add.sprite(0, 0, textureKey, frameName);\n}\n
      • sprites.fade :
        • 0 : No fade-in or fade-out when adding or removing a sprite.
        • A number : Duration of fading. Default value is 500.
        • A plain object contains mode, time
          • sprite.fade.mode : Fade mode
            • 'tint', or 0 : Fade-in or fade-out via tint property.
            • 'alpha', or 1 : Fade-in or fade-out via alpha property.
            • 'revealUp', or 2 : Reveal up for fade-in.
            • 'revealDown', or 3 : Reveal down for fade-in.
            • 'revealLeft', or 4 : Reveal left for fade-in.
            • 'revealRight', or 5 : Reveal right for fade-in.
          • sprite.fade.time : Duration of fading. Default value is 500.
      • sprites.viewportCoordinate : Apply viewportCoordinate behavior to sprite game object.
        • true : Attach vpx, vpy, vp to sprite game object.
          • vpx, vpy : Number between 0~1. Proportion of viewport.
          • vp : Viewport in rectangle
        • false : Do nothing, default behavior.
      • sprites.symbols : Convert string value to number value when Set or Ease property of game object.
        • A plain object contains string key and number value.
    • layers :
      • undefined : Don't create layerManger.
      • Array of string : Pre-create layer game objects in layerManger.
    • sounds : Configuration of sound effect, or background music.
      • sounds.bgm.initial, sounds.bgm2.initial : Initial music instance created by scene.sound.add(key) before starting playing content.
        • undefined : No initial music instance, default value.
      • sounds.bgm.loop, sounds.bgm2.loop :
        • true : Loop background music, default behavior.
        • false : Play background music once.
      • sounds.bgm.fade, sounds.bgm2.fade :
        • 0 : No fade-in or fade-out when starting or stopping a background music.
        • A number : Fade-in or fade-out (cross-fade) when starting or stopping a background music. Default value is 500.
    • nextPageInput : Wait condition to type next page
      • null, or false : Stop tying next page. Default behavior
        • Typing next manually via txt.typingNextPage().
      • 'click' : Wait click.
      • 'click|2000' : Wait one of condition: click, or 2000ms.
      • 'click|enter|2000' : Wait one of condition: click, enter key down, or 2000ms.
      • A function callback :
        function(callback) {\n// Invoke `callback()` to continue typing\n}\n
    • clickTarget : Click target, default is text player itself.
      • scene : Any pointer down on this scene.
    • ignoreNextPageInput : Set true to continue typing next page without any waiting.
    • text : Content of text to play.

    or

    var txt = scene.add.rexTextPlayer(x, y, width, height, config);\n

    or

    var txt = scene.add.rexTextPlayer(x, y, config);\n

    Add textplayer from JSON

    var txt = scene.make.rexTextPlayer({\nx: 0,\ny: 0,\n\n// origin: {x: 0.5, y: 0.5},\n// fill: null,\n\nadd: true\n});\n
    "},{"location":"textplayer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextPlayer extends TextPlayer {\nconstructor(scene, x, y, config) {\nsuper(scene, x, y, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var txt = new MyTextPlayer(scene, x, y, config);\n
    "},{"location":"textplayer/#game-object-manager","title":"Game object manager","text":"
    txt.addGameObjectManager({\nname: goType,\ncreateGameObject: function(scene, ...) {\nreturn gameObject\n},\n\nfade: 500,\n// fade: {mode: 'tint', time: 500},\n\n// viewportCoordinate: false,\n// viewportCoordinate: { viewport: new Phaser.Geom.Rectangle() },\n\n// defaultLayer: layerName,\n\n// symbols: undefined,  // { key:value },\n})\n
    • name : Name of this game object manager, a string.
    • createGameObject : Callback to return a game object
      function(scene, a, b, c) {\n// return gameObject;\n}\n
      • a, b, c : Parameters pass from [goType.name=a,b,c]
    • fade : Tint-fade (if game object has tint property) or alpha-fade game object when creating or destroying a game object.
      • 0 : No fade-in or fade-out when adding or removing a game object.
      • A number : Duration of fading. Default value is 500.
      • A plain object contains mode, time
        • fade.mode : Fade mode
          • 'tint', or 0 : Fade-in or fade-out via tint property.
          • 'alpha', or 1 : Fade-in or fade-out via alpha property.
          • 'revealUp', or 2 : Reveal up for fade-in.
          • 'revealDown', or 3 : Reveal down for fade-in.
          • 'revealLeft', or 4 : Reveal left for fade-in.
          • 'revealRight', or 5 : Reveal right for fade-in.
        • fade.time : Duration of fading. Default value is 500.
    • viewportCoordinate : Apply viewportCoordinate behavior to sprite game object.
      • false : Do nothing, default behavior.
      • true, or an object :
        • viewport :
          • undefined : Rectangle of display area under main camera of current scene. Default value.
          • A rectangle
    • defaultLayer : Put this game object into layer inside of layerManager.
    • symbols : Convert string value to number value when Set or Ease property of game object.
      • A plain object contains string key and number value.
    "},{"location":"textplayer/#built-in-commands","title":"Built-in commands","text":"

    goType : name parameter in config of txt.addGameObjectManager method

    • Add game object : [goType.name=a,b,c]
      • Tint-fade-in, or alpha-fade-in if fade is not 0
    • Remove game object : [/goType.name]
      • Tint-fade-out, or alpha-fade-out if fade is not 0
    • Remove all game objects : [/goType]
      • Tint-fade-out, or alpha-fade-out if fade is not 0
    • Call method : [goType.name.methodName=value0,value1,value2]
    • Set property : [goType.name.x=value], [goType.name.alpha=value], ....
    • Ease property :
      [goType.name.prop.easeMode=value,duration]\n[goType.name.prop.easeMode=value,duration,repeat]\n[goType.name.prop.easeMode=value,duration,easeFunction,repeat]\n[goType.name.prop.easeMode=value]\n
      • prop : Any number property of this sprite.
      • easeMode : One of these modes
        • to, toLeft, toRight, toUp, toDown
        • yoyo, yoyoLeft, yoyoRight, yoyoUp, yoyoDown
        • from, fromLeft, fromRight, fromUp, fromDown
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Wait ease task of game object's number property : [wait=goType.name.prop]
      • Also fire event 'wait.' + goType
        txt.on('wait.' + goType, function(name, prop) {\n})\n
    • Wait a game objects are destroyed : [wait=goType.name]
      • Also fire event 'wait.' + goType
        txt.on('wait.' + goType, function(name, prop) {\n// prop parameter are `undefined` here\n})\n
    • Wait all game objects are destroyed : [wait=goType]
      • Also fire event 'wait.' + goType
        txt.on('wait.' + goType, function(name, prop) {\n// name and prop parameter are `undefined` here\n})\n
    • Wait boolean data in game object's data manager set to true/false : [wait=goType.name.dataKey]/[wait=goType.name.!dataKey]
      • Also fire event 'wait.' + goType
        txt.on('wait.' + goType, function(name, prop) {\n})\n
    "},{"location":"textplayer/#typing-content","title":"Typing content","text":"
    txt.play(content);\n

    or

    txt.playPromise(content)\n.then(function(){\n// Typing content complete\n})\n
    "},{"location":"textplayer/#show-current-page","title":"Show current page","text":"
    txt.showPage();\n
    • Set typing speed to 0.
    • Set animation progress to 1.
    • Skip all waiting events.
    • Stop current sound effects, and ignore remainder sound effects.
    "},{"location":"textplayer/#typing-next-page","title":"Typing next page","text":"
    txt.typingNextPage();\n
    • Set nextPageInput to null, or false in config.
    "},{"location":"textplayer/#ignore-next-page-input","title":"Ignore next page input","text":"
    • Ignore next page input
      txt.setIgnoreNextPageInput();\n
    • Rollback waiting next page input
      txt.setIgnoreNextPageInput(false);\n
    "},{"location":"textplayer/#pause","title":"Pause","text":"
    • Pause typing
      txt.pauseTyping();\n
    • Pause typing and typing animation
      txt.pause();\n
    "},{"location":"textplayer/#resume","title":"Resume","text":"
    • Resume typing
      txt.resumeTyping();\n
    • Resume typing and typing animation
      txt.resume();\n
    "},{"location":"textplayer/#typing-speed","title":"Typing speed","text":"
    • Get
      • Default typing speed
        var speed = txt.defaultTypingSpeed;\n
      • Current typing speed
        var speed = txt.typingSpeed;\n
    • Set
      • Default typing speed
        txt.setDefaultTypingSpeed(speed);\n
        txt.defaultTypingSpeed = speed;\n
      • Current typing speed
        txt.setTypingSpeed(speed);\n// txt.setTypingSpeed();    // Set speed to default speed\n
        txt.typingSpeed = speed;\n
    "},{"location":"textplayer/#time-scale","title":"Time scale","text":"

    Time scale of typing, typing animation, sprite animation and easing of sprite's properties.

    • Get
      var timeScale = txt.timeScale;\n
    • Set
      txt.setTimeScale(timeScale);    
      txt.timeScale = timeScale;\n
    "},{"location":"textplayer/#status","title":"Status","text":"
    • Is playing : After txt.play(content), before typing all pages completed
      var isPlaying = txt.isPlaying\n
    • Is page typing : After txt.play(content), or txt.typingNextPage(), before page typing completed
      var isPageTyping = txt.isPageTYyping;\n
    "},{"location":"textplayer/#events","title":"Events","text":"
    • On typing content complete
      txt.on('complete', function() {\n\n})\n
    • On typing a character or an image
      txt.on('typing', function(child) {\nif (child.type === 'text') {\nvar character = child.text;\n} else {\nvar textureLey = child.key;\nvar frameKey = child.frame;\n}\n})\n
    • On typing a page start
      txt.on('page.start', function() {\n\n})\n
    • On typing a page complete
      txt.on('page.complete', function() {\n\n})\n
    "},{"location":"textplayer/#tags-of-content","title":"Tags of content","text":""},{"location":"textplayer/#content","title":"Content","text":"

    These lines will be skipped :

    • Empty line, which only has space characters.
    • Comment line, start with '//'.

    New line symbol '\\n' will be removed, use [r] to insert a new line character.

    "},{"location":"textplayer/#content-output-switch","title":"Content output switch","text":"
    • Turn off content output : [content.off]
    • Turn on content output : [content.on]
    "},{"location":"textplayer/#content-output-enable","title":"Content output enable","text":"
    • Content won't output if parser.setContentOutputEnable(false) under custom tag events
      • Fire 'parser.+custom#content' event if conent is ignored now
        txt.on('parser.+custom#content', function(parser, content) {\n\n})\n
    • Invoke parser.setContentOutputEnable() to turn on content output back.
    "},{"location":"textplayer/#text-style","title":"Text style","text":"
    • Font color : [color=red]content[/color], [color=#FF0000]content[/color]
    • Font size : [size=24]content[/size]
    • Bold : [b]content[/b]
    • Italic : [i]content[/i]
    • Stroke : [stroke]content[/stroke], [stroke=red]content[/stroke]
      • strokeThickness is set in config
    • Shadow : [shadow]content[/shadow], [shadow=red]content[/shadow]
      • shadowOffsetX, shadowOffsetY, shadowBlur are set in config
    • Character offset Y : [y=-8]c[/y]ontent
    • Character offset X : [x=10]c[/x]ontent
    • Left space : [left=10]c[/left]ontent
    • Right space : conten[right=10]t[/right]
    • Line-align : [align=left], [align=center], [align=right]
    "},{"location":"textplayer/#new-line","title":"New line","text":"
    • New line : [r]
      • New line via \\n will be ignored.
    "},{"location":"textplayer/#page-break","title":"Page break","text":"
    • [pagebreak], or [pb] : Put remainder characters to next page.
    "},{"location":"textplayer/#image","title":"Image","text":"

    [img=key]

    "},{"location":"textplayer/#render-size","title":"Render size","text":"
    • Set render size in config
      {\nimages: {\n// key: {width, height},\n// key: {key, frame, width, height, tintFill: false}\n}\n}\n
      • tintFill :
        • false : Keep original color. Default behavior.
        • true : Change fill-color by color tag. [color=...][img=...].
    • Set render size by method
      txt.addImage({\n// key: {width, height},\n// key: {key, frame, width, height, tintFill: false}\n})\n
    • Use origin render size by default
    "},{"location":"textplayer/#space","title":"Space","text":"

    [space=width]

    "},{"location":"textplayer/#typing-speed_1","title":"Typing speed","text":"
    • No typing : [speed=0]
    • Set speed : [speed=1000]
    • Back to default speed : [/speed]
    "},{"location":"textplayer/#sprite","title":"Sprite","text":"
    • Add sprite : [sprite.name=textureKey,frameKey]
      • Tint-fade-in if sprite.fade is not 0
    • Remove sprite : [/sprite.name]
      • Tint-fade-out if sprite.fade is not 0
    • Remove all sprites : [/sprite]
      • Tint-fade-out if sprite.fade is not 0
    • Call method : [sprite.name.methodName=value0,value1,value2]
    • Set property : [sprite.name.x=value], [sprite.name.alpha=value], ....
    • Ease property :
      [sprite.name.x.to=value,duration]\n
      [sprite.name.x.to=value,duration,repeat]\n
      [sprite.name.x.to=value,duration,easeFunction,repeat]\n
      [sprite.name.x.to=value]\n
      • duration : Default value is 1000
      • easeFunction : Default value is 'Linear'
      • repeat : Default value is 0
    • Yoyo ease property :
      [sprite.name.x.yoyo=value,duration]\n
      [sprite.name.x.yoyo=value,duration,repeat]\n
      [sprite.name.x.yoyo=value,duration,easeFunction,repeat]\n
      [sprite.name.x.yoyo=value]\n
    • Set texture : [sprite.name.texture=textureKey,frameKey]
    • Play animation : [sprite.name.play=animationKey], or [sprite.name.play=animationKey0,animationKey1,...]
      • Can play animation without adding sprite first.
    • Stop animation : [/sprite.name.play], or [sprite.name.stop]
    • Pause animation : [sprite.name.pause]
    "},{"location":"textplayer/#sound-effect","title":"Sound effect","text":"
    • Play : [se=key], [se2=key]
      • Sound effect will be destroyed when complete
    • Play with fade in volume : [se=key,1000], [se2=key,1000]
    • Fade in volume : [se.fadein=1000], [se2.fadein=1000]
    • Fade out volume : [se.fadeout=1000], [se2.fadeout=1000]
    • Fade out volume then stop : [se.fadeout=1000,stop], [se2.fadeout=1000,stop]
    • Set volume : [se.volume=1], [se2.volume=1]
    "},{"location":"textplayer/#background-music","title":"Background music","text":"
    • Play, stop : [bgm=key], [/bgm], [bgm2=key],[/bgm2]`
      • Previous background music will be stopped and destroyed.
      • Cross fade to next background music if sounds.bgm.fade/sounds.bgm2.fade is not 0
    • Play with fade in volume : [bgm=key,1000], [bgm2=key,1000]
    • Pause, resume : [bgm.pause], [/bgm.pause], [bgm2.pause], [/bgm2.pause]
    • Fade in volume : [bgm.fadein=1000], [bgm2.fadein=1000]
    • Fade out volume : [bgm.fadeout=1000], [bgm2.fadeout=1000]
    • Fade out volume then stop : [bgm.fadeout=1000,stop], [bgm2.fadeout=1000,stop]
    • Cross fade to another background music : [bgm.cross=key,10000], [bgm2.cross=key,10000]
    • Set volume : [bgm.volume=1], [bgm2.volume=1]
    • Mute : [bgm.mute], [bgm2.mute], [bgm.unmute], [bgm2.unmute]
    "},{"location":"textplayer/#camera","title":"Camera","text":"
    • Fade-in effect : [camera.fadein], [camera.fadein=1000], or [camera.fadein=duration,red,green,blue]
    • Fade-out effect : [camera.fadeout], [camera.fadeout=1000], or [camera.fadeout=duration,red,green,blue]
    • Flash effect : [camera.flash], [camera.flash=1000], or [camera.flash=duration,red,green,blue]
    • Shake effect : [camera.shake], [camera.shake=1000], or [camera.shake=duration,intensity]
    • Zoom
      • Set zoom : [camera.zoom=2]
      • Zoom to : [camera.zoom.to=1,1000], or [camera.zoom.to=zoomValue,duration,Cubic]
    • Rotate
      • Set angle : [camera.rotate=90], angle in degrees
      • Rotate to : [camera.rotate.to=0,1000], or [camera.rotate.to=deg,duration,Cubic], angle in degrees
    • Scroll
      • Scroll x,y : [camera.scroll=0,200]
      • Scroll x,y to : [camera.scroll.to=0,200,1000], or [camera.rotate.to=x,y,duration,Cubic]
    "},{"location":"textplayer/#wait-conditions","title":"Wait conditions","text":"
    • Wait click : [wait=click], [click]
      • Also fire event 'wait.click'
         txt.on('wait.click', function() {\n})\n
    • Wait key-down : [wait=enter], [wait=space], ....
      • Also fire event 'wait.keydown'
         txt.on('wait.keydown', function(keyName) {\n})\n
    • Wait time : [wait=1000]
      • Also fire event 'wait.time'
         txt.on('wait.time', function(time) {\n})\n
    • Wait sound effect : [wait=se], [wait=se2]
      • Also fire event 'wait.music'
         txt.on('wait.music', function(music) {\n// var key = music.key;\n})\n
    • Wait background music : [wait=bgm], [wait=bgm2]
      • Also fire event 'wait.music'
         txt.on('wait.music', function(music) {\n// var key = music.key;\n})\n
    • Wait camera effect : [wait=camera.fadein], [wait=camera.fadeout], [wait=camera.flash], [wait=camera.shake], [wait=camera.zoom], [wait=camera.rotate], [wait=camera.scroll]
      • Also fire event 'wait.camera'
         txt.on('wait.camera', function(effectName) {\n// effectName : 'camera.fadein', 'camera.fadeout', 'camera.flash', 'camera.shake', 'camera.zoom', 'camera.rotate', 'camera.scroll'\n})\n
    • Wait ease task of sprite's property : [wait=sprite.name.prop]
      • Also fire event 'wait.sprite'
         txt.on('wait.sprite', function(name, prop) {\n})\n
    • Wait all sprites are destroyed : [wait=sprite]
      • Also fire event 'wait.sprite'
         txt.on('wait.sprite', function(name, prop) {\n// name and prop parameter are `undefined` here\n})\n
    • Wait callback : [wait], or [wait=xxx] (xxx is any string which not been used in above case)
      • Fire event 'wait'
        txt.on('wait', function(callback) {\n// Invoke `callback()` to continue typing\n})\n
      • Fire event 'wait.xxx'
        txt.on('wait.xxx', function(callback) {\n// Invoke `callback()` to continue typing\n})\n
    • Combine conditions : [wait=cond0|cond1|...]
      • Wait click, or enter key down : [wait=click|enter]
      • Wait click, enter key down, or 100ms : [wait=click|enter|1000]
    "},{"location":"textplayer/#custom-tag","title":"Custom tag","text":"

    Assume that adding a custom tag : [custom=10,20][/custom].

    +custom parses the open tag [custom=10,20] and -custom parses the closing tag [/custom]

    • On parse a +custom tag, will add a custom command child
      txt.on('parser.+custom', function(parser, a, b, params) {\n// console.log('Parse +custom tag:', a, b)\n})\n
      • parses opening tag
      • a, b, ... : Parameters after =
      • params : Arguments array used when executing +custom. Equal to [a, b] in this case.
      • Disable content after this start tag
        parser.setContentOutputEnable(false);\n
    • On execute a +custom command child
      txt.on('tag.+custom', function(a, b) {\n// console.log('Execute +custom tag:', a, b)\n})\n
      • a, b, ... : Parameters passed from params in 'parser.+custom' event.
    • On parse a -custom tag, will add a custom command child
      txt.on('parser.-custom', function(parser, params) {\n// console.log('Parse -custom tag')\n})\n
      • parses closing tag
      • params : Arguments array used when executing -custom. Equal to [] in this case.
      • Enable content after this start tag
        parser.setContentOutputEnable(true);\n
    • On execute a -custom command child
      txt.on('tag.-custom', function(...params) {\n// console.log('Execute -custom tag')\n})\n
      • params : Parameters passed from params in 'parser.-custom' event.
    "},{"location":"textplayer/#size","title":"Size","text":"
    • Resize canvas size
      txt.setCanvasSize(width, height)\n
    • Reisze text wrapping size and canvas size.
      txt.setSize(width, height);\n
      or
      txt.setFixedSize(width, height);\n
    • Resize to minimun size to show all visible characters.
      txt.setToMinSize();\n
    "},{"location":"textplayer/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"textplayer/#create-mask","title":"Create mask","text":"
    var mask = txt.createBitmapMask();\n

    See mask

    "},{"location":"textplayer/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"texttranslation/","title":"Translation","text":""},{"location":"texttranslation/#introduction","title":"Introduction","text":"

    Apply translated string (i18next) to text object, bbcode text object, tag text object, bitmap text object, or label game object

    • Author: Rex
    • Behavior of text object
    "},{"location":"texttranslation/#live-demos","title":"Live demos","text":"
    • Inline resources
    • External resources
    • External yaml resource
    "},{"location":"texttranslation/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"texttranslation/#install-plugin","title":"Install plugin","text":""},{"location":"texttranslation/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in scene's config
      class Demo extends Phaser.Scene {\nconstructor() {\nsuper({\nkey: 'Scnee',\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'rextexttranslationplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexttranslationplugin.min.js',\nstart: true,\nmapping: 'translation'  // Add text-translation plugin to `scene.translation`\n}]\n},\n// ...\n});\n}\n// ...\n}\n
    • Initialize i18next during preload stage
      scene.plugins.get('rextexttranslationplugin').initI18Next(scene, {\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n\n// backend: {\n//     loadPath: '',\n//     parse: function(data) { return JSON.parse(data); }\n// },\n})\n
    • Add translation behavior
      var translation = scene.plugins.get('rextexttranslationplugin').add(textGameObject, config);\n
    "},{"location":"texttranslation/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextTranslationPlugin from 'phaser3-rex-plugins/plugins/texttranslation-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextTranslation',\nplugin: TextTranslationPlugin,\nstart: true,\nmapping: 'translation'  // Add text-translation plugin to `scene.translation`\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Initialize i18next during preload stage
      scene.plugins.get('rexTextTranslation').initI18Next(scene, {\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n\n// backend: {\n//     loadPath: '',\n//     parse: function(data) { return JSON.parse(data); }\n// },\n})\n
    • Add translation behavior
      var translation = scene.plugins.get('rexTextTranslation').add(textGameObject, config);\n
    "},{"location":"texttranslation/#import-class","title":"Import class","text":"
    • Install rex plugins, i18next, i18next-http-backend from npm
      npm i phaser3-rex-plugins\nnpm i i18next\nnpm i i18next-http-backend\n
    • Import class
      import TextTranslationBehavior from 'phaser3-rex-plugins/plugins/texttranslation.js';\nimport i18next from 'i18next';\nimport Backend from 'i18next-http-backend';\nimport Awaitloader from 'phaser3-rex-plugins/plugins/awaitloader.js';\n
    • Initialize i18next during preload stage
      Awaitloader.call(scene.load, function (successCallback, failureCallback) {\ni18next\n.use(Backend)\n.init({\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n\n// backend: {\n//     loadPath: '',\n//     parse: function(data) { return JSON.parse(data); }\n// },\n}, successCallback);\n})\nTextTranslationBehavior.setI18Next(i18next);\n
      • Awaitloader : Using Awaitloader to load external resource.
      • Backend : i18next-http-backend module can be used to load external resource.
      • TextTranslationBehavior.setI18Next(i18next) : Pass i18next to TextTranslationBehavior.
        • TextTranslationBehavior.setI18Next is a static method.
    • Add translation behavior
      var translation = new TextTranslationBehavior(textGameObject, config);\n
    "},{"location":"texttranslation/#initialize-i18next","title":"Initialize i18next","text":"
    scene.plugins.get('rexTextTranslation').initI18Next(scene, {\nlng: 'dev',\nfallbackLng: 'dev',\nns: 'translation',\n\n// resources: {\n//     'dev': {\n//         'translation': {\n//             key: value,  \n//         }\n//     }\n// }\n\n// debug: true,\n\n// backend: {\n//     loadPath: '',\n//     parse: function(data) { return JSON.parse(data); }\n// },\n})\n

    or

    i18next\n.use(Backend)\n.init(config, onComplete);\n
    • lng : Language to use. Will fallback to 'dev'.
    • fallbackLng : Language to use if translations in user language are not available. Setting it explicitly to false will not trigger to load the fallbackLng at all.
    • ns : String or array of namespaces to load. Default value is 'translation'.
    • debug : Logs info level to console output. Helps finding issues with loading not working. Default value is false.
    • resources : Resources to initialize with.
    • backend.loadPath : Path where resources get loaded from, or a function returning a path.
      function(lngs, namespaces) { return customPath; }\n
    • backend.parse : Parse data after it has been fetched. Optional.
      function(data) { return JSON.parse(data); }\n

    See also Configuration Options, and Backend Options

    "},{"location":"texttranslation/#create-instance","title":"Create instance","text":"
    var translation = scene.plugins.get('rexTextTranslation').add(textGameObject, {\n// translationKey: '',\n// interpolation: {},\n\n// updateText: true,\n\n// setText: function(gameObject, text) { \n//     gameObject.setText(text); \n// }\n});\n
    • textObject : text object, bbcode text object, tag text object, bitmap text object, or label game object
    • translationKey : Key in translation resource. See Essentials
    • interpolation : Integrating dynamic values into translation result. See Interpolation
    • updateText :
      • true : Update text object via translationKey, and interpolation. Default behavior.
      • false : Don't update text object now.
    • setText : Callback invoked when updating text object. Default value is
      function(gameObject, text) {\ngameObject.setText(text);\n}\n
    "},{"location":"texttranslation/#set-translation-key","title":"Set translation key","text":"
    translation\n.setTranslationKey(key)\n.updateText()\n
    "},{"location":"texttranslation/#set-interpolation","title":"Set interpolation","text":"
    • Assign interpolation object
      translation\n.setInterpolation(object)\n.updateText()\n
    • Update current interpolation object
      translation\n.updateInterpolation(key, value)\n.updateText()\n
      or
      translation\n.updateInterpolation(object)\n.updateText()\n
    "},{"location":"texttranslation/#update-text","title":"Update text","text":"

    Update text object via translationKey, and interpolation.

    translation.updateText()\n
    "},{"location":"texttranslation/#change-language","title":"Change language","text":"
    scene.plugins.get('rexTextTranslation').changeLanguage(language);\n// scene.plugins.get('rexTextTranslation').changeLanguage(language, onComplete);\n

    or

    i18next.changeLanguage(language, onComplete);\n

    All translation behavior will update text object after changing language.

    "},{"location":"texttranslation/#set-default-namespace","title":"Set default namespace","text":"
    scene.plugins.get('rexTextTranslation').setDefaultNamespace(namespace);\n

    or

    i18next.setDefaultNamespace(namespace);\n
    "},{"location":"texttranslation/#translate-string","title":"Translate string","text":"
    var result = scene.plugins.get('rexTextTranslation').t(translationKey, interpolation);\n

    or

    var result = i18next.t(translationKey, interpolation);\n
    "},{"location":"texttranslation/#events","title":"Events","text":"
    • On language changed, triggered by changeLanguage method.
      scene.plugins.get('rexTextTranslation').on('languageChanged', function (lng) {\n});\n
      or
      i18next.on('languageChanged', function (lng) {\n});\n
    "},{"location":"texttruncator/","title":"Truncator","text":""},{"location":"texttruncator/#introduction","title":"Introduction","text":"

    Constraints text game object size by truncating text with padding symbol on text object, bbcode text object, or tag text object.

    • Author: Rex
    • Behavior of text object
    "},{"location":"texttruncator/#live-demos","title":"Live demos","text":"
    • Truncate text
    • Truncate BBCodeText
    "},{"location":"texttruncator/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"texttruncator/#install-plugin","title":"Install plugin","text":""},{"location":"texttruncator/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextexttruncatorplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexttruncatorplugin.min.js', true);\n
    • Add text-truncator behavior
      var truncator = scene.plugins.get('rextexttruncatorplugin').add(textGameObject, config);\n
    "},{"location":"texttruncator/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextTruncatorPlugin from 'phaser3-rex-plugins/plugins/texttruncator-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextTruncator',\nplugin: TextTruncatorPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-truncator behavior
      var truncator = scene.plugins.get('rexTextTruncator').add(textGameObject, config);\n
    "},{"location":"texttruncator/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TextTruncator from 'phaser3-rex-plugins/plugins/texttruncator.js';\n
    • Add text-truncator behavior
      var truncator = new TextTruncator(textGameObject, config);\n
    "},{"location":"texttruncator/#create-instance","title":"Create instance","text":"
    var truncator = scene.plugins.get('rexTextTruncator').add(textGameObject, {\n// enable: true,\n// symbol: '...',\n// maxWidth: undefined,\n// maxHeight: undefined,\n// text: '',              // content in string or array\n});\n
    • textObject : Text object, bbcode text object, tag text object, or bitmap text object
    • enable :
      • true : Truncate string with padding symbol. Default value.
      • false : Display all text.
    • symbol : Padding symbol. Default value is '...'
    • maxWidth : Maximum width of game object, for single-line mode.
      • undefined : Use fixedWidth as maximum width.
    • maxHeight : Maximum height of game object, for multiple-line mode.
      • undefined : Use fixedHeight as maximum height.
    • text : content in string or array, optional
    "},{"location":"texttruncator/#truncation-modes","title":"Truncation modes","text":"
    • Single-line mode :
      • maxHeight or fixedHeight are not given, or 0
      • Have maxWidth or fixedWidth
    • Multiple-line mode
      • Have fixedWidth or wordWrap.width (wrap-width)
      • Have maxHeight or fixedHeight
    "},{"location":"texttruncator/#set-content","title":"Set content","text":"
    • Set content
      truncator.setText(content);\n
      • content : String, number, or string array.
    • Append content
      truncator.appendText(content);\n
      • content : String, number, or string array.

    Will update displaying content.

    • Get content back
      var text = truncator.text;\n
    "},{"location":"texttruncator/#update-display-content","title":"Update display content","text":"
    truncator.updateText();\n
    "},{"location":"texttruncator/#set-enable","title":"Set enable","text":"
    truncator.setEnable(enable).updateText();\n
    "},{"location":"texttruncator/#set-paddding-symbol","title":"Set paddding symbol","text":"
    truncator.setSymbol(symbol).updateText();\n
    "},{"location":"texttruncator/#set-max-size","title":"Set max size","text":"
    • Max width
      • Set
        truncator.setMaxWidth(width).updateText();\n
      • Get
        var width = truncator.maxWidth;\n
    • Max height
      • Set
        truncator.setMaxHeight(height).updateText();\n
      • Get
        var height = truncator.maxHeight;\n
    "},{"location":"texttyping/","title":"Typing","text":""},{"location":"texttyping/#introduction","title":"Introduction","text":"

    Typing text on text object, bbcode text object, or tag text object.

    • Author: Rex
    • Behavior of text object
    "},{"location":"texttyping/#live-demos","title":"Live demos","text":"
    • BBCode text + page + typing
    • Text wrap enable
    • TextBox, see text-box.
    "},{"location":"texttyping/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"texttyping/#install-plugin","title":"Install plugin","text":""},{"location":"texttyping/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextexttypingplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextexttypingplugin.min.js', true);\n
    • Add typing behavior
      var typing = scene.plugins.get('rextexttypingplugin').add(textGameObject, config);\n
    "},{"location":"texttyping/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TextTypingPlugin from 'phaser3-rex-plugins/plugins/texttyping-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTextTyping',\nplugin: TextTypingPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add typing behavior
      var typing = scene.plugins.get('rexTextTyping').add(textGameObject, config);\n
    "},{"location":"texttyping/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TextTyping from 'phaser3-rex-plugins/plugins/texttyping.js';\n
    • Add typing behavior
      var typing = new TextTyping(textGameObject, config);\n
    "},{"location":"texttyping/#create-instance","title":"Create instance","text":"
    var typing = scene.plugins.get('rexTextTyping').add(textGameObject, {\n// wrap: false,\n// speed: 333,       // typing speed in ms\n// typeMode: 0,      //0|'left-to-right'|1|'right-to-left'|2|'middle-to-sides'|3|'sides-to-middle'\n// setTextCallback: function(text, isLastChar, insertIdx){ return text; }  // callback before set-text\n// setTextCallbackScope: null,   \n});\n
    • textObject : Text object, bbcode text object, tag text object, or bitmap text object
    • wrap :
      • false : Don't insert \\n, default behavior.
      • true : Insert \\n to wrap content according to style of text, to prevent typing jittering.
    • speed : Typing speed in ms, default value is 333.
    • typeMode :
      • 'left-to-right', or 0 : Typing characters from left to right.
      • 'right-to-left', or 1 : Typing characters from right to left.
      • 'middle-to-sides', or 2 : Typing characters from middle to sides.
      • 'sides-to-middle', or 3 : Typing characters from sides to middle.
    • setTextCallback : Callback befor set-text, to decorate display text.
      function(text, isLastChar, insertIdx) { return text; }\n
    • setTextCallbackScope : Scope of setTextCallback function.
    "},{"location":"texttyping/#start-typing","title":"Start typing","text":"
    typing.start(text);\n// typing.start(text, speed); \n
    • text : Typing content string.
    • speed : Typing speed in ms.
    "},{"location":"texttyping/#start-typing-from-line","title":"Start typing from line","text":"
    typing.startFromLine(text, lineIndex);\n// typing.startFromLine(text, lineIndex, speed);\n
    • text : Typing content string.
    • lineIndex : Start from line.
    • speed : Typing speed in ms.
    "},{"location":"texttyping/#typing-more-text","title":"Typing more text","text":"
    typing.appendText(text);\n
    "},{"location":"texttyping/#stop-typing","title":"Stop typing","text":"
    typing.stop();\n// typing.stop(true);;  // stop and show all text\n
    "},{"location":"texttyping/#pauseresume-typing","title":"Pause/Resume typing","text":"
    • Pause typing
      typing.pause();\n
    • Resume typing
      typing.resume();\n
    "},{"location":"texttyping/#set-typing-speed","title":"Set typing speed","text":"
    typing.setTypingSpeed(speed);  // speed in ms\n// typing.speed = speed;\n

    Set speed in typing event or setTextCallback to change typing speed of remaining text.

    "},{"location":"texttyping/#set-typing-mode","title":"Set typing mode","text":"
    typing.setTypeMode(mode);\n
    • typeMode :
      • 'left-to-right', or 0 : typing characters from left to right.
      • 'right-to-left', or 1 : typing characters from right to left.
      • 'middle-to-sides', or 2 : typing characters from middle to sides, optional.
      • 'sides-to-middle', or 3 : typing characters from sides to middle.
    "},{"location":"texttyping/#events","title":"Events","text":"
    • On changing content of text game object :
      typing.on('type', function(){\n\n});\n
    • On typing a character
      typing.on('typechar', function(char){\n\n});\n
    • On typing completed :
      typing.on('complete', function(typing, txt){});\n
    "},{"location":"texttyping/#status","title":"Status","text":"
    • Is typing
      var isTyping = typing.isTyping;\n
    "},{"location":"textures/","title":"Textures","text":""},{"location":"textures/#introduction","title":"Introduction","text":"

    Textures cache, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"textures/#usage","title":"Usage","text":""},{"location":"textures/#image-texture","title":"Image texture","text":"
    • Load image texture
      scene.load.image(key, url);\n
      Reference: Loader
    • Load image texture via base64 string
      scene.textures.addBase64(key, data)\n
    • Get image texture
      var texture = scene.textures.get(key);\nvar image = texture.getSourceImage();\n// var width = image.width;\n// var height = image.height;\n
    • Get image texture from frame object
      var texture = scene.textures.get(frameObject);\n
    "},{"location":"textures/#get-pixel","title":"Get pixel","text":"
    var color = scene.textures.getPixel(x, y, key);\n// var color = scene.textures.getPixel(x, y, key, frame);\n

    Properties of color

    • r : 0 ~ 255
    • g : 0 ~ 255
    • b : 0 ~ 255
    • a : 0 ~ 255
    • color : color integer
    var alpha = scene.textures.getPixelAlpha(x, y, key);\n// var alpha = scene.textures.getPixelAlpha(x, y, key, frame);\n

    alpha : 0 ~ 255

    Return null if the coordinates were out of bounds.

    "},{"location":"textures/#generate-texture-from-array","title":"Generate texture from array","text":"
    var config = {\ndata: data,\n// 3x3:\n// [ '...',\n//   '...',\n//   '...' ]\npixelWidth: 1,    // pixel width of each data\npixelHeight: 1,   // pixel height of each data\npreRender: null,  // callback, function(canvas, ctx) {}\npostRender: null, // callback, function(canvas, ctx) {}\n\ncanvas: null,  // create a canvas if null\nresizeCanvas: true,\nclearCanvas: true\n};\nvar texture = scene.textures.generate(key, config);\n
    "},{"location":"textures/#has-key","title":"Has key","text":"
    var hasKey = scene.textures.exists(key);\n
    "},{"location":"textures/#remove-texture","title":"Remove texture","text":"

    Remove texture stored in texture cache.

    scene.textures.remove(key);\n
    "},{"location":"textures/#get-base64","title":"Get base64","text":"
    var s = scene.textures.getBase64(key);  // type= 'image/png', encoderOptions= 0.92\n// var s = scene.textures.getBase64(key, frame, type, encoderOptions);\n
    "},{"location":"textures/#default-textures","title":"Default textures","text":"
    • Default : '__DEFAULT'
    • Missing : '__MISSING'
    • 4x4 white : '__WHITE'
    "},{"location":"textures/#get-key-list-of-all-textures","title":"Get key list of all textures","text":"
    var keys = scene.textures.getTextureKeys();\n
    "},{"location":"textures/#texture","title":"Texture","text":""},{"location":"textures/#get-texture","title":"Get texture","text":"
    var texture = scene.textures.get(key);\n
    "},{"location":"textures/#has-frame","title":"Has frame","text":"
    var hasFrame = texture.has(frameName);\n
    "},{"location":"textures/#add-frame","title":"Add frame","text":"
    var frame = texture.add(frameName, sourceIndex, x, y, width, height);\n
    • key : Texture key.
    • frameName : The name of this Frame. The name is unique within the Texture.
    • sourceIndex : The index of the TextureSource that this Frame is a part of.
    • x, y : The x/y coordinate of the top-left of this Frame.
    • width, height : The width/height of this Frame.
    "},{"location":"textures/#remove-frame","title":"Remove frame","text":"
    var removed = texture.remove(frameName);\n
    "},{"location":"textures/#get-name-of-frames","title":"Get name of frames","text":"
    var nameList = texture.getFrameNames();\n// nameList does not include `__BASE`\n

    or

    var nameList = texture.getFrameNames(true);\n// nameList includes `__BASE`\n
    "},{"location":"textures/#frame-object","title":"Frame object","text":""},{"location":"textures/#get-frame","title":"Get frame","text":"
    var frame = scene.textures.getFrame(key, frame);\n
    "},{"location":"textures/#properties","title":"Properties","text":"
    • frame.source.image : Image of texture source.
    • frame.cutX : X position within the source image to cut from.
    • frame.cutY : Y position within the source image to cut from.
    • frame.cutWidth : The width of the area in the source image to cut.
    • frame.cutHeight : The height of the area in the source image to cut.
    "},{"location":"textures/#add-atlas","title":"Add atlas","text":"
    scene.textures.addAtlas(key, HTMLImageElement, data);\n// scene.textures.addAtlas(key, HTMLImageElement, data, dataSource);\n
    • key : The unique string-based key of the Texture.
    • HTMLImageElement : HTML Image element/s.
    • data : The Texture Atlas data/s.
      {\nframes: [\n{\n// Location of frame image\nframe: {\nx, y, w, h\n},\n\n// trimmed\ntrimmed:\nsourceSize: {\nw, h\n},\nspriteSourceSize: {\nx, y, w, h\n},\n\nrotated:\n\n// Custom origin\nanchor: pivot: {\nx, y\n},\n\n// Other custom properties of this frame ...\n}\n],\n\n// Other custom properties of this texture ...\n}\n
    • dataSource : An optional data Image element (normal map).

    or

    scene.textures.addAtlas(undefined, texture, data);\n// scene.textures.addAtlas(undefined, texture, data, dataSource);\n
    • texture : Phaser Texture.
    "},{"location":"textures/#add-sprite-sheet","title":"Add sprite sheet","text":"
    scene.textures.addSpriteSheet(key, HTMLImageElement, config);\n// scene.textures.addAtlas(key, HTMLImageElement, config, dataSource);\n
    • key : The unique string-based key of the Texture.
    • HTMLImageElement : HTML Image element/s.
    • config : The configuration object for this Sprite Sheet.
      {\nframeWidth: ,\nframeHeight: ,\nstartFrame: 0,\nendFrame: -1,\nmargin: 0,\nspacing: 0\n}\n
    • dataSource : An optional data Image element (normal map).

    or

    scene.textures.addSpriteSheet(undefined, texture, config);\n// scene.textures.addSpriteSheet(undefined, texture, config, dataSource);\n
    • texture : Phaser Texture.
    "},{"location":"textures/#events","title":"Events","text":"
    • Texture manager is ready
      scene.textures.on('ready', function() {\n\n})\n
    • Add texture
      scene.textures.on('addtexture', function(key) {\n\n})\n
      or
      scene.textures.on('addtexture-' + key, function() {\n\n})\n
    • Error when adding texture
      scene.textures.on('onerror', function(key) {\n\n})\n
    • Remove texture
      scene.textures.on('removetexture', function(key) {\n\n})\n
      or
      scene.textures.on('removetexture-' + key, function() {\n\n})\n
    "},{"location":"tiledmapdata/","title":"Tiled map data","text":""},{"location":"tiledmapdata/#introduction","title":"Introduction","text":"

    Parses a Tiled JSON object into a new MapData object.

    • Author: Richard Davey
    "},{"location":"tiledmapdata/#usage","title":"Usage","text":"
    var mapData = Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled(name, json, insertNull);\n
    • name : The name of the tilemap, used to set the name on the MapData.
    • json : The Tiled JSON object.
    • insertNull : Controls how empty tiles, tiles with an index of -1.
      • true : Empty locations will get a value of null.
      • false : Empty location will get a Tile object with an index of -1.
    "},{"location":"tiledmapdata/#map-data","title":"Map data","text":""},{"location":"tiledmapdata/#map-type","title":"Map type","text":"
    var mapType = mapData.orientation;\n
    • mapType : orthogonal, isometric, hexagonal
    "},{"location":"tiledmapdata/#map-size","title":"Map size","text":"
    • Grid size
      var mapWidth = mapData.width;\nvar mapHeight = mapData.height;\n
    • Pixel size
      var mapWidth = mapData.widthInPixels;\nvar mapHeight = mapData.heightInPixels;\n
    "},{"location":"tiledmapdata/#tile-size","title":"Tile size","text":"
    var tileWidth = mapData.tileWidth;\nvar tileHeight = mapData.tileHeight;\n
    "},{"location":"tiledmapdata/#layer","title":"Layer","text":"
    var layers = mapData.layers;\n
    mapData.layers.forEach(function(layer){\nvar name = layer.name;\n\n\nvar alpha = layer.alpha;\nvar visible = layer.visible;\n\nvar x = layer.x;\nvar y = layer.y;\nvar width = layer.width;\nvar height = layer.height;\nvar data = layer.data;\n\nlayer.data.forEach(function(gid, index){\nvar tileX = index % width;\nvar tileY = Math.floor(index / width);\nif (gid === -1) { // Empty\n\n} else {\n\n}\n})\n})\n
    "},{"location":"tilemap/","title":"Tile map","text":""},{"location":"tilemap/#introduction","title":"Introduction","text":"

    Display of tiles map, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"tilemap/#usage","title":"Usage","text":""},{"location":"tilemap/#hierarchy","title":"Hierarchy","text":"
    graph TB\n\ntilemap --> layerA[\"layerA<br>(Game object)\"]\ntilemap --> layerB\n\nlayerA --> tilesA[\"tiles<br>(layer.data[x][y])\"]\nlayerB --> tilesB[\"tiles\"]
    • map : A container for Tilemap data.
    • layer : A Game Object that renders LayerData from a map when used in combination with one or more tileset.
    • tiles : A 2d array of Tile object
      • Tile : A lightweight data representation, store position information without factoring in scroll, layer scale or layer position.
    • tileset : Image and tileData of some kind of tiles.
    "},{"location":"tilemap/#load-tile-map","title":"Load tile map","text":"
    scene.load.tilemapTiledJSON(key, url);   // JSON\nscene.load.tilemapCSV(key, url);         // CSV\n
    "},{"location":"tilemap/#add-tile-map-object","title":"Add tile map object","text":"
    1. Create map
      • Create map from tiled
        var map = scene.add.tilemap(key);\n
        or
        var map = this.make.tilemap({ key: 'map', tileWidth: 16, tileHeight: 16\n});\n
        • Support ORTHOGONAL, ISOMETRIC, STAGGERED, HEXAGONAL map
      • Create map from 2d array
        var map = this.make.tilemap({\n// data: tileIdxArray,  // [ [], [], ... ]\ntileWidth: 32,\ntileHeight: 32,\nwidth: 10,\nheight: 10,\n});\n
        • Only support ORTHOGONAL map
      • Create map from csv
        var map = this.make.tilemap({\nkey: 'map',     // csv file\ntileWidth: 32,\ntileHeight: 32,\n});\n
        • Only support ORTHOGONAL map
    2. Add tileset image
      var tileset = map.addTilesetImage(tilesetName, key); // key: texture key\n// var tileset = map.addTilesetImage(tilesetName);  // key = tilesetName\n// var tileset = map.addTilesetImage(tilesetName, key, tileWidth, tileHeight, tileMargin, tileSpacing, gid, tileOffset);\n
      • key : The key of the Phaser.Cache image used for this tileset.
        • undefined , null : Use tilesetName as default value.
      • tileWidth , tileHeight : The width/height of the tile (in pixels) in the Tileset Image.
        • undefined : Default to the map's tileWidth/tileHeight.
      • tileMargin : The margin around the tiles in the sheet (in pixels).
        • undefined : Default to 0
      • tileSpacing The spacing between each the tile in the sheet (in pixels).
        • undefined : Default to 0
      • gid : If adding multiple tilesets to a blank map, specify the starting GID this set will use here.
      • tileOffset : {x, y} Tile texture drawing offset.
    3. Create layer
      • Create existed layer
        var layer = map.createLayer(layerID, tileset);\n// var layer = map.createLayer(layerID, tileset, x, y);\n
        • tileset : The tileset, or an array of tilesets.
          • A string, or an array of string.
          • A tileset object, or an array of tileset objects.
        • x, y : Offset in pixels. Default is 0/0.
      • Create a new and empty layer
        var layer = map.createBlankLayer(layerID, tileset);\n// var layer = map.createBlankLayer(layerID, tileset, x, y, width, height, tileWidth, tileHeight); // x, y : offset in pixels\n
        • layerID : The name of this layer. Must be unique within the map.
        • tileset : The tileset, or an array of tilesets.
          • A string, or an array of string.
          • A tileset object, or an array of tileset objects.
        • x, y : Offset in pixels. Default is 0/0.
        • width, height : The width/height of the layer in tiles. Default is map.width/map.height.
        • tileWidth, tileHeight : The width/height of the tiles the layer uses for calculations. Default is map's tileWidth/tileHeight.
    4. Create game objects (optional)
      • Create game objects by Object-ID/Object-GID/Object-Name
        var sprites = map.createFromObjects(layerName, {\n// gid: 26,\n// name: 'bonus',\n// id: 9,\n\n// classType: Sprite,\n// ignoreTileset\n// scene,\n// container: null,\n// key: null,\n// frame: null\n}, useTileset);\n
        or
        var sprites = map.createFromObjects(layerName, configArray, useTileset);\n
        • One of filter
          • gid : Object GID.
          • id : Object ID.
          • name : Object Name.
        • classType : Class of game object, default is Sprite.
        • ignoreTileset :
        • scene : A Scene reference, passed to the Game Objects constructors. Default is map's scene.
        • container : Optional Container to which the Game Objects are added.
        • key, frame : Optional key of a Texture to be used.
      • Create game objects by tile
        var sprites = map.createFromTiles(indexes, replacements, spriteConfig);\n// var sprites = map.createFromTiles(indexes, replacements, spriteConfig, scene, camera, layer);\n
        • indexes : The tile index, or array of indexes
        • replacements :
          • null : Leave the tiles unchanged
          • Array of indexes : One-to-one mapping indexes to replacements.
        • spriteConfig : The config object to pass into the Sprite creator (i.e. scene.make.sprite).
          • useSpriteSheet : Set to true to load the tileset as a sprite sheet (not an image), map frame to tile index.
          • Copy rotation, flipX, flipY, alpha, visible and tint properties from Tile to sprites if these properties are not given.
        • scene : The Scene to create the Sprites within.
        • camera : The Camera to use when determining the world XY.
        • layer : The Tilemap Layer to act upon.
    "},{"location":"tilemap/#map","title":"Map","text":""},{"location":"tilemap/#map-size","title":"Map size","text":"
    var mapWidth = map.width;\nvar mapHeight = map.height;\n
    "},{"location":"tilemap/#tile-size","title":"Tile size","text":"
    • Set
      map.setBaseTileSize(tileWidth, tileHeight);\n
    • Get
      var tileWidth = map.tileWidth;\nvar tileHeight = map.tileHeight;\n
    "},{"location":"tilemap/#tileworld-position","title":"Tile/world position","text":"
    • World position -> Tile position
      var tileXY = map.worldToTileXY(worldX, worldY);\n// var out = map.worldToTileXY(worldX, worldY, snapToFloor, out, camera, layer);\n
    • Tile position -> World position
      var worldXY = map.tileToWorldXY(tileX, tileY);\n// var out = map.tileToWorldXY(tileX, tileY, out, camera, layer);\n
    "},{"location":"tilemap/#tile-at-world-xy","title":"Tile at world XY","text":"
    var hasTile = map.hasTileAtWorldXY(worldX, worldY);\n

    or

    var hasTile = map.hasTileAtWorldXY(worldX, worldY, camera, layer);\n
    "},{"location":"tilemap/#draw-on-graphics","title":"Draw on graphics","text":"
    map.renderDebug(graphics);\n

    or

    map.renderDebug(graphics, {\ntileColor: new Phaser.Display.Color(105, 210, 231, 150),         // null\ncollidingTileColor: new Phaser.Display.Color(243, 134, 48, 200), // null\nfaceColor: new Phaser.Display.Color(40, 39, 37, 150)             // null\n});\n

    or

    map.renderDebug(graphics, styleConfig, layer);\n
    • graphics : Graphics game object.
    "},{"location":"tilemap/#layer","title":"Layer","text":"

    A Game Object that renders LayerData from a map when used in combination with one or more tileset.

    "},{"location":"tilemap/#get-layer","title":"Get layer","text":"
    • Get layer instance
      var layer = map.getLayer(name);\n
    • Set current layer of map
      map.setLayer(layer);  // layer name, layer index\n
      or
      map.layer = layer;\n
    "},{"location":"tilemap/#render-pipeline","title":"Render pipeline","text":"
    layer.setPipeline(pipelineName);\n
    layer.setPostPipeline(pipelineName);\n

    See Render pipeline section of Game object.

    "},{"location":"tilemap/#render-order","title":"Render order","text":"
    layer.setRenderOrder(renderOrder);\n
    • renderOrder
      • 0, or 'right-down'
      • 1, or 'left-down'
      • 2, or 'right-up'
      • 3, or 'left-up'
    "},{"location":"tilemap/#fill-tiles","title":"Fill tiles","text":"
    • Fill current layer
      map.fill(index);  // Fill all grids\n
      or
      map.fill(index, tileX, tileY, width, height);\n
    • Fill layer
      layer.fill(index);  // Fill all grids\n
      or
      layer.fill(index, tileX, tileY, width, height);\n
    "},{"location":"tilemap/#randomize","title":"Randomize","text":"
    • Randomize current layer
      map.randomize(); // Randomize all grids\n
      or
      map.randomize(tileX, tileY, width, height, indexes);\n
      • indexes An array of tile indexes.
        • -1 : Empty tile.
    • Weight randomize current layer
      map.weightedRandomize(\n{\n{ index: 0, weight: 4 },\n{ index: [0, 1], weight: 4 }\n},\ntileX, tileY, width, height);\n
    • Randomize layer
      layer.randomize();  // Randomize all grids\n
      or
      layer.randomize(tileX, tileY, width, height, indexes);\n
      • indexes An array of tile indexes.
    • Weight randomize layer
      layer.weightedRandomize(\n{\n{ index: 0, weight: 4 },\n{ index: [0, 1], weight: 4 }\n},\ntileX, tileY, width, height);\n
    "},{"location":"tilemap/#copy-tiles","title":"Copy tiles","text":"
    • Copy current layer
      map.copy(srcTileX, srcTileY, width, height, destTileX, destTileY);\n
    • Copy layer
      map.copy(srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer);\n
      or
      layer.copy(srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces);\n
    "},{"location":"tilemap/#put-tile-at","title":"Put tile at","text":"
    • Put on current layer
      map.putTileAt(tile, tileX, tileY);\n
      • tile :
        • Tile index
        • Tile object :
          var tile = map.getTileAt(tileX, tileY);\n
          or
          var tile = map.getTileAtWorldXY(worldX, worldY);\n
    • Put on layer
      map.putTileAt(tile, tileX, tileY, recalculateFaces, layer);\n
      or
      layer.putTileAt(tile, tileX, tileY, recalculateFaces);\n
      • tile : Tile index, or tile object.
    "},{"location":"tilemap/#put-tiles-at","title":"Put tiles at","text":"
    • Put on current layer
      map.putTilesAt(tilesArray, tileX, tileY);  // tilesArray: 1d/2d array of Tile object or tile index\n
      • tilesArray : 1d/2d array of tile objects or tile indexes
    • Put on layer
      map.putTilesAt(tilesArray, tileX, tileY, recalculateFaces, layer);\n
      or
      layer.putTilesAt(tilesArray, tileX, tileY, recalculateFaces);\n
      • tilesArray : 1d/2d array of tile objects or tile indexes
    "},{"location":"tilemap/#replace-tiles","title":"Replace tiles","text":"
    • Replace on current layer
      map.replaceByIndex(findIndex, newIndex); // Search on all grids\n
      or
      map.replaceByIndex(findIndex, newIndex, tileX, tileY, width, height);\n
    • Replace on layer
      map.replaceByIndex(findIndex, newIndex, tileX, tileY, width, height, layer);\n
      or
      layer.replaceByIndex(findIndex, newIndex, tileX, tileY, width, height);\n
    "},{"location":"tilemap/#swap-tiles","title":"Swap tiles","text":"
    • Swap on current layer
      map.swapByIndex(indexA, indexB);\n
      or
      map.swapByIndex(indexA, indexB, tileX, tileY, width, height);\n
    • Swap on layer
      map.swapByIndex(indexA, indexB, tileX, tileY, width, height, layer);\n
      or
      layer.swapByIndex(indexA, indexB, tileX, tileY, width, height);\n
    "},{"location":"tilemap/#shuffle-tiles","title":"Shuffle tiles","text":"
    • Shuffle on current layer
      map.shuffle();\n
      or
      map.shuffle(tileX, tileY, width, height);\n
    • Shuffle on layer
      map.shuffle(tileX, tileY, width, height, layer);\n
      or
      layer.shuffle(tileX, tileY, width, height);\n
    "},{"location":"tilemap/#shader-effects","title":"Shader effects","text":"

    `layer`` support postFX effects

    Note

    No preFX effect support

    "},{"location":"tilemap/#tile","title":"Tile","text":""},{"location":"tilemap/#get-tile","title":"Get tile","text":"
    var tile = map.getTileAt(tileX, tileY);\n// var tile = map.getTileAtWorldXY(worldX, worldY);\n

    or

    var tile = map.getTileAt(tileX, tileY, true, layer);  // Return a Tile object with an index of -1 for empty tile\n// var tile = map.getTileAtWorldXY(worldX, worldY, true, camera, layer);\n
    • layer : The tile layer to use. Default is current layer (map.setLayer(layer))
    • tile : A tile, or null if layer is invalid.
    "},{"location":"tilemap/#get-tiles-within-a-rectangle-area","title":"Get tiles within a rectangle area","text":"
    var tiles = map.getTilesWithin(tileX, tileY, width, height);\n

    or

    var tiles = map.getTilesWithin(tileX, tileY, width, height, {\n// isNotEmpty: false,\n// isColliding: false,\n// hasInterestingFace: false\n}, layer);\n
    • tileX , tileY : The left/top most tile index (in tile coordinates) to use as the origin of the area. Default is 0/0.
    • width , height : How many tiles wide/tall from the tileX/tileY index the area will be. Default is map.width/map.height.
    • filteringOptions : Optional filters to apply when getting the tiles.
      • isNotEmpty : If true, only return tiles that don't have -1 for an index.
      • isColliding : If true, only return tiles that collide on at least one side.
      • hasInterestingFace : If true, only return tiles that have at least one interesting face.
    • layer : The tile layer to use. Default is current layer (map.setLayer(layer))
    • tiles : An array of Tiles, or null if layer is invalid.
    "},{"location":"tilemap/#get-tiles-within-world-xy","title":"Get tiles within world XY","text":"
    var tiles = map.getTilesWithinWorldXY(worldX, worldY, width, height);\n

    or

    var tiles = map.getTilesWithinWorldXY(worldX, worldY, width, height,  {\n// isNotEmpty: false,\n// isColliding: false,\n// hasInterestingFace: false\n}, camera, layer);\n
    • worldX , worldY : The world x/y coordinate for the top-left of the area.
    • width , height : The width/height of the area. Default is map.width/map.height.
    • filteringOptions : Optional filters to apply when getting the tiles.
      • isNotEmpty : If true, only return tiles that don't have -1 for an index.
      • isColliding : If true, only return tiles that collide on at least one side.
      • hasInterestingFace : If true, only return tiles that have at least one interesting face.
    • camera : The Camera to use when factoring in which tiles to return. Default is main camera.
    • layer : The tile layer to use. Default is current layer (map.setLayer(layer))
    • tiles : An array of Tiles, or null if layer is invalid.
    "},{"location":"tilemap/#get-tiles-within-shape","title":"Get tiles within shape","text":"
    vat tiles = map.getTilesWithinShape(shape);\n

    or

    vat tiles = map.getTilesWithinShape(shape, {\n// isNotEmpty: false,\n// isColliding: false,\n// hasInterestingFace: false\n}, camera, layer);\n

    Shape:

    • new Phaser.Geom.Rectangle(x0, y0, width, height)
    • new Phaser.Geom.Line(x0, y0, x1, y1)
    • new Phaser.Geom.Circle(x, y, radius)
    • new Phaser.Geom.Triangle(x0, y0, x1, y1, x2, y2)
    "},{"location":"tilemap/#for-each-tile-in-layer","title":"For each tile in layer","text":"
    map.forEachTile(function(tile, index, tileArray) { /* ... */ }, context);\n

    or

    map.forEachTile(function(tile, index, tileArray) { /* ... */ }, context,\ntileX, tileY, width, height, {\n// isNotEmpty: false,\n// isColliding: false,\n// hasInterestingFace: false\n}, layer);\n
    • tileX , tileY : The left/top most tile index (in tile coordinates) to use as the origin of the area to search.
    • width , height : How many tiles wide/tall from the tileX/tileY index the area will be. Default is map.width/map.height.
    • filteringOptions : Optional filters to apply when getting the tiles.
      • isNotEmpty : If true, only return tiles that don't have -1 for an index.
      • isColliding : If true, only return tiles that collide on at least one side.
      • hasInterestingFace : If true, only return tiles that have at least one interesting face.
    • layer : The tile layer to use. Default is current layer (map.setLayer(layer))
    "},{"location":"tilemap/#tile-index","title":"Tile index","text":"
    • Get index
      var index = tile.index;\n
    • Copy index
      tile.index = index;\n
    • Copy
      tile.copy(tileSrc);\n
      Copies the tile data & properties from the given tile to this tile. This copies everything except for position and interesting faces.
    "},{"location":"tilemap/#tile-position","title":"Tile position","text":"
    var x = tile.x;\nvar y = tile.y;\n
    "},{"location":"tilemap/#tile-corners","title":"Tile corners","text":"
    var points = map.getTileCorners(tileX, tileY, camera, layer);\n
    • points : Array of vector2 corresponding to the world XY location of each tile corner.
    "},{"location":"tilemap/#alpha","title":"Alpha","text":"
    • Set
      tile.setAlpha(value);\n
      or
      tile.alpha = value;\n
    • Get
      var alpha = tile.alpha;\n
    "},{"location":"tilemap/#visible","title":"Visible","text":"
    • Set
      tile.setVisible(visible);\n
      or
      tile.visible = visible;\n
    • Get
      var visible = visible;\n
    "},{"location":"tilemap/#flip","title":"Flip","text":"
    • Set
      tile.setFlipX(flipX);\ntile.setFlipY(flipY);\n
      or
      tile.flipX = flipX;\ntile.flipY = flipY;\n
    • Toggle
      tile.toggleFlipX();\ntile.toggleFlipY();\n
      or
      tile.flipX = !tile.flipX;\ntile.flipY = !tile.flipY;\n
    • Reset
      tile.resetFlip();\n
      or
      tile.flipX = false;\ntile.flipY = false;\n
    • Get
      var flipX = tile.flipX;\nvar flipY = tile.flipY;\n
    "},{"location":"tilemap/#bounds","title":"Bounds","text":"
    • Bounds rectangle
      var bounds = tile.getBounds();\n// var out = tile.getBounds(camera, out);\n
    • Left
      var left = tile.getLeft();\n// var left = tile.getLeft(camera);\n
    • Right
      var right = tile.getRight();\n// var right = tile.getRight(camera);\n
    • CenterX
      var centerX = tile.getCenterX();\n// var centerX = tile.getCenterX(camera);\n
    • Top
      var top = tile.getTop();\n// var top = tile.getTop(camera);\n
    • Bottom
      var bottom = tile.getBottom();\n// var bottom = tile.getBottom(camera);\n
    • CenterY
      var centerY = tile.getCenterY();\n// var centerY = tile.getCenterY(camera);\n
    "},{"location":"tilemap/#properties","title":"Properties","text":"
    var properties = tile.properties;  // object or null\nvar value = properties[key];\n
    tile.properties[key] = value;\n
    "},{"location":"tilemap/#collision","title":"Collision","text":""},{"location":"tilemap/#enable-collision","title":"Enable collision","text":"
    • Enable collision by tile index
      map.setCollision(index);\n// map.setCollision(index, true, recalculateFaces, updateLayer);\n
      • index : Tile index, or an array of tile indexes.
    • Enable collision by tile index in a range
      map.setCollisionBetween(start, stop);\n// map.setCollisionBetween(start, stop, true, recalculateFaces, layer);\n
      • start , stop : The first/last index of the tile.
    • Enable collision excluded tile indexes
      map.setCollisionByExclusion(indexes);\n// map.setCollisionByExclusion(indexes, true, recalculateFaces, layer);\n
      • index : An array of tile indexes.
    • Enable collision by properties matching
      • Enable collision if value of tile property 'key' is equal to 'value'
        map.setCollisionByProperty({key:value});\n// map.setCollisionByProperty({key:value}, true, recalculateFaces, layer);\n
      • Enable collision if value of tile property 'key' is equal to 'value0', or 'value1'
        map.setCollisionByProperty({key:[value0, value1]});\n// map.setCollisionByProperty({key:[value0, value1]}, true, recalculateFaces, layer);\n
    • Enable collision by collision group
      map.setCollisionFromCollisionGroup();\n// map.setCollisionFromCollisionGroup(true, recalculateFaces, layer);\n
    "},{"location":"tilemap/#disable-collision","title":"Disable collision","text":"
    • Disable collision by tile index
      map.setCollision(index, false);\n// map.setCollision(index, false, recalculateFaces, layer);\n
      • index : Tile index, or an array of tile indexes.
    • Disable collision by tile index in a range
      map.setCollisionBetween(start, stop, false);\n// map.setCollisionBetween(start, stop, false, recalculateFaces, layer);\n
      • start , stop : The first/last index of the tile.
    • Disable collision by properties matching
      • Disable collision if value of tile property 'key' is equal to 'value'
        map.setCollisionByProperty({key:value}, false);\n// map.setCollisionByProperty({key:value}, false, recalculateFaces, layer);\n
      • Disable collision if value of tile property 'key' is equal to 'value0', or 'value1'
        map.setCollisionByProperty({key:[value0, value1]}, false);\n// map.setCollisionByProperty({key:[value0, value1]}, false, recalculateFaces, layer);\n
    • Disable collision by collision group
      map.setCollisionFromCollisionGroup(false);\n// map.setCollisionFromCollisionGroup(false, recalculateFaces, layer);\n
    "},{"location":"tilemap/#get-collision-group","title":"Get collision group","text":"
    var collisionGroup = tile.getCollisionGroup();\n

    or

    var collisionGroup = tileset.getTileCollisionGroup(tile.index); // array of collision shapes, or null\n

    Types of collision shape (collisionGroup.objects[i])

    • object.rectangle :
      {\nrectangle: true,\nx, y,\nwidth, height\n}\n
      • x, y : Offset position related top-left of tile.
        var worldX = tile.getLeft() + object.x;\nvar worldY = tile.getTop() + object.y;\n
      • width, height : Width/height of rectangle area in pixels.
    • object.ellipse :
      {\nellipse: true,\nx, y,\nwidth, height\n}\n
      • x, y : Offset position related top-left of tile.
        var centerX = tile.getLeft() + object.x + (object.width / 2);\nvar centerY = tile.getTop() + object.y + (object.height / 2);\n
      • width, height : Width/height of ellipse area in pixels.
    • object.polygon :
      {\nx, y,\npolygon: [{x,y}, {x,y}, ...]\n}\n
      • Each point :
        {\nx: tile.getLeft() + object.x + polygon[i].x,\ny: tile.getTop() + object.y + polygon[i].y\n}\n
    • object.polyline :
      {\nx, y,\npolyline: [{x,y}, {x,y}, ...]\n}\n
      • Each point :
        {\nx: tile.getLeft() + object.x + polyline[i].x,\ny: tile.getTop() + object.y + polyline[i].y\n}\n
    "},{"location":"tilemap/#arcade-collision","title":"Arcade collision","text":"
    scene.physics.add.collider(arcadeGO, layer);\n

    or, in update stage:

    scene.physics.world.collide(arcadeGO, layer);\n

    See Collision section of Arcade-world.

    "},{"location":"tilemap/#matter-collision","title":"Matter collision","text":"
    • Any colliding tiles will be given a Matter body.
      scene.matter.world.convertTilemapLayer(layer);\n
    "},{"location":"tilemap/#tileset","title":"Tileset","text":""},{"location":"tilemap/#get-tileset","title":"Get tileset","text":"
    var tileset = map.getTileset(name);\n
    "},{"location":"tilemap/#change-texture-of-tileset","title":"Change texture of tileset","text":"
    var texture = scene.sys.textures.get(key);\ntileset.setImage(texture);\n
    "},{"location":"tilesprite/","title":"Tile sprite","text":""},{"location":"tilesprite/#introduction","title":"Introduction","text":"

    Display of repeating texture, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"tilesprite/#usage","title":"Usage","text":""},{"location":"tilesprite/#load-texture","title":"Load texture","text":"
    scene.load.image(key, url);\n

    Reference: load image

    "},{"location":"tilesprite/#add-tile-sprite-object","title":"Add tile sprite object","text":"
    var image = scene.add.tileSprite(x, y, width, height, textureKey);\n

    Add tile sprite from JSON

    var image = scene.make.tileSprite({\nx: 0,\ny: 0,\nwidth: 512,\nheight: 512,\nkey: '',\n\n// angle: 0,\n// alpha: 1\n// flipX: true,\n// flipY: true,\n// scale : {\n//    x: 1,\n//    y: 1\n//},\n// origin: {x: 0.5, y: 0.5},\n\nadd: true\n});\n
    "},{"location":"tilesprite/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTileSprite extends Phaser.GameObjects.TileSprite {\nconstructor(scene, x, y, width, height, texture, frame) {\nsuper(scene, x, y, width, height, texture, frame);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var image = new MyTileSprite(scene, x, y, key);\n
    "},{"location":"tilesprite/#properties-of-tiles","title":"Properties of tiles","text":"
    • Position
      image.setTilePosition(x, y);\n
      or
      image.tilePositionX = x;\nimage.tilePositionY = y;\n
    • Scale
      image.setTileScale(scaleX, scaleY);\n
      or
      image.tileScaleX = scaleX;\nimage.tileScaleY = scaleY;\n
    "},{"location":"tilesprite/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"tilesprite/#create-mask","title":"Create mask","text":"
    var mask = image.createBitmapMask();\n

    See mask

    "},{"location":"tilesprite/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"timeline/","title":"Timeline","text":""},{"location":"timeline/#introduction","title":"Introduction","text":"

    Schedule commands to happen at specific times in the future, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"timeline/#usage","title":"Usage","text":""},{"location":"timeline/#create-timeline","title":"Create timeline","text":"
    var timeline = scene.add.timeline([    {\n// Time condition\nat: 0,\nin:\nfrom:\n\n// Enable condition\nif(event) {\n// this: target parameter\nreturn true;  // false\n},\n\nset: {\nkey: value,\n},\n\ntween: {\ntargets: gameObject,\nalpha: 1,\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false\n},\n\nrun(){ // this: target parameter\n},\n\nloop() {\n\n},\n\nsound: '',\n\nevent: '',\n\n// target: this,\n\n// once: false,\n// stop: false,\n},\n\n// ...\n])\n
    • Time :
      • at : Absolute delay time after starting in ms.
      • in : Absolute delay time after current time in ms.
      • from : Relative delay time after previous event in ms
    • Enable :
      • if : A function. Invoking every tick, run actions when it returns true.
    • Actions :
      • set : A key-value object of properties to set on the target.
      • tween : tween config
      • run : A function which will be called when the Event fires.
        function() {\n// this: target parameter\n}\n
      • loop : A function which will be called when the Event sequence repeat again.
        function() {\n// this: target parameter\n}\n
      • sound :
        • A string : A key from the Sound Manager to play
        • A config object for a sound to play when the Event fires.
          {\nkey,\nconfig\n}\n
          • key : The key of the sound to play
          • config : config of playing sound
      • event : String-based event name to emit when the Event fires. The event is emitted from the Timeline instance.
        timeline.on(eventName);\n
      • target : The scope (this object) with which to invoke the run.
    • Control
      • once : If set, the Event will be removed from the Timeline when it fires.
      • stop : If set, the Timeline will stop and enter a complete state when this Event fires, even if there are other events after it.

    The Timeline always starts paused.

    "},{"location":"timeline/#steps-of-commands","title":"Steps of commands","text":"

    For each tick, for each command :

    1. Test time (at, in, from)
    2. Test enable (if)
    3. Run actions (set, tween, run, sound, event)
    4. Control (once, stop)
    "},{"location":"timeline/#start","title":"Start","text":"
    timeline.play();\n
    "},{"location":"timeline/#restart","title":"Restart","text":"
    timeline.play(true);\n
    "},{"location":"timeline/#start-with-repeat","title":"Start with repeat","text":"
    • Repeat infinite
      timeline.repeat().play();\n// timeline.repeat(true).play();\n// timeline.repeat(-1).play();\n
    • Amount of times to repeat
      timeline.repeat(amount).play();\n
      • amount : A positive number
    • No repeat
      timeline.repeat(false);\n
    • Current loop counter
      var loopCounter = timeline.iteration;\n
    "},{"location":"timeline/#stop","title":"Stop","text":"
    timeline.stop();\n
    "},{"location":"timeline/#pause-resume","title":"Pause / Resume","text":"
    timeline.pause();\n// timeline.paused = true;\n
    timeline.resume();\n// timeline.paused = false;\n

    Will also pause/resume currently active Tweens.

    "},{"location":"timeline/#reset","title":"Reset","text":"

    Resets this Timeline back to the start, include loop counter.

    If the Timeline had any events that were set to once that have already been removed, they will not be present again after calling this method.

    timeline.reset();\n

    If the Timeline isn't currently running (i.e. it's paused or complete) then calling this method resets those states, the same as calling Timeline.play(true) (restart).

    "},{"location":"timeline/#add-command","title":"Add command","text":"
    timeline.add(config);\n

    or

    timeline.add([config0, config1, ...]);\n
    "},{"location":"timeline/#clear-all-commands","title":"Clear all commands","text":"
    timeline.clear();\n

    Will also destroy currently active Tweens.

    "},{"location":"timeline/#events","title":"Events","text":"
    • On all commands are completed
      timeline.on('complete', function(){\n\n});\n
    "},{"location":"timeline/#other-properties","title":"Other properties","text":"
    • Timeline is currently playing, not paused or not complete.
      var isPlaying = timeline.isPlaying()\n
    • Is paused
      var isPaused = timeline.paused;\n
    • All commands are complete
      var isCompleted = timeline.complete;\n
    "},{"location":"timeline/#destroy","title":"Destroy","text":"

    Also remove updating.

    timeline.destroy();\n

    Will also destroy currently active Tweens.

    "},{"location":"timer/","title":"Timer","text":""},{"location":"timer/#introduction","title":"Introduction","text":"

    Execute callback when time-out, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"timer/#usage","title":"Usage","text":""},{"location":"timer/#start-timer","title":"Start timer","text":"
    • Looped timer
      var timer = scene.time.addEvent({\ndelay: 500,                // ms\ncallback: callback,\n//args: [],\ncallbackScope: thisArg,\nloop: true\n});\n
    • Repeat timer
      var timer = scene.time.addEvent({\ndelay: 500,                // ms\ncallback: callback,\n//args: [],\ncallbackScope: thisArg,\nrepeat: 4\n});\n
    • Oneshot timer
      var timer = scene.time.delayedCall(delay, callback, args, scope);  // delay in ms\n
    • All properties of timer
      var timer = scene.time.addEvent({\ndelay: 500,                // ms\ncallback: callback,\nargs: [],\ncallbackScope: thisArg,\nloop: false,\nrepeat: 0,\nstartAt: 0,\ntimeScale: 1,\npaused: false\n});\n
    • Reuse timer
      timer.reset({\ndelay: 500,                // ms\ncallback: callback,\nargs: [],\ncallbackScope: thisArg,\nloop: false,\nrepeat: 0,\nstartAt: 0,\ntimeScale: 1,\npaused: false\n})\nscene.time.addEvent(timer);\n

    Note

    Throw error message if delay : 0 with (repeat > 0 or loop: true)

    "},{"location":"timer/#pauseresume","title":"Pause/resume","text":"
    • Pause timer
      timer.paused = true;\n
    • Resume timer
      timer.paused = false;\n
    • Is paused
      var isPaused = timer.paused;\n
    "},{"location":"timer/#stop","title":"Stop","text":"
    • Stop a running timer
      timer.remove();\n
    • Remove from timeline's all internal lists, for timer re-using
      scene.time.removeEvent(timer);\n
    "},{"location":"timer/#time-scale","title":"Time scale","text":"
    • Set
      timer.timeScale = 2;\n
    • Get
      var timeScale = timer.timeScale;\n
    "},{"location":"timer/#other-properties","title":"Other properties","text":"
    • Get elapsed time
      var elapsed = timer.getElapsed();   // ms\nvar elapsed = timer.getElapsedSeconds(); // sec\n// var elapsed = timer.elapsed;  // ms\n
    • Get remaining time
      var remaining = timer.getRemaining();   // ms\nvar remaining = timer.getRemainingSeconds(); // sec\n// var remaining = timer.getOverallRemaining();   // ms\n// var remaining = timer.getOverallRemainingSeconds(); // sec\n
    • Get repeat count
      var repeat = timer.getRepeatCount();\n
    • Gets the progress of the current iteration
      var progress = timer.getProgress();  // elapsed / delay\n
    • Gets the progress of the timer overall, factoring in repeats.
      var progress = timer.getOverallProgress();  // totalElapsed / totalDuration\n
    • Get delay time
      var delay = timer.delay;   // ms\n
    "},{"location":"tintrgb/","title":"TintRGB","text":""},{"location":"tintrgb/#introduction","title":"Introduction","text":"

    Attach tintR, tintG, tintB, and tintGray properties to a game object.

    Note

    This behavior will override default tint property

    • Author: Rex
    • Method only
    "},{"location":"tintrgb/#live-demos","title":"Live demos","text":"
    • Fade
    • Yellow to green
    "},{"location":"tintrgb/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"tintrgb/#install-plugin","title":"Install plugin","text":""},{"location":"tintrgb/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextintrgbplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextintrgbplugin.min.js', true);\n
    • Attach tintR, tintG, tintB, and tintGray properties.
      scene.plugins.get('rextintrgbplugin').add(gameObject, tintRGB);\ngameObject.tintGray = 128;\n
    "},{"location":"tintrgb/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TintRGBPlugin from 'phaser3-rex-plugins/plugins/tintrgb-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTintRGB',\nplugin: TintRGBPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Attach tintR, tintG, tintB, and tintGray properties.
      scene.plugins.get('rexTintRGB').add(gameObject, tintRGB);\ngameObject.tintGray = 128;\n
    "},{"location":"tintrgb/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import AddTintRGBProperties from 'phaser3-rex-plugins/plugins/tintrgb.js';\n
    • Attach tintR, tintG, tintB, and tintGray properties.
      AddTintRGBProperties(gameObject, tintRGB);\ngameObject.tintGray = 128;\n
    "},{"location":"tintrgb/#attach-properties","title":"Attach properties","text":"
    scene.plugins.get('rexTintRGB').add(gameObject, tintRGB);\ngameObject.tintGray = 128;\n// gameObject.tintR = 128;\n// gameObject.tintG = 128;\n// gameObject.tintB = 128;\n
    • tintRGB : Initial tintRGB value in 0xRRGGBB.
    • tintR : color R of tint, 0~255. Default is 255.
    • tintG : color G of tint, 0~255. Default is 255.
    • tintB : color B of tint, 0~255. Default is 255.
    • tintGray :\u3000Gray tint, 0~255. Default is 255.
      • Set gameObject.tintGray is equal to set tintR, tintG, tintB with the same value.
    "},{"location":"tintrgb/#fade","title":"Fade","text":"
    scene.tweens.add({\ntargets: gameObject,\ntintR: 0,\ntintG: 0,\ntintB: 0,\n// tintGray: 0,\nduration: 3000\n})\n
    "},{"location":"tools/","title":"Tools","text":""},{"location":"tools/#texture-atlas","title":"Texture atlas","text":""},{"location":"tools/#texture-packer","title":"Texture-packer","text":"

    Texture-packer

    "},{"location":"tools/#free-texture-packer","title":"Free texture packer","text":"

    Free texture packer, Web app

    "},{"location":"tools/#leshy-spritesheet-tool","title":"Leshy SpriteSheet Tool","text":"

    Leshy SpriteSheet Tool

    Export to JSON-TP-Hash

    "},{"location":"tools/#aseprite","title":"Aseprite","text":"

    Aseprite

    1. Go to \"File - Export Sprite Sheet\"
    2. On the Layout tab:
    3. Set the \"Sheet type\" to \"Packed\"
    4. Set the \"Constraints\" to \"None\"
    5. Check the \"Merge Duplicates\" checkbox
    6. On the Sprite tab:
      1. Set \"Layers\" to \"Visible layers\"
      2. Set \"Frames\" to \"All frames\", unless you only wish to export a sub-set of tags
    7. On the Borders tab:
      1. Check the \"Trim Sprite\" and \"Trim Cells\" options
      2. Ensure \"Border Padding\", \"Spacing\" and \"Inner Padding\" are all > 0 (1 is usually enough)
    8. On the Output tab:
      1. Check \"Output File\", give your image a name and make sure you choose \"png files\" as the file type
      2. Check \"JSON Data\" and give your json file a name
      3. The JSON Data type can be either a Hash or Array, Phaser doesn't mind.
      4. Make sure \"Tags\" is checked in the Meta options
      5. In the \"Item Filename\" input box, make sure it says just \"{frame}\" and nothing more.
    9. Click export

    Tested with Aseprite 1.2.25

    "},{"location":"tools/#atlas-packer","title":"Atlas-packer","text":"
    • gammafp/Atlas-packer
    "},{"location":"tools/#animation","title":"Animation","text":"
    • gammafp/Animator
    "},{"location":"tools/#bitmap-font","title":"Bitmap font","text":"
    • SnowB BMF
    • 71squared-glyphdesigner
    • Bitmap Font Generator
    • TTF to PNG
    "},{"location":"touchevents/","title":"Touch events","text":""},{"location":"touchevents/#introduction","title":"Introduction","text":"

    Built-in touch/mouse events of phaser.

    • Author: Richard Davey

    Note

    No touch input event fired in preload stage.

    "},{"location":"touchevents/#usage","title":"Usage","text":""},{"location":"touchevents/#quick-start","title":"Quick start","text":"
    • Is touching
      var pointer = scene.input.activePointer;\nif (pointer.isDown) {\nvar touchX = pointer.x;\nvar touchY = pointer.y;\n// ...\n}\n
    • On any touching start
      scene.input.on('pointerdown', function(pointer){\nvar touchX = pointer.x;\nvar touchY = pointer.y;\n// ...\n}, scope);\n
    • On any touching end
      scene.input.on('pointerup', function(pointer){\nvar touchX = pointer.x;\nvar touchY = pointer.y;\n// ...\n}, scope);\n
    • On touch game object start
      gameObject.setInteractive().on('pointerdown', function(pointer, localX, localY, event){\n// ...\n}, scope);\n
    • On touch game object end
      gameObject.setInteractive().on('pointerup', function(pointer, localX, localY, event){\n// ...\n}, scope);\n
    • Drag game object
      gameObject\n.setInteractive({ draggable: true })\n.on('dragstart', function(pointer, dragX, dragY){\n// ...\n}, scope);\n.on('drag', function(pointer, dragX, dragY){\ngameObject.setPosition(dragX, dragY);\n}, scope);\n.on('dragend', function(pointer, dragX, dragY, dropped){\n// ...\n}, scope);\n

    Reference : Properties of point

    "},{"location":"touchevents/#register-interactive","title":"Register interactive","text":"

    Call gameObject.setInteractive(...) to register touch input of Game Object before listening touching events.

    • Set hit area from width & height (rectangle) of the texture
      gameObject.setInteractive();\n
    • Set hit area from game object
      gameObject.setInteractive(shape, callback);\n
      • Circle
        • shape : new Phaser.Geom.Circle(x, y, radius)
        • callback : Phaser.Geom.Circle.Contains
      • Ellipse
        • shape : new Phaser.Geom.Ellipse(x, y, width, height)
        • callback : Phaser.Geom.Ellipse.Contains
      • Rectangle
        • shape : new Phaser.Geom.Rectangle(x, y, width, height)
        • callback : Phaser.Geom.Rectangle.Contains
      • Triangle
        • shape : new Phaser.Geom.Triangle(x1, y1, x2, y2, x3, y3)
        • callback : Phaser.Geom.Triangle.Contains
      • Polygon
        • shape : new Phaser.Geom.Polygon(points)
        • callback : Phaser.Geom.Polygon.Contains
      • Hexagon
        • shape : new Phaser.Geom.rexHexagon(x, y, size, type)
        • callback : Phaser.Geom.Polygon.Contains
      • Rhombus
        • shape : new Phaser.Geom.rexRhombus(x, y, width, height)
        • callback : Phaser.Geom.Polygon.Contains
      • Note: x, y relate to the top-left of the gameObject.
    • Set hit area from input plugin
      scene.input.setHitArea(gameObjects, shape, callback);\n
      • Circle
        scene.input.setHitAreaCircle(gameObjects, x, y, radius);\n// scene.input.setHitAreaCircle(gameObjects, x, y, radius, callback); // callback = Circle.Contains\n
      • Ellipse
        scene.input.setHitAreaEllipse(gameObjects, x, y, width, height);\n// scene.input.setHitAreaEllipse(gameObjects, x, y, width, height, callback); // callback = Ellipse.Contains\n
      • Rectangle
        scene.input.setHitAreaRectangle(gameObjects, x, y, width, height);\n// scene.input.setHitAreaRectangle(gameObjects, x, y, width, height, callback); // callback = Rectangle.Contains\n
      • Triangle
        scene.input.setHitAreaTriangle(gameObjects, x1, y1, x2, y2, x3, y3);\n// scene.input.setHitAreaTriangle(gameObjects, x1, y1, x2, y2, x3, y3, callback); // callback = Triangle.Contains\n
      • Note: x, y relate to the top-left of the gameObject.
    • Set interactive configuration
      gameObject.setInteractive({\nhitArea: shape,\nhitAreaCallback: callback,\nhitAreaDebug: shape,\ndraggable: false,\ndropZone: false,\nuseHandCursor: false,\ncursor: CSSString,\npixelPerfect: false,\nalphaTolerance: 1\n});\n
      • Hit area
        • shape
        • Pixel alpha
          • pixelPerfect : true
          • alphaTolerance : 1 (0-255)
        • Custom hit-testing function
          • hitAreaCallback
            function(shape, x, y, gameObject) {\nreturn hit;  // true/false\n}\n
            • shape : Hit area object
            • x, y : Local position of texture.
            • gameObject : Game object.
        • hitAreaDebug : Debug shape.
      • Dragging
        • draggable : true
      • Drop zone
        • dropZone : true
      • Cursor
        • cursor : CSS string
        • useHandCursor : true

    Pixel perfect hit-testing

    This is an expensive process, should only be enabled on Game Objects that really need it.

    "},{"location":"touchevents/#disable-interactive","title":"Disable interactive","text":"
    • Disable temporary
      gameObject.disableInteractive();\n// gameObject.disableInteractive(resetCursor);\n
      • resetCursor : Should the currently active Input cursor, if any, be reset to the default cursor?
    • Remove interaction
      gameObject.removeInteractive();\n// gameObject.removeInteractive(resetCursor);\n
      • resetCursor : Should the currently active Input cursor, if any, be reset to the default cursor?
    "},{"location":"touchevents/#top-only","title":"Top only","text":"

    When set to true this Input Plugin will emulate DOM behavior by only emitting events from the top-most Game Objects in the Display List. If set to false it will emit events from all Game Objects below a Pointer, not just the top one.

    • Get
      var topOnly = scene.input.topOnly;\n
    • Set
      scene.input.topOnly = topOnly;\nscene.input.setTopOnly(topOnly);\n

    Each scene can has its own scene.input.topOnly setting.

    "},{"location":"touchevents/#touch-events","title":"Touch events","text":"

    Trigger these events from top scene to bottom scene.

    1. Events on touched Game object
      gameObject.on('pointerdown', function(pointer, localX, localY, event){ /* ... */ }, scope);\ngameObject.on('pointerup', function(pointer, localX, localY, event){ /* ... */ }, scope);\ngameObject.on('pointermove', function(pointer, localX, localY, event){ /* ... */ }, scope);\ngameObject.on('pointerover', function(pointer, localX, localY, event){ /* ... */ }, scope);\ngameObject.on('pointerout', function(pointer, event){ /* ... */ }, scope);\n
      • Cancel remaining touched events
        function(pointer, localX, localY, event) {\nevent.stopPropagation();\n}\n
    2. Event on input plugin for each touched Game object
      scene.input.on('gameobjectdown', function(pointer, gameObject, event){ /* ... */ }, scope);\nscene.input.on('gameobjectup', function(pointer, gameObject, event){ /* ... */ }, scope);\nscene.input.on('gameobjectmove', function(pointer, gameObject, event){ /* ... */ }, scope);\nscene.input.on('gameobjectover', function(pointer, gameObject, event){ /* ... */ }, scope);\nscene.input.on('gameobjectout', function(pointer, gameObject, event){ /* ... */ }, scope);\n
      • Cancel remaining touched events
        function(pointer, gameObject, event) {\nevent.stopPropagation();\n}\n
    3. Events to get all touched Game Objects
      scene.input.on('pointerdown', function(pointer, currentlyOver){ /* ... */ }, scope);\nscene.input.on('pointerdownoutside', function(pointer){ /* ... */ }, scope);\nscene.input.on('pointerup', function(pointer, currentlyOver){ /* ... */ }, scope);\nscene.input.on('pointerupoutside', function(pointer){ /* ... */ }, scope);\nscene.input.on('pointermove', function(pointer, currentlyOver){ /* ... */ }, scope);\nscene.input.on('pointerover', function(pointer, justOver){ /* ... */ }, scope);\nscene.input.on('pointerout', function(pointer, justOut){ /* ... */ }, scope);\nscene.input.on('gameout', function(timeStamp, domEvent){ /* ... */ }, scope);\nscene.input.on('gameover', function(timeStamp, domEvent){ /* ... */ }, scope);\n
      • Check pointer.camera in multiple-cameras scene.
    "},{"location":"touchevents/#game-canvas","title":"Game canvas","text":"
    scene.input.on('gameout', function(timeStamp, event){ /* ... */ }, scope);\nscene.input.on('gameover', function(timeStamp, event){ /* ... */ }, scope);\n
    "},{"location":"touchevents/#dragging","title":"Dragging","text":""},{"location":"touchevents/#enable-dragging","title":"Enable dragging","text":"
    • Enable dragging when registering interactive
      gameObject.setInteractive({ draggable: true });\n
    • Enable dragging and add it to dragging detecting list after registered interactive
      scene.input.setDraggable(gameObject);\n
    • Enable dragging
      gameObject.input.draggable = true;\n
    "},{"location":"touchevents/#disable-dragging","title":"Disable dragging","text":"
    • Remove Game Object from dragging detecting list
      scene.input.setDraggable(gameObject, false);\n
    • Disable dragging but keep it in dragging detecting list
      gameObject.input.draggable = false;\n
    "},{"location":"touchevents/#dragging-events","title":"Dragging events","text":"
    gameObject.on('dragstart', function(pointer, dragX, dragY){ /* ... */ }, scope);\ngameObject.on('drag', function(pointer, dragX, dragY){ /* ... */ }, scope);\ngameObject.on('dragend', function(pointer, dragX, dragY, dropped){ /* ... */ }, scope);\n
    scene.input.on('dragstart', function(pointer, gameObject){ /* ... */ }, scope);\nscene.input.on('drag', function(pointer, gameObject, dragX, dragY){ /* ... */ }, scope);\nscene.input.on('dragend', function(pointer, gameObject, dropped){ /* ... */ }, scope);\n
    • dropped : 'dragend' and also 'drop'.
    "},{"location":"touchevents/#dragging-properties","title":"Dragging properties","text":"
    scene.input.dragDistanceThreshold = 16;\nscene.input.dragTimeThreshold = 500;\n
    "},{"location":"touchevents/#drop-zone","title":"Drop zone","text":""},{"location":"touchevents/#enable-drop-zone","title":"Enable drop zone","text":"
    • Enable dropping when registering interactive
      gameObject.setInteractive({ dropZone: true });\n
    • Enable dropping after registered interactive
      gameObject.input.dropZone = true;\n
    "},{"location":"touchevents/#disable-drop-zone","title":"Disable drop zone","text":"
    gameObject.input.dropZone = false;\n
    "},{"location":"touchevents/#dropping-events","title":"Dropping events","text":"
    gameObject.on('drop', function(pointer, target){ /* ... */ }, scope);\n\ngameObject.on('dragenter', function(pointer, target){ /* ... */ }, scope);\ngameObject.on('dragover', function(pointer, target){ /* ... */ }, scope);\ngameObject.on('dragleave', function(pointer, target){ /* ... */ }, scope);\n
    scene.input.on('drop', function(pointer, gameObject, target){ /* ... */ }, scope);\n\nscene.input.on('dragenter', function(pointer, gameObject, target){ /* ... */ }, scope);\nscene.input.on('dragover', function(pointer, gameObject, target){ /* ... */ }, scope);\nscene.input.on('dragleave', function(pointer, gameObject, target){ /* ... */ }, scope);\n
    "},{"location":"touchevents/#force-state-of-pointer","title":"Force state of pointer","text":"
    • Down state
      scene.input.forceDownState(pointer, gameObject);\n
      • Emit 'pointerdown' event from game object.
      • Emit 'gameobjectdown' event from scene.input.
    • Up state
      scene.input.forceUpState(pointer, gameObject);\n
      • Emit 'pointerup' event from game object.
      • Emit 'gameobjectup' event from scene.input.
    • Over state
      scene.input.forceOverState(pointer, gameObject);\n
      • Emit 'pointerover' event from game object.
      • Emit 'gameobjectover' event from scene.input.
    • Out state
      scene.input.forceOutState(pointer, gameObject);\n
      • Emit 'pointeroutr' event from game object.
      • Emit 'gameobjectout' event from scene.input.
    "},{"location":"touchevents/#first-event-of-all","title":"First event of all","text":"
    scene.input.on('preupdate', function() { /* ... */ }, scope);\n
    "},{"location":"touchevents/#single-touch","title":"Single touch","text":""},{"location":"touchevents/#pointer","title":"Pointer","text":"
    var pointer = scene.input.activePointer;\n
    "},{"location":"touchevents/#multi-touch","title":"Multi-touch","text":""},{"location":"touchevents/#amount-of-active-pointers","title":"Amount of active pointers","text":"

    Set amount of active pointers in game configuration

    var config = {\n// ...\ninput: {\nactivePointers: 1,\n// ...\n}\n};\nvar game = new Phaser.Game(config);\n

    Or add pointers in run-time.

    scene.input.addPointer(num);  // total points = num + 1\n
    "},{"location":"touchevents/#pointers","title":"Pointers","text":"
    • pointer 1 ~ 10
      var pointer = scene.input.pointer1;\n// ...\nvar pointer = scene.input.pointer10;\n
    • pointer n
      var pointer = scene.input.manager.pointers[n];\n
    • Amount of total pointers
      var amount = scene.input.manager.pointersTotal;\n
      • 1 in desktop
      • 2 in touch device. (0 for mouse, 1 for 1 touch pointer)
    "},{"location":"touchevents/#pointer_1","title":"Pointer","text":"
    • Position
      • Current touching
        • Position in screen : pointer.x , pointer.y
        • Position in camera :
          • Single camera :
            var worldX = pointer.worldX;\nvar worldY = pointer.worldY;\n
          • Multiple cameras :
            var worldXY = pointer.positionToCamera(camera);  // worldXY: {x, y}\n// var worldXY = pointer.positionToCamera(camera, worldXY);\nvar worldX = worldXY.x;\nvar worldY = worldXY.y;\n
          • Camera
            var camera = pointer.camera;\n
        • Position of previous moving : pointer.prevPosition.x , pointer.prevPosition.y
          • Updating when pointer-down, potiner-move, or pointer-up.
        • Interpolated position :
          var points = pointer.getInterpolatedPosition(step);\n// var out = pointer.getInterpolatedPosition(step, out);\n
      • Drag
        • Touching start : pointer.downX, pointer.downY
        • Touching end : pointer.upX, pointer.upY
        • Drag distance between pointer-down to latest pointer : pointer.getDistance()
          • Horizontal drag distance : pointer.getDistanceX()
          • Vertical drag distance : pointer.getDistanceY()
        • Drag angle : pointer.getAngle()
    • Time
      • Touching start : pointer.downTime
      • Touching end : pointer.upTime
      • Drag : pointer.getDuration()
    • Touch state
      • Is touching/any button down : pointer.isDown
      • Is primary button down : pointer.primaryDown
    • Button state : pointer.button
      • On Touch devices the value is always 0.
    • Button down
      • No button down : pointer.noButtonDown()
      • Is primary (left) button down : pointer.leftButtonDown()
      • Is secondary (right) button down : pointer.rightButtonDown()
      • Is middle (mouse wheel) button down : pointer.middleButtonDown()
      • Is back button down : pointer.backButtonDown()
      • Is forward button down : pointer.forwardButtonDown()
    • Button released
      • Is primary (left) button released : pointer.leftButtonReleased()
      • Is secondary (right) button released : pointer.rightButtonReleased()
      • Is middle (mouse wheel) button released : pointer.middleButtonReleased()
      • Is back button released : pointer.backButtonReleased()
      • Is forward button released : pointer.forwardButtonReleased()
    • Index in scene.input.manager.pointers : pointer.id
    • Motion
      • Angle: pointer.angle
      • Distance: pointer.distance
      • Velocity: pointer.velocity
        • pointer.velocity.x, `pointer.velocity.y
    "},{"location":"touchevents/#input-object","title":"Input object","text":"
    • gameObject.input : Game object's input object.
    • gameObject.input.localX, gameObject.input.localY : Pointer to local position of texture.
    • gameObject.input.dragStartX, gameObject.input.dragStartY : The x/y coordinate of the Game Object that owns this Interactive Object when the drag started.
    • gameObject.input.dragStartXGlobal, gameObject.input.dragStartYGlobal : The x/y coordinate that the Pointer started dragging this Interactive Object from.
    • gameObject.input.dragX, gameObject.input.dragY : The x/y coordinate that this Interactive Object is currently being dragged to.
    "},{"location":"touchevents/#smooth","title":"Smooth","text":"

    Get touch position from interpolation of previous touch position and current touch position.

    Touch-position = (current-touch-position * smooth-factor) + (previous-touch-position * (1 - smooth-factor))\n
    1. Set smooth factor. In game configuration
      var config = {\n// ....\ninput: {\nsmoothFactor: 0\n}\n}\n
    2. Get touch position
      var x = pointer.x;\nvar y = pointer.y;\nvar worldX = pointer.worldX;\nvar worldY = pointer.worldY;\n
    "},{"location":"touchevents/#debug","title":"Debug","text":"
    • Enable, draw shape of (shape) hit area.
      scene.input.enableDebug(gameObject);\n// scene.input.enableDebug(gameObject, color);\n
    • Disable
      scene.input.removeDebug(gameObject);\n
    • Get debug shape game object
      var shape = gameObject.input.hitAreaDebug;\n
    "},{"location":"touchevents/#poll-rate","title":"Poll rate","text":"
    • Poll when touches moved, or updated. Default behavior.
      scene.input.setPollOnMove();\n
    • Poll every tick.
      scene.input.setPollAlways();\n
    • Set poll rate.
      scene.input.setPollRate(rate);\n
    "},{"location":"toucheventstop/","title":"Touch event stop","text":""},{"location":"toucheventstop/#introduction","title":"Introduction","text":"

    Stop touch events propagation.

    • Author: Rex
    • Behavior of game object
    "},{"location":"toucheventstop/#live-demos","title":"Live demos","text":"
    • Stop touch events
    "},{"location":"toucheventstop/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"toucheventstop/#install-plugin","title":"Install plugin","text":""},{"location":"toucheventstop/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextoucheventstopplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextoucheventstopplugin.min.js', true);\n
    • Add touch-event-stop behavior
      var touchEventStop = scene.plugins.get('rextoucheventstopplugin').add(gameObject, config);\n
    "},{"location":"toucheventstop/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TouchEventStopPlugin from 'phaser3-rex-plugins/plugins/toucheventstop-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTouchEventStop',\nplugin: TouchEventStopPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add touch-event-stop behavior
      var touchEventStop = scene.plugins.get('rexTouchEventStop').add(gameObject, config);\n
    "},{"location":"toucheventstop/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import TouchEventStop from 'phaser3-rex-plugins/plugins/toucheventstop.js';\n
    • Add touch-event-stop behavior
      var touchEventStop = newe TouchEventStop(gameObject, config);\n
    "},{"location":"toucheventstop/#create-instance","title":"Create instance","text":"
    var touchEventStop = scene.plugins.get('rexTouchEventStop').add(gameObject, {\n// hitAreaMode: 0,    // 0|1|'default'|'fullWindow'\n// enable: true\n});\n
    • hitAreaMode : Mode of hit-area
      • 0, or 'default' : Set hit-area to size of game object, only touch events on this game object will be stopped..
      • 1, or 'fullWindow' : Set hit-area to whole window, all touch events will be stopped.
    • enable : Set false to disable touch-event-stop behavior.
    "},{"location":"toucheventstop/#enable","title":"Enable","text":"
    • Get
      var enable = touchEventStop.enable;  // enable: true, or false\n
    • Set
      touchEventStop.setEnable(enable);  // enable: true, or false\n// touchEventStop.enable = enable;\n
    • Toggle
      touchEventStop.toggleEnable();\n
    "},{"location":"touchstate/","title":"Touch state","text":""},{"location":"touchstate/#introduction","title":"Introduction","text":"

    Store current touch input properties.

    • Author: Rex
    • Behavior of game object
    "},{"location":"touchstate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"touchstate/#install-plugin","title":"Install plugin","text":""},{"location":"touchstate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextouchstateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextouchstateplugin.min.js', true);\n
    • Add touch-state behavior
      var touchState = scene.plugins.get('rextouchstateplugin').add(gameObject, config);\n
    "},{"location":"touchstate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TouchStatePlugin from 'phaser3-rex-plugins/plugins/touchstate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTouchState',\nplugin: TouchStatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add touch-state behavior
      var touchState = scene.plugins.get('rexTouchState').add(gameObject, config);\n
    "},{"location":"touchstate/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TouchState from 'phaser3-rex-plugins/plugins/touchstate.js';\n
    • Add touch-state behavior
      var touchState = new TouchState(gameObject, config);\n
    "},{"location":"touchstate/#create-instance","title":"Create instance","text":"
    var touchState = scene.plugins.get('rexTouchState').add(gameObject, {\n// enable: true,\n});\n
    • enable : Can touch.
    "},{"location":"touchstate/#properties","title":"Properties","text":"
    • Is pointer down, is pointer up
      var isDown = touchState.isDown;\nvar isUp = touchState.isUp;\n
    • Is in touching
      var isInTouching = touchState.isInTouching;\n
    • Pointer in local position
      var localX = touchState.localX;\nvar localY = touchState.localY;\n
    • Drag speed
      var speed = touchState.speed;\nvar speedX =  touchState.speedX;\nvar speedY =  touchState.speedY;\n
      var dx = touchState.dx;\nvar dy = touchState.dy;\nvar dt = touchState.dt;    
    "},{"location":"touchstate/#events","title":"Events","text":"
    • Touch start (pointer down)
      touchState.on('touchstart', function (touchState, gameObject, pointer, localX, localY, event) {\n// ...\n}, scope);\n
    • Touch end (pointer up)
      touchState.on('touchend', function (touchState, gameObject, pointer) {\n// ...\n}, scope);\n
    • Touch move (pointer move)
      touchState.on('touchmove', function (touchState, gameObject, pointer, localX, localY, event) {\n// ...\n}, scope);\n
    "},{"location":"touchstate/#enable","title":"Enable","text":"
    • Get
      var enabled = touchState.enable;  // enabled: true, or false\n
    • Set
      touchState.setEnable(enabled);  // enabled: true, or false\n// touchState.enable = enabled;\n
    • Toggle
      touchState.toggleEnable();\n
    "},{"location":"transitionimage/","title":"Transition image","text":""},{"location":"transitionimage/#introduction","title":"Introduction","text":"

    Transit texture to another one. A containerLite game object with 2 image game objects.

    • Author: Rex
    • Game object
    "},{"location":"transitionimage/#live-demos","title":"Live demos","text":"
    • Ease property of current/next image
      • Cross-fade
      • Scale
      • Slide
    • Apply shader effect to current/next image, then ease property this shader effect.
      • Split
      • Dissolve
    • Grid cut current/next image to cell images, then ease property of cell images
      • Grid cut
      • 3 columns
    • Morph custom mask game object
      • Pie mask
    • Transition modes
    "},{"location":"transitionimage/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"transitionimage/#install-plugin","title":"Install plugin","text":""},{"location":"transitionimage/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextransitionimageplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextransitionimageplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexTransitionImage(x, y, texture, frame, config);\n
    "},{"location":"transitionimage/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TransitionImagePlugin from 'phaser3-rex-plugins/plugins/transitionimage-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTransitionImagePlugin',\nplugin: TransitionImagePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexTransitionImage(x, y, texture, frame, config);\n
    "},{"location":"transitionimage/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TransitionImage from 'phaser3-rex-plugins/plugins/transitionimage.js';\n
    • Add image object
      var image = new TransitionImage(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"transitionimage/#create-instance","title":"Create instance","text":"

    var image = scene.add.rexTransitionImage(x, y, texture, frame, {\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,    \n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n\n// width: undefined, height: undefined,\n});\n
    or

    var image = scene.add.rexTransitionImage(x, y, texture, frame, {\n// x: 0,\n// y: 0,\n// key: \n// frame: \n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,    \n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n\n// width: undefined, height: undefined,\n});\n
    • dir : Transition direction.
      • 0, or 'out' : Transit current texture/image out.
      • 1, or 'in' : Transit next texture/image in.
    • onStart, onStartScope : Callback and scope of transition-start. See Set transition callbacks
    • onProgress, onProgressScope : Callback and scope of transition-progress. See Set transition callbacks
    • onComplete, onCompleteScope : Callback and scope of transition-complete. See Set transition callbacks
    • duration : Duration of transition.
    • ease : Ease function of transition-progress.
    • mask : Mask game object.
      • true : Default graphics game object.
      • Any shape game object, or custom shape, custom progress game object.
    • width, height : Scale images to fit this size (widthxheight).
      • undefined : Don't scale images.

    If onStart, onProgress and onComplete are all undefined, it will use cross-fade as default transition callbacks.

    Add transitionimage from JSON

    var image = scene.make.rexTransitionImage({\nx: 0,\ny: 0,\nkey: null,\nframe: null,\n\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,\n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n\n// width: undefined, height: undefined,\n\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"transitionimage/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTransitionImage extends TransitionImage {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var transitionimage = new MyTransitionImage(scene, x, y, texture, frame, config);\n
    "},{"location":"transitionimage/#transit","title":"Transit","text":"
    image\n// .setTransitionDirection(dir)\n// .setTransitionStartCallback(onStart, onStartScope)\n// .setTransitionProgressCallback(onProgress, onProgressScope)\n// .setTransitionCompleteCallback(onComplete, onCompleteScope)\n// .setDuration(duration)\n// .setEaseFunction(ease)\n// .setMaskEnable(enable)\n.transit(texture, frame)\n

    or

    image.transit({\nkey: undefined,\n// frame: undefined,\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,\n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n})\n
    • mask : Mask game object.
      • true : Default graphics game object. Also apply this mask to current and next textures/images
      • Any shape game object, or custom shape, custom progress game object.
        • Apply mask to current texture :
          image.setCurrentImageMaskEnable();\n// image.setCurrentImageMaskEnable(enable, invertAlpha);\n
        • Apply mask to next texture :
          image.setNextImageMaskEnable();\n// image.setNextImageMaskEnable(enable, invertAlpha);\n
        • Apply mask to both current and next trextures :
          image.setMaskEnable();\n// image.setMaskEnable(enable, invertAlpha);\n

    Fire 'complete' event when transition completed.

    "},{"location":"transitionimage/#register-transtion-mode","title":"Register transtion mode","text":"
    • Register transtion mode
      image.addTransitionMode(modeName, {\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,\n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n});\n
    • Trnasit by transition mode
      image.transit(texture, frame, modeName);\n// image.transit(texture, frame, modeNames);\n
      or
      image.transit({\nkey: undefined,\n// frame: undefined,\n\nmode: modeName, // or modeName\n// dir: 0,\n// onStart: function(parent, currentImage, nextImage, t) { },\n// onStartScope: undefined,\n// onProgress: function(parent, currentImage, nextImage, t) { },\n// onProgressScope: undefined,\n// onComplete: function(parent, currentImage, nextImage, t) { },\n// onCompleteScope: undefined,\n// duration: 1000,\n// ease: 'Linear',\n// mask: undefined,\n})\n
      • Can override configuration of transition mode
      • modeName : A string, or an array of string to pick a random mode.
    • Current transition mode
      var modeName = image.currentTransitionMode;\n
    "},{"location":"transitionimage/#current-texture","title":"Current texture","text":"
    var textureKey = image.texture.key;\nvar frameName = image.frame.name;\n
    "},{"location":"transitionimage/#transition-callbacks","title":"Transition callbacks","text":"
    • Set transition direction
      image.setTransitionDirection(dir);\n
      • 0, or 'out' : Transit current texture out.
      • 1, or 'in' : Transit next texture in.
    • Set transition-start callback
      image.setTransitionStartCallback(onStart, onStartScope)\n
      • onStart
        function(parent, currentImage, nextImage, t) { }\n
        • parent : Transition image game object, extends from ContainerLite
        • currentImage : Image game object to display current texture.
        • nextImage : Image game object to display next texture.
        • t : Progress percentage. It is 0 in this case.
    • Set transition-progress callback
      image.setTransitionProgressCallback(onProgress, onProgressScope)\n
      • onProgress
        function(parent, currentImage, nextImage, t) { // parent.setChildLocalAlpha(currentImage, 1 - t);\n// parent.setChildLocalScale(currentImage, 1 - t);\n// parent.setChildLocalPosition(currentImage, x, 0);\n}\n
        • parent : Transition image game object, extends from ContainerLite
        • currentImage : Image game object to display current texture.
          • Set alpha of currentImage, or nextImage by parent.setChildLocalAlpha(currentImage, alpha).
          • Set scale of currentImage, or nextImage by parent.setChildLocalScale(currentImage, scale).
          • Set position of currentImage, or nextImage by parent.setChildLocalScale(currentImage, x, y).
        • nextImage : Image game object to display next texture.
        • t : Progress percentage. 0~1.
    • Set transition-complete callback
      image.setTransitionCompleteCallback(onComplete, onCompleteScope)\n
      • onComplete
        function(parent, currentImage, nextImage, t) { }\n
        • parent : Transition image game object, extends from ContainerLite
        • currentImage : Image game object to display current texture.
        • nextImage : Image game object to display next texture.
        • t : Progress percentage. It is 1 in this case.
    "},{"location":"transitionimage/#transition-duration","title":"Transition duration","text":"
    • Set
      image.setDuration(duration);\n
    • Get
      var duration = image.duration;\n
    "},{"location":"transitionimage/#ease-function","title":"Ease function","text":"
    • Set
      image.setEaseFunction(ease);\n
      • ease : Ease function of transition-progress.
    • Get
      var ease = image.easeFunction;\n
    "},{"location":"transitionimage/#mask","title":"Mask","text":"
    • Apply mask to current texture :
      image.setCurrentImageMaskEnable();\n// image.setCurrentImageMaskEnable(enable, invertAlpha);\n
    • Apply mask to next texture :
      image.setNextImageMaskEnable();\n// image.setNextImageMaskEnable(enable, invertAlpha);\n
    • Apply mask to both current and next trextures :
      image.setMaskEnable();\n// image.setMaskEnable(enable, invertAlpha);\n
    • Assign default mask game object
      image.setMaskGameObject(true);\n
    • Assign custom mask game object
      image.setMaskGameObject(maskGameObject);\n
      • maskGameObject : A graphics game object, or any shape game objects, custom-progress shape game object
    "},{"location":"transitionimage/#grid-cut","title":"Grid cut","text":"

    Grid cut texture to cells.

    • Grid cut current texture :
      var cellImageGameObjects = image.gridCutCurrentImage(columns, rows);\n
      • cellImageGameObjects : Array of cell game objects.
    • Grid cut next texture :
      var cellImageGameObjects = image.gridCutNextImage(columns, rows);\n
      • cellImageGameObjects : Array of cell game objects.
    • Get cut cell image game objects, after cutting.
      var cellImageGameObjects = image.getCellImages();\n
    • Apply mask to cell images
      image.setCellImagesMaskEnable();\n// image.setCellImagesMaskEnable(enable, invertAlpha);\n

    Cut cell image game objects will be set to invisible after transition complete.

    "},{"location":"transitionimage/#pauseresume","title":"Pause/Resume","text":"
    image.pause();\n
    image.resume();\n
    "},{"location":"transitionimage/#stop","title":"Stop","text":"
    image.stop();\n

    Also will fire 'complete' event.

    "},{"location":"transitionimage/#events","title":"Events","text":"
    • On complete
      image.on('complete', function(){\n})\n
    "},{"location":"transitionimage/#flip","title":"Flip","text":"

    Apply flipX, flipY to both current and next trextures.

    • Flip
      image.flipX(value);\nimage.flipY(value);\nimage.flip(x, y);\n
    • Toggle
      image.toggleFlipX();\nimage.toggleFlipY();\n
    "},{"location":"transitionimage/#tint","title":"Tint","text":"

    Apply tint to both current and next trextures.

    image.setTint(value);\n
    "},{"location":"transitionimage/#use-cases","title":"Use cases","text":"
    • Ease property of current/next image.
      • Scale
      • Slide, apply mask to current/next image.
    • Apply shader effect to current/next image, then ease property this shader effect.
      • Dissolve
      • Split
    • Grid cut current/next image to cell images, then ease property of cell images
      • Grid cut
      • Three-columns, apply mask to cell images.
    • Morph custom mask game object
      • Pie-mask, mask current/next image by a custom-progress game object.
    "},{"location":"transitionimage/#internal-image-game-object","title":"Internal image game object","text":"
    • Current, next image game object
      var curentImageGO = image.currentImage;\nvar nextImageGO = image.nextImage;\n
    • Front, back image game object
      var frontImageGO = image.frontImage;\nvar backImageGO = image.backImage;\n
    "},{"location":"transitionimage/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"transitionimage/#shader-effects","title":"Shader effects","text":"

    Internal image game objects (image.currentImage, image.nextImage) support preFX and postFX effects

    "},{"location":"transitionimagepack/","title":"Transition image pack","text":""},{"location":"transitionimagepack/#introduction","title":"Introduction","text":"

    Transit texture to another one, with some pre-build effects, extended from TransitionImage

    • Author: Rex
    • Game object
    "},{"location":"transitionimagepack/#live-demos","title":"Live demos","text":"
    • Effect list
    • Slide modes
    • Fade modes
    • Mask modes
    • Shader effect modes
    "},{"location":"transitionimagepack/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"transitionimagepack/#install-plugin","title":"Install plugin","text":""},{"location":"transitionimagepack/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rextransitionimagepackplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rextransitionimagepackplugin.min.js', true);\n
    • Add image object
      var image = scene.add.rexTransitionImagePack(x, y, texture, frame, config);\n
    "},{"location":"transitionimagepack/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import TransitionImagePackPlugin from 'phaser3-rex-plugins/templates/transitionimagepack/transitionimagepack-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexTransitionImagePackPlugin',\nplugin: TransitionImagePackPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add image object
      var image = scene.add.rexTransitionImagePack(x, y, texture, frame, config);\n
    "},{"location":"transitionimagepack/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import TransitionImagePack from 'phaser3-rex-plugins/templates/transitionimagepack/TransitionImagePack.js';\n
    • Add image object
      var image = new TransitionImagePack(scene, x, y, texture, frame, config);\nscene.add.existing(image);\n
    "},{"location":"transitionimagepack/#create-instance","title":"Create instance","text":"

    var image = scene.add.rexTransitionImagePack(x, y, texture, frame, {   // duration: 1000,\n// width: undefined, height: undefined,\n});\n
    or

    var image = scene.add.rexTransitionImagePack(x, y, texture, frame, {\n// x: 0,\n// y: 0,\n// key: \n// frame: \n// duration: 1000,\n// width: undefined, height: undefined,\n});\n
    • duration : Duration of transition.
    • width, height : Scale images to fit this size (widthxheight).
      • undefined : Don't scale images.

    Add transitionimage from JSON

    var image = scene.make.rexTransitionImagePack({\nx: 0,\ny: 0,\nkey: null,\nframe: null,\n\n// duration: 1000,\n// width: undefined, height: undefined,\n\n// origin: {x: 0.5, y: 0.5},\nadd: true\n});\n
    "},{"location":"transitionimagepack/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTransitionImagePack extends TransitionImagePack {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var transitionimage = new MyTransitionImagePack(scene, x, y, texture, frame, config);\n
    "},{"location":"transitionimagepack/#transit","title":"Transit","text":"
    image\n// .setDuration(duration)\n// .setEaseFunction(ease)\n.transit(texture, frame, modeName)\n

    or

    image.transit({\nkey: undefined,\n// frame: undefined,\n// duration: 1000,\n// ease: 'Linear',\nmode: modeName\n})\n
    • duration : Override default duration setting.
    • ease : Override default ease setting.
    • mode : Pre-build effects
      • Fade effects :
        • 'fade' : Tint old image to black, then tint new image from black to origin color.
        • 'crossFade' : Ease alpha of old image from 1 to 0, and ease alpha of new image from 0 to 1 at the same time.
      • Slide effects : 'slideLeft', 'slideRight', 'slideUp', 'slideDown', 'slideAwayLeft', 'slideAwayRight', 'slideAwayUp', 'slideAwayDown', 'pushLeft', 'pushRight', 'pushUp', 'pushDown'.
      • Zoom(scale) effects : 'zoomOut', 'zoomIn', 'zoomInOut'.
      • Mask effects : 'wipeLeft', 'wipeRight', 'wipeUp', 'wipeDown', 'irisOut', 'irisIn', 'irisInOut', 'pieOut', 'pieIn', 'pieInOut', 'blinds', 'squares', 'diamonds', 'circles', 'curtain'.
      • Shader effects : 'pixellate', 'dissolve', 'revealLeft', 'revealRight', 'revealUp', 'revealDown'
    "},{"location":"transitionimagepack/#current-texture","title":"Current texture","text":"
    var textureKey = image.texture.key;\nvar frameName = image.frame.name;\n
    "},{"location":"transitionimagepack/#transition-duration","title":"Transition duration","text":"
    • Set
      image.setDuration(duration);\n
    • Get
      var duration = image.duration;\n
    "},{"location":"transitionimagepack/#ease-function","title":"Ease function","text":"
    • Set
      image.setEaseFunction(ease);\n
      • ease : Ease function of transition-progress.
    • Get
      var ease = image.easeFunction;\n
    "},{"location":"transitionimagepack/#pauseresume","title":"Pause/Resume","text":"
    image.pause();\n
    image.resume();\n
    "},{"location":"transitionimagepack/#stop","title":"Stop","text":"
    image.stop();\n

    Also will fire 'complete' event.

    "},{"location":"transitionimagepack/#events","title":"Events","text":"
    • On complete
      image.on('complete', function(){\n})\n
    "},{"location":"transitionimagepack/#flip","title":"Flip","text":"
    • Flip
      image.flipX(value);\nimage.flipY(value);\nimage.flip(x, y);\n
    • Toggle
      image.toggleFlipX();\nimage.toggleFlipY();\n
    "},{"location":"transitionimagepack/#other-properties","title":"Other properties","text":"

    See transition image object, game object

    "},{"location":"tween/","title":"Tween","text":""},{"location":"tween/#introduction","title":"Introduction","text":"

    Change properties by tween equations, built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"tween/#usage","title":"Usage","text":""},{"location":"tween/#create-tween-task","title":"Create tween task","text":"
    var tween = scene.tweens.add({\ntargets: gameObject,\nx: 1,\n// x: '+=1',\n// x: '-=1',\n// x: '*=1',\n// x: '/=1',\n// x: 'random(0.25, 0.75)',\n// x: 'int(10, 100)',\n// x: [100, 300, 200, 600],\n// x: { from: 0, to: 1 },\n// x: { start: 0, to: 1 },  \n// x: { start: value0, from: value1, to: value2 },  \n// x: {\n//      getActive: function (target, key, value, targetIndex, totalTargets, tween) { return newValue; },\n//      getStart: function (target, key, value, targetIndex, totalTargets, tween) { return newValue; },\n//      getEnd: function (target, key, value, targetIndex, totalTargets, tween) { return newValue; }\n// },\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false,\n\n// interpolation: null,\n});\n
    • key: value2 : Tween to value2.
    • key: '+=deltaValue' : Tween to current value + deltaValue
      • Support these expressions : key: '+=deltaValue', key: '-=deltaValue', key: '*=deltaValue', key: '/=deltaValue'
    • key: 'random(10, 100)' : Tween to a random float value.
    • key: 'int(10, 100)' : Tween to a random int value.
    • key: [100, 300, 200, 600] : Use interpolation to determine the value.
    • key: { from: value1, to: value2 } : Set the property to value11 when tween started after delay, then tween to value2.
    • value1, value2 : A number, string, or callback(function(target, key, value, targetIndex, totalTargets, tween) { return newValue; })
    • key: { start: value0, to: value2 } : Set the property to value0 immediately, then tween to value2.
      • value1, value2 : A number, string, or callback(function(target, key, value, targetIndex, totalTargets, tween) { return newValue; })
    • key: { start: value0, from: value1, to: value2 } : Set the property to value0 immediately, then set to value1 when tween started after delay, then tween to value2.
      • value0, value1, value2 : A number, string, or callback(function(target, key, value, targetIndex, totalTargets, tween) { return newValue; })
    • key: function(target, key, value, targetIndex, totalTargets, tween) { return newValue; }
      • target :\u3000The tween target.
      • key : The target property.
      • value : The current value of the target property.
      • targetIndex : The index of the target within the Tween.
      • totalTargets : The total number of targets in this Tween.
      • tween : The Tween that invoked this callback.
    • key: { getActive:callback, getStart:callback, getEnd:callback}
      • callback : function(target, key, value, targetIndex, totalTargets, tween) { return newValue; }

    or

    var tween = scene.tweens.add({\ntargets: gameObject,\npaused: false,\ncallbackScope: tween,\n\n// timming/callback of each state\nonStart: function () {},\nonStartParams: [],\n\n// initial delay\ndelay: 0,  // function(target, targetKey, value, targetIndex, totalTargets, tween) { },\n\n// tween duration\nduration: 1000,\nease: 'Linear',\neaseParams: null,\n\nonActive: function () {},\nonUpdate: function (tween, target, key, current, previous, param) {},\nonUpdateParams: [],\n\n// delay between tween and yoyo\nhold: 0,\nyoyo: false,  // true to tween backward\nflipX: false,\nflipY: false,\nonYoyo: function (tween, target, key, current, previous, param) {},\nonYoyoParams: [],\n\n// repeat count (-1: infinite)\nrepeat: 0,\nonRepeat: function (tween, target, key, current, previous, param) {},\nonRepeatParams: [],\n// delay to next pass\nrepeatDelay: 0,\n\n// loop count (-1: infinite)\nloop: 0,\nonLoop: function () {},\nonLoopParams: [],\n// delay to next loop\nloopDelay: 0,\n\n// delay to onComplete callback\ncompleteDelay: 0,\nonComplete: function () {},\nonCompleteParams: [],\n// timming/callback of each state\n\nonStop: function () {}, onPause: function () {}, onResume: function () {}, // properties:\nx: '+=600',        // start from current value\ny: 500,\nrotation: ...\nangle: ...\nalpha: ...\n// ...\n\n// or\nprops: {\nx: { value: '+=600', duration: 3000, ease: 'Power2' },\ny: { value: '500', duration: 1500, ease: 'Bounce.easeOut' }\n},\n\n// or\nprops: {\nx: {\nduration: 400,\nyoyo: true,\nrepeat: 8,\nease: 'Sine.easeInOut',\nvalue: {\ngetActive: function (target, key, value, targetIndex, totalTargets, tween)\n{\nreturn value;\n},\ngetStart: function (target, key, value, targetIndex, totalTargets, tween)\n{\nreturn value + 30;\n},\ngetEnd: function (target, key, value, targetIndex, totalTargets, tween)\n{\ndestX -= 30;\nreturn destX;\n}\n}\n},\n....\n},\n\npersist: false,\n\ninterpolation: null,\ninterpolationData: null,\n\n});\n
    • targets : The targets the tween is updating.
    • delay : The time the tween will wait before it first starts
      • A number, for all targets
      • A callback function, built via stagger builder :
        • From 0 to endValue :
          • scene.tweens.stagger(endValue)
        • From startValue to endValue :
          • scene.tweens.stagger([startValue, endValue])
        • From 0 to endValue, with specific ease function :
          • scene.tweens.stagger(endValue, {ease: 'cubic.inout'})
        • From startValue to endValue, with specific ease function :
          • scene.tweens.stagger([startValue, endValue], {ease: 'cubic.inout'})
        • From 0 to endValue, with specific start index :
          • scene.tweens.stagger(endValue, {from: 'last'})
          • scene.tweens.stagger(endValue, {from: 'center'})
          • scene.tweens.stagger(endValue, {from: index})
        • From startValue to endValue, , with specific start index :
          • scene.tweens.stagger([startValue, endValue], {from: 'last'})
          • scene.tweens.stagger([startValue, endValue], {from: 'center'})
          • scene.tweens.stagger([startValue, endValue], {from: index})
        • From 0 to endValue, with specific ease function, with specific start index :
          • scene.tweens.stagger(endValue, {from: 'last', ease: 'cubic.inout'})
        • From startValue to endValue, with specific ease function , with specific start index :
          • scene.tweens.stagger([startValue, endValue], {from: 'last', ease: 'cubic.inout'})
        • Grid mode. From 0 to endValue.
          • scene.tweens.stagger(endValue, {grid: [gridWidth, gridHeight], })
          • scene.tweens.stagger(endValue, {grid: [gridWidth, gridHeight], from: 'center'})
          • scene.tweens.stagger(endValue, {grid: [gridWidth, gridHeight], from: 'center', ease: 'cubic.inout'})
        • Grid mode. From startValue to endValue.
          • scene.tweens.stagger([startValue, endValue], {grid: [gridWidth, gridHeight], })
          • scene.tweens.stagger([startValue, endValue], {grid: [gridWidth, gridHeight], from: 'center'})
          • scene.tweens.stagger([startValue, endValue], {grid: [gridWidth, gridHeight], from: 'center', ease: 'cubic.inout'})
    • duration : The duration of the tween
    • ease : The ease function used by the tween
    • easeParams : The parameters to go with the ease function (if any)
    • hold : The time the tween will pause before running a yoyo
    • repeat : The number of times the tween will repeat itself (a value of 1 means the tween will play twice, as it repeated once)
    • repeatDelay : The time the tween will pause for before starting a repeat. The tween holds in the start state.
    • yoyo : boolean - Does the tween reverse itself (yoyo) when it reaches the end?
    • flipX : flip X the GameObject on tween end
    • flipY : flip Y the GameObject on tween end
    • completeDelay : The time the tween will wait before the onComplete event is dispatched once it has completed
    • loop : -1 for an infinite loop
    • loopDelay
    • paused : Does the tween start in a paused state, or playing?
    • props : The properties being tweened by the tween
    • onActive : Tween becomes active within the Tween Manager.
      function(tween, target) { }\n
    • onStart : A tween starts.
      function(tween, targets) { }\n
    • onUpdate : Callback which fired when tween task updated
      function(tween, target, key, current, previous, param) { }\n
    • onComplete : Tween completes or is stopped.
      function(tween, targets) { }\n
    • onYoyo : A function to call each time the tween yoyos. Called once per property per target.
      function(tween, target, key, current, previous, param) { }\n
    • onLoop : A function to call each time the tween loops.
      function(tween, targets) { }\n
    • onRepeat : A function to call each time the tween repeats. Called once per property per target.
      function(tween, target, key, current, previous, param) { }\n
    • onStop : A function to call when the tween is stopped.
      function(tween, targets) { }\n
    • onPause : A function to call when the tween is paused.
      function(tween, targets) { }\n
    • onResume : A function to call when the tween is resumed after being paused.
      function(tween, targets) { }\n
    • persist : Will the Tween be automatically destroyed on completion, or retained for future playback?
    • interpolation : The interpolation function to use if the value given is an array of numbers.
      • 'linear', 'bezier', 'catmull' (or 'catmullrom')

    Note

    Tween task will not manipulate any property that begins with an underscore.

    "},{"location":"tween/#ease-equations","title":"Ease equations","text":"
    • Power0 : Linear
    • Power1 : Quadratic.Out
    • Power2 : Cubic.Out
    • Power3 : Quartic.Out
    • Power4 : Quintic.Out
    • Linear
    • Quad : Quadratic.Out
    • Cubic : Cubic.Out
    • Quart : Quartic.Out
    • Quint : Quintic.Out
    • Sine : Sine.Out
    • Expo : Expo.Out
    • Circ : Circular.Out
    • Elastic : Elastic.Out
    • Back : Back.Out
    • Bounce : Bounce.Out
    • Stepped
    • Quad.easeIn
    • Cubic.easeIn
    • Quart.easeIn
    • Quint.easeIn
    • Sine.easeIn
    • Expo.easeIn
    • Circ.easeIn
    • Back.easeIn
    • Bounce.easeIn
    • Quad.easeOut
    • Cubic.easeOut
    • Quart.easeOut
    • Quint.easeOut
    • Sine.easeOut
    • Expo.easeOut
    • Circ.easeOut
    • Back.easeOut
    • Bounce.easeOut
    • Quad.easeInOut
    • Cubic.easeInOut
    • Quart.easeInOut
    • Quint.easeInOut
    • Sine.easeInOut
    • Expo.easeInOut
    • Circ.easeInOut
    • Back.easeInOut
    • Bounce.easeInOut

    Demo

    "},{"location":"tween/#pause-resume-task","title":"Pause / Resume task","text":"
    tween.pause();\n
    tween.resume();\n
    "},{"location":"tween/#stop-task","title":"Stop task","text":"
    tween.complete();\n
    tween.stop();\n

    Won't invoke onComplete callback ('complete' event)

    "},{"location":"tween/#play-task","title":"Play task","text":"
    tween.play();\n
    "},{"location":"tween/#restart-task","title":"Restart task","text":"
    tween.restart();\n
    "},{"location":"tween/#seek","title":"Seek","text":"
    tween.seek(amount);\n// tween.seek(amount, delta, emit);\n
    • amount : The number of milliseconds to seek into the Tween from the beginning.
    • delta : The size of each step when seeking through the Tween. Default value is 16.6 (1000/60)
    • emit : While seeking, should the Tween emit any of its events or callbacks? The default is false.
    "},{"location":"tween/#remove-task","title":"Remove task","text":"

    Removes this Tween from the TweenManager

    tween.remove();\n
    "},{"location":"tween/#destroy-task","title":"Destroy task","text":"

    Free tween task from memory

    tween.destroy();\n

    Note

    A Tween that has been destroyed cannot ever be played or used again.

    "},{"location":"tween/#get-tweens","title":"Get tweens","text":"
    • Tweens of a target
      var tweens = scene.tweens.getTweensOf(target);\n// var tweens = scene.tweens.getTweensOf(target, includePending);\n
      • tweens : Array of tweens, or timelines.
      • includePending : Set true to search pending tweens.
    • All tweens
      var tweens = scene.tweens.getTweens();\n
    "},{"location":"tween/#destroy-task-of-a-target","title":"Destroy task of a target","text":"
    scene.tweens.killTweensOf(target);\n
    • target : The target to kill the tweens of. Provide an array to use multiple targets.
    "},{"location":"tween/#time-scale","title":"Time-scale","text":"
    tween.setTimeScale(v);\n// tween.timeScale = timescale;\n
    var timeScale = tween.getTimeScale();\n// var timeScale = tween.timeScale;\n
    "},{"location":"tween/#global-time-scale","title":"Global time-scale","text":"
    var timeScale = scene.tweens.timeScale;\n
    scene.tweens.timeScale = timescale;\n
    "},{"location":"tween/#events","title":"Events","text":"
    • Tween becomes active within the Tween Manager.
      tween.on('active', function(tween, targets){\n\n}, scope);\n
    • Tween completes or is stopped.
      tween.on('complete', function(tween, targets){\n\n}, scope);\n
    • A tween loops, after any loop delay expires.
      tween.on('loop', function(tween, targets){\n\n}, scope);\n
    • A tween property repeats, after any repeat delay expires.
      tween.on('repeat', function(tween, key, target){\n\n}, scope);\n
    • A tween starts.
      tween.on('start', function(tween, targets){\n\n}, scope);\n
    • A tween property updates.
      tween.on('update', function(tween, key, target, current, previous){\n\n}, scope);\n
      • tween : A reference to the Tween instance that emitted the event.
      • key : The property that was updated, i.e. x or scale.
      • target : The target object that was updated. Usually a Game Object, but can be of any type.
      • current : The current value of the property that was tweened.
      • previous : The previous value of the property that was tweened, prior to this update.
    • A tween property pause.
      tween.on('pause', function(tween, key, target){\n\n}, scope);\n
    • A tween property resume.
      tween.on('resume', function(tween, key, target){\n\n}, scope);\n
    • A tween property yoyos.
      tween.on('yoyo', function(tween, key, target){\n\n}, scope);\n
    • A tween stopped.
      tween.on('stop', function(tween, targets){\n\n}, scope);\n
    "},{"location":"tween/#set-callbacks","title":"Set callbacks","text":"
    tween.setCallback(type, callback, param);\n
    • type :
      • 'onActive' : When the Tween is first created it moves to an 'active' state when added to the Tween Manager. 'Active' does not mean 'playing'.
      • 'onStart' : When the Tween starts playing after a delayed or paused state. This will happen at the same time as onActive if the tween has no delay and isn't paused.
      • 'onLoop' : When a Tween loops, if it has been set to do so. This happens after the loopDelay expires, if set.
      • 'onComplete' : When the Tween finishes playback fully. Never invoked if the Tween is set to repeat infinitely.
      • 'onStop' : Invoked only if the Tween.stop method is called.
      • 'onPause' : Invoked only if the Tween.pause method is called. Not invoked if the Tween Manager is paused.
      • 'onResume' : Invoked only if the Tween.resume method is called. Not invoked if the Tween Manager is resumed.
      • 'onYoyo' : When a TweenData starts a yoyo. This happens after the hold delay expires, if set.
      • 'onRepeat' : When a TweenData repeats playback. This happens after the repeatDelay expires, if set.
      • 'onUpdate' : When a TweenData updates a property on a source target during playback.
    • callback :
      • 'onRepeat', 'onUpdate', 'onYoyo'
        function(tween, targets, key, current, previous, param) {\n\n}\n
      • 'onActive', 'onLoop', 'onPause', 'onResume', 'onComplete', 'onStart', 'onStop',
        function(tween, targets, param) {\n\n}\n
    "},{"location":"tween/#state","title":"State","text":"
    • Is playing
      var isPlaying = tween.isPlaying();\n
    • Is paused
      var isPaused = tween.isPaused();\n
    • Is actively and not just in a delayed state
      var hasStarted = tween.hasStarted;\n
    "},{"location":"tween/#custom-ease-function","title":"Custom ease function","text":"
    var tween = scene.tweens.add({\ntargets: gameObject,\n// ...\nease: function (t) {  // t: 0~1\nreturn value;     // value: 0~1\n},\n// ...\n});\n
    "},{"location":"tween/#has-target","title":"Has target","text":"
    var hasTarget = tween.hasTarget(gameObject);\n
    "},{"location":"tween/#tween-value","title":"Tween value","text":"
    • Create tween task
      var tween = scene.tweens.addCounter({\nfrom: 0,\nto: 1,\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false,\nonUpdate(tween, targets, key, current, previous, param) {\n// var value = current;\n// var value = tween.getValue();\n}\n});\n
      • More config parameters...
    • Get value
      var value = tween.getValue();\n
    "},{"location":"tween/#chain","title":"Chain","text":""},{"location":"tween/#create-chain","title":"Create chain","text":"
    var chain = scene.tweens.chain({\ntargets: null,\ntweens: [\n{\n// targets: gameObject,\nalpha: 1,            ease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false\n},        // ...\n],\n\ndelay: 0,\ncompleteDelay: 0,\nloop: 0,  // repeat: 0,\nrepeatDelay: 0,\npaused: false,\npersist: true,\n// callbackScope: this,\n})\n
    • targets, or tweenConfig.targets
    • tweens : Array of tween config
    "},{"location":"tween/#pause-resume-chain","title":"Pause / Resume chain","text":"
    chain.pause();\n
    chain.resume();\n
    "},{"location":"tween/#restart-chain","title":"Restart chain","text":"
    chain.restart();\n
    "},{"location":"tween/#add-tween-task","title":"Add tween task","text":"
    chain.add({\ntargets: gameObject,\nalpha: 1,\nease: 'Linear',       // 'Cubic', 'Elastic', 'Bounce', 'Back'\nduration: 1000,\nrepeat: 0,            // -1: infinity\nyoyo: false\n})\n

    or

    chain.add([tweenConfig0, tweenConfig1, ...]);\n
    "},{"location":"tween/#remove-tween-task","title":"Remove tween task","text":"
    chain.remove(tweenTask);\n
    "},{"location":"tween/#has-target_1","title":"Has target","text":"
    var hasTarget = chain.hasTarget(gameObject);\n
    "},{"location":"tween/#flow-chart","title":"Flow chart","text":"
    graph TB\n\nStart((Start)) --> CallbackOnStart\nCallbackOnStart>\"Callback: onStart\"] --> ActiveDelay((\"delay\"))\nActiveDelay --> DurationForward\n\nDurationForward((\"Tween forward<br>Callback: onUpdate<br>(duration)\")) --> Hold[\"hold\"]\nHold((hold)) --> IsYoyo{Is yoyo}\nIsYoyo --> |Yes| CallbackOnYoyo>\"Callback: onYoyo\"]\nCallbackOnYoyo --> DurationBackward((\"Tween backword<br>Callback: onUpdate<br>(duration)\"))\nDurationBackward --> IsRepeat{\"Repeat count > 0\"}\nIsYoyo --> |No| IsRepeat\nIsRepeat --> |Yes| CallbackOnRepeat>\"Callback: onRepeat\"]\nCallbackOnRepeat --> RepeatDelay((\"repeatDelay\"))\nRepeatDelay --> DurationForward\n\nIsRepeat --> |No| IsLoop{\"Loop count > 0\"}\n\nIsLoop --> |Yes| CallbackOnLoop\nCallbackOnLoop>\"Callback: onLoop\"] --> LoopDelay((\"loopDelay\"))\nLoopDelay --> DurationForward\n\nIsLoop --> |No| CompleteDelay\nCompleteDelay((\"completeDelay\")) --> CallbackOnComplete>\"Callback: onComplete\"]\nCallbackOnComplete --> End((End))
    "},{"location":"tween/#tween-data","title":"Tween data","text":"
    • tween.data : An array of TweenData objects, each containing a unique property and target being tweened.
      • tween.data[i].key : The property of the target to tween.
      • tween.data[i].start, tween.data[i].end, tween.data[i].current : Ease Value Data.
    "},{"location":"ui-badgelabel/","title":"Badge label","text":""},{"location":"ui-badgelabel/#introduction","title":"Introduction","text":"

    A container with badges above a main item.

    • Author: Rex
    • Game object
    "},{"location":"ui-badgelabel/#live-demos","title":"Live demos","text":"
    • Badge
    "},{"location":"ui-badgelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-badgelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-badgelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add badge-label object
      var badgeLabel = scene.rexUI.add.badgeLabel(config);\n
    "},{"location":"ui-badgelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add badge-label object
      var badgeLabel = scene.rexUI.add.badgeLabel(config);\n
    "},{"location":"ui-badgelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { BadgeLabel } from 'phaser3-rex-plugins/templates/ui/uiComponents.js';\n
    • Add badge-label object
      var badgeLabel = new BadgeLabel(scene, config);\nscene.add.existing(badgeLabel);\n
    "},{"location":"ui-badgelabel/#add-badgelabel-object","title":"Add badgeLabel object","text":"
    var badgeLabel = scene.rexUI.add.badgeLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\nmain: mainItemGameObject,\n\nleftTop: leftTopBadgeGameObject,\ncenterTop: centerTopBadgeGameObject,\nrightTop: rightTopBadgeGameObject,\nleftCenter: leftCenterBadgeGameObject,\ncenter: centerBadgeGameObject,\nrightCenter: rightCenterBadgeGameObject,\nleftBottom: leftBottomBadgeGameObject,\ncenterBottom: centerBottomBadgeGameObject,\nrightBottom: rightBottomBadgeGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of badgeLabel.
    • main : Game object of main item, optional.
    • leftTop : Badge game object at leftTop side, optional.
    • centerTop : Badge game object at centerTop side, optional.
    • rightTop : Badge game object at rightTop side, optional.
    • leftCenter : Badge game object at leftCenter side, optional.
    • center : Badge game object at center side, optional.
    • rightCenter : Badge game object at rightCenter side, optional.
    • leftBottom : Badge game object at leftBottom side, optional.
    • centerBottom : Badge game object at centerBottom side, optional.
    • rightBottom : Badge game object at rightBottom side, optional.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
        • Positive number : Indent badge game objects inside background.
        • Negative number : Exceed badge game objects out of background.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-badgelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyBadgeLabel extends RexPlugins.UI.BadgeLabel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var badgeLabel = new MyBadgeLabel(scene, config);\n
    "},{"location":"ui-badgelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    badgeLabel.layout();\n

    See also - dirty

    "},{"location":"ui-badgelabel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = badgeLabel.getElement('background');\n
      • Main item game object
        var item = badgeLabel.getElement('main');\n
      • LeftTop badge game object
        var badge = badgeLabel.getElement('leftTop');\n
      • CenterTop badge game object
        var badge = badgeLabel.getElement('centerTop');\n
      • RightTop badge game object
        var badge = badgeLabel.getElement('rightTop');\n
      • LeftCenter badge game object
        var badge = badgeLabel.getElement('leftCenter');\n
      • Center badge game object
        var badge = badgeLabel.getElement('center');\n
      • RightCenter badge game object
        var badge = badgeLabel.getElement('rightCenter');\n
      • LeftBottom badge game object
        var badge = badgeLabel.getElement('leftBottom');\n
      • CenterBottom badge game object
        var badge = badgeLabel.getElement('centerBottom');\n
      • RightBottom badge game object
        var badge = badgeLabel.getElement('rightBottom');\n
    • Get by name
      var gameObject = badgeLabel.getElement('#' + name);\n// var gameObject = badgeLabel.getElement('#' + name, recursive);\n
      or
      var gameObject = badgeLabel.getByName(name);\n// var gameObject = badgeLabel.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-badgelabel/#other-properties","title":"Other properties","text":"

    See overlap sizer object, base sizer object, container-lite.

    "},{"location":"ui-basesizer/","title":"Base sizer","text":""},{"location":"ui-basesizer/#introduction","title":"Introduction","text":"

    Base class of all ui plugins.

    • Author: Rex
    "},{"location":"ui-basesizer/#usage","title":"Usage","text":""},{"location":"ui-basesizer/#background","title":"Background","text":"
    sizer.addBackground(gameObject);\n// sizer.addBackground(gameObject, key);\n// sizer.addBackground(gameObject, paddingConfig, key);\n
    • gameObject : Background game object will be resized after sizer.layout() method.
      • Round rectangle game object
        var gameObject = scene.rexUI.add.roundRectangle(x, y, width, height, radius, fillColor);\n
      • Nine-slice game object
        var gameObject = scene.add.nineslice(x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);\n
        or
        var gameObject = scene.make.nineslice({\nkey: key, frame: frameName,\nleftWidth: 0, rightWidth: 0,\ntopHeight: 0, bottomHeight: 0\n});\n
      • Nine-patch game object
        var gameObject = scene.rexUI.add.ninePatch(x, y, width, height, key, columns, rows, config);\n
      • Custom game object which has resize(width, height) method.
        • Display width, display height will be changed if this background game object does not have resize method.
    • paddingConfig : Add space between bounds. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • key : A string key. Get background game object back via
      var child = sizer.getElement(key);\n

    A sizer can have more than one background. i.e. user can invoke sizer.addBackground(gameObject) many times.

    "},{"location":"ui-basesizer/#remove-background","title":"Remove background","text":"
    • Remove background child
      sizer.removeBackground(gameObject);\n
    • Remove background child and destroy it
      sizer.removeBackground(gameObject, true);\n
    • Remove all background children
      sizer.removeAllBackgrounds();\n
    • Remove all background children and destroy them
      sizer.removeAllBackgrounds(true);\n
    "},{"location":"ui-basesizer/#depth-of-background","title":"Depth of background","text":"

    Send this background child to bottom of sizer.

    sizer.sendChildToBack(gameObject);\n
    "},{"location":"ui-basesizer/#minimum-size","title":"Minimum size","text":"
    • Get
      var minWidth = sizer.minWidth;\nvar minHeight = sizer.minHeight;\n
    • Set
      sizer.setMinSize(width, height);\n
      or
      sizer.setMinWidth(width);\nsizer.setMinHeight(height);\n

    Resize top-most sizer

    sizer.setMinSize(width, height).layout()\n
    "},{"location":"ui-basesizer/#dirty","title":"Dirty","text":"

    Don't layout this sizer if sizer.dirty is false. i.e. Size of this sizer won't be changed, but won't layout children neither.

    Default value is true.

    • Get
      var dirty = sizer.dirty;\n
    • Set
      sizer.setDirty();\n// sizer.setDirty(true);\n
      or
      sizer.dirty = true;\n
    • Clear
      sizer.setDirty(false);\n
      or
      sizer.dirty = false;\n
    "},{"location":"ui-basesizer/#bounds-of-sizer","title":"Bounds of sizer","text":"
    • Get
      var leftBound = sizer.left;\nvar rightBound = sizer.right;\nvar topBound = sizer.top;\nvar bottomBound = sizer.bottom;\nvar centerX = sizer.centerX;\nvar centerY = sizer.centerY;\n
    • Set
      sizer.left = leftBound;\nsizer.right = rightBound;\nsizer.top = topBound;\nsizer.bottom = bottomBound;\nsizer.centerX = centerXBound;\nsizer.centerY = centerYBound;\n
      or
      sizer.alignLeft(leftBound);\nsizer.alignRight(rightBound);\nsizer.alignTop(topBound);\nsizer.alignBottom(bottomBound);\nsizer.alignCenterX(centerXBound);\nsizer.alignCenterY(centerYBound);\n
    "},{"location":"ui-basesizer/#size-of-sizer","title":"Size of sizer","text":"
    • Size
      var width = sizer.width;\nvar height = sizer.height;\n
    • Display size
      var displayWidth = sizer.displayWidth;\nvar displayHeight = sizer.displayHeight;\n
    • Inner size
      var innerWidth = sizer.innerWidth;\nvar innerHeight = sizer.innerHeight;\n
    • Minimum size
      var minWidth = sizer.minWidth;\nvar minHeight = sizer.minHeight;\n
    • Minimum inner size
      var minInnerWidth = sizer.minInnerWidth;\nvar minInnerHeight = sizer.minInnerHeight;\n
    "},{"location":"ui-basesizer/#push-into-bounds","title":"Push into bounds","text":"

    Align sizer to bound if overlapping it.

    sizer.pushIntoBounds();\n

    or

    sizer.pushIntoBounds(bounds);\n
    • bounds : Bounds in rectangle object.
    "},{"location":"ui-basesizer/#scale","title":"Scale","text":"
    • Scale up from 0 to current scale of game object.
      • Pop-up width and height
        sizer\n//.setScale(scaleX, scaleY)\n.popUp(duration);\n\n// sizer.popUp(duration, undefined, ease);\n
        or
        sizer\n//.setScale(scaleX, scaleY)\n.popUpPromise(duration)\n.then(function() {\n// ....\n})\n
        • ease : Ease function, default is 'Cubic'.
      • Pop-up width only
        sizer\n//.setScaleX(scaleX)\n.popUp(duration, 'x');\n\n// sizer.popUp(duration, 'x', ease);\n
        or
        sizer\n//.setScaleX(scaleX)\n.popUpPromise(duration, 'x')\n.then(function() {\n// ....\n})\n
      • Pop-up height only
        sizer\n//.setScaleY(scaleY)\n.popUp(duration, 'y');\n\n// sizer.popUp(duration, 'y', ease);\n
        or
        sizer\n//.setScaleY(scaleY)\n.popUpPromise(duration, 'y')\n.then(function() {\n// ....\n})\n
      • Pop-up via config
        sizer\n//.setScale(scaleX, scaleY)\n.popUp({\nduration: undefined,\norientation: undefined,\nease: undefined,\n})\n
        or
        sizer\n//.setScale(scaleX, scaleY)\n.popUpPromise(config)\n.then(function() {\n// ....\n})\n
        • orientation : undefined, x, or y
    • Scale-down destroy
      • Scale-down width and height
        sizer.scaleDownDestroy(duration);\n// sizer.scaleDownDestroy(duration, undefined, ease);\n
        or
        sizer.scaleDownDestroyPromise(duration)\n.then(function() {\n// ....\n})\n
        • ease : Ease function, default is 'Linear'.
      • Scale-down width only
        sizer.scaleDownDestroy(duration, 'x');\n// sizer.scaleDownDestroy(duration, 'x', ease);\n
        or
        sizer.scaleDownDestroyPromise(duration, 'x');\n.then(function() {\n// ....\n})\n
      • Scale-down height only
        sizer.scaleDownDestroy(duration, 'y');\n// sizer.scaleDownDestroy(duration, 'y', ease);\n
        or
        sizer.scaleDownDestroyPromise(duration, 'y')\n.then(function() {\n// ....\n})\n
    • Scale-down without destroy
      • Scale-down width and height
        sizer.scaleDown(duration);\n// sizer.scaleDown(duration, undefined, ease);\n
        or
        sizer.scaleDownPromise(duration, undefined, ease)\n.then(function() {\n// ....\n})\n
      • Scale-down width only
        sizer.scaleDowny(duration, 'x');\n// sizer.scaleDowny(duration, 'x', ease);\n
        or
        sizer.scaleDownPromise(duration, 'x', ease)\n.then(function() {\n// ....\n})\n
      • Scale-down height only
        sizer.scaleDown(duration, 'y');\n// sizer.scaleDown(duration, 'y', ease);\n
        or
        sizer.scaleDownPromise(duration, 'y', ease)\n.then(function() {\n// ....\n})\n
    • Scale up/down, then scale back (yoyo)
      • Scale up/down, then scale back width and height
        sizer\n//.setScale(scaleX, scaleY)\n.scaleYoyo(duration, peakValue);\n\n// sizer.scaleYoyo(duration, peakValue, repeat, undefined, ease);\n
        or
        sizer\n//.setScale(scaleX, scaleY)\n.scaleYoyoPromise(duration, peakValue, repeat)\n.then(function() {\n// ....\n})\n
        • peakValue : Scale to this peak value, then scale back
        • repeat : Yoyo repeat, default value is 0.
        • ease : Ease function, default is 'Cubic'.
      • Scale up/down, then scale back width only
        sizer\n//.setScaleX(scaleX)\n.scaleYoyo(duration, peakValue, 0, 'x');\n\n// sizer.popUp(duration, peakValue, repeat, 'x', ease);\n
        or
        sizer\n//.setScaleX(scaleX)\n.scaleYoyoPromise(duration, peakValue, repeat, 'x')\n.then(function() {\n// ....\n})\n
      • Scale up/down, then scale back height only
        sizer\n//.setScaleY(scaleY)\n.scaleYoyo(duration, peakValue, 0, 'y');\n\n// sizer.popUp(duration, peakValue, repeat, 'y', ease);\n
        or
        sizer\n//.setScaleY(scaleY)\n.scaleYoyoPromise(duration, peakValue, repeat, 'y')\n.then(function() {\n// ....\n})\n
      • Scale up/down via config
        sizer\n//.setScale(scaleX, scaleY)\n.scaleYoyo({\nduration: undefined,\npeakValue: 1.2,\nrepeat: 0,\norientation: undefined,\nease: undefined,\n})\n
        or
        sizer\n//.setScale(scaleX, scaleY)\n.scaleYoyoPromise(config)\n.then(function() {\n// ....\n})\n
        • orientation : undefined, x, or y
    • Events
      • Pop-up complete
        sizer.on('popup.complete', function(sizer) { });\n
      • Scale-down, scale-down destroy complete
        sizer.on('scaledown.complete', function(sizer) { });\n
      • Scale up/down, then scale back (yoyo)
        sizer.on('scaleyoyo.complete', function(sizer) { });\n
    "},{"location":"ui-basesizer/#fade","title":"Fade","text":"
    • Fade-in
      sizer.fadeIn(duration);\n
      or
      sizer.fadeIn(duration, endAlpha);\n
      or
      sizer.fadeIn(duration, {start:0, end:1});\n
      or
      sizer.fadeInPromise(duration, endAlpha)\n.then(function(){\n// ...\n})\n
      or
      sizer.fadeInPromise(duration, {start:0, end:1})\n.then(function(){\n// ...\n})\n
    • Fade-out destroy
      sizer.fadeOutDestroy(duration);\n
      or
      sizer.fadeOutDestroyPromise(duration)\n.then(function(){\n// ...\n})\n
    • Fade-out without destroy
      sizer.fadeOut(duration);\n
      or
      sizer.fadeOutPromise(duration)\n.then(function(){\n// ...\n})\n
    • Events
      • Fade-in complete
        sizer.on('fadein.complete', function(sizer) { });\n
      • Fade-out, fade-out destroy complete
        sizer.on('fadeout.complete', function(sizer) { });\n
    "},{"location":"ui-basesizer/#ease-move","title":"Ease move","text":"
    • Move from
      sizer.moveFrom(duration, x, y);\n// sizer.moveFrom(duration, x, y, ease);\n// sizer.moveFrom({x, y, duration, ease});\n// sizer.moveFrom({x, y, speed, ease});\n
      or
      sizer\n.moveFromPromise(duration, x, y, ease)\n// .moveFromPromise({x, y, duration, ease})\n// .moveFromPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
      • x, y : Start position.
        • Number : Start position x/y.
        • String(+=300) : Related position of current position x/y.
        • undefined : Current position x/y.
      • speed : Get duration according to speed and distance between current sizer position to {x, y}
      • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • Move-from destroy
      sizer.moveFromDestroy(duration, x, y);\n// sizer.moveFrom(duration, x, y, ease);\n// sizer.moveFrom({x, y, duration, ease});\n// sizer.moveFrom({x, y, speed, ease});\n
      or
      sizer\n.moveFromDestroyPromise(duration, x, y, ease)\n// .moveFromDestroyPromise({x, y, duration, ease})\n// .moveFromDestroyPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
    • Move to
      sizer.moveTo(duration, x, y);\n// sizer.moveTo(duration, x, y, ease);\n// sizer.moveTo({x, y, duration, ease});\n// sizer.moveTo({x, y, speed, ease});\n
      or
      sizer\n.moveToPromise(duration, x, y, ease)\n// .moveToPromise({x, y, duration, ease})\n// .moveToPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
      • x, y : End position.
        • Number : End position x/y.
        • String(+=300) : Related position of current position x/y.
        • undefined : Current position x/y.
      • speed : Get duration according to speed and distance between current sizer position to {x, y}
      • ease : 'Linear', 'Cubic', 'Elastic', 'Bounce', 'Back' ...
    • Move-to destroy
      sizer.moveToDestroy(duration, x, y);\n// sizer.moveTo(duration, x, y, ease);\n// sizer.moveTo({x, y, duration, ease});\n// sizer.moveTo({x, y, speed, ease});\n
      or
      sizer\n.moveToDestroyPromise(duration, x, y, ease)\n// .moveToDestroyPromise({x, y, duration, ease})\n// .moveToDestroyPromise({x, y, speed, ease})\n.then(function(){\n// ...\n})    
    • Move-stop
      sizer.moveStop();\n// sizer.moveStop(true);  // Set to end position\n
    • Events
      • Move-from complete
        sizer.on('movefrom.complete', function(sizer) { });\n
      • Move-to complete
        sizer.on('moveto.complete', function(sizer) { });\n
    "},{"location":"ui-basesizer/#shake","title":"Shake","text":"
    • Start
      sizer.shake(duration);\n// sizer.shake(duration, magnitude);\n
      or
      sizer.shakePromise(duration, magnitude)\n.then(function(){\n// ...\n})\n
    • Events
      • Shake complete
        sizer.on('shake.complete', function(sizer) { });\n
    "},{"location":"ui-basesizer/#ease-data","title":"Ease data","text":"
    • Start
      sizer.easeDataTo(key, value, duration);\n// sizer.easeDataTo(key, value, duration, ease);\n// sizer.easeDataTo({ key, value, duration, ease });\n// sizer.easeDataTo({ key, value, speed, ease });\n
      or
      sizer.easeDataToPromise(key, value, duration, ease)\n.then(function(){\n// ...\n})\n
    • Stop
      sizer.stopEaseData(key);           // Set to end value\n// sizer.stopEaseData(key, false); // Stop at current value\n
      or
      sizer.stopAllEaseData();           // Set to end value\n// sizer.stopAllEaseData(false);   // Stop at current value\n
    • Events
      • Easing complete
        sizer.on('easedata.' + key + '.complete', function(sizer) { });\n
        sizer.on('easedata.complete', function(key, sizer) { });\n
    "},{"location":"ui-basesizer/#delay-call","title":"Delay call","text":"
    sizer.delayCall(delay, callback, scope);\n

    Timer will be removed when destroying game object.

    "},{"location":"ui-basesizer/#modal","title":"Modal","text":"
    1. Assign sizer.onCreateModalBehavior callback, or register events to close modal sizer directly.
      • onCreateModalBehavior :
        sizer.onCreateModalBehavior = function(sizer, config) {\n// ...\nsizer.modalClose(data);\n}\n
        • config : Passed from sizer.modal(config)
      • Close modal sizer
        sizer.modalClose(data);\n
    2. Pop this modal sizer
      sizer.modal(onClose);  // Use default modal config\n
      or
      sizer.modal({\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0,\n// transitOut: 0,\n\n// destroy: true\n}, onClose);\n
      or
      sizer\n.modalPromise(config)\n.then(function(data){\n\n})\n
      • config : See Modal behavior
      • onClose : Callback when closing modal dialog
        function(data) {      }\n
        • data : Object passed from sizer.modalClose(data).
    "},{"location":"ui-basesizer/#set-properties-of-child","title":"Set properties of child","text":"
    sizer.setChildPosition(child, x, y);\nsizer.setChildRotation(child, rotation);\nsizer.setChildScale(child, scaleX, scaleY);\nsizer.setChildDisplaySize(child, width, height);\nsizer.setChildVisible(child, visible);\nsizer.setChildAlpha(child, alpha);\n
    "},{"location":"ui-basesizer/#depth","title":"Depth","text":"
    • Get depth of sizer
      var depth = sizer.depth;\n
    • Set depth of sizer
      sizer.setDepth(value, true);\n// sizer.depth = depth;\n
    • Set depth of sizer and all children
      sizer.setDepth(value);\n
    • Bring this sizer and its children to top
      sizer.bringToTop();\n
    • Swap depth with another sizer
      sizerA.swapDepth(sizerB);\n
    • Increase of sizer and all children
      sizer.incDepth(value);\n
    • Move game object below this sizer and all children
      sizer.moveDepthBelow(gameObject);\n
    • Move game object above this sizer and all children
      sizer.moveDepthAbove(gameObject);\n
    • Bring a child of this sizer to top
      sizer.bringChildToTop(gameObject);\n
    • Send a child of this sizer to bottom
      sizer.sendChildToBack(gameObject);\n
    "},{"location":"ui-basesizer/#scroll-factor","title":"Scroll factor","text":"
    • Set scroll factor to children
      sizer.setScrollFactor(x, y);\n
    "},{"location":"ui-basesizer/#change-origin","title":"Change origin","text":"
    sizer.changeOrigin(originX, originY);\n

    This method also will reset all local state of children.

    "},{"location":"ui-basesizer/#destroy","title":"Destroy","text":"
    sizer.destroy();\n
    "},{"location":"ui-basesizer/#drag-sizer","title":"Drag sizer","text":"
    • Drag top-most sizer by child
      • Enable
        sizer.setDraggable(child);\n// sizer.setDraggable(child, true);\n
        or
        sizer.setDraggable(elementName);\n// sizer.setDraggable(elementName, true);\n
      • Disable
        sizer.setDraggable(child, false);\n
        or
        sizer.setDraggable(elementName, false);\n
    • Drag top-most sizer by this sizer
      • Enable
        sizer.setDraggable();\n// sizer.setDraggable(true);\n
      • Disalbe
        sizer.setDraggable(false);\n
    • Drag target sizer by child
      • Enable
        sizer.setDraggable(child, targetSizer);\n// sizer.setDraggable(child, true, targetSizer);\n
        or
        sizer.setDraggable(elementName);\n// sizer.setDraggable(elementName, true, targetSizer);\n
      • Disable
        sizer.setDraggable(child, false);\n
        or
        sizer.setDraggable(elementName, false);\n
    • Drag target config
      sizer.setDraggable({\nsensor: child, // or elementName\ntarget: undefined, // or a parentSizer\ndraggable: true\n})\n
      • sensor : A game object or a string
      • target
        • undefined : Top-most sizer
        • A game object : A parent sizer
    "},{"location":"ui-basesizer/#events","title":"Events","text":"
    • Fire 'sizer.drag' on target sizer when dragging
      targetSizer.on('sizer.drag', function(pointer, dragX, dragY) {\n\n})\n
    • Fire 'sizer.dragstart' on target sizer when dragging
      targetSizer.on('sizer.dragstart', function(pointer, dragX, dragY) {\n\n})\n
    • Fire 'sizer.dragend' on target sizer when dragging
      targetSizer.on('sizer.dragend', function(pointer, dragX, dragY, dropped) {\n\n})\n
    • Fire 'sizer.drop' on target sizer when dropped
      targetSizer.on('sizer.drop', function(pointer, dropZone) {\n\n})\n
    "},{"location":"ui-basesizer/#click","title":"Click","text":"
    • Add click event
      sizer.onClick(callback, scope);\n// sizer.onClick(callback, scope, config);\n
      • config : See Button
      • callback :
        function(button, gameObject, pointer, event) {\n\n}\n
        • button : Button behavior.
    • Turn off click event
      sizer.offClick(callback, scope);\n
    • Enable click event
      sizer.enableClick();\n
    • Disable click event
      sizer.disableClick();\n

    Equal to

    var click = scene.rexUI.add.click(sizer, config);\nclick.on('click', callback, scope);\n
    "},{"location":"ui-basesizer/#click-child","title":"Click child","text":"
    • Add click event
      sizer.onClick(child, callback, scope);\n// sizer.onClick(child, callback, scope, config);\n
    • Turn off click event
      sizer.offClick(child, callback, scope);\n
    • Enable click event
      sizer.enableClick(child);\n
    • Disable click event
      sizer.disableClick(child);\n
    "},{"location":"ui-basesizer/#click-outside","title":"Click outside","text":"
    • Add click-outside event
      sizer.onClickOutside(callback, scope);\n// sizer.onClickOutside(callback, scope, config);\n
      • config : See ClickOutside
      • callback :
        function(clickOutside, gameObject, pointer) {\n\n}\n
        • clickOutside : ClickOutside behavior.
    • Turn off click-outside event
      sizer.offClickOutside(callback, scope);\n
    • Enable click-outside event
      sizer.enableClickOutside();\n
    • Disable click-outside event
      sizer.disableClickOutside();\n

    Equal to

    var clickOutside = scene.rexUI.add.clickOutside(sizer, config);\nclickOutside.on('clickoutside', callback, scope);\n
    "},{"location":"ui-basesizer/#click-outside-of-child","title":"Click outside of child","text":"
    • Add click-outside event
      sizer.onClickOutside(child, callback, scope);\n// sizer.onClickOutside(child, callback, scope, config);\n
      • config : See ClickOutside
      • callback :
        function(clickOutside, gameObject, pointer) {\n\n}\n
        • clickOutside : ClickOutside behavior.
    • Turn off click-outside event
      sizer.offClickOutside(child, callback, scope);\n
    • Enable click-outside event
      sizer.enableClickOutside(child);\n
    • Disable click-outside event
      sizer.disableClickOutside(child);\n
    "},{"location":"ui-basesizer/#is-pointer-in-bounds","title":"Is pointer in bounds","text":"
    • Is current sizer clicking
      var isClicked = sizer.isPointerInBounds();\n
    • Is a child clicking
      var isClicked = sizer.isPointerInBounds(child);\n
      or
      var isClicked = sizer.isPointerInBounds(elementName);\n
      • child : Game object of child
      • elementName : Element name for retrieveing child game object.
    "},{"location":"ui-basesizer/#in-touching","title":"In touching","text":"

    Invoke callbeack if pointer is inside hitarea every tick.

    • Add in-touching event
      sizer.onTouching(callback, scope);\n// sizer.onTouching(callback, scope, config);\n
    • Turn off in-touching event
      sizer.offTouching(callback, scope);\n
    • Add touching-end event
      sizer.onTouchingEnd(callback, scope);\n// sizer.onTouchingEnd(callback, scope, config);\n
    • Turn off touching-end event
      sizer.offTouchingEnd(callback, scope);\n
    • Enable in-touching event
      sizer.enableTouching();\n
    • Disable in-touching event
      sizer.disableTouching();\n

    Equal to

    var inTouching = scene.rexUI.add.inTouching(sizer, config);\ninTouching.on('intouch', callback, scope);\n
    "},{"location":"ui-basesizer/#in-touching-child","title":"In touching child","text":"
    • Add in-touching event
      sizer.onTouching(child, callback, scope);\n// sizer.onClick(child, callback, scope, config);\n
    • Turn off in-touching event
      sizer.offTouching(child, callback, scope);\n
    • Enable in-touching event
      sizer.enableTouching(child);\n
    • Disable in-touching event
      sizer.disableTouching(child);\n
    "},{"location":"ui-basesizer/#set-children-interactive","title":"Set children interactive","text":"

    Applies click, tap, press, swipe behaviors on this sizer, to detect input events of children.

    sizer.setChildrenInteractive({\n// dropZone: false,\n\n// down: undefined,\n// up: undefined,\n// over: undefined,\n\n// click: {mode: 'release', clickInterval: 100},\n\n// press: {time: 251, threshold: 9},\n\n// tap: {time: 250, tapInterval: 200, threshold: 9, tapOffset: 10, \n//       taps: undefined, minTaps: undefined, maxTaps: undefined,},\n\n// swipe: {threshold: 10, velocityThreshold: 1000, dir: '8dir'},\n\n// inputEventPrefix: 'child.',\n})\n
    • dropZone :
      • true : Enable drop Zone on this sizer.
      • false : Do nothing.
    • down :
      • false : Don't fire (pointer-) down events
    • up :
      • false : Don't fire (pointer-) up events
    • over :
      • false : Don't fire (pointer-) over/out events
    • click : Configuration of Button behavior.
      • false : Don't install Button behavior.
    • press : Configuration of Press behavior.
      • false : Don't install Press behavior.
    • tap : Configuration of Tap behavior.
      • false : Don't install Tap behavior.
    • swipe : Configuration of Swipe behavior.
      • false : Don't install Swipe behavior.
    • inputEventPrefix : Prefix string of each event, default is 'child.'.

    Note

    Input behaviors are installed to this Sizer game object, not each child. And it assumes that all children are not overlapped. Use Button if user needs to enable/disable input behaviors of each child individually.

    "},{"location":"ui-basesizer/#events_1","title":"Events","text":"
    • Pointer-down
      sizer.on('child.down', function(child, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-up
      sizer.on('child.up', function(child, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-over
      sizer.on('child.over', function(child, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-out
      sizer.on('child.out', function(child, pointer, event) {\n// ...\n}, scope);\n
    • Click
      sizer.on('child.click', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Triggered child game object.
      • pointer : Pointer object.
    • Press
      sizer.on('child.pressstart', function(child, pointer) { // ...\n}, scope);\n
      sizer.on('child.pressend', function(child, pointer) { // ...\n}, scope);\n
    • Tap
      sizer.on(tapEventName, function(child, pointer, tap) { // ...\n}, scope);\n
      • tapEventName : 'child.tap', 'child.1tap', 'child.2tap', 'child.3tap', etc ...
      • tap : Tap object.
        • tap.tapsCount : Taps count.
    • Swipe
      sizer.on(swipeEventName, function(child, pointer, swipe) { // ...\n}, scope);\n
      • swipeEventName : 'child.swipe', 'child.swipeleft', 'child.swiperight', 'child.swipeup', 'child.swipedown'.
      • swipe : Swipe object.
        • swipe.left, swipe.right, swipe.up, swipe.down : Swipe direction states.
    "},{"location":"ui-basesizer/#bind-event","title":"Bind event","text":"
    • Bind event
      sizer.bindEvent(eventEmitter, eventName, callback, scope);\n
    • Bind scene's 'preupdate' event
      sizer.bindScenePreupdateEvent(callback, scope);\n
    • Bind scene's 'update' event
      sizer.bindSceneUpdateEvent(callback, scope);\n
    • Bind scene's 'postupdate' event
      sizer.bindScenePostupdateEvent(callback, scope);\n
    • Bind scene's 'render' event
      sizer.bindSceneRenderEvent(callback, scope);\n
    • Bind scene's 'pause' event
      sizer.bindScenePauseEvent(callback, scope);\n
    • Bind scene's 'resume' event
      sizer.bindSceneResumeEvent(callback, scope);\n
    • Bind scene's 'sleep' event
      sizer.bindSceneSleepEvent(callback, scope);\n
    • Bind scene's 'wake' event
      sizer.bindSceneWakeEvent(callback, scope);\n
    • Bind scene's 'shutdown' event
      sizer.bindSceneShutdownEvent(callback, scope);\n

    Will remove this event from eventEmitter when destroying sizer.

    "},{"location":"ui-basesizer/#pin-game-object","title":"Pin game object","text":"
    sizer.pin(gameObject);\n

    or

    sizer.pinLocal(gameObject);\n

    Note

    Method sizer.add is override in each sizer class usually.

    "},{"location":"ui-basesizer/#un-pin-game-object","title":"Un-pin game object","text":"
    sizer.unpin(child);\n// sizer.unpin(child, destroyChild);\n
    • destroyChild : Set true to destroy child. Default is false.

    Note

    Method sizer.remove is override in each sizer class usually.

    "},{"location":"ui-basesizer/#draw-bounds","title":"Draw bounds","text":"
    • Draw bounds of shown game object on a graphics game object
      sizer.drawBounds(graphics);\n// sizer.drawBounds(graphics, color);\n
      • graphics : Graphics game object
      • color : Default value is 0xffffff
    • Draw bounds of shown game object, and display name of child
      sizer.drawBounds(graphics, {\n// color: 0xffffff,\n// lineWidth: 2,\n\n// name: false, \n// name: true, \n// name: {\n//     createTextCallback: function(scene) {\n//         return scene.add.text(0, 0, '');\n//     },\n//     createTextCallbackScope: undefined,\n//     align: 'left-top'\n// }\n});\n
      • graphics : Graphics game object
      • color : Default value is 0xffffff.
      • lineWidth : Default value is 1.
      • name :
        • false : Don't display child name, default value
        • true : Display child name with default text game object, aligned at left-top of child bounds.
        • Plain object :
          • name.createTextCallback : Callback of creating customized text game object for child name
            function(scene, child, childBoundsRect) {\n// return scene.add.text(0, 0, ''); \n}\n
          • name.createTextCallbackScope : Callback scope of name.createTextCallback, default is undefined
          • name.align :
            • 'left-top', or Phaser.Display.Align.TOP_LEFT : Align text game object at left-top. Default value
            • 'center', or Phaser.Display.Align.CENTER : Align text game object at center
            • 'left', or Phaser.Display.Align.LEFT_CENTER : Align text game object at left-center
            • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align text game object at right-center
            • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game text object at top-center
            • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game text object at bottom-center
            • 'left-bottom', or Phaser.Display.Align.BOTTOM_LEFT : Align text game object at left-bottom
            • 'right-top', or Phaser.Display.Align.TOP_RIGHT : Align text game object at right-top
            • 'right-bottom', or Phaser.Display.Align.BOTTOM_RIGHT : Align text game object at right-bottom
      • Text game objects of these children's name will be attached on graphics game object, graphics.clear(), or graphics.destroy() will also destroy these text game objects
    "},{"location":"ui-basesizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-basesizer/#padding","title":"Padding","text":"
    • Set inner padding, will indent children position.
      • Set inner padding via config
        sizer.setInnerPadding({\nleft: leftPadding, right: rightPadding,\ntop: topPadding,\nbottom: bottomPadding\n});\n
      • Set inner padding via single number
        sizer.setInnerPadding(value);\n
      • Set specific inner padding
        sizer.setInnerPadding(key, value);\n
        • key : 'left', 'right', 'top', 'bottom'
    • Get inner padding
      • Get inner padding values
        var innerPadding = sizer.getInnerPadding();\n
      • Get specific inner padding
        var value = sizer.getInnerPadding(key);\n
        • key : 'left', 'right', 'top', 'bottom'
    • Set outer padding, which is equal to padding parameter when adding this sizer to parent sizer.
      • Set outer padding via config
        sizer.setOuterPadding({\nleft: leftPadding, right: rightPadding,\ntop: topPadding,\nbottom: bottomPadding\n});\n
      • Set outer padding via single number
        sizer.setOuterPadding(value);\n
      • Set specific outer padding
        sizer.setOuterPadding(key, value);\n
        • key : 'left', 'right', 'top', 'bottom'
    • Get outer padding
      • Get outer padding values
        var outerPadding = sizer.getOuterPadding();\n
      • Get specific outer padding
        var value = sizer.getOuterPadding(key);\n
        • key : 'left', 'right', 'top', 'bottom'
    • Set outer padding of child, which is equal to padding parameter when adding this sizer to parent sizer.
      • Set outer padding via config
        sizer.setChildOuterPadding(\nchild,\n{\nleft: leftPadding, right: rightPadding,\ntop: topPadding,\nbottom: bottomPadding\n}\n);\n
        • child : A string key or game object.
      • Set outer padding via single number
        sizer.setChildOuterPadding(child, value);\n
        • child : A string key or game object.
      • Set specific outer padding
        sizer.setChildOuterPadding(child, key, value);\n
        • child : A string key or game object.
        • key : 'left', 'right', 'top', 'bottom'
    • Get outer padding of child
      • Get outer padding values
        var outerPadding = sizer.getChildOuterPadding(child);\n
        • child : A string key or game object.
      • Get specific outer padding
        var value = sizer.getChildOuterPadding(child, key);\n
        • child : A string key or game object.
        • key : 'left', 'right', 'top', 'bottom'
    "},{"location":"ui-basesizer/#anchor","title":"Anchor","text":"
    sizer.setAnchor({\n// left: '0%+0',\n// right: '0%+0',\n// centerX: '0%+0',\n// x: '0%+0',\n\n// top: '0%+0',\n// bottom: '0%+0',\n// centerY: '0%+0',\n// y: '0%+0'\n})\n
    • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
      • Percentage of visible width/height : 'p%', p: 0~100
        • 'left'(=0%), 'center'(=50%), 'right'(=100%)
        • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
      • Offset : '+n', or '-n'

    For example, anchor game object's left bound to viewport's left+10, and centerY to viewport's center :

    {\nleft: 'left+10',\ncenterY: 'center'\n}\n
    "},{"location":"ui-basesizer/#get-child","title":"Get child","text":"
    • Get child by specific key
      1. Add child
        sizer.addChildrenMap(key, child);\n
        • Remove children map :
          sizer.removeChildrenMap(key);\n
          or
          sizer.removeChildrenMap(child);\n
      2. Get child
        var child = sizer.getElement(key);\n
    • Get child by name
      var child = sizer.getByName(name);\n// var child = sizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-basesizer/#get-parent","title":"Get parent","text":"
    • Get parent sizer
      var parentSizer = sizer.getParentSizer();\n
    • Get ancestor sizer matched given name
      var parentSizer = sizer.getParentSizer(name);\n
    • Get topmost sizer
      var topmostSizer = sizer.getTopmostSizer();\n
    "},{"location":"ui-basesizer/#has-parentchild","title":"Has parent/child","text":"
    • Has parent
      var hasParent = sizer.hasParentSizer(parentGameObject);\n
    • Has child
      var hasChild = sizer.hasParentSizer(childGameObject);\n
    "},{"location":"ui-basesizer/#is-in-touching","title":"Is in touching","text":"
    • Is this sizer in touching?
      var isTouching = sizer.isInTouching();\n
    • Is child of this sizer in touching?
      var isTouching = sizer.isInTouching(child);\n
      or
      var isTouching = sizer.isInTouching(childKey);\n
      • child : Child game object.
      • childKey : Get child game object back via sizer.getElement(childKey). See also sizer.addChildrenMap(key, child)
    "},{"location":"ui-basesizer/#change-properties-of-child","title":"Change properties of child","text":"
    • Set property of child from sizer
    • Set property of child, then reset local state of child
    • Tween local state of child
    "},{"location":"ui-basesizer/#add-to-container","title":"Add to container","text":"
    • Add to built-in container
      p3Container.add(sizer);\n
      or
      sizer.addToContainer(p3Container);\n
      • container : Container game object.
    • Add to Layer
      sizer.addToLayer(layer);\n
      • layer : Layer game object.

    Note

    container.add(sizer), or layer.add(sizer) won't add children of sizer.

    "},{"location":"ui-basesizer/#layer","title":"Layer","text":"

    A sizer can have a layer. Current children and new children will draw on this layer, instead of display list of scene.

    • Enable layer. Do nothing if layer is existed.
      sizer.enableLayer();\n
    • Get layer game object. Will enable layer if layer is not existed.
      var layer = sizer.getLayer();\n
    "},{"location":"ui-basesizer/#shader-effects","title":"Shader effects","text":"

    Apply post-fx pipeline on layer of sizer.

    "},{"location":"ui-basesizer/#snapshot","title":"Snapshot","text":"
    • Draw all visible children on a render-texture.
      var renderTexture = container.snapshot({\nrenderTexture: undefined,\npadding: 0\n});\n
      • renderTexture : Draw on this render-texture
        • undefined : Create a new render-texture
      • padding :
        • 0 : No extra padding space. Default value.
        • A number : Add extra padding space around this render-texture.
    • Draw all visible children on a texture
      container.snapshot({\npadding: 0,\nsaveTexture: textureKey\n});\n
      • saveTexture : Save render result to texture manager.
    "},{"location":"ui-basesizer/#layout-children","title":"Layout children","text":"

    Note

    Enable sizer events by set sizerEvents to true in config.

    • Fire 'sizer.postlayout' event to all children after layout.
      child.on('sizer.postlayout', function(child, sizer){\nvar prevState = sizer.getChildPrevState(child);\n})\n
      • prevState : Properties before layout.
        • prevState.x, prevState.y : Child position before layout.
        • prevState.width, prevState.height, prevState.displayWidth, prevState.displayHeight, prevState.scaleX, prevState.scaleY : Child size before layout.
    • Fire 'postlayout' event.
      sizer.on('postlayout', function(children, sizer) {\nfor(var i=0, cnt=children.length; i<cnt; i++) {\nvar prevState = sizer.getChildPrevState(children[i]);\n// ...\n}\n})\n
    "},{"location":"ui-basesizer/#remove-child","title":"Remove child","text":"

    Note

    Enable sizer events by set sizerEvents to true in config.

    • Fire 'sizer.remove' event to removed without destroyed child.
      child.on('sizer.remove', function(child, sizer){\n\n})\n
    • Fire 'remove' event.
      sizer.on('remove', function(child, sizer){\n\n})\n
    "},{"location":"ui-basesizer/#add-child","title":"Add child","text":"

    Note

    Enable sizer events by set sizerEvents to true in config.

    • Fire 'sizer.add' event to added child.
      child.on('sizer.add', function(child, sizer){\n\n})\n
    • Fire 'add' event.
      sizer.on('add', function(child, sizer){\n\n})\n
    "},{"location":"ui-basesizer/#broadcast-event","title":"Broadcast event","text":"

    Fire event to sizer itself and all children

    sizer.broadcastEvent(eventName, parameter0, parameter1, ...);\n

    Receive event

    child.on(eventName, function(parameter0, parameter1, ...) {\n\n}, scope);\n
    "},{"location":"ui-basesizer/#other-properties","title":"Other properties","text":"

    This game object inherits from ContainerLite.

    "},{"location":"ui-buttons/","title":"Buttons","text":""},{"location":"ui-buttons/#introduction","title":"Introduction","text":"

    A container with a group of buttons.

    • Author: Rex
    • Game object
    "},{"location":"ui-buttons/#live-demos","title":"Live demos","text":"
    • Buttons with header and footer
    • Expand
    • Space
    • Checkboxes/radio
    • CustomProgress background
    • Popup each button
    "},{"location":"ui-buttons/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-buttons/#install-plugin","title":"Install plugin","text":""},{"location":"ui-buttons/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add buttons object
      var buttons = scene.rexUI.add.buttons(config);\n
    "},{"location":"ui-buttons/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add buttons object
      var buttons = scene.rexUI.add.buttons(config);\n
    "},{"location":"ui-buttons/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Buttons } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add buttons object
      var buttons = new Buttons(scene, config);\nscene.add.existing(buttons);\n
    "},{"location":"ui-buttons/#add-buttons-object","title":"Add Buttons object","text":"
    var buttons = scene.rexUI.add.buttons({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n// buttonsType: undefined,\n\n// Elements\n// background: backgroundGameObject,\n\nbuttons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\nexpand: false,\nalign: undefined,\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\n// space: 0,   // deprecated \n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n// eventEmitter: this,\n// groupName: undefined,\n\n// setValueCallback: undefined,  // or setButtonStateCallback: undefined\n// setValueCallbackScope: undefined  // or setButtonStateCallbackScope: undefined\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Main orientation of button game objects.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange button game objects from left ot right.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange button game objects from top to bottom.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • buttonsType : Type/behavior of these buttons.
      • undefined : No extra behavior, default value.
      • 'checkboxes' : Set these buttons to checkboxes.
      • 'radio' : Set these buttons to radio.
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • buttons : Array of button game objects, or Space (scene.rexUI.add.space()).
    • expand : Set true to expand width, or height of buton game objects.
    • align : Note: Add Space (scene.rexUI.add.space()) into buttons parameter to have more flexible alignment style. Alignment of these button game objects. Only valid when expand is false.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • space :
      • An object: Padding of button game objects.
        • space.top, space.bottom, space.left, space.right : Padding around bottons.
        • space.item : Space between 2 button game objects.
      • A number: Deprecated, space between 2 button game objects.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • eventEmitter : Dispatch buttons' touch events to other game object, default is this buttons game object.
    • groupName : Optional group name for argument of touch events.
    • setValueCallback, or setButtonStateCallback : Callback to set value of a button.
      • undefined : No callback, default value.
      • A function object.
        function(button, value, previousValue) {\n// ...\n}\n
        • button : Button game object.
        • value: true, or false.
        • previousValue : true, or false.
    "},{"location":"ui-buttons/#custom-class","title":"Custom class","text":"
    • Define class
      class MyButtons extends RexPlugins.UI.Buttons {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var buttons = new MyButtons(scene, config);\n
    "},{"location":"ui-buttons/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    buttons.layout();\n

    See also - dirty

    "},{"location":"ui-buttons/#other-properties","title":"Other properties","text":"

    See sizer object

    "},{"location":"ui-buttons/#events","title":"Events","text":"
    • Click button
      buttons.on('button.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.click', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      • groupName : Optional group name.
      • button : Triggered button game object.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over button
      buttons.on('button.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.over', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-out button
      buttons.on('button.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.out', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-down button
      buttons.on('button.down', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.down', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-up button
      buttons.on('button.up', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.up', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Enable button's input
      buttons.on('button.enable', function(button, index) {\n// ...\n}, scope);\n
      or
      buttons.on('button.enable', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Disable button's input
      buttons.on('button.disable', function(button, index) {\n// ...\n}, scope);\n
      or
      buttons.on('button.disable', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    "},{"location":"ui-buttons/#emit-button-click-event","title":"Emit button click event","text":"
    buttons.emitButtonClick(index);\n
    • index : Index of triggered button game object, or a button game object.
    "},{"location":"ui-buttons/#enabledisable-input-of-button","title":"Enable/disable input of button","text":"
    • Enable a button's input
      buttons.setButtonEnable(index);\n// buttons.setButtonEnable(index, true);\n
      • index : Index of triggered button game object, or a button game object.
    • Enable all buttons' input
      buttons.setButtonEnable();\n// buttons.setButtonEnable(true);\n
    • Disable
      buttons.setButtonEnable(index, true);\n
      • index : Index of triggered button game object, or a button game object.
    • Disable all buttons' input
      buttons.setButtonEnable(false);\n
    • Toggle
      buttons.toggleButtonEnable(index);\n
    • Toggle all buttons's input
      buttons.toggleButtonEnable();\n
    • Get button's input enable
      var enabled = bottons.getButtonEnable(index);\n
    "},{"location":"ui-buttons/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = buttons.getElement('background');\n
      • Button game objects
        var buttonObjects = buttons.getElement('buttons');\n
        or
        var buttonObject = buttons.getButton(index);\n
        or
        var buttonObjects = buttons.getElement('buttons[0]'); // First button\n
    • Get by name
      var gameObject = buttons.getElement('#' + name);\n// var gameObject = buttons.getElement('#' + name, recursive);\n
      or
      var gameObject = buttons.getByName(name);\n// var gameObject = buttons.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-buttons/#add-child","title":"Add child","text":"
    • Add button child
      buttons.addButton(gameObject)\n
      • gameObject : A game object, or an array of game objects.
    • Add non-button child, see sizer.add() method.
      buttons.add(gameObject,\n{\nproportion: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,\nkey: undefined,\nindex: undefined,\nminWidth: undefined,\nminHeight: undefined\n}\n)\n
    "},{"location":"ui-buttons/#remove-child","title":"Remove child","text":"
    • Remove button child
      buttons.removeButton(gameObject, destroyChild);\n
      • gameObject :
        • Game object, or array of game objects : Button game object.
        • A number, or array of numbers : Index of button game object.
        • A string, or array of strings : Name of button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove all buttton children
      buttons.clearButtons(destroyChild);\n
      • destroyChild : Set true to destroy button game objects.
    • Remove a button or non-button child, see sizer.remove() method.
      buttons.remove(gameObject, destroyChild);\n
    • Remove all button or non-button children, see sizer.remove() method.
      buttons.removeAll(destroyChild);\n
    "},{"location":"ui-buttons/#showhide-button","title":"Show/hide button","text":"

    Hidden elements won't be counted when layouting. Call buttons.layout(), or topSizer.layout() after show/hide any button.

    • Show button
      buttons.showButton(index);\n
      • index : A number index, or a button game object.
    • Hide button.
      buttons.hideButton(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-buttons/#for-each-button","title":"For each button","text":"
    buttons.forEachButtton(callback, scope);\n
    • callback :
      function(button, index, buttonArray) {\n// ...\n}\n
    "},{"location":"ui-buttons/#checkboxesradio","title":"Checkboxes/radio","text":"
    • Configure buttons to checkboxes/radio
      var buttons = scene.rexUI.add.buttons({\nbuttons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\nbuttonsType: 'checkboxes', // or 'radio'\nsetValueCallback: function(button, value, previousValue) {\n// ...\n}, // or setButtonStateCallback\n});\n
      • buttons : Array of button game objects.
        • Property name of each button game object will be used as a key in buttons.data
      • buttonsType : Set type to 'checkboxes', or 'radio'.
      • setValueCallback or setButtonStateCallback : Callback to set value of a button.
        function(button, value) {\n// ...\n}\n
        • button : Button game object.
        • value: true, or false.
        • previousValue : true, or false.
        • Also trigger 'button.statechange' event.
      • State of a button : Stored in buttons.data
      • Get states of all buttons :
        var states = buttons.getAllButtonsState();  // { key: boolean }\n
      • Clear states of all button :
        buttons.clearAllButtonsState();\n
        • Will trigger setValueCallback and 'button.statechange' event.
    "},{"location":"ui-buttons/#checkboxes","title":"Checkboxes","text":"
    • Read state
      var state = buttons.getButtonState(key);\n
      • key : name property of a button game object. (i.e. button.name)
      • state : true, or false
    • Set state
      buttons.setButtonState(key, state);\n
      • key : name property of a button game object. (i.e. button.name)
      • state : true, or false
    "},{"location":"ui-buttons/#radio","title":"Radio","text":"
    • Read state
      var value = buttons.getSelectedButtonName();\n
      or
      var value = buttons.value;\n
      • value : name property of a button game object. (i.e. button.name)
    • Set state
      buttons.setSelectedButtonName(key);\n
      or
      buttons.value = key;\n
      • key : name property of a button game object. (i.e. button.name)
    "},{"location":"ui-buttons/#events_1","title":"Events","text":"
    • On button state changed. For Checkboxes/radio
      buttons.on('button.statechange', function(button, index, value, previousValue) {\n// ...\n}, scope);\n
      or
      buttons.on('button.statechange', function(button, groupName, index, value, previousValue) {\n// ...\n}, scope);\n
      • Can be used to replace setValueCallback.
    "},{"location":"ui-chart/","title":"Chart","text":""},{"location":"ui-chart/#introduction","title":"Introduction","text":"

    Draw chart on canvas.

    • Author: Rex
    • Game object
    "},{"location":"ui-chart/#live-demos","title":"Live demos","text":"
    • Radar chart
    "},{"location":"ui-chart/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-chart/#install-plugin","title":"Install plugin","text":""},{"location":"ui-chart/#install-chartjs","title":"Install chart.js","text":"

    Chart.js is not included in rexUI, installs it before creating any chart.

    scene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/chart.min.js');\n
    or
    scene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js');\n

    "},{"location":"ui-chart/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');\nscene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add chart object
      var chart = scene.rexUI.add.chart(config);\n
    "},{"location":"ui-chart/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add chart object
      var chart = scene.rexUI.add.chart(config);\n
    "},{"location":"ui-chart/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Chart } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add chart object
      var chart = new Chart(scene, config);\nscene.add.existing(chart);\n
    "},{"location":"ui-chart/#add-chart-object","title":"Add chart object","text":"
    var chart = scene.rexUI.add.chart(x, y, width, height, config);\n
    • x, y : Position of this object.
    • width, height : Canvas size.
    • config : Configuration for creating chart.
      • Set undefined to not create chart at beginning.
    "},{"location":"ui-chart/#custom-class","title":"Custom class","text":"
    • Define class
      class MyChart extends RexPlugins.UI.Chart {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var chart = new MyChart(scene, x, y, width, height, config);\n
    "},{"location":"ui-chart/#create-chart","title":"Create chart","text":"

    Create chart (if not creating at beginning).

    chart.setChart(config);\n
    • config : Configuration for creating chart.
    "},{"location":"ui-chart/#chart-data","title":"Chart data","text":"
    • Get dataset
      var dataset = chart.getChartDataset(datasetIndex);\n
      • datasetIndex : Index number or label string.
    • Get data
      var data = chart.getChartData(datasetIndex, dataIndex);\n
      • datasetIndex : Index number or label string.
      • dataIndex : Index number or label string.
    • Set
      chart.setChartData(datasetIndex, dataIndex, value).updateChart();\n
      • datasetIndex : Index number or label string.
      • dataIndex : Index number or label string.
    "},{"location":"ui-chart/#manipulate-chart-object","title":"Manipulate chart object","text":"
    1. Get chart object
      var chart = chart.chart;\n
    2. Set properties of chart
      • Array of dataset
        var datasets = chart.data.datasets;\n
        • Label of dataset
          var label = chart.data.datasets[i].label;\n
      • Labels
        var labels = chart.data.labels;\n
      • Set chart data
        chart.data.datasets[datasetIndex].data[dataIndex] = value;\n
    3. Update chart
      chart.update();\n
    "},{"location":"ui-colorcomponents/","title":"Color components","text":""},{"location":"ui-colorcomponents/#introduction","title":"Introduction","text":"

    Edit color value by RGB, or HSV input fields. Clicking fist label can switch color format between RGB and HSV

    • Author: Rex
    • Game object
    "},{"location":"ui-colorcomponents/#live-demos","title":"Live demos","text":"
    • Color components
    "},{"location":"ui-colorcomponents/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-colorcomponents/#install-plugin","title":"Install plugin","text":""},{"location":"ui-colorcomponents/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add color-components object
      var colorComponents = scene.rexUI.add.colorComponents(config);\n
    "},{"location":"ui-colorcomponents/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add color-components object
      var colorComponents = scene.rexUI.add.colorComponents(config);\n
    "},{"location":"ui-colorcomponents/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ColorComponents } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add color-components object
      var colorComponents = new ColorComponents(scene, config);\nscene.add.existing(colorComponents);\n
    "},{"location":"ui-colorcomponents/#add-colorcomponents-object","title":"Add colorComponents object","text":"
    var colorComponents = scene.rexUI.add.colorComponents({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nformatLabel: {\nbackground: {\nradius: 0,\ncolor: undefined, alpha: undefined,\nstrokeColor: undefined, strokeAlpha: undefined, strokeWidth: 2\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nalign: 'left',  // 'left'|'center'|'right'|'justify'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n},\n\nspace: {left: 0, right: 0, top: 0, bottom: 0}\n},\n\n// formatLabel: labelGameObject,\n\ninputText: {\nwidth: undefined, height: undefined,\n\npadding: 0,  // {left: 0, right: 0, top: 0, bottom: 0}\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n\n// Style when focus\n// 'focus.color': ...\n// 'focus.color2': ...\n// 'focus.stroke': ...\n},\nfocusStyle: undefined,\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0,\n\n// Style when cursor move on\n// 'cursor.color': ...\n// 'cursor.backgroundColor': ...\n// 'cursor.xxx': ...\n},\ncursorStyle: undefined,\n\nwrap: {\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n},\nlineHeight: undefined,\nmaxLines: undefined,\nwrapWidth: undefined,\nletterSpacing: 0,\nhAlign: 0,\nvAlign: 'center',  // For single line text input\ncharWrap: true,    // For single line text input\n},\n\n// enterClose: true,\n// readOnly: false,\n\n// Callbacks\n// onOpen: function (textObject, hiddenInputText) {\n// },\n\n// onClose: function (textObject, hiddenInputText) {\n// },\n\n// onUpdate: function (text, textObject, hiddenInputText) {\n//     return text;\n// },   \n\n// onAddChar: function(child, index, canvasInput) {\n//    child.modifyStyle({...})\n// },\n\n// onCursorOut: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// onCursorIn: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n},\n\n// inputText0: canvasInputGameObject,\n// inputText1: canvasInputGameObject,\n// inputText2: canvasInputGameObject,\n\n// proportion: { formatLabel: 0 },\n\nvaluechangeCallback: function(newValue, oldValue, knob) {\n},\nvaluechangeCallbackScope: undefined,\n\nvalue: 0xffffff,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\nitem: 0\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,    \n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of colorComponents.
    • formatLabel : Clicking this label can switch color format between RGB and HSV
      • A label game object, or a text game object.
      • A plain object
        {\nbackground: {\nradius: 0,\ncolor: undefined, alpha: undefined,\nstrokeColor: undefined, strokeAlpha: undefined, strokeWidth: 2\n},\n\ntext: textStyle,\n\nspace: {left: 0, right: 0, top: 0, bottom: 0}\n}\n
        • formatLable.background : Parameters to create round rectangle game object.
        • formatLable.text : Text style to create [text.md] game object.
        • formatLabel.space : Padding space around format label.
    • inputText : Configuration of canvasInput
    • inputText0, inputText1, inputText2 : 3 canvas input game objects if parameter inputText is not given.
    • proportion :
      • proportion.formatLabel : Default value is 0.
    • valuechangeCallback : callback function when value changed.
    • value : Initial color value (0 ~ 0xffffff).
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between swatch and inputText.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-colorcomponents/#custom-class","title":"Custom class","text":"
    • Define class
      class MyColorComponents extends RexPlugins.UI.ColorComponents {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var colorComponents = new MyColorComponents(scene, config);\n
    "},{"location":"ui-colorcomponents/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    colorComponents.layout();\n

    See also - dirty

    "},{"location":"ui-colorcomponents/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = colorComponents.getElement('background');\n
      • Format-label game object
        var icon = colorComponents.getElement('formatLabel');\n
      • Color component input text game objects
        var textObjects = colorComponents.getElement('components');\n
        • textObjects : An arrray with 3 canvas input game objects.
    • Get by name
      var gameObject = colorComponents.getElement('#' + name);\n// var gameObject = colorComponents.getElement('#' + name, recursive);\n
      or
      var gameObject = colorComponents.getByName(name);\n// var gameObject = colorComponents.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-colorcomponents/#value","title":"Value","text":"

    Change value will also change the position of marker on H-palette and SV-palette

    • Get color value
      var value = colorComponents.value;\n// var value = colorComponents.color;\n
    • Set color value
      colorComponents.setValue(value);\n// colorComponents.setColor(value);\n
      or
      colorComponents.value = value;\ncolorComponents.color = value;\n
    "},{"location":"ui-colorcomponents/#events","title":"Events","text":"
    • On value changed
      colorComponents.on('valuechange', function(newValue, oldValue, colorComponents){\n//\n}, scope);\n
    "},{"location":"ui-colorcomponents/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-colorinput/","title":"Color input","text":""},{"location":"ui-colorinput/#introduction","title":"Introduction","text":"

    Color number (0x0~0xffffff) or color string ('#000000'~'#ffffff', or 'red') input field.

    • Author: Rex
    • Game object
    "},{"location":"ui-colorinput/#live-demos","title":"Live demos","text":"
    • Color input
    "},{"location":"ui-colorinput/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-colorinput/#install-plugin","title":"Install plugin","text":""},{"location":"ui-colorinput/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add color-input object
      var colorInput = scene.rexUI.add.colorInput(config);\n
    "},{"location":"ui-colorinput/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add color-input object
      var colorInput = scene.rexUI.add.colorInput(config);\n
    "},{"location":"ui-colorinput/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ColorInput } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add color-input object
      var colorInput = new ColorInput(scene, config);\nscene.add.existing(colorInput);\n
    "},{"location":"ui-colorinput/#add-colorinput-object","title":"Add colorInput object","text":"
    var colorInput = scene.rexUI.add.colorInput({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nswatch: undefined,\n// swatch: { shape: 'circle' },\n// swatch: { size: 30 },\n// swatch: swatchGameObject,\n// swatch: false,\n\n// swatchSize: undefined,  // or swatch: { size }\n// squareExpandSwatch: true,\n\ninputText: inputTextConfig,\n// inputText: false,\n\ncolorPicker : {\nwidth: 160, height: 170,\n\nbackground: {\nradius: 0,\ncolor: undefined, alpha: undefined,\nstrokeColor: undefined, strokeAlpha: undefined, strokeWidth: 2\n},\n// createBackgroundCallback: function(scene) {\n//     return gameObject;\n// }\n\n// hPalettePosition: 'bottom',\n\n// space: { left: 10, right: 10, top: 10, bottom: 10, item: 8 }\n},\n\ncolorComponents: {\n// height: undefined,\n\n// formatLabel: undefined,\n\n// inputText: undefined,\n\n// space: { item: 8 }\n},\n// colorComponents: false,\n\nvaluechangeCallback: function(newValue, oldValue, colorInput) {\n},\nvaluechangeCallbackScope: undefined,\n\nvalue: 0xffffff,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\ntext: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,    \n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of colorInput.
    • swatch : Display color value on a square, circle shape, or an image game object with tint.
      • undefein : A square swatch. Default game object.
      • A plain object : A circle, or a round square swatch.
        { shape: 'circle' }\n
        or
        { radius: 10 }\n
        or
        { radius: 10, size: 30 }\n
        • shape : (Round-) Rectangle or circle
          • 0, or 'rectangle' : (Round-) Rectangle shape.
          • 1, or 'circle' : Circle shape.
        • radius : Radius of round rectangle.
        • size : Size of swatch. Equal to swatchSize parameter.
      • An Image or Sprite game object : Tint this game object for displaying color value.
      • false : No swatch game object.
    • swatchSize :
      • A number : Size of swatch.
      • undefined : Expand size to fit inner height of color input. Default behavior.
    • squareExpandSwatch
      • true : Expand size to fit inner height of color input. Default behavior if swatchSize is set to undefined, or not given
      • false : Keep current size of swatch.
    • inputText : Configuration of canvasInput
    • colorPicker : Configuration of a drop-down color picker, triggered by clicking swatch.
      • colorPicker.width, colorPicker.height : Sizer of color picker. Default value is 180x170
      • colorPicker.background : Parameters to create round rectangle game object, optional.
      • colorPicker.createBackgroundCallback : Callback to create background game object, optional.
        function(scene) {\nreturn gameObject;\n}\n
      • colorPicker.hPalettePosition : Position of h-palette.
        • 'bottom' or 0 : Place h-palette at bottom side of sv-palette.
        • 'left' or 1 : Place h-palette at left side of sv-palette.
        • 'top' or 2 : Place h-palette at top side of sv-palette.
        • 'right' or 3 : Place h-palette at right side of sv-palette.
      • colorPicker.space : Padding space around color picker. Default value is
        { left: 10, right: 10, top: 10, bottom: 10, item: 8 }\n
      • false : No color picker.
    • colorComponents : Configuration of color components inside the drop down color picker.
      • colorComponents.height : Height of color components.
      • colorComponents.formatLabel : Clicking this label can switch color format between RGB and HSV
        • undefined : Will create a label with default text game object.
        • A plain object
          {\nbackground: {\nradius: 0,\ncolor: undefined, alpha: undefined,\nstrokeColor: undefined, strokeAlpha: undefined, strokeWidth: 2\n},\n\ntext: textStyle,\n\nspace: {left: 0, right: 0, top: 0, bottom: 0}\n}            
      • colorComponents.inputText : Configuration of canvasInput used in this color components. Will use inputText of color input if this parameter is not given.
      • colorComponents.space : Padding space around color components. Default value is
        { item: 8 }\n
      • false : No color components.
    • valuechangeCallback : callback function when value changed.
    • value : Initial color value (0 ~ 0xffffff).
      • Number : 0 ~ 0xffffff
      • String :
        • 0x0~0xffffff
        • '#000000'~'#ffffff'
        • 'red'
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between swatch and inputText.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-colorinput/#custom-class","title":"Custom class","text":"
    • Define class
      class MyColorInput extends RexPlugins.UI.ColorInput {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var colorInput = new MyColorInput(scene, config);\n
    "},{"location":"ui-colorinput/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    colorInput.layout();\n

    See also - dirty

    "},{"location":"ui-colorinput/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = colorInput.getElement('background');\n
      • Swatch game object
        var icon = colorInput.getElement('swatch');\n
      • Input text game object
        var textObject = colorInput.getElement('inputText');\n
    • Get by name
      var gameObject = colorInput.getElement('#' + name);\n// var gameObject = colorInput.getElement('#' + name, recursive);\n
      or
      var gameObject = colorInput.getByName(name);\n// var gameObject = colorInput.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-colorinput/#value","title":"Value","text":"

    Change value will also change the position of marker on H-palette and SV-palette

    • Get color value
      var value = colorInput.value;\n// var value = colorInput.color;\n
    • Set color value
      colorInput.setValue(value);\n// colorInput.setColor(value);\n
      or
      colorInput.value = value;\ncolorInput.color = value;\n
    "},{"location":"ui-colorinput/#events","title":"Events","text":"
    • On value changed
      colorInput.on('valuechange', function(newValue, oldValue, colorInput){\n//\n}, scope);\n
    "},{"location":"ui-colorinput/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-colorpicker/","title":"Color picker","text":""},{"location":"ui-colorpicker/#introduction","title":"Introduction","text":"

    Pick color value from H and SV palettes.

    • Author: Rex
    • Game object
    "},{"location":"ui-colorpicker/#live-demos","title":"Live demos","text":"
    • Color picker
    "},{"location":"ui-colorpicker/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-colorpicker/#install-plugin","title":"Install plugin","text":""},{"location":"ui-colorpicker/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add color-picker object
      var colorPicker = scene.rexUI.add.colorPicker(config);\n
    "},{"location":"ui-colorpicker/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add color-picker object
      var colorPicker = scene.rexUI.add.colorPicker(config);\n
    "},{"location":"ui-colorpicker/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ColorPicker } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add color-picker object
      var colorPicker = new ColorPicker(scene, config);\nscene.add.existing(colorPicker);\n
    "},{"location":"ui-colorpicker/#add-colorpicker-object","title":"Add colorPicker object","text":"
    var colorPicker = scene.rexUI.add.colorPicker({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nhPalette: {\nposition: 'bottom',\nsize: 10,\nwidth: undefined,\nheight: undefined,       },\n\nsvPalette: {\nwidth: undefined,\nheight: undefined,\n},\n\nvaluechangeCallback: function(newValue, oldValue, knob) {\n},\nvaluechangeCallbackScope: undefined,\n\nvalue: 0xffffff,\n\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,    \n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of colorPicker.
    • hPalette : Configuration of h-palette. H-palette is rendered on a canvas game object.
      • hPalette.position : Position of h-palette.
        • 'bottom' or 0 : Place h-palette at bottom side of sv-palette.
        • 'left' or 1 : Place h-palette at left side of sv-palette.
        • 'top' or 2 : Place h-palette at top side of sv-palette.
        • 'right' or 3 : Place h-palette at right side of sv-palette.
      • hPalette.size : Width (if position of h-palette is at left or right side) or height (if position of h-palette is at top or bottom side) of h-palette.
      • hPalette.width : Width (if position of h-palette is at left or right side) of h-palette.
      • hPalette.height : Height (if position of h-palette is at top or bottom side) of h-palette.
    • svPalette : Configuration of sv-palette. SV-palette is rendered on a canvas game object.
      • svPalette.width : Width of sv-palette.
      • svPalette.height : Height of sv-palette.
    • valuechangeCallback : callback function when value changed.
    • value : Initial color value (0 ~ 0xffffff).
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between sv-palette and h-palette.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-colorpicker/#custom-class","title":"Custom class","text":"
    • Define class
      class MyColorPicker extends RexPlugins.UI.ColorPicker {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var colorPicker = new MyColorPicker(scene, config);\n
    "},{"location":"ui-colorpicker/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    colorPicker.layout();\n

    See also - dirty

    "},{"location":"ui-colorpicker/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = colorPicker.getElement('background');\n
      • H-palette game object
        var icon = colorPicker.getElement('hPalette');\n
      • SV-palette game object
        var textObject = colorPicker.getElement('svPalette');\n
    • Get by name
      var gameObject = colorPicker.getElement('#' + name);\n// var gameObject = colorPicker.getElement('#' + name, recursive);\n
      or
      var gameObject = colorPicker.getByName(name);\n// var gameObject = colorPicker.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-colorpicker/#value","title":"Value","text":"

    Change value will also change the position of marker on H-palette and SV-palette

    • Get color value
      var value = colorPicker.value;\n// var value = colorPicker.color;\n
    • Set color value
      colorPicker.setValue(value);\n// colorPicker.setColor(value);\n
      or
      colorPicker.value = value;\ncolorPicker.color = value;\n
    "},{"location":"ui-colorpicker/#events","title":"Events","text":"
    • On value changed
      colorPicker.on('valuechange', function(newValue, oldValue, colorPicker){\n//\n}, scope);\n
    "},{"location":"ui-colorpicker/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-confirmaction/","title":"Confirm action","text":""},{"location":"ui-confirmaction/#introduction","title":"Introduction","text":"

    Create a modal confirm dialog temporary, invoke callback after clicking button.

    • Author: Rex
    • Method
    "},{"location":"ui-confirmaction/#live-demos","title":"Live demos","text":"
    • Confirm action
    "},{"location":"ui-confirmaction/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-confirmaction/#install-plugin","title":"Install plugin","text":""},{"location":"ui-confirmaction/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Run confirm action
      var dialog = scene.rexUI.confirmAction(scene, config);\n
      • dialog : Confirm dialog will be destroy after clicking any button.
    "},{"location":"ui-confirmaction/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Run confirm action
      var dialog = scene.rexUI.confirmAction(scene, config)\n
      • dialog : Confirm dialog will be destroy after clicking any button.
    "},{"location":"ui-confirmaction/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ConfirmAction } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Run confirm action
      var dialog = ConfirmAction(scene, config)\n
      • dialog : Confirm dialog will be destroy after clicking any button.
    "},{"location":"ui-confirmaction/#run-confirm-action","title":"Run confirm action","text":"
    var dialog = scene.rexUI.confirmAction(scene, {    style: confirmDialogConfig\n\ncontent: confirmDialogResetChoiceDisplayContentConfig,\n\n// modal: confirmDialogModalConfig,\n\n// onCreateDialog: function(dialog) { },\n\nconfirm: function() {},\n// confirmScope: \n// confirmButtonIndex: 0,\n\n// cancel: function() {},\n// cancelScope: \n// cancelButtonIndex: 1,\n})\n
    • Build confirm dialog
      • style : Config parameter of Confirm dialog
      • content : Content strings of title, content, button.
      • modal : Config parameter of modal method
      • onCreateDialog : Callback invoking after creating dialog.
        function(dialog) {\n\n}\n
    • Callbacks
      • confirm, confirmScope : Callback invoking when click confirm/OK button of Confirm dialog
      • confirmButtonIndex : Index of confirm/OK button on Confirm dialog. Default value is 0.
      • cancel, cancelScope : Callback invoking when click cancel/cancel button of Confirm dialog
      • cancelButtonIndex : Index of cancel/cancel button on Confirm dialog. Default value is 1.
    • dialog : Confirm dialog will be destroy after clicking any button.
    "},{"location":"ui-confirmactionbutton/","title":"Confirm action button","text":""},{"location":"ui-confirmactionbutton/#introduction","title":"Introduction","text":"

    Click this label to invoke ConfirmAction. It will create a modal confirm dialog temporary, invoke callback after clicking button.

    • Author: Rex
    • Game object
    "},{"location":"ui-confirmactionbutton/#live-demos","title":"Live demos","text":"
    • Open page
    "},{"location":"ui-confirmactionbutton/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-confirmactionbutton/#install-plugin","title":"Install plugin","text":""},{"location":"ui-confirmactionbutton/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add button object
      var button = scene.rexUI.add.confirmActionButton(config);\n
    "},{"location":"ui-confirmactionbutton/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add button object
      var button = scene.rexUI.add.confirmActionButton(config);\n
    "},{"location":"ui-confirmactionbutton/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ConfirmActionButton } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add button object
      var button = new ConfirmActionButton(scene, config);\nscene.add.existing(button);\n
    "},{"location":"ui-confirmactionbutton/#add-button-object","title":"Add button object","text":"
    var button = scene.rexUI.confirmActionButton({\n// Parameters of Label\n\n\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\nicon: iconGameObject,\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\n\naction: actionGameObject,\n// actionMask: false,\n// squareFitAction: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nalign: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0, iconLeft: 0, iconRight: 0,\n\ntext: 0,\nactionTop: 0, actionBottom: 0, actionLeft: 0, actionRight: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n\n// Parameter of building confirm dialog\nconfirmDialog: {\nstyle: confirmDialogConfig\n// content: confirmDialogResetChoiceDisplayContentConfig,\n// modal: confirmDialogModalConfig,\n// onCreateDialog: function(dialog) { },\n\n// confirmButtonIndex: 0,\n// cancelButtonIndex: 1,\n\n},\n\n// Callbacks\nconfirm: function() {},\n// confirmScope:\n\n// cancel: function() {},\n// cancelScope: \n});\n
    • Parameters of Label...
    • Parameter of building confirm dialog
      • confirmDialog.style : Config parameter of Confirm dialog
      • confirmDialog.content : Content strings of title, content, button. Can assign this value later.
      • confirmDialog.modal : Config parameter of modal method
      • confirmDialog.onCreateDialog : Callback invoking after creating dialog.
        function(dialog) {\n\n}\n
      • confirmDialog.confirmButtonIndex : Index of confirm/OK button on Confirm dialog. Default value is 0.
      • confirmDialog.cancelButtonIndex : Index of cancel/cancel button on Confirm dialog. Default value is 1.
    • Callbacks
      • confirm, confirmScope : Callback invoking when click confirm/OK button of Confirm dialog
      • cancel, cancelScope : Callback invoking when click cancel/cancel button of Confirm dialog

    Destroy confirm dialog after clicking confirm/OK, or cancel/cancel button.

    "},{"location":"ui-confirmactionbutton/#custom-class","title":"Custom class","text":"
    • Define class
      class MyButton extends RexPlugins.UI.ConfirmActionButton {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var button = new MyButton(scene, config);\n
    "},{"location":"ui-confirmactionbutton/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    button.layout();\n

    See also - dirty

    "},{"location":"ui-confirmactionbutton/#get-element","title":"Get element","text":"

    See Get element

    "},{"location":"ui-confirmactionbutton/#set-callbacks","title":"Set callbacks","text":"
    • Callback after clicking confirm/OK button of confirm dialog
      button.setConfirmCallback(callback);\n// button.setConfirmCallback(callback, scope);\n
      • callback : Any function object
        function() {\n\n}\n
    • Callback after clicking cancel/cancel button of confirm dialog
      button.setCancelCallback(callback);\n// button.setCancelCallback(callback, scope);\n
      • callback : Any function object
        function() {\n\n}\n
    "},{"location":"ui-confirmactionbutton/#set-display-content-of-confirm-dialog","title":"Set display content of confirm dialog","text":"
    button.setConfirmDialogContent({\ntitle: '',\ncontent: '',\nbuttonA: '',\nbuttonB: '',\n});\n

    or

    button.setConfirmDialogContent({\ntitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\ncontent: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbuttonA: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbuttonB: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nchoices: [\n{\ntext: '', value: undefined,\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n},        // ...\n]\n});\n
    • title, content,buttonA, buttonB : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
    • choices : Array of display content
      • A string : Set text of simple lable, also use this string as option value.
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
        • Property value : Option value.
    "},{"location":"ui-confirmactionbutton/#set-style-of-confirm-dialog","title":"Set style of confirm dialog","text":"
    button.setConfitmDialogStyle(style);\n
    • style : See Config parameter of Confirm dialog
    "},{"location":"ui-confirmactionbutton/#set-configuration-of-confirm-dialogs-modal-behavior","title":"Set configuration of confirm dialog's modal behavior","text":"
    button.setConfitmDialogModalConfig(config);\n
    • config : See Config parameter of modal method
    "},{"location":"ui-confirmactionbutton/#disalbe-confirm-dialog","title":"Disalbe confirm dialog","text":"

    Run confirm callback directly without confirm dialog.

    button.setConfirmDialogEnable(false);\n
    "},{"location":"ui-confirmactionbutton/#other-properties","title":"Other properties","text":"

    See label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-confirmdialog/","title":"Confirm dialog","text":""},{"location":"ui-confirmdialog/#introduction","title":"Introduction","text":"

    Using json style to create confirm dialog, composed of simple-label title, simple-label content, with simple-label 0, 1, or 2 action button(s).

    • Author: Rex
    • Game object
    "},{"location":"ui-confirmdialog/#live-demos","title":"Live demos","text":"
    • Yes-no buttons
    • Ok button
    • Any-touch closing
    • TextArea content
    • Radio-choices
    "},{"location":"ui-confirmdialog/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-confirmdialog/#install-plugin","title":"Install plugin","text":""},{"location":"ui-confirmdialog/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add dialog object
      var dialog = scene.rexUI.add.confirmDialog(style).resetDisplayContent(config);\n// var dialog = scene.rexUI.add.confirmDialog(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-confirmdialog/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dialog object
      var dialog = scene.rexUI.add.confirmDialog(style).resetDisplayContent(config);\n// var dialog = scene.rexUI.add.confirmDialog(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-confirmdialog/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ConfirmDialog } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dialog object
      var dialog = new ConfirmDialog(scene, config);\n// var dialog = new ConfirmDialog(scene, config, creators);\nscene.add.existing(dialog);\ndialog.resetDisplayContent(config);\n
    "},{"location":"ui-confirmdialog/#add-dialog-object","title":"Add dialog object","text":"
    var dialog = scene.rexUI.add.confirmDialog({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundStyle,\n// background: null,\n\ntitle: titleStyle,  // SimpleLabelConfig\n// title: null,\n\ncontent: contentStyle, // SimpleLabelConfig, or TextAreaStyle\n// content: null,\n\nbuttonMode: 0,  // 0|1|2\n\nbutton: SimpleLabelConfig,\n// buttonA: SimpleLabelConfig\n// buttonB: SimpleLabelConfig\n\n// choice: SimpleLabelConfig,\n// choicesType\n// choicesWidth: undefined,\n// choicesHeight: undefined,\n\n// Space\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntitle: 0,\ntitleLeft: 0,\ntitleRight: 0,\n\ncontent: 0,\ncontentLeft: 0,\ncontentRight: 0,\n\nactionsLeft: 0,\nactionsRight: 0,\naction: 0,\n\nchoices: 0,\nchoicesLeft: 0,\nchoicesRight: 0,\nchoice: 0,\nchoiceLine: 0,\nchoiceColumn: 0, choiceRow: 0,\nchoicesBackgroundLeft: 0,\nchoicesBackgroundRight: 0,\nchoicesBackgroundTop: 0,\nchoicesBackgroundBottom: 0,\n},\n\nproportion: {\ntitle: 0,\ncontent: 0,\nactions: 0,\nchoices: 0,\n},\n\nexpand: {\ntitle: true,\ncontent: true,\nactions: false,\nchoices: true,\n},\n\nalign: {\ntitle: 'center',\ncontent: 'center',\nactions: 'center',\nchoices: 'center',\n},\n\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\nmodal: {\ncover: {\ncolor: 0x0,\nalpha: 0.8,\ntransitIn: function(gameObject, duration) { },\ntransitOut: function(gameObject, duration) { },\n},\n// cover: false, \n\n// When to close modal dialog?\ntouchOutsideClose: false,\nanyTouchClose: false,\ntimeOutClose: false,\nmanualClose: false,\n\nduration: {\nin: 200,\nhold: 2000,\nout: 200\n}\n\ntransitIn: 0,\ntransitOut: 0,\n\ndestroy: true,\n\ndefaultBehavior: true,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n// confirmButtonIndex: 0,\n// cancelButtonIndex: 1,\n\n}, creators);\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • title :
      • Styles of simple-label
      • null : Don't create any game object.
    • content :
      • Styles of simple-label : Create Label as content element.
      • Style of TextArea : Create TextArea as content element.
      • null : Don't create any game object.
    • buttonMode : 0, 1, or 2
      • 0 : No action button, any touch can close modal dialog
      • 1, 2 : Dialog with 1 or 2 action buttons, clicking any action button to close modal dialog.
    • button, buttonA, buttonB, choice :
      • Styles of simple-label, optional.
    • choicesType : Sizer type (Buttons/FixWidthButtons/GridButtons) and behavior (''/'radio'/'checkboxes') of choice buttons.
      • undefined, '', or 'y' : Buttons in vertical/horizontal without any extra behavior, default behavior.
      • 'radio', or 'x-radio' : Buttons in vertical/horizontal, with radio behavior.
        • Name of selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName().
      • 'checkboxes', or 'x-checkboxes' : Buttons in vertical/horizontal, with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
      • 'wrap' : FixWidthButtons without any extra behavior, default behavior.
      • 'wrap-radio' : FixWidthButtons with radio behavior.
        • Name of Selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName()
      • 'wrap-checkboxes' : FixWidthButtons with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
    • choicesWidth, choicesHeight : Minimum width, minimum height of choices.
      • Must assign choicesHeight value if using GridButtons choices.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.title : Space between title game object and below game object.
      • space.titleLeft, space.titleRight : Extra left/right padding of title game object.
      • space.content : Space between content game object and below game object.
      • space.contentLeft, space.contentRight : Extra left/right padding of content game object.
      • space.action : Space between each action-button game objects.
    • proportion : Keep height of element, or expand height of element.
      • proportion.title : Set to 1 to expand height of title. Default is 0.
      • proportion.content : Set to 1 to expand height of content. Default is 0.
      • proportion.actions : Set to 1 to expand height of actions. Default is 0.
    • expand : Expand width of element
      • expand.title : Set true to expand width of title game object. Default is true.
      • expand.content : Set true to expand width of content game object. Default is true.
      • expand.actions : Set true to expand width of actions game object. Default is false.
    • align : Align element
      • align.title
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value. Will add Spaces at right and left sides.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center. Will add a Space at right side.
      • align.content : Align content game object to 'left'/'center'/'right', if expand.content is false.
      • align.actions : Align action game objects to 'left'/'center'/'right', if expand.actions is false.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • modal : Configuration of modal, See Modal behavior.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false..
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • confirmButtonIndex, cancelButtonIndex : Button index for firing 'confirm', 'cancel' events. Default values are 0, 1.
    • creators : Callbacks for creating components.
      {\nbackground: undefined,\ntitle: undefined,\ncontent: undefined,\nbutton: undefined,\nbuttonA: undefined,\nbuttonB: undefined,\n}\n
      • creators.background : Callback to create background of dialog. Default behavior is creating a round-rectangle-shape.
        function(scene, config)  {\nreturn gameObject;\n}\n
      • creators.title, creators.content, creators.button, creators.buttonA, creators.buttonB : Creators of simple-label, included these properties
        {\nbackground: undefined,\ntext: undefined,\nicon: undefined,\naction: undefined,\n}\n
    "},{"location":"ui-confirmdialog/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDialog extends RexPlugins.UI.ConfirmDialog {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dialog = new MyDialog(scene, config, creators);\n
    "},{"location":"ui-confirmdialog/#reset-display-content","title":"Reset display content","text":"
    dialog.resetDisplayContent({\ntitle: '',\ncontent: '',\nbuttonA: '',\nbuttonB: '',\n});\n

    or

    dialog.resetDisplayContent({\ntitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\ncontent: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbuttonA: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbuttonB: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nchoices: [\n{\ntext: '', value: undefined,\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n},        // ...\n]\n});\n
    • title, content : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
      • null : Hide title or content element.
    • buttonA, buttonB : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
    • choices : Array of display content
      • A string : Set text of simple lable, also use this string as option value.
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
        • Property value : Option value.

    Run dialog.layout() after this method, to layout children again.

    "},{"location":"ui-confirmdialog/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    dialog.layout();\n

    See also - dirty

    "},{"location":"ui-confirmdialog/#modal","title":"Modal","text":"

    Pop this dialog as modal dialog, close this modal dialog under these conditions :

    • Clicking any action button.
    • Clicking any choice button and no action button on dialog.
    dialog.modal(onClose);  // Use default modal config\n

    or

    dialog.modal({\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0,\n// transitOut: 0,\n\n// destroy: true\n}, onClose);\n

    or

    dialog\n.modalPromise(config)\n.then(function(data){\n\n})\n
    • config : See Modal behavior
      • config.defaultBehavior :
        • undefined, or true : Will close modal dialog when clicking any action button.
        • false : Disable default behavior.
    • onClose : Callback when closing modal dialog
      function(data) {\n// var index = data.index;\n// var text = data.text;\n// var value = data.value;\n// var button = data.button;\n// var dialog = data.dialog;\n}\n
      • data : Contains these properties
        • data.index : Index of clicking action button
        • data.text : button.text, this property is valided if button game object is a label.
        • data.value :
          • A single value : Return selected value, if choicesType is 'radio'
          • A dictionary contains {value: boolean} : Return selected values, if choicesType is 'checkboxes'
          • undefined : Default value
        • data.button : Clicked button game object.
        • data.dialog : This dialog game object.
    "},{"location":"ui-confirmdialog/#button-index","title":"Button index","text":"
    • Confirm button
      • Get
        var confirmButtonIndex = dialog.confirmButtonIndex;\n
      • Set
        dialog.setConfirmButtonIndex(index);\n// dialog.confirmButtonIndex = index;\n
    • Cancel button
      • Get
        var cancelButtonIndex = dialog.cancelButtonIndex;\n
      • Set
        dialog.setCancelButtonIndex(index);\n// dialog.cancelButtonIndex = index;\n
    "},{"location":"ui-confirmdialog/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = dialog.getElement('background');\n
      • Title game object
        var title = dialog.getElement('title');\n
      • Content game object
        var content = dialog.getElement('content');\n
      • Buttons game object
        var buttonA = dialog.getElement('buttonA');\nvar buttonB = dialog.getElement('buttonB');\n
    • Get by name
      var gameObject = dialog.getElement('#' + name);\n// var gameObject = dialog.getElement('#' + name, recursive);\n
      or
      var gameObject = dialog.getByName(name);\n// var gameObject = dialog.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-confirmdialog/#other-properties","title":"Other properties","text":"

    See dialog, sizer object, base sizer object, container-lite.

    "},{"location":"ui-confirmdialog/#events","title":"Events","text":"
    • Click confirm button
      dialog.on('confirm', function (data) {\n// var index = data.index;\n// var text = data.text;\n// var value = data.value;\n// var button = data.button;\n// var dialog = data.dialog;\n}, scope);\n
      • data : See modal
    • Click cancel button
      dialog.on('cancel', function (data) {\n// var index = data.index;\n// var text = data.text;\n// var value = data.value;\n// var button = data.button;\n// var dialog = data.dialog;\n}, scope);\n
      • data : See modal
    "},{"location":"ui-dialog/","title":"Dialog","text":""},{"location":"ui-dialog/#introduction","title":"Introduction","text":"

    A container with a title, content, buttons and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-dialog/#live-demos","title":"Live demos","text":"
    • Dialog
    • Yes-no dialog
    • Action buttons with Space
    • Radio choices dialog
    • Horizontal-radio choices dialog
    • Wrap-radio choices dialog
    • Wrap-checkboxes choices dialog
    • Grid-checkboxes choices dialog
    • Popup/scaledown
      • Pop-up dialog
    • Ease-in, ease-out
    • Show/hide buttons
    • Add button
    • Wrap label
    • Modal dialog
    • Content sizer
    "},{"location":"ui-dialog/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-dialog/#install-plugin","title":"Install plugin","text":""},{"location":"ui-dialog/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add dialog object
      var dialog = scene.rexUI.add.dialog(config);\n
    "},{"location":"ui-dialog/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dialog object
      var dialog = scene.rexUI.add.dialog(config);\n
    "},{"location":"ui-dialog/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Dialog } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dialog object
      var dialog = new Dialog(scene, config);\nscene.add.existing(dialog);\n
    "},{"location":"ui-dialog/#add-dialog-object","title":"Add dialog object","text":"
    var dialog = scene.rexUI.add.dialog({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundGameObject,\n\ntitle: titleGameObject,\n\ntoolbarBackground: toolbarBackgroundGameObject,\ntoolbar: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\nleftToolbarBackground: leftToolbarBackgroundGameObject,\nleftToolbar: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\ncontent: contentGameObject,\n\ndescription: descriptionGameObject,\n\nchoicesType: '',\n// choicesWidth: undefined,\n// choicesHeight: undefined,  // Used when choicesType is `'grid'`, `'grid-radio'`, or `'grid-checkboxes'`\nchoicesBackground: choicesBackgroundGameObject,\nchoices: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\nactionsBackground: actionsBackgroundGameObject,\nactions: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n\n// Space\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntitle: 0,\ntitleLeft: 0,\ntitleRight: 0,\ntitleTop: 0,\n\ntoolbarItem: 0,\nleftToolbarItem: 0,\n\ncontent: 0,\ncontentLeft: 0,\ncontentRight: 0,\n\ndescription: 0,\ndescriptionLeft: 0,\ndescriptionRight: 0\n\nchoices: 0,\nchoicesLeft: 0,\nchoicesRight: 0,\n\n// choiceLine: 0,   // Used when choicesType is `'wrap'`, `'wrap-radio'`, or `'wrap-checkboxes'`\n// choiceColumn: 0, // Used when choicesType is `'grid'`, `'grid-radio'`, or `'grid-checkboxes'`\n// choiceRow: 0,    // Used when choicesType is `'grid'`, `'grid-radio'`, or `'grid-checkboxes'`\nchoicesBackgroundLeft: 0,\nchoicesBackgroundRight: 0,\nchoicesBackgroundTop: 0,\nchoicesBackgroundBottom: 0,\n\naction: 0,\nactionsLeft: 0,\nactionsRight: 0,\nactionsBottom: 0,\n\n},\n\nproportion: {\ntitle: 0,\ncontent: 0,\ndescription: 0,\nchoices: 0,\nactions: 0,\n},\n\nexpand: {\ntitle: true,\ncontent: true,\ndescription: true,\nchoices: true,\nactions: false,\n},\n\nalign: {\ntitle: 'center',\ncontent: 'center',\ndescription: 'center',\nchoices: 'center',\nactions: 'center',\n},\n\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n}\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of dialog.
    • title : Game object of title, optional.
    • toolbar : Array of Game objects for toolbar-buttons group which arranged from left to right, optional.
      • [] : Assign an empty array if user will add button later.
    • toolbarBackground : Game object of toolbar buttons background, optional. This background game object will be resized to fit the size of dialog.
    • leftToolbar : Array of Game objects for left-toolbar-buttons group which arranged from left to right, optional.
      • [] : Assign an empty array if user will add button later.
    • leftToolbarBackground : Game object of leftToolbar buttons background, optional. This background game object will be resized to fit the size of dialog.
    • content : Game object of content, optional.
    • description : Game object of description, optional.
    • choices : Array of Game objects for choice-buttons group which arranged from top to bottom, optional.
      • Array of Game objects, for Buttons/FixWidthButtons choices.
        • [] : Assign an empty array if user will add button later.
      • 2d Array of Game objects, for GridButtons choices..
    • choicesBackground : Game object of choices buttons background, optional. This background game object will be resized to fit the size of dialog.
    • choicesType : Sizer type (Buttons/FixWidthButtons/GridButtons) and behavior (''/'radio'/'checkboxes') of choice buttons.
      • undefined, 'x', or 'y' : Buttons in vertical/horizontal without any extra behavior, default behavior.
      • 'radio', or 'x-radio' : Buttons in vertical/horizontal, with radio behavior.
        • Name of selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName().
      • 'checkboxes', or 'x-checkboxes' : Buttons in vertical/horizontal, with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
      • 'wrap' : FixWidthButtons without any extra behavior, default behavior.
      • 'wrap-radio' : FixWidthButtons with radio behavior.
        • Name of Selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName()
      • 'wrap-checkboxes' : FixWidthButtons with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
      • 'grid' : GridButtons without any extra behavior, default behavior.
      • 'grid-radio' : GridButtons with radio behavior.
        • Name of Selected button game object (gameObject.name) will be returned via method dialog.setChoicesSelectedButtonName()
      • 'grid-checkboxes' : GridButtons with checkboxes behavior.
        • Name of selected button game object (gameObject.name) will be return via method dialog.getChoicessButtonStates().
    • choicesWidth, choicesHeight : Minimum width, minimum height of choices.
      • Must assign choicesHeight value if using GridButtons choices.
    • actions : Array of Game objects, or Space (scene.rexUI.add.space()) for action-buttons group which arranged from left to right, optional.
      • [] : Assign an empty array if user will add button later.
    • choicesBackground : Game object of choices buttons background, optional. This background game object will be resized to fit the size of dialog.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.title : Space between title game object and below game object.
      • space.titleLeft, space.titleRight : Extra left/right padding of title game object.
      • space.content : Space between content game object and below game object.
      • space.contentLeft, space.contentRight : Extra left/right padding of content game object.
      • space.description : Space between description game object and below game object.
      • space.descriptionLeft, space.descriptionRight : Extra left/right padding of description game object.
      • space.choices : Space between last choice-button and below game object.
      • space.choicesLeft, space.choicesRight : Extra left/right padding of choice buttons.
      • space.actionsLeft, space.actionsRight : Extra left/right padding of actions buttons.
      • space.toolbarItem : Space between each toolbar item game objects.
      • space.leftToolbarItem : Space between each left-toolbar item game objects.
      • space.choice : Space between each choice-button game objects.
      • space.choicesBackgroundLeft, space.choicesBackgroundRight, space.choicesBackgroundTop, space.choicesBackgroundBottom : Padding space around choices-background.
      • space.action : Space between each action-button game objects.
    • proportion : Keep height of element, or expand height of element.
      • proportion.title : Set to 1 to expand height of title. Default is 0.
      • proportion.content : Set to 1 to expand height of content. Default is 0.
      • proportion.description : Set to 1 to expand height of description. Default is 0.
      • proportion.choices : Set to 1 to expand height of choices. Default is 0.
      • proportion.actions : Set to 1 to expand height of actions. Default is 0.
    • expand : Expand width of element
      • expand.title : Set true to expand width of title game object. Default is true.
      • expand.content : Set true to expand width of content game object. Default is true.
      • expand.description : Set true to expand width of description game object. Default is true.
      • expand.choices : Set true to expand width of choices game object. Default is true.
      • expand.actions : Set true to expand width of actions game object. Default is false.
    • align : Align element
      • align.title
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value. Will add Spaces at right and left sides.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center. Will add a Space at right side.
      • align.content : Align content game object to 'left'/'center'/'right', if expand.content is false.
      • align.description : Align description game object to 'left'/'center'/'right', if expand.description is false.
      • align.choices : Align choices game object to 'left'/'center'/'right', if expand.choices is false.
      • align.actions : Align action game objects to 'left'/'center'/'right', if expand.actions is false.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false..
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-dialog/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDialog extends RexPlugins.UI.Dialog {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dialog = new MyDialog(scene, config);\n
    "},{"location":"ui-dialog/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    dialog.layout();\n

    See also - dirty

    "},{"location":"ui-dialog/#modal","title":"Modal","text":"

    Pop this dialog as modal dialog, clicking any action button to close this modal dialog.

    dialog.modal({\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0, // 0|'popUp'|1|'fadeIn'\n// transitIn: function(gameObject, duration) { },\n\n// transitOut: 0, // 0|'scaleDown'|1|'fadeOut'\n// transitOut: function(gameObject, duration) { },\n\n// destroy: true,\n\n// defaultBehavior: true,\n});\n// dialog.modal(config, onClose);\n

    or

    dialog\n.modalPromise(config)\n.then(function(data){\n\n})\n
    • config : See Modal behavior
      • config.defaultBehavior :
        • undefined, or true : Will close modal dialog when clicking any action button.
        • false : Disable default behavior. User has to invoke dialog.modalClose(data) manually.
    • onClose : Callback when closing modal dialog
      function(data) {\n// var index = data.index;\n// var text = data.text;\n// var button = data.button;\n// var dialog = data.dialog;\n}\n
      • data : Contains these properties
        • data.index : Index of clicking action button
        • data.text : button.text, this property is valided if button game object is a label.
        • data.button : Clicked button game object.
        • data.dialog : This dialog game object.
    "},{"location":"ui-dialog/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-dialog/#events","title":"Events","text":"
    • Click button
      dialog.on('button.click', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'choices', 'actions', or 'toolbar', 'leftToolbar'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over button
      dialog.on('button.over', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object
      • groupName : 'choices', 'actions', 'toolbar', or 'leftToolbar'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-out button
      dialog.on('button.out', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'choices', 'actions', 'toolbar', or 'leftToolbar'
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Enable button's input
      dialog.on('button.enable', function(button, groupName, index) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.enable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.enable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.enable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.enable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'choices', 'actions', 'toolbar', or 'leftToolbar'
      • index : Index of triggered button game object.
    • Disable button's input
      dialog.on('button.disable', function(button, groupName, index) {\n// ...\n}, scope);\n
      or
      dialog.on('choice.disable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('action.disable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('toolbar.disable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      dialog.on('leftToolbar.disable', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'choices', 'actions', 'toolbar', or 'leftToolbar'
      • index : Index of triggered button game object.
    "},{"location":"ui-dialog/#emit-button-click-event","title":"Emit button click event","text":"
    • Emit choice/action/toolbar/left-toolbar button's click event
      dialog.emitChoiceClick(index);\ndialog.emitActionClick(index);\ndialog.emitToolbarClick(index);\ndialog.emitLeftToolbarClick(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-dialog/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = dialog.getElement('background');\n
      • Title game object
        var title = dialog.getElement('title');\n
      • Content game object
        var content = dialog.getElement('content');\n
      • Description game object
        var description = dialog.getElement('description');\n
      • Choice button game object
        var buttons = dialog.getElement('choices');\n
        or
        var button = dialog.getChoice(index);\n
        or
        var button = dialog.getElement('choices[' + index + ']');\n
      • Action button game object
        var buttons = dialog.getElement('actions');\n
        or
        var button = dialog.getAction(index);\n
        or
        var button = dialog.getElement('actions[' + index + ']');\n
      • Toolbar button game object
        var buttons = dialog.getElement('toolbar');\n
        or
        var button = dialog.getToolbar(index);\n
        or
        var button = dialog.getElement('toolbar[' + index + ']');\n
      • Left-toolbar button game object
        var buttons = dialog.getElement('leftToolbar');\n
        or
        var button = dialog.getLeftToolbar(index);\n
        or
        var button = dialog.getElement('leftToolbar[' + index + ']');\n
    • Get by name
      var gameObject = dialog.getElement('#' + name);\n// var gameObject = dialog.getElement('#' + name, recursive);\n
      or
      var gameObject = dialog.getByName(name);\n// var gameObject = dialog.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-dialog/#add-button","title":"Add button","text":"

    Add choice/action/toolbar/left-toolbar button

    dialog.addChoice(gameObject);\ndialog.addAction(gameObject);\ndialog.addToolbar(gameObject);\ndialog.addLeftToolbar(gameObject);\n
    • gameObject : A game object, or an array of game objects.
    "},{"location":"ui-dialog/#remove-button","title":"Remove button","text":"
    • Remove a choice/action/toolbar/left-toolbar button
      dialog.removeChoice(index, destroyChild);\ndialog.removeAction(index, destroyChild);\ndialog.removeToolbar(index, destroyChild);\ndialog.removeLeftToolbar(index, destroyChild);\n
      • index : A number index, a string name, or a button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove all choice/action/toolbar/left-toolbar buttons
      dialog.clearChoices(destroyChild);\ndialog.clearActions(destroyChild);\ndialog.clearToolbar(destroyChild);\ndialog.clearLeftToolbar(destroyChild);\n
      • destroyChild : Set true to destroy button game object.
    "},{"location":"ui-dialog/#enabledisable-input-of-button","title":"Enable/disable input of button","text":"
    • Enable choice/action/toolbar/left-toolbar button
      dialog.setChoiceEnable(index);\ndialog.setActionEnable(index);\ndialog.setToolbarEnable(index);\ndialog.setLeftToolbarEnable(index);\n
      • index : A number index, or a button game object.
    • Enable all buttons
      dialog.setAllButtonsEnable();\n
    • Disable choice/action/toolbar/left-toolbar button's input
      dialog.setChoiceEnable(index, false);\ndialog.setActionEnable(index, false);\ndialog.setToolbarEnable(index, false);\ndialog.setLeftToolbarEnable(index, false);\n
      • index : A number index, or a button game object.
    • Disable all buttons
      dialog.setAllButtonsEnable(false);\n
    • Toggle choice/action/toolbar/left-toolbar button's input
      dialog.toggleChoiceEnable(index);\ndialog.toggleActionEnable(index);\ndialog.toggleToolbarEnable(index);\ndialog.toggleLeftToolbarEnable(index);\n
      • index : A number index, or a button game object.
    • Get choice/action/toolbar/left-toolbar button's input enable
      var enabled = dialog.getChoiceEnable(index);\nvar enabled = dialog.getActionEnable(index);\nvar enabled = dialog.getToolbarEnable(index);\nvar enabled = dialog.getLeftToolbarEnable(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-dialog/#showhide-button","title":"Show/hide button","text":"

    Hidden elements won't be counted when layouting. Call dialog.layout(), or topSizer.layout() after show/hide any button.

    • Show choice/action/toolbar/left-toolbar button
      dialog.showChoice(index);\ndialog.showAction(index);\ndialog.showToolbar(index);\ndialog.showLeftToolbar(index);\n
      • index : A number index, a string name, or a button game object.
    • Hide choice/action/toolbar/left-toolbar button.
      dialog.hideChoice(index);\ndialog.hideAction(index);\ndialog.hideToolbar(index);\ndialog.hideLeftToolbar(index);\n
      • index : A number index, a string name, or a button game object.
    "},{"location":"ui-dialog/#for-each-button","title":"For each button","text":"
    dialog.forEachChoice(callback, scope);\ndialog.forEachAction(callback, scope);\ndialog.forEachToolbar(callback, scope);\ndialog.forEachLeftToolbar(callback, scope);\n
    • callback :
      function(button, index, buttons) {\n// ...\n}\n
    "},{"location":"ui-dialog/#state-of-choices-buttons","title":"State of choices buttons","text":""},{"location":"ui-dialog/#radio","title":"Radio","text":"
    • Read state
      var value = dialog.getChoicesSelectedButtonName();\n
    • Set state
      dialog.setChoicesSelectedButtonName(name);\n
    "},{"location":"ui-dialog/#checkboxes","title":"Checkboxes","text":"
    • Read states
      var states = dialog.getChoicesButtonStates();\n
      • states : {name: boolean}
    • Set state
      dialog.setChoicesButtonState(name, state);\n
      • name : Name of button game object
      • state : Set true if button is selected
    • Clear all states to false
      dialog.clearChoicesButtonStates();\n
    "},{"location":"ui-dialog/#events_1","title":"Events","text":"
    • On button state changed. For Checkboxes/radio
      dialog.on('button.statechange', function(button, groupName, index, value, previousValue) {\n// ...\n}, scope);\n
      • Can be used to replace setValueCallback.
    "},{"location":"ui-dropdownlist/","title":"Drop down list","text":""},{"location":"ui-dropdownlist/#introduction","title":"Introduction","text":"

    A label can open a drop-down list panel.

    • Author: Rex
    • Game object
    "},{"location":"ui-dropdownlist/#live-demos","title":"Live demos","text":"
    • Drop-down list
    • Drop-down wrap-list
    • Custom transit
    • Align to right side
    • Cursor select
    • Drop-down scrollable-list
    "},{"location":"ui-dropdownlist/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-dropdownlist/#install-plugin","title":"Install plugin","text":""},{"location":"ui-dropdownlist/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add drop-down list object
      var dropDownList = scene.rexUI.add.dropDownList(config);\n
    "},{"location":"ui-dropdownlist/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add drop-down list object
      var dropDownList = scene.rexUI.add.dropDownList(config);\n
    "},{"location":"ui-dropdownlist/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { DropDownList } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dropDownList object
      var dropDownList = new DropDownList(scene, config);\nscene.add.existing(dropDownList);\n
    "},{"location":"ui-dropdownlist/#add-drop-down-list-object","title":"Add drop-down list object","text":"
    var dropDownList = scene.rexUI.add.dropDownList({\noptions: [\noption0,\noption1,\n// ...\n],\n\nlist: {\n// createBackgroundCallback: function(scene) {\n//     // this : dropDownList\n//     return gameObject;\n// },\n\ncreateButtonCallback: function(scene, option, index, options) {\n// this : dropDownList\nreturn gameObject;\n},\n\n// createTrackCallback: function(scene) {\n//     // this : dropDownList\n//     return gameObject;\n// },\n\n// createThumbCallback: function(scene) {\n//     // this : dropDownList\n//     return gameObject;\n// },\n\nmouseWheelScroller: undefined,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\nonButtonClick: function(button, index, pointer, event) {\n// this : dropDownList\n},\n\n// onButtonOver: function(button, index, pointer, event) {\n//     // this : dropDownList\n// },\n\n// onButtonOut: function(button, index, pointer, event) {\n//     // this : dropDownList\n// },\n\n// easeIn: 500,\n// transitIn: undefined,\n// transitIn: function(listPanel, duration) {  },\n\n// easeOut: 100,\n// transitOut: undefined,\n// transitOut: function(listPanel, duration) {  },\n\n// wrap: false,\n// maxHeight: undefined,\n// width: undefined, \n// height: undefined,\n// alignParent: 'text',\n// alignSide: '',\n// expandDirection: 0,\n// bounds: undefined,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0, item: 0,\n//     line: 0\n// },\n\n// draggable: false\n},\n\nsetValueCallback: function(dropDownList, value, previousValue) {\n\n},\nsetValueCallbackScope: undefined,\nvalue: undefined,\n\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\naction: actionGameObject,\nactionMask: false,\nalign: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\ntext: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • options : Array of strings, or objects.
    • list : Configuration of list panel.
      • list.createBackgroundCallback : Create background of list panel
        function(scene) {\n// this : dropDownList\nreturn gameObject;\n}\n
      • list.createButtonCallback : Create option button of list panel
        function(scene, option, index, options) {\n// this : dropDownList\nreturn gameObject;\n}\n
      • list.createTrackCallback : Create slider's track of list panel, optional.
        function(scene) {\n// this : dropDownList\nreturn gameObject;\n}\n
      • list.createThumbCallback : Create slider's thumb of list panel, optional.
        function(scene) {\n// this : dropDownList\nreturn gameObject;\n}\n
      • list.mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
        • list.mouseWheelScroller.focus :
          • false, or 0 : Without checking if cursor is over game object or not.
          • true, or 1 : Cursor is inside the rectangle bounds of game object. Default behavior.
          • 2 : Cursor is over game object.
        • list.mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
        • Set to false to skip creating mouse-wheel-scroller. Default behavior.
      • list.onButtonClick : Callback when clicking a button
        function(button, index, pointer, event) {\n// this : dropDownList\n}\n
      • list.onButtonOver : Callback when pointer over a button
        function(button, index, pointer, event) {\n// this : dropDownList\n}\n
      • list.onButtonOut : Callback when pointer out a button
        function(button, index, pointer, event) {\n// this : dropDownList\n}\n
      • list.easeIn : Pop-up duration in ms. Default value is 500.
      • list.transitIn : Tween behavior of opening list panel.
        • undefined : Expand list panel by pop-up, default behavior.
        • Custom callback
          function(listPanel, duration) {\n\n}\n
      • list.easeOut : Scale-down duration in ms. Default value is 100.
      • list.transitOut : Tween behavior of closing list panel.
        • undefined : Closing list panel by scale-down, default behavior.
        • Custom callback
          function(listPanel, duration) {\n\n}\n
      • list.wrap : Layout mode of buttons
        • true : fixwidth-sizer layout.
        • false : sizer layout. Default behavior.
      • list.maxHeight : If height of button list is larger than this maxHeight, put this button list into scrollable panel.
        • undefined, or 0 : Ignore this behavior.
        • > 0 and list.createThumbCallback parameter is given : If height of button list is larger than this maxHeight, put this button list into scrollable panel.
      • list.width : Minimum width.
        • undefined : Minimum width of panel will equal to width of parent label. Default value.
        • A number : Width of panel. Required fields when list.wrap is true.
      • list.height : Minimum height.
        • undefined : Create button list or wrap button list. Default value.
        • > 0 and list.createThumbCallback parameter is given : Create scrollable button list or wrap button list.
      • list.alignParent : Align x position to label.
        • 'icon' : Align x position to icon game object of parent label.
        • 'text' : Align x position to text game object of parent label. Default behavior
        • 'label', or null : Align x position to parent label.
      • list.alignSide : Align list to label's left or right side.
        • undefined, or 'left' : Align list's left side to label's left side. Default behavior.
        • 'right : Align list's right side to label's right side. Default behavior.
      • list.expandDirection :
        • 0, 'down' : Expand list down. i.e. list panel will put below parent label.
        • 1, 'up' : Expand list up. i.e. list panel will put above parent label.
      • list.bounds : Put list panel below parent label if bottom of list panel is inside bounds (Rectangle)
        • undefined : Use viewport as bounds
        • Rectangle
      • list.space : space properties of list panel.
        • left, right, top, bottom, item : For sizer layout. (list.wrap is false)
        • left, right, top, bottom, item, line : For fixwidth-sizer layout. (list.wrap is true)
      • list.draggable : Set true to drag top-most object.
    • value, setValueCallback, setValueCallbackScope : See value
      function(dropDownList, value, previousValue) {\n\n}\n
    • Properties of Label
      • x, y : Position of this object, it is valid when this object is the top object.
      • anchor : See anchor.
        • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
          • Percentage of visible width/height : 'p%', p: 0 ~ 100.
            • 'left'(=0%), 'center'(=50%), 'right'(=100%)
            • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
          • Offset : '+n', or '-n'.
        • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
          • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • Padding : '+n', or '-n'.
        • onResizeCallback : A default resize callback will be assigned interanlly.
      • width, height : Minimum width, minimum height.
      • orientation :
        • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
        • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
      • rtl :
        • true : Layout children from right to left.
        • false : Layout children from left to right. Default behavior.
      • background : Game object of background, optional. This background game object will be resized to fit the size of label.
      • icon : Game object of icon, optional.
      • iconMask : Set true to add a circle mask on icon game object.
        • Phaser 3 engine does not support nested mask, uses circle mask image instead.
      • text : Game object of text, optional.
      • expandTextWidth : Set true to expand width of text object.
      • expandTextHeight : Set true to expand height of text object.
      • action : Game object of action icon, optional.
      • actionMask : Set true to add a circle mask on action icon game object.
        • Phaser 3 engine does not support nested mask, uses circle mask image instead.
      • align : Alignment of icon, text, action-icon game objects.
        • undefined, or 'left', or 'top' : Align game objects at left, or top.
        • 'center' : Align game objects at center.
        • 'right', or 'bottom' : Align game objects at right, or bottom.
      • space : Pads spaces.
        • space.left, space.right, space.top, space.bottom : Space of bounds.
        • space.icon : Space between icon game object and text game object.
        • space.text : Space between text game object and action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-dropdownlist/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDropDownList extends RexPlugins.UI.DropDownList {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dropDownList = new MyDropDownList(scene, config);\n
    "},{"location":"ui-dropdownlist/#options","title":"Options","text":"
    • Set
      dropDownList.setOptions(options);\n
      or
      dropDownList.options = options;\n
      • options : Array of strings, or objects.
    • Get
      var options = dropDownList.options;\n
    "},{"location":"ui-dropdownlist/#clicking","title":"Clicking","text":"
    • Enable
      dropDownList.enableClick();\n
    • Disable
      dropDownList.disableClick();\n
    • Register another clicking callback
      dropDownList.onClick(callback, scope);\n
    "},{"location":"ui-dropdownlist/#emit-button-click-event","title":"Emit button click event","text":"
    dropDownList.emitButtonClick(index);\n// dropDownList.emitButtonClick();\n
    • index : Index of button/option.
      • undefined : Click current focus (over) button.

    Will fire 'button.click' event

    dropDownList.on('button.click', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
    • listPanel : listPanel, or undefined if list is not created.
    • button : Button game object, or option if list is not created.
    • pointer : undefined
    • event : undefined

    This method won't close list panel.

    "},{"location":"ui-dropdownlist/#emit-button-over-event","title":"Emit button over event","text":"
    dropDownList.emitButtonOver(index);\n
    • index : Index of button/option.

    or

    dropDownList.focusNextButton();\ndropDownList.focusPrevButton();\n

    Will fire 'button.out', 'button.over' event

    dropDownList.on('button.out', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
    dropDownList.on('button.over', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n

    • listPanel : listPanel, or undefined if list is not created.
    • button : Button game object, or option if list is not created.
    • pointer : undefined
    • event : undefined
    "},{"location":"ui-dropdownlist/#value","title":"Value","text":"
    • Set value under list.onButtonClick callback.
      dropDownList.setValue(value);\n
      or
      dropDownList.value = value;\n
      • When value changing
        • Will invoke setValueCallback
          function(dropDownList, value, previousValue) {\n\n}\n
        • Will fire 'valuechange' event
    • Get
      var value = dropDownList.value;\n
    "},{"location":"ui-dropdownlist/#openclose-list-panel","title":"Open/close list panel","text":""},{"location":"ui-dropdownlist/#open-list-panel","title":"Open list panel","text":"
    • Click parent label to open (create and pop-up) list panel.
    • Or invoke this method dropDownList.openListPanel().
    "},{"location":"ui-dropdownlist/#close-list-panel","title":"Close list panel","text":"
    • When list panel is opened, click any where will close (scale-down then destroy) this list panel.
    • Or invoke this method dropDownList.closeListPanel().
    "},{"location":"ui-dropdownlist/#toggle-list-panel","title":"Toggle list panel","text":"
    dropDownList.toggleListPanel();\n
    "},{"location":"ui-dropdownlist/#is-list-opened","title":"Is list opened","text":"
    var isOpened = dropDownList.isOpened;\n
    "},{"location":"ui-dropdownlist/#other-properties","title":"Other properties","text":"

    See label object, sizer object, base sizer object, container-lite.

    "},{"location":"ui-dropdownlist/#events","title":"Events","text":"
    • Open list
      dropDownList.on('list.open', function(dropDownList, listPanel) {\n\n})\n
    • Close list
      dropDownList.on('list.close', function(dropDownList, listPanel) {\n\n})\n
    • Click button
      dropDownList.on('button.click', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button on list panel.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Over button
      dropDownList.on('button.over', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button on list panel.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Out button
      dropDownList.on('button.out', function(dropDownList, listPanel, button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button on list panel.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • On value changing
      dropDownList.on('valuechange', function(dropDownList, value, previousValue) {\n// ...\n}, scope);\n
    "},{"location":"ui-expbar/","title":"Exp bar","text":""},{"location":"ui-expbar/#introduction","title":"Introduction","text":"

    Disply experience bar on NameValueLabel.

    • Author: Rex
    • Game object
    "},{"location":"ui-expbar/#live-demos","title":"Live demos","text":"
    • Exp bar
    • Custom bar
    "},{"location":"ui-expbar/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-expbar/#install-plugin","title":"Install plugin","text":""},{"location":"ui-expbar/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add expBar object
      var expBar = scene.rexUI.add.expBar(config);\n
    "},{"location":"ui-expbar/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add expBar object
      var expBar = scene.rexUI.add.expBar(config);\n
    "},{"location":"ui-expbar/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ExpBar } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add expBar object
      var expBar = new ExpBar(scene, config);\nscene.add.existing(expBar);\n
    "},{"location":"ui-expbar/#add-expbar-object","title":"Add expBar object","text":"
    var expBar = scene.rexUI.add.expBar({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\n\nnameText: nameTextGameObject,\nvalueText: valueTextGameObject,\n// valueTextFormatCallback: function(value, min, max) {\n//     return `${value}/${max}`;\n// },\n// valueTextFormatCallback: null,\n\n// barShape: 'line',   // 'line', or 'circle'\n\n// line bar\nbar: {\ntrackColor: undefined,\ntrackThickness: 2,\ntrackStrokeColor: undefined,\nbarColor: undefined,\nbarColor2: undefined,\n\nskewX: 0,\n\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'linear'\n},\n}, // circle bar\n/*\n    bar: {\n        barColor: undefined,\n        barColor2: undefined,\n        trackColor: undefined,\n        centerColor: undefined,\n        thickness: 0.2,\n        startAngle: Phaser.Math.DegToRad(270),\n        endAngle: Phaser.Math.DegToRad(270+360),\n        anticlockwise: false,\n    }\n    */\n\n// bar: CustomProgressGameObject,\n\n// bar: undefined,\n\naction: actionGameObject,\nactionMask: false,\n\nalign: {        text: 'bottom',  // 'top', 'center', 'bottom'\n},\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0,\nname: 0, value: 0,\nbar:0, barBottom: 0, barLeft: 0, barRight: 0,\ntext: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// easeDuration: 1000,\n\nlevelCounter: {\ntable: function(level) { return level * 100; },\n// table: [0, 100, 200, 300,],        \n// maxLevel: -1,        \n// exp: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of expBar.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • nameText : Game object of nameText.
      • OriginX of nameText will be set to 0.
      • Empty text will be set to a space character ' '. To preserve height of this text game object.
    • valueText : Game object of valueText.
      • OriginX of nameText will be set to 1.
      • Empty text will be set to a space character ' '. To preserve height of this text game object.
    • valueTextFormatCallback : Callback to return a string set to valueText game object when invokeing label.setValue(value, min, max) method.
      • A callback
        function(value, min, max) {\nreturn `${value}/${max}`;\n}\n
      • null, or false : Don't set valueText game object.
    • barShape : 'line' or 'circle'.
    • bar : Game object of bar, or config of horizontal line progress bar, or config of circular progress bar or undefined.
      • Config of horizontal line progress bar
        • bar.trackColor : Fill color of bar's track, in number or css string value.
        • bar.trackStrokeColor : Stroke color of bar's track, in number or css string value.
        • bar.trackThickness : Stroke line width of bar's track.
        • bar.barColor, bar.barColor2 : Fill color of bar, in number or css string value. Assign gradient start color by barColor2.
        • bar.skewX : Horizontal skew of track and bar.
        • bar.rtl :
          • false : Bar starts from left side. Default behavior.
          • true : Bar starts from right side.
      • Config of circular progress bar
        • bar.shape : 'circle'
        • bar.barColor, bar.barColor2 : Fill color of circular bar, in number or css string value. Assign gradient start color by barColor2.
        • bar.trackColor : Color of circular track, in number or css string value.
        • bar.centerColor : Color of center circle, in number or css string value.
        • bar.thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
        • bar.startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
        • bar.endAngle : End angle of circular bar, in radians. Default value is 270+360 degrees.
        • bar.anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
      • (CustomProgress) Game object.
      • undefined : No bar game object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • align :
      • align.text : Alignment of nameText, valueText game objects.
        • 'top', 'center', or 'bottom'. Default value is 'bottom'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom : Space around icon game object.
      • space.name : Left space of nameText game object.
      • space.value : Right space of valueText game object.
      • space.bar, space.barLeft, space.barRight, space.barBottom : Space around bar game object.
      • space.text : Space between text game object and action icon game object.
      • space.actionTop, space.actionBottom : Space around action game object.
    • easeDuration : Total duration of easing value from level-start to level-end. Default value is 1000 ms.
    • levelCounter : Config of level-counter
      • levelCounter.table : Level table, return experience value from level value. Level value starts from 0.
        • A callback
          function(level) {\nreturn experience;\n}\n
        • A number array : Experience value of each level.
      • levelCounter.maxLevel :
        • undefined : Default value
          • No upper limit for callback level table.
          • (table.length - 1) for number array level table.
        • A number : Maximum level value
      • levelCounter.exp : Initial experience value. Default value is 0.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-expbar/#custom-class","title":"Custom class","text":"
    • Define class
      class MyExpBar extends RexPlugins.UI.ExpBar {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var expBar = new MyExpBar(scene, config);\n
    "},{"location":"ui-expbar/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    expBar.layout();\n

    See also - dirty

    "},{"location":"ui-expbar/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = expBar.getElement('background');\n
      • Icon game object
        var icon = expBar.getElement('icon');\n
      • NameText game object
        var nameTextObject = expBar.getElement('name');\n
      • ValueText game object
        var valueTextObject = expBar.getElement('value');\n
      • Bar game object
        var textObject = expBar.getElement('bar');\n
      • Action icon game object
        var action = expBar.getElement('action');\n
    • Get by name
      var gameObject = expBar.getElement('#' + name);\n// var gameObject = expBar.getElement('#' + name, recursive);\n
      or
      var gameObject = expBar.getByName(name);\n// var gameObject = expBar.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-expbar/#accumulate-experience","title":"Accumulate experience","text":"
    • Accumulate experience
      expBar.gainExp(incExp);\n// expBar.exp += incExp;\n
      • Will fire 'levelup' event
    • Reset experience value
      expBar.resetExp(exp);\n
      • Won't fire 'levelup' event.
    • Force level up
      expBar.setLevel(level);\n
      • Will fire 'levelup' event
    "},{"location":"ui-expbar/#level-and-experience","title":"Level and experience","text":"
    • Get current experience
      var exp = expBar.getExp();\n// var exp = expBar.exp;\n
    • Get current level
      var level = expBar.getLevel();\n// var level = expBar.level;\n
    • Get current required experience to next level
      var exp = expBar.requiredExp;\n
    • Get experience of level
      var exp = expBar.getExp(level);\n
    • Get level from experience
      var level = expBar.getLevel(exp);\n
    • Get required experience to level
      var exp = expBar.getRequiredExpToNextLevel(level);\n// var exp = expBar.getRequiredExpToNextLevel(level, exp);\n
    "},{"location":"ui-expbar/#events","title":"Events","text":"
    • Easing starting of Level-up
      expBar.on('levelup.start', function(level, fromExp, toExp){        }, scope);\n
      • level : Current level
    • Easing end of Level-up
      expBar.on('levelup.end', function(level, fromExp, toExp){        }, scope);\n
      • level : Current level
    • Total easing of Level-up complete
      expBar.on('levelup.complete', function(level){        }, scope);\n
      • level : Current level
    "},{"location":"ui-expbar/#other-properties","title":"Other properties","text":"

    See NameValueLabel, sizer object, base sizer object, container-lite.

    "},{"location":"ui-fileselectorbutton/","title":"File selector button","text":""},{"location":"ui-fileselectorbutton/#introduction","title":"Introduction","text":"

    A transparent file chooser button (<input type=\"file\">) above a Label.

    • Author: Rex
    • Game object, DOM Game object
    "},{"location":"ui-fileselectorbutton/#live-demos","title":"Live demos","text":"
    • File selector button
    "},{"location":"ui-fileselectorbutton/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-fileselectorbutton/#install-plugin","title":"Install plugin","text":""},{"location":"ui-fileselectorbutton/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add file selector button object
      var button = scene.add.fileSelectorButton(config);\n
    "},{"location":"ui-fileselectorbutton/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import FileChooserPlugin from 'phaser3-rex-plugins/plugins/filechooser-plugin.js';\nvar config = {    parent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add file selector button object
      var button = scene.add.fileSelectorButton(config);\n
    "},{"location":"ui-fileselectorbutton/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { FileSelectorButton } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add file chooser object
      var button = new FileSelectorButton(scene, config);\nscene.add.existing(button);\n
    "},{"location":"ui-fileselectorbutton/#add-file-chooser-object","title":"Add file chooser object","text":"
    var button = scene.add.fileSelectorButton({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\nicon: iconGameObject,\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\n\naction: actionGameObject,\n// actionMask: false,\n// squareFitAction: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nalign: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\ntext: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n// accept: '',\n// multiple: false,\n});\n// var fileChooser = scene.add.fileSelectorButton(x, y, width, height, config);\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitIcon :
      • true : Resize icon size to square to fit label height/width.
      • false : Ignore this feature. Default behavior.
    • iconSize : Set display size of icon game object to iconSizexiconSize
    • iconWidth : Set display width of icon game object to iconWidth.
      • If iconHeight is undefined, set scaleY of icon game object to scaleX of icon game object, to keep size ratio.
    • iconHeight : Set display height of icon game object to iconHeight.
      • If iconWidth is undefined, set scaleX of icon game object to scaleY of icon game object, to keep size ratio.
    • text : Game object of text, optional.
    • expandTextWidth :
      • false : Keep width of text to original size. Default behavior.
      • true : Expand width of text object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
    • expandTextHeight : Set true to expand height of text object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitAction :
      • true : Resize action icon size to square to fit label height/width.
      • false : Ignore this feature. Default behavior.
    • actionSize : Set display size of action game object to actionSizexactionSize
    • actionWidth : Set display width of action game object to actionWidth.
      • If actionHeight is undefined, set scaleY of action game object to scaleX of action game object, to keep size ratio.
    • actionHeight : Set display height of action game object to actionHeight.
      • If actionWidth is undefined, set scaleX of action game object to scaleY of action game object, to keep size ratio.
    • align : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.text : Space between text game object and action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    • multiple : Set true to select multiple files.
    "},{"location":"ui-fileselectorbutton/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFileSelectorButton extends RexPlugins.UI.FileSelectorButton {\nconstructor(scene, config) {\nsuper(scene, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var button = new MyFileSelectorButton(scene, config);\n
    "},{"location":"ui-fileselectorbutton/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-fileselectorbutton/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = label.getElement('background');\n
      • Icon game object
        var icon = label.getElement('icon');\n
      • Text game object
        var textObject = label.getElement('text');\n
      • Action icon game object
        var action = label.getElement('action');\n
      • File chooser game object
        var fileChooser = label.getElement('fileChooser');\n
    • Get by name
      var gameObject = label.getElement('#' + name);\n// var gameObject = label.getElement('#' + name, recursive);\n
      or
      var gameObject = label.getByName(name);\n// var gameObject = label.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-fileselectorbutton/#selected-files","title":"Selected files","text":"
    var files = fileChooser.files;\n
    • files : Array of file object.
    "},{"location":"ui-fileselectorbutton/#set-accept-filter","title":"Set accept filter","text":"
    fileChooser.setAccept(accept);\n
    • accept : A filter for what file types the user can pick from the file input dialog box.
      • 'image/*' : The user can pick all image files.
      • 'audio/*' : The user can pick all sound files.
      • 'video/*' : The user can pick all video files.
      • file_extension : Specify the file extension(s) (e.g: .gif, .jpg, .png, .doc) the user can pick from.
    "},{"location":"ui-fileselectorbutton/#multiple-files","title":"Multiple files","text":"
    • Enable
      fileChooser.setMultiple();\n
    • Disable
      fileChooser.setMultiple(false);\n
    "},{"location":"ui-fileselectorbutton/#events","title":"Events","text":"
    • Selected file(s) changed
      button.on('select', function(files, button) {        var file = files[0];\nvar url = URL.createObjectURL(file);\n// ...\n})\n
    "},{"location":"ui-fileselectorbutton/#load-file-to-cache","title":"Load file to cache","text":"
    fileChooser.loadFile(file, loaderType, key);\n// fileChooser.loadFile(file, loaderType, key, cahceType);\n

    or

    fileChooser.loadFilePromise(file, loaderType, key, cahceType)\n.then(function(content) {\n\n})\n
    • file : File object, see Events
    • loaderType : image, text, binary, ... See Loader
    • key : Unique string key.
    • cahceType :
      • undefined : Use default value.
    • content : Content of file.
    "},{"location":"ui-fileselectorbutton/#create-object-url","title":"Create object URL","text":"
    • Create object url
      var objectURL = URL.createObjectURL(file);\n
    • Release object url
      URL.createObjectURL(objectURL);\n
    "},{"location":"ui-fileselectorbutton/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"ui-fileselectorbutton/#other-properties","title":"Other properties","text":"

    See label object, sizer object, base sizer object, container-lite.

    "},{"location":"ui-fixwidthbuttons/","title":"Fix-width buttons","text":""},{"location":"ui-fixwidthbuttons/#introduction","title":"Introduction","text":"

    A container with a group of fix-width buttons.

    • Author: Rex
    • Game object
    "},{"location":"ui-fixwidthbuttons/#live-demos","title":"Live demos","text":"
    • Checkboxes/radio
    • Indent left
    • Indent top
    "},{"location":"ui-fixwidthbuttons/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-fixwidthbuttons/#install-plugin","title":"Install plugin","text":""},{"location":"ui-fixwidthbuttons/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add fix-Width buttons object
      var buttons = scene.rexUI.add.fixWidthButtons(config);\n
    "},{"location":"ui-fixwidthbuttons/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add fix-Width buttons object
      var buttons = scene.rexUI.add.fixWidthButtons(config);\n
    "},{"location":"ui-fixwidthbuttons/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { FixWidthButtons } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add fix-Width buttons object
      var buttons = new FixWidthButtons(scene, config);\nscene.add.existing(buttons);\n
    "},{"location":"ui-fixwidthbuttons/#add-buttons-object","title":"Add Buttons object","text":"
    var buttons = scene.rexUI.add.fixWidthButtons({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\n// background: backgroundGameObject,\n\nbuttons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\n// rtl: false,\nalign: 0,\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\n// space: 0,\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0,\n//     item: 0, line: 0,\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n// eventEmitter: this,\n// groupName: undefined,\n\n// buttonsType: undefined,\n// setValueCallback: undefined,  // or setButtonStateCallback: undefined\n// setValueCallbackScope: undefined  // or setButtonStateCallbackScope: undefined\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • buttons : 1d/2d array of button game objects.
    • align : Align children of a line.
      • 0, 'left' : Align children of a line to left/top side.
      • 1, 'right' : Align children of a line to right/bottom side.
      • 2, 'center' : Align children of a line to ceter.
      • 3, 'justify', 'justify-left' : If remainder space is less or equal than 25%, then justify children. Else align children to left/top side.
      • 4, 'justify-right' : If remainder space is less or equal than 25%, then justify children. Else align children to right/bottom side.
      • 5, 'justify-cneter' : If remainder space is less or equal than 25%, then justify children. Else align children to center.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • space :
      • A number: Space between 2 button game objects.
      • An object: Padding of button game objects.
        • space.left, space.right, space.top, space.bottom : Space of bounds.
        • space.item : Space betwen each child of a line.
        • space.line : Space between each line.
        • space.indentLeftOdd, space.indentLeftEven : Indent at each odd/even line.
        • space.indentTopOdd, space.indentTopEven : Indent at each odd/even item.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • eventEmitter : Dispatch buttons' touch events to other game obhect, default is this buttons game object.
    • groupName : Optional group name for argument of touch events.
    • buttonsType : Type/behavior of these buttons.
      • undefined : No extra behavior, default value.
      • 'checkboxes' : Set these buttons to checkboxes.
      • 'radio' : Set these buttons to radio.
    • setValueCallback or setButtonStateCallback : Callback to set value of a button.
      • undefined : No callback, default value.
      • A function object.
        function(button, value, previousValue) {\n// ...\n}\n
        • button : Button game object.
        • value: true, or false.
        • previousValue : true, or false.
    "},{"location":"ui-fixwidthbuttons/#custom-class","title":"Custom class","text":"
    • Define class
      class MyButtons extends RexPlugins.UI.FixWidthButtons {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var buttons = new MyButtons(scene, config);\n
    "},{"location":"ui-fixwidthbuttons/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    buttons.layout();\n

    See also - dirty

    "},{"location":"ui-fixwidthbuttons/#other-properties","title":"Other properties","text":"

    See sizer object

    "},{"location":"ui-fixwidthbuttons/#events","title":"Events","text":"
    • Click button
      buttons.on('button.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.click', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
      • groupName : Optional group name.
      • button : Triggered button game object.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over button
      buttons.on('button.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.over', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Pointer-out button
      buttons.on('button.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      or
      buttons.on('button.out', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Enable button's input
      buttons.on('button.enable', function(button, index) {\n// ...\n}, scope);\n
      or
      buttons.on('button.enable', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    • Disable button's input
      buttons.on('button.disalbe', function(button, index) {\n// ...\n}, scope);\n
      or
      buttons.on('button.disalbe', function(button, groupName, index, pointer, event) {\n// ...\n}, scope);\n
    "},{"location":"ui-fixwidthbuttons/#emit-button-click-event","title":"Emit button click event","text":"
    buttons.emitButtonClick(index);\n
    • index : Index of triggered button game object, or a button game object.
    "},{"location":"ui-fixwidthbuttons/#enabledisable-input-of-button","title":"Enable/disable input of button","text":"
    • Enable a button's input
      buttons.setButtonEnable(index);\n// buttons.setButtonEnable(index, true);\n
      • index : Index of triggered button game object, or a button game object.
    • Enable all buttons' input
      buttons.setButtonEnable();\n// buttons.setButtonEnable(true);\n
    • Disable
      buttons.setButtonEnable(index, true);\n
      • index : Index of triggered button game object, or a button game object.
    • Disable all buttons' input
      buttons.setButtonEnable(false);\n
    • Toggle
      buttons.toggleButtonEnable(index);\n
    • Toggle all buttons's input
      buttons.toggleButtonEnable();\n
    • Get button's input enable
      var enabled = bottons.getButtonEnable(index);\n
    "},{"location":"ui-fixwidthbuttons/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = buttons.getElement('background');\n
      • Button game objects
        var buttonObjects = buttons.getElement('buttons');\n
        or
        var buttonObject = buttons.getButton(index);\n
        or
        var buttonObjects = buttons.getElement('buttons[0]'); // First button\n
    • Get by name
      var gameObject = buttons.getElement('#' + name);\n// var gameObject = buttons.getElement('#' + name, recursive);\n
      or
      var gameObject = buttons.getByName(name);\n// var gameObject = buttons.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-fixwidthbuttons/#add-child","title":"Add child","text":"
    • Add button child
      buttons.addButton(gameObject)\n
      • gameObject : A game object, or an array of game objects.
    • Add non-button child, see fixWidthSizer.add() method.
      buttons.add(gameObject,\n{\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nkey: undefined,\nindex: undefined\n}\n)\n
    "},{"location":"ui-fixwidthbuttons/#remove-child","title":"Remove child","text":"
    • Remove button child
      buttons.removeButton(gameObject, destroyChild);\n
      • gameObject :
        • Game object, or array of game objects : Button game object.
        • A number, or array of numbers : Index of button game object.
        • A string, or array of strings : Name of button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove all buttton children
      buttons.clearButtons(destroyChild);\n
      • destroyChild : Set true to destroy button game objects.
    • Remove a button or non-button child, see fixWidthSizer.remove() method.
      buttons.remove(gameObject, destroyChild);\n
    • Remove all button or non-button children, see fixWidthSizer.remove() method.
      buttons.removeAll(destroyChild);\n
    "},{"location":"ui-fixwidthbuttons/#showhide-button","title":"Show/hide button","text":"

    The same as for each button of buttons.

    "},{"location":"ui-fixwidthbuttons/#for-each-button","title":"For each button","text":"

    The same as for each button of buttons.

    "},{"location":"ui-fixwidthbuttons/#checkboxesradio","title":"Checkboxes/radio","text":"

    The same as checkboxes/radio of buttons.

    "},{"location":"ui-fixwidthsizer/","title":"Fix-width sizer","text":""},{"location":"ui-fixwidthsizer/#introduction","title":"Introduction","text":"

    Layout children game objects into lines.

    • Author: Rex
    • Game object
    "},{"location":"ui-fixwidthsizer/#live-demos","title":"Live demos","text":"
    • Fix-width sizer
    • Scrollable, fix-width sizer
    • Indent
    • Drag-drop item
    • Set children interactive
    • vertical & horizontal
    "},{"location":"ui-fixwidthsizer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-fixwidthsizer/#install-plugin","title":"Install plugin","text":""},{"location":"ui-fixwidthsizer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add sizer object
      var sizer = scene.rexUI.add.fixWidthSizer(config);\n
    "},{"location":"ui-fixwidthsizer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sizer object
      var sizer = scene.rexUI.add.fixWidthSizer(config);\n
    "},{"location":"ui-fixwidthsizer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { FixWidthSizer } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add sizer object
      var sizer = new FixWidthSizer(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-fixwidthsizer/#add-sizer-object","title":"Add sizer object","text":"
    var sizer = scene.rexUI.add.fixWidthSizer({\n// x: 0,\n// y: 0,\n// anchor: undefined,    \n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// orientation: 0,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0,\n//     item: 0, line: 0, \n//     indentLeftOdd: 0, indentLeftEven: 0,\n// },\n\n// rtl: false,\n// align: 0,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.fixWidthSizer(x, y, {\n// width: 2,\n// height: 2\n// orientation: 0,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0,\n//     item: 0, line: 0,\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// rtl: false,\n// align: 0,\n\n// name: '',\n// draggable: false\n});\n

    or

    var sizer = scene.rexUI.add.fixWidthSizer(x, y, width, height, {\n// orientation: 0,\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0,\n//     item: 0, line: 0\n// },\n\n// rtl: false,\n// align: 0,\n\n// name: '',\n// draggable: false\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Orientation of the sizer.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right. Default value is 0.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space betwen each child of a line.
      • space.line : Space between each line.
      • space.indentLeftOdd, space.indentLeftEven : Indent at each odd/even line.
      • space.indentTopOdd, space.indentTopEven : Indent at each odd/even item.
    • rtl : Order of children in each line.
      • false : Place children from left-to-right/top-to-bottom, default value.
      • true : Place children from right-to-left/bottom-to-top.
    • align : Align children of a line.
      • 0, 'left' : Align children of a line to left/top side.
      • 1, 'right' : Align children of a line to right/bottom side.
      • 2, 'center' : Align children of a line to ceter.
      • 3, 'justify', 'justify-left' : If remainder space is less or equal than 25%, then justify children. Else align children to left/top side.
      • 4, 'justify-right' : If remainder space is less or equal than 25%, then justify children. Else align children to right/bottom side.
      • 5, 'justify-cneter' : If remainder space is less or equal than 25%, then justify children. Else align children to center.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-fixwidthsizer/#custom-class","title":"Custom class","text":"
    • Define class
      class MySizer extends RexPlugins.UI.FixWidthSizer {\nconstructor(scene, x, y, minWidth, minHeight, orientation, space, config) {\nsuper(scene, x, y, minWidth, minHeight, orientation, space, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var sizer = new MySizer(scene, x, y, minWidth, minHeight, orientation, space, config);\n
    "},{"location":"ui-fixwidthsizer/#add-background","title":"Add background","text":"
    sizer.addBackground(child);\n

    or

    sizer.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    "},{"location":"ui-fixwidthsizer/#add-child","title":"Add child","text":"

    Add a game obejct to sizer

    sizer.add(child);\n

    or

    sizer.add(child,\n{\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nkey: undefined,\nindex: undefined,\noffsetX: 0,\noffsetY: 0,\noffsetOriginX: 0,\noffsetOriginY: 0,\n}\n);\n

    or

    sizer.add(child, padding, key, index);\n
    • child : A game object
    • padding : Add space between bounds. Default is 0.
      • A number for left/right/top/bottom bounds
      • Or a plain object
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
      • items : Reserved key, for all children item.
    • offsetX, offsetOriginX : Apply offset offsetX + offsetOriginY * width to x coordinate after alignment.
    • offsetY, offsetOriginY : Apply offset offsetY + offsetOriginY * height to y coordinate after alignment.
    • index : Insert child to.
      • undefined : Insert child at last.
    "},{"location":"ui-fixwidthsizer/#add-multiple","title":"Add multiple","text":"
    sizer.add(gameObjects, config);\n
    • gameObjects : Array of child game objects
    • config : See config of add-child
    "},{"location":"ui-fixwidthsizer/#insert-child","title":"Insert child","text":"
    sizer.insert(index, child, {\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nkey: undefined,\n}\n);\n

    or

    sizer.insert(index, child, padding, key);\n
    "},{"location":"ui-fixwidthsizer/#insert-at-position","title":"Insert at position","text":"
    sizer.insertAtPosition(x, y, child, {\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nkey: undefined,\n}\n);\n

    or

    sizer.insertAtPosition(x, y, index, child, padding, key);\n
    "},{"location":"ui-fixwidthsizer/#add-new-line","title":"Add new line","text":"
    sizer.addNewLine();\n
    "},{"location":"ui-fixwidthsizer/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    sizer.layout();\n

    See also - dirty

    "},{"location":"ui-fixwidthsizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-fixwidthsizer/#remove-child","title":"Remove child","text":"
    • Remove a child
      sizer.remove(child);\n
    • Remove and destroy a child
      sizer.remove(child, true);\n
    • Remove all children
      sizer.removeAll();\n
    • Remove and destroy all children
      sizer.removeAll(true);\n
    • Remove all children and backgrounds
      sizer.clear();\n
    • Remove and destroy all children and backgrounds
      sizer.clear(true);\n
    • Remove from parent sizer
      sizer.removeFromParentSizer();\n
    "},{"location":"ui-fixwidthsizer/#sort-children","title":"Sort children","text":"
    • Sort by data
      sizer.sortChildrenByData(key, descending).layout();\n
      • key : Data key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by property of child
      sizer.sortChildrenByProperty(key, descending).layout();\n
      • key : Property key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by callback
      sizer.sortChildren(function(childA, childB){\n// var valueA = childA.getData(key);\n// var valueB = childB.getData(key);\n// return valueB - valueA\n}).layout();\n
      • childA, childB : 2 children of this size
    "},{"location":"ui-fixwidthsizer/#get-element","title":"Get element","text":"
    • Get element
      • All children items
        var items = sizer.getElement('items');\n
    • Get by name
      var gameObject = sizer.getElement('#' + name);\n// var gameObject = sizer.getElement('#' + name, recursive);\n
      or
      var gameObject = sizer.getByName(name);\n// var gameObject = sizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-fixwidthsizer/#get-child-index","title":"Get child index","text":"
    var index = sizer.getChildIndex(child);\n
    • index : A number, or null.
    "},{"location":"ui-fixwidthsizer/#other-properties","title":"Other properties","text":"

    See base-sizer object.

    "},{"location":"ui-folder/","title":"Folder","text":""},{"location":"ui-folder/#introduction","title":"Introduction","text":"

    A container with a title, foldable child, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-folder/#live-demos","title":"Live demos","text":"
    • Scrollable folders
    • Draggable folder
    • Nested folders
    "},{"location":"ui-folder/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-folder/#install-plugin","title":"Install plugin","text":""},{"location":"ui-folder/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add folder object
      var folder = scene.rexUI.add.folder(config);\n
    "},{"location":"ui-folder/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add folder object
      var folder = scene.rexUI.add.folder(config);\n
    "},{"location":"ui-folder/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Folder } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add folder object
      var folder = new Folder(scene, config);\nscene.add.existing(folder);\n
    "},{"location":"ui-folder/#add-folder-object","title":"Add folder object","text":"
    var folder = scene.rexUI.add.folder({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\ntitle: titleGameObject,    child: childGameObject,\n// customChildOrigin: false,\n\ntoggleByTarget: undefined,\ntoggleClickConfig: {\nmode:'pointerup',\nclickInterval: 100,\nthreshold: undefined,\n},\n\nalign: {\ntitle: 'left',\nchild: 'left',\n},\n\nexpand: {\ntitle: true,\nchild: true,\n},\n\nspace: { left: 0, right:0, top:0, bottom:0, item:0,\n\ntitleLeft: 0, titleRight: 0, titleTop: 0, titleBottom: 0,\nchildLeft: 0, childRight: 0, childTop: 0, childBottom: 0,\n},\n\ntransition: {\nduration: 200,\nexpandCallback: undefined,\ncollapseCallback: undefined,\n},\n\nreLayoutTarget: undefined,\n\nonExpandStart: undefined,\nonExpandComplete: undefined,\nonCollapseStart: undefined,\nonCollapseComplete: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nitem: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of folder.
    • title : Game object of title, required.
    • child : Game object of child, required.
    • customChildOrigin :
      • false : Set origin of child to 0, or 1 (if rtl is set to true). Default behavior.
      • true : Don't change origin of child.
    • toggleByTarget : Toggle expanding/collapsing by clicking this target game object
      • undefined : Toggle by clicking title game object.
    • toggleClickConfig : Configuration of clicking behavior
      • undefined : Use default configuration.
    • align.title, align.child : Alignment of title, child game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top. Default behavior.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • expand.title, expand.child : Expand width/height of title, child game objects.
      • true : Expand width/heigh. Default behavior.
      • false : Use origin width/height.
    • transition : Configuration of expanding/collapsing transition.
      • transition.duration : Duration of expanding/collapsing transition.
      • transition.expandCallback : Callback invoked when expading child. Default behavior is scale-up.
      • transition.collapseCallback : Callback invoked when collapsing child. Default behavior is scale-down.
    • reLayoutTarget : Layout topmost sizer when expanding/collapsing start.
      • undefined : Topmost sizer will be layouted again. Default behavior.
      • A sizer : Layout this sizer.
    • onExpandStart : Callback invoked when expanding start. Register this callback on 'expand.start' event.
      function(folder) {  }\n
    • onExpandComplete : Callback invoked when expanding complete. Register this callback on 'expand.complete' event.
      function(folder) {  }\n
    • onCollapseStart : Callback invoked when collapsing start. Register this callback on 'collapse.start' event.
      function(folder) {  }\n
    • onCollapseComplete : Callback invoked when collapsing complete. Register this callback on 'collapse.complete' event.
      function(folder) {  }\n
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.text : Space between text game object and action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-folder/#custom-class","title":"Custom class","text":"
    • Define class
      class MyFolder extends RexPlugins.UI.Folder {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var folder = new MyFolder(scene, config);\n
    "},{"location":"ui-folder/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    folder.layout();\n

    See also - dirty

    Note

    Layout topmost sizer when expanding/collapsing start.

    "},{"location":"ui-folder/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = folder.getElement('background');\n
      • Title game object
        var title = folder.getElement('title');\n
      • Child game object
        var child = folder.getElement('child');\n
    • Get by name
      var gameObject = folder.getElement('#' + name);\n// var gameObject = folder.getElement('#' + name, recursive);\n
      or
      var gameObject = folder.getByName(name);\n// var gameObject = folder.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-folder/#expandcollapse","title":"Expand/collapse","text":"
    • Expand, will re-layout from topmost sizer
      folder.expand();\n// folder.expand(duration);\n
      folder.expand(0);  // Immediately, won't invoke expandCallback\n
    • Collapse, will re-layout from topmost sizer
      folder.collapse();\n// folder.collapse(duration);\n
      folder.collapse(0);  // Immediately, won't invoke collapseCallback\n
    • Toggle, will re-layout from topmost sizer
      folder.toggle();\n// folder.toggle(duration);\n
      folder.toggle(0);  // Immediately, won't invoke expandCallback/collapseCallback\n
    • Set expanded state without re-layouting
      folder.setExpandedState(expanded);  // true, or false\n
    • Get expanded state
      var expanded = folder.expanded;\n
      • expanded : Initial value is undefined
    "},{"location":"ui-folder/#transition-callbacks","title":"Transition callbacks","text":"
    • Set transition callbacks
      folder.setExpandCallback(callback);\nfolder.setCollapseCallback(callback);\n
      • callback :
        function(gameObject, duration) {\n}\n
        • gameObject : Child game object
    • Transition duration
      • Set
        folder.setTransitionDuration(duration);\n
      • Get
        var duration = folder.transitionDuration;\n
    "},{"location":"ui-folder/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-folder/#events","title":"Events","text":"
    • On expand-start
      folder.on('expand.start', function(folder){\n\n})\n
      title.on('folder.expand', function(folder){\n\n})\n
      child.on('folder.expand', function(folder){\n\n})\n
    • On expand-complete
      folder.on('expand.complete', function(folder){\n\n})\n
    • On collapse-start
      folder.on('collapse.start', function(folder){\n\n})\n
      title.on('folder.collapse', function(folder){\n\n})\n
      child.on('folder.collapse', function(folder){\n\n})\n
    • On collapse-complete
      folder.on('collapse.complete', function(folder){\n\n})\n
    "},{"location":"ui-gridbuttons/","title":"Grid buttons","text":""},{"location":"ui-gridbuttons/#introduction","title":"Introduction","text":"

    A container with a group of buttons in grids.

    • Author: Rex
    • Game object
    "},{"location":"ui-gridbuttons/#live-demos","title":"Live demos","text":"
    • Number pad
    • Checkboxes/radio
    "},{"location":"ui-gridbuttons/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-gridbuttons/#install-plugin","title":"Install plugin","text":""},{"location":"ui-gridbuttons/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add buttons object
      var buttons = scene.rexUI.add.gridButtons(config);\n
    "},{"location":"ui-gridbuttons/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add buttons object
      var buttons = scene.rexUI.add.gridButtons(config);\n
    "},{"location":"ui-gridbuttons/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { GridButtons } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add buttons object
      var buttons = new GridButtons(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-gridbuttons/#add-grid-sizer-object","title":"Add grid sizer object","text":"
    var buttons = scene.rexUI.add.gridButtons({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\n// background: backgroundGameObject,\n\nbuttons: [\n[buttonGameObject, buttonGameObject, buttonGameObject, ...],\n[buttonGameObject, buttonGameObject, buttonGameObject, ...],\n[buttonGameObject, buttonGameObject, buttonGameObject, ...],\n...\n],\n// row: 0, \n// column: 0,   // col: 0\n// createCellContainerCallback: function(scene, x, y) {\n//       return cellContainer;\n// },    \nexpand: true,\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0     // [0, 0, 0]\n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n// eventEmitter: this,\n// groupName: undefined,\n\n// buttonsType: undefined,\n// setValueCallback: undefined,  // or setButtonStateCallback: undefined\n// setValueCallbackScope: undefined  // or setButtonStateCallbackScope: undefined\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width : Minimum width. i.e. Width of this gridButtons will larger then this value.
    • height : Minimum height. i.e. Hieght of this gridButtons will larger then this value.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • buttons : 2d array of button game objects, or create buttons via row, column(or col), and createCellContainerCallback.
    • createCellContainerCallback : Callback to create buttons.
      function(scene, x, y) {\nreturn cellContainer;\n}\n
    • expand : Set true to expand width and height of buton game objects.
    • space : Space around this sizer, and space between columns/rows
      • space.left, space.right, space.top, space.bottom : Space around this sizer.
      • space.column : Space between 2 columns
        • A number
        • A number array
      • space.row : Space between 2 rows
        • A number
        • A number array
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • eventEmitter : Dispatch buttons' touch events to other game object, default is this buttons game object.
    • groupName : Optional group name for argument of touch events.
    • buttonsType : Type/behavior of these buttons.
      • undefined : No extra behavior, default value.
      • 'checkboxes' : Set these buttons to checkboxes.
      • 'radio' : Set these buttons to radio.
    • setValueCallback or setButtonStateCallback : Callback to set value of a button.
      • undefined : No callback, default value.
      • A function object.
        function(button, value, previousValue) {\n// ...\n}\n
        • button : Button game object.
        • value: true, or false.
        • previousValue : true, or false.
    "},{"location":"ui-gridbuttons/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGridButtons extends RexPlugins.UI.GridButtons {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var buttons = new MyGridButtons(scene, config);\n
    "},{"location":"ui-gridbuttons/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    buttons.layout();\n

    See also - dirty

    "},{"location":"ui-gridbuttons/#other-properties","title":"Other properties","text":"

    See grid sizer object.

    "},{"location":"ui-gridbuttons/#events","title":"Events","text":"

    The same as events of buttons.

    "},{"location":"ui-gridbuttons/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = buttons.getElement('background');\n
      • Button game objects
        var buttonObjects = buttons.getElement('buttons');\n
        or
        var buttonObject = buttons.getButton(index);\n
        or
        var buttonObjects = buttons.getElement('buttons[0]'); // First button\n
    • Get by name
      var gameObject = buttons.getElement('#' + name);\n// var gameObject = buttons.getElement('#' + name, recursive);\n
      or
      var gameObject = buttons.getByName(name);\n// var gameObject = buttons.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-gridbuttons/#showhide-button","title":"Show/hide button","text":"

    The same as for each button of buttons.

    "},{"location":"ui-gridbuttons/#for-each-button","title":"For each button","text":"

    The same as for each button of buttons.

    "},{"location":"ui-gridbuttons/#checkboxesradio","title":"Checkboxes/radio","text":"

    The same as checkboxes/radio of buttons.

    "},{"location":"ui-gridsizer/","title":"Grid sizer","text":""},{"location":"ui-gridsizer/#introduction","title":"Introduction","text":"

    Layout children game objects in grids.

    • Author: Rex
    • Game object
    "},{"location":"ui-gridsizer/#live-demos","title":"Live demos","text":"
    • Create cell-containers
    • Scrollable grids
    • Add new row
    • Add new column
    • Full viewport
    • Set children interactive
    • Destroy cell
    • Reset grid
    "},{"location":"ui-gridsizer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-gridsizer/#install-plugin","title":"Install plugin","text":""},{"location":"ui-gridsizer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add sizer object
      var sizer = scene.rexUI.add.gridSizer(config);\n
    "},{"location":"ui-gridsizer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sizer object
      var sizer = scene.rexUI.add.gridSizer(config);\n
    "},{"location":"ui-gridsizer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { GridSizer } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add sizer object
      var sizer = new GridSizer(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-gridsizer/#add-grid-sizer-object","title":"Add grid sizer object","text":"
    var gridSizer = scene.rexUI.add.gridSizer({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\ncolumn: 0,  // col: 0\nrow: 0,\n// columnProportions: undefined,\n// rowProportions: undefined,\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0,    // [0, 0, 0]\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// createCellContainerCallback: function(scene, x, y, config) {\n//     config.expand = true;\n//     return cellContainer;\n// },\n\n// name: '',\n// draggable: false\n});\n

    or

    var gridSizer = scene.rexUI.add.gridSizer(x, y, {\ncolumn: 0,  // col: 0\nrow: 0,\n// columnProportions: undefined,\n// rowProportions: undefined,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0,    // [0, 0, 0]\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// createCellContainerCallback: function(scene, x, y, config) {\n//     config.expand = true;\n//     return cellContainer;\n// },\n\n// width: undefined,\n// height: undefined\n});\n

    or

    var gridSizer = scene.rexUI.add.gridSizer(x, y, width, height, {\ncolumn: 0,   // col: 0\nrow: 0,\n// columnProportions: undefined,\n// rowProportions: undefined,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0,    // [0, 0, 0]\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// createCellContainerCallback: function(scene, x, y, config) {\n//     config.expand = true;\n//     return cellContainer;\n// },\n});\n

    or

    var gridSizer = scene.rexUI.add.gridSizer(x, y, width, height, column, row, {\n// space: {\n//     left: 0, right: 0, top: 0, bottom:0,\n//     column: 0, // [0, 0, 0]\n//     row: 0,    // [0, 0, 0]\n//     indentLeftOdd: 0, indentLeftEven: 0,\n//     indentTopOdd: 0, indentTopEven: 0,\n// },\n\n// createCellContainerCallback: function(scene, x, y, config, gridSizer) {\n//     config.expand = true;\n//     return cellContainer;\n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width : Minimum width. i.e. Width of this gridSizer will larger then this value.
    • height : Minimum height. i.e. Hieght of this gridSizer will larger then this value.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • column, or col : Amount of column grids.
    • row : Amount of row grids.
    • columnProportions, rowProportions : Proportion of each column/row.
      • Number : Apply this number proportion to each column/row
      • Number array : Apply proportion of column/row through elements of this number array.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.column : Space between 2 columns
        • A number
        • A number array
      • space.row : Space between 2 rows
        • A number
        • A number array
      • space.indentLeftOdd, space.indentLeftEven : Indent at each odd/even row.
      • space.indentTopOdd, space.indentTopEven : Indent at each odd/even column.
    • createCellContainerCallback : Callback to create container(sizer) of each cell.
      function(scene, x, y, config) {\nreturn cellContainer;\n}\n
      • x, y : Column, row index of this cell.
      • config : Config of adding child
        config.align = 'center';\nconfig.padding = {left: 0, right: 0, top: 0, bottom: 0};\nconfig.expand = false;\nconfig.key = undefined;\n
      • cellContainer : Return a game object for this cell.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-gridsizer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGridSizer extends RexPlugins.UI.GridSizer {\nconstructor(scene, x, y, minWidth, minHeight, column, row) {\nsuper(scene, x, y, minWidth, minHeight, column, row);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var gridSizer = new MyGridSizer(scene, x, y, minWidth, minHeight, column, row);\n
    "},{"location":"ui-gridsizer/#add-background","title":"Add background","text":"
    gridSizer.addBackground(child);\n

    or

    gridSizer.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    "},{"location":"ui-gridsizer/#add-child","title":"Add child","text":"

    Add a game obejct to grid sizer

    gridSizer.add(child, column, row);\n

    or

    gridSizer.add(child,\n{\ncolumn: 0,\nrow: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,        // expand: {width, height}\nkey: undefined,\noffsetX: 0,\noffsetY: 0,\noffsetOriginX: 0,\noffsetOriginY: 0,\n}\n);\n

    or

    gridSizer.add(child, column, row, align, padding, expand, key);\n
    • child : A game object
    • column, row : Index of grid to add.
      • column and row are numbers : Insert game object to cell (column, row).
        • Do nothing if that cell has item already.
      • column and row are undefined : Search each column, each row to find an empty cell for inserting.
        • Add an new row (gridSizer.addEmptyRow()) if last row was full, then find an empty cell in new row.
      • column is undefined, and row is true : Search each row, each column to find an empty cell for inserting.
        • Add an new column (gridSizer.addEmptyColumn()) if last column was full, then find an empty cell in new column.
      • column is a number, and row is undefined : Search each row of column column to find an empty cell for inserting.
        • Add an new row (gridSizer.addEmptyRow()) if last row was full, then find an empty cell in new row.
      • column is undefined and row is a number : Search each column of row row to find an empty cell for inserting.
        • Add an new column (gridSizer.addEmptyColumn()) if last column was full, then find an empty cell in new column.
    • align :
      • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
      • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
      • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center.
      • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center.
    • padding : Add space between bounds. Default is 0.
      • A number for left/right/top/bottom bounds
      • Or a plain object
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • expand :
      • Boolean value
        • true : Expand width and height of child. Default value.
        • false : Don't expand width or height of child.
      • A plain object
        • {width: true} : Only expand width of child.
        • {height: true} : only expand height of child.
        • {width: true, height: true} : Expand width and height of child.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    • offsetX, offsetOriginX : Apply offset offsetX + offsetOriginY * width to x coordinate after alignment.
    • offsetY, offsetOriginY : Apply offset offsetY + offsetOriginY * height to y coordinate after alignment.
    "},{"location":"ui-gridsizer/#add-multiple","title":"Add multiple","text":"
    sizer.add(gameObjects, config);\n
    • gameObjects : Array of child game objects
    • config : See config of add-child
    "},{"location":"ui-gridsizer/#insert-empty-rowcolumn","title":"Insert empty row/column","text":"
    • Insert an empty row
      gridSizer.insertEmptyRow(rowIndex);\n// gridSizer.insertEmptyRow(rowIndex, proportion, space);\n
      • proportion : Proportion of this new row.
        • undefined : Use proportion of 1st row as default value.
      • space : Space between this new row and previous row.
        • undefined : Use space of 1st row as default value.
    • Add an empty row
      gridSizer.addEmptyRow();\n// gridSizer.addEmptyRow(rowIndex, proportion, space);\n
    • Insert an empty column
      gridSizer.insertEmptyColumn(colIndex);\n// gridSizer.insertEmptyColumn(colIndex, proportion, space);\n
      • proportion : Proportion of this new column.
        • undefined : Use proportion of 1st column as default value.
      • space : Space between this new column and previous column.
        • undefined : Use space of 1st column as default value.
    • Add an empty row
      gridSizer.addEmptyColumn();\n// gridSizer.addEmptyColumn(colIndex, proportion, space);\n
    "},{"location":"ui-gridsizer/#proportion","title":"Proportion","text":"

    Set proportion of each column or row via

    gridSizer.setColumnProportion(columnIndex, proportion);\ngridSizer.setRowProportion(rowIndex, proportion);\n
    "},{"location":"ui-gridsizer/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    gridSizer.layout();\n

    See also - dirty

    "},{"location":"ui-gridsizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-gridsizer/#grid-index-child","title":"Grid index <-> child","text":"
    • Grid index -> child
      var child = gridSizer.getChildAt(columnIndex, rowIndex);\n
    • Child -> grid index
      var gridIndex = gridSizer.childToGridIndex(child);\n// var gridIndex = gridSizer.childToGridIndex(child, out);\n
      • gridIndex : {x, y}, or null if child is not belong this sizer.
    "},{"location":"ui-gridsizer/#remove-child","title":"Remove child","text":"
    • Remove a child
      gridSizer.remove(child);\n
      or
      gridSizer.removeAt(columnIndex, rowIndex);\n
    • Remove and destroy a child
      gridSizer.remove(child, true);\n
      or
      gridSizer.removeAt(columnIndex, rowIndex, true);\n
    • Remove all children
      gridSizer.removeAll();\n
    • Remove and destroy all children
      gridSizer.removeAll(true);\n
    • Remove all children and backgrounds
      gridSizer.clear();\n
    • Remove and destroy all children and backgrounds
      gridSizer.clear(true);\n
    • Remove from parent sizer
      sizer.removeFromParentSizer();\n
    "},{"location":"ui-gridsizer/#sort-children","title":"Sort children","text":"
    • Sort by data
      gridSizer.sortChildrenByData(key, descending).layout();\n
      • key : Data key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by property of child
      gridSizer.sortChildrenByProperty(key, descending).layout();\n
      • key : Property key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by callback
      gridSizer.sortChildren(function(childA, childB){\n// var valueA = childA.getData(key);\n// var valueB = childB.getData(key);\n// return valueB - valueA\n}).layout();\n
      • childA, childB : 2 children of this size
    "},{"location":"ui-gridsizer/#grid-size","title":"Grid size","text":"
    • Amount of column
      var columnCount = gridSizer.columnCount;\n
    • Amount of row
      var rowCount = gridSizer.rowCount;\n
    • Amount of grid = columnCount * rowCount
      var gridCount = gridSizer.gridCount;\n
    "},{"location":"ui-gridsizer/#get-element","title":"Get element","text":"
    • Get element
      • All children items
        var items = gridSizer.getElement('items');\n
    • Get by name
      var gameObject = gridSizer.getElement('#' + name);\n// var gameObject = gridSizer.getElement('#' + name, recursive);\n
      or
      var gameObject = gridSizer.getByName(name);\n// var gameObject = gridSizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-gridsizer/#get-child-index","title":"Get child index","text":"
    var index = sizer.getChildIndex(child);\n
    • index : A number, or null.
    "},{"location":"ui-gridsizer/#reset-grid","title":"Reset grid","text":"
    sizer.resetGrid(column, row, columnProportions, rowProportions, space);\n
    • column : Amount of column grids.
    • row : Amount of row grids.
    • columnProportions, rowProportions : Proportion of each column/row.
      • Number : Apply this number proportion to each column/row
      • Number array : Apply proportion of column/row through elements of this number array.
    • space :
      • space.column : Space between 2 columns
        • A number
        • A number array
      • space.row : Space between 2 rows
        • A number
        • A number array

    Note

    Children game objects will be removed without destroyed.

    Note

    Will invoke createCellContainerCallback to create cellContainer of each cell.

    "},{"location":"ui-gridsizer/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-gridtable/","title":"Grid table","text":""},{"location":"ui-gridtable/#introduction","title":"Introduction","text":"

    A container with a grid table, slider, and scroller.

    • Author: Rex
    • Game object
    "},{"location":"ui-gridtable/#live-demos","title":"Live demos","text":"
    • Grid table
    • Varying cell size
    • Messages
      • Demo 1
      • Demo 2
      • Demo 3
    • Sizer cell:
      • Demo 1
      • Demo 2
    • Click child of cell
    • Two sliders
    • Separator
    • Modal
    • Fixed cell size
    • Drag item
    • Layer + mask padding
    • Fade-out-destroy cell
    • Custom mask
    "},{"location":"ui-gridtable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-gridtable/#install-plugin","title":"Install plugin","text":""},{"location":"ui-gridtable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add table object
      var table = scene.rexUI.add.gridTable(config);\n
    "},{"location":"ui-gridtable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add table object
      var table = scene.rexUI.add.gridTable(config);\n
    "},{"location":"ui-gridtable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { GridTable } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add table object
      var table = new GridTable(scene, config);\nscene.add.existing(table);\n
    "},{"location":"ui-gridtable/#add-table-object","title":"Add table object","text":"
    var table = scene.rexUI.add.gridTable({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// scrollMode: 0,\n\n// Elements\nbackground: backgroundGameObject,\n\ntable: {\nwidth: undefined,\nheight: undefined,\n\ncellWidth: undefined,\ncellHeight: undefined,\ncolumns: 1,\n// rows: 1,\n// fixedCellSize: false,\n\nmask: {\npadding: 0,\n// updateMode: 0,\n},\n// enableLayer: false,\ninteractive: true,\nreuseCellContainer: false,\n\n// click: undefined,\n// tap: undefined,\n// press: undefined,\n// swipe: undefined,\n},\n\nslider: {\n// background: sliderBackgroundGameObject,\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n\n// buttons: {\n//     top: topButtonGameObject, bottom: bottomButtonGameObject,\n//     left: leftButtonGameObject, right: rightButtonGameObject,\n//     step: 0.01,\n// }\n},\n\n// sliderX: {...},\n// sliderY: {...},\n\n// scroller: {\n//     threshold: 10,\n//     slidingDeceleration: 5000,\n//     backDeceleration: 2000,\n//     pointerOutRelease: true,\n//     rectBoundsInteractive: true,\n//     dragRate: 1,\n// },\n\n// scrollerX: {...},\n// scrollerY: {...},\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// }.\n\n// mouseWheelScrollerX: {...},\n// mouseWheelScrollerY: {...},\n\nclampChildOY: false,\n\nheader: headerGameObject,\nfooter: footerGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntable: 0,\n// table: {\n//    top: 0,\n//    bottom: 0,\n//    left: 0,\n//    right: 0,\n//},\n\nslider: 0,\n// slider: {\n//     top: 0,\n//     bottom: 0,\n//     left: 0,\n//     right: 0,\n// },\n// sliderX: 0,\n// sliderY: 0,\n\nheader: 0,\nfooter: 0,\n},\n\nexpand: {\nheader: true,\nfooter: true,\n},\n\nalign: {\nheader: 'center',\nfooter: 'center',\n},\n\ncreateCellContainerCallback: function(cell, cellContainer) {\nvar scene = cell.scene,\nwidth = cell.width,\nheight = cell.height,\nitem = cell.item,\nitems = cell.items,\nindex = cell.index;\nif (cellContainer === null) { // No reusable cell container, create a new one\n// cellContainer = scene.rexUI.add.label();\n}\n// Set child properties of cell container ...\n\n// cell.setCellContainerAlign();  // Set alignment of cellContainer\n\nreturn cellContainer; // or null\n},\n\nitems: [],\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
      • Set width to undefined, and table.width is not undefined, will count width via table + slider.
      • Set height to undefined, and table.height is not undefined, will count height via table + slider.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • scrollMode : Scroll panel vertically, or horizontally.
      • 0, 'vertical', or 'v', 'y' : Scroll panel vertically. Default value.
      • 1, 'horizontal', or 'h'. 'x' : Scroll panel horizontally.
      • 2, or 'xy' : Two-sliders mode, scroll panel vertically and horizontally.
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • table : Configuration of grid table core.
      • table.width : Width of table, in pixels.
        • Set to undefined to expand table width to fit this grid table object.
      • table.height : Height of table, in pixels.
        • Set to undefined to expand table height to fit this grid table object.
      • table.cellHeight : Default height of each cell.
        • Necessary field in vertical scrollMode.
        • undefined : Expand cell height to fit table height, in horizontal scrollMode.
      • table.cellWidth : Width of each cell.
        • Necessary field in horizontal scrollMode.
        • undefined : Expand cell width to fit table width, in vertical scrollMode.
      • table.columns : Columns count of each row. Can be used in vertical or horizontal scroll mode.
      • table.rows : Rows count of each column. Can be used in horizontal scroll mode.
      • table.fixedCellSize : Assign columns according to cellWidth (if scrollMode is 0) or cellHeight (if scrollMode is 1) , when initialize and resizing. \u3000\u3000 - false : Ignore this parameter. Default behavior.
        • true : Set columns according to cellWidth/cellHeight.
      • table.mask : A rectangle mask of cells
        • table.mask.padding : Extra left/right/top/bottom padding spacing of this rectangle mask. Default value is 0.
        • table.mask.updateMode : When to update cells mask
          • 0, or update : Apply mask to cell container only when table.updateTable() is invoked. Default behavior.
          • 1, or everyTick : Apply mask to cell container every tick. Use this mode if game objects of cell are moved after table.updateTable() and still been masked.
        • false : No mask.
      • table.enableLayer :
        • false : Add cell game objects into scene's display list. Default behavior.
        • true : Add cell game objects into an internal layer game object. See also.
      • table.reuseCellContainer :
        • true : Reuse cell container when creating new cell container.
        • false : Destory cell container when cell is invisible, create new cell container when cell is visible. Default behavior.
      • table.interactive : Set true to install touch events (tap/press/over/out/click). Default value is true.
      • table.click : Configuration of cell-click behavior, if table.interactive is true.
        • undefined : Use default click behavior.
      • table.tap : Configuration of cell-tap behavior, if table.interactive is true.
        • undefined : Use default tap behavior.
      • table.press : Configuration of cell-press behavior, if table.interactive is true.
        • undefined : Use default press behavior.
      • table.swipe : Configuration of cell-swipe behavior, if table.interactive is true.
        • undefined : Use default swipe behavior.
    • slider : Componments of slider, optional.
      • slider.background : Game object of slider background, optional.
      • slider.track : Game object of track.
      • slider.thumb : Game object of thumb.
      • slider.input :
        • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.position : Position of this slider.
        • 0, 'right', 'bottom' : Slider at right/bottom side. Default value.
        • 1, 'left', 'top' : Slider at left/top side.
      • slider.hideUnscrollableSlider :
        • false : Slider is always visible no matter it is scrollable or not. Default behavior.
        • true : Set slider to invisible if it is unscrollable.
      • slider.disableUnscrollableDrag :
        • false : Scroller is always enale no matter it is scrollable or not. Default behavior.
        • true : Set scroller to disable if it is unscrollable.
      • slider.adaptThumbSize :
        • false : Don't adjust height/width of thumb. Default behavior.
        • true : Adjust height/width of thumb according to ratio of visible child.
          • Minimum height/width of thumb = slider.minThumbSize. If content is larger then a page.
          • Maximum height/width of thumb = height/width of slider.track. If content is less then a page.
      • slider.minThumbSize : Minimum height/width of thumb used in slider.adaptThumbSize mode.
      • slider.buttons : Press button to scroll content in each tick.
        • slider.buttons.top, slider.buttons.bottom : Top and bottom buttons.
        • slider.buttons.left, slider.buttons.right : Left and right buttons
        • slider.buttons.step : Scrolling step in each tick. Default value is 0.01.
      • Set to false to skip creating slider.
    • sliderX, sliderY : Componments of sliderX and sliderY, for two-sliders mode.
    • scroller : Configuration of scroller behavior.
      • scroller.threshold : Minimal movement to scroll. Set 0 to scroll immediately.
      • scroller.slidingDeceleration : Deceleration of slow down when dragging released.
        • Set false to disable it.
      • scroller.backDeceleration : Deceleration of pull back when out of bounds.
        • Set false to disable it.
      • scroller.pointerOutRelease : Set to true to release input control when pointer out of gameObject.
      • scroller.rectBoundsInteractive :
        • false : Detect scrolling by game object's touch input.
        • true : Detect scrolling by rectangle bounds of game object. Default behavior.
      • scroller.dragRate : Rate of dragging distance/dragging speed. Default value is 1.
      • Set to false to skip creating scroller.
    • scrollerX, scrollerY : Configuration of scrollerX, scrollerY behavior, for two-sliders mode.
    • mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
      • mouseWheelScroller.focus :
        • false, or 0 : Without checking if cursor is over game object or not.
        • true, or 1 : Cursor is inside the rectangle bounds of game object. Default behavior.
        • 2 : Cursor is over game object.
      • mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
      • Set to false to skip creating mouse-wheel-scroller. Default behavior.
    • mouseWheelScrollerX, mouseWheelScrollerY : Configuration of mouse-wheel-scrollerX, or mouse-wheel-scrollerY behavior, for two-sliders mode.
    • clampChildOY : Set true to clamp scrolling.
    • createCellContainerCallback : Callback to return a container object, or null of each visible cell.
      • Properties of cell parameter
        • cell.scene : Scene of this grid table object.
        • cell.width : Width of this cell, in pixels.
        • cell.height : Height of this cell, in pixels.
        • cell.item : Item of this cell to display.
        • cell.items : Array of item data for each cell, equal to items parameter.
        • cell.index : Index of this cell.
      • Alignment of cellContainer :
        cell.setCellContainerAlign(align);\n
        • align :
          • undefined : Set position of cellContainer to left-top of cell space. Default behavior.
          • 'center', or Phaser.Display.Align.CENTER : Align game object at center of cell space.
          • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center of cell space.
          • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center of cell space.
          • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center of cell space.
          • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center of cell space.
      • If cell.align is undefined (default value), Origin of returned cell container will be set to (0, 0)
      • cellContainer : Cell container picked from object pool for reusing. Set reuseCellContainer to true to enable this feature.
        • null : No cell container available.
        • Game object : Reusable cell container.
    • header : Game object of header, optional.
    • footer : Game object of footer, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.table :
        • A number: Space between table object and slider object.
        • An object: Padding of table object.
          • If scrollMode is 0 (vertical) :
            • space.table.top, space.table.bottom : Top, bottom padding space of table object.
            • space.table.right : Space between table object and slider object.
          • If scrollMode is 1 (horizontal) :
            • space.table.left, space.table.right : Left, right padding space of table object.
            • space.table.bottom : Space between table object and slider object.
      • space.slider :
        • 0 : No space around slider.
        • space.slider.left, space.slider.right, space.slider.top, space.slider.bottom : Space around slider.
      • space.sliderX, space.sliderX : Space configuration of sliderX, sliderX, for two-sliders mode.
        • 0 : No space around slider.
      • space.header : Space between header and table.
      • space.footer : Space between footer and table.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width or height of header game object.
      • expand.footer : Set true to expand width or height of footer game object.
    • align : Align element
      • align.header
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • align.footer
    • items : Array of item data for each cell.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    "},{"location":"ui-gridtable/#scroll-mode","title":"Scroll mode","text":"

    If scrollMode parameter is not given :

    • Set scrollMode to 2, if configuration has sliderX, sliderY, or scrollerX, scrollerY parameters.
    • Set scrollMode to 0, if configuration has sliderY, or scrollerY parameters.
    • Set scrollMode to 1, if configuration has sliderX, or scrollerX parameters.
    "},{"location":"ui-gridtable/#custom-class","title":"Custom class","text":"
    • Define class
      class MyGridTable extends RexPlugins.UI.GridTable {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var table = new MyGridTable(scene, config);\n
    "},{"location":"ui-gridtable/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    table.layout();\n

    See also - dirty

    "},{"location":"ui-gridtable/#items","title":"Items","text":"
    • Set
      table.setItems(items);\n
      • items : Array of item data for each cell.
      • This method will update each visible cell of grid table.
    • Clear all items
      table.setItems();\n
    • Get
      var items = table.items;\n
    • Add item
      Phaser.Utils.Array.Add(table.items, item);\ntable.refresh();\n
    • Insert item
      Phaser.Utils.Array.AddAt(table.items, item, index);\ntable.refresh();\n
    • Remove item
      Phaser.Utils.Array.Remove(table.items, item);\ntable.refresh();\n
    • Remove item at index
      Phaser.Utils.Array.RemoveAt(table.items, index);\ntable.refresh();\n
    • Remove items between indexes
      Phaser.Utils.Array.RemoveBetween(table.items, startIndex, endIndex);\ntable.refresh();\n
    • Remove random item
      Phaser.Utils.Array.RemoveRandomElement(table.items);\ntable.refresh();\n
    "},{"location":"ui-gridtable/#cell-container","title":"Cell container","text":"
    • Get
      var container = table.getCellContainer(cellIndex);\n
    "},{"location":"ui-gridtable/#reset-size-of-all-cells","title":"Reset size of all cells","text":"
    table.resetAllCellsSize(width, height);\n
    "},{"location":"ui-gridtable/#scroll-content","title":"Scroll content","text":"
    • Set
      table.childOY = oy;\n// table.setChildOY(oy);\n
    • Set and clamp
      table.setChildOY(oy, true);\n
    • Add
      table.addChildOY(oy);\n
    • Add and clamp
      table.addChildOY(oy, true);\n
    • Get
      var childOY = table.childOY;\n
    • Top OY
      var topOY = table.topChildOY;\n
    • Bottom OY
      var bottomOY = table.bottomChildOY;\n
    • Is overflow (height of content is larger than display height)
      var isOverflow = textArea.isOverflow;\n
    "},{"location":"ui-gridtable/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      table.t = t;  // t: 0~1\n// table.setT(t);  \n
    • Set and clamp
      table.setT(t, true);\n
    • Get
      var t = table.t;\n
    "},{"location":"ui-gridtable/#scroll-to-topbottom","title":"Scroll to top/bottom","text":"
    • Scroll to top
      table.scrollToTop();\n
      • Equal to table.t = 0;
    • Scroll to bottom
      table.scrollToBottom();\n
      • Equal to table.t = 1;
    "},{"location":"ui-gridtable/#scroll-to-row","title":"Scroll to row","text":"
    • Scroll to next row
      table.scrollToNextRow();\n
    • Scroll to next n row
      table.scrollToNextRow(n);\n
    • Scroll to row
      table.scrollToRow(rowIndex);\n
    • Get current row index
      var rowIndex = table.startRowIndex;\n
    "},{"location":"ui-gridtable/#enabledisable-scrolling","title":"Enable/disable scrolling","text":"
    • Slider
      • Set enable state
        table.setSliderEnable(enabled);\n
        or
        table.sliderEnable = enabled;\n
      • Get enable state
        var enable = table.sliderEnable;\n
    • Scroller
      • Set enable state
        table.setScrollerEnable(enabled);\n
        or
        table.scrollerEnable = enabled;\n
      • Get enable state
        var enable = table.scrollerEnable;\n
    • Mouse-Wheel-Scroller
      • Set enable state
        table.setMouseWheelScrollerEnable(enabled);\n
        or
        table.mouseWheelScrollerEnable = enabled;\n
      • Get enable state
        var enable = table.mouseWheelScrollerEnable;\n
    "},{"location":"ui-gridtable/#refresh-table-cells","title":"Refresh table cells","text":"
    • Refresh all visible cells
      table.refresh();\n
      • Equal to table.setItems(table.items).
    • Update a visible cell
      table.updateVisibleCell(cellIndex);\n
    "},{"location":"ui-gridtable/#table-size","title":"Table size","text":"
    • Table width
      var tableWidth = table.getElement('table').tableWidth;\n
    • Table height
      var tableHeight = table.getElement('table').tableHeight;\n
    "},{"location":"ui-gridtable/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-gridtable/#events","title":"Events","text":"
    • Pointer-down cell
      table.on('cell.down', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-up cell
      table.on('cell.up', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over cell
      table.on('cell.over', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-out cell
      table.on('cell.out', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Click cell
      table.on('cell.click', function(cellContainer, cellIndex, pointer, event) {\n// ...\n}, scope);\n
      • Cancel remaining touched events : event.stopPropagation()
    • Tap cell
      table.on(tapEventName, function(cellContainer, cellIndex, pointer) {\n// ...\n}, scope);\n
      • tapEventName : 'cell.1tap', 'cell.2tap', 'cell.3tap', etc ...
      • cellContainer : Container game object of triggered cell.
      • cellIndex : Index of triggered cell.
    • Press cell
      table.on(`cell.pressstart`, function(cellContainer, cellIndex, pointer) {\n// ...\n}, scope);\n
      table.on(`cell.pressend`, function(cellContainer, cellIndex, pointer) {\n// ...\n}, scope);\n
    • Swipe cell
      table.on(swipeEventName, function(cellContainer, cellIndex, pointer) {\n// ...\n}, scope);\n
      • swipeEventName : 'cell.swipeleft', 'cell.swiperight', 'cell.swipeup', 'cell.swipedown'.
    • Scroll table
      table.on('scroll', function(table) {\n// ...\n})\n
    • Slider
      • Slider drag start
        table.getElement('slider').on('inputstart', function(panel) {\n// ...\n})\n
      • Slider drag end
        table.getElement('slider').on('inputend', function(panel) {\n// ...\n})\n
    • Scroller
      • Scroller drag start
        table.getElement('scroller').on('dragstart', function(panel) {\n// ...\n})\n
      • Scroller drag end
        table.getElement('scroller').on('dragend', function(panel) {\n// ...\n})\n
    "},{"location":"ui-gridtable/#interactive-with-child-of-cell","title":"Interactive with child of cell","text":"
    table.on('cell.click', function(cellContainer, cellIndex, pointer, event) {\nvar child;\n// child = cellContainer.getElement(...);\nif (cellContainer.isPointerInBounds(child)) {\n// Pointer on this child\n}\n}, scope);\n

    Reference of isPointerInBounds method

    "},{"location":"ui-gridtable/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = table.getElement('background');\n
      • Grid table
        var tableBody = table.getElement('table');\n
      • Layer of gridtable, assigned at config table.mask.layer.
        var layer = table.getElement('tableLayer');\n
      • Slider
        • Track
          var track = table.getElement('slider.track');\n
        • Thumb
          var thumb = table.getElement('slider.thumb');\n
      • Scroller
        var scroller = table.getElement('scroller');\n
      • Header game object
        var tableBody = table.getElement('header');\n
      • Footer game object
        var tableBody = table.getElement('footer');\n
    • Get by name
      var gameObject = table.getElement('#' + name);\n// var gameObject = table.getElement('#' + name, recursive);\n
      or
      var gameObject = table.getByName(name);\n// var gameObject = table.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-holygrail/","title":"Holy grail","text":""},{"location":"ui-holygrail/#introduction","title":"Introduction","text":"

    Layout elements in Holy grail style.

    • Author: Rex
    • Game object
    "},{"location":"ui-holygrail/#live-demos","title":"Live demos","text":"
    • Simple
    • Align
    • Layout modes
    • Change layout mode
    "},{"location":"ui-holygrail/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-holygrail/#install-plugin","title":"Install plugin","text":""},{"location":"ui-holygrail/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add holy-grail object
      var holyGrail = scene.rexUI.add.holyGrail(config);\n
    "},{"location":"ui-holygrail/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add holy-grail object
      var holyGrail = scene.rexUI.add.holyGrail(config);\n
    "},{"location":"ui-holygrail/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { HolyGrail } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add holy-grail object
      var holyGrail = new HolyGrail(scene, config);\nscene.add.existing(holyGrail);\n
    "},{"location":"ui-holygrail/#add-holygrail-object","title":"Add holyGrail object","text":"
    var holyGrail = scene.rexUI.add.holyGrail({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\n// Elements\nbackground: backgroundGameObject,\n\nheader: headerGameObject,\n\nleftSide: leftSideGameObject,\n\ncontent: contentGameObject,\n\nrightSide: rightSideGameObject,\n\nfooter: footerGameObject,\n\n// Space\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nheader: 0,  // {left, right, top, bottom}\nfooter: 0,  // {left, right, top, bottom}\nleftSide: 0, // {left, right, top, bottom}\nrightSide: 0, // {left, right, top, bottom}\n},\n\n// proportion: {\n//     header: 0,\n//     footer: 0,\n//     leftSide: 0,\n//     rightSide: 0,\n//     content: 1,\n// },\n\n// expand: {\n//     header: true,\n//     footer: true,\n//     leftSide: true,\n//     rightSide: true,\n//     content: false,\n// },\n\n// align: {\n//     header: 'center',\n//     footer: 'center',\n//     leftSide: 'center',\n//     rightSide: 'center',\n//     content: 'center',\n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • layoutMode : Expand left side, right side to bottom row.
      • 0, or 'FFF' : Bottom row is footer. Default behavior
      • 1, or 'LFF' : Left side will expand down to bottom row.
      • 2, or 'FFR' : Right side will expand down to bottom row.
      • 3, or 'LFR' : Left side and right side will expand down to bottom row.
    • background : Game object of background, optional. This background game object will be resized to fit the size of holyGrail.
    • header : Game object of header, optional.
      • Will fixed height (proportion=0) and expand width (expand=true) width default setting.
    • leftSide : Game object of leftSide, optional.
      • Will fixed width (proportion=0) and expand height (expand=true) width default setting.
    • content : Game object of content, optional.
      • Will expand width (proportion=1) and expand height (expand=true) width default setting.
    • rightSide : Game object of rightSide, optional.
      • Will fixed width (proportion=0) and expand height (expand=true) width default setting.
    • footer : Game object of footer, optional.
      • Will fixed height (proportion=0) and expand width (expand=true) width default setting.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.header :
        • A number : Space between header game object and below game object, equal to {bottom}
        • {left, right, top, bottom} : Padding values of header game object.
      • space.footer
        • A number : Space between footer game object and above game object, equal to {top}
        • {left, right, top, bottom} : Padding values of footer game object.
      • space.leftSide :
        • A number : Space between leftSide game object and content game object, equal to {right}
        • {left, right, top, bottom} : Padding values of leftSide game object.
      • space.rightSide :
        • A number : Space between rightSide game object and content game object, equal to {left}
        • {left, right, top, bottom} : Padding values of rightSide game object.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width of header game object. Default is true.
      • expand.footer : Set true to expand width of footer game object. Default is true.
      • expand.leftSide : Set true to expand height of leftSide game object. Default is true.
      • expand.rightSide : Set true to expand height of rightSide game object. Default is true.
      • expand.content : Set true to expand height of content game object. Default is true.
    • proportion : Fixed width or height of element
      • proportion.header :
        • 0 : Fixed height. Default behavior.
        • 1, or other numbers : Expand height.
      • proportion.footer :
        • 0 : Fixed height. Default behavior.
        • 1, or other numbers : Expand height.
      • proportion.leftSide :
        • 0 : Fixed width. Default behavior.
        • 1, or other numbers : Expand width.
      • proportion.rightSide :
        • 0 : Fixed width. Default behavior.
        • 1, or other numbers : Expand width.
      • proportion.content :
        • 0 : Fixed width.
        • 1, or other numbers : Expand width. Default value is 1.
    • align : Align element
      • align.header
      • align.footer
      • align.leftSide
      • align.rightSide
      • align.content
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false..
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-holygrail/#custom-class","title":"Custom class","text":"
    • Define class
      class MyHolyGrail extends RexPlugins.UI.HolyGrail {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var holyGrail = new MyHolyGrail(scene, config);\n
    "},{"location":"ui-holygrail/#layout-modes","title":"Layout modes","text":""},{"location":"ui-holygrail/#mode-0","title":"Mode 0","text":"

    Bottom row is footer. Default behavior.

    Header Left side Content Right side Footer"},{"location":"ui-holygrail/#mode-1","title":"Mode 1","text":"

    Left side will expand down to bottom row.

    Header Left side Content Right side Footer"},{"location":"ui-holygrail/#mode-2","title":"Mode 2","text":"

    Right side will expand down to bottom row.

    Header Left side Content Right side Footer"},{"location":"ui-holygrail/#mode-3","title":"Mode 3","text":"

    Left side and right side will expand down to bottom row.

    Header Left side Content Right side Footer"},{"location":"ui-holygrail/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    holyGrail.layout();\n

    See also - dirty

    "},{"location":"ui-holygrail/#re-build","title":"Re-build","text":"

    Destroy current elements then add elements with new config.

    holyGrail\n.build({\n// Elements\nbackground: backgroundGameObject,\n\nheader: headerGameObject,\n\nleftSide: leftSideGameObject,\n\ncontent: contentGameObject,\n\nrightSide: rightSideGameObject,\n\nfooter: footerGameObject,\n\nlayoutMode: 0,\n\n// Space\nspace: {        header: 0,  // {left, right, top, bottom}\nfooter: 0,  // {left, right, top, bottom}\nleftSide: 0, // {left, right, top, bottom}\nrightSide: 0, // {left, right, top, bottom}\n},\n\n// proportion: {\n//     header: 0,\n//     footer: 0,\n//     leftSide: 0,\n//     rightSide: 0,\n//     content: 1,\n// },\n\n// expand: {\n//     header: true,\n//     footer: true,\n//     leftSide: true,\n//     rightSide: true,\n//     content: false,\n// },\n\n// align: {\n//     header: 'center',\n//     footer: 'center',\n//     leftSide: 'center',\n//     rightSide: 'center',\n//     content: 'center',\n// },\n})\n.layout()\n
    "},{"location":"ui-holygrail/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-holygrail/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = holyGrail.getElement('background');\n
      • Header game object
        var header = holyGrail.getElement('header');\n
      • Left-side game object
        var leftSide = holyGrail.getElement('leftSide');\n
      • Content game object
        var content = holyGrail.getElement('content');\n
      • Right-side game object
        var rightSide = holyGrail.getElement('rightSide');\n
      • Footer game object
        var footer = holyGrail.getElement('footer');\n
    • Get by name
      var gameObject = holyGrail.getElement('#' + name);\n// var gameObject = holyGrail.getElement('#' + name, recursive);\n
      or
      var gameObject = holyGrail.getByName(name);\n// var gameObject = holyGrail.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-imageinputlabel/","title":"Image input label","text":""},{"location":"ui-imageinputlabel/#introduction","title":"Introduction","text":"

    A container with a canvas icon, text, and background. Click icon to popup a (image) file chooser dialog, display selected image on canvas.

    • Author: Rex
    • Game object
    "},{"location":"ui-imageinputlabel/#live-demos","title":"Live demos","text":"
    • Save texture
    "},{"location":"ui-imageinputlabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-imageinputlabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-imageinputlabel/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add image-input label object
      var imageInputLabel = scene.rexUI.add.imageInputLabel(config);\n
    "},{"location":"ui-imageinputlabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin, enable dom element in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\nparent: divId,\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Add image-input label object
      var imageInputLabel = scene.rexUI.add.imageInputLabel(config);\n
    "},{"location":"ui-imageinputlabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import { ImageInputLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add image-input label object
      var imageInputLabel = new ImageInputLabel(scene, config);\nscene.add.existing(imageInputLabel);\n
    "},{"location":"ui-imageinputlabel/#add-imageinputlabel-object","title":"Add imageInputLabel object","text":"
    var imageInputLabel = scene.rexUI.add.imageInputLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\ncanvas: {\n// width: 128, \n// height: 128,\n// fill: undefined,\n\n// key: undefined, \n// frame: undefined,        \n},\n\n// scaleUpIcon: false,\n\niconBackground: iconBackgroundGameObject,    // squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\n\naction: actionGameObject,\n// actionMask: false,\n// squareFitAction: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nalign: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0, iconLeft: 0, iconRight: 0,\n\ntext: 0,\nactionTop: 0, actionBottom: 0, actionLeft: 0, actionRight: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n// clickTarget: undefined,\n// domButton: true,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of imageInputLabel.
    • canvas : Parameters of creating canvas game object.
      • canvas.width, canvas.height, canvas.fill : Create canvas with size (canvas.width x canvas.height), filling by color canvas.fill.
      • canvas.key, canvas.frame : Create canvas then paste texture canvas.key, canvas.frame.
    • iconBackground : Game object of iconBackground, optional.
      • icon game object will be created internally by imageBox with canvas.
    • squareFitIcon :
      • true : Resize icon size to square to fit imageInputLabel height/width.
        • Can't work wit expandTextWidth: true
      • false : Ignore this feature. Default behavior.
    • iconSize : Set display size of icon game object to iconSizexiconSize
    • iconWidth : Set display width of icon game object to iconWidth.
      • If iconHeight is undefined, set scaleY of icon game object to scaleX of icon game object, to keep size ratio.
    • iconHeight : Set display height of icon game object to iconHeight.
      • If iconWidth is undefined, set scaleX of icon game object to scaleY of icon game object, to keep size ratio.
    • scaleUpIcon :
      • true : Scale-up canvas game object if its size is smaller than icon (imageBox).
      • false : Keep current size when its size is smaller than icon (imageBox). Default behavior.
    • text : Game object of text, optional.
    • expandTextWidth :
      • false : Keep width of text to original size. Default behavior.
      • true : Expand width of text object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
        • Can't work with squareFitIcon: true.
    • expandTextHeight : Set true to expand height of text object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitAction :
      • true : Resize action icon size to square to fit imageInputLabel height/width.
      • false : Ignore this feature. Default behavior.
    • actionSize : Set display size of action game object to actionSizexactionSize
    • actionWidth : Set display width of action game object to actionWidth.
      • If actionHeight is undefined, set scaleY of action game object to scaleX of action game object, to keep size ratio.
    • actionHeight : Set display height of action game object to actionHeight.
      • If actionWidth is undefined, set scaleX of action game object to scaleY of action game object, to keep size ratio.
    • align : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom, space.iconLeft, space.iconRight : Space around icon game object.
      • space.text : Space between text game object and action icon game object.
      • space.actionTop, space.actionBottom, space.actionLeft, space.actionRight : Space around action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • clickTarget : Click target to open file chooser dialog
      • A string, 'icon', 'text', 'action', 'background' : Click icon, text, action, background game object to open file chooser dialog.
      • undefined : Click this ImageInputLabel game object to open file chooser dialog. Default behavior.
      • null, false : No clickTarget. Open file chooser dialog manually under a touch event.
    • domButton :
      • true : Put DOM buttom above clickTarget, to receive click event.
      • false : Add click event at clickTarget.
        • This mode won't work at ios
    "},{"location":"ui-imageinputlabel/#expand-size-of-text","title":"Expand size of text","text":"

    Expand width/height of text when expandTextWidth/expandTextHeight is true

    To resize text object, text object should have resize method. For example

    class MyText extends Phaser.GameObjects.Text {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\nscene.add.existing(this);\n}\nresize(width, height) {\nthis.setFixedSize(width, height);\nreturn this;\n}\n}\n

    Or uses bbcode text object, tag text object, canvasInput object.

    "},{"location":"ui-imageinputlabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLabel extends RexPlugins.UI.ImageInputLabel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var imageInputLabel = new MyLabel(scene, config);\n
    "},{"location":"ui-imageinputlabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    imageInputLabel.layout();\n

    See also - dirty

    "},{"location":"ui-imageinputlabel/#open-file-chooser-dialog","title":"Open file chooser dialog","text":"

    Failure

    This method can't run at ios.

    Note

    Open a file chooser dialog under any touch event. i.e. User can't open file chooser dialog directly.

    imageInputLabel.openPromise()\n.then(function(file){\n})\n
    • file : File object
    imageInputLabel.open()\n
    "},{"location":"ui-imageinputlabel/#enable-clicking-open","title":"Enable clicking-open","text":"
    • Enable
      imageInputLabel.setClickOpenEnable();\n// imageInputLabel.setClickOpenEnable(true);\n
    • Disable
      imageInputLabel.setClickOpenEnable(false)\n
    "},{"location":"ui-imageinputlabel/#save-texture","title":"Save texture","text":"

    Save image on canvas into texture manager.

    imageInputLabel.saveTexture(key);\n
    "},{"location":"ui-imageinputlabel/#events","title":"Events","text":"
    • Select file
      imageInputLabel.on('select', function(file, imageInputLabel) {\n\n})\n
      • file : File object
    "},{"location":"ui-imageinputlabel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = imageInputLabel.getElement('background');\n
      • Canvas game object (a canvas game object created internally)
        var canvas = imageInputLabel.getElement('canvas');\n
      • Icon background game object
        var iconBackground = imageInputLabel.getElement('iconBackground');\n
      • Icon game object (an imageBox game object created internally)
        var imageBox = imageInputLabel.getElement('icon');\n
      • Text game object
        var textObject = imageInputLabel.getElement('text');\n
      • Action icon game object
        var action = imageInputLabel.getElement('action');\n
      • File chooser game object, if domButton is set to true
        var fileChooser = imageInputLabel.getElement('fileChooser');\n
    • Get by name
      var gameObject = imageInputLabel.getElement('#' + name);\n// var gameObject = imageInputLabel.getElement('#' + name, recursive);\n
      or
      var gameObject = imageInputLabel.getByName(name);\n// var gameObject = imageInputLabel.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-imageinputlabel/#other-properties","title":"Other properties","text":"

    See label), sizer object, base sizer object, container-lite.

    "},{"location":"ui-knob/","title":"Knob","text":""},{"location":"ui-knob/#introduction","title":"Introduction","text":"

    A knob button based on circular progress shape.

    • Author: Rex
    • Game object
    "},{"location":"ui-knob/#live-demos","title":"Live demos","text":"
    • Knob
    "},{"location":"ui-knob/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-knob/#install-plugin","title":"Install plugin","text":""},{"location":"ui-knob/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add knob object
      var knob = scene.rexUI.add.knob(config);\n
    "},{"location":"ui-knob/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add knob object
      var knob = scene.rexUI.add.knob(config);\n
    "},{"location":"ui-knob/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Knob } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add knob object
      var knob = new Knob(scene, config);\nscene.add.existing(knob);\n
    "},{"location":"ui-knob/#add-knob-object","title":"Add knob object","text":"
    var knob = scene.rexUI.add.knob({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nbarColor: undefined,\ntrackColor: undefined,\ncenterColor: undefined,\nthickness: 0.2,\nstartAngle: Phaser.Math.DegToRad(270),\nanticlockwise: false,\n// iterations: 128,\nknobDepth: 0,\n\ntext: undefined,\ntextFormatCallback: undefined,\ntextFormatCallbackScope: undefined,\n\ninput: 'pan',\n\nvalue: 0,\ngap: undefined,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},\nvaluechangeCallback: function(newValue, oldValue, knob) {\n},\nvaluechangeCallbackScope: undefined,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n\nenable: true,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of knob.
    • barColor : Color of circular bar, in number or css string value.
    • trackColor : Color of circular track, in number or css string value.
    • centerColor : Color of center circle, in number or css string value.
    • thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
    • startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
    • anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
    • iterations : Iterations of curve, set larger value to get more smooth rendering result. Default value is 128.
    • knobDepth : Depth of knob (circular progress). Default value is 0.
    • text : Label, Text, BBCodeText, or TagText, which has setText(text) method, optional.
      • Don't set textColor, textStrokeColor if text parameter is provided.
      • Depth of text object ought to larger than knob (circular progress), to put text object in front of knob.
    • Display text :
      • textColor : Color of display text. Default is undefined.
      • textStrokeColor, textStrokeThickness : Stroke color, stroke line width of display text. Default is undefined.
      • textSize, textFamily, textStyle : Size, family, style of display text.
    • textFormatCallback, textFormatCallbackScope : Formating callback of display text. ex:
      function(value) {\nreturn Math.floor(value * 100).toString();\n}\n
      Default value is undefined.
    • input :
      • 'pan', 'drag', or 0 : Control knob by panning circular progress. Default setting.
      • 'click', or 1 : Control knob by touching circular progress.
      • 'none', or -1 : Disable knob controlling.
    • value : Initial value (0 ~ 1).
    • gap : Snap a value to nearest grid slice, using rounding.
      • undefined : Disalbe this feature.
    • easeValue : Easing value when input is 'click'.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • valuechangeCallback : callback function when value changed.
    • enable : Set false to disable controlling.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-knob/#custom-class","title":"Custom class","text":"
    • Define class
      class MyKnob extends RexPlugins.UI.Knob {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var knob = new MyKnob(scene, config);\n
    "},{"location":"ui-knob/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    knob.layout();\n

    See also - dirty

    "},{"location":"ui-knob/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = knob.getElement('background');\n
      • Circular progress game object
        var circularProgress = knob.getElement('knob');\n
      • Text game object
        var text = knob.getElement('text');\n
    • Get by name
      var gameObject = knob.getElement('#' + name);\n// var gameObject = knob.getElement('#' + name, recursive);\n
      or
      var gameObject = knob.getByName(name);\n// var gameObject = knob.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-knob/#enable","title":"Enable","text":"
    • Get
      var enable = knob.enable;\n
    • Set
      knob.setEanble(enable);\n
      or
      knob.enable = enable;\n
    "},{"location":"ui-knob/#value","title":"Value","text":"

    Change value will also change the position of knob thumb and width of knob indicator.

    • Get value
      var value = knob.getValue(min, max); // value : min ~ max\n
      or
      var value = knob.getValue(); // value: 0 ~ 1\n
      or
      var value = knob.value; // value: 0 ~ 1\n
    • Set value
      knob.setValue(value, min, max); // value: min ~ max\n
      or
      knob.setValue(value); // value: 0 ~ 1\n
      or
      knob.value = value; // value: 0 ~ 1\n
    • Increase value
      knob.addValue(inc, min, max); // inc: min ~ max\n
      or
      knob.addValue(inc); // inc: 0 ~ 1\n
      or
      knob.value += inc; // inc: 0 ~ 1\n
    "},{"location":"ui-knob/#ease-value","title":"Ease value","text":"
    • Ease value to
      knob.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      knob.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      knob.stopEaseValue();\n
    • Set ease duration
      knob.setEaseValueDuration(duration);\n
    • Set ease function
      knob.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"ui-knob/#other-properties","title":"Other properties","text":"

    See overlap sizer object, base sizer object, container-lite.

    "},{"location":"ui-knob/#events","title":"Events","text":"
    • On value changed
      knob.on('valuechange', function(newValue, oldValue, knob){\n//\n}, scope);\n
    "},{"location":"ui-label/","title":"Label","text":""},{"location":"ui-label/#introduction","title":"Introduction","text":"

    A container with an icon, text, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-label/#live-demos","title":"Live demos","text":"
    • Align
    • Add to layer
    • Text wrap in horizontal label
    • Text wrap in vertical label
    • Adjust text font size
    • Square fit icon
    • Icon size
    "},{"location":"ui-label/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-label/#install-plugin","title":"Install plugin","text":""},{"location":"ui-label/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.label(config);\n
    "},{"location":"ui-label/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.label(config);\n
    "},{"location":"ui-label/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Label } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new Label(scene, config);\nscene.add.existing(label);\n
    "},{"location":"ui-label/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.label({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\n\nicon: iconGameObject,\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textGameObject,\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\naction: actionGameObject,\n// actionMask: false,\n// squareFitAction: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nalign: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0, iconLeft: 0, iconRight: 0,\n\ntext: 0,\nactionTop: 0, actionBottom: 0, actionLeft: 0, actionRight: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitIcon :
      • true : Resize icon size to square to fit label height/width.
        • Can't work wit expandTextWidth: true
      • false : Ignore this feature. Default behavior.
    • iconSize : Set display size of icon game object to iconSizexiconSize
    • iconWidth : Set display width of icon game object to iconWidth.
      • If iconHeight is undefined, set scaleY of icon game object to scaleX of icon game object, to keep size ratio.
    • iconHeight : Set display height of icon game object to iconHeight.
      • If iconWidth is undefined, set scaleX of icon game object to scaleY of icon game object, to keep size ratio.
    • text : Game object of text, optional.
    • wrapText : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
        • Text-width will be expanding.
      • 2, 'char' : Character WrapExpandText.
        • Text-width will be expanding.
    • adjustTextFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapText: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.
    • expandTextWidth :
      • false : Keep width of text to original size. Default behavior.
      • true : Expand width of text object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
        • Can't work with squareFitIcon: true.
    • expandTextHeight : Set true to expand height of text object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • squareFitAction :
      • true : Resize action icon size to square to fit label height/width.
      • false : Ignore this feature. Default behavior.
    • actionSize : Set display size of action game object to actionSizexactionSize
    • actionWidth : Set display width of action game object to actionWidth.
      • If actionHeight is undefined, set scaleY of action game object to scaleX of action game object, to keep size ratio.
    • actionHeight : Set display height of action game object to actionHeight.
      • If actionWidth is undefined, set scaleX of action game object to scaleY of action game object, to keep size ratio.
    • align : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
      • 'center' : Align game objects at center.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom, space.iconLeft, space.iconRight : Space around icon game object.
      • space.text : Space between text game object and action icon game object.
      • space.actionTop, space.actionBottom, space.actionLeft, space.actionRight : Space around action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-label/#expand-size-of-text","title":"Expand size of text","text":"

    Expand width/height of text when expandTextWidth/expandTextHeight is true

    To resize text object, text object should have resize method. For example

    class MyText extends Phaser.GameObjects.Text {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\nscene.add.existing(this);\n}\nresize(width, height) {\nthis.setFixedSize(width, height);\nreturn this;\n}\n}\n

    Or uses bbcode text object, tag text object, or canvasInput object.

    "},{"location":"ui-label/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLabel extends RexPlugins.UI.Label {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyLabel(scene, config);\n
    "},{"location":"ui-label/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-label/#change-childrens-align-mode","title":"Change children's align mode","text":"
    label\n.setChildrenAlignMode(mode)\n.layout();\n
    • mode : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
        • Remove first and last space children.
      • 'center' : Align game objects at center.
        • Add two spaces as first and last children.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
        • Add space as first child.
    "},{"location":"ui-label/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = label.getElement('background');\n
      • Icon game object
        var icon = label.getElement('icon');\n
      • Text game object
        var textObject = label.getElement('text');\n
      • Action icon game object
        var action = label.getElement('action');\n
    • Get by name
      var gameObject = label.getElement('#' + name);\n// var gameObject = label.getElement('#' + name, recursive);\n
      or
      var gameObject = label.getByName(name);\n// var gameObject = label.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-label/#text","title":"Text","text":"
    • Get text string
      var s = label.text;\n
    • Set text string
      label.setText(s);\n
      or
      label.text = s;\n
    • Append text string
      label.appendText(text);\n// label.text += '\\n' + text;\n
      or
      label.appendText(text, false);\n// label.text += text;\n
    "},{"location":"ui-label/#icon-texture","title":"Icon texture","text":"
    • Set texture
      label.setTexture(key);\n// label.setTexture(key, frame);\n
    • Set texture via texture object
      label.setTexture(texture);\n// label.setTexture(texture, frame);\n
    • Get texture, frame
      var texture = label.texture;\nvar frame = label.frame;\n
    • Get texture key, frame name
      var textureKey = label.texture.key;\nvar frameName = label.frame.name;\n
    "},{"location":"ui-label/#reset-display-content","title":"Reset display content","text":"
    label.resetDisplayContent({\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n})\n

    or

    label.resetDisplayContent(text);\n
    • text : Set text string.
    • icon, iconFrame
      • A string : Set texture of icon game object.
      • undefined, or null : Hide icon game object.
      • true : Show icon game object without change its texture.
    • iconSize : Set display size of icon game object.
    • action, actionFrame
      • A string : Set texture of icon game object.
      • undefined, or null : Hide action game object.
      • true : Show action game object without change its texture.
    • actionSize : Set display size of action game object.

    Run label.layout() after this method, to layout children again.

    "},{"location":"ui-label/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-menu/","title":"Menu","text":""},{"location":"ui-menu/#introduction","title":"Introduction","text":"

    A container with buttons and sub-menu.

    • Author: Rex
    • Game object
    "},{"location":"ui-menu/#live-demos","title":"Live demos","text":"
    • Pop-up menu
    • Static menu
    • Drop-down list
    • Expand, collapse
    • Custom transit
    "},{"location":"ui-menu/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-menu/#install-plugin","title":"Install plugin","text":""},{"location":"ui-menu/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add menu object
      var menu = scene.rexUI.add.menu(config);\n
    "},{"location":"ui-menu/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add menu object
      var menu = scene.rexUI.add.menu(config);\n
    "},{"location":"ui-menu/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Menu } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add menu object
      var menu = new Menu(scene, config);\nscene.add.existing(menu);\n
    "},{"location":"ui-menu/#add-menu-object","title":"Add menu object","text":"
    var menu = scene.rexUI.add.menu({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n\n// popup: true,\n// orientation: 1,\n// subMenuSide: undefined,\nitems: [],\n\ncreateBackgroundCallback: function(items) {\nvar scene = items.scene;\n// background = ...\nreturn background;\n},\ncreateBackgroundCallbackScope: undefined,\n\ncreateButtonCallback: function(item, index, items) {\nvar scene = item.scene;\n// var isFirstButton = (index === 0);\n// var isLastButton = (index === (items.length - 1));\n// container = ...\nreturn container;\n},\ncreateButtonCallbackScope: undefined,\n\neaseIn: 0,\n// easeIn: {\n//     duration: 500,\n//     orientation: undefined,\n//     ease: 'Cubic'\n// },\ntransitIn: undefined,\n// transitIn: function(menu, duration) {  },\n\neaseOut: 0,\n// easeOut: {\n//     duration: 100,\n//     orientation: undefined,\n//     ease: 'Linear'\n// },\ntransitOut: undefined,\n// transitOut: function(menu, duration) {  },\n\n// expandEvent: 'button.click',\n\n// pointerDownOutsideCollapsing: true,\n\n// childrenKey: 'children',\n\nname: '',\n// draggable: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • popup :
      • true : Pop-up menu, will layout automatically, push inside viewport. Default behavior.
      • false : Static menu, can put into another sizer, won't layout automatically.
    • orientation : Main orientation of the menu, default is 1 (top to bottom)
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange buttons from left ot right.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange buttons from top to bottom.
    • items : Array of item data for each button. Each item has
      • children : An array of items for sub-menu, optional. Can change by childrenKey parameter.
      • Other custom properties
    • createBackgroundCallback : Callback to return container object of menu's bckground.
      • Properties of items parameter
        • items.scene : Scene of this menu object.
    • createButtonCallback : Callback to return container object of each item.
      • Properties of item parameter
        • item.scene : Scene of this menu object.
        • Other custom properties
    • easeIn : Duration of expanding menu.
      • A number : Duration of ease, in milliseconds.
      • An object :
        • easeIn.duration : Duration of ease, in milliseconds.
        • easeIn.ease : Ease function, default is 'Cubic'
        • easeIn.orientation : Orientation of ease.
          • undefined : The same orientation with menu's orientation.
          • 'h', 'x', or 0 : Pop-up menu horizontally.
          • 'v', 'y', or 1 : Pop-up menu vertically.
    • transitIn : Tween behavior of expanding menu.
      • undefined : Expand menu by pop-up, default behavior.
      • Custom callback
        function(menu, duration) {\n\n}\n
    • easeOut : Duration of collapsing menu
      • A number : Duration of ease, in milliseconds.
      • An object :
        • easeOut.duration : Duration of ease, in milliseconds.
        • easeOut.ease : Ease function, default is 'Linear'
        • easeOut.orientation : Orientation of ease.
          • undefined : The same orientation with menu's orientation.
          • 'h', 'x', or 0 : Scale-down menu horizontally.
          • 'v', 'y', or 1 : Scale-down menu vertically.
    • transitOut : Tween behavior of collapsing menu.
      • undefined : Collapse menu by scale-down, default behavior.
      • Custom callback
        function(menu, duration) {\n\n}\n
    • expandEvent : Event name of expanding sub-menu.
      • 'button.click' : Default value
      • 'button.over'
    • pointerDownOutsideCollapsing :
      • true : Collapse all menus (popup:true), or sub-menus (popup:false) when pointer-down outside of all menus. Default behavior.
      • false : Ignore pointer-down outside detection.
    • childrenKey : Key of sub-menu in element of items.
      • children : Default value.
    • subMenuSide : Side of sub-menu
      • undefined : Determine side of sub-menu automatically.
      • 'right', or 0 : Put sub-menu at right side. Used with orientation is set to y.
      • 'left', or 2 : Put sub-menu at left side. Used with orientation is set to y.
      • 'up', or 3 : Put sub-menu at up side. Used with orientation is set to x.
      • 'down', or 1 : Put sub-menu at down side. Used with orientation is set to x.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    "},{"location":"ui-menu/#custom-class","title":"Custom class","text":"
    • Define class
      class MyMenu extends RexPlugins.UI.Menu {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var menu = new MyMenu(scene, config);\n
    "},{"location":"ui-menu/#collapse","title":"Collapse","text":"
    • Collapse menu
      menu.collapse();\n
    • Collapse sub-menu
      menu.collapseSubMenu();\n
    "},{"location":"ui-menu/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-menu/#events","title":"Events","text":"
    • Click button
      menu.on('button.click', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-over button
      menu.on('button.over', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Pointer-out button
      menu.on('button.out', function(button, index, pointer, event) {\n// ...\n}, scope);\n
      • button : Game object of triggered button.
      • index : Index of triggered button.
      • pointer : Pointer object.
      • Cancel remaining touched events : event.stopPropagation()
    • Expand(Pop-up start) sub-menu
      menu.on('expand', function(subMenu, parentButton) {\n// ....\n}, scope)\n
      • subMenu : Sub-menu.
      • parentButton : Game object of triggered button.
      • rootMenu : Root-menu
    • Pop-up root-menu, or sub-menu completely
      menu.on('popup.complete', function(menu) {\n// ....\n}, scope)\n
      • menu : Root-menu, or sub-menu
    • Collapse(Scale-down starting) root-menu, or sub-menu
      menu.on('collapse', function(subMenu, parentButton, rootMenu) {\n// ....\n}, scope)\n
      • subMenu : Sub-menu.
      • parentButton : Game object of triggered button.
      • rootMenu : Root-menu
    • Scale-down root-menu completely
      menu.on('scaledown.complete', function(rootMenu) {\n// ....\n}, scope)\n
      • rootMenu : Root-menu
    "},{"location":"ui-nameinputdialog/","title":"Name input dialog","text":""},{"location":"ui-nameinputdialog/#introduction","title":"Introduction","text":"

    Enter first name and last name via a dialog.

    • Author: Rex
    • Game object
    "},{"location":"ui-nameinputdialog/#live-demos","title":"Live demos","text":"
    • Horizontal-layout
    • Vertical-layout
    "},{"location":"ui-nameinputdialog/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-nameinputdialog/#install-plugin","title":"Install plugin","text":""},{"location":"ui-nameinputdialog/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add dialog object
      var dialog = scene.rexUI.add.nameInputDialog(style).resetDisplayContent(config);\n// var dialog = scene.rexUI.add.nameInputDialog(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-nameinputdialog/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add dialog object
      var dialog = scene.rexUI.add.nameInputDialog(style).resetDisplayContent(config);\n// var dialog = scene.rexUI.add.nameInputDialog(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-nameinputdialog/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { NameInputDialog } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dialog object
      var dialog = new NameInputDialog(scene, config);\n// var dialog = new NameInputDialog(scene, config, creators);\nscene.add.existing(dialog);\ndialog.resetDisplayContent(config);\n
    "},{"location":"ui-nameinputdialog/#add-dialog-object","title":"Add dialog object","text":"
    var dialog = scene.rexUI.add.nameInputDialog({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundStyle,\n// background: null,\n\ntitle: titleStyle,  // SimpleLabelConfig\n// title: null,\n\nfirstNameTitle: titleStyle,  // SimpleLabelConfig\n// firstNameTitle: null,\n\nfirstNameInput: inputTextStyle, // CanvasInputTextConfig\n\nlastNameTitle: titleStyle,  // SimpleLabelConfig\n// firstNameTitle: null,\n\nlastNameInput: inputTextStyle, // CanvasInputTextConfig\n\ncontent: contentStyle, // SimpleLabelConfig, or TextAreaStyle\n// content: null,\n\nbutton: SimpleLabelConfig,\n\n// Space\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntitle: 0,\ntitleLeft: 0,\ntitleRight: 0,\n\nnames: 0,\nnamesLeft: 0,\nnamesRight: 0,\nfirstName: 0,\nfirstNameTitle: 0,\nlastNamTitle: 0,\n\nactionsLeft: 0,\nactionsRight: 0,\naction: 0,\n},\n\nproportion: {\ntitle: 0,\nactions: 0,\n},\n\nexpand: {\ntitle: true,\nactions: false,\n},\n\nalign: {\ntitle: 'center',\nactions: 'center',\n},\n\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\n\nmodal: {\ncover: {\ncolor: 0x0,\nalpha: 0.8,\ntransitIn: function(gameObject, duration) { },\ntransitOut: function(gameObject, duration) { },\n},\n// cover: false, \n\n// When to close modal dialog?\ntouchOutsideClose: false,\nanyTouchClose: false,\ntimeOutClose: false,\nmanualClose: false,\n\nduration: {\nin: 200,\nhold: 2000,\nout: 200\n}\n\ntransitIn: 0,\ntransitOut: 0,\n\ndestroy: true,\n\ndefaultBehavior: true,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n\n// nameInputButtonIndex: 0,\n// cancelButtonIndex: 1,\n\n}, creators);\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • title, firstNameTitle, lastNameTitle :
      • Styles of simple-label
      • null : Don't create any game object.
    • firstNameInput, lastNameInput :
      • Styles of canvas-input
    • button :
      • Styles of simple-label, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.title : Space between title game object and below game object.
      • space.titleLeft, space.titleRight : Extra left/right padding of title game object.
      • space.names : Space between names and action buttons.
      • space.namesLeft, space.namesRight : Extra left/right padding of names.
      • space.firstName : Space between first name and last name.
      • space.firstNameTitle : Space between firstNameTitle and firstNameInput.
      • space.lastNameTitle : Space between lastNameTitle and lastNameInput.
      • space.action : Space between each action-button game objects.
    • proportion : Keep height of element, or expand height of element.
      • proportion.title : Set to 1 to expand height of title. Default is 0.
      • proportion.actions : Set to 1 to expand height of actions. Default is 0.
    • expand : Expand width of element
      • expand.title : Set true to expand width of title game object. Default is true.
      • expand.actions : Set true to expand width of actions game object. Default is false.
    • align : Align element
      • align.title
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value. Will add Spaces at right and left sides.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center. Will add a Space at right side.
      • align.actions : Align action game objects to 'left'/'center'/'right', if expand.actions is false.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • modal : Configuration of modal, See Modal behavior.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false..
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • nameInputButtonIndex, cancelButtonIndex : Button index for firing 'nameInput', 'cancel' events. Default values are 0, 1.
    • creators : Callbacks for creating components.
      {\nbackground: undefined,\ntitle: undefined,\nfirstNameTitle: undefined,\nlastNameTitle: undefined,\nbutton: undefined,\n}\n
      • creators.background : Callback to create background of dialog. Default behavior is creating a round-rectangle-shape.
        function(scene, config)  {\nreturn gameObject;\n}\n
      • creators.title, creators.firstNameTitle, creators.lastNameTitle, creators.button : Creators of simple-label, included these properties
        {\nbackground: undefined,\ntext: undefined,\nicon: undefined,\naction: undefined,\n}\n
    "},{"location":"ui-nameinputdialog/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDialog extends RexPlugins.UI.NameInputDialog {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dialog = new MyDialog(scene, config, creators);\n
    "},{"location":"ui-nameinputdialog/#reset-display-content","title":"Reset display content","text":"
    dialog.resetDisplayContent({\ntitle: '',\nfirstNameTitle: '',\nlastNameTitle: '',\nbutton: '',\n\nfirstName: '',\nlastName: '',\n});\n

    or

    dialog.resetDisplayContent({\ntitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nfirstNameTitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nlastNameTitle: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nbutton: {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n},\n\nfirstName: '',\n\nlastName: ''\n});\n
    • title, firstNameTitle, lastNameTitle : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
      • null : Hide title or firstNameTitle, lastNameTitle element.
    • button : Display content
      • A string : Set text of simple lable
      • Configuration of simpleLabel.resetDisplayContent(config) : Set icon, text, action icon of simple label.
    • firstName, lastNmae : A string

    Run dialog.layout() after this method, to layout children again.

    "},{"location":"ui-nameinputdialog/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    dialog.layout();\n

    See also - dirty

    "},{"location":"ui-nameinputdialog/#modal","title":"Modal","text":"

    Pop this dialog as modal dialog, close this modal dialog when clicking action button.

    dialog.modal(onClose);  // Use default modal config\n

    or

    dialog.modal({\n// cover: {\n//     color: 0x0,\n//     alpha: 0.8,\n//     transitIn: function(gameObject, duration) { },\n//     transitOut: function(gameObject, duration) { },\n// },\n// cover: false, \n\n// When to close modal dialog?\n// touchOutsideClose: false,\n// anyTouchClose: false,\n// timeOutClose: false,\n// manualClose: false,\n\n// duration: {\n//     in: 200,\n//     hold: 2000,\n//     out: 200\n// }\n\n// transitIn: 0,\n// transitOut: 0,\n\n// destroy: true\n}, onClose);\n

    or

    dialog\n.modalPromise(config)\n.then(function(data){\nvar firstName = data.firstName;\nvar lastName = data.lastName;\n})\n
    • config : See Modal behavior
      • config.defaultBehavior :
        • undefined, or true : Will close modal dialog when clicking any action button.
        • false : Disable default behavior.
    • onClose : Callback when closing modal dialog
      function(data) {\nvar firstName = data.firstName;\nvar lastName = data.lastName;\n}\n
      • data : Contains these properties
        • data.firstName : Enter string of firstNameInput.
        • data.lastName : Enter string of lastNameInput.
    "},{"location":"ui-nameinputdialog/#names-input","title":"Names input","text":"
    • First name
      • Get
        var firstName = dialog.firstName;\n
      • Set
        dialog.setFirstName(value);\n// data.firstName = value;\n
    • Last name
      • Get
        var lastName = dialog.lastName;\n
      • Set
        dialog.setLastName(value);\n// data.lastName = value;\n
    "},{"location":"ui-nameinputdialog/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = dialog.getElement('background');\n
      • Title game object
        var title = dialog.getElement('title');\n
      • FirstName-title game object
        var firstNameTitle = dialog.getElement('firstNameTitle');\n
      • FirstName-input game object
        var firstNameInput = dialog.getElement('firstNameInput');\n
      • LastName-title game object
        var lastNameTitle = dialog.getElement('lastNameTitle');\n
      • LastName-input game object
        var lastNameInput = dialog.getElement('lastNameInput');\n
      • Button game object
        var button = dialog.getElement('button');\n
    • Get by name
      var gameObject = dialog.getElement('#' + name);\n// var gameObject = dialog.getElement('#' + name, recursive);\n
      or
      var gameObject = dialog.getByName(name);\n// var gameObject = dialog.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-nameinputdialog/#other-properties","title":"Other properties","text":"

    See dialog, sizer object, base sizer object, container-lite.

    "},{"location":"ui-nameinputdialog/#events","title":"Events","text":"
    • Click confirm button
      dialog.on('confirm', function (data) {\nvar firstName = data.firstName;\nvar lastName = data.lastName;\n}, scope);\n
      • data : See modal
    "},{"location":"ui-namevaluelabel/","title":"Name value label","text":""},{"location":"ui-namevaluelabel/#introduction","title":"Introduction","text":"

    A container with name text, value text in a row, with a horizontal line progress bar, and an icon, background.

    • Author: Rex
    • Game object
    "},{"location":"ui-namevaluelabel/#live-demos","title":"Live demos","text":"
    • Name-value label
    • Custom bar
    "},{"location":"ui-namevaluelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-namevaluelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-namevaluelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.nameValueLabel(config);\n
    "},{"location":"ui-namevaluelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.nameValueLabel(config);\n
    "},{"location":"ui-namevaluelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { NameValueLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new NameValueLabel(scene, config);\nscene.add.existing(label);\n
    "},{"location":"ui-namevaluelabel/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.nameValueLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\n\nnameText: nameTextGameObject,\nvalueText: valueTextGameObject,\n// valueTextFormatCallback: function(value, min, max) {\n//     return `${value}/${max}`;\n// },\n// valueTextFormatCallback: null,\n\n// barShape: 'line',   // 'line', or 'circle'\n\n// line bar\nbar: {        trackColor: undefined,\ntrackThickness: 2,\ntrackStrokeColor: undefined,\nbarColor: undefined,\nbarColor2: undefined,\n\nskewX: 0,\n\nrtl: false,\n\neaseValue: {\nduration: 0,\nease: 'linear'\n},\n}, // circle bar\n/*\n    bar: {\n        barColor: undefined,\n        barColor2: undefined,\n        trackColor: undefined,\n        centerColor: undefined,\n        thickness: 0.2,\n        startAngle: Phaser.Math.DegToRad(270),\n        endAngle: Phaser.Math.DegToRad(270+360),\n        anticlockwise: false,\n    }\n    */\n\n// bar: CustomProgressGameObject,\n\n// bar: undefined,\n\naction: actionGameObject,\nactionMask: false,\n\nalign: {        text: 'bottom',  // 'top', 'center', 'bottom'\n},\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0, iconTop: 0, iconBottom: 0,\nname: 0, value: 0,\nbar:0, barBottom: 0, barLeft: 0, barRight: 0,\ntext: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • nameText : Game object of nameText.
      • OriginX of nameText will be set to 0.
      • Empty text will be set to a space character ' '. To preserve height of this text game object.
    • valueText : Game object of valueText.
      • OriginX of nameText will be set to 1.
      • Empty text will be set to a space character ' '. To preserve height of this text game object.
    • valueTextFormatCallback : Callback to return a string set to valueText game object when invokeing label.setValue(value, min, max) method.
      • A callback
        function(value, min, max) {\nreturn `${value}/${max}`;\n}\n
      • null, or false : Don't set valueText game object.
    • barShape : 'line' or 'circle'.
    • bar : Game object of bar, or config of horizontal line progress bar, or config of circular progress bar or undefined.
      • Config of horizontal line progress bar
        • bar.trackColor : Fill color of bar's track, in number or css string value.
        • bar.trackStrokeColor : Stroke color of bar's track, in number or css string value.
        • bar.trackThickness : Stroke line width of bar's track.
        • bar.barColor, bar.barColor2 : Fill color of bar, in number or css string value. Assign gradient start color by barColor2.
        • bar.skewX : Horizontal skew of track and bar.
        • bar.rtl :
          • false : Bar starts from left side. Default behavior.
          • true : Bar starts from right side.
      • Config of circular progress bar
        • bar.barColor, bar.barColor2 : Fill color of circular bar, in number or css string value. Assign gradient start color by barColor2.
        • bar.trackColor : Color of circular track, in number or css string value.
        • bar.centerColor : Color of center circle, in number or css string value.
        • bar.thickness : 0 ~ 1, thickness of circular bar. Default value is 0.2 (0.2*radius)
        • bar.startAngle : Start angle of circular bar, in radians. Default value is 270 degrees.
        • bar.endAngle : End angle of circular bar, in radians. Default value is 270+360 degrees.
        • bar.anticlockwise : Set true to put anticlockwise circular bar. Default value is false.
      • (CustomProgress) Game object.
      • undefined : No bar game object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • align :
      • align.text : Alignment of nameText, valueText game objects.
        • 'top', 'center', or 'bottom'. Default value is 'bottom'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom : Space around icon game object.
      • space.name : Left space of nameText game object.
      • space.value : Right space of valueText game object.
      • space.bar, space.barLeft, space.barRight, space.barBottom : Space around bar game object.
      • space.text : Space between text game object and action icon game object.
      • space.actionTop, space.actionBottom : Space around action game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-namevaluelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNameValueLabel extends RexPlugins.UI.NameValueLabel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyNameValueLabel(scene, config);\n
    "},{"location":"ui-namevaluelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-namevaluelabel/#name-text","title":"Name text","text":"
    • Get nameText string
      var s = label.nameText;\n
    • Set nameText string
      label.setNameText(s);\n
      or
      label.nameText = s;\n
    "},{"location":"ui-namevaluelabel/#value-text","title":"Value text","text":"
    • Get valueText string
      var s = label.valueText;\n
    • Set valueText string
      label.setValueText(s);\n
      or
      label.valueText = s;\n
    "},{"location":"ui-namevaluelabel/#bar","title":"Bar","text":"
    • Get bar value
      var s = label.barValue;\n
    • Set bar value
      label.setBarValue(value);  // 0~1\n
      or
      label.setBarValue(value, min, max);  // min~max\n
      or
      label.barValue = t;  // 0~1\n
    • Ease bar value
      label.easeBarValueTo(value);  // 0~1\n
      or
      label.easeBarValueTo(value, min, max);    // min~max\n
    "},{"location":"ui-namevaluelabel/#icon-texture","title":"Icon texture","text":"
    • Set texture
      label.setTexture(key);\n// label.setTexture(key, frame);\n
    • Set texture via texture object
      label.setTexture(texture);\n// label.setTexture(texture, frame);\n
    • Get texture, frame.
      var texture = label.texture;\nvar frame = label.frame;\n
    • Get texture key, frame name.
      var textureKey = label.texture.key;\nvar frameName = label.frame.name;\n
    "},{"location":"ui-namevaluelabel/#set-value","title":"Set value","text":"
    • Set valueText game object and bar game object.
      label.setValue(value, min, max);\n// label.setValue(value);  // min, max are not changed\n
      or
      label.setValue(value);  // min, max are not changed\n
      Will invoke valueTextFormatCallback callback.
    • Ease valueText game object and bar game object.
      label\n.setEaseValueDuration(duration)\n.easeValueTo(value, min, max);\n
      or
      label\n.setEaseValueDuration(duration)\n.easeValueTo(value);  // min, max are not changed\n
      Will invoke valueTextFormatCallback callback.
    • Get values
      var value = label.value;\nvar max = label.maxValue;\nvar min = label.minValue;\n
      • value will ease during label.easeValueTo() task.
    "},{"location":"ui-namevaluelabel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = label.getElement('background');\n
      • Icon game object
        var icon = label.getElement('icon');\n
      • NameText game object
        var nameTextObject = label.getElement('name');\n
      • ValueText game object
        var valueTextObject = label.getElement('value');\n
      • Bar game object
        var textObject = label.getElement('bar');\n
      • Action icon game object
        var action = label.getElement('action');\n
    • Get by name
      var gameObject = label.getElement('#' + name);\n// var gameObject = label.getElement('#' + name, recursive);\n
      or
      var gameObject = label.getByName(name);\n// var gameObject = label.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-namevaluelabel/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-numberbar/","title":"Number bar","text":""},{"location":"ui-numberbar/#introduction","title":"Introduction","text":"

    A container with an icon, slider, text, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-numberbar/#live-demos","title":"Live demos","text":"
    • Number bar
    • Color picker
    • Video player
    "},{"location":"ui-numberbar/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-numberbar/#install-plugin","title":"Install plugin","text":""},{"location":"ui-numberbar/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin(\n\"rexuiplugin\",\n\"https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js\",\n\"rexUI\",\n\"rexUI\"\n);\n
    • Add number bar object
      var numberBar = scene.rexUI.add.numberBar(config);\n
    "},{"location":"ui-numberbar/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from \"phaser3-rex-plugins/templates/ui/ui-plugin.js\";\nvar config = {\n// ...\nplugins: {\nscene: [\n{\nkey: \"rexUI\",\nplugin: UIPlugin,\nmapping: \"rexUI\",\n},\n// ...\n],\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add number bar object
      var numberBar = scene.rexUI.add.numberBar(config);\n
    "},{"location":"ui-numberbar/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { NumberBar } from \"phaser3-rex-plugins/templates/ui/ui-components.js\";\n
    • Add number bar object
      var sizer = new NumberBar(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-numberbar/#add-number-bar-object","title":"Add number bar object","text":"
    var numberBar = scene.rexUI.add.numberBar({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\nslider: {\nbackground: backgroundGameObject,\n/* \n        background: { \n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */    indicator: indicatorGameObject,\n/* \n        indicator: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\ninput: 'drag',\ngap: undefined,        easeValue: {\nduration: 0,\nease: 'Linear'\n},\n}\ntext: textGameObject,\n\nvaluechangeCallback: function(newValue, oldValue, numberBar) {\n// numberBar.text = Math.round(Phaser.Math.Linear(0, 100, newValue));\n}\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\nslider: 0,\n},\n\nenable: true,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of numberBar.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
    • slider : Slider game object which composed of
      • slider.width : Fixed width of slider, optional. Width of slider will be extended if this value is not set.
      • slider.background :
        • Game object of background, optional. This background game object will be resized to fit the size of slider.
        • A plain object to create round rectangle shape
          { radius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.track :
        • Game object of track, optional. This track game object will be resized to fit the size of slider, with space.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.indicator :
        • Game object of indicator, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.thumb :
        • Game object of thumb, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.input :
        • 'pan', 'drag', or 0 : Control knob by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.gap : Snap a value to nearest grid slice, using rounding.
        • undefined : Disable this feature.
      • slider.easeValue : Easing value when input is 'click'.
        • slider.easeValue.duration : Duration of value easing, default is 0 (no easing).
        • slider.easeValue.ease : Ease function, default is 'Linear'.
    • text : Game object of text, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds
      • space.icon : Space between icon game object and text game object.
      • space.slider : Space between slider game object and text game object.
    • valuechangeCallback : callback function when value changed.
    • enable : Set false to disable controlling.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-numberbar/#custom-class","title":"Custom class","text":"
    • Define class
      class MyNumberBar extends RexPlugins.UI.NumberBar {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var numberBar = new MyNumberBar(scene, config);\n
    "},{"location":"ui-numberbar/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    numberBar.layout();\n

    See also - dirty

    "},{"location":"ui-numberbar/#get-element","title":"Get element","text":"
    • Get element
    • Background game object
      var background = numberBar.getElement(\"background\");\n
    • Icon game object
      var icon = numberBar.getElement(\"icon\");\n
    • Slider game object
      • Slider background
        var sliderBackground = numberBar.getElement(\"slider.background\");\n
      • Slider track
        var sliderTrack = numberBar.getElement(\"slider.track\");\n
      • Slider indicator
        var sliderIndicator = numberBar.getElement(\"slider.indicator\");\n
      • Slider thumb
        var sliderThumb = numberBar.getElement(\"slider.thumb\");\n
    • Text game object
      var textObject = numberBar.getElement(\"text\");\n
    • Get by name
      var gameObject = numberBar.getElement(\"#\" + name);\n// var gameObject = numberBar.getElement('#' + name, recursive);\n
      or
      var gameObject = numberBar.getByName(\"#\" + name);\n// var gameObject = numberBar.getByName(name, recursive);\n
    • recursive : Set true to search all children recursively.
    "},{"location":"ui-numberbar/#enable","title":"Enable","text":"
    • Get
      var enable = numberBar.enable;\n
    • Set
      numberBar.setEanble(enable);\n
      or
      numberBar.enable = enable;\n
    "},{"location":"ui-numberbar/#value","title":"Value","text":"

    Change value will also change the position of slider thumb and width of slider indicator.

    • Get value
      var value = numberBar.getValue(min, max); // value : min ~ max\n
      or
      var value = numberBar.getValue(); // value: 0 ~ 1\n
      or
      var value = numberBar.value; // value: 0 ~ 1\n
    • Set value
      numberBar.setValue(value, min, max); // value: min ~ max\n
      or
      numberBar.setValue(value); // value: 0 ~ 1\n
      or
      numberBar.value = value; // value: 0 ~ 1\n
    • Increase value
      numberBar.addValue(inc, min, max); // inc: min ~ max\n
      or
      numberBar.addValue(inc); // inc: 0 ~ 1\n
      or
      numberBar.value += inc; // inc: 0 ~ 1\n
    "},{"location":"ui-numberbar/#ease-value","title":"Ease value","text":"
    • Ease value to
      numberBar.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      numberBar.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      numberBar.stopEaseValue();\n
    • Set ease duration
      numberBar.setEaseValueDuration(duration);\n
    • Set ease function
      numberBar.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"ui-numberbar/#text","title":"Text","text":"
    • Get text string
      var s = numberBar.text;\n
    • Set text string
      numberBar.setText(s);\n
      or
      numberBar.text = s;\n
    "},{"location":"ui-numberbar/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-numberbar/#events","title":"Events","text":"
    • On value changed
      numberBar.on('valuechange', function (newValue, oldValue, numberBar) {\n// numberBar.text = Math.round(Phaser.Math.Linear(0, 100, newValue));\n}, scope);\n
    • On input start
      numberBar.on('inputstart', function(pointer) {\n\n}, scope);\n
    • On input end
      numberBar.on('inputend', function(pointer) {\n\n}, scope);\n
    "},{"location":"ui-overlapsizer/","title":"Overlap sizer","text":""},{"location":"ui-overlapsizer/#introduction","title":"Introduction","text":"

    Layout children game objects overlapped.

    • Author: Rex
    • Game object
    "},{"location":"ui-overlapsizer/#live-demos","title":"Live demos","text":"
    • Overlap
    • Aspect ratio
    • Fit viewport
    "},{"location":"ui-overlapsizer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-overlapsizer/#install-plugin","title":"Install plugin","text":""},{"location":"ui-overlapsizer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add sizer object
      var sizer = scene.rexUI.add.overlapSizer(config);\n
    "},{"location":"ui-overlapsizer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sizer object
      var sizer = scene.rexUI.add.overlapSizer(config);\n
    "},{"location":"ui-overlapsizer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { OverlapSizer } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add sizer object
      var sizer = new OverlapSizer(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-overlapsizer/#add-sizer-object","title":"Add sizer object","text":"
    var sizer = scene.rexUI.add.overlapSizer({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,    \n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.overlapSizer(x, y, {\n// width: undefined,\n// height: undefined,\n// anchor: undefined,    \n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.overlapSizer(x, y, width, height, {\n// anchor: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-overlapsizer/#custom-class","title":"Custom class","text":"
    • Define class
      class MySizer extends RexPlugins.UI.OverlapSizer {\nconstructor(scene, x, y, minWidth, minHeight, config) {\nsuper(scene, x, y, minWidth, minHeight, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var sizer = new MySizer(scene, x, y, minWidth, minHeight, config);\n
    "},{"location":"ui-overlapsizer/#add-background","title":"Add background","text":"
    sizer.addBackground(child);\n

    or

    sizer.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
      • items is a reserved key, which is used to store all children.
    "},{"location":"ui-overlapsizer/#add-child","title":"Add child","text":"

    Add a game obejct to sizer

    sizer.add(child);\n

    or

    sizer.add(child,\n{\nkey: undefined,\nalign: 'center',     offsetX: 0,\noffsetY: 0,\noffsetOriginX: 0,\noffsetOriginY: 0,\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: true,        // expand: {width, height}\nminWidth: undefined,\nminHeight: undefined,\naspectRatio: 0,\n}\n);\n

    or

    sizer.add(child, key, align, padding, expand, minWidth, minHeight, offsetX, offsetY);\n
    • child : A game object.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Use current timestamp as key.
      • items is a reserved key, which is used to store all children.
    • align :
      • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
      • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
      • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center.
      • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center.
      • 'left-top' , or Phaser.Display.Align.TOP_LEFT : Align game object at left-top.
      • 'left-center' , or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
      • 'left-bottom' , or Phaser.Display.Align.BOTTOM_LEFT : Align game object at left-bottom.
      • 'center-top' , or Phaser.Display.Align.TOP_CENTER : Align game object at center-top.
      • 'center-center' , or Phaser.Display.Align.CENTER : Align game object at center-center.
      • 'center-bottom' , or Phaser.Display.Align.BOTTOM_CENTER : Align game object at center-bottom.
      • 'right-top' , or Phaser.Display.Align.TOP_RIGHT : Align game object at right-top.
      • 'right-center' , or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • 'right-bottom' , or Phaser.Display.Align.BOTTOM_RIGHT : Align game object at right-bottom.
    • offsetX, offsetOriginX : Apply offset offsetX + offsetOriginY * width to x coordinate after alignment.
    • offsetY, offsetOriginY : Apply offset offsetY + offsetOriginY * height to y coordinate after alignment.
    • padding : Extra padded space. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • expand :
      • Boolean value
        • true : Expand width and height of child. Default value.
        • false : Don't expand width or height of child.
      • A plain object
        • {width: true} : Only expand width of child.
        • {height: true} : only expand height of child.
        • {width: true, height: true} : Expand width and height of child.
    • minWidth : Minimum width of normal (non-sizer) game object, used when expand width mode. Default value is current display width.
    • minHeight : Minimum height of normal (non-sizer) game object, used when expand height mode. Default value is current display height.
    • aspectRatio : Keep aspect ratio after layout.
      • 0 : Don't keep aspect ratio. Default behavior.
      • true : Keep aspect ratio via current size.
      • A number : Keep aspect ratio via given value.
    "},{"location":"ui-overlapsizer/#add-multiple","title":"Add multiple","text":"
    sizer.add(gameObjects, config);\n
    • gameObjects : Array of child game objects
    • config : See config of add-child
    "},{"location":"ui-overlapsizer/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    sizer.layout();\n

    See also - dirty

    "},{"location":"ui-overlapsizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-overlapsizer/#remove-child","title":"Remove child","text":"
    • Remove a child
      sizer.remove(child);\n
      or
      sizer.remove(key);\n
    • Remove and destroy a child
      sizer.remove(child, true);\n
      or
      sizer.remove(key, true);\n
    • Remove all children
      sizer.removeAll();\n
    • Remove and destroy all children
      sizer.removeAll(true);\n
    • Remove all children and backgrounds
      sizer.clear();\n
    • Remove and destroy all children and backgrounds
      sizer.clear(true);\n
    • Remove from parent sizer
      sizer.removeFromParentSizer();\n
    "},{"location":"ui-overlapsizer/#get-element","title":"Get element","text":"
    • Get element
    • A child
      var item = sizer.getElement(key);\n
      or
      var item = sizer.getElement('items[' + key + ']');\n
      • All children items
        var items = sizer.getElement('items');\n
    • Get by name
      var gameObject = sizer.getElement('#' + name);\n// var gameObject = sizer.getElement('#' + name, recursive);\n
      or
      var gameObject = sizer.getByName(name);\n// var gameObject = sizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-overlapsizer/#get-child-index","title":"Get child index","text":"
    var index = sizer.getChildIndex(child);\n
    • index : A number, string, or null.
    "},{"location":"ui-overlapsizer/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-overview/","title":"Overview","text":""},{"location":"ui-overview/#install-ui-plugins","title":"Install ui plugins","text":""},{"location":"ui-overview/#install-from-minify-file","title":"Install from minify file","text":"
    1. Download minify file (link).
    2. Install ui plugin in preload stage
      scene.load.scenePlugin({\nkey: 'rexuiplugin',\nurl: filePath,\nsceneKey: 'rexUI'\n});\n
      • key : Must be 'rexuiplugin'
    "},{"location":"ui-overview/#install-from-npm-package","title":"Install from npm package","text":"
    1. Install rex plugins
      npm i phaser3-rex-plugins\n
    2. Install ui plugin in configuration of game
      import RexUIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\n\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: RexUIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    "},{"location":"ui-overview/#using-typescript-declaration-file","title":"Using typescript declaration file","text":"
    import 'phaser';\nimport RexUIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\ndeclare module 'phaser' {\ninterface Scene {\nrexUI: RexUIPlugin;\n}\n}\n

    or

    import RexUIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\n\nclass Game extends Phaser.Scene {\nrexUI: RexUIPlugin;  // Declare scene property 'rexUI' as RexUIPlugin type\n\ncreate() {\nvar sizer = this.rexUI.add.sizer({\n// ...\n})\n}\n}\n\nvar game = new Phaser.Game({\nscene: Game,\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: RexUIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n});\n
    • 'phaser3-rex-plugins/templates/ui/ui-plugin' : Factories of rexUI components.
    • 'phaser3-rex-plugins/templates/ui/ui-components' : Class of rexUI components.
      import { Sizer } from 'phaser3-rex-plugins/templates/ui/ui-components';\n

    See this example

    "},{"location":"ui-overview/#list-of-ui-plugins","title":"List of ui plugins","text":""},{"location":"ui-overview/#ui-components","title":"UI components","text":"
    1. Badge label: A container with badges above a main item.
    2. Buttons: A container with a group of buttons.
    3. Color componets: Edit color value by RGB, or HSV input fields.
    4. Color input: Color number or color string input field.
    5. Color picker: Pick color value from H and SV palettes.
    6. Confirm action button: Create a modal confirm dialog temporary, invoke callback after clicking button.
    7. Confirm dialog: Using json style to create confirm dialog.
    8. Dialog: A container with a title, content, buttons and background.
    9. Drop down list: A label can open a drop-down list panel.
    10. Exp bar: Disply experience bar on NameValueLabel.
    11. File selector button: A transparent file chooser button above a Label.
    12. Fix-width-buttons: A container with a group of fix-width buttons.
    13. Fix-width-sizer: Layout children game objects into lines.
    14. Folder: A container with a title, foldable child, and background.
    15. Grid-buttons: A container with a group of buttons in grids.
    16. Grid-sizer: Layout children game objects in grids.
    17. Grid-table: A container with a grid table, slider, and scroller.
    18. Holy grail: Layout elements in Holy grail style.
    19. Knob: A knob button based on circular progress.
    20. Label: A container with an icon, text, and background.
    21. Menu: A container with buttons and sub-menu.
    22. Name-input dialog: Enter first name and last name via a dialog.
    23. Name-value label: A container with name text, value text in a row, with a horizontal line progress bar, and an icon, background.
    24. Image input label: A container with a canvas icon, text, and background. Click icon to popup a (image) file chooser dialog, display selected image on canvas.
    25. Number-bar: A container with an icon, slider, text, and background.
    26. Overlap sizer: Layout children game objects overlapped.
    27. Pages: A container with pages, only current page is visible.
    28. Perspective card: A container with front and back faces.
    29. Scroll-able panel: A container with a panel, slider, and scroller.
    30. Simple drop down list: Using plain object to create drop down list.
    31. Simple label: Using json style to create label.
    32. Simple title label: Using json style to create title label.
    33. Simple text box: Using json style to create text box.
    34. Sizer: Layout children game objects.
    35. Slider: A container with a track, indicator, thumb and background.
    36. Split panels: A container with left(top) panel, right(bottom) panel, splitter, and background. Drag splitter to resize with left(top) panel, right(bottom) panel.
    37. Tab-pages: A container with tabs and pages, only current page is visible.
    38. Tabs: A container with 4 groups of buttons around a center panel.
    39. TextArea: A container with a text, slider, and scroller.
    40. TextAreaInput: A container with a canvasInput, and slider.
    41. Textbox: A container with an icon, (typing and paging) text, and background.
    42. Title label: A container with title, text in two rows, and an icon, background.
    43. Toast: Show text message for a short while.
    44. Toast queue: Queue messages for a short while.
    45. Trees: A container with trees and leaf-nodes.
    46. Tweaker: Fine-tuning properties of target object.

    Scroll-able table

    There are 3 kinds of scroll-able tables :

    • Grid-table only creates visible objects. It is suitable for large table.
    • Grid-sizer adds all objects. Put this grid-sizer into scroll-able panel to have a scroll-able table.
    • Fixwidth-sizer adds all objects. Put this fixwidth-sizer into scroll-able panel to have a scroll-able table.
    "},{"location":"ui-overview/#basic-container","title":"Basic container","text":"
    1. ContainerLite: Control the position and angle of children game objects.
      var container = scene.rexUI.add.container(x, y);\n
      or
      class MyContainer extends RexPlugins.UI.Container {\nconstructor(scene, x, y, width, height, children) {\nsuper(scene, x, y, width, height, children);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#background-objects","title":"Background objects","text":"
    1. Round-rectangle: Round rectangle shape.
      var shape = scene.rexUI.add.roundRectangle(x, y, width, height, radius, fillColor);\n
      or
      class MyRoundRectangle extends RexPlugins.UI.RoundRectangle {\nconstructor(scene, x, y, width, height, radius, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, radius, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. Nine-patch: Stretchable imaage.
      var ninePatch = scene.rexUI.add.ninePatch(x, y, width, height, key, columns, rows, config);\n
      var ninePatch = scene.rexUI.add.ninePatch2(x, y, width, height, key, columns, rows, config);\n
      or
      class MyNinePatch extends RexPlugins.UI.NinePatch {\nconstructor(scene, x, y, width, height, key, columns, rows, config) {\nsuper(scene, x, y, width, height, key, columns, rows, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
      class MyNinePatch extends RexPlugins.UI.NinePatch2 {\nconstructor(scene, x, y, width, height, key, columns, rows, config) {\nsuper(scene, x, y, width, height, key, columns, rows, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    3. Quad shape: Quad shape, offsets can be given on four vertices, and additional points can be added on the four sides.
      var quad = scene.rexUI.add.quadShapes(x, y, width, height, fillColor, fillAlpha);\n
      or
      class MyQuadShape extends RexPlugins.UI.QuadShape {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    4. Custom shapes: Custom shapes on shape.
      var customShapes = scene.rexUI.add.customShapes(x, y, width, height, config);\n
      or
      class MyCustomShapes extends RexPlugins.UI.CustomShapes {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    5. Custom progress: Custom progress on shape.
      var customProgress = scene.rexUI.add.customProgress(x, y, width, height, config);\n
      or
      class MyCustomProgress extends RexPlugins.UI.CustomProgress {\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}    
    6. Canvas-round-rectangle: Round rectangle on canvas.
      var shape = scene.rexUI.add.roundRectangleCanvas(x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n
      or
      class MyRoundRectangleCanvas extends RexPlugins.UI.RoundRectangleCanvas {\nconstructor(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient) {\nsuper(scene, x, y, width, height, radiusConfig, fillStyle, strokeStyle, lineWidth, fillColor2, isHorizontalGradient);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    7. Cover: Rectangle shape covered full window, and block all touch events.
      var shape = scene.rexUI.add.cover(config);\n
      or
      class MyCover extends RexPlugins.UI.Cover {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#canvasshape-objects","title":"Canvas/Shape objects","text":"
    1. Canvas: Drawing on canvas.
      var canvas = scene.rexUI.add.canvas(x, y, width, height);\n// var canvas = scene.rexUI.add.canvas(x, y, width, height);\n
      or
      class MyCanvas extends RexPlugins.UI.Canvas {\nconstructor(scene, x, y, width, height) {\nsuper(scene, x, y, width, height);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. Circle mask image: Load a texture, then apply a circle mask.
      var image = scene.rexUI.add.circleMaskImage(x, y, key, frame, config);\n
      or
      class MyImage extends RexPlugins.UI.CircleMaskImage {\nconstructor(scene, x, y, key, frame, config) {\nsuper(scene, x, y, key, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    3. Alpha mask image: Load a texture, then apply an alpha mask from another texture.
      var image = scene.rexUI.add.alphaMaskImage(x, y, key, frame, config);\n
      or
      class MyImage extends RexPlugins.UI.AlphaMaskImage {\nconstructor(scene, x, y, key, frame, config) {\nsuper(scene, x, y, key, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    4. Circular progress shape: Circular progress bar shape.
      var circularProgress = scene.rexUI.add.circularProgress(x, y, radius, barColor, value, config);\n
      or
      class MyCircularProgress extends RexPlugins.UI.CircularProgress {\nconstructor(scene, x, y, radius, barColor, value, config) {\nsuper(scene, x, y, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    5. Circular progress canvas: Circular progress bar on canvas
      var circularProgress = scene.rexUI.add.circularProgressCanvas(x, y, radius, barColor, value, config);\n
      or
      class MyCircularProgress extends RexPlugins.UI.CircularProgressCanvas {\nconstructor(scene, x, y, radius, barColor, value, config) {\nsuper(scene, x, y, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    6. Line progress shape: Horizontal line progress bar shape.
      var lineProgress = scene.rexUI.add.lineProgress(x, y, width, height, barColor, value, config);\n
      or
      class MyLineProgress extends RexPlugins.UI.LinerProgress {\nconstructor(scene, x, y, width, height, barColor, value, config) {\nsuper(scene, x, y, width, height, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    7. Round rectangle progress shape: Horizontal or vertical round rectangle progress bar shape.
      var roundRectangleProgress = scene.rexUI.add.roundrectangleProgress(x, y, width, height, radius, barColor, value, config);\n
      or
      class MyRoundRectangleProgress extends RexPlugins.UI.RoundRectangleProgress {\nconstructor(scene, x, y, width, height, radius, barColor, value, config) {\nsuper(scene, x, y, width, height, radius, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    8. Line progress canvas: Horizontal line progress bar filled with gradient color on canvas.
      var lineProgress = scene.rexUI.add.lineProgressCanvas(x, y, width, height, barColor, value, config);\n
      or
      class MyLineProgress extends RexPlugins.UI.LinerProgressCanvas {\nconstructor(scene, x, y, width, height, barColor, value, config) {\nsuper(scene, x, y, width, height, barColor, value, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    9. Checkbox: Checkbox input with drawing checker path animation.
      var checkbox = scene.rexUI.add.checkbox(x, y, width, height, color, config);\n
      or
      class MyCheckbox extends RexPlugins.UI.Checkbox {\nconstructor(scene, x, y, width, height, color, config) {\nsuper(scene, x, y, width, height, color, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    10. Toggle switch: Toggle-switch input.
      var toggleSwitch = scene.rexUI.add.toggleSwitch(x, y, width, height, color, config);\n
      or
      class MyToggleSwitch extends RexPlugins.UI.ToggleSwitch {\nconstructor(scene, x, y, width, height, color, config) {\nsuper(scene, x, y, width, height, color, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    11. Triangle: Trangle shape inside a rectangle bounds.
      var triangle = scene.rexUI.add.triangle(x, y, width, height, fillColor, fillAlpha);\n
      or
      class MyTriangle extends RexPlugins.UI.Triangle {\nconstructor(scene, x, y, width, height, fillColor, fillAlpha) {\nsuper(scene, x, y, width, height, fillColor, fillAlpha);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    12. AIO-spinner
      var spinner = scene.rexUI.add.aioSpinner(config);\n
      or
      class MySpinner extends RexPlugins.UI.AIOSpinner {\nconstructor(scene, configa) {\nsuper(scene, configa);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    13. Chart: Draw chart on canvas.
    "},{"location":"ui-overview/#colored-text-objects","title":"Colored text objects","text":"
    1. BBCode text: Drawing text with BBCode protocol.
      var txt = scene.rexUI.add.BBCodeText(x, y, text, style);\n
      or
      class MyText extends RexPlugins.UI.BBCodeText {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. Tag text: Displays text with multi-color, font face, or font size with tags.
      var txt = scene.rexUI.add.tagText(x, y, text, style);\n
      or
      class MyText extends RexPlugins.UI.TagText {\nconstructor(scene, x, y, text, style) {\nsuper(scene, x, y, text, style);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    3. Dynamic text: Control position, angle of each character drawn on a canvas.
      var txt = scene.rexUI.add.dynamicText(config);\n
      or
      class MyText extends RexPlugins.UI.DynamicText {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    4. Text player: Typing characters on dynamic text, waiting click or key enter, play sound effect or backgroun music.
      var txt = scene.rexUI.add.textPlayer(config);\n
      or
      class MyText extends RexPlugins.UI.TextPlayer {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    5. Canvas input: An invisible Input DOM element to receive character input and display on DynamicText.
      var txt = scene.rexUI.add.canvasInput(config);\n
      or
      class MyText extends RexPlugins.UI.CanvasInput {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#behaviors-of-text","title":"Behaviors of text","text":"
    1. Hidden text edit: Create an invisible Input DOM element to edit string content.
      var hiddenEdit = this.rexUI.add.hiddenEdit(textObject, config);\n
      • textObject : text, bbocodetext, tagtext, or label.
    2. Text edit: Create an input text object above a text object to edit string content.
      scene.rexUI.edit(textObject, config);\n// scene.rexUI.edit(textObject, config, onClose);\n
    3. Wrap-expand text
      var textObject = scene.rexUI.wrapExpandText(textObject);\n// var textObject = scene.rexUI.wrapExpandText(textObject, minWidth);\n
      • textObject :
        • Text object, bbcode text object, tag text object,
        • Bitmap text object
        • Dynamic text object, With default wrap configuration, ex:
          {\nlineHeight: 24,\npadding: {bottom: 12}\n}\n
    4. Font-size-expand text
      var textObject = scene.rexUI.fontSizeExpandText(textObject);    
      or
      var textObject = scene.rexUI.fontSizeExpandText(textObject, {\nfitHeight: true\n});\n
      • textObject :
        • Text object, bbcode text object, tag text object, bitmap text game object
      • fitHeight :
        • false : Set font size to fit width only. Default behavior.
        • true : Set font size to fit width and height.
    5. Set font-size to fit width
      var textObject = scene.rexUI.setFontSizeFitToWidth(textObject, width);\n
      • textObject :
        • Text object, bbcode text object, tag text object, bitmap text game object
    6. Text typing
      var textTyping = scene.rexUI.add.textTyping(textObject, config);\n
    7. Text page
      var textPage = scene.rexUI.add.textPage(textObject, config);\n
    "},{"location":"ui-overview/#scaled-image","title":"Scaled image","text":"
    1. Image box: Keep aspect ratio of image game object after scale-down resizing.
      var image = scene.rexUI.add.imageBox(x, y, texture, frame, config);\n
      or
      class MyImageBox extends RexPlugins.UI.ImageBox {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#transition-image","title":"Transition image","text":"
    1. Transition image: Transit texture to another one.
      var image = scene.rexUI.add.transitionImage(x, y, texture, frame, config);\n
      or
      class MyTransitionImage extends RexPlugins.UI.TransitionImage {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. Transition image pack: Transit texture to another one, with some pre-build effects, extended from TransitionImage.
      var image = scene.rexUI.add.transitionImagePack(x, y, texture, frame, config);\n
      or
      class MyTransitionImagePack extends RexPlugins.UI.TransitionImagePack {\nconstructor(scene, x, y, texture, frame, config) {\nsuper(scene, x, y, texture, frame, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#dom-game-objects","title":"Dom game objects","text":"
    1. Input text: Input DOM element.
      var inputText = scene.rexUI.add.inputText(config);\n
      or
      class MyInputText extends RexPlugins.UI.InputText {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    2. File chooser: Create a transparent file chooser button (<input type=\"file\">).
      var fileChooser = scene.rexUI.add.fileChooser(config);\n
      or
      class MyFileChooser extends RexPlugins.UI.FileChooser {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    3. File drop zone: Create a div element for dropping file(s).
      var fileDropZone = scene.rexUI.add.fileDropZone(config);\n
      or
      class MyFileDropZpne extends RexPlugins.UI.FileDropZpne {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    "},{"location":"ui-overview/#layer-manager","title":"Layer manager","text":"

    Layer manager : A dictionary to store Layer game objects.

    var layerManager = scene.rexUI.add.layerManager({\n// layers: ['layer0', 'layer1', ...]\n});\n\n// layerManager.addToLayer(name, gameObject);\n
    "},{"location":"ui-overview/#touch-input","title":"Touch input","text":"
    1. Click: Fires 'click' event when touch releasd after pressed.
      var click = scene.rexUI.add.click(gameObject, config);\n
      or
      var click = new RexPlugins.UI.Click(gameObject, config);\n
    2. Click-Outside: Fires 'clickoutside' event when pointer-down or pointer-up outside of game object.
      var clickOutside = scene.rexUI.add.clickOutside(gameObject, config);\n
      or
      var clickOutside = new RexPlugins.UI.ClickOutside(gameObject, config);\n
    3. In touching: Fires 'intouch' event every tick when pressing on a game object.
      var inTouching = scene.rexUI.add.inTouching(gameObject, config);\n
      or
      var inTouching = new RexPlugins.UI.inTouching(gameObject, config);\n
    4. Tap: Get tap/multi-taps events of a game object.
      var tap = scene.rexUI.add.tap(gameObject, config);\n
      or
      var tap = new RexPlugins.UI.Tap(gameObject, config);\n
    5. Press: Get press events of a game object.
      var press = scene.rexUI.add.press(gameObject, config);\n
      or
      var press = new RexPlugins.UI.Press(gameObject, config);\n
    6. Swipe: Get swipe events of a game object.
      var swipe = scene.rexUI.add.swipe(gameObject, config);\n
      or
      var swipe = new RexPlugins.UI.Swipe(gameObject, config);\n
    7. Pan: Get pan events of a game object.
      var pan = scene.rexUI.add.pan(gameObject, config);\n
      or
      var pan = new RexPlugins.UI.Pan(gameObject, config);\n
    8. Pinch: Get scale factor from 2 dragging touch pointers.
      var pinch = scene.rexUI.add.pinch(config);\n
      or
      var pinch = new RexPlugins.UI.Pinch(config);\n
    9. Rotste: Get spin angle from 2 dragging touch pointers.
      var rotate = scene.rexUI.add.rotate(config);\n
      or
      var rotate = new RexPlugins.UI.Rotate(config);\n
    10. Touch event stop: Stop touch events propagation.
      var touchEventStop = scene.rexUI.add.touchEventStop(gameObject, config);\n
      or
      var touchEventStop = new RexPlugins.UI.TouchEventStop(gameObject, config);\n
    "},{"location":"ui-overview/#behaviors","title":"Behaviors","text":"
    1. Confirm action : Create a modal confirm dialog temporary, invoke callback after clicking button.
      scene.rexUI.confirmAction(scene, config)\n.then(function(data){ })\n
    2. Modal promise : Modal behavior wrapped into promise.
      scene.rexUI.modalPromise(gameObject, config)\n.then(function(closeEventData){ })\n
      • Close modal dialog:
        scene.rexUI.modalClose(gameObject);\n// scene.rexUI.modalClose(gameObject, closeEventData);\n
        or
        gameObject.emit('modal.requestClose');\n// gameObject.emit('modal.requestClose', closeEventData);\n
        • Fire 'modal.requestClose' event on game object, which will invoke modal.requestClose() method. After closing dialog, resolve part of promise will be triggered.
    3. Flip: Flip game object to another face by scaling width/height.
      var flip = scene.rexUI.add.flip(gameObject, config);\n
      or
      var flip = new RexPlugins.UI.Flip(gameObject, config);\n
    4. Fade in, fade out destroy
      scene.rexUI.fadeIn(gameObject, duration);\n// scene.rexUI.fadeIn(gameObject, duration, alpha);\n
      scene.rexUI.fadeOutDestroy(gameObject, duration);\n
    5. Ease-move to, ease-move from
      scene.rexUI.easeMoveTo(gameObject, duration, x, y);\n// scene.rexUI.easeMoveTo(gameObject, duration, x, y, ease);\n
      scene.rexUI.easeMoveFrom(gameObject, duration, x, y);\n// scene.rexUI.easeMoveFrom(gameObject, duration, x, y, ease);\n
    6. Shake
      scene.rexUI.shake(gameObject, config);\n
    7. Perspective: Snapshot children of containerlite, to a perspective render texture.
      var perspective = scene.rexUI.add.perspective(gameObject, config);\n
      or
      var perspective = new RexPlugins.UI.Perspective(gameObject, config);\n
    8. Skew: Snapshot children of containerlite, to a skew render texture.
      var skew = scene.rexUI.add.skew(gameObject, config);\n
      or
      var skew = new RexPlugins.UI.Skew(gameObject, config);\n
    "},{"location":"ui-overview/#helper-methods","title":"Helper methods","text":""},{"location":"ui-overview/#get-parent","title":"Get parent","text":"
    • Get parent sizer
      var parentSizer = scene.rexUI.getParentSizer(gameObject);\n
      • gameObject : Any game object added to sizer.
    • Get ancestor sizer matched given name
      var parentSizer = scene.rexUI.getParentSizer(gameObject, name);\n
      • gameObject : Any game object added to sizer.
      • name : Name string.
    • Get topmost sizer
      var topmostSizer = scene.rexUI.getTopmostSizer(gameObject);\n
      • gameObject : Any game object added to sizer.
    "},{"location":"ui-overview/#remove-from-parent","title":"Remove from parent","text":"
    scene.rexUI.removeFromParent(gameObject);\n
    "},{"location":"ui-overview/#showhide","title":"Show/hide","text":"
    • Show
      scene.rexUI.show(gameObject);\nscene.rexUI.getTopmostSizer(gameObject).layout();\n
    • Hide
      scene.rexUI.hide(gameObject);\nscene.rexUI.getTopmostSizer(gameObject).layout();\n
    • Is shown
      var isShown = scene.rexUI.isShown(gameObject);\n
    "},{"location":"ui-overview/#is-pointer-in-bounds","title":"Is pointer in bounds","text":"
    var isInBounds = scene.rexUI.isInTouching(gameObject);\n// var isInBounds = scene.rexUI.isInTouching(gameObject, pointer);\n
    "},{"location":"ui-overview/#event-promise","title":"Event promise","text":"
    • Get event promise
      var promise = scene.rexUI.waitEvent(eventEmitter, eventName)\n.then(function() {\n\n})\n
      • eventEmitter : Any kind of event emitter. for example, game object, or tween task, or scene event
    • Get complete event promise
      var promise = scene.rexUI.waitComplete(eventEmitter)\n.then(function() {\n\n})\n
      • eventEmitter : Event emitter which will fire 'complete' event, for example, tween task.
    • Delay time promise
      var promise = scene.rexUI.delayPromise(time)\n.then(function() {\n\n})\n
    "},{"location":"ui-overview/#view-port","title":"View port","text":"

    View port is a rectangle of current visible area.

    var viewport = scene.rexUI.viewport;\n

    Which will be changed after resizing

    scene.scale.on('resize', function() {\nvar viewport = scene.rexUI.viewport;\n/*\n    sizer\n        .setPosition(viewport.centerX, viewport.centerY)\n        .setMinSize(viewport.width, viewport.height)\n        .layout();\n    */\n});\n
    "},{"location":"ui-overview/#demos","title":"Demos","text":"
    • Dialog
      • Yes/No
      • Choice
      • Pop-up
    • Text input
      • Text edit
      • Hidden text edit
      • Canvas input
    • Menu
    • Text-box
    • Text-area
    • Number bar
    • Grid table
    • Tabs
      • Tabs-tables
    • Scroll-able panel
    • Pages
    • Fix-width sizer
    • Chart
    • Video player
    • Anchor
    • Round-rectangle
    "},{"location":"ui-pages/","title":"Pages","text":""},{"location":"ui-pages/#introduction","title":"Introduction","text":"

    A container with pages, only current page is visible.

    • Author: Rex
    • Game object
    "},{"location":"ui-pages/#live-demos","title":"Live demos","text":"
    • Pages
    • Tabpage
    "},{"location":"ui-pages/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-pages/#install-plugin","title":"Install plugin","text":""},{"location":"ui-pages/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add pages object
      var pages = scene.rexUI.add.pages(config);\n
    "},{"location":"ui-pages/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add pages object
      var pages = scene.rexUI.add.pages(config);\n
    "},{"location":"ui-pages/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Pages } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add pages object
      var pages = new Pages(scene, config);\nscene.add.existing(pages);\n
    "},{"location":"ui-pages/#add-pages-object","title":"Add pages object","text":"
    var pages = scene.rexUI.add.pages({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0 },\n// swapMode: 0,\n// fadeIn: 0,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • swapMode : Set to invisible or destroy swapped page.
      • 0, 'invisible' : Set swapped page to invisible.
      • 1, 'destroy' : Destroy swapped page.
    • fadeIn : Fade-in duration of current page.
      • 0 : No fade-in effect. Default behavior.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-pages/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPages extends RexPlugins.UI.Pages {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var pages = new MyPages(scene, config);\n
    "},{"location":"ui-pages/#add-background","title":"Add background","text":"
    pages.addBackground(child);\n

    or

    pages.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    "},{"location":"ui-pages/#add-page","title":"Add page","text":"
    pages.addPage(child, key, align, padding, expand);\n// pages.add(child, key, align, padding, expand);\n

    or

    pages.addPage(child, {\nkey: 0,\nalign: Phaser.Display.Align.TOP_LEFT,\npadding: {left: 0, right: 0, top: 0, bottom: 0}, expand: true\n}\n);\n// pages.add(child, config);\n
    • child : A game object.
    • key : Unique name of this page.
    • align :
      • 'left-top', or Phaser.Display.Align.TOP_LEFT : Align game object at left-top. Default value.
      • 'left-center', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
      • 'left-bottom', or Phaser.Display.Align.LEFT_BOTTOM : Align game object at left-bottom.
      • 'center-top', or Phaser.Display.Align.TOP_CENTER : Align game object at center-top.
      • 'center-center', or Phaser.Display.Align.CENTER : Align game object at center-center.
      • 'center-bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at center-bottom.
      • 'right-top', or Phaser.Display.Align.TOP_RIGHT : Align game object at right-top.
      • 'right-center', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • 'right-bottom', or Phaser.Display.Align.RIGHT_BOTTOM : Align game object at right-bottom.
    • padding : Add space between bounds. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • expand : Expand width and height of the page.
      • true : Expand width and height.
      • false : Don't expand width or height.
      • A plain object, to expand width or height
        {\nwidth: true,\nheight: true\n}\n
        • expand.width : Expand width.
        • expand.height : Expand height.
    "},{"location":"ui-pages/#swap-to-page","title":"Swap to page","text":"
    pages.swapPage(key);\n// pages.swapPage(key, fadeInDuration);\n
    • key : Unique name of this page.

    Note

    This method will run pages.layout() to arrange position of current page.

    "},{"location":"ui-pages/#page-name","title":"Page name","text":"
    • Current page name

      var pageName = pages.currentKey;\n

    • Previous page name

      var pageName = pages.previousKey;\n

    • Name of all pages
      var names = pages.keys;\n
    "},{"location":"ui-pages/#page-object","title":"Page object","text":"
    • Get page object
      var pageObject = pages.getPage(key);\n
      • pageObject : A game object or null.
    • Current page object
      var pageObject = pages.currentPage;\n
    • Previous page object
      var pageObject = pages.previousPage;\n
    "},{"location":"ui-pages/#fade-in-duration","title":"Fade in duration","text":"
    pages.setFadeInDuration(duration);\n
    • 0 : No fade-in effect.
    "},{"location":"ui-pages/#get-element","title":"Get element","text":"
    • Get element
      • All page game objects
        var gameObjects = pages.getElement('items');\n
    • Get by name
      var gameObject = pages.getElement('#' + name);\n// var gameObject = pages.getElement('#' + name, recursive);\n
      or
      var gameObject = pages.getByName(name);\n// var gameObject = pages.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-pages/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-pages/#events","title":"Events","text":"
    • Set page invisible, triggered when page is swapped out.
      pages.on('pageinvisible', function(pageObject, key, pages) {\n// ...\n}, scope);\n
      • pageObject : Game object of page.
      • key : Page name.
      • pages : Pages object
    • Set page visible, triggered when page is shown.
      pages.on('pagevisible', function(pageObject, key, pages) {\n// ...\n}, scope);\n
      • pageObject : Game object of page.
      • key : Page name.
      • pages : Pages object
    "},{"location":"ui-perspectivecard/","title":"Perspective card","text":""},{"location":"ui-perspectivecard/#introduction","title":"Introduction","text":"

    A container with front and back faces.

    • Author: Rex
    • Game object

    WebGL only

    It only works in WebGL render mode.

    "},{"location":"ui-perspectivecard/#live-demos","title":"Live demos","text":"
    • Flip
    • Rotation
    "},{"location":"ui-perspectivecard/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-perspectivecard/#install-plugin","title":"Install plugin","text":""},{"location":"ui-perspectivecard/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add card object
      var card = scene.rexUI.add.perspectiveCard(config);\n
    "},{"location":"ui-perspectivecard/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add card object
      var card = scene.rexUI.add.perspectiveCard(config);\n
    "},{"location":"ui-perspectivecard/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { PerspectiveCard } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add card object
      var card = new PerspectiveCard(scene, config);\nscene.add.existing(card);\n
    "},{"location":"ui-perspectivecard/#add-card-object","title":"Add card object","text":"
    var sizer = scene.rexUI.add.perspectiveCard({    // x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nback: backGameObject,\nfront: frontGameObject,\n// face: 0,\n// orientation: 0,\n// snapshotPadding: 0,\n\n// flip : {\n//     frontToBack: 0,\n//     backToFront: 1,\n//     duration: 1000,\n//     ease: 'Cubic',\n//     delay: 0,\n// }\n\n// space: { left: 0, right:0, top:0, bottom:0 },\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • front, back : Any game object for front or back face.
    • face : Show front or back face.
      • 'front', or 0 : Show front face.
      • 'back', or 1 : Show back face.
    • orientation : Flipping orientation.
      • 'horizontal','h', 'x', or 0 : Flipping left-to-right, or right-to-left.
      • 'vertical','v', 'y', or 1 : Flipping top-to-bottom, or bottom-to-top.
    • snapshotPadding : Padding around face when taking a snapshot of a face.
    • flip : Configuration of flipping behavior.
      • flip.frontToBack, flip.backToFront : Flipping direction.
        • 'right', 'left-to-right', or 0 : Flipping from right to left.
        • 'left', 'right-to-left', or 1 : Flipping from left to right.
      • flip.duration : Duration of flipping, in millisecond.
      • flip.delay : Initial delay.
      • flip.ease : Ease function. Default value is 'Cubic'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-perspectivecard/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPerspectiveCard extends PerspectiveCard {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta);\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var card = new MyPerspectiveCard(scene, config);\n
    "},{"location":"ui-perspectivecard/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    card.layout();\n

    See also - dirty

    "},{"location":"ui-perspectivecard/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = card.getElement('background');\n
      • Front face game object
        var frontFace = card.getElement('front');\n
      • Back face game object
        var backFace = card.getElement('back');\n
    • Get by name
      var gameObject = card.getElement('#' + name);\n// var gameObject = card.getElement('#' + name, recursive);\n
      or
      var gameObject = card.getByName(name);\n// var gameObject = card.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-perspectivecard/#face","title":"Face","text":"
    • Get
      var face = card.face;\n
      • face:
        • 0 : Show front face.
        • 1 : Show back face.
    • Set
      card.setFace(face)\n
      • face
        • 'front', or 0 : Show front face.
        • 'back', or 1 : Show back face.
    • Toggle
      card.toggleFace()\n
    "},{"location":"ui-perspectivecard/#face-instances","title":"Face instances","text":"
    • Front face
      var frontFace = card.frontFace;\n// var frontFace = card.faces.front;\n
    • Back face
      var backFace = card.backFace;\n// var backFace = card.faces.back;\n
    "},{"location":"ui-perspectivecard/#flip-behavior","title":"Flip behavior","text":""},{"location":"ui-perspectivecard/#start-flipping","title":"Start flipping","text":"
    card.flip.flip();\n// card.flip.flip(duration, repeat);\n
    • duration : Overwrite default duration value.
    • repeat : Number of flipping time (repeat + 1) during duration. Default value is 0.

    or

    • Flip-right
      card.flip.flipRight();\n// card.flip.flipRight(duration, repeat);\n
    • Flip-left
      card.flip.flipLeft();\n// card.flip.flipLeft(duration, repeat);\n

    Note

    • When flipping start:
      • Snapshot face game objects to perspective-card mesh
      • Set face game objects to invisible, and perspective-card mesh to visible
    • When flipping complete:
      • Revert visible of Face game objects and perspective-card mesh
    "},{"location":"ui-perspectivecard/#stop-flipping","title":"Stop flipping","text":"
    card.flip.stop();\n
    "},{"location":"ui-perspectivecard/#set-duration","title":"Set duration","text":"
    card.flip.setDuration(duration);\n// card.flip.duration = duration;\n
    "},{"location":"ui-perspectivecard/#set-ease","title":"Set ease","text":"
    card.flip.setEase(ease);\n// card.flip.ease = ease;\n
    "},{"location":"ui-perspectivecard/#events","title":"Events","text":"
    • On flipping start
      card.flip.on('start', function(){\n// ...\n});\n
    • On flipping complete
      card.flip.on('complete', function(){\n// ...\n});\n
    "},{"location":"ui-perspectivecard/#status","title":"Status","text":"
    • Is flipping
      var isRunning = card.flip.isRunning;\n
    "},{"location":"ui-perspectivecard/#rotation","title":"Rotation","text":"
    • Get rotation angle
      var angleX = card.angleX; // Angle in degrees\nvar angleY = card.angleY; // Angle in degrees\nvar angleZ = card.angleZ; // Angle in degrees\n
      or
      var rotationX = card.rotationX; // Angle in radians\nvar rotationY = card.rotationY; // Angle in radians\nvar rotationZ = card.rotationZ; // Angle in radians\n
    • Set rotation angle
      card.angleX = angleX; // Angle in degrees\ncard.angleY = angleY; // Angle in degrees\ncard.angleZ = angleZ; // Angle in degrees\n
      or
      card.rotationX = rotationX; // Angle in radians\ncard.rotationY = rotationY; // Angle in radians\ncard.rotationZ = rotationZ; // Angle in radians\n

    Warning

    Can't be used with flipping mode.

    "},{"location":"ui-perspectivecard/#other-properties","title":"Other properties","text":"

    See overlapSizer.

    "},{"location":"ui-scrollablepanel/","title":"Scroll-able panel","text":""},{"location":"ui-scrollablepanel/#introduction","title":"Introduction","text":"

    A container with a panel, slider, and scroller.

    • Author: Rex
    • Game object
    "},{"location":"ui-scrollablepanel/#live-demos","title":"Live demos","text":"
    • Scroll-able panel + grid sizer
    • Scroll-able panel + table by fix-width sizer
    • Scroll-able panel + fix-width sizer
    • Scroll-able panel + built-in container
      • Container panel
      • Container child
    • Button click
    • Dropdown, scrollable list
    • Add child
    • Scroll to child
    • Drag item
    • Destroy
    • XY sliders
    • Min-width panel
    • Drag, resize panel
      • Single scroller
      • ScrollerX, scrollerY
    • Drag&drop items between panels :
      • With scroller
      • Without scroller
    • Nested scroll-able panel
    • Typing on Label
    "},{"location":"ui-scrollablepanel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-scrollablepanel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-scrollablepanel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add scrollable-panel object
      var panel = scene.rexUI.add.scrollablePanel(config);\n
    "},{"location":"ui-scrollablepanel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add scrollable-panel object
      var panel = scene.rexUI.add.scrollablePanel(config);\n
    "},{"location":"ui-scrollablepanel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ScrollablePanel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add scrollable-panel object
      var panel = new ScrollablePanel(scene, config);\nscene.add.existing(panel);\n
    "},{"location":"ui-scrollablepanel/#add-scroll-able-panel-object","title":"Add scroll-able panel object","text":"
    var panel = scene.rexUI.add.scrollablePanel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// scrollMode: 0,\n\n// Elements\nbackground: backgroundGameObject,\n\npanel: {\nchild: panelGameObject,\nmask: {\npadding: 0, // or {left, right, top, bottom}\n// updateMode: 0,\n}\n}.\n\nslider: {\n// background: sliderBackgroundGameObject,\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n\n// buttons: {\n//     top: topButtonGameObject, \n//     bottom: bottomButtonGameObject,\n//     left: leftButtonGameObject, \n//     right: rightButtonGameObject,\n//     step: 0.01,\n// }\n},\n\n// sliderX: {...},\n// sliderY: {...},\n\n// scrollDetectionMode: 0,\n\n// scroller: {\n//     threshold: 10,\n//     slidingDeceleration: 5000,\n//     backDeceleration: 2000,\n//     pointerOutRelease: true,\n//     rectBoundsInteractive: true,\n//     dragRate: 1,\n// },\n\n// scrollerX: {...},\n// scrollerY: {...},\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\n// mouseWheelScrollerX: {...},\n// mouseWheelScrollerY: {...},\n\nclampChildOY: false,\n// clampChildOX: false,\n\nheader: headerGameObject,\nfooter: footerGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\npanel: 0,\n// panel: {\n//    top: 0,\n//    bottom: 0,\n//    left: 0,\n//    right: 0,\n//},\n\nslider: 0,\n// slider: {\n//     top: 0,\n//     bottom: 0,\n//     left: 0,\n//     right: 0,\n// },\n// sliderX: 0,\n// sliderY: 0,\n\nheader: 0,\nfooter: 0,\n},\n\nexpand: {\nheader: true,\nfooter: true,\npanel: true,\n},\n\nalign: {\nheader: 'center',\nfooter: 'center',\npanel: 'center',\n},\n\n// name: '',\n// draggable: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • scrollMode : Scroll panel vertically, or horizontally.
      • 0, 'vertical', or 'v', 'y' : Scroll panel vertically. Default value.
      • 1, 'horizontal', or 'h'. 'x' : Scroll panel horizontally.
      • 2, or 'xy' : Two-sliders mode, scroll panel vertically and horizontally.
    • background : Game object of background, optional. This background game object will be resized to fit the size of scroll-able panel.
    • panel : Configuration of panel game object.
      • panel.child : Panel game object.
      • panel.mask : Configuration of panel's mask.
        • panel.mask.padding :
          • A number : Extra left/right/top/bottom padding spacing of this rectangle mask. Default value is 0.
          • A plain object {left, right, top, bottom}
        • panel.mask.updateMode : When to update mask
          • 0, or 'update' : Apply mask only when scrolling. Default behavior.
          • 1, or 'everyTick' : Apply mask every tick. Use this mode if children game objects of panel are moved after scrolling and still been masked.
        • false : No mask
    • slider : Componments of slider, optional.
      • slider.background :
        • Game object of background, optional. This background game object will be resized to fit the size of slider.
        • A plain object to create round rectangle shape
          { radius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.track :
        • Game object of track, optional. This track game object will be resized to fit the size of slider, with space.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.indicator :
        • Game object of indicator, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.thumb :
        • Game object of thumb, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.input :
        • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.position : Position of this slider.
        • 0, 'right', 'bottom' : Slider at right/bottom side. Default value.
        • 1, 'left', 'top' : Slider at left/top side.
      • slider.hideUnscrollableSlider :
        • false : Slider is always visible no matter it is scrollable or not. Default behavior.
        • true : Set slider to invisible if it is unscrollable.
      • slider.disableUnscrollableDrag :
        • false : Scroller is always enale no matter it is scrollable or not. Default behavior.
        • true : Set scroller to disable if it is unscrollable.
      • slider.adaptThumbSize :
        • false : Don't adjust height/width of thumb. Default behavior.
        • true : Adjust height/width of thumb according to ratio of visible child.
          • Minimum height/width of thumb = slider.minThumbSize. If content is larger then a page.
          • Maximum height/width of thumb = height/width of slider.track. If content is less then a page.
      • slider.minThumbSize : Minimum height/width of thumb used in slider.adaptThumbSize mode.
      • slider.buttons : Press button to scroll content in each tick.
        • slider.buttons.top, slider.buttons.bottom : Top and bottom buttons.
        • slider.buttons.left, slider.buttons.right : Left and right buttons
        • slider.buttons.step : Scrolling step in each tick. Default value is 0.01.
      • Set to false to skip creating slider.
    • sliderX, sliderY : Componments of sliderX and sliderY, for two-sliders mode.
    • scrollDetectionMode :
      • 0 : Dectct drag-scrolling, mouse-wheel-scrolling by game object's touch event. Default behavior.
      • 1 : Dectct drag-scrolling, mouse-wheel-scrolling by rectangle bounds.
    • scroller : Configuration of scroller behavior.
      • scroller.threshold : Minimal movement to scroll. Set 0 to scroll immediately.
      • scroller.slidingDeceleration : Deceleration of slow down when dragging released.
        • Set false to disable it.
      • scroller.backDeceleration : Deceleration of pull back when out of bounds.
        • Set false to disable it.
      • scroller.pointerOutRelease : Set to true to release input control when pointer out of gameObject.
      • scroller.rectBoundsInteractive :
        • false : Detect scrolling by game object's touch input.
        • true : Detect scrolling by rectangle bounds of game object. Default behavior.
      • scroller.dragRate : Rate of dragging distance/dragging speed. Default value is 1.
      • Set to false to skip creating scroller.
    • scrollerX, scrollerY : Configuration of scrollerX, scrollerY behavior, for two-sliders mode.
    • mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
      • mouseWheelScroller.focus :
        • false, or 0 : Without checking if cursor is over game object or not.
        • true, or 1 : Cursor is inside the rectangle bounds of game object. Default behavior.
        • 2 : Cursor is over game object.
      • mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
      • Set to false to skip creating mouse-wheel-scroller. Default behavior.
    • mouseWheelScrollerX, mouseWheelScrollerY : Configuration of mouse-wheel-scrollerX, or mouse-wheel-scrollerY behavior, for two-sliders mode.
    • clampChildOY : Set true to clamp scrolling.
    • clampChildOX : Set true to clamp scrolling, for two-sliders mode.
    • header : Game object of header, optional.
    • footer : Game object of footer, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.panel :
        • A number: Space between panel object and slider object.
        • An object: Padding of panel object.
          • If scrollMode is 0 (vertical) :
            • space.panel.top, space.panel.bottom : Top, bottom padding space of panel object.
            • space.panel.right : Space between panel object and slider object.
          • If scrollMode is 1 (horizontal) :
            • space.panel.left, space.panel.right : Left, right padding space of panel object.
            • space.panel.bottom : Space between panel object and slider object.
          • If two-sliders mode (scrollMode is 2):
            • space.panel.top, space.panel.bottom, space.panel.left, space.panel.right : Top, bottom, left, right padding space of panel object.
      • space.slider :
        • 0 : No space around slider.
        • space.slider.left, space.slider.right, space.slider.top, space.slider.bottom : Space around slider.
      • space.sliderX, space.sliderX : Space configuration of sliderX, sliderX, for two-sliders mode.
        • 0 : No space around slider.
      • space.header : Space between header and panel.
      • space.footer : Space between footer and panel.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width or height of header game object. Default value is true.
      • expand.footer : Set true to expand width or height of footer game object. Default value is true.
      • expand.panel : Set true to expand width or height of panel game object. Default value is true.
    • align : Align element
      • align.header
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • 'top', or Phaser.Display.Align.ALIGN.TOP_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.ALIGN.BOTTOM_CENTER : Align game object at bottom-center.
      • align.footer
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • 'top', or Phaser.Display.Align.ALIGN.TOP_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.ALIGN.BOTTOM_CENTER : Align game object at bottom-center.
      • align.panel
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • 'top', or Phaser.Display.Align.ALIGN.TOP_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.ALIGN.BOTTOM_CENTER : Align game object at bottom-center.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    "},{"location":"ui-scrollablepanel/#scroll-mode","title":"Scroll mode","text":"

    If scrollMode parameter is not given :

    • Set scrollMode to 2, if configuration has sliderX, sliderY, or scrollerX, scrollerY parameters.
    • Set scrollMode to 0, if configuration has sliderY, or scrollerY parameters.
    • Set scrollMode to 1, if configuration has sliderX, or scrollerX parameters.
    "},{"location":"ui-scrollablepanel/#child-bounds","title":"Child bounds","text":"

    Scrollable panel will mask child if child's bounds (child.getBounds()) is across mask area.

    Bitmaptext game object does not have getBounds method. User can inject it by

    const Components = Phaser.GameObjects.Components;\nPhaser.Class.mixin(\nPhaser.GameObjects.BitmapText,\n[\nComponents.ComputedSize,\nComponents.GetBounds\n]\n);\n
    "},{"location":"ui-scrollablepanel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyPanel extends RexPlugins.UI.ScrollablePanel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var panel = new MyPanel(scene, config);\n
    "},{"location":"ui-scrollablepanel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    panel.layout();\n

    See also - dirty

    "},{"location":"ui-scrollablepanel/#scroll-content","title":"Scroll content","text":"
    • Set
      panel.childOY = oy;\n// panel.setChildOY(oy);\n
    • Set and clamp
      panel.setChildOY(oy, true);\n
    • Add
      panel.addChildOY(oy);\n
    • Add and clamp
      panel.addChildOY(oy, true);\n
    • Get
      var childOY = panel.childOY;\n
    • Top OY
      var topOY = panel.topChildOY;\n
    • Bottom OY
      var bottomOY = panel.bottomChildOY;\n
    • Is overflow (height of content is larger than display height)
      var isOverflow = panel.isOverflow;\n
    "},{"location":"ui-scrollablepanel/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      panel.t = t;  // t: 0~1\n// panel.setT(t);  \n
    • Set and clamp
      panel.setT(t, true);\n
    • Get
      var t = panel.t;\n
    "},{"location":"ui-scrollablepanel/#scroll-to-topbottom","title":"Scroll to top/bottom","text":"
    • Scroll to top
      panel.scrollToTop();\n
      • Equal to panel.t = 0;
    • Scroll to bottom
      panel.scrollToBottom();\n
      • Equal to panel.t = 1;
    "},{"location":"ui-scrollablepanel/#scroll-to-child","title":"Scroll to child","text":"
    panel.scrollToChild(child, align);\n
    • align :
      • undefined : Align child to top(left), or bottom(right) of panel. Default value.
      • 'top', 'center', 'bottom' : Align child to top/center/bottom of panel.
      • 'left', 'center', 'right' : Align child to left/center/right of panel.
    "},{"location":"ui-scrollablepanel/#enabledisable-scrolling","title":"Enable/disable scrolling","text":"
    • Slider
      • Set enable state
        panel.setSliderEnable(enabled);\n
        or
        panel.sliderEnable = enabled;\n
      • Get enable state
        var enable = panel.sliderEnable;\n
    • Scroller
      • Set enable state
        panel.setScrollerEnable(enabled);\n
        or
        panel.scrollerEnable = enabled;\n
      • Get enable state
        var enable = panel.scrollerEnable;\n
    • Mouse-Wheel-Scroller
      • Set enable state
        panel.setMouseWheelScrollerEnable(enabled);\n
        or
        panel.mouseWheelScrollerEnable = enabled;\n
      • Get enable state
        var enable = panel.mouseWheelScrollerEnable;\n
    "},{"location":"ui-scrollablepanel/#event","title":"Event","text":"
    • Scroll
      panel.on('scroll', function(panel) {\n// ...\n})\n
    • Slider
      • Slider drag start
        panel.getElement('slider').on('inputstart', function(panel) {\n// ...\n})\n
      • Slider drag end
        panel.getElement('slider').on('inputend', function(panel) {\n// ...\n})\n
    • Scroller
      • Scroller drag start
        panel.getElement('scroller').on('dragstart', function(panel) {\n// ...\n})\n
      • Scroller drag end
        panel.getElement('scroller').on('dragend', function(panel) {\n// ...\n})\n
    "},{"location":"ui-scrollablepanel/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-scrollablepanel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = panel.getElement('background');\n
      • Child-panel game object
        var childPanel = panel.getElement('panel');\n
      • Child-panel mask game object, which is a graphics game object.
        var maskGameObject = panel.getElement('mask');\n
      • Layer of panel, assigned at config panel.mask.layer.
        var layer = panel.getElement('panelLayer');\n
      • Header game object
        var childPanel = panel.getElement('header');\n
      • Footer game object
        var childPanel = panel.getElement('footer');\n
      • Slider
        • Slider top
          var slider = panel.getElement('slider');\n
        • Track
          var track = panel.getElement('slider.track');\n
        • Thumb
          var thumb = panel.getElement('slider.thumb');\n
      • Scroller
        var scroller = panel.getElement('scroller');\n
      • Scrollable-block, registering scroller and children-interactive on it.
        var scrollableBlock = panel.getElement('scrollableBlock');\n
    • Get by name
      var gameObject = panel.getElement('#' + name);\n// var gameObject = panel.getElement('#' + name, recursive);\n
      or
      var gameObject = panel.getByName(name);\n// var gameObject = panel.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-scrollablepanel/#input-events","title":"Input events","text":"

    Two possible solution to register input events to children of scrollable panel.

    "},{"location":"ui-scrollablepanel/#individual-input-events","title":"Individual input events","text":"

    When scene.input.topOnly is true (default value), input events of children elements will block the drag-scrolling of scrollable panel. (Assmue that the children elememts are above scrollable panel)

    • Set scene.input.topOnly to false to enable drag-scrolling and input events of children elememts both.
      • Or Set scrollDetectionMode: 1 in config of constructor, to using rectangle-bounds input detection.
    • Test if pointer is inside the mask of panel via panel.isInTouching('mask'), during input events' callback.
    • To recognize pointer-down and dragging-start, use press's pressstart event.
    "},{"location":"ui-scrollablepanel/#set-children-interactive","title":"Set children interactive","text":"

    Applies click, tap, press, swipe behaviors on this scrollable panel, to detect input events of children.

    panel.setChildrenInteractive({\n// targetMode: 'parent',\ntargets: targetSizers,\n\n// dropZone: false,\n\n// click: {mode: 'release', clickInterval: 100},\n\n// over: undefined,\n\n// press: {time: 251, threshold: 9},\n\n// tap: {time: 250, tapInterval: 200, threshold: 9, tapOffset: 10, \n//       taps: undefined, minTaps: undefined, maxTaps: undefined,},\n\n// swipe: {threshold: 10, velocityThreshold: 1000, dir: '8dir'},\n\n// inputEventPrefix: 'child.',\n})\n
    • targetMode :
      • 'parent' : targetSizers is an array of hit-targrts' parentSizers. Will run hit-test on parentSizers first, then run hit-test on children of parentSizer. Default behavior.
      • 'direct' : targetSizers is an array of hit-targrts. Will run hit-test directly on these hit-targrts.
    • targetSizers : Array of hit-targrts' parentSizers, or array of hit-targrts. See targetMode parameter.
    • dropZone :
      • true : Enable drop Zone on scrollable area.
      • false : Do nothing.

    See Base-sizer/Set children interactive

    "},{"location":"ui-scrollablepanel/#events","title":"Events","text":"

    See Base-sizer/Set children interactive/Events

    "},{"location":"ui-scrollablepanel/#steps-of-building-a-scrollable-panel","title":"Steps of building a scrollable panel","text":"
    1. Build child panel from bottom to top
      • Child panel might be composed of sizers (sizer/fix-width sizer/grid sizer)
      • Return child sizer from method
    2. Build scrollable panel
    3. Add interactive events
    "},{"location":"ui-scrollbar/","title":"Scroll bar","text":""},{"location":"ui-scrollbar/#introduction","title":"Introduction","text":"

    A container with slider, two buttons, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-scrollbar/#live-demos","title":"Live demos","text":"
    • Scroll bar
    "},{"location":"ui-scrollbar/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-scrollbar/#install-plugin","title":"Install plugin","text":""},{"location":"ui-scrollbar/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin(\n\"rexuiplugin\",\n\"https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js\",\n\"rexUI\",\n\"rexUI\"\n);\n
    • Add scroll bar object
      var scrollBar = scene.rexUI.add.scrollBar(config);\n
    "},{"location":"ui-scrollbar/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from \"phaser3-rex-plugins/templates/ui/ui-plugin.js\";\nvar config = {\n// ...\nplugins: {\nscene: [\n{\nkey: \"rexUI\",\nplugin: UIPlugin,\nmapping: \"rexUI\",\n},\n// ...\n],\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add scroll bar object
      var scrollBar = scene.rexUI.add.scrollBar(config);\n
    "},{"location":"ui-scrollbar/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ScrollBar } from \"phaser3-rex-plugins/templates/ui/ui-components.js\";\n
    • Add scroll bar object
      var sizer = new ScrollBar(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-scrollbar/#add-scroll-bar-object","title":"Add scroll bar object","text":"
    var scrollBar = scene.rexUI.add.scrollBar({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\norientation: 0,\n\nbackground: backgroundGameObject,    slider: {\nbackground: backgroundGameObject,\n/* \n        background: { \n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */    indicator: indicatorGameObject,\n/* \n        indicator: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\ninput: 'drag',\ngap: undefined,        easeValue: {\nduration: 0,\nease: 'Linear'\n},\n},\n\nbuttons: {\ntop: topButtonGameObject, bottom: bottomButtonGameObject,\nleft: leftButtonGameObject, right: rightButtonGameObject,\nstep: 0.01,\n}\n\nvaluechangeCallback: function(newValue, oldValue, scrollBar) {\n// scrollBar.text = Math.round(Phaser.Math.Linear(0, 100, newValue));\n}\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\nitem: 0\n},\n\nenable: true,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Main orientation of the sizer.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    • background : Game object of background, optional. This background game object will be resized to fit the size of scrollBar.
    • slider : Slider game object which composed of
      • slider.width : Fixed width of slider, optional. Width of slider will be extended if this value is not set.
      • slider.background :
        • Game object of background, optional. This background game object will be resized to fit the size of slider.
        • A plain object to create round rectangle shape
          { radius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.track :
        • Game object of track, optional. This track game object will be resized to fit the size of slider, with space.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.indicator :
        • Game object of indicator, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.thumb :
        • Game object of thumb, optional.
        • A plain object to create round rectangle shape
          { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
      • slider.input :
        • 'pan', 'drag', or 0 : Control knob by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.gap : Snap a value to nearest grid slice, using rounding.
        • undefined : Disable this feature.
      • slider.easeValue : Easing value when input is 'click'.
        • slider.easeValue.duration : Duration of value easing, default is 0 (no easing).
        • slider.easeValue.ease : Ease function, default is 'Linear'.
    • buttons : Press button to scroll content in each tick.
      • buttons.top, buttons.bottom : Top and bottom buttons.
      • buttons.left, buttons.right : Left and right buttons
      • buttons.step : Scrolling step in each tick. Default value is 0.01.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds
      • space.item : Space between 2 children game objects.
    • valuechangeCallback : callback function when value changed.
    • enable : Set false to disable controlling.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    "},{"location":"ui-scrollbar/#custom-class","title":"Custom class","text":"
    • Define class
      class MyScrollBar extends RexPlugins.UI.ScrollBar {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var scrollBar = new MyScrollBar(scene, config);\n
    "},{"location":"ui-scrollbar/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    scrollBar.layout();\n

    See also - dirty

    "},{"location":"ui-scrollbar/#get-element","title":"Get element","text":"
    • Get element
    • Background game object
      var background = scrollBar.getElement(\"background\");\n
    • Slider game object
      • Slider background
        var sliderBackground = scrollBar.getElement(\"slider.background\");\n
      • Slider track
        var sliderTrack = scrollBar.getElement(\"slider.track\");\n
      • Slider indicator
        var sliderIndicator = scrollBar.getElement(\"slider.indicator\");\n
      • Slider thumb
        var sliderThumb = scrollBar.getElement(\"slider.thumb\");\n
    • Button game objects
      var buttons = scrollBar.getElement(\"buttons\");\n
      • buttons : Array of button game objects.
        • buttons[0] : Left or top button.
        • buttons[1] : Right or bottom button.
    • Get by name
      var gameObject = scrollBar.getElement(\"#\" + name);\n// var gameObject = scrollBar.getElement('#' + name, recursive);\n
      or
      var gameObject = scrollBar.getByName(\"#\" + name);\n// var gameObject = scrollBar.getByName(name, recursive);\n
    • recursive : Set true to search all children recursively.
    "},{"location":"ui-scrollbar/#enable","title":"Enable","text":"
    • Get
      var enable = scrollBar.enable;\n
    • Set
      scrollBar.setEanble(enable);\n
      or
      scrollBar.enable = enable;\n
    "},{"location":"ui-scrollbar/#value","title":"Value","text":"

    Change value will also change the position of slider thumb and width of slider indicator.

    • Get value
      var value = scrollBar.getValue(min, max); // value : min ~ max\n
      or
      var value = scrollBar.getValue(); // value: 0 ~ 1\n
      or
      var value = scrollBar.value; // value: 0 ~ 1\n
    • Set value
      scrollBar.setValue(value, min, max); // value: min ~ max\n
      or
      scrollBar.setValue(value); // value: 0 ~ 1\n
      or
      scrollBar.value = value; // value: 0 ~ 1\n
    • Increase value
      scrollBar.addValue(inc, min, max); // inc: min ~ max\n
      or
      scrollBar.addValue(inc); // inc: 0 ~ 1\n
      or
      scrollBar.value += inc; // inc: 0 ~ 1\n
    "},{"location":"ui-scrollbar/#ease-value","title":"Ease value","text":"
    • Ease value to
      scrollBar.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      scrollBar.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      scrollBar.stopEaseValue();\n
    • Set ease duration
      scrollBar.setEaseValueDuration(duration);\n
    • Set ease function
      scrollBar.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"ui-scrollbar/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-scrollbar/#events","title":"Events","text":"
    • On value changed
      scrollBar.on('valuechange',\nfunction (newValue, oldValue, scrollBar) {\n// scrollBar.text = Math.round(Phaser.Math.Linear(0, 100, newValue));\n},\nscope\n);\n
    • On input start
      scrollBar.on('inputstart', function(pointer) {\n\n}, scope);\n
    • On input end
      scrollBar.on('inputend', function(pointer) {\n\n}, scope);\n
    "},{"location":"ui-simpledropdownlist/","title":"Simple drop down list","text":""},{"location":"ui-simpledropdownlist/#introduction","title":"Introduction","text":"

    Using plain object to create drop down list.

    • Author: Rex
    • Game object
    "},{"location":"ui-simpledropdownlist/#live-demos","title":"Live demos","text":"
    • Drop-down list
    • Drop-down scrollable-list
    "},{"location":"ui-simpledropdownlist/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-simpledropdownlist/#install-plugin","title":"Install plugin","text":""},{"location":"ui-simpledropdownlist/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add drop-down list object
      var dropDownList = scene.rexUI.add.simpleDropDownList(config);\n
    "},{"location":"ui-simpledropdownlist/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add drop-down list object
      var dropDownList = scene.rexUI.add.simpleDropDownList(config);\n
    "},{"location":"ui-simpledropdownlist/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { DropDownList } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add dropDownList object
      var dropDownList = new SimpleDropDownList(scene, config);\nscene.add.existing(dropDownList);\n
    "},{"location":"ui-simpledropdownlist/#add-drop-down-list-object","title":"Add drop-down list object","text":"
    var dropDownList = scene.rexUI.add.simpleDropDownList({\nlabel: labelStyle,\nbutton: buttonStyle,\n\ntrack: backgroundStyle,\nthumb: backgroundStyle,\n\nlist: {\n// easeIn: 500,\n// transitIn: undefined,\n// transitIn: function(listPanel, duration) {  },\n\n// easeOut: 100,\n// transitOut: undefined,\n// transitOut: function(listPanel, duration) {  },\n\n// wrap: false,\n// maxHeight: undefined,\n// width: undefined, \n// height: undefined,\n// alignParent: 'text',\n// alignSide: '',\n// expandDirection: 0,\n// bounds: undefined,\n\n// space: {\n//     left: 0, right: 0, top: 0, bottom: 0, item: 0,\n//     line: 0\n// },\n\n// draggable: false        \n}\n\n}, creators);\n
    • label :
      • Styles of simple-label
    • button : Use label parameter if button parameter is not given.
      • Styles of simple-label
    • track, thumb :
      • Styles of background
    • list : Configuration of list panel.
      • list.easeIn : Pop-up duration in ms. Default value is 500.
      • list.transitIn : Tween behavior of opening list panel.
        • undefined : Expand list panel by pop-up, default behavior.
        • Custom callback
          function(listPanel, duration) {\n\n}\n
      • list.easeOut : Scale-down duration in ms. Default value is 100.
      • list.transitOut : Tween behavior of closing list panel.
        • undefined : Closing list panel by scale-down, default behavior.
        • Custom callback
          function(listPanel, duration) {\n\n}\n
      • list.wrap :
        • true : fixwidth-sizer layout, a row within buttons.
        • false : sizer layout, a row within a button. Default behavior.
      • list.maxHeight : If height of button list is larger than this maxHeight, put this button list into scrollable panel.
        • undefined, or 0 : Ignore this behavior.
        • > 0 and list.createThumbCallback parameter is given : If height of button list is larger than this maxHeight, put this button list into scrollable panel.
      • list.width : Minimum width.
        • undefined : Minimum width of panel will equal to width of parent label. Default value.
        • A number : Width of panel. Required fields when list.wrap is true.
      • list.height : Minimum height.
        • undefined : Create button list or wrap button list. Default value.
        • > 0 and thumb parameter is given : Create scrollable button list or wrap button list.
      • list.alignParent : Align x position to label.
        • 'icon' : Align x position to icon game object of parent label.
        • 'text' : Align x position to text game object of parent label. Default behavior
        • 'label', or null : Align x position to parent label.
      • list.alignSide : Align list to label's left or right side.
        • undefined, or 'left' : Align list's left side to label's left side. Default behavior.
        • 'right : Align list's right side to label's right side. Default behavior.
      • list.expandDirection :
        • 0, 'down' : Expand list down. i.e. list panel will put below parent label.
        • 1, 'up' : Expand list up. i.e. list panel will put above parent label.
      • list.bounds : Put list panel below parent label if bottom of list panel is inside bounds (Rectangle)
        • undefined : Use viewport as bounds
        • Rectangle
      • list.space : space properties of list panel.
        • left, right, top, bottom, item : For sizer layout. (list.wrap is false)
        • left, right, top, bottom, item, line : For fixwidth-sizer layout. (list.wrap is true)
      • list.draggable : Set true to drag top-most object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-simpledropdownlist/#custom-class","title":"Custom class","text":"
    • Define class
      class MyDropDownList extends RexPlugins.UI.SimpleDropDownList {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var dropDownList = new MyDropDownList(scene, config);\n
    "},{"location":"ui-simpledropdownlist/#options","title":"Options","text":"
    • Set
      dropDownList.setOptions(options);\n
      or
      dropDownList.options = options;\n
      • options : Array of strings, or objects contains these properties.
        {\ntext: string,\nvalue: any\n}\n
    • Get
      var options = dropDownList.options;\n
    "},{"location":"ui-simpledropdownlist/#other-properties","title":"Other properties","text":"

    See drop-down list, label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-simpledropdownlist/#events","title":"Events","text":"

    See Events section of drop-down list

    "},{"location":"ui-simplelabel/","title":"Simple label","text":""},{"location":"ui-simplelabel/#introduction","title":"Introduction","text":"

    Using plain object to create label.

    • Author: Rex
    • Game object
    "},{"location":"ui-simplelabel/#live-demos","title":"Live demos","text":"
    • Style
    • Bitmaptext
    • Nine-slice background
    • Bar-rectangle background
    • Wrap text
    • TextArea
    • Buttons
    "},{"location":"ui-simplelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-simplelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-simplelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.simpleLabel(style).resetDisplayContent(config);\n//var label = scene.rexUI.add.simpleLabel(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simplelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.simpleLabel(style).resetDisplayContent(config);\n//var label = scene.rexUI.add.simpleLabel(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simplelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SimpleLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new SimpleLabel(scene, style);\n// var label = new SimpleLabel(scene, style, creators);\nscene.add.existing(label);\nlabel.resetDisplayContent(config)\n
    "},{"location":"ui-simplelabel/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.simpleLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundStyle,\n// background: null,\n\nicon: iconStyle,\n// icon: null,\n\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: textStyle,\n// text: null,\n\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\naction: actionStyle,\n// action: null,\n\n// squareFitAction: false,\n// actionMask: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\nalign: undefined,  // 'left' | 'top' | 'right' | 'bottom' | 'center\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • background :
      • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • text :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as text element.
      • null : Don't create any game object.
    • icon, action :
      • Style of Image : Create Image, Nine-slice, or Round-rectangle as image, action element.
      • null : Don't create any game object.
    "},{"location":"ui-simplelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLabel extends RexPlugins.UI.SimpleLabel {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyLabel(scene, config, creators);\n
    "},{"location":"ui-simplelabel/#reset-display-content","title":"Reset display content","text":"

    See label

    "},{"location":"ui-simplelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-simplelabel/#set-state","title":"Set state","text":"

    Override/restore properties of elements.

    "},{"location":"ui-simplelabel/#active-state","title":"Active state","text":"
    • Enable active state
      label.setActiveState();\n// label.setActiveState(true);\n
      • Override properties of background declared in config with prefix 'active.' parameters.
    • Disable active state
      label.setActiveState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simplelabel/#hover-state","title":"Hover state","text":"
    • Enable active state
      label.setHoverState();\n// label.setHoverState(true);\n
      • Override properties of background declared in config with prefix 'hover.' parameters
    • Disable active state
      label.setHoverState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simplelabel/#disable-state","title":"Disable state","text":"
    • Enable disable state
      label.setDisableState();\n// label.setDisableState(true);\n
      • Override properties of background declared in config with prefix 'disable.' parameters
    • Disable disable state
      label.setDisableState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simplelabel/#get-element","title":"Get element","text":"

    See label

    "},{"location":"ui-simplelabel/#other-properties","title":"Other properties","text":"

    See label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-simpletextbox/","title":"Simple text box","text":""},{"location":"ui-simpletextbox/#introduction","title":"Introduction","text":"

    Using plain object to create textBox.

    • Author: Rex
    • Game object
    "},{"location":"ui-simpletextbox/#live-demos","title":"Live demos","text":"
    • Inner sizer
    "},{"location":"ui-simpletextbox/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-simpletextbox/#install-plugin","title":"Install plugin","text":""},{"location":"ui-simpletextbox/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add textBox object
      var textBox = scene.rexUI.add.simpleTextBox(style).resetDisplayContent(config);\n//var textBox = scene.rexUI.add.simpleTextBox(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simpletextbox/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add textBox object
      var textBox = scene.rexUI.add.simpleTextBox(style).resetDisplayContent(config);\n//var textBox = scene.rexUI.add.simpleTextBox(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simpletextbox/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SimpleTextBox } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add textBox object
      var textBox = new SimpleTextBox(scene, style);\n// var textBox = new SimpleTextBox(scene, style, creators);\nscene.add.existing(textBox);\ntextBox.resetDisplayContent(config)\n
    "},{"location":"ui-simpletextbox/#add-textbox-object","title":"Add textBox object","text":"
    var textBox = scene.rexUI.add.simpleTextBox({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\n// rtl: false,\n\nbackground: backgroundStyle,\n// background: null,\n\ninnerBackground: backgroundStyle,\n// innerBackground: null,\n\nicon: iconStyle,\n// icon: null,\n\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntitle: textStyle,\n// title: null,\n// wrapTitle: false,\n// adjustTitleFontSize: false,\n// expandTitleWidth: false,\n// expandTitleHeight: false,\n\ntext: testStyle,\n// text: null,\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\nseparator: separatorStyle,\n// separator: null,\n\naction: actionStyle,\n// action: null,\n\n// squareFitAction: false,\n// actionMask: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\nalign: {\ntitle: 'left',\ntext: 'left',\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ninnerLeft: 0, innerRight: 0, innerTop: 0, innerBottom: 0,\n\ntitle: 0, titleLeft: 0, titleRight: 0,\nicon: 0, iconTop: 0, iconBottom: 0,\ntext: 0, textLeft: 0, textRight: 0,\nseparator: 0, separatorLeft: 0, separatorRight: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// page: { \n//    maxLines: undefined,\n//    pageBreak: '\\f\\n',\n// },\n// typing: { \n//    wrap: false,\n//    speed: 333,    \n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • background, innerBackground :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • title :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as title element.
      • null : Don't create any game object.
    • text :
      • Style of Text : Create Text, BBCodeText, BitmapText as text element.
        • Don't use SimpleLabel, or TextArea as text element.
      • null : Don't create any game object.
    • separator :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as separator element.
      • null : Don't create any game object.
    • icon, action :
      • Style of Image : Create Image, Nine-slice, or Round-rectangle as image, action element.
      • null : Don't create any game object.
    • wrapTitle : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
      • 2, 'char' : Character WrapExpandText.
    • adjustTitleFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapText: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.
    • wrapText : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
      • 2, 'char' : Character WrapExpandText.
    • adjustTextFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapText: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.
    "},{"location":"ui-simpletextbox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextBox extends RexPlugins.UI.SimpleTextBox {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var textBox = new MyTextBox(scene, config, creators);\n
    "},{"location":"ui-simpletextbox/#reset-display-content","title":"Reset display content","text":"

    See title-label

    "},{"location":"ui-simpletextbox/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    textBox.layout();\n

    See also - dirty

    "},{"location":"ui-simpletextbox/#typing","title":"Typing","text":"

    See textBox

    "},{"location":"ui-simpletextbox/#get-element","title":"Get element","text":"

    See textBox

    "},{"location":"ui-simpletextbox/#events","title":"Events","text":"

    See textBox

    "},{"location":"ui-simpletextbox/#other-properties","title":"Other properties","text":"

    See textBox, sizer object, base sizer object, container-lite.

    "},{"location":"ui-simpletitlelabel/","title":"Simple title label","text":""},{"location":"ui-simpletitlelabel/#introduction","title":"Introduction","text":"

    Using plain object to create title-label.

    • Author: Rex
    • Game object
    "},{"location":"ui-simpletitlelabel/#live-demos","title":"Live demos","text":"
    • Style
    "},{"location":"ui-simpletitlelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-simpletitlelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-simpletitlelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.simpleLabel(style).resetDisplayContent(config);\n//var label = scene.rexUI.add.simpleLabel(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simpletitlelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.simpleLabel(style).resetDisplayContent(config);\n//var label = scene.rexUI.add.simpleLabel(style, creators).resetDisplayContent(config);\n
    "},{"location":"ui-simpletitlelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SimpleTitleLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new SimpleTitleLabel(scene, style);\n// var label = new SimpleTitleLabel(scene, style, creators);\nscene.add.existing(label);\nlabel.resetDisplayContent(config)\n
    "},{"location":"ui-simpletitlelabel/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.simpleLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\n// rtl: false,\n\nbackground: backgroundStyle,\n// background: null,\n\ninnerBackground: backgroundStyle,\n// innerBackground: null,\n\nicon: iconStyle,\n// icon: null,\n\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntitle: textStyle,\n// title: null,\n// wrapTitle: false,\n// adjustTitleFontSize: false,\n// expandTitleWidth: false,\n// expandTitleHeight: false,\n\ntext: testStyle,\n// text: null,\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\nseparator: separatorStyle,\n// separator: null,\n\naction: actionStyle,\n// action: null,\n\n// squareFitAction: false,\n// actionMask: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\nalign: {\ntitle: 'left',\ntext: 'left',\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ninnerLeft: 0, innerRight: 0, innerTop: 0, innerBottom: 0,\n\ntitle: 0, titleLeft: 0, titleRight: 0,\nicon: 0, iconTop: 0, iconBottom: 0,\ntext: 0, textLeft: 0, textRight: 0,\nseparator: 0, separatorLeft: 0, separatorRight: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • background, innerBackground :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • title :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as title element.
      • null : Don't create any game object.
    • text :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as text element.
      • null : Don't create any game object.
    • separator :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as separator element.
      • null : Don't create any game object.
    • icon, action :
      • Style of Image : Create Image, Nine-slice, or Round-rectangle as image, action element.
      • null : Don't create any game object.
    "},{"location":"ui-simpletitlelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyLabel extends RexPlugins.UI.SimpleTitleLabel {\nconstructor(scene, config, creators) {\nsuper(scene, config, creators);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyLabel(scene, config, creators);\n
    "},{"location":"ui-simpletitlelabel/#reset-display-content","title":"Reset display content","text":"

    See title-label

    "},{"location":"ui-simpletitlelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-simpletitlelabel/#set-state","title":"Set state","text":"

    Override/restore properties of elements.

    "},{"location":"ui-simpletitlelabel/#active-state","title":"Active state","text":"
    • Enable active state
      label.setActiveState();\n// label.setActiveState(true);\n
      • Override properties of background declared in config with prefix 'active.' parameters.
    • Disable active state
      label.setActiveState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simpletitlelabel/#hover-state","title":"Hover state","text":"
    • Enable active state
      label.setHoverState();\n// label.setHoverState(true);\n
      • Override properties of background declared in config with prefix 'hover.' parameters
    • Disable active state
      label.setHoverState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simpletitlelabel/#disable-state","title":"Disable state","text":"
    • Enable disable state
      label.setDisableState();\n// label.setDisableState(true);\n
      • Override properties of background declared in config with prefix 'disable.' parameters
    • Disable disable state
      label.setDisableState(false);\n
      • Restore properties of background.
    "},{"location":"ui-simpletitlelabel/#get-element","title":"Get element","text":"

    See title-label

    "},{"location":"ui-simpletitlelabel/#other-properties","title":"Other properties","text":"

    See title-label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-sizer/","title":"Sizer","text":""},{"location":"ui-sizer/#introduction","title":"Introduction","text":"

    Layout children game objects.

    It is inspired from wxSizer.

    • Author: Rex
    • Game object
    "},{"location":"ui-sizer/#live-demos","title":"Live demos","text":"
    • Nested sizer
      • Demo 1
      • Demo 2
      • Demo 3
    • Proportion
    • DOM child
    • Set children interactive :
      • Parent mode
      • Direct mode
    • Drag drop child
    • Bring child to top
    • Fit-ratio
    • Sort
    • Add multiple
    "},{"location":"ui-sizer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-sizer/#install-plugin","title":"Install plugin","text":""},{"location":"ui-sizer/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add sizer object
      var sizer = scene.rexUI.add.sizer(config);\n
    "},{"location":"ui-sizer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add sizer object
      var sizer = scene.rexUI.add.sizer(config);\n
    "},{"location":"ui-sizer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Sizer } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add sizer object
      var sizer = new Sizer(scene, config);\nscene.add.existing(sizer);\n
    "},{"location":"ui-sizer/#add-sizer-object","title":"Add sizer object","text":"
    var sizer = scene.rexUI.add.sizer({\norientation: 0,\n// rtl: false,\n// startChildIndex: 0,\n\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.sizer(x, y, {\norientation: 0,\n// rtl: false,\n// startChildIndex: 0,\n\n// width: undefined,\n// height: undefined,\n// anchor: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.sizer(x, y, width, height, {\norientation: 0,\n// rtl: false,\n// startChildIndex: 0,\n// anchor: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n

    or

    var sizer = scene.rexUI.add.sizer(x, y, width, height, orientation, {\n// rtl: false,\n// startChildIndex: 0,\n// anchor: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// space: { left: 0, right:0, top:0, bottom:0, item:0 }\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Orientation of the sizer.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right. Default value is 0.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom.
    • rtl :
      • false : Layout children from left to right. Default behavior.
      • true : Layout children from right to left.
    • startChildIndex : A number, start index of first layout child. Default value is 0.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between 2 children game objects.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-sizer/#custom-class","title":"Custom class","text":"
    • Define class
      class MySizer extends RexPlugins.UI.Sizer {\nconstructor(scene, x, y, minWidth, minHeight, orientation, config) {\nsuper(scene, x, y, minWidth, minHeight, orientation, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var sizer = new MySizer(scene, x, y, minWidth, minHeight, orientation);\n
    "},{"location":"ui-sizer/#add-background","title":"Add background","text":"
    sizer.addBackground(child);\n

    or

    sizer.addBackground(child, {left: 0, right: 0, top: 0, bottom: 0}, key);\n
    • left, right, top, bottom : Extra padded space. Default is 0.
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    "},{"location":"ui-sizer/#add-child","title":"Add child","text":"

    Add a game obejct to sizer

    sizer.add(child);\n

    or

    sizer.add(child,\n{\nproportion: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,\nkey: undefined,\nindex: undefined,\nminWidth: undefined,\nminHeight: undefined,\nfitRatio: 0,  // true\noffsetX: 0,\noffsetY: 0,\noffsetOriginX: 0,\noffsetOriginY: 0,\n}\n);\n

    or

    sizer.add(child, proportion, align, padding, expand, key, index);\n// sizer.add(child, proportion, align, padding, expand, key, index);\n
    • child : A game object.
    • proportion :
      • 0, or 'min' : Place next game object closely. Default value.
      • > 0 : Stretch game object via proportion value.
      • null : Don't arrange this child.
    • align :
      • For horizontal orientation sizer :
        • 'center', or Phaser.Display.Align.CENTER : Align game object at vertical-center. Default value.
        • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center.
        • Use addSpace() to align child at horizontal-center.
      • For vertical orientation sizer :
        • 'center', or Phaser.Display.Align.CENTER : Align game object at horizontal-center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • Use addSpace() to align child at vertical-center.
    • padding : Extra padded space. Default is 0.
      • A number for left/right/top/bottom bounds,
      • Or a plain object.
        {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0\n}\n
    • expand : Set true to
      • Expand height when orientation is 0 (left-to-right), or
      • Expand width when orientation is 1 (top-to-bottom)
    • key : Add this child into childMap, which could be read back by sizer.getElement(key).
      • undefined : Don't add this child. Default value.
    • index : Insert child to.
      • undefined : Insert child at last.
    • minWidth : Minimum width of normal (non-sizer) game object, used when orientation is x, and proportion is not 0, or orientation is y, and expand is true
      • Default value is current display width.
    • minHeight : Minimum height of normal (non-sizer) game object, used when orientation is y, and proportion is not 0, or orientation is x, and expand is true
      • Default value is current display height.
    • fitRatio : Resize child to fit sizer height/width before layout children, when proportion is set to 0.
      • 0, or false : Ignore this feature. Default behavior.
      • true : Fit ratio (width/height) from game object's display size.
      • > 0 : Fit ratio (width/height). 1 is square.
    • offsetX, offsetOriginX : Apply offset offsetX + offsetOriginY * width to x coordinate after alignment.
    • offsetY, offsetOriginY : Apply offset offsetY + offsetOriginY * height to y coordinate after alignment.
    "},{"location":"ui-sizer/#add-multiple","title":"Add multiple","text":"
    sizer.add(gameObjects, config);\n
    • gameObjects : Array of child game objects
    • config : See config of add-child
    "},{"location":"ui-sizer/#insert-child","title":"Insert child","text":"
    sizer.insert(index, child, {\nproportion: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,\nkey: undefined,\nminWidth: undefined,\nminHeight: undefined,\nfitRatio: 0,\n}\n);\n

    or

    sizer.insert(index, child, proportion, align, padding, expand, key);\n
    "},{"location":"ui-sizer/#insert-at-position","title":"Insert at position","text":"
    sizer.insertAtPosition(x, y, child, {\nproportion: 0,\nalign: 'center',\npadding: {left: 0, right: 0, top: 0, bottom: 0},\nexpand: false,\nkey: undefined,\nminWidth: undefined,\nminHeight: undefined,\nfitRatio: 0,\n}\n);\n

    or

    sizer.insertAtPosition(x, y, index, child, proportion, align, padding, expand, key);\n
    "},{"location":"ui-sizer/#add-space","title":"Add space","text":"
    • Add a stretchable space.
      sizer.addSpace();\n// sizer.addSpace(proportion);\n
    • Insert a stretchable space.
      sizer.insertSpace(index);\n// sizer.insertSpace(index, proportion);\n

    Use cases :

    • Align child at center
      sizer\n.addSpace()\n.add(child)\n.addSpace()\n
    • Align 2 children at left and right side
      sizer\n.add(childLeft)\n.addSpace()\n.add(childRight)\n
    "},{"location":"ui-sizer/#change-childrens-align-mode","title":"Change children's align mode","text":"
    sizer\n.setChildrenAlignMode(mode)\n.layout();\n
    • mode : Alignment of icon, text, action game objects.
      • undefined, or 'left', or 'top' : Align game objects at left, or top.
        • Remove first and last space children.
      • 'center' : Align game objects at center.
        • Add two spaces as first and last children.
      • 'right', or 'bottom' : Align game objects at right, or bottom.
        • Add space as first child.
    "},{"location":"ui-sizer/#layout-children","title":"Layout children","text":"

    Arrange position of all children.

    sizer.layout();\n

    See also - dirty

    "},{"location":"ui-sizer/#hide","title":"Hide","text":"
    • Set invisible, won't layout it
      sizer.hide();\n
      or
      sizer.hide(gameObject);\n
    • Set visible, will layout it
      sizer.show();\n
      or
      sizer.show(gameObject);\n
    "},{"location":"ui-sizer/#remove-child","title":"Remove child","text":"
    • Remove a child
      sizer.remove(child);\n
    • Remove and destroy a child
      sizer.remove(child, true);\n
    • Remove all children
      sizer.removeAll();\n
    • Remove and destroy all children
      sizer.removeAll(true);\n
    • Remove all children and backgrounds
      sizer.clear();\n
    • Remove and destroy all children and backgrounds
      sizer.clear(true);\n
    • Remove from parent sizer
      sizer.removeFromParentSizer();\n
    "},{"location":"ui-sizer/#sort-children","title":"Sort children","text":"
    • Sort by data
      sizer.sortChildrenByData(key, descending).layout();\n
      • key : Data key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by property of child
      sizer.sortChildrenByProperty(key, descending).layout();\n
      • key : Property key
      • descending :
        • true : Descending order
        • false : Ascending order, default behavior.
    • Sort by callback
      sizer.sortChildren(function(childA, childB){\n// var valueA = childA.getData(key);\n// var valueB = childB.getData(key);\n// return valueB - valueA\n}).layout();\n
      • childA, childB : 2 children of this size
    "},{"location":"ui-sizer/#get-element","title":"Get element","text":"
    • Get element
      • All children items
        var items = sizer.getElement('items');\n
    • Get by name
      var gameObject = sizer.getElement('#' + name);\n// var gameObject = sizer.getElement('#' + name, recursive);\n
      or
      var gameObject = sizer.getByName(name);\n// var gameObject = sizer.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-sizer/#get-child-index","title":"Get child index","text":"
    var index = sizer.getChildIndex(child);\n
    • index : A number, or null.
    "},{"location":"ui-sizer/#rtl","title":"RTL","text":"
    • Set rtl in config of constructor
    • Set rtl : sizer.setRTL(enable)
    • Get rtl : var rtl = sizer.rtl
    "},{"location":"ui-sizer/#alignment-of-child","title":"Alignment of child","text":"
    • Set alignment of child in config of adding child
    • Set alignment of child : sizer.setChildAlign(child, align)
      • align :
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
        • 'top', or Phaser.Display.Align.RIGHT_CENTER : Align game object at top-center.
        • 'bottom', or Phaser.Display.Align.BOTTOM_CENTER : Align game object at bottom-center.
    • Get alignment of child : var align = sizer.getChildAlign(child)
    "},{"location":"ui-sizer/#proportion-of-child","title":"Proportion of child","text":"
    • Set proportion of child in config of adding child
    • Set proportion of child : sizer.setChildProportion(child, proportion)
    • Get proportion of child : var align = sizer.getChildProportion(child)
    "},{"location":"ui-sizer/#expand-of-child","title":"Expand of child","text":"
    • Set expand of child in config of adding child
    • Set expand of child : sizer.setChildExpand(child, expand)
    • Get expand of child : var expand = sizer.getChildExpand(child)
    "},{"location":"ui-sizer/#other-properties","title":"Other properties","text":"

    See base sizer object, container-lite.

    "},{"location":"ui-slider/","title":"Slider","text":""},{"location":"ui-slider/#introduction","title":"Introduction","text":"

    A container with a track, indicator, thumb and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-slider/#live-demos","title":"Live demos","text":"
    • Slider bar
    • Color picker
    • Crop resize
    • Gap
    "},{"location":"ui-slider/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-slider/#install-plugin","title":"Install plugin","text":""},{"location":"ui-slider/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add slider object
      var slider = scene.rexUI.add.slider(config);\n
    "},{"location":"ui-slider/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add slider object
      var slider = scene.rexUI.add.slider(config);\n
    "},{"location":"ui-slider/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Slider } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add slider object
      var slider = new Slider(scene, config);\nscene.add.existing(slider);\n
    "},{"location":"ui-slider/#add-slider-object","title":"Add slider object","text":"
    var slider = scene.rexUI.add.slider({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\nreverseAxis: false,\n\nbackground: backgroundGameObject,\n/* \n    background: { \n        radius: 0, \n        color: undefined, alpha: 1,\n        strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n        shape: undefined\n    }\n    */\n\ntrack: trackGameObject,\n/* \n    track: { \n        width: 1, height: 1,\n        radius: 0, \n        color: undefined, alpha: 1,\n        strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n        shape: undefined\n    }\n    */    indicator: indicatorGameObject,\n/* \n    indicator: { \n        width: 1, height: 1,\n        radius: 0, \n        color: undefined, alpha: 1,\n        strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n        shape: undefined\n    }\n    */\n\nthumb: thumbGameObject,\n/* \n    thumb: { \n        width: 1, height: 1,\n        radius: 0, \n        color: undefined, alpha: 1,\n        strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n        shape: undefined\n    }\n    */\nthumbOffsetX: 0,\nthumbOffsetY: 0,\n\ninput: 'drag',\n\nvalue: 0,\ngap: undefined,\neaseValue: {\nduration: 0,\nease: 'Linear'\n},    valuechangeCallback: function(newValue, oldValue, slider) {\n},\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n\nenable: true,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Horizontal slider.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Vertical slider.
    • reverseAxis :
      • false : Map left/top to 0, and right/bottom to 1. Default behavior.
      • true : Map left/top to 1, and right/bottom to 0.
    • background :
      • Game object of background, optional. This background game object will be resized to fit the size of slider.
      • A plain object to create round rectangle shape
        { radius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
    • track :
      • Game object of track, optional. This track game object will be resized to fit the size of slider, with space.
      • A plain object to create round rectangle shape
        { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
    • indicator :
      • Game object of indicator, optional.
      • A plain object to create round rectangle shape
        { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
    • thumb :
      • Game object of thumb, optional.
      • A plain object to create round rectangle shape
        { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n}\n
    • thumbOffsetX, thumbOffsetY : Shift thumb, default value is 0.
    • input :
      • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
      • 'click', or 1 : Control slider by touching track game object.
      • 'none', or -1 : Disable sider controlling.
    • value : Initial value (0 ~ 1).
    • gap : Snap a value to nearest grid slice, using rounding.
      • undefined : Disalbe this feature.
    • easeValue : Easing value when input is 'click'.
      • easeValue.duration : Duration of value easing, default is 0 (no easing).
      • easeValue.ease : Ease function, default is 'Linear'.
    • valuechangeCallback : callback function when value changed.
      function(newValue, oldValue, slider) {\n}\n
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
    • enable : Set false to disable controlling.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-slider/#custom-class","title":"Custom class","text":"
    • Define class
      class MySlider extends RexPlugins.UI.Slider {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var slider = new MySlider(scene, config);\n
    "},{"location":"ui-slider/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    slider.layout();\n

    See also - dirty

    "},{"location":"ui-slider/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = slider.getElement('background');\n
      • Track game object
        var track = slider.getElement('track');\n
      • Indicator game object
        var track = slider.getElement('indicator');\n
      • Thumb track game object
        var action = slider.getElement('thumb');\n
    • Get by name
      var gameObject = slider.getElement('#' + name);\n// var gameObject = slider.getElement('#' + name, recursive);\n
      or
      var gameObject = slider.getByName(name);\n// var gameObject = slider.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-slider/#enable","title":"Enable","text":"
    • Get
      var enable = slider.enable;\n
    • Set
      slider.setEanble(enable);\n
      or
      slider.enable = enable;\n
    "},{"location":"ui-slider/#value","title":"Value","text":"

    Change value will also change the position of slider thumb and width of slider indicator.

    • Get value
      var value = slider.getValue(min, max); // value : min ~ max\n
      or
      var value = slider.getValue(); // value: 0 ~ 1\n
      or
      var value = slider.value; // value: 0 ~ 1\n
    • Set value
      slider.setValue(value, min, max); // value: min ~ max\n
      or
      slider.setValue(value); // value: 0 ~ 1\n
      or
      slider.value = value; // value: 0 ~ 1\n
    • Increase value
      slider.addValue(inc, min, max); // inc: min ~ max\n
      or
      slider.addValue(inc); // inc: 0 ~ 1\n
      or
      slider.value += inc; // inc: 0 ~ 1\n
    "},{"location":"ui-slider/#ease-value","title":"Ease value","text":"
    • Ease value to
      slider.easeValueTo(value, min, max);  // value: min ~ max\n
      or
      slider.easeValueTo(value);  // value: 0 ~ 1\n
    • Stop ease
      slider.stopEaseValue();\n
    • Set ease duration
      slider.setEaseValueDuration(duration);\n
    • Set ease function
      slider.setEaseValueFunction(ease);\n
      • ease : Ease function.
    "},{"location":"ui-slider/#gap","title":"Gap","text":"
    • Set
      slider.setGap(gap);  // gap: 0~1\n
      or
      slider.setGap(gap, min, max);  // gap: min~max\n
    • Get
      var gap = slider.gap;  // gap: 0~1\n
    "},{"location":"ui-slider/#events","title":"Events","text":"
    • On value changed
      slider.on('valuechange', function(newValue, oldValue, slider){\n//\n}, scope);\n
    • On input start
      slider.on('inputstart', function(pointer) {\n\n}, scope);\n
    • On input end
      slider.on('inputend', function(pointer) {\n\n}, scope);\n
    "},{"location":"ui-slider/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-splitpanels/","title":"Split panels","text":""},{"location":"ui-splitpanels/#introduction","title":"Introduction","text":"

    A container with left(top) panel, right(bottom) panel, splitter, and background. Drag splitter to resize with left(top) panel, right(bottom) panel.

    • Author: Rex
    • Game object
    "},{"location":"ui-splitpanels/#live-demos","title":"Live demos","text":"
    • Split-panels
    "},{"location":"ui-splitpanels/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-splitpanels/#install-plugin","title":"Install plugin","text":""},{"location":"ui-splitpanels/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add split-panels object
      var splitPanels = scene.rexUI.add.splitPanels(config);\n
    "},{"location":"ui-splitpanels/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add split-panels object
      var splitPanels = scene.rexUI.add.splitPanels(config);\n
    "},{"location":"ui-splitpanels/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { SplitPanels } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add split-panels object
      var splitPanels = new SplitPanels(scene, config);\nscene.add.existing(splitPanels);\n
    "},{"location":"ui-splitpanels/#add-split-panels-object","title":"Add split-panels object","text":"
    var splitPanels = scene.rexUI.add.splitPanels({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nbackground: backgroundGameObject,\n\nleftPanel: leftPanelGameObject,\n// topPanel: topPanelGameObject,\n\nrightPanel: rightPanelGameObject,\n// bottomPanel: topPanelGameObject,\n\nsplitter: splitterGameObject,\n\nminLeftPanelWidth: 0,\nminTopPanelHeight: 0,\n\nminRightPanelWidth: 0,\nminBottomPanelHeight: 0,\n\nsplitRatio: 0.5\n\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0, item: 0,\n\nleftPanelTop: 0, leftPanelBottom: 0, leftPanelLeft: 0, leftPanelRight: 0,\n// topPanelTop: 0, topPanelBottom: 0, topPanelLeft: 0, topPanelRight: 0,\n\nrightPanelTop: 0, rightPanelBottom: 0, rightPanelLeft: 0, rightPanelRight: 0,\n// bottomPanelTop: 0, bottomPanelBottom: 0, bottomPanelLeft: 0, bottomPanelRight: 0,\n\nsplitterPanelTop: 0, splitterPanelBottom: 0, splitterPanelLeft: 0, splitterPanelRight: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • leftPanel(topPanel), rightPanel(bottomPanel) : First and second panel children.
    • splitter : Game object of splitter.
    • minLeftPanelWidth(minTopPanelHeight), minRightPanelWidth(minBottomPanelHeight) : Minimum width/height of first and second children.
      • 0 : Width/height does not have constraint. Default behavior.
    • splitRatio : Position of splitter. 0~1. Default value is 0.5.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between first child and splitter, splitter and second child.
      • space.leftPanelTop(space.topPanelTop), space.leftPanelBottom(space.topPanelBottom), space.leftPanelLeft(space.topPanelLeft), space.leftPanelRight(space.topPanelRight) : Space around first game object.
      • space.rightPanelTop(space.bottomPanelTop), space.rightPanelBottom(space.bottomPanelBottom), space.rightPanelLeft(space.bottomPanelLeft), space.rightPanelRight(space.bottomPanelRight) : Space around second game object.
      • space.splitterTop, space.splitterBottom, space.splitterLeft, space.splitterRight : Space around splitter game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-splitpanels/#custom-class","title":"Custom class","text":"
    • Define class
      class MySplitPanels extends RexPlugins.UI.SplitPanels {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var splitPanels = new MySplitPanels(scene, config);\n
    "},{"location":"ui-splitpanels/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    splitPanels.layout();\n

    See also - dirty

    "},{"location":"ui-splitpanels/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = splitPanels.getElement('background');\n
      • First game object
        var leftPanel = splitPanels.getElement('leftPanel');\n// var topPanel = splitPanels.getElement('topPanel');\n
      • Second game object
        var rightPanel = splitPanels.getElement('rightPanel');\n// var bottomPanel = splitPanels.getElement('bottomPanel');\n
      • Splitter game object
        var splitter = splitPanels.getElement('splitter');\n
    • Get by name
      var gameObject = splitPanels.getElement('#' + name);\n// var gameObject = splitPanels.getElement('#' + name, recursive);\n
      or
      var gameObject = splitPanels.getByName(name);\n// var gameObject = splitPanels.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-splitpanels/#split-ratio","title":"Split ratio","text":"
    • Get
      var splitRatio = splitPanels.splitRatio;\n
    • Set
      splitPanels.setSplitRatio(value);\n
      or
      splitPanels.splitRatio = value;\n
    "},{"location":"ui-splitpanels/#minimum-child-size","title":"Minimum child size","text":"
    • Get
      var minLeftPanelWidth = splitPanels.minLeftPanelWidth;\n// var minTopPanelHeight = splitPanels.minTopPanelHeight;\n\nvar minRightPanelWidth = splitPanels.minRightPanelWidth;\n// var minBottomPanelHeight = splitPanels.minBottomPanelHeight;\n
    • Set
      splitPanels.setMinLeftPanelWidth(value);\n// splitPanels.setMinTopPanelHeight(value);\n\nsplitPanels.setMinRightPanelWidth(value);\n// splitPanels.setMinBottomPanelHeight(value);\n
      or
      splitPanels.minLeftPanelWidth = value;\n// splitPanels.minTopPanelHeight = value;\n\nsplitPanels.minRightPanelWidth = value;\n// splitPanels.minBottomPanelHeight = value;\n
    "},{"location":"ui-splitpanels/#enable","title":"Enable","text":"
    • Get
      var enable = splitPanels.splitterEnable;\n
    • Set
      slider.setSplitterEnable(enable);\n
      or
      slider.splitterEnable = enable;\n
    "},{"location":"ui-splitpanels/#events","title":"Events","text":"
    • On drag splitter start
      splitPanels.on('splitter.dragstart', function(splitter, splitRatio){\n//\n}, scope);\n
    • On drag splitter end
      splitPanels.on('splitter.dragend', function(splitter, splitRatio){\n//\n}, scope);\n
    • On dragging splitter
      splitPanels.on('splitter.drag', function(splitter, splitRatio){\n//\n}, scope);\n
    • On pointer-over splitter
      splitPanels.on('splitter.over', function(splitter, splitRatio){\n//\n}, scope);\n
    • On pointer-out splitter
      splitPanels.on('splitter.out', function(splitter, splitRatio){\n//\n}, scope);\n
    "},{"location":"ui-splitpanels/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-style/","title":"Style","text":""},{"location":"ui-style/#introduction","title":"Introduction","text":"

    Style in plain object for creating image, or text.

    "},{"location":"ui-style/#style-of-background","title":"Style of Background","text":"

    Create Round-rectangle, Nine-slice, Nine-patch, or Image for background.

    • Create Round-rectangle, if style has color, or strokeColor key. Default type of Background.
    • Create Line-progress, if style has bar key.
    • Create Nine-slice, if style has leftWidth key.
    • Create Nine-patch, if style has leftWidth and stretchMode key.
    • Create Image, if style has key key.
    "},{"location":"ui-style/#style-of-image","title":"Style of Image","text":"

    Create Image, Nine-slice, Nine-patch, or Round-rectangle for image.

    • Create Image, if style has key key. Default type of Background.
    • Create Nine-slice, if style has leftWidth key.
    • Create Nine-patch, if style has leftWidth and stretchMode key.
    • Create Round-rectangle, if style has color, or strokeColor key.
    "},{"location":"ui-style/#style-of-text","title":"Style of Text","text":"

    Create Text, BBCodetext, BitmapText, SimpleLabel, or TextArea for text.

    • Text, by style, default type of Text.
    • BBCodetext, by style.
    • BitmapText, by style.
    • SimpleLabel, by style.
    • TextArea, by style.
    "},{"location":"ui-style/#style-of-image-game-object","title":"Style of Image game object","text":"
    {\n// $type: 'image',\n\nkey:\n// frame:\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n\n// effects: true,\n// Style override in active state\n// 'active.key': undefined,\n// 'active.frame': undefined,\n// 'active.tint': undefined,\n// 'active.alpha': undefined,\n// 'active.scale': undefined,\n// 'active.glowColor': null,\n// ...\n\n// Style override in hover state\n// 'hover.key': undefined,\n// 'hover.frame': undefined,\n// 'hover.tint': undefined,\n// 'hover.alpha': undefined,\n// 'hover.scale': undefined,\n// 'hover.glowColor': null,\n// ...\n\n// Style override in disable state\n// 'disable.key': undefined,\n// 'disable.frame': undefined,\n// 'disable.tint': undefined,\n// 'disable.alpha': undefined,\n// 'disable.scale': undefined,\n// 'disable.glowColor': null,\n// ...    \n}\n
    "},{"location":"ui-style/#style-of-nine-slice","title":"Style of Nine-slice","text":"
    {\n// $type: 'nineSlice',\n\nkey: ,\nframe: ,\nleftWidth: , rightWidth: ,\ntopHeight: , bottomHeight: ,\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n// width: 0,\n// height: 0,\n\n// effects: true,\n\n// Style override in active state\n// 'active.key': undefined,\n// 'active.frame': undefined,\n// 'active.tint': undefined,\n// 'active.alpha': undefined,\n// 'active.scale': undefined,\n// 'active.glowColor': null,\n// ...\n\n// Style override in hover state\n// 'hover.key': undefined,\n// 'hover.frame': undefined,\n// 'hover.tint': undefined,\n// 'hover.alpha': undefined,\n// 'hover.scale': undefined,\n// 'hover.glowColor': null,\n// ...\n\n// Style override in disable state\n// 'disable.key': undefined,\n// 'disable.frame': undefined,\n// 'disable.tint': undefined,\n// 'disable.alpha': undefined,\n// 'disable.scale': undefined,\n// 'disable.glowColor': null,\n// ...  \n}\n
    "},{"location":"ui-style/#style-of-nine-patch","title":"Style of Nine-patch","text":"
    {\n// $type: 'nineSlice',\n\nkey: ,\nframe: ,\nleftWidth: , rightWidth: ,\ntopHeight: , bottomHeight: ,\nstretchMode: ,\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n// width: 0,\n// height: 0,\n\n// effects: true,\n\n// Style override in active state\n// 'active.key': undefined,\n// 'active.frame': undefined,\n// 'active.tint': undefined,\n// 'active.alpha': undefined,\n// 'active.scale': undefined,\n// 'active.glowColor': null,\n// ...\n\n// Style override in hover state\n// 'hover.key': undefined,\n// 'hover.frame': undefined,\n// 'hover.tint': undefined,\n// 'hover.alpha': undefined,\n// 'hover.scale': undefined,\n// 'hover.glowColor': null,\n// ...\n\n// Style override in disable state\n// 'disable.key': undefined,\n// 'disable.frame': undefined,\n// 'disable.tint': undefined,\n// 'disable.alpha': undefined,\n// 'disable.scale': undefined,\n// 'disable.glowColor': null,\n// ...  \n}\n
    "},{"location":"ui-style/#style-of-round-rectangle","title":"Style of Round-rectangle","text":"
    {\n// $type: 'roundRectangle',\n\ncolor: 0xffffff,\n// alpha: 1,\n// origin:\n// originX: \n// originY:\nstrokeColor: 0xffffff,\n// strokeAlpha: 1,\n// strokeWidth: 2,\n// radius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n// width: 0,\n// height: 0,\n\n// Style override in active state\n// 'active.color': undefined,\n// 'active.alpha': undefined,\n// 'active.strokeColor': undefined,\n// 'active.strokeAlpha': undefined,\n// 'active.strokeWidth': undefined,\n// 'active.radius': undefined,\n// 'active.xxx': ...\n\n// Style override in hover state\n// 'hover.color': undefined,\n// 'hover.alpha': undefined,\n// 'hover.strokeColor': undefined,\n// 'hover.strokeAlpha': undefined,\n// 'hover.strokeWidth': undefined,\n// 'hover.radius': undefined,\n// 'hover.xxx': ...\n\n// Style override in disable state\n// 'disable.color': undefined,\n// 'disable.alpha': undefined,\n// 'disable.strokeColor': undefined,\n// 'disable.strokeAlpha': undefined,\n// 'disable.strokeWidth': undefined,\n// 'disable.radius': undefined,\n// 'disable.xxx': ...\n}\n
    "},{"location":"ui-style/#style-of-bar-rectangle","title":"Style of bar-rectangle","text":"

    Bar-rectangle = Line-progress

    {\n// $type: 'bar',\n\nbarColor: 0xffffff,\n// easeDuration: 200,\n// ease: 'Quad',\n// rtl: false,\n\n// alpha: 1,\n// origin:\n// originX: \n// originY:\n// color: 0xffffff,\n// strokeColor: 0xffffff,\n// strokeAlpha: 1,\n// strokeWidth: 2,    \n// width: 0,\n// height: 0,\n\n// Style override in active state\n// 'active.barColor': undefined,\n// 'active.color': undefined,\n// 'active.alpha': undefined,\n// 'active.strokeColor': undefined,\n// 'active.strokeAlpha': undefined,\n// 'active.strokeWidth': undefined,\n// 'active.radius': undefined,\n// 'active.xxx': ...\n\n// Style override in hover state\n// 'hover.barColor': undefined,\n// 'hover.color': undefined,\n// 'hover.alpha': undefined,\n// 'hover.strokeColor': undefined,\n// 'hover.strokeAlpha': undefined,\n// 'hover.strokeWidth': undefined,\n// 'hover.radius': undefined,\n// 'hover.xxx': ...,\n// 'hover.bar: true,\n\n// Style override in disable state\n// 'disable.barColor': undefined,\n// 'disable.color': undefined,\n// 'disable.alpha': undefined,\n// 'disable.strokeColor': undefined,\n// 'disable.strokeAlpha': undefined,\n// 'disable.strokeWidth': undefined,\n// 'disable.radius': undefined,\n// 'disable.xxx': ...\n}\n
    "},{"location":"ui-style/#style-of-text-game-object","title":"Style of Text game object","text":"
    {\n// $type: 'text',\n\n// Normal text-style\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nalign: 'left',  // 'left'|'center'|'right'|'justify'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\nrtl: false,\ntestString: '|M\u00c9qgy',\nwordWrap: {\nwidth: null,\ncallback: null,\ncallbackScope: null,\nuseAdvancedWrap: false\n},\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n\n// Style override in active state\n'active.fontFamily': undefined,\n'active.fontSize': undefined,\n'active.fontStyle': undefined,\n'active.backgroundColor': undefined,\n'active.color': undefined,\n'active.fill': undefined,\n'active.stroke': undefined,\n'active.strokeThickness': undefined,\n\n// Style override in hover state\n'hover.fontFamily': undefined,\n'hover.fontSize': undefined,\n'hover.fontStyle': undefined,\n'hover.backgroundColor': undefined,\n'hover.color': undefined,\n'hover.fill': undefined,\n'hover.stroke': undefined,\n'hover.strokeThickness': undefined,\n\n// Style override in disable state\n'disable.fontFamily': undefined,\n'disable.fontSize': undefined,\n'disable.fontStyle': undefined,\n'disable.backgroundColor': undefined,\n'disable.color': undefined,\n'disable.fill': undefined,\n'disable.stroke': undefined,\n'disable.strokeThickness': undefined,\n}\n
    "},{"location":"ui-style/#style-of-bbcodetext","title":"Style of BBCodeText","text":"
    {\n$type: 'bbcodetext', // or 'bbcode'\n\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},\nalign: 'left',  // 'left'|'center'|'right'|'justify'\npadding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\nmaxLines: 0,\nlineSpacing: 0,\nfixedWidth: 0,\nfixedHeight: 0,\nrtl: false,\ntestString: '|M\u00c9qgy',\nwrap: {\nmode: 'none'     // 0|'none'|1|'word'|2|'char'|'character'|3|'mix'\nwidth: null\n},\n// wordWrap: { width: 0 },   // Compatible with Text game object\nmetrics: false,\n// metrics: {\n//     ascent: 0,\n//     descent: 0,\n//     fontSize: 0\n// },\n\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// flipX: false,\n// flipY: false,\n// origin:\n// originX: \n// originY:\n}\n
    "},{"location":"ui-style/#style-of-bitmaptext","title":"Style of BitmapText","text":"
    {\n// $type: 'bitmaptext',  // or 'bitmap'\n\nfont: '',\nfontSize: undefined,\nalign: undefined,\ntint: undefined,\nletterSpacing: undefined,\nlineSpacing: undefined,\n\n// tint: 0xffffff,\n// alpha: 1,\n// scale: 1,\n// origin:\n// originX: \n// originY:\n\n// Style override in active state\n'active.font': undefined,\n'active.fontSize': undefined,\n'active.tint': undefined,\n'active.letterSpacing': undefined,\n'active.lineSpacing': undefined,\n\n// Style override in hover state\n'hover.font': undefined,\n'hover.fontSize': undefined,\n'hover.tint': undefined,\n'hover.letterSpacing': undefined,\n'hover.lineSpacing': undefined,\n\n// Style override in disable state\n'disable.font': undefined,\n'disable.fontSize': undefined,\n'disable.tint': undefined,\n'disable.letterSpacing': undefined,\n'disable.lineSpacing': undefined,\n}\n
    "},{"location":"ui-style/#style-of-simplelabel","title":"Style of SimpleLabel","text":"
    {\n$type: 'label',\n\n// width: undefined,\n// height: undefined,\n// origin:\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\nbackground: backgroundStyle,\n\nicon: iconStyle,\n\n// iconMask: false,\n// squareFitIcon: false,\n// iconSize: undefined, iconWidth: undefined, iconHeight: undefined,\n\ntext: testStyle,\n// wrapText: false,  // false|'word'|'char',\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\naction: actionStyle,\n\n// squareFitAction: false,\n// actionMask: false,\n// actionSize: undefined, actionWidth: undefined, actionHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\nalign: undefined,  // 'left' | 'top' | 'right' | 'bottom' | 'center\n}    
    • background :
      • Style of Background : Create Round-rectangle, Nine-slice, or Image as background element.
      • null : Don't create any game object.
    • text :
      • Style of Text : Create Text, BBCodeText, BitmapText, SimpleLabel, or TextArea as text element.
      • null : Don't create any game object.
    • icon, action :
      • Style of Image : Create Image, Nine-slice, or Round-rectangle as image, action element.
      • null : Don't create any game object.
    "},{"location":"ui-style/#style-of-textarea","title":"Style of TextArea","text":"

    {\n$type: 'textarea',\n\nspace: { left: 0, right: 0, top: 0, bottom: 0, text: 0, },\n\n// width:\n// height:\n// origin:\n// originX:\n// originY:\n\nbackground: backgroundStyle,\n\ntext: textStyle,\n\n// textWidth: undefined,\n// textHeight: undefined,\n// textMask: false,\n// alwaysScrollable: false,\n\nslider: {\ntrack: backgroundStyle,\n\nthumb: backgroundStyle,\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n},\n// slider: null,\n\n// scroller: {\n//     threshold: 10,\n//     slidingDeceleration: 5000,\n//     backDeceleration: 2000,\n//     pointerOutRelease: true,\n//     dragRate: 1,\n// },\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\nclampChildOY: false,\n}\n
    - background : - Style of Background : Create round-rectangle, nine-slice, or image as background element. - null : Don't create any game object. - text : - Style of Text : Create text, BBCodeText, BitmapText, or SimpleLabel as text element. - null : Don't create any game object. - slider : - slider.track : - Style of Background : Create round-rectangle, nine-slice, or image as track element. - null : Don't create any game object. - slider.thumb : - Style of Background : Create round-rectangle, nine-slice, or image as thumb element. - null : Don't create any game object. - null, or false : Don't create any game object for slider.

    "},{"location":"ui-style/#style-of-canvasinput","title":"Style of CanvasInput","text":"

    CanvasInput

    {\nwidth: undefined, height: undefined,\n\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n\n// Style when focus\n// 'focus.color': ...\n// 'focus.color2': ...\n// 'focus.stroke': ...\n},\nfocusStyle: undefined,\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0,\n\n// Style when cursor move on\n// 'cursor.color': ...\n// 'cursor.backgroundColor': ...\n// 'cursor.xxx': ...\n},\ncursorStyle: undefined,\n}\n
    "},{"location":"ui-style/#style-of-triangle","title":"Style of triangle","text":"
    {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n
    "},{"location":"ui-tabpages/","title":"Tab pages","text":""},{"location":"ui-tabpages/#introduction","title":"Introduction","text":"

    A container with tabs and pages, only current page is visible.

    • Author: Rex
    • Game object
    "},{"location":"ui-tabpages/#live-demos","title":"Live demos","text":"
    • Tabpage
    "},{"location":"ui-tabpages/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-tabpages/#install-plugin","title":"Install plugin","text":""},{"location":"ui-tabpages/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add tab-pages object
      var tabPages = scene.rexUI.add.tabPages(config);\n
    "},{"location":"ui-tabpages/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tab-pages object
      var tabPages = scene.rexUI.add.tabPages(config);\n
    "},{"location":"ui-tabpages/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TabPages } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add tab-pages object
      var tabPages = new TabPages(scene, config);\nscene.add.existing(tabPages);\n
    "},{"location":"ui-tabpages/#add-tab-pages-object","title":"Add tab-pages object","text":"
    var tabPages = scene.rexUI.add.tabPages({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// background: backgroundGameObject,\n\ntabsPosition: 'top',\n// tabPosition: 'top',\n\nwrapTabs: false,\n\ntabs: {\n// width:\n// height:\n// rtl:\n\n// background: backgroundGameObject,        \nalign:\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n},\nspace: { left: 0, right:0, top:0, bottom:0, item:0 }\n},\n\npages: {\nspace: { left: 0, right:0, top:0, bottom:0 },\nfadeIn: 0,\n},\n\nexpand: {\ntabs: false,\n},\n\nalign: {\ntabs: 'left',\n},\n\n// space: { left:0, right:0, top:0, bottom:0, item:0 },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • tabsPosition (or tabPosition) : Put tabs at top, bottom, left, right of pages.
      • 'top', 'bottom', 'left', 'right' : Default value is 'top'.
    • wrapTabs :
      • false : Uses Buttons as Tabs, default behavior.
      • true :
        • Using FixWidthButtons as Tabs, if tabPosition is 'top' or 'bottom'.
        • Using Buttons as Tabs, if tabPosition is 'left' or 'right'
    • tabs : Configuration of tabs, which is a buttons game object.
      • tabs.width, tabs.height : Minimum width, minimum height of tabs, to preserve space if tabs is empty, optional.
      • tabs.rtl :
        • true : Layout buttons from right to left.
        • false : Layout buttons from left to right. Default behavior.
      • tabs.background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
      • tabs.space :
        • tabs.space.top, tabs.space.bottom, tabs.space.left, tabs.space.right : Padding around bottons.
        • tabs.space.item : Space between 2 button game objects.
      • tabs.click: Configuration of button clicking.
        • tabs.click.mode :
          • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
          • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
        • tabs.click.clickInterval : Interval between 2 'click' events, in ms.
    • pages : Configuration of pages
      • pages.space : Pads spaces.
        • pages.space.left, pages.space.right, pages.space.top, pages.space.bottom : Space of bounds.
      • pages.fadeIn : Fade-in duration of current page.
        • 0 : No fade-in effect. Default behavior.
    • expand :
      • expand.tabs : Set true to expand width/height of tabs. Default value is false.
    • align :
      • align.tabs :
        • 'left'. 'right', 'center' : Align tabs to left/right/center side when tabPosition is 'top' or 'bottom'.
        • 'top'. 'bottom', 'center' : Align tabs to top/bottom/center side when tabPosition is 'left' or 'right'.
    • space :
      • An object: Padding of button game objects.
        • space.top, space.bottom, space.left, space.right : Padding around bottons.
        • space.item : Space between tabs and pages.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-tabpages/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTabPages extends RexPlugins.UI.TabPages {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var tabPages = new MyTabPages(scene, config);\n
    "},{"location":"ui-tabpages/#add-page","title":"Add page","text":"

    Add a tab/page to last of tabs/pages.

    tabPages.addPage(key, tabGameObject, pageGameObject).layout();\n

    or

    tabPages.addPage({\n// key: undefined,\ntab: tabGameObject,\npage: pageGameObject\n}).layout();\n
    • key : Unique string name of this page.
      • undefined : Create an UUID for key.
    • tab : A game object, will put it into tabs.
    • page : A game object, will put it into pages.

    Note

    Invoke tabPages.layout() after adding pages.

    "},{"location":"ui-tabpages/#swap-to-page","title":"Swap to page","text":"
    • Swap to related page when clicking tab.
    • Swap to page by key/index
      tabPages.swapPage(key);\n
      tabPages.swapPage(index);\n
      • key : Unique string name of the page.
      • index : Index number in tabs.
    • Swap to first page
      tabPages.swapFirstPage();\n
    • Swap to last page
      tabPages.swapLastPage();\n
    • Swap page without fade-in transition
      tabPages.swapPage(key, 0);\n
      tabPages.swapPage(index, 0);\n
      tabPages.swapFirstPage(0);\n
      tabPages.swapLastPage(0);\n
    "},{"location":"ui-tabpages/#remove-page","title":"Remove page","text":"
    • Remove page
      tabPages.removePage(key);\n
      tabPages.removePage(index);\n
    • Remove and destroy page
      tabPages.removePage(key, true);\n
      tabPages.removePage(index, true);\n
    • Remove all pages
      tabPages.removeAllPages();\n
    • Remove and destroy all pages
      tabPages.removeAllPages(true);\n
    "},{"location":"ui-tabpages/#change-tabs-position","title":"Change tabs position","text":"
    tabPages.setTabPosition(position);\n
    • position : 'top', 'bottom', 'left', 'right'
    "},{"location":"ui-tabpages/#padding-of-tabs","title":"Padding of tabs","text":"
    • Change padding
      tabPages.setTabsPadding(key, value).layout();\n
      or
      tabPages.setTabsPadding({\nleft: leftPadding, right: rightPadding,\ntop: topPadding,\nbottom: bottomPadding\n}).layout();\n
      • key : 'left', 'right', 'top', 'bottom', 'item'
    • Get padding
      var value = tabPages.getTabsPadding(key);\n
      • key : 'left', 'right', 'top', 'bottom', 'item'
    "},{"location":"ui-tabpages/#get-element","title":"Get element","text":"
    • Get element
      • Pages
        var gameObject = tabPages.getElement('pages');\n
      • Tabs, a buttons
        var gameObject = tabPages.getElement('tabs');\n
      • Page by key/index
        var gameObject = tabPages.getPage(key);\n
        var gameObject = tabPages.getPage(index);\n
        • key : Unique string name of the page.
        • index : Index number in tabs.
      • Tab by key/index
        var gameObjects = tabPages.getTab(key);\n
        var gameObjects = tabPages.getTab(index);\n
        • key : Unique string name of the page.
        • index : Index number in tabs.
    • Get by name
      var gameObject = tabPages.getElement('#' + name);\n// var gameObject = pages.getElement('#' + name, recursive);\n
      or
      var gameObject = tabPages.getByName(name);\n// var gameObject = tabPages.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-tabpages/#other-properties","title":"Other properties","text":"

    See sizer, base sizer object, container-lite, Pages, Buttons

    "},{"location":"ui-tabpages/#events","title":"Events","text":"
    • When swapping to a page by clicking tab, or tabPages.swapPage(key)
      pages.on('tab.focus', function(tab, key) {\n// ...\n}, scope);\npages.on('page.focus', function(page, key) {\n// ...\n}, scope);\n
      pages.on('tab.blur', function(tab, key) {\n// ...\n}, scope);\npages.on('page.blur', function(page, key) {\n// ...\n}, scope);    
      • tab : Game object of tab.
      • page : Game object of page.
      • key : Unique string name of the page.
    "},{"location":"ui-tabs/","title":"Tabs","text":""},{"location":"ui-tabs/#introduction","title":"Introduction","text":"

    A container with 4 groups of buttons around a center panel.

    • Author: Rex
    • Game object
    "},{"location":"ui-tabs/#live-demos","title":"Live demos","text":"
    • Tabs
    • Expand buttons
    • Tabs-table
    "},{"location":"ui-tabs/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-tabs/#install-plugin","title":"Install plugin","text":""},{"location":"ui-tabs/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add tabs object
      var tabs = scene.rexUI.add.tabs(config);\n
    "},{"location":"ui-tabs/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tabs object
      var tabs = scene.rexUI.add.tabs(config);\n
    "},{"location":"ui-tabs/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Tabs } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add tabs object
      var tabs = new Tabs(scene, config);\nscene.add.existing(tabs);\n
    "},{"location":"ui-tabs/#add-tabs-object","title":"Add Tabs object","text":"
    var tabs = scene.rexUI.add.tabs({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundGameObject,\npanel: panelGameObject,\n\nleftButtons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\nrightButtons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\ntopButtons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\nbottomButtons: [\nbuttonGameObject,\nbuttonGameObject,\n// ...\n],\nleftButtonsBackground: leftButtonsBackgroundGameObject,\nrightButtonsBackground: rightButtonsBackgroundGameObject,\ntopButtonsBackground: topButtonsBackgroundGameObject,\nbottomButtonsBackground: bottomButtonsBackgroundGameObject,\n\nexpand: {\npanel: false,\nleftButtons: false,\nrightButtons: false,\ntopButtons: false,\nbottomButtons: false,\n},\n\nalign: {\nleftButtons: 'top',\nrightButtons: 'top',\ntopButtons: 'left',\nbottomButtons: 'left',\n},\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nleftButtonsOffset: 0,\nrightButtonsOffset: 0,\ntopButtonsOffset: 0,\nbottomButtonsOffset: 0,\n\nleftButton: 0,\nrightButton: 0,\ntopButton: 0,\nbottomButton: 0\n},\n\nclick: {\nmode: 'pointerup',\nclickInterval: 100\n}\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of grid table.
    • panel : Game object of center panel.
    • leftButtons, rightButtons, topButtons, bottomButtons : Array of button game object.
      • [] : Assign an empty array if user will add button later.
    • leftButtonsBackground, rightButtonsBackground, topButtonsBackground, bottomButtonsBackground : Game object of leftButtons' background, rightButtons' background, topButtons' background, bottomButtons' background, optional.
    • expand : Expand size of panel or buttons
      • expand.panel : Expand size of panel. Default value is false.
      • expand.leftButtons, expand.rightButtons : Expand height of leftButtons, rightButtons. Default value is false.
      • expand.topButtons, expand.bottomButtons : Expand width of topButtons, bottomButtons. Default value is false.
    • align : Alignment of buttons
      • align.leftButtons, align.rightButtons : 'top', 'bottom', or 'center'. Default value is 'top'.
      • align.topButtons, align.bottomButtons : 'left', 'right', or 'center'. Default value is 'left'.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds
      • space.leftButtonsOffset, space.rightButtonsOffset : Top offset of buttons group.
      • space.topButtonsOffset, space.bottomButtonsOffset : Left offset of buttons group.
      • space.leftButton, space.rightButton, space.topButton, space.bottomButton : Space between 2 button game objects.
    • click: Configuration of button clicking.
      • click.mode :
        • 'pointerdown', 'press', or 0 : Fire 'click' event when touch pressed.
        • 'pointerup', 'release', or 1 : Fire 'click' event when touch released after pressed.
      • click.clickInterval : Interval between 2 'click' events, in ms.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-tabs/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTabs extends RexPlugins.UI.Tabs {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var tabs = new MyTabs(scene, config);\n
    "},{"location":"ui-tabs/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    tabs.layout();\n

    See also - dirty

    "},{"location":"ui-tabs/#other-properties","title":"Other properties","text":"

    See grid sizer object, base-sizer object.

    "},{"location":"ui-tabs/#events","title":"Events","text":"
    • Click button
      tabs.on('button.click', function(button, groupName, index, pointer) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
    • Pointer-over button
      tabs.on('button.over', function(button, groupName, index, pointer) {\n// ...\n}, scope);\n
      • button : Triggered button game object
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
    • Pointer-out button
      tabs.on('button.out', function(button, groupName, index, pointer) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
      • pointer : Pointer object.
    • Enable button's input
      tabs.on('button.enable', function(button, groupName, index) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
    • Disable button's input
      tabs.on('button.disalbe', function(button, groupName, index) {\n// ...\n}, scope);\n
      • button : Triggered button game object.
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : Index of triggered button game object.
    "},{"location":"ui-tabs/#emit-button-click-event","title":"Emit button click event","text":"
    • Emit button click event in a given group
      tabs.emitButtonClick(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Emit left/right/top/bottom button click event
      tabs.emitLeftButtonClick(index);\ntabs.emitRightButtonClick(index);\ntabs.emitTopButtonClick(index);\ntabs.emitBottomButtonClick(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-tabs/#enabledisable-input-of-button","title":"Enable/disable input of button","text":"
    • Enable button input in a given group
      tabs.setButtonEnable(groupName, index);\n// tabs.setButtonEnable(groupName, index, true);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Enable left/right/top/bottom button
      tabs.setLeftButtonEnable(index);\ntabs.setRightButtonEnable(index);\ntabs.setTopButtonEnable(index);\ntabs.setBottomButtonEnable(index);\n
      • index : A number index, or a button game object.
    • Disable button input in a given group
      tabs.setButtonEnable(groupName, index, false);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Disable choice/action/toolbar/left-toolbar button's input
      tabs.setLeftButtonEnable(index, false);\ntabs.setRightButtonEnable(index, false);\ntabs.setTopButtonEnable(index, false);\ntabs.setBottomButtonEnable(index, false);\n
      • index : A number index, or a button game object.
    • Toggle button input in a given group
      tabs.toggleButtonEnable(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Toggle choice/action/toolbar/left-toolbar button's input
      tabs.toggleLeftButtonEnable(index);\ntabs.toggleRightButtonEnable(index);\ntabs.toggleTopButtonEnable(index);\ntabs.toggleBottomButtonEnable(index);\n
      • index : A number index, or a button game object.
    • Get button input enable in a given group
      var enabled = tabs.getButtonEnable(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • Get choice/action/toolbar/left-toolbar button's input enable
      var enabled = tabs.getLeftButtonEnable(index);\nvar enabled = tabs.getRightButtonEnable(index);\nvar enabled = tabs.getTopButtonEnable(index);\nvar enabled = tabs.getBottomButtonEnable(index);\n
      • index : A number index, or a button game object.
    "},{"location":"ui-tabs/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = tabs.getElement('background');\n
      • Panel game object
        var panel = tabs.getElement('panel');\n
      • Buttons
        • Button game object in a group
          var buttons = tabs.getButton(groupName, index)\n
          • groupName : 'left', 'right', 'top', or 'bottom'.
          • index : A number index.
        • Left button game object
          var buttons = tabs.getElement('leftButtons');\n
          or
          var button = tabs.getLeftButton(index);\n
          or
          var buttons = tabs.getElement('leftButtons[0]');\n
          • First button of left buttons.
        • Right button game object
          var buttons = tabs.getElement('rightButtons');\n
          or
          var button = tabs.getRightButton(index);\n
          or
          var buttons = tabs.getElement('rightButtons[0]');\n
          • First button of right buttons.
        • Top button game object
          var buttons = tabs.getElement('topButtons');\n
          or
          var button = tabs.getTopButton(index);\n
          or
          var buttons = tabs.getElement('topButtons[0]');\n
          • First button of top buttons.
        • Bottom button game object
          var buttons = tabs.getElement('bottomButtons');\n
          or
          var button = tabs.getBottomButton(index);\n
          or
          var buttons = tabs.getElement('bottomButtons[0]');\n
          • First button of bottom buttons.
    • Get by name
      var gameObject = tabs.getElement('#' + name);\n// var gameObject = tabs.getElement('#' + name, recursive);\n
      or
      var gameObject = tabs.getByName(name);\n// var gameObject = tabs.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-tabs/#add-button","title":"Add button","text":"
    • Add button in a group
      tabs.addButton(groupName, gameObject);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • gameObject : A game object, or an array of game objects.
    • Add left/right/top/bottom button
      tabs.addLeftButton(gameObject);\ntabs.addRightButton(gameObject);\ntabs.addTopButton(gameObject);\ntabs.addBottomButton(gameObject);\n
      • gameObject : A game object, or an array of game objects.
    "},{"location":"ui-tabs/#remove-button","title":"Remove button","text":"
    • Remove a button from a group
      tabls.removeButton(groupName, index, destroyChild);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, a string name, or a button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove left/right/top/bottom button
      tabs.removeLeftButton(index, destroyChild);\ntabs.removeRightButton(index, destroyChild);\ntabs.removeTopButton(index, destroyChild);\ntabs.removeBottomButton(index, destroyChild);\n
      • index : A number index, a string name, or a button game object.
      • destroyChild : Set true to destroy button game object.
    • Remove all buttons of a group
      tabls.clearButtons(groupName, destroyChild);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • destroyChild : Set true to destroy button game objects.
    • Remove all left/right/top/bottom buttons
      tabs.clearLeftButtons(destroyChild);\ntabs.clearRightButtons(destroyChild);\ntabs.clearTopButtons(destroyChild);\ntabs.clearBottomButtosn(destroyChild);\n
      • destroyChild : Set true to destroy button game objects.
    "},{"location":"ui-tabs/#showhide-button","title":"Show/hide button","text":"

    Hidden elements won't be counted when layouting. Call tabs.layout(), or topSizer.layout() after show/hide any button.

    • Show button in a group
      tabs.showButton(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, a string name, or a button game object.
    • Show left/right/top/bottom button
      tabs.showLeftButton(index);\ntabs.showRightButton(index);\ntabs.showTopButton(index);\ntabs.showBottomButton(index);\n
      • index : A number index, a string name, or a button game object.
    • Hide button in a group
      tabs.hideButton(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, a string name, or a button game object.
    • Hide left/right/top/bottom button.
      tabs.hideLeftButton(index);\ntabs.hideRightButton(index);\ntabs.hideTopButton(index);\ntabs.hideBottomButton(index);\n
      • index : A number index, a string name, or a button game object.
    "},{"location":"ui-tabs/#for-each-button","title":"For each button","text":"
    • For each button in a group
      var enabled = tabs.forEachButton(groupName, index);\n
      • groupName : 'left', 'right', 'top', or 'bottom'.
      • index : A number index, or a button game object.
    • For each button in left/right/top/bottom group
      tabs.forEachLeftButton(callback, scope);\ntabs.forEachRightButton(callback, scope);\ntabs.forEachTopButton(callback, scope);\ntabs.forEachBottomButton(callback, scope);\n
      • callback :
        function(button, index, buttons) {\n// ...\n}\n
    "},{"location":"ui-text-helper/","title":"Ui text helper","text":""},{"location":"ui-text-helper/#introduction","title":"Introduction","text":"

    Some helper methods for Text object, bbcode text object, tag text object, Bitmap text object game objects

    • Author: Rex
    • Methods
    "},{"location":"ui-text-helper/#live-demos","title":"Live demos","text":"
    • Wrap-expand-text
    • Wrap-expand-bitmaptext
    • Fontsize-expand-text
    • Resize Fontsize-expand-text
    "},{"location":"ui-text-helper/#usage","title":"Usage","text":"
    • Wrap-expand-text
    • Fontsize-expand-text
    "},{"location":"ui-text-helper/#wrap-expand-text","title":"Wrap expand text","text":"
    sizer\n.add(\nthis.rexUI.wrapExpandText(this.add.text(0, 0, content)),\n{\n// proportion: 1,\n// expand: true\n}\n)\n
    • proportion: 1 or/and expand: true : Expand width of text
    "},{"location":"ui-text-helper/#fontsize-expand-text","title":"Fontsize expand text","text":"
    sizer\n.add(\nthis.rexUI.fontSizeExpandText(this.add.text(0, 0, content)),\n{\n// proportion: 1,\n// expand: true\n}\n)\n
    • proportion: 1 or/and expand: true : Expand width of text
    "},{"location":"ui-textarea/","title":"Text area","text":""},{"location":"ui-textarea/#introduction","title":"Introduction","text":"

    A container with a text, slider, and scroller.

    • Author: Rex
    • Game object
    "},{"location":"ui-textarea/#live-demos","title":"Live demos","text":"
    • Text-area
    • Bitmap text
    • Hide unscrollable slider
    • Append text
    • Scroll to line
    • Modal dialog
    • Min height
    "},{"location":"ui-textarea/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-textarea/#install-plugin","title":"Install plugin","text":""},{"location":"ui-textarea/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add text-area object
      var textArea = scene.rexUI.add.textArea(config);\n
    "},{"location":"ui-textarea/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-area object
      var textArea = scene.rexUI.add.textArea(config);\n
    "},{"location":"ui-textarea/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TextArea } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add text-area object
      var textArea = new TextArea(scene, config);\nscene.add.existing(textArea);\n
    "},{"location":"ui-textarea/#add-text-area-object","title":"Add text-area object","text":"
    var textArea = scene.rexUI.add.textArea({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundGameObject,\n\ntext: textGameObject,\n// textWidth: undefined,\n// textHeight: undefined,\n// textMask: false,\n// alwaysScrollable: false,\n\nslider: {\n// background: sliderBackgroundGameObject,\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n\n// indicator: indicatorGameObject,\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n\n// buttons: {\n//     top: topButtonGameObject, bottom: bottomButtonGameObject,\n//     left: leftButtonGameObject, right: rightButtonGameObject,\n//     step: 0.01,\n// }\n},\n\n// scroller: {\n//     threshold: 10,\n//     slidingDeceleration: 5000,\n//     backDeceleration: 2000,\n//     pointerOutRelease: true,\n//     rectBoundsInteractive: true,\n//     dragRate: 1,\n// },\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\nclampChildOY: false,\n\nheader: headerGameObject,\nfooter: footerGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntext: 0,\n// text: {\n//    top: 0,\n//    bottom: 0,\n//    left: 0,\n//    right: 0,\n//},\n\nslider: 0,\n// slider: {\n//     top: 0,\n//     bottom: 0,\n//     left: 0,\n//     right: 0,\n// },\n\nheader: 0,\nfooter: 0,\n},\n\nexpand: {\nheader: true,\nfooter: true,\n},\n\nalign: {\nheader: 'center',\nfooter: 'center',\n},\n\ncontent: '',\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of text area.
    • text : Text object, bbcode text object, tag text object, or bitmap text object
    • textWidth : Fixed width of text game object. Set undefined to ignore this feature.
    • textHeight : Fixed height of text game object. Set undefined to ignore this feature.
    • textMask :
      • false : Crop text game object. Default behavior if text game object has setCrop method.
      • true : Apply mask on text to crop text game object. Default behavior if text game object does not have setCrop method (ex. bitmaptext game object).
    • slider : Componments of slider, optional.
      • slider.background : Game object of slider background, optional.
      • slider.track : Game object of track.
      • slider.thumb : Game object of thumb.
      • slider.input :
        • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.position : Position of this slider.
        • 0, 'right', 'bottom' : Slider at right/bottom side. Default value.
        • 1, 'left', 'top' : Slider at left/top side.
      • slider.hideUnscrollableSlider :
        • false : Slider is always visible no matter it is scrollable or not. Default behavior.
        • true : Set slider to invisible if it is unscrollable.
      • slider.disableUnscrollableDrag :
        • false : Scroller is always enale no matter it is scrollable or not. Default behavior.
        • true : Set scroller to disable if it is unscrollable.
      • slider.adaptThumbSize :
        • false : Don't adjust height/width of thumb. Default behavior.
        • true : Adjust height/width of thumb according to ratio of visible child.
          • Minimum height/width of thumb = slider.minThumbSize. If content is larger then a page.
          • Maximum height/width of thumb = height/width of slider.track. If content is less then a page.
      • slider.minThumbSize : Minimum height/width of thumb used in slider.adaptThumbSize mode.
      • slider.buttons : Press button to scroll content in each tick.
        • slider.buttons.top, slider.buttons.bottom : Top and bottom buttons.
        • slider.buttons.left, slider.buttons.right : Left and right buttons
        • slider.buttons.step : Scrolling step in each tick. Default value is 0.01.
      • Set to false to skip creating slider.
    • scroller : Configuration of scroller behavior.
      • scroller.threshold : Minimal movement to scroll. Set 0 to scroll immediately.
      • scroller.slidingDeceleration : Deceleration of slow down when dragging released.
        • Set false to disable it.
      • scroller.backDeceleration : Deceleration of pull back when out of bounds.
        • Set false to disable it.
      • scroller.pointerOutRelease : Set to true to release input control when pointer out of gameObject.
      • scroller.rectBoundsInteractive :
        • false : Detect scrolling by game object's touch input.
        • true : Detect scrolling by rectangle bounds of game object. Default behavior.
      • scroller.dragRate : Rate of dragging distance/dragging speed. Default value is 1.
      • Set to false to skip creating scroller.
    • mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
      • mouseWheelScroller.focus :
        • false, or 0 : Without checking if cursor is over game object or not.
        • true, or 1 : Cursor is inside the rectangle bounds of game object. Default behavior.
        • 2 : Cursor is over game object.
      • mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
      • Set to false to skip creating mouse-wheel-scroller. Default behavior.
    • clampChildOY : Set true to clamp scrolling.
    • alwaysScrollable :
      • false : Can't scroll if content is less then 1 page. Default behavior.
      • true : Can scroll in all cases
    • header : Game object of header, optional.
    • footer : Game object of footer, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.text :
        • A number: Space between text object and slider object.
        • An object: Padding of text object.
          • space.text.top, space.text.bottom : Top, bottom padding space of text object.
          • space.text.right : Space between text object and slider object.
      • space.slider :
        • 0 : No space around slider.
        • space.slider.left, space.slider.right, space.slider.top, space.slider.bottom : Space around slider.
      • space.header : Space between header and text object.
      • space.footer : Space between footer and text object.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width or height of header game object.
      • expand.footer : Set true to expand width or height of footer game object.
    • align : Align element
      • align.header
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • align.footer
    • content : Content of this text area.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-textarea/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextArea extends RexPlugins.UI.TextArea {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var textArea = new MyTextArea(scene, config);\n
    "},{"location":"ui-textarea/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    textArea.layout();\n

    See also - dirty

    "},{"location":"ui-textarea/#content","title":"Content","text":"
    • Set
      textArea.setText(text);\n
    • Append
      textArea.appendText(text);\n
    • Get
      var text = textArea.text;\n
    "},{"location":"ui-textarea/#scroll-content","title":"Scroll content","text":"
    • Scroll down lines
      textArea.scrollLine(lineCount);\n
    • Set
      textArea.childOY = oy;\n// textArea.setChildOY(oy);\n
    • Set and clamp
      textArea.setChildOY(oy, true);\n
    • Add
      textArea.addChildOY(oy);\n
    • Add and clamp
      textArea.addChildOY(oy, true);\n
    • Get
      var childOY = textArea.childOY;\n
    • Top OY
      var topOY = textArea.topChildOY;\n
    • Bottom OY
      var bottomOY = textArea.bottomChildOY;\n
    • Is overflow (height of content is larger than display height)
      var isOverflow = textArea.isOverflow;\n
    "},{"location":"ui-textarea/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      textArea.t = t;  // t: 0~1\n// textArea.setT(t);  \n
    • Set and clamp
      textArea.setT(t, true);\n
    • Get
      var t = textArea.t;\n
    "},{"location":"ui-textarea/#scroll-to-topbottom","title":"Scroll to top/bottom","text":"
    • Scroll to top
      textArea.scrollToTop();\n
      • Equal to textArea.t = 0;
    • Scroll to bottom
      textArea.scrollToBottom();\n
      • Equal to textArea.t = 1;
    "},{"location":"ui-textarea/#scroll-to-line","title":"Scroll to line","text":"
    • Scroll to next line
      textArea.scrollToNextLine();\n
    • Scroll to next n line
      textArea.scrollToNextLine(n);\n
    • Scroll to line
      textArea.scrollToLine(lineIndex);\n
    • Get current line index
      var lineIndex = textArea.lineIndex;\n
    "},{"location":"ui-textarea/#enabledisable-scrolling","title":"Enable/disable scrolling","text":"
    • Slider
      • Set enable state
        textArea.setSliderEnable(enabled);\n
        or
        textArea.sliderEnable = enabled;\n
      • Get enable state
        var enable = textArea.sliderEnable;\n
    • Scroller
      • Set enable state
        textArea.setScrollerEnable(enabled);\n
        or
        textArea.scrollerEnable = enabled;\n
      • Get enable state
        var enable = textArea.scrollerEnable;\n
    • Mouse-Wheel-Scroller
      • Set enable state
        textArea.setMouseWheelScrollerEnable(enabled);\n
        or
        textArea.mouseWheelScrollerEnable = enabled;\n
      • Get enable state
        var enable = textArea.mouseWheelScrollerEnable;\n
    "},{"location":"ui-textarea/#event","title":"Event","text":"
    • Scroll
      textArea.on('scroll', function(textArea) {\n// ...\n})\n
    • Slider
      • Slider drag start
        textArea.getElement('slider').on('inputstart', function(panel) {\n// ...\n})\n
      • Slider drag end
        textArea.getElement('slider').on('inputend', function(panel) {\n// ...\n})\n
    • Scroller
      • Scroller drag start
        textArea.getElement('scroller').on('dragstart', function(panel) {\n// ...\n})\n
      • Scroller drag end
        textArea.getElement('scroller').on('dragend', function(panel) {\n// ...\n})\n
    "},{"location":"ui-textarea/#lines-count","title":"Lines count","text":"
    var linesCount = textArea.linesCount;\n
    "},{"location":"ui-textarea/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-textarea/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = textArea.getElement('background');\n
      • Text game object
        var text = textArea.getElement('text');\n
      • Slider
        • Track
          var track = textArea.getElement('slider.track');\n
        • Thumb
          var thumb = textArea.getElement('slider.thumb');\n
      • Scroller
        var scroller = textArea.getElement('scroller');\n
    • Get by name
      var gameObject = textArea.getElement('#' + name);\n// var gameObject = textArea.getElement('#' + name, recursive);\n
      or
      var gameObject = textArea.getByName(name);\n// var gameObject = textArea.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-textareainput/","title":"Text area input","text":""},{"location":"ui-textareainput/#introduction","title":"Introduction","text":"

    A container with a canvasInput, and slider.

    • Author: Rex
    • Game object
    "},{"location":"ui-textareainput/#live-demos","title":"Live demos","text":"
    • Text-area
    "},{"location":"ui-textareainput/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-textareainput/#install-plugin","title":"Install plugin","text":""},{"location":"ui-textareainput/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add text-area-input object
      var textAreaInput = scene.rexUI.add.textAreaInput(config);\n
    "},{"location":"ui-textareainput/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-area-input object
      var textAreaInput = scene.rexUI.add.textAreaInput(config);\n
    "},{"location":"ui-textareainput/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TextAreaInput } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add text-area-input object
      var textAreaInput = new TextAreaInput(scene, config);\nscene.add.existing(textAreaInput);\n
    "},{"location":"ui-textareainput/#add-text-area-input-object","title":"Add text-area-input object","text":"
    var textAreaInput = scene.rexUI.add.textAreaInput({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\n// Elements\nbackground: backgroundGameObject,\n\ntext: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null,\n\n// Style when focus\n// 'focus.color': ...\n// 'focus.color2': ...\n// 'focus.stroke': ...\n},\nfocusStyle: undefined,\n\ninnerBounds: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBY: undefined,\noffsetX: 0,\noffsetY: 0,\n\n// Style when cursor move on\n// 'cursor.color': ...\n// 'cursor.backgroundColor': ...\n// 'cursor.xxx': ...\n},\ncursorStyle: undefined,\n\nchildrenInteractive: false,\n\ntext: '',\n\nwrap: {\nlineHeight: undefined,\nuseDefaultLineHeight: true,\nmaxLines: 1,\nwrapWidth: undefined,\nletterSpacing: 0,\nhAlign: 0,\nvAlign: 'center',  // For single line text input\nwrapMode: 'char',  // For single line text input\n},\n\ntextArea: true,\n\n// Parameters of hidden-text-editor   \n// inputType: 'text',  // 'text'|'password'|'textarea'|...                \n\n// readOnly: false,\n// maxLength: undefined,\n// minLength: undefined,\n// selectAll: false,\n\n// enterClose: true,\n\n// Callbacks\n// onOpen: function (textObject, hiddenInputText) {\n// },\n\n// onClose: function (textObject, hiddenInputText) {\n// },\n\n// onUpdate: function (text, textObject, hiddenInputText) {\n//     return text;\n// },\n\n// onAddChar: function(child, index, canvasInput) {\n//    child.modifyStyle({...})\n// },\n\n// onCursorOut: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// onCursorIn: function(child, cursorIndex, canvasInput) {\n//     child.modifyStyle({\n//         \n//     });\n// },\n\n// parseTextCallback: function(text) {\n//     return text;\n// }.        \n},\n// alwaysScrollable: false,\n\nslider: {\n// background: sliderBackgroundGameObject,\ntrack: trackGameObject,\n/* \n        track: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n\n// indicator: indicatorGameObject,\nthumb: thumbGameObject,\n/* \n        thumb: { \n            width: 1, height: 1,\n            radius: 0, \n            color: undefined, alpha: 1,\n            strokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\n            shape: undefined\n        }\n        */\n\n// input: 'drag',\n// position: 'right',\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n\n// buttons: {\n//     top: topButtonGameObject, bottom: bottomButtonGameObject,\n//     left: leftButtonGameObject, right: rightButtonGameObject,\n//     step: 0.01,\n// }\n},\n\n// scroller: false,  // No scrollor support\n\nmouseWheelScroller: false,\n// mouseWheelScroller: {\n//     focus: true,\n//     speed: 0.1\n// },\n\nclampChildOY: false,\n\nheader: headerGameObject,\nfooter: footerGameObject,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\ntext: 0,\n// text: {\n//    top: 0,\n//    bottom: 0,\n//    left: 0,\n//    right: 0,\n//},\n\nslider: 0,\n// slider: {\n//     top: 0,\n//     bottom: 0,\n//     left: 0,\n//     right: 0,\n// },\n\nheader: 0,\nfooter: 0,\n},\n\nexpand: {\nheader: true,\nfooter: true,\n},\n\nalign: {\nheader: 'center',\nfooter: 'center',\n},\n\ncontent: '',\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • background : Game object of background, optional. This background game object will be resized to fit the size of text area.
    • text : Configuration of CanvasInput, or a CanvasInput game object.
    • slider : Componments of slider, optional.
      • slider.background : Game object of slider background, optional.
      • slider.track : Game object of track.
      • slider.thumb : Game object of thumb.
      • slider.input :
        • 'pan', 'drag', or 0 : Control slider by panning/dragging thumb game object. Default setting.
        • 'click', or 1 : Control slider by touching track game object.
        • 'none', or -1 : Disable sider controlling.
      • slider.position : Position of this slider.
        • 0, 'right', 'bottom' : Slider at right/bottom side. Default value.
        • 1, 'left', 'top' : Slider at left/top side.
      • slider.hideUnscrollableSlider :
        • false : Slider is always visible no matter it is scrollable or not. Default behavior.
        • true : Set slider to invisible if it is unscrollable.
      • slider.disableUnscrollableDrag :
        • false : Scroller is always enale no matter it is scrollable or not. Default behavior.
        • true : Set scroller to disable if it is unscrollable.
      • slider.adaptThumbSize :
        • false : Don't adjust height/width of thumb. Default behavior.
        • true : Adjust height/width of thumb according to ratio of visible child.
          • Minimum height/width of thumb = slider.minThumbSize. If content is larger then a page.
          • Maximum height/width of thumb = height/width of slider.track. If content is less then a page.
      • slider.minThumbSize : Minimum height/width of thumb used in slider.adaptThumbSize mode.
      • slider.buttons : Press button to scroll content in each tick.
        • slider.buttons.top, slider.buttons.bottom : Top and bottom buttons.
        • slider.buttons.left, slider.buttons.right : Left and right buttons
        • slider.buttons.step : Scrolling step in each tick. Default value is 0.01.
      • Set to false to skip creating slider.
    • scroller : No scroller supported (false).
    • mouseWheelScroller : Configuration of mouse-wheel-scroller behavior.
      • mouseWheelScroller.focus :
        • true : Only scrolling when cursor is over textAreaInput. Default behavior.
        • false : Scrolling without checking cursor.
      • mouseWheelScroller.speed : Scrolling speed, default value is 0.1.
      • Set to false to skip creating mouse-wheel-scroller. Default behavior.
    • clampChildOY : Set true to clamp scrolling.
    • alwaysScrollable :
      • false : Can't scroll if content is less then 1 page. Default behavior.
      • true : Can scroll in all cases
    • header : Game object of header, optional.
    • footer : Game object of footer, optional.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.text :
        • A number: Space between text object and slider object.
        • An object: Padding of text object.
          • space.text.top, space.text.bottom : Top, bottom padding space of text object.
          • space.text.right : Space between text object and slider object.
      • space.slider :
        • 0 : No space around slider.
        • space.slider.left, space.slider.right, space.slider.top, space.slider.bottom : Space around slider.
      • space.header : Space between header and text object.
      • space.footer : Space between footer and text object.
    • expand : Expand width or height of element
      • expand.header : Set true to expand width or height of header game object.
      • expand.footer : Set true to expand width or height of footer game object.
    • align : Align element
      • align.header
        • 'center', or Phaser.Display.Align.CENTER : Align game object at center. Default value.
        • 'left', or Phaser.Display.Align.LEFT_CENTER : Align game object at left-center.
        • 'right', or Phaser.Display.Align.RIGHT_CENTER : Align game object at right-center.
      • align.footer
    • content : Content of this text area.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-textareainput/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextAreaInput extends RexPlugins.UI.TextAreaInput {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var textAreaInput = new MyTextAreaInput(scene, config);\n
    "},{"location":"ui-textareainput/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    textAreaInput.layout();\n

    See also - dirty

    "},{"location":"ui-textareainput/#content","title":"Content","text":"
    • Set
      textAreaInput.setText(text);\n
    • Append
      textAreaInput.appendText(text);\n
    • Get
      var text = textAreaInput.text;\n
    "},{"location":"ui-textareainput/#scroll-content","title":"Scroll content","text":"
    • Scroll down lines
      textAreaInput.scrollLine(lineCount);\n
    • Set
      textAreaInput.childOY = oy;\n// textAreaInput.setChildOY(oy);\n
    • Set and clamp
      textAreaInput.setChildOY(oy, true);\n
    • Add
      textAreaInput.addChildOY(oy);\n
    • Add and clamp
      textAreaInput.addChildOY(oy, true);\n
    • Get
      var childOY = textAreaInput.childOY;\n
    • Top OY
      var topOY = textAreaInput.topChildOY;\n
    • Bottom OY
      var bottomOY = textAreaInput.bottomChildOY;\n
    • Is overflow (height of content is larger than display height)
      var isOverflow = textAreaInput.isOverflow;\n
    "},{"location":"ui-textareainput/#scroll-by-percentage","title":"Scroll by percentage","text":"
    • Set
      textAreaInput.t = t;  // t: 0~1\n// textAreaInput.setT(t);  \n
    • Set and clamp
      textAreaInput.setT(t, true);\n
    • Get
      var t = textAreaInput.t;\n
    "},{"location":"ui-textareainput/#scroll-to-topbottom","title":"Scroll to top/bottom","text":"
    • Scroll to top
      textAreaInput.scrollToTop();\n
      • Equal to textAreaInput.t = 0;
    • Scroll to bottom
      textAreaInput.scrollToBottom();\n
      • Equal to textAreaInput.t = 1;
    "},{"location":"ui-textareainput/#scroll-to-line","title":"Scroll to line","text":"
    • Scroll to next line
      textAreaInput.scrollToNextLine();\n
    • Scroll to next n line
      textAreaInput.scrollToNextLine(n);\n
    • Scroll to line
      textAreaInput.scrollToLine(lineIndex);\n
    • Get current line index
      var lineIndex = textAreaInput.lineIndex;\n
    "},{"location":"ui-textareainput/#enabledisable-scrolling","title":"Enable/disable scrolling","text":"
    • Slider
      • Set enable state
        textAreaInput.setSliderEnable(enabled);\n
        or
        textAreaInput.sliderEnable = enabled;\n
      • Get enable state
        var enable = textAreaInput.sliderEnable;\n
    • Scroller
      • Set enable state
        textAreaInput.setScrollerEnable(enabled);\n
        or
        textAreaInput.scrollerEnable = enabled;\n
      • Get enable state
        var enable = textAreaInput.scrollerEnable;\n
    "},{"location":"ui-textareainput/#read-only","title":"Read only","text":"
    • Enable read only
      textAreaInput.setReadOnly();\n// textAreaInput.setReadOnly(true);\n
      or
      textAreaInput.readOnly = true;\n
    • Disable read only
      textAreaInput.setReadOnly(false);\n
      or
      textAreaInput.readOnly = false;\n
    • Get read only
      var readOnlyEanble = txt.readOnly;\n
    "},{"location":"ui-textareainput/#event","title":"Event","text":"
    • On close text-editor
      textAreaInput.on('close', function(text, textAreaInput) {\n\n})\n
    • Text changed
      textAreaInput.on('textchange', function(text, textAreaInput){\n// ...\n})\n
    • Scroll
      textAreaInput.on('scroll', function(textAreaInput) {\n// ...\n})\n
    • Slider
      • Slider drag start
        textAreaInput.getElement('slider').on('inputstart', function(panel) {\n// ...\n})\n
      • Slider drag end
        textAreaInput.getElement('slider').on('inputend', function(panel) {\n// ...\n})\n
    • Scroller
      • Scroller drag start
        textAreaInput.getElement('scroller').on('dragstart', function(panel) {\n// ...\n})\n
      • Scroller drag end
        textAreaInput.getElement('scroller').on('dragend', function(panel) {\n// ...\n})\n
    "},{"location":"ui-textareainput/#lines-count","title":"Lines count","text":"
    var linesCount = textAreaInput.linesCount;\n
    "},{"location":"ui-textareainput/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-textareainput/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = textAreaInput.getElement('background');\n
      • Text game object
        var text = textAreaInput.getElement('text');\n
      • Slider
        • Track
          var track = textAreaInput.getElement('slider.track');\n
        • Thumb
          var thumb = textAreaInput.getElement('slider.thumb');\n
    • Get by name
      var gameObject = textAreaInput.getElement('#' + name);\n// var gameObject = textAreaInput.getElement('#' + name, recursive);\n
      or
      var gameObject = textAreaInput.getByName(name);\n// var gameObject = textAreaInput.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-textbox/","title":"Text box","text":""},{"location":"ui-textbox/#introduction","title":"Introduction","text":"

    A container with an icon, (typing and paging) text, and background.

    • Author: Rex
    • Game object
    "},{"location":"ui-textbox/#live-demos","title":"Live demos","text":"
    • Text box
    • Inner sizer
    • Speech bubble background
    • Bitmap text
    • Page break
    • Show last page
    "},{"location":"ui-textbox/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-textbox/#install-plugin","title":"Install plugin","text":""},{"location":"ui-textbox/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add text-box object
      var textBox = scene.rexUI.add.textBox(config);\n
    "},{"location":"ui-textbox/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add text-box object
      var textBox = scene.rexUI.add.textBox(config);\n
    "},{"location":"ui-textbox/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TextBox } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add text-box object
      var textBox = new TextBox(scene, config);\nscene.add.existing(textBox);\n
    "},{"location":"ui-textbox/#add-textbox-object","title":"Add textbox object","text":"
    var textBox = scene.rexUI.add.textBox({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\nrtl: false,\n\ntypingMode: 0,\n\nbackground: backgroundGameObject,\n\ninnerBackground: backgroundGameObject,\n\ntitle: titleGameObject,\n\nseparator: separatorGameObject,\n\nicon: iconGameObject,\niconMask: false,\n\ntext: textGameObject,\nexpandTextWidth: false,\nexpandTextHeight: false,\n\naction: actionGameObject,\nactionMask: false,\n\nalign: {\ntitle: 'left',\ntext: 'left',\nicon: 'center',\naction: 'center'\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ninnerLeft: 0, innerRight: 0, innerTop: 0, innerBottom: 0,\n\ntitle: 0, titleLeft: 0, titleRight: 0,\nicon: 0, iconTop: 0, iconBottom: 0,\ntext: 0, textLeft: 0, textRight: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// page: { \n//    maxLines: undefined,\n//    pageBreak: '\\f\\n',\n// },\n// typing: { \n//    wrap: false,\n//    speed: 333,    \n// },\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • layoutMode :
      • 0 : title, separator, and text will be layout vertically, then layout with icon, action horizontally.
      • 1 : icon, text, and action will be layout horizontally, then layout with title, separator vertically. Default behavior.
    • rtl :
      • false : Layout children (icon, text, action) from left to right. Default behavior.
      • true : Layout children (icon, text, action) from right to left.
    • typingMode :
      • 0, 'page' : Typing content page by page. Default behavior.
      • 1, 'line' : Typing content line by line until finished.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • innerBackground : Game object of background inside innerSizer, optional.
      • In mode 0, innerSizer contains title, separator, and text.
      • In mode 1, innerSizer contains icon, text, and action.
    • title : Game object of title, optional.
    • separator : Game object of separator, optional.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
    • text : Text object, bbcode text object, tag text object, or bitmap text object, required.
      • Max lines and wrapped width
        • Built-in text object : maxLines and wrap width (wordWrap.width).
        • BBcode text object : maxLines and wrap width (wrap.width).
        • Tag text object : maxLines and wrap width (wrap.width).
        • Bitmap text object : Set maxLines at page.maxLines in configuration of page behavior, and wrap width at text.setMaxWidth(width).
      • Fixed width and fixed height
        • Built-in text object : fixedWidth and fixedHeight, set to 0 to disable this feature.
        • BBcode text object : fixedWidth and fixedHeight, set to 0 to disable this feature.
        • Tag text object : fixedWidth and fixedHeight, set to 0 to disable this feature.
    • expandTextWidth :
      • true : Expand fixedWidth and wrapWidth when layout, to change width of text game object to fit this textbox.
    • expandTextHeight :
      • true : Expand fixedHeight when layout, to change height of text game object to fit this textbox.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
    • align : Alignment of title, text, icon, action game objects.
      • align.title, align.text : 'left', 'center', or 'right'. Default vale is 'left'.
      • align.icon, align.action : 'top', 'center', or 'bottom'. Default vale is 'center'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.innerLeft, space.innerRight, space.innerTop, space.innerBottom : Space parameter of inner sizer.
      • space.title : Space between title game object and separator game object.
      • space.titleLeft, space.titleRight : Space at left or right side of title game object.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom : Space around icon game object.
      • space.text : Space between text game object and action icon game object.
      • space.textLeft, space.textRight : Space at left or right side of text game object.
      • space.actionTop, space.actionBottom : Space around action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • page : Configuration of page behavior
      • page.maxLines : Max lines of a page. If not given in text game object.
      • page.pageBreak : Symbol of page-break. Default value is '\\f\\n'.
    • typing : Configuration of type behavior
      • typing.wrap :
        • false : Don't insert \\n, default behavior.
        • true : Insert \\n to wrap content according to style of text, to prevent typing jittering.
      • typing.speed : Typing speed in ms, default value is 333.
    "},{"location":"ui-textbox/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTextBox extends RexPlugins.UI.TextBox {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var textBox = new MyTextBox(scene, config);\n
    "},{"location":"ui-textbox/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    textBox.layout();\n

    See also - dirty

    "},{"location":"ui-textbox/#typing","title":"Typing","text":"
    • Start typing
      textBox.start(content, typingSpeed);\n
      • content : Content string.
      • speed : Typing speed in ms.
        • undefined : Use previous typing speed.
    • Append and continue typing
      textBox.more(content, typingSpeed);\n
      • content : Content string.
      • speed : Typing speed in ms.
        • undefined : Use previous typing speed.
    • Stop typing
      textBox.stop();\n
      • Will fire 'stop' event.
    • Stop typing and show all text
      textBox.stop(true);\n
      • Will fire 'stop', 'type', 'pageend' event.
    • Stop typing and show all text at last page
      textBox.showLastPage();\n
      • Will fire 'type', 'pageend', 'complete' events.
    • Pause typing
      textBox.pause();\n
      • Will fire 'pause' event.
    • Resume typing
      textBox.resume();\n
      • Will fire 'resume' event.
    • Is typing
      var isTyping = textBox.isTyping;\n
    "},{"location":"ui-textbox/#typing-speed","title":"Typing speed","text":"
    • Change typing speed
      textBox.setTypingSpeed(speed);\n
      • speed : Typing speed in ms.
    • Get typing speed
      var speed = textBox.typingSpeed;\n
    "},{"location":"ui-textbox/#page","title":"Page","text":"
    • Type next page
      textBox.typeNextPage();\n
    • Is page end, after typing complete
      var isPageEnd = textBox.isPageEnd;\n
    • Is last page
      var isLastPage = textBox.isLastPage;\n
    • Is first page
      var isFirstPage = textBox.isFirstPage;\n
    • Current page index
      var pageIndex = textBox.pageIndex;\n
    • Number of pages
      var pageIndex = textBox.pageCount;\n
    "},{"location":"ui-textbox/#icon-texture","title":"Icon texture","text":"
    • Set texture
      textBox.setTexture(key);\n// label.setTexture(key, frame);\n
    • Get texture key, frame name
      var textureKey = textBox.texture.key;\nvar frameName = textBox.frame.name;\n
    "},{"location":"ui-textbox/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = textBox.getElement('background');\n
      • InnerSizer
        var innerSizer = textBox.getElement('innerSizer');\n
        • In mode 0, innerSizer contains title, separator, and text.
        • In mode 1, innerSizer contains icon, text, and action.
      • Background game object inside innerSizer
        var innerBackground = textBox.getElement('innerBackground');\n
      • Title game object
        var textObject = textBox.getElement('title');\n
      • Separator game object
        var textObject = textBox.getElement('separator');\n
      • Icon game object
        var icon = textBox.getElement('icon');\n
      • Text game object
        var textObject = textBox.getElement('text');\n
      • Action icon game object
        var action = textBox.getElement('action');\n
    • Get by name
      var gameObject = textBox.getElement('#' + name);\n// var gameObject = textBox.getElement('#' + name, recursive);\n
      or
      var gameObject = textBox.getByName(name);\n// var gameObject = textBox.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-textbox/#events","title":"Events","text":"
    • On typing start.
      textBox.on('start', function() {\n// ...\n}, scope);\n
    • On changing content of text game object, will also re-layout textbox :
      textBox.on('type', function() {\n// ...\n}, scope);\n
    • On typing a character :
      textBox.on('typechar', function(char) {\n// ...\n}, scope);\n
    • On Typing the last character of current page.
      textBox.on('pageend', function() {\nif (textBox.isLastPage) {\n// ...            \n}\n}, scope);\n
    • On typing all pages complete, equal to 'pageend' event with textBox.isLastPage.
      textBox.on('complete', function() {\n// ...\n}, scope);\n
    • On typing paused by textBox.pause().
      textBox.on('pause', function() {\n// ...\n}, scope);\n
    • On typing resume by textBox.resume().
      textBox.on('resume', function() {\n// ...\n}, scope);\n
    • On typing stop by textBox.stop().
      textBox.on('stop', function() {\n// ...\n}, scope);\n
    "},{"location":"ui-textbox/#other-properties","title":"Other properties","text":"

    See title label, sizer object, base sizer object, container-lite.

    "},{"location":"ui-titlelabel/","title":"Title label","text":""},{"location":"ui-titlelabel/#introduction","title":"Introduction","text":"

    A container with title, text in two rows, and an icon, background.

    • Author: Rex
    • Game object
    "},{"location":"ui-titlelabel/#live-demos","title":"Live demos","text":"
    • Title-label
    • Layout modes
    "},{"location":"ui-titlelabel/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-titlelabel/#install-plugin","title":"Install plugin","text":""},{"location":"ui-titlelabel/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add label object
      var label = scene.rexUI.add.titleLabel(config);\n
    "},{"location":"ui-titlelabel/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add label object
      var label = scene.rexUI.add.titleLabel(config);\n
    "},{"location":"ui-titlelabel/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { TitleLabel } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add label object
      var label = new TitleLabel(scene, config);\nscene.add.existing(label);\n
    "},{"location":"ui-titlelabel/#add-label-object","title":"Add label object","text":"
    var label = scene.rexUI.add.titleLabel({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\nlayoutMode: 0,\n\n// rtl: false,\n\nbackground: backgroundGameObject,\n\ninnerBackground: backgroundGameObject,\n\ntitle: titleGameObject,\n// wrapTitle: false,\n// adjustTitleFontSize: false,\n// expandTitleWidth: false,\n// expandTitleHeight: false,\n\nseparator: separatorGameObject,\n\nicon: iconGameObject,\niconMask: false,\n\ntext: textGameObject,\n// wrapText: false,\n// adjustTextFontSize: false,\n// expandTextWidth: false,\n// expandTextHeight: false,\n\naction: actionGameObject,\nactionMask: false,\n\nalign: {\ntitle: 'left',\ntext: 'left',\nicon: 'center',\naction: 'center'\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ninnerLeft: 0, innerRight: 0, innerTop: 0, innerBottom: 0,\n\ntitle: 0, titleLeft: 0, titleRight: 0,\nicon: 0, iconTop: 0, iconBottom: 0,\ntext: 0, textLeft: 0, textRight: 0,\nseparator: 0, separatorLeft: 0, separatorRight: 0,\nactionTop: 0, actionBottom: 0,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • layoutMode :
      • 0 : title, separator, and text will be layout vertically, then layout with icon, action horizontally.
      • 1 : icon, text, and action will be layout horizontally, then layout with title, separator vertically.
    • rtl :
      • false : Layout children (icon, text, action) from left to right. Default behavior.
      • true : Layout children (icon, text, action) from right to left.
    • background : Game object of background, optional. This background game object will be resized to fit the size of label.
    • innerBackground : Game object of background inside innerSizer, optional.
      • In mode 0, innerSizer contains title, separator, and text.
      • In mode 1, innerSizer contains icon, text, and action.
    • title : Game object of title, optional.
    • wrapTitle : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
      • 2, 'char' : Character WrapExpandText.
    • adjustTitleFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapTitle: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.
    • expandTitleWidth :
      • false : Keep width of title to original size. Default behavior.
      • true : Expand width of title object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
        • Can't work with squareFitIcon: true.
    • expandTitleHeight : Set true to expand height of title object.
    • separator : Game object of separator, optional.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • text : Game object of text.
    • wrapText : Enable WrapExpandText feature.
      • false, 0 : No WrapExpandText feature. Default behavior.
      • true, 1, 'word' : Word WrapExpandText.
      • 2, 'char' : Character WrapExpandText.
    • adjustTextFontSize : Enable FontSizeExpandText feature.
      • false : No FontSizeExpandText feature. Default behavior.
      • true : Enable FontSizeExpandText feature. Can't work with wrapText: true.
        • Text-width and text-height will be expanding.
        • Use BBCodeText (scene.rexUI.add.BBCodeText) with {valign: 'center'} style.- expandTextWidth :
      • false : Keep width of text to original size. Default behavior.
      • true : Expand width of text object. Will set display width by default.
        • Must set to true if using scene.rexUI.wrapExpandText method with any text game object.
        • Can't work with squareFitIcon: true.
    • expandTextHeight : Set true to expand height of text object.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
      • Phaser 3 engine does not support nested mask, uses circle mask image instead.
    • align : Alignment of title, text, icon, action game objects.
      • align.title, align.text : 'left', 'center', or 'right'. Default vale is 'left'.
      • align.icon, align.action : 'top', 'center', or 'bottom'. Default vale is 'center'.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.innerLeft, space.innerRight, space.innerTop, space.innerBottom : Space parameter of inner sizer.
      • space.title : Space between title game object and separator game object.
      • space.titleLeft, space.titleRight : Space at left or right side of title game object.
      • space.icon : Space between icon game object and text game object.
      • space.iconTop, space.iconBottom : Space around icon game object.
      • space.text : Space between text game object and action icon game object.
      • space.textLeft, space.textRight : Space at left or right side of text game object.
      • space.actionTop, space.actionBottom : Space around action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-titlelabel/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTitleLabel extends RexPlugins.UI.TitleLabel {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var label = new MyTitleLabel(scene, config);\n
    "},{"location":"ui-titlelabel/#layout-modes","title":"Layout modes","text":""},{"location":"ui-titlelabel/#mode-0","title":"Mode 0","text":"

    title, separator, and text will be layout vertically inside innerSizer, then layout with icon, action horizontally.

    Icon Title Action Separator Text"},{"location":"ui-titlelabel/#mode-1","title":"Mode 1","text":"

    icon, text, and action will be layout horizontally inside innerSizer, then layout with title, separator vertically.

    Title Separator Icon Text Action"},{"location":"ui-titlelabel/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    label.layout();\n

    See also - dirty

    "},{"location":"ui-titlelabel/#get-element","title":"Get element","text":"
    • Get element
      • Background game object
        var background = label.getElement('background');\n
      • InnerSizer
        var innerSizer = label.getElement('innerSizer');\n
        • In mode 0, innerSizer contains title, separator, and text.
        • In mode 1, innerSizer contains icon, text, and action.
      • Background game object inside innerSizer
        var innerBackground = label.getElement('innerBackground');\n
      • Title game object
        var textObject = label.getElement('title');\n
      • Separator game object
        var textObject = label.getElement('separator');\n
      • Icon game object
        var icon = label.getElement('icon');\n
      • Text game object
        var textObject = label.getElement('text');\n
      • Action icon game object
        var action = label.getElement('action');\n
    • Get by name
      var gameObject = label.getElement('#' + name);\n// var gameObject = label.getElement('#' + name, recursive);\n
      or
      var gameObject = label.getByName(name);\n// var gameObject = label.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-titlelabel/#title","title":"Title","text":"
    • Get title string
      var s = label.title;\n
    • Set title string
      label.setTitle(s);\n
      or
      label.title = s;\n
    "},{"location":"ui-titlelabel/#text","title":"Text","text":"
    • Get text string
      var s = label.text;\n
    • Set text string
      label.setText(s);\n
      or
      label.text = s;\n
    "},{"location":"ui-titlelabel/#icon-texture","title":"Icon texture","text":"
    • Set texture
      label.setTexture(key);\n// label.setTexture(key, frame);\n
    • Set texture via texture object
      label.setTexture(texture);\n// label.setTexture(texture, frame);\n
    • Get texture, frame.
      var texture = label.texture;\nvar frame = label.frame;\n
    • Get texture key, frame name.
      var textureKey = label.texture.key;\nvar frameName = label.frame.name;\n
    "},{"location":"ui-titlelabel/#reset-display-content","title":"Reset display content","text":"
    label.resetDisplayContent({\ntitle: '',\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n})\n

    or

    label.resetDisplayContent(text);\n
    • title : Set title's text string.
    • text : Set text string.
    • icon, iconFrame
      • A string : Set texture of icon game object.
      • undefined, or null : Hide icon game object.
      • true : Show icon game object without change its texture.
    • iconSize : Set display size of icon game object.
    • action, actionFrame
      • A string : Set texture of icon game object.
      • undefined, or null : Hide action game object.
      • true : Show action game object without change its texture.
    • actionSize : Set display size of action game object.

    Run label.layout() after this method, to layout children again.

    "},{"location":"ui-titlelabel/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-toast/","title":"Toast","text":""},{"location":"ui-toast/#introduction","title":"Introduction","text":"

    Show text message for a short while.

    • Author: Rex
    • Game object
    "},{"location":"ui-toast/#live-demos","title":"Live demos","text":"
    • Toast
    • Depth
      • Set depth
      • Bring to top
      • Add to layer
    "},{"location":"ui-toast/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-toast/#install-plugin","title":"Install plugin","text":""},{"location":"ui-toast/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add toast object
      var toast = scene.rexUI.add.toast(config);\n
    "},{"location":"ui-toast/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add toast object
      var toast = scene.rexUI.add.toast(config);\n
    "},{"location":"ui-toast/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Toast } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add toast object
      var toast = new Toast(scene, config);\nscene.add.existing(toast);\n
    "},{"location":"ui-toast/#add-toast-object","title":"Add toast object","text":"
    var toast = scene.rexUI.add.toast({\nx: 0,\ny: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n\nbackground: backgroundGameObject,\nicon: iconGameObject,\niconMask: false,\ntext: textGameObject,\naction: actionGameObject,\nactionMask: false,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nicon: 0,\ntext: 0,\n},\n\nduration: {\nin: 200,\nhold: 1200,\nout: 200,\n},\n\n// transitIn: 0,\n// transitOut: 0,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • background : Game object of background, optional. This background game object will be resized to fit the size of toast.
    • icon : Game object of icon, optional.
    • iconMask : Set true to add a circle mask on icon game object.
    • text : Game object of text.
    • action : Game object of action icon, optional.
    • actionMask : Set true to add a circle mask on action icon game object.
    • space : Pads spaces
      • space.left, space.right, space.top, space.bottom : Space of bounds
      • space.icon : Space between icon game object and text game object.
      • space.text : Space between text game object and action icon game object.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • duration : Duration of displaying message
      • duration.in : Duration of transit-in stage.
      • duration.hold : Duration of hold stage.
      • duration.out : Duration of transit-out stage.
    • transitIn : Transit-in action.
      • 0, or 'popUp' : Pop-up.
      • 1, or 'fadeIn' : Fade-in.
      • A callback : Custom transit-in function
        function(toast, duration) {\n// ...\n}\n
      • false, null : No transitIn.
    • transitOut : Transit-out action.
      • 0, or 'scaleDown' : Scale-down.
      • 1, or 'fadeOut' : Fade-out.
      • A callback : Custom transit-out function
        function(toast, duration) {\n// ...\n}\n
      • false, null : No transitOut.

    Toast object will be invisible at beginning.

    "},{"location":"ui-toast/#custom-class","title":"Custom class","text":"
    • Define class
      class MyToast extends RexPlugins.UI.Toast {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var toast = new MyToast(scene, config);\n
    "},{"location":"ui-toast/#show-message","title":"Show message","text":"
    toast.showMessage(message);\n
    • message : A string, or a callback.
      • A string. Apply this content to text game object.
      • Callback. Invoke this callback to configurate toast object.
        function(toast) {\n// var icon = toast.getElement('icon');\n// var text = toast.getElement('text');\n// var action = toast.getElement('action');\n}\n

    Toast displays message follows these steps : transit-in, hold, transit-out. New message will be pending until toast is back to idle.

    "},{"location":"ui-toast/#clear-messages","title":"Clear messages","text":"
    toast.removeAllMessages();\n
    "},{"location":"ui-toast/#is-showing-message","title":"Is showing message","text":"
    var isShowing = toast.isShowingMessage;\n
    "},{"location":"ui-toast/#display-time","title":"Display time","text":"
    • Transit-in time (duration.in)
      • Get
        var time = toast.transitInTime;\n
      • Set
        toast.setTransitInTime(time);\n
    • Display time (duration.hold)
      • Get
        var time = toast.displayTime;\n
      • Set
        toast.setDisplayTime(time);\n
    • Transit-out time (duration.out)
      • Get
        var time = toast.transitOutTime;\n
      • Set
        toast.setTransitOutTime(time);\n
    "},{"location":"ui-toast/#transit-action","title":"Transit action","text":"
    • Set transit-in action
      toast.setTransitInCallback(callback);\n
      • callback : Transit-in action
        • 0, or 'popUp' : Pop-up.
        • 1, or 'fadeIn' : Fade-in.
        • A callback : Custom transit-in function
          function(toast, duration) {\n// ...\n}\n
    • Set transit-out action
      toast.setTransitOutCallback(callback);\n
      • callback : Transit-out action
        • 0, or 'scaleDown' : Scale-down.
        • 1, or 'fadeOut' : Fade-out.
        • A callback : Custom transit-out function
          function(toast, duration) {\n// ...\n}\n
    "},{"location":"ui-toast/#event","title":"Event","text":"
    • Transit-in
      toast.on('transitin', function(toast, transitInTime) {\n// ...\n})\n
    • Transit-out
      toast.on('transitout', function(toast, transitOutTime) {\n// ...\n})\n
    "},{"location":"ui-toast/#other-properties","title":"Other properties","text":"

    See label object, sizer object, base sizer object, container-lite.

    "},{"location":"ui-toastqueue/","title":"Toast queue","text":""},{"location":"ui-toastqueue/#introduction","title":"Introduction","text":"

    Queue messages for a short while.

    • Author: Rex
    • Game object
    "},{"location":"ui-toastqueue/#live-demos","title":"Live demos","text":"
    • Toast queue
    "},{"location":"ui-toastqueue/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-toastqueue/#install-plugin","title":"Install plugin","text":""},{"location":"ui-toastqueue/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add toast-queue object
      var toastQueue = scene.rexUI.add.toastQueue(config);\n
    "},{"location":"ui-toastqueue/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add toast-queue object
      var toastQueue = scene.rexUI.add.toastQueue(config);\n
    "},{"location":"ui-toastqueue/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { ToastQueue } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add toast-queue object
      var toastQueue = new ToastQueue(scene, config);\nscene.add.existing(toastQueue);\n
    "},{"location":"ui-toastqueue/#add-toast-queue-object","title":"Add toast-queue object","text":"
    var toastQueue = scene.rexUI.add.toastQueue({\nx: 0,\ny: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 1,\n\nspace: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n\nitem: 0,\n},\n\ncreateMessageLabelCallback(scene, message, toastQueue) {\n// return gameObject;\n},\n\nqueueDirection: 1, // 'bottom-to-top', or 'top-to-bottom'\n\nduration: {\nin: 200,\nhold: 2000,\nout: 200,\n},\n\n// transitIn: undefined,\n// transitOut: undefined,\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between 2 children game objects.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    • createMessageLabelCallback : Callback for creating message label game object
      function(scene, message, toastQueue) {\n// \nreturn gameObject;\n}\n
      • message : message parameter passing from showMessage method.
      • toastQueue : This toast-queue game object.
    • queueDirection : Direction of message queue
      • 1, or 'bottom-to-top' : Message queue from bottom to top. Default value.
      • 0, or 'top-to-bottom' : Message queue from top to bottom.
    • duration : Duration of displaying message
      • duration.in : Duration of transit-in stage.
      • duration.hold : Duration of hold stage.
      • duration.out : Duration of transit-out stage.
    • transitIn : Transit-in action.
      • undefined (not gived) : Pop up message label.
      • A callback : Custom transit-in function
        function(messageLabel, duration, toastQueue) {\n// ...\n}\n
      • false, null : No transitOut.
    • transitOut : Transit-out action.
      • undefined (not gived) : Fade out message label.
      • A callback : Custom transit-out function
        function(messageLabel, duration, toastQueue) {\n// ...\n}\n
      • false, null : No transitOut.

    Message Label will be destroyed when

    • Clicking, or
    • Timeout
    "},{"location":"ui-toastqueue/#custom-class","title":"Custom class","text":"
    • Define class
      class MyToastQueue extends RexPlugins.UI.ToastQueue {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var toastQueue = new MyToastQueue(scene, config);\n
    "},{"location":"ui-toastqueue/#show-message","title":"Show message","text":"
    toastQueue.showMessage(message);\n
    • message : A string, or an object. Will pass to createMessageLabelCallback callback.
    "},{"location":"ui-toastqueue/#clear-messages","title":"Clear messages","text":"
    toastQueuetoast.removeAllMessages();\n

    Invoke transition-out of all message labels.

    "},{"location":"ui-toastqueue/#display-time","title":"Display time","text":"
    • Transit-in time (duration.in)
      • Get
        var time = toastQueue.transitInTime;\n
      • Set
        toastQueue.setTransitInTime(time);\n
    • Display time (duration.hold)
      • Get
        var time = toastQueue.displayTime;\n
      • Set
        toastQueue.setDisplayTime(time);\n
    • Transit-out time (duration.out)
      • Get
        var time = toastQueue.transitOutTime;\n
      • Set
        toastQueue.setTransitOutTime(time);\n
    "},{"location":"ui-toastqueue/#transit-action","title":"Transit action","text":"
    • Set transit-in action
      toastQueue.setTransitInCallback(callback);\n
      • callback : Transit-in action
        function(messageLabel, duration, toastQueue) {\n// ...\n}\n
    • Set transit-out action
      toastQueue.setTransitOutCallback(callback);\n
      • callback : Transit-out action
        function(messageLabel, duration, toastQueue) {\n// ...\n}\n
    "},{"location":"ui-toastqueue/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"ui-trees/","title":"Trees","text":""},{"location":"ui-trees/#introduction","title":"Introduction","text":"

    A container with trees and leaf-nodes.

    • Author: Rex
    • Game object
    "},{"location":"ui-trees/#live-demos","title":"Live demos","text":"
    • Tree
    • Display json
    "},{"location":"ui-trees/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-trees/#install-plugin","title":"Install plugin","text":""},{"location":"ui-trees/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add trees object
      var trees = scene.rexUI.add.trees(config);\n
    "},{"location":"ui-trees/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add trees object
      var trees = scene.rexUI.add.trees(config);\n
    "},{"location":"ui-trees/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Trees } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add trees object
      var trees = new Trees(scene, config);\nscene.add.existing(trees);\n
    "},{"location":"ui-trees/#add-instance","title":"Add instance","text":"

    Trees contains tree-node instance, each tree contains tree instance and node instance.

    "},{"location":"ui-trees/#add-trees-object","title":"Add trees object","text":"
    var trees = scene.rexUI.add.trees({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n\norientation: 0,\n// rtl: false,\n\n// space: { left: 0, right:0, top:0, bottom:0, item:0 },\n\ntree: {\n// background: function(scene {isLeaf}) { return gameObject; },\n// background: backgroundStyle,\n\n// toggleButton: function(scene, {isLeaf}) {\n//     gameObject\n//         .on('expand.start', function (gameObject) {\n//          })\n//          .on('collapse.start', function (gameObject) {\n//          })\n//     return gameObject;\n// }\n// toggleButton : triangleStyle,\n\n// nodeBackground: function(scene {isLeaf}) { return gameObject; },\n// nodeBackground: backgroundStyle,\n\n// nodeBody: function(scene {isLeaf}) { return gameObject; },\n// nodeBody: simpleLabelStyle,\n\n// transition: {\n//     duration: 200,\n//     expandCallback: undefined,\n//     collapseCallback: undefined,\n// },\n\n// orientation: 'y',\n\n//space: {\n//    indent: 0,\n//    indentLeft: 0, indentRight: 0, indentTop: 0, indentBottom: 0,\n//\n//    nodeLeft: 0, nodeRight: 0, nodeTop: 0, nodeBottom: 0,\n//    toggleButton: 0,\n//},\n\n// align: {\n//     title: 'left',\n//     child: 'left',\n// },\n\n// expand: {\n//     title: true,\n//     child: true,\n// },\n\n// expanded: true,\n},\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this trees. Default value is (0.5, 0.5).
    • orientation :
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Put icon at left side, and text at right side.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Put icon at top side, and text at bottom side.
    • rtl :
      • true : Layout children from right to left.
      • false : Layout children from left to right. Default behavior.
    • space : Pads spaces.
      • space.left, space.right, space.top, space.bottom : Space of bounds.
      • space.item : Space between 2 children game objects.
    • tree : Default configuration of node, optional.
      • tree.background :
        • Callback
          function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
          • isLeaf :
            • false : This node is a tree-node.
            • true : This node is a leaf-node.
        • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
        • undefined : Don't create any game object.
      • tree.toggleButton
        • Callback
          function(scene, {isLeaf}) {\ngameObject\n.on('expand.start', function (gameObject) {\n})\n.on('collapse.start', function (gameObject) {\n})\nreturn gameObject;\n}\n
          • isLeaf :
            • false : This node is a tree-node.
            • true : This node is a leaf-node.
          • Events 'expand.start' and 'collapse.start' will be fired when expanding or collapsing child nodes of this tree.
        • Style of triangle, default behavior.
          {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n
      • tree.nodeBackground
        • Callback
          function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
          • isLeaf :
            • false : This node is a tree-node.
            • true : This node is a leaf-node.
        • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
        • undefined : Don't create any game object.
      • tree.nodeBody
        • Callback
          function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
          • isLeaf :
            • false : This node is a tree-node.
            • true : This node is a leaf-node.
        • Style of simple label : Create Simple-label as node body element. Default behavior.
      • tree.transition : Configuration of expanding/collapsing transition.
        • tree.transition.duration : Duration of expanding/collapsing transition.
        • tree.transition.expandCallback : Callback invoked when expading child. Default behavior is scale-up.
        • tree.transition.collapseCallback : Callback invoked when collapsing child. Default behavior is scale-down.
      • tree.space : Pads spaces of tree.
        • tree.space.indent, tree.space.indentLeft, tree.space.indentRight, tree.space.indentTop, tree.space.indentBottom : Space of node's bounds.
        • tree.space.nodeLeft, tree.space.nodeRight, tree.space.nodeTop, tree.space.nodeBottom : Space of node child's bounds.
        • tree.space.toggleButton : Space between toggle button and next child.
      • tree.align.title, tree.align.child : Alignment of title, child game objects.
        • undefined, or 'left', or 'top' : Align game objects at left, or top. Default behavior.
        • 'center' : Align game objects at center.
        • 'right', or 'bottom' : Align game objects at right, or bottom.
      • tree.expand.title, tree.expand.child : Expand width/height of title, child game objects.
        • true : Expand width/heigh. Default behavior.
        • false : Use origin width/height.
      • tree.expanded :
        • true : Expand this tree node. Default behavior.
        • false : Collapse this tree node.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire trees events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-trees/#add-tree-object","title":"Add tree object","text":"

    var tree = trees.addTree();\n// var tree = trees.addTree(nodeKey);\n
    var subTree = tree.addTree();\n// var subTree = tree.addTree(nodeKey);\n

    or

    var tree = trees.addTree({\n// nodeKey: UUID()\n\n// background: backgroundGameObject,\n// background: function(scene {isLeaf}) { return gameObject; },\n// background: backgroundStyle,\n\ntoggleButton: toggleButtonGameObject,\n// toggleButton: function(scene {isLeaf}) { \n//      gameObject\n//          .on('expand.start', function (gameObject) {\n//           })\n//           .on('collapse.start', function (gameObject) {\n//           })\n//     return gameObject; \n// },\n// toggleButton : triangleStyle,\n\n// nodeBackground: nodeBackgroundGameObject,\n// nodeBackground: function(scene {isLeaf}) { return gameObject; },\n// nodeBackground: backgroundStyle,\n\nnodeBody: nodeBodyGameObject,\n// nodeBody: function(scene {isLeaf}) { return gameObject; },\n// nodeBody: simpleLabelStyle,\n\n// transition: {\n//     duration: 200,\n//     expandCallback: undefined,\n//     collapseCallback: undefined,\n// },\n\n// orientation: 'y',\n\n// space: {\n//     indent: 0,\n//     indentLeft: 0, indentRight: 0, indentTop: 0, indentBottom: 0,\n// \n//     nodeLeft: 0, nodeRight: 0, nodeTop: 0, nodeBottom: 0,\n//     toggleButton: 0,\n// },\n\n// align: {\n//     title: 'left',\n//     child: 'left',\n// },\n\n// expand: {\n//     title: true,\n//     child: true,\n// },\n\n// expanded: true,\n})\n
    var subTree = tree.addTree(config);\n

    • nodeKey : Store reference of this tree instance by this unique string. Get tree back by trees.getTree(nodeKey)
      • An unique string, does not contain .
      • undefined : Create unique string by UUID
    • background :
      • A game object
      • Callback
        function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
        • isLeaf :
          • false : This node is a tree-node.
          • true : This node is a leaf-node.
      • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
      • undefined : Don't create any game object.
    • toggleButton
      • A game object
      • Callback
        function(scene, {isLeaf}) {\ngameObject\n.on('expand.start', function (gameObject) {\n})\n.on('collapse.start', function (gameObject) {\n})\nreturn gameObject;\n}\n
        • isLeaf :
          • false : This node is a tree-node.
          • true : This node is a leaf-node.
        • Events 'expand.start' and 'collapse.start' will be fired when expanding or collapsing child nodes of this tree.
      • Style of triangle, default behavior.
        {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n
    • nodeBackground
      • A game object
      • Callback
        function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
        • isLeaf :
          • false : This node is a tree-node.
          • true : This node is a leaf-node.
      • Style of Background : Create Round-rectangle, Bar-rectangle, Nine-slice, or Image as background element.
      • undefined : Don't create any game object.
    • nodeBody
      • A game object
      • Callback
        function(scene, {isLeaf}) {\nreturn gameObject;\n}\n
        • isLeaf :
          • false : This node is a tree-node.
          • true : This node is a leaf-node.
      • Style of simple label : Create Simple-label as node body element. Default behavior.
    "},{"location":"ui-trees/#add-node-object","title":"Add node object","text":"
    • Add default node game object
      var node = tree.addNode();\n// var node = tree.addNode(nodeKey);\n
      • nodeKey : Store reference of this tree instance by this unique string. Get tree back by trees.getTree(nodeKey)
        • An unique string, does not contain .
        • undefined : Create unique string by UUID
    • Add custom node game object
      var node = tree.addNode(gameObject);\n// var node = tree.addNode(gameObject, nodeKey);\n
    "},{"location":"ui-trees/#insert-tree-object","title":"Insert tree object","text":"

    var tree = trees.insertTree(index);\n// var tree = trees.insertTree(index, nodeKey);\n// var tree = trees.insertTree(index, config);\n
    var subTree = tree.insertTree(index);\n// var subTree = tree.insertTree(index, nodeKey);\n// var subTree = tree.insertTree(index, config);\n

    "},{"location":"ui-trees/#insert-node-object","title":"Insert node object","text":"
    • Insert default node game object
      var node = tree.insertTree(index);\n// var node = tree.insertTree(index, nodeKey);\n
    • Insert custom node game object
      var node = tree.insertTree(index, gameObject);\n// var node = tree.insertTree(index, gameObject, nodeKey);\n
    "},{"location":"ui-trees/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTrees extends RexPlugins.UI.Trees {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var trees = new MyTrees(scene, config);\n
    "},{"location":"ui-trees/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    trees.layout();\n

    See also - dirty

    Note

    Layout topmost trees when expanding/collapsing start.

    "},{"location":"ui-trees/#expandcollapse-tree","title":"Expand/collapse tree","text":"
    • Expand, will re-layout from topmost trees
      tree.expand();\n// tree.expand(duration);\n
      tree.expand(0);  // Immediately, won't invoke expandCallback\n
    • Collapse, will re-layout from topmost trees
      tree.collapse();\n// tree.collapse(duration);\n
      tree.collapse(0);  // Immediately, won't invoke collapseCallback\n
    • Toggle, will re-layout from topmost trees
      tree.toggle();\n// tree.toggle(duration);\n
      tree.toggle(0);  // Immediately, won't invoke expandCallback/collapseCallback\n
    • Set expanded state without re-layouting
      tree.setExpandedState(expanded);  // true, or false\n
    • Get expanded state
      var expanded = tree.expanded;\n
      • expanded : Initial value is undefined
    "},{"location":"ui-trees/#remove-tree-or-node","title":"Remove tree or node","text":""},{"location":"ui-trees/#remove-tree","title":"Remove tree","text":"
    • Remove tree without destroying
      trees.removeTree(tree);\n
      tree.removeTree(subTree);\n
      tree.removeTree(nodeKey);\n
    • Remove tree and destroying
      trees.removeTree(tree, true);\n
      tree.removeTree(subTree, true);\n
      tree.removeTree(nodeKey, true);\n
    • Remove all trees without destroying
      trees.removeAllNodes();\n
      tree.removeAllNodes();\n
    • Remove all trees and destroying
      trees.removeAllNodes(tree);\n
      tree.removeAllNodes(tree);\n
    "},{"location":"ui-trees/#remove-subtree-or-node","title":"Remove subTree or node","text":"
    • Remove subTree or node without destroying
      tree.removeNode(subTree);\n
      tree.removeNode(node);\n
      tree.removeNode(nodeKey);\n
    • Remove subTree or node and destroying
      trees.removeNode(subTree, true);\n
      tree.removeNode(node, true);\n
      tree.removeNode(nodeKey, true);\n
    • Remove all sub-trees and nodes without destroying
      tree.removeAllNodes();\n
    • Remove all sub-trees and nodes and destroying
      tree.removeAllNodes(tree);\n
    "},{"location":"ui-trees/#get-sub-tree-or-node","title":"Get sub-tree or node","text":"
    • Get sub-tree
      var tree = trees.getTree(nodeKey);\n
      var tree = subTree.getTree(nodeKey);\n
    • Get sub-tree/node
      var tree = trees.getNode(nodeKeys);\n
      var tree = subTree.getNode(nodeKeys);\n
      • nodeKeys : nodeKeys connected by ., e.x. key0.key1.key2...
    • Get all child nodes in this tree
      var nodes = tree.getNodes();\n// var nodes = tree.getNodes(out);\n
    • Get all child nodes including all descendant nodes
      var nodes = tree.getAllNodes();\n// var nodes = tree.getAllNodes(out);\n
    "},{"location":"ui-trees/#get-parent-or-root-tree","title":"Get parent or root tree","text":"
    • Get parent (tree)
      var patent = tree.getTreePatent();\n
      var patent = node.getTreePatent();\n
    • Get root (tree)
      var root = tree.getTreeRoot();\n
      var root = node.getTreeRoot();\n
    "},{"location":"ui-trees/#get-element","title":"Get element","text":"
    • Get element in a tree
      • Background game object
        var background = tree.getElement('background');\n
      • Toggle button game object
        var toggleButton = trees.getElement('toggleButton');\n
      • Node-body game object
        var nodeBody = trees.getElement('nodeBody');\n
      • Children-node list game objects
        var childrenNodes = trees.getElement('childrenNodes');\n
    • Get by name
      var gameObject = trees.getElement('#' + name);\n// var gameObject = trees.getElement('#' + name, recursive);\n
      or
      var gameObject = trees.getByName(name);\n// var gameObject = trees.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-trees/#other-properties","title":"Other properties","text":"

    Trees is extended from trees object, base trees object, container-lite. Tree is extended from folder.

    "},{"location":"ui-trees/#set-children-interactive","title":"Set children interactive","text":"

    Applies click, tap, press, swipe behaviors on this trees, to detect input events of children.

    tree.setChildrenInteractive({\n// dropZone: false,\n\n// click: {mode: 'release', clickInterval: 100},\n\n// over: undefined,\n\n// press: {time: 251, threshold: 9},\n\n// tap: {time: 250, tapInterval: 200, threshold: 9, tapOffset: 10, \n//       taps: undefined, minTaps: undefined, maxTaps: undefined,},\n\n// swipe: {threshold: 10, velocityThreshold: 1000, dir: '8dir'},\n\n// inputEventPrefix: 'child.',\n})\n
    • dropZone :
      • true : Enable drop Zone on scrollable area.
      • false : Do nothing.
    "},{"location":"ui-trees/#events","title":"Events","text":"
    • Pointer-down
      trees.on('child.down', function(child, pointer, event) {        }, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Pointer-up
      trees.on('child.up', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Pointer-over
      trees.on('child.over', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Pointer-out
      trees.on('child.out', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Click
      trees.on('child.click', function(child, pointer, event) {\n// ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
      • pointer : Pointer object.
    • Press
      trees.on('child.pressstart', function(child, pointer, press) { // ...\n}, scope);\n
      trees.on('child.pressend', function(child, pointer, press) { // ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
    • Tap
      trees.on(tapEventName, function(child, pointer, tap) { // ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
      • tapEventName : 'child.tap', 'child.1tap', 'child.2tap', 'child.3tap', etc ...
      • tap : Tap object.
        • tap.tapsCount : Taps count.
    • Swipe
      trees.on(swipeEventName, function(child, pointer, swipe) { // ...\n}, scope);\n
      • child : Tree or leaf-node.
        • Pointer on tree's title : child.isTree
        • Pointer on leaf-node : child.isNode
      • swipeEventName : 'child.swipe', 'child.swipeleft', 'child.swiperight', 'child.swipeup', 'child.swipedown'.
      • swipe : Swipe object.
        • swipe.left, swipe.right, swipe.up, swipe.down : Swipe direction states.
    "},{"location":"ui-trees/#events_1","title":"Events","text":"
    • On tree expand-start
      trees.on('expand.start', function(tree){\n\n})\n
    • On tree expand-complete
      trees.on('expand.complete', function(tree){\n\n})\n
    • On tree collapse-start
      trees.on('collapse.start', function(tree){\n\n})\n
    • On tree collapse-complete
      trees.on('collapse.complete', function(tree){\n\n})\n
    "},{"location":"ui-tweaker/","title":"Tweaker","text":""},{"location":"ui-tweaker/#introduction","title":"Introduction","text":"

    Fine-tuning properties of target object. Reference

    • Author: Rex
    • Game object
    "},{"location":"ui-tweaker/#live-demos","title":"Live demos","text":"
    • Tweaker
    • Bind target
    • Horizontal tweaker
    • Columns
    • Wrap
    • Buttons
    • Add rows
    • Edit item
    "},{"location":"ui-tweaker/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ui-tweaker/#install-plugin","title":"Install plugin","text":""},{"location":"ui-tweaker/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.scenePlugin('rexuiplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuiplugin.min.js', 'rexUI', 'rexUI');\n
    • Add tweaker object
      var tweaker = scene.rexUI.add.tweaker(config);\n
    "},{"location":"ui-tweaker/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin.js';\nvar config = {\n// ...\nplugins: {\nscene: [{\nkey: 'rexUI',\nplugin: UIPlugin,\nmapping: 'rexUI'\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add tweaker object
      var tweaker = scene.rexUI.add.tweaker(config);\n
    "},{"location":"ui-tweaker/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import { Tweaker } from 'phaser3-rex-plugins/templates/ui/ui-components.js';\n
    • Add tweaker object
      var tweaker = new Tweaker(scene, config);\nscene.add.existing(tweaker);\n
    "},{"location":"ui-tweaker/#add-tweaker-object","title":"Add tweaker object","text":"
    var tweaker = scene.rexUI.add.tweaker({\n// x: 0,\n// y: 0,\n// anchor: undefined,\n// width: undefined,\n// height: undefined,\n// origin: 0.5\n// originX:\n// originY:\n// orientation: 0,\n\n// style: { ... }\nstyles : {\nitemWidth : 0,\nitemHeight: 0,\n\ninputRow: {\nbackground: {\n\n},\n\ntitle: {\n\n},\n\ninputText: {\n\n},\n\ninputTextArea: {\nheight:\n},\n\nlist: {\nlabel: {\n\n},\n\nbutton: {\n\n}\n},\n\nbutton: {\n\n},\n\nslider: {\ntrack: {\n\n},\n\nindicator: {\n\n},\n\nthumb: {\n\n}\n},\n\ncolorInput: {\ncolorPicker: {\n\n},\n\ncolorComponents: {\ninputText: {\n\n}\n}\n},\n\ncheckbox: {\n\n},\n\ntoggleSwitch: {\n\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n}\n},\n\nseparator: {\n\n},\n\nfolder: {\n},\n\ntab: {\n},\n\nscrollable: {\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0, item: 0\n},\n},\n\n\n// name: '',\n// draggable: false,\n// sizerEvents: false,\n// enableLayer: false,\n});\n
    • x, y : Position of this object, it is valid when this object is the top object.
    • anchor : See anchor.
      • left, right, centerX, x, top, bottom, centerY, y : Position based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
          • 'left'(=0%), 'center'(=50%), 'right'(=100%)
          • 'top'(=0%), 'center'(=50%), 'bottom'(=100%)
        • Offset : '+n', or '-n'.
      • width, height : Set size (invoke onResizeCallback) based on visible window, which composed of
        • Percentage of visible width/height : 'p%', p: 0 ~ 100.
        • Padding : '+n', or '-n'.
      • onResizeCallback : A default resize callback will be assigned interanlly.
    • width, height : Minimum width, minimum height.
    • origin, originX, originY : Set origin of this sizer. Default value is (0.5, 0.5).
    • orientation : Main orientation of the tweaker.
      • 'left-to-right', 'horizontal','h', 'x', or 0 : Arrange game objects from left ot right.
      • 'top-to-bottom', 'vertical','v', 'y', or 1 : Arrange game objects from top to bottom. Default value is 1.
    • styles, or style : Styles settings of input rows, separator, folder, tab, and scrollable. See Styles chapter for more detail.
      • style.itemWidth : Width of input row, used if orientation is set to 'y'(1).
      • styles.space : Pads spaces.
        • styles.space.left, styles.space.right, styles.space.top, styles.space.bottom : Space of bounds.
        • styles.space.item : Space between 2 input rows.
    • name : Set name of this game object.
    • draggable : Set true to drag top-most object.
    • sizerEvents : Set true to fire sizer events. Default value is false.
    • enableLayer :
      • false : Add child game objects into scene's display list. Default behavior.
      • true : Add child game objects into an internal layer game object. See also.
    "},{"location":"ui-tweaker/#custom-class","title":"Custom class","text":"
    • Define class
      class MyTweaker extends RexPlugins.UI.Tweaker {\nconstructor(scene, config) {\nsuper(scene, config);\n// ...\nscene.add.existing(this);\n}\n// ...\n}\n
    • Create instance
      var tweaker = new MyTweaker(scene, config);\n
    "},{"location":"ui-tweaker/#add-input-row","title":"Add input row","text":"

    An input row can fine-tuning properties of target object.

    "},{"location":"ui-tweaker/#text-input-row","title":"Text input row","text":"

    object[key] is a text value.

    tweaker.addInput(object, key, {    // view: 'string',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n\n// autoUpdate: true,\n// onValidate: undefined,\n// onValueChange: undefined,    \n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'string',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n\n// autoUpdate: true,\n// onValidate: undefined,\n// onValueChange: undefined,    \n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'string', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.
    • autoUpdate :
      • true : Update binding key when user input. Default behavior.
      • false : Use onValueChange to set value of binding key when user input.
    • onValidate :
      • Callback invoked when new value input.
        function(newValue, oldValue, bindingTarget, bindingKey) { return true;\n}\n
        • true : Accept this new value.
        • false : Reject this new value.
      • undefined : Always accept new value changing. Default behavior.
    • onValueChange :
      • Callback invoked when binding value changing.
        function(newValue, oldValue, bindingTarget, bindingKey) { }\n
      • undefined : Ignore this feature. Default value.

    See Style of text input

    "},{"location":"ui-tweaker/#text-area-input-row","title":"Text-Area input row","text":"

    object[key] is a text value.

    tweaker.addInput(object, key, {    view: 'textarea',\n\n// height: undefined,\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n\n// autoUpdate: true,\n// onValidate: undefined,\n// onValueChange: undefined,    \n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\nview: 'textarea',\n\n// height: undefined,\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n\n// autoUpdate: true,\n// onValidate: undefined,\n// onValueChange: undefined,    \n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : 'textarea'.
    • height : Height of this input row.
      • undefined : Use children height.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.
    • autoUpdate :
      • true : Update binding key when user input. Default behavior.
      • false : Use onValueChange to set value of binding key when user input.
    • onValidate :
      • Callback invoked when new value input.
        function(newValue, oldValue, bindingTarget, bindingKey) { return true;\n}\n
        • true : Accept this new value.
        • false : Reject this new value.
      • undefined : Always accept new value changing. Default behavior.
    • onValueChange :
      • Callback invoked when binding value changing.
        function(newValue, oldValue, bindingTarget, bindingKey) { }\n
      • undefined : Ignore this feature. Default value.

    See Style of text-area input

    "},{"location":"ui-tweaker/#text-input-from-list","title":"Text input from list","text":"

    object[key] is a text value.

    tweaker.addInput(object, key, {\n// view: 'list',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0, /* icon: , iconFrame, .. */ },\n{text: text1, value: value1, /* icon: , iconFrame, .. */ },\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'list',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0, /* icon: , iconFrame, .. */ },\n{text: text1, value: value1, /* icon: , iconFrame, .. */ },\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'list', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • options : Option list, each item contains
      • text : Display text.
      • value : Set key to this value.
      • icon, iconFrame, ... : See Reset display content of Label
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of list input

    "},{"location":"ui-tweaker/#text-input-from-buttons","title":"Text input from buttons","text":"

    object[key] is a text value.

    tweaker.addInput(object, key, {\nview: 'buttons',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\nview: 'buttons',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'buttons'.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • options : Option list, each item contains
      • text : Display text.
      • value : Set key to this value.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of buttons input

    "},{"location":"ui-tweaker/#number-input-row","title":"Number input row","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\n// view: 'number',\n// int: undefined,\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'number',\n// int: undefined,\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'number', if bindingTarget is not given.
    • int : Set to true to truncate float number to integer number.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of text input

    "},{"location":"ui-tweaker/#number-input-in-a-range","title":"Number input in a range","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\n// view: 'range',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\nmin: minValue, max: maxValue,\n// step: undefined,\n\n// format: function(value) { return s; },\n// inputTextReadOnly: false,\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'range',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\nmin: minValue, max: maxValue,\n// step: undefined,\n\n// format: function(value) { return s; },\n// inputTextReadOnly: false,\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'range', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • min, max : Minimum, maximun value of range.
    • step : Step/gap of slider, optional.
    • format : Callback to return formatted string for input text field.
      function(value) {\nreturn s;\n}\n
    • inputTextReadOnly :
      • false : Input text field is editable. Default behavior.
      • true : Input text field is read-only.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of range input

    "},{"location":"ui-tweaker/#number-input-in-inc-dec-buttons","title":"Number input in inc-dec buttons","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\nview: 'incdec',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// min: undefined, \n// max: undefined,\n// step: 1,\n\n// format: function(value) { return s; },\n// inputTextReadOnly: false,\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'incdec',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// min: undefined, \n// max: undefined,\n// step: 1,\n\n// format: function(value) { return s; },\n// inputTextReadOnly: false,\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'incdec', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • step : Incremental or decremental value when clicking inc-button, or dec-button
    • min, max : Minimum, maximun value of range, optional.
    • format : Callback to return formatted string for input text field.
      function(value) {\nreturn s;\n}\n
    • inputTextReadOnly :
      • false : Input text field is editable. Default behavior.
      • true : Input text field is read-only.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of incdec input

    "},{"location":"ui-tweaker/#number-input-from-list","title":"Number input from list","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\n// view: 'list',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'list',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'list', if bindingTarget is not given.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • options : Option list, each item contains
      • text : Display text.
      • value : Set key to this value.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of list input

    "},{"location":"ui-tweaker/#number-input-from-buttons","title":"Number input from buttons","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\nview: 'buttons',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\nview: 'buttons',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\noptions: [\n{text: text0, value: value0},\n{text: text1, value: value1},\n// ...\n],\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'buttons'.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • options : Option list, each item contains
      • text : Display text.
      • value : Set key to this value.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of buttons input

    "},{"location":"ui-tweaker/#color-input","title":"Color input","text":"

    object[key] is a number value.

    tweaker.addInput(object, key, {\nview: 'color',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\nview: 'color',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'color'.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of color input

    "},{"location":"ui-tweaker/#boolean-input-row","title":"Boolean input row","text":"

    object[key] is a boolean value.

    tweaker.addInput(object, key, {\n// view: 'boolean',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n

    or

    tweaker.addInput({\nbindingTarget: object,\nbindingKey: key,\n// view: 'boolean',\n// view: 'toggleSwitch',\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • bindingKey : Bind to target's property key. Necessary field
    • view : Set to 'boolean', or 'toggleSwitch', if bindingTarget is not given.
      • 'boolean' : Checkbox input. Default behavior.
      • 'toggleSwitch' : Toggle switch input.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of boolean input

    "},{"location":"ui-tweaker/#value-callbacks-row","title":"Value callbacks row","text":"
    tweaker.addInput({\nbindingTarget: object,\n\nonGetValue(bindingTarget) {\n\n},\n\nonSetValue(bindingTarget, value) {\n\n},\n\nview: ,\n\n// Other properties..\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\n// title: undefined,\n\n// orientation: 'x',\n\n// monitor: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target object.
      • Can bind target later via tweaker.setBindingTarget(object).
    • onGetValue : Callback to get dispaly value
      function(bindingTarget) {\nreturn value;\n}\n
    • onSetValue : Callback to set value to bindingTarget
      function(bindingTarget, value) {        }\n
    • view : Any kind of view listed before.
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label. Default value is equal to key.
    • monitor :
      • false : Don't update input text every tick from target. Default behavior.
      • true : Update input text from current object, in postupdate event of scene.
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    Note

    No bindingKey parameter in this case.

    "},{"location":"ui-tweaker/#add-button","title":"Add button","text":"
    tweaker.addButton({\n// bindingTarget: object,\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\ntitle: undefined,\n\nlabel: undefined,\n\ncallback: function(target) {},\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target will pass to callback. Optional.
      • Can bind target later via tweaker.setBindingTarget(object).
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label.
    • label : Display text of button, a string or a plain object.
      {\ntext: '',\n\nicon: undefined, iconFrame: undefined,\niconSize: undefined,\n\naction: undefined, actionFrame: undefined,\nactionSize: undefined,\n\n}\n
    • callback : Callback when clicking button
      function(target) { }\n
    • key : Add this child into childMap, which could be read back by tweaker.getElement(key).
      • undefined : Don't add this child. Default value.

    See Style of botton

    "},{"location":"ui-tweaker/#add-buttons","title":"Add buttons","text":"
    tweaker.addButtons({\n// bindingTarget: object,\n\n// icon: undefined,\n// iconFrame: undefined,\n// iconSize: undefined,\n\ntitle: undefined,\n\nbuttons:[\n{\nlabel: undefined,\ncallback: function(target) {},\n},\n{\nlabel: undefined,\ncallback: function(target) {},\n},\n// ...\n],\n\nwrap: false,\n\n// key: undefined,\n})\n
    • bindingTarget : Binding target will pass to callback. Optional.
      • Can bind target later via tweaker.setBindingTarget(object).
    • icon, iconFrame : Texture key, frame name of icon on title-label.
    • iconSize : Fixed icon size
    • title : Display text of title-label.
    • buttons : Array of button label and button callback
      {\nlabel: undefined,\ncallback: function(target) {},\n}\n
      • label : Display text of button, a string or a plain object. ```javascript { text: '',

        icon: undefined, \niconFrame: undefined,\niconSize: undefined,\n\naction: undefined, \nactionFrame: undefined,\nactionSize: undefined,\n

        } `` -callback: Callback when clicking button

        function(target) { }\n
        -wrap: Layout mode of buttons. -true: [fixwidth-sizer](ui-fixwidthsizer.md) layout. -false: [sizer](ui-sizer.md) layout. Default behavior. -key: Add this child into childMap, which could be read back bytweaker.getElement(key). -undefined` : Don't add this child. Default value.

    See Style of botton

    "},{"location":"ui-tweaker/#add-separator","title":"Add separator","text":"
    tweaker.addSeparator();\n

    See Style of separator

    "},{"location":"ui-tweaker/#add-folder","title":"Add folder","text":"

    Folder contains collapsible child tweaker game object.

    var childTweaker = tweaker.addFolder({\ntitle: titleA,\n\n// expanded: true,\n});\n\n// childTweaker.addInput(...)\n
    • childTweaker : Child tweaker game object. Add input rows by addInput method.
    • title Title of folder. Click title can collapse or expand child tweaker game object.
    • expanded :
      • true : Expand child tweaker game object at beginning. Default behavior.
      • false : Collapse child tweaker game object at beginning.

    See Style of folder

    "},{"location":"ui-tweaker/#add-tab","title":"Add tab","text":"

    Tab containes pages. Each page is a tweaker game object.

    var childrenTweakers = tweaker.addTab({\npages: [\n{\ntitle: titleA, // show: false\n},\n{\ntitle: titleB\n// show: false\n},\n// ...\n]\n});\n\n// childrenTweakers[0].addInput(...)\n// childrenTweakers[1].addInput(...)\n
    • childrenTweakers : Array of children tweaker game object. Add input rows by addInput method.
    • pages : Array of page setting.
      {\ntitle: titleA,\nshow: false,\n}\n
      • title : Display text of page title
      • show : Set to true to show this page at beginning

    See Style of tab

    "},{"location":"ui-tweaker/#add-columns","title":"Add columns","text":"

    Multiple columns in a row. Each column is a tweaker game object.

    var childrenTweakers = tweaker.addColumns(amount);\n\n// childrenTweakers[0].addInput(...)\n// childrenTweakers[1].addInput(...)\n

    or

    var childrenTweakers = tweaker.addColumns({\n// title: title,\n\ncolumns: [\n{\n// width: 0,\n// expand: true\n},\n{\n// width: 0,\n// expand: true\n},\n]\n});\n\n// childrenTweakers[0].addInput(...)\n// childrenTweakers[1].addInput(...)\n
    • childrenTweakers : Array of children tweaker game object. Add input rows by addInput method.
    • amount : A number, amount of columns. Will use default column config.
    • columns : Array of column config, each column config contains
      • width : Minimum width of this column, default value is 0, will set proportion to 1.
      • expand : Expand height of this column, default value is true.

    See Style of columns

    "},{"location":"ui-tweaker/#add-wrap","title":"Add wrap","text":"

    A tweaker panel which Wrap input rows into multiple lines.

    var childTweaker = tweaker.addWrap({\n// title: titleA,\n\nitemWidth: 0,\nitemHeight: 0,\n});\n\n// childTweaker.addInput(...)\n
    • childTweaker : Child tweaker game object. Add input rows by addInput method.
    • title Title of folder. Click title can collapse or expand child tweaker game object.
    • itemWidth, itemHeight : Size of input row.

    See Style of wrap

    "},{"location":"ui-tweaker/#add-scrollable","title":"Add scrollable","text":"

    Scrollable(Panel) contains child tweaker game object and slider.

    var childTweaker = tweaker.addScrollable({\n// title: title,\n\n// height: 0\n});\n\n// childTweaker.addInput(...)\n
    • childTweaker : Child tweaker game object. Add input rows by addInput method.
    • title Title of scrolable.
      • A string : Title string.
      • undefined : Hide this title game object.
    • height :
      • A number : Height of this Scrollable(Panel).
      • undefined, or 0 : Expand this scrollable(Panel).

    See Style of scrollable

    "},{"location":"ui-tweaker/#add-rows","title":"Add rows","text":"

    Add mutiple rows (input row, button, buttons, separator, folder, tab) in a single method

    tweaker.addRows(properties, target);\n// tweaker.addRows(properties, target, monitor);\n
    • properties : A list of properties, each property could be one of
      • Input row
        {\n$key: '',\n// $target:\n// More properties...\n}\n
        • $key : Assign this value to bindingKey
        • $target : Assign this value to bindingTarget
          • undefined : Use target parameter from addRows method. Default behavior
        • More properties. See
          • Text input row,
          • Text area input row,
          • Text input from list
          • Text input from buttons
          • Number input row
          • Number input in a range
          • Number input from list
          • Number input from buttons
          • Color input row
          • Boolean input row
          • Value callback row
      • Button
        {\n$type: 'button', title: '', label: '',\ncallback(target) {\n}\n}\n
      • Buttons
      • Separator
        { $type: 'separator' }\n
      • Folder
        {\n$type: 'folder', title: '',\n// $target: \n$properties: [\n// ...\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
      • Tab
        {\n$type: 'tab',\n// $target:\npages: [\n{\ntitle: '',\n$properties: [\n// ...\n]\n},\n{\ntitle: '',\n$properties: [\n// ...\n]\n},\n// ... More pages\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
      • Columns
        {\n$type: 'columns',\n// $target:\ncolumns: [\n{\n// width: 0,\n// expand: true,\n$properties: [\n// ...\n]\n},\n{\n// width: 0,\n// expand: true,\n$properties: [\n// ...\n]\n},\n// ... More columns\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
      • Wrap
        {\n$type: 'wrap', title: '',\n// $target: \n$properties: [\n// ...\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
      • Scrollable
        {\n$type: 'scrollable', title: undefined,\n// $target: \n$properties: [\n// ...\n]\n}\n
        • $target : Override target value pass to remainder $properties.
          • undefined : Use previous target value. Default behavior.
    • monitor :
      • false : Don't update input text every tick from target.
      • true : Update input text from current object, in postupdate event of scene. Default behavior.
    "},{"location":"ui-tweaker/#layout-children","title":"Layout children","text":"

    Arrange position of all elements.

    tweaker.layout();\n

    See also - dirty

    "},{"location":"ui-tweaker/#styles","title":"Styles","text":""},{"location":"ui-tweaker/#style-of-text-input","title":"Style of text input","text":"

    Style of text-area input is defined in

    • styles.inputRow.title
    • styles.inputRow.inputText
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-text-area-input","title":"Style of text-area input","text":"

    Style of text-area input is defined in

    • styles.inputRow.title
    • styles.inputRow.inputTextArea
    • styles.inputRow.inputText
    • styles.inputRow.slider
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ninputTextArea: {\nheight: undefined,\n\ntext: {\n\n},\n\nslider: {\n// ...\n}\n},\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},\n\nslider: {\ntrack: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nindicator: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nthumb: {\nwidth: 0, height: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n}\n}\n}\n

    Style of text-area is defined at styles.inputRow.inputTextArea :

    • Define style of input text at styles.inputRow.inputTextArea.text, if not given, it will use styles.inputRow.inputText.
    • Define style of slider at styles.inputRow.inputTextArea.slider, if not given, it will use styles.inputRow.slider.
    "},{"location":"ui-tweaker/#style-of-list-input","title":"Style of list input","text":"

    Style of text/number list input is defined in

    • styles.inputRow.title
    • styles.inputRow.list
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nlist: {\nlabel: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n\n},\n\nbutton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n\n'hover.color': undefined,\n'hover.alpha': undefined,\n'hover.strokeColor': undefined,\n'hover.strokeAlpha': undefined,\n'hover.strokeWidth': undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nlist: {\nalignParent: 'text',\nalignSide: 'left',\nexpandDirection: 'down',\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-buttons-input","title":"Style of buttons input","text":"

    Style of buttons input is defined in

    • styles.inputRow.title
    • styles.inputRow.button
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nbutton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpand: true\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-range-input","title":"Style of range input","text":"

    Style of range input is defined in

    • styles.inputRow.title
    • styles.inputRow.slider
    • styles.inputRow.inputText
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nslider: {\ntrack: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nindicator: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nthumb: {\nwidth: 0, height: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n}\n},\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\nrange: {\nslider: 0,\ninputText: 0,\n}\n}\n\n}\n}\n}\n
    • Set proportion.range.slider and proportion.range.inputText to layout slider and inputText.
    "},{"location":"ui-tweaker/#style-of-inc-dec-input","title":"Style of inc-dec input","text":"

    Style of range input is defined in

    • styles.inputRow.title
    • styles.inputRow.incDec
    • styles.inputRow.inputText
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nincDec: {\nincButton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nicon: {\nkey:,\nframe:,\n},\n\ntext: null,\naction: null,\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ndecButton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nicon: {\nkey:,\nframe:,\n},\n\ntext: null,\naction: null,\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ninputTextIndex: 0, // 0,1,2\n},\n\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\nrange: {\nslider: 0,\ninputText: 0,\n}\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-color-input","title":"Style of color input","text":"

    Style of color input is defined in

    • styles.inputRow.title
    • styles.inputRow.inputText
    • styles.inputRow.colorInput
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\ncolorInput: {\nswatch: {\nradius: 0,\nsize: undefined,\n},\n\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n},                // inputText: false,\n\ncolorPicker: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n}\n},\n\ncolorComponents: {\ninputText: {\nbackground: {\ncolor: null,\ncolor2: null,\nhorizontalGradient: true,\n\nstroke: null,\nstrokeThickness: 2,\n\ncornerRadius: 0,\ncornerIteration: null\n},\nfocusStyle: {\n// color:\n// color2:\n// horizontalGradient:\n\n// stroke:\n// strokeThickness:\n\n// cornerRadius:\n// cornerIteration:\n},\n\nstyle: {\nbold: false,\nitalic: false,\nfontSize: '16px',\nfontFamily: 'Courier',\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadowColor: null,\nshadowOffsetX: 0,\nshadowOffsetY: 0,\nshadowBlur: 0,\nbackgroundColor: null,\nbackgroundHeight: undefined,\nbackgroundBottomY: undefined,\noffsetX: 0,\noffsetY: 0\n},\ncursorStyle: {\n// bold:\n// italic:\n// fontSize:\n// fontFamily:\n// color:\n// stroke:\n// strokeThickness:\n// shadowColor:\n// shadowOffsetX:\n// shadowOffsetY:\n// shadowBlur:\n// backgroundColor:\n// backgroundHeight:\n// backgroundBottomY:\n// offsetX:\n// offsetY:\n}\n\n}\n}\n\n// colorComponents: false,\n\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-boolean-input","title":"Style of boolean input","text":"

    Style of boolean input is defined in

    • styles.inputRow.title
    • styles.inputRow.checkbox, or styles.inputRow.toggleSwitch
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\n// For checkbox view\ncheckbox: {\n// size: undefined,\n\ncolor: 0x005cb2,\nboxFillAlpha: 1,\nuncheckedColor: null,\nuncheckedBoxFillAlpha: 1,\n\nboxLineWidth: 4,\nboxStrokeColor: 0x005cb2,\nboxStrokeAlpha: 1,\nuncheckedBoxStrokeColor: 0x005cb2,\nuncheckedBoxStrokeAlpha: 1,\n\ncheckerColor: 0xffffff,\ncheckerAlpha: 1,\n\ncircleBox: false\n\nanimationDuration: 150,\n\nreadOnly: false,\n},\n\n// For toggle switch view\ntoggleSwitch: {\n// size: undefined,\n\ncolor: 0x005cb2,\ntrackFillAlpha: 1,\nfalseValueTrackColor: undefined,\nfalseValueTrackFillAlpha: 1,\n\nthumbColor: 0xffffff,\nthumbAlpha: 1,\n\ntrackWidth: 0.9,\ntrackHeight: 0.5,\ntrackCornerRadius: (trackHeight * 0.5),\n\nthumbHeight: (trackHeight * 0.9),\nthumbWidth: (thumbHeight),\nthumbCornerRadius: (thumbHeight * 0.5),\n\nthumbLeft: 0.3,\nthumbRight: (1 - thumbLeft),\nrtl: false,\n\nanimationDuration: 150,\n\nreadOnly: false,\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-botton","title":"Style of botton","text":"

    Style of button is defined in

    • styles.inputRow.title
    • styles.inputRow.button
    • styles.inputRow.background
    {\n// style: {...}\nstyles: {\ninputRow: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nbutton: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom: 0,\ntitle: 0\n},\n\nproportion: {\ntitle: 0, inputField: 0,\n}\n\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-separator","title":"Style of separator","text":"

    Style of separator is defined in

    • styles.separator
    {\n// style: {...}\nstyles: {\nseparator: {\nheight: 0,\n\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-folder","title":"Style of folder","text":"

    Style of folder is defined in

    • styles.folder
    {\n// style: {...}\nstyles: {\nfolder: {\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpandedIcon: {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n},\n\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, }\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-tab","title":"Style of tab","text":"

    Style of tab is defined in

    • styles.tab
    {\n// style: {...}\nstyles: {\ntab: {\ntab: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n\n'active.color': undefined,\n'active.alpha': undefined,\n'active.strokeColor': undefined,\n'active.strokeAlpha': undefined,\n'active.strokeWidth': undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n}\n},\n\nwrapTabs: false,\n\ntabs: {\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, item: 0,\n}\n},\n\npages: {\nfadeIn: 0,\n}\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-columns","title":"Style of columns","text":"

    Style of columns is defined in

    • styles.columns
    {\n// style: {...}\nstyles: {\ncolumns: {\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpandedIcon: {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n},\n\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\n//background: [\n//    {\n//        radius: 0,\n//        // radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n//\n//        color: undefined,\n//        alpha: undefined,\n//        strokeColor: undefined,\n//        strokeAlpha: undefined,\n//        strokeWidth: undefined,\n//    }\n//],\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, column: 0,\n}\n}\n}\n}\n
    "},{"location":"ui-tweaker/#style-of-wrap","title":"Style of wrap","text":"

    Style of wrap is defined in

    • styles.wrap
    {\n// style: {...}\nstyles: {\nwrap: {\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpandedIcon: {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n},\n\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nspace: {\nitem: 0, line: 0\n},\n\nalign: 'justify-cneter'\n}\n}\n}\n
    • align : Align children of a line.
      • 0, 'left' : Align children of a line to left/top side.
      • 1, 'right' : Align children of a line to right/bottom side.
      • 2, 'center' : Align children of a line to ceter.
      • 3, 'justify', 'justify-left' : If remainder space is less or equal than 25%, then justify children. Else align children to left/top side.
      • 4, 'justify-right' : If remainder space is less or equal than 25%, then justify children. Else align children to right/bottom side.
      • 5, 'justify-cneter' : If remainder space is less or equal than 25%, then justify children. Else align children to center.
    "},{"location":"ui-tweaker/#style-of-scrollable","title":"Style of scrollable","text":"

    Style of scrollable is defined in

    • styles.scrollable
    {\n// style: {...}\nstyles: {\nscrollable: {\ntitle: {\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\ntext: {\nfontFamily: 'Courier',\nfontSize: '16px',\nfontStyle: '',\nbackgroundColor: null,\ncolor: '#fff',\nstroke: '#fff',\nstrokeThickness: 0,\nshadow: {\noffsetX: 0,\noffsetY: 0,\ncolor: '#000',\nblur: 0,\nstroke: false,\nfill: false\n},                  padding: {\nleft: 0,\nright: 0,\ntop: 0,\nbottom: 0,\n},\n// more text styles\n},\n\niconSize: undefined,\niconWidth: undefined, iconHeight: undefined,\n\nspace: {\nleft: 0, right: 0, top: 0, bottom:0, icon: 0, text: 0\n},\n\nexpandedIcon: {\ncolor: undefined,\nalpha: 1,\n\nstrokeColor: undefined,\nstrokeAlpha: 1,\nstrokeWidth: 1,\narrowOnly: false,\n\neaseDuration: 0,\n}\n},\n\nbackground: {\nradius: 0,\n// radius: {tl: {x,y}, tr: {x,y}, bl: {x,y}, br: {x,y}}\n\ncolor: undefined,\nalpha: undefined,\nstrokeColor: undefined,\nstrokeAlpha: undefined,\nstrokeWidth: undefined,\n},\n\nslider: {\ntrack: { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n},\n\nthumb: { width: 1, height: 1,\nradius: 0, color: undefined, alpha: 1,\nstrokeColor: undefined, strokeAlpha: 1, strokeWidth: 2,\nshape: undefined\n},\n\n// hideUnscrollableSlider: false,\n// disableUnscrollableDrag: false,\n// adaptThumbSize: false,\n// minThumbSize: undefined,\n},\n\nspace: {\npanel:0, }\n}\n}\n}\n
    "},{"location":"ui-tweaker/#bind-target","title":"Bind target","text":"

    All input rows will bind to this new target, and update display status.

    tweaker.setBindingTarget(object);\n
    "},{"location":"ui-tweaker/#events","title":"Events","text":"
    • On value change of any bindingKey
      tweaker.on('valuechange', function(newValue, oldValue, bindingTarget, bindingKey) {\n\n})\n
    "},{"location":"ui-tweaker/#get-element","title":"Get element","text":"
    • Get by key
      var gameObject = tweaker.getElement(key);\n
      • key : Add by key parameter in tweaker.addInput(config) method
        tweaker.addInput({\nkey: ...\n})\n
    • Get by name
      var gameObject = tweaker.getElement('#' + name);\n// var gameObject = pages.getElement('#' + name, recursive);\n
      or
      var gameObject = tweaker.getByName(name);\n// var gameObject = tweaker.getByName(name, recursive);\n
      • recursive : Set true to search all children recursively.
    "},{"location":"ui-tweaker/#other-properties","title":"Other properties","text":"

    See sizer object, base sizer object, container-lite.

    "},{"location":"uniqueitemlist/","title":"Unique item list","text":""},{"location":"uniqueitemlist/#introduction","title":"Introduction","text":"

    List of unique items. Support array and set methods.

    • Author: Rex
    • Data structure
    "},{"location":"uniqueitemlist/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"uniqueitemlist/#install-plugin","title":"Install plugin","text":""},{"location":"uniqueitemlist/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexuniqueitemlistplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexuniqueitemlistplugin.min.js', true);\n
    • Add list object
      var listA = scene.plugins.get('rexuniqueitemlistplugin').add(config);\n
    "},{"location":"uniqueitemlist/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import UniqueItemListPlugin from 'phaser3-rex-plugins/plugins/uniqueitemlist-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexUniqueItemList',\nplugin: UniqueItemListPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add list object
      var listA = scene.plugins.get('rexUniqueItemList').add(config);\n
    "},{"location":"uniqueitemlist/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import UniqueItemList from 'phaser3-rex-plugins/plugins/uniqueitemlist.js';\n
    • Add list object
      var listA = new UniqueItemList();\n
    "},{"location":"uniqueitemlist/#create-instance","title":"Create instance","text":"
    var listA = scene.plugins.get('rexUniqueItemList').add({\n// items: undefined,\n// autoCleanup: true\n});\n
    • items : Initial items.
    • autoCleanup : Set true to remove item when item is destroyed (from item's 'destroy' event)

    or

    var listA = scene.plugins.get('rexUniqueItemList').add(items);\n
    "},{"location":"uniqueitemlist/#items","title":"Items","text":"
    • Get first item
      var item = listA.getFirst();\n
    • Get last item
      var item = listA.getLast();\n
    • Get item at index
      var item = listA.get(index);\n
    • Get a random item
      var item = listA.getRandom();\n
    • Get items
      var items = listA.getItems();\n
    • Clone items to a new array
      var items = listA.cloneItems();\n
    "},{"location":"uniqueitemlist/#item-count","title":"Item count","text":"
    • Get item count
      var count = listA.length;\n
    • List is empty
      var isEmpty = listA.isEmpty();\n
    "},{"location":"uniqueitemlist/#contains","title":"Contains","text":"
    • Has item
      var hasItem = listA.contains(item);\n
    • Has any item
      var hasAny = listA.any(listB);\n
    • Has all items
      var hasAll = listA.all(listB);\n
    "},{"location":"uniqueitemlist/#array-operations","title":"Array operations","text":""},{"location":"uniqueitemlist/#add","title":"Add","text":"
    • Add to last
      listA.add(item);\n
      or
      listA.addLast(item);\n
    • Add to first
      listA.addFirst(item);\n
    • Insert to index
      listA.add(item, index);\n
    • Insert, or move to index
      listA.add(item, iindex, true);\n
    • Add items
      listA.addMultiple(items);\n
    • Clone list
      var newList = listA.clone();\n// listA.clone(listB)\n
    "},{"location":"uniqueitemlist/#remove","title":"Remove","text":"
    • Remove item
      listA.remove(item);\n
    • Remove first
      listA.removeFirst();\n
    • Remove last
      listA.removeLast();\n
    • Remove item at index
      listA.remove(undefined, index);\n
    • Remove items
      listA.removeMultiple(items);\n
    • Remove all items
      listA.clear();\n
    • Destroy all items
      listA.clear(true);\n
    "},{"location":"uniqueitemlist/#pop","title":"Pop","text":"
    • Pop first item
      var item = listA.pop();\n
      or
      var item = listA.popFirst();\n
    • Pop last item
      var item = listA.popLast();\n
    • Pop item at index
      var item = listA.pop(index);\n
    • Pop a random item
      var item = listA.popRandom();\n
    "},{"location":"uniqueitemlist/#slice","title":"Slice","text":"
    • Extract items from startIndex to endIndex (item of endIndex is included)
      var newList = listA.slice(startIndex, endIndex);\n// listA.slice(startIndex, endIndex, listB);\n
    "},{"location":"uniqueitemlist/#sort","title":"Sort","text":"
    • Sort
      list.sort(function(itemA, itemB) {\nif (itemA > itemB) {\nreturn 1;\n} else if (itemA < itemB) {\nreturn -1;\n} else {\nreturn 0;\n}\n})\n
    • Reverse
      listA.reverse();\n
    • Shuffle
      listA.shuffle();\n
    "},{"location":"uniqueitemlist/#set-operations","title":"Set operations","text":"
    • C = A | B
      var listC = listA.union(listB);\n// listA.union(listB, listC);\n
      • listC : Result unique-item-list. Can be listA, or listB.
    • C = A & B
      var listC = listA.intersect(listB);\n// listA.intersect(listB, listC);\n
      • listC : Result unique-item-list. Can be listA, or listB.
    • C = A - B
      var listC = listA.difference(listB);\n// listA.difference(listB, listC);\n
      • listC : Result unique-item-list. Can be listA, or listB.
    "},{"location":"uniqueitemlist/#call-method","title":"Call method","text":"

    Apply method of each item.

    listA.call(fnName, arg0, arg1, arg2, ...);\n
    • fnName : Method name of item.
    • arg0, arg1, arg2 : Arguments of fnName method.

    Warning

    Don't add or remove any item during this method.

    listA.call(function(item, i) {\n// ....\n}, scope);\n
    • callback : A function object.
      function(item, i) {\n\n}\n
    "},{"location":"uuid/","title":"UUID","text":""},{"location":"uuid/#introduction","title":"Introduction","text":"

    Creates and returns an RFC4122 version 4 compliant UUID, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"uuid/#usage","title":"Usage","text":"
    var uuid = Phaser.Utils.String.UUID();\n
    "},{"location":"vector2/","title":"Vector2","text":""},{"location":"vector2/#introduction","title":"Introduction","text":"

    A representation of a vector in 2D space ({x, y}), built-in object of phaser.

    • Author: Richard Davey
    "},{"location":"vector2/#usage","title":"Usage","text":""},{"location":"vector2/#create-object","title":"Create object","text":"
    var vector = new Phaser.Math.Vector2();\n// var vector = new Phaser.Math.Vector2(x, y);\n// var vector = new Phaser.Math.Vector2({x, y});\n
    "},{"location":"vector2/#clone","title":"Clone","text":"
    var newVector = vector.clone();\n
    "},{"location":"vector2/#set-components","title":"Set components","text":"
    • Set (x, y)
      vector.set(x, y);\n// vector.setTo(x, y);\n
      or
      vector.copy({x, y});\n// vector.setFromObject({x, y});\n
    • Set angle
      vector.setAngle(angle);\n
      • angle : Angle in radians.
    • Rotate
      vector.rotate(delta);\n
      • delta : The angle to rotate by, in radians.
    • Project
      vector.project(srcVector2);\n
    • Set length
      vector.setLength(length);\n
    • Set from polar coordinate
      vector.setToPolar(azimuth, radius);\n
      • azimuth : The angular coordinate, in radians.
      • radius : The radial coordinate (length). Default is 1.
    • Reset to (0, 0)
      vector.reset();\n
    "},{"location":"vector2/#get-componments","title":"Get componments","text":"
    • X, Y
      var x = vector.x;\nvar y = vector.y;\n
    • Angle
      var angle = vector.angle(); // angle in radians\n
    • Length
      var length = vector.length();\n
      or
      var lengthSq = vector.lengthSq(); // squared\n
    "},{"location":"vector2/#methods","title":"Methods","text":"
    • Scale
      vector.scale(value);\n
    • Limit the length
      vector.limit(value);\n
    • Normalize
      vector.normalize();\n
    • Negate
      vector.negate();\n
    • Rotate perpendicular
      vector.normalizeRightHand();\nvector.normalizeLeftHand();\n
    • Reflect
      • Reflect this Vector off a line defined by a normal.
        vector.reflect(normal);\n
        • normal : A vector perpendicular to the line.
      • Reflect this Vector across another.
        vector.mirror(axis);\n
        • axis : A vector to reflect across.
    "},{"location":"vector2/#vector-methods","title":"Vector methods","text":"
    • Add
      vector.add(src); // src: {x, y}\n
    • Subtract
      vector.subtract(src); // src: {x, y}\n
    • Multiply
      vector.multiply(src); // src: {x, y}\n
    • Divide
      vector.divide(src); // src: {x, y}\n
    • Dot
      var value = vector.dot(src); // src: {x, y}\n
    • Cross
      var value = vector.cross(src); // src: {x, y}\n
    • Fuzzy Equal
      var equal = vector.fuzzyEquals(src); // src: {x, y}\n// var equal = vector.fuzzyEquals(src, epsilon);\n
    "},{"location":"vector2/#points-method","title":"Points method","text":"
    • Distance between 2 points.
      var distance = vector.distance(src);\n
      or
      var distanceSq = vector.distanceSq(src); // squared\n
    • Linearly interpolate between 2 points.
      vector.lerp(src, t); // src: {x, y}\n
      • t : The interpolation percentage, between 0 and 1.
    "},{"location":"vector2/#constant","title":"Constant","text":"
    • Zero (0,0)
      var vector = Phaser.Math.Vector2.ZERO;\n
    • One (1,1)
      var vector = Phaser.Math.Vector2.ONE;\n
    • Right (1,0)
      var vector = Phaser.Math.Vector2.RIGHT;\n
    • Left (-1,0)
      var vector = Phaser.Math.Vector2.LEFT;\n
    • Up (0,-1)
      var vector = Phaser.Math.Vector2.UP;\n
    • Down (0,1)
      var vector = Phaser.Math.Vector2.DOWN;\n
    "},{"location":"video/","title":"Video","text":""},{"location":"video/#introduction","title":"Introduction","text":"

    Handling playback of a video file, video stream or media stream.

    • Author: Richard Davey
    "},{"location":"video/#usage","title":"Usage","text":""},{"location":"video/#load-video","title":"Load video","text":"
    scene.load.video(key, url, noAudio);\n

    Reference: load video

    Cross-origin

    Can't load video cross-origin via scene.load.video(...). Using scene.add.video(x, y).loadURL(urls, noAudio, crossOrigin) to load video cross-origin.

    "},{"location":"video/#add-video-object","title":"Add video object","text":""},{"location":"video/#reference-video-from-video-cache","title":"Reference video from Video Cache","text":"
    var video = scene.add.video(x, y, key);\n
    • key : Key of the Video this Game Object will play, as stored in the Video Cache.
    "},{"location":"video/#load-video-from-url","title":"Load video from URL","text":"
    1. Add video object
      var video = scene.add.video(x, y);\n
    2. Play video from URL
      video.loadURL(url);\n// video.loadURL(urls, noAudio, crossOrigin);\n
      • noAudio : Does the video have an audio track? If not you can enable auto-playing on it.
        • false : Has audio track. Default behavior.
      • crossOrigin : The value to use for the crossOrigin property in the video load request.
        • undefined : crossorigin will not be set in the request. Default behavior.
        • 'anonymous'
        • 'use-credentials'
    "},{"location":"video/#load-video-from-mediastream","title":"Load video from MediaStream","text":"
    video.loadMediaStream(stream);\n// video.loadMediaStream(stream, noAudio, crossOrigin);\n
    • stream : The MediaStream object.
    • noAudio : Does the video have an audio track? If not you can enable auto-playing on it.
      • false : Has audio track. Default behavior.
    • crossOrigin : The value to use for the crossOrigin property in the video load request.
      • undefined : crossorigin will not be set in the request. Default behavior.
      • 'anonymous'
      • 'use-credentials'
    navigator.mediaDevices.getUserMedia({ video: true, audio: false })\n.then(function(stream) {\nvideo.loadMediaStream(stream, true);\nvideo.play();\n})\n.catch(function(err) {\n\n})\n
    • navigator.mediaDevices.getUserMedia
    "},{"location":"video/#get-first-frame","title":"Get first frame","text":"
    video.getFirstFrame();\n
    "},{"location":"video/#size","title":"Size","text":"
    • Initial size : 256x265 (video.setSize(256, 256))
    • Size after playing : Size of video from metadata
    "},{"location":"video/#play","title":"Play","text":"
    video.play();\n// video.play(loop, markerIn, markerOut);\n
    • loop : Should the video loop automatically when it reaches the end? Please note that not all browsers support seamless video looping for all encoding formats.
    • markerIn, markerOut : Optional in/out marker time, in seconds, for playback of a sequence of the video.

    Play video first time

    Call video.play() when playing video first time.

    Note

    If you need audio in your videos, then you'll have to consider the fact that the video cannot start playing until the user has interacted with the browser, into your game flow.

    "},{"location":"video/#pause","title":"Pause","text":"
    • Pause
      video.setPaused();\n// video.setPaused(true);\n
    • Resume
      video.setPaused(false);\n

    Play video after paused

    Call video.setPaused(false) to resume playing.

    "},{"location":"video/#stop","title":"Stop","text":"

    Stops the video playing and clears all internal event listeners.

    video.stop();\n
    "},{"location":"video/#is-playing","title":"Is playing","text":"
    • Is playing
      var isPlaying = video.isPlaying();  // (not PAUSE) and (not not ENDED)\n
    • Is paused
      var isPaused = video.isPaused();\n
    "},{"location":"video/#playback-time","title":"Playback time","text":"
    • Get
      var playbackTime = video.getCurrentTime();\n
      or
      var t = video.getProgress(); // t: 0~1\n
    • Set
      • Set to
        video.setCurrentTime(playbackTime);  // time in seconds\n
        or
        video.seekTo(t); // t: 0~1\n
        • Is seeking
          var isSeeking = video.isSeeking();\n
      • Forward
        video.setCurrentTime('+' + time);  // time in seconds\n// video.setCurrentTime('+2');\n
      • Backeard
        video.setCurrentTime('-' + time);  // time in seconds\n// video.setCurrentTime('-2');\n
    "},{"location":"video/#playback-rate","title":"Playback rate","text":"
    • Get
      var rate = video.getPlaybackRate();\n
    • Set
      video.setPlaybackRate(rate);\n
    "},{"location":"video/#duration","title":"Duration","text":"
    var duration = video.getDuration();  // time in seconds\n
    "},{"location":"video/#volume","title":"Volume","text":"
    • Get
      var volume = video.getVolume();  // volume: 0~1\n
    • Set
      video.setVolume(volume);  // volume: 0~1\n
    "},{"location":"video/#mute","title":"Mute","text":"
    • Get
      var muted = video.isMuted();  // muted: true/false\n
    • Set
      video.setMute(muted);  // muted: true/false\n
    "},{"location":"video/#loop","title":"Loop","text":"
    • Get
      var loop = video.getLoop();  // loop: true/false\n
    • Set
      video.setLoop(loop);  // loop: true/false\n
    "},{"location":"video/#video-key","title":"Video key","text":"
    • Get
      var key = video.getVideoKey();\n
    • Change video key (video source)
      video.changeSource(key);\n// video.changeSource(key, autoplay, loop, markerIn, markerOut);\n
      • autoplay : Should the video start playing immediately, once the swap is complete?
      • loop : Should the video loop automatically when it reaches the end? Not all browsers support seamless video looping for all encoding formats.
      • markerIn, markerOut : Optional in/out marker time, in seconds, for playback of a sequence of the video.
    "},{"location":"video/#marks","title":"Marks","text":"
    • Add mark
      video.addMarker(key, markerIn, markerOut);\n
      • key : A unique name to give this marker.
      • markerIn, markerOut : The time, in seconds, representing the start/end of this marker.
    • Play mark
      video.playMarker(key, loop);\n
    • Remove mark
      video.removeMarker(key);\n
    "},{"location":"video/#snapshot","title":"Snapshot","text":"
    1. Allocate a canvas texrure
      video.saveSnapshotTexture(key);\n
      • key : Texture key.
    2. Take a snapshot
      var canvasTexture = video.video.snapshot();\n// var canvasTexture = video.snapshot(width, height);\n
      or
      var canvasTexture = video.snapshotArea(x, y, srcWidth, srcHeight);\n// var canvasTexture = video.snapshotArea(x, y, srcWidth, srcHeight, destWidth, destHeight);\n
      • x, y : The horizontal/vertical location of the top-left of the area to grab from.
      • srcWidth, srcHeight : The width/height of area to grab from the video.
      • destWidth, destHeight : The destination width/height of the grab, allowing you to resize it.
      • canvasTexture : Canvas texture object.
        • Get key of texture
          var key = canvasTexture.key;\n
    "},{"location":"video/#save-texture","title":"Save texture","text":"

    The saved texture is automatically updated as the video plays. If you pause this video, or change its source, then the saved texture updates instantly.

    var texture = video.saveTexture(key);\n// var texture = video.saveTexture(key, flipY);\n
    • flipY : Set to true if use it as the input for a Shader.
    "},{"location":"video/#events","title":"Events","text":"
    • The media source doesn't represent a supported media format.
      video.on('unsupported', function(video, error){\n\n}, scope);\n
    • A Video is unlocked by a user gesture.
      video.on('unlocked', function(video, error){\n\n}, scope);\n
    • A Video tries to play a source that does not exist, or is the wrong file type.
      video.on('error', function(video, error){\n\n}, scope);\n
    • A Video has access to the metadata.
      video.on('metadata', function(video){\n\n}, scope);\n
    • A Video has exhausted its allocated time while trying to connect to a video source to start playback.
      video.on('timeout', function(video){\n\n}, scope);\n
    • A Video begins playback.
      video.on('play', function(video){\n\n}, scope);\n
    • First started or restarted.
      video.on('playing', function(video){\n\n}, scope);\n
    • The video has finished loading enough data for its first frame.
      video.on('textureready', function(video){\n\n}, scope);\n
    • A Video finishes playback by reaching the end of its duration, or markerOut.
      video.on('complete', function(video){\n\n}, scope);\n
    • A Video that is currently playing has looped.
      video.on('loop', function(video){\n\n}, scope);\n
    • A Video begins seeking to a new point in its timeline.
      video.on('seeking', function(video){\n\n}, scope);\n
    • A Video completes seeking to a new point in its timeline.
      video.on('seeked', function(video){\n\n}, scope);\n
    • Enough of the video source has been loaded, that the browser is able to render a frame from it.
      video.on('created', function(video, width, height){\n\n}, scope);\n
    • Stalled by stalled, suspend, waiting DOM event.
      video.on('stalled', function(video, width, height){\n\n}, scope);\n
    • A Video is stopped from playback via a call to the Video.stop method,
      video.on('stop', function(video){\n\n}, scope);\n
    "},{"location":"video/#other-properties","title":"Other properties","text":"

    See game object

    "},{"location":"video/#create-mask","title":"Create mask","text":"
    var mask = video.createBitmapMask();\n

    See mask

    "},{"location":"video/#shader-effects","title":"Shader effects","text":"

    Support preFX and postFX effects

    "},{"location":"viewport-coordinate/","title":"Viewport-coordinate","text":""},{"location":"viewport-coordinate/#introduction","title":"Introduction","text":"

    Attach vpx, vpy properties to a game object, to set position according to proportion (vpx, vpy) of viewport, a rectangle).

    • Author: Rex
    • Method only
    "},{"location":"viewport-coordinate/#live-demos","title":"Live demos","text":"
    • Resize
    "},{"location":"viewport-coordinate/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"viewport-coordinate/#install-plugin","title":"Install plugin","text":""},{"location":"viewport-coordinate/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexviewportcoordinateplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexviewportcoordinateplugin.min.js', true);\n
    • Attach vpx, vpy properties.
      scene.plugins.get('rexviewportcoordinateplugin').add(gameObject, viewport, vpx, vpy);\ngameObject.vpx = 0.5;\ngameObject.vpy = 0.5;\n
    "},{"location":"viewport-coordinate/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ViewportCoordinatePlugin from 'phaser3-rex-plugins/plugins/viewportcoordinate-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexViewportCoordinate',\nplugin: ViewportCoordinatePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Attach vpx, vpy, vpxOffset, vpyOffset properties.
      scene.plugins.get('rexViewportCoordinate').add(gameObject, viewport, vpx, vpy);\ngameObject.vpx = 0.5;\ngameObject.vpy = 0.5;\ngameObject.vpxOffset = 0;\ngameObject.vpyOffset = 0;\n
    "},{"location":"viewport-coordinate/#import-method","title":"Import method","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import method
      import AddViewportCoordinateProperties from 'phaser3-rex-plugins/plugins/viewportcoordinate.js';\n
    • Attach vpx, vpy, vpxOffset, vpyOffset properties.
      AddViewportCoordinateProperties(gameObject, viewport, vpx, vpy);\ngameObject.vpx = 0.5;\ngameObject.vpy = 0.5;\ngameObject.vpxOffset = 0;\ngameObject.vpyOffset = 0;\n
    "},{"location":"viewport-coordinate/#attach-properties","title":"Attach properties","text":"
    scene.plugins.get('rexViewportCoordinate').add(gameObject, viewport, vpx, vpy, transformCallback);\n
    • vpx, vpy : Proportion of viewport.
    • vpxOffset, vpyOffset : Offset of position.
    • viewport : Viewport in rectangle
    • transformCallback : Transform callback.
      • undefined : Use default transform callback.
        function(vpx, vpy, vpxOffset, vpyOffset, viewport, out) {\ngameObject.x = viewport.x + (viewport.width * vpx) + vpxOffset;\ngameObject.y = viewport.y + (viewport.height * vpy) + vpyOffset;\n}\n

    Changing

    • gameObject.vpx, gameObject.vpy, gameObject.vpxOffset, gameObject.vpyOffset
    • x, y, width, height of viewport (a rectangle)

    Will change position (x , y) of game object.

    "},{"location":"virtualjoystick/","title":"Virtual joystick","text":""},{"location":"virtualjoystick/#introduction","title":"Introduction","text":"

    Simulate cursor keys according to touch events.

    • Author: Rex
    • Member of scene
    "},{"location":"virtualjoystick/#live-demos","title":"Live demos","text":"
    • Virtual joystick
    • Two joySticks
    • Joystick and button
    • Toggle visible
    • Drag vector to cursor keys
    "},{"location":"virtualjoystick/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"virtualjoystick/#install-plugin","title":"Install plugin","text":""},{"location":"virtualjoystick/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexvirtualjoystickplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexvirtualjoystickplugin.min.js', true);\n
    • Create instance
      var joyStick = scene.plugins.get('rexvirtualjoystickplugin').addPlayer(scene, config);\n
    "},{"location":"virtualjoystick/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import VirtualJoystickPlugin from 'phaser3-rex-plugins/plugins/virtualjoystick-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexVirtualJoystick',\nplugin: VirtualJoystickPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var joyStick = scene.plugins.get('rexVirtualJoystick').addPlayer(scene, config);\n
    "},{"location":"virtualjoystick/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import VirtualJoystick from 'phaser3-rex-plugins/plugins/virtualjoystick.js';\n
    • Create instance
      var joyStick = new VirtualJoystick(scene, config);\n
    "},{"location":"virtualjoystick/#create-instance","title":"Create instance","text":"
    var joystick = scene.plugins.get('rexVirtualJoystick').add(scene, {\nx: x,\ny: y,\nradius: 100,\nbase: baseGameObject,\nthumb: thumbGameObject,\n// dir: '8dir',\n// forceMin: 16,\n// fixed: true,\n// enable: true\n});\n
    • base : Base game object.
      • Create a circle shape object if no base game object passed.
    • thumb : Thumb game object.
      • Create a circle shape object if no thumb game object passed.
    • x, y : Position of base game object
    • radius : Circle hit-area of base game object
    • dir :
      • 'up&down', or 0 : Simulate up or down cursor keys only.
      • 'left&right', or 1 : Simulate left or right cursor keys only.
      • '4dir', or 2 : Simulate up, down, left or right cursor keys.
      • '8dir', or 3 : Simulate up, up-left, up-right, down, down-left, down-right, left, or right cursor keys.
    • forceMin : Cursor keys will be pressed when force is larger then this value.
      • force : Distance between position of base game object to touch pointer
    • fixed : Set true to fix to camera, i.e set scrollFactor to 0 for base and thumb game object. Default value is true.
    • enable : Set false to disable cursor keys simulation
    "},{"location":"virtualjoystick/#state-of-cursor-keys","title":"State of cursor keys","text":"
    var cursorKeys = joystick.createCursorKeys();\n\nvar leftKeyDown = cursorKeys.left.isDown;\nvar rightKeyDown = cursorKeys.right.isDown;\nvar upKeyDown = cursorKeys.up.isDown;\nvar downKeyDown = cursorKeys.down.isDown;\n

    Or

    var leftKeyDown = joystick.left;\nvar rightKeyDown = joystick.right;\nvar upKeyDown = joystick.up;\nvar downKeyDown = joystick.down;\nvar noKeyDown = joystick.noKey;\n
    "},{"location":"virtualjoystick/#force-angle","title":"Force & Angle","text":"

    Force : Distance between position of base game object to touch pointer.

    var force = joystick.force;\nvar forceX = joystick.forceX;\nvar forceY = joystick.forceY;\n\nvar angle = joystick.angle;  // degree between -180 to 180\nvar rotation = joystick.rotation; // radians\n
    "},{"location":"virtualjoystick/#visible","title":"Visible","text":"

    Visible of base game object.

    • Get : Return visible of base game object
      var visible = joystick.visible;\n
    • Set : Set visible to base game object and thumb game object
      joystick.visible = visible;\njoystick.setVisible(visible);\njoystick.toggleVisible();\n
      Joystick will be disabled when invisible.
    "},{"location":"virtualjoystick/#enable","title":"Enable","text":"
    • Get
      var enable = joystick.enable;\n
    • Set
      joystick.setEnable(enable);  // enable: true, or false\n//joystick.enable = enable;\n
    • Toggle
      joystick.toggleEnable();\n
    "},{"location":"virtualjoystick/#position","title":"Position","text":"

    Position of base game object.

    • Get
      var x = joystick.x;\nvar y = joystick.y;\n
    • Set
      joystick.setPosition(x ,y);\n// joystick.x = x;\n// joystick.y = y;\n
    "},{"location":"virtualjoystick/#scroll-factor","title":"Scroll factor","text":"
    • Fix to camera
      joystick.setScrollFactor(0);\n
    "},{"location":"virtualjoystick/#touch-pointer","title":"Touch pointer","text":"
    • Position
      var x = joystick.pointerX;\nvar y = joystick.pointerY;\n
    • Pointer
      var pointer = joystick.pointer;\n
    "},{"location":"virtualjoystick/#destroy","title":"Destroy","text":"

    Destroy base & thumb game object.

    joystick.destroy();\n
    "},{"location":"virtualjoystick/#events","title":"Events","text":"
    • On joystick updated :
      joystick.on('update', function(){});\n
    • On pointer-down
      joystick.on('pointerdown', function(pointer){});\n
    • On pointer-up
      joystick.on('pointerup', function(pointer){});\n
    "},{"location":"virtualjoystick/#elements","title":"Elements","text":"
    • Base Game object:
      var baseGO = joystick.base;\n
    • Thumb Game object:
      var thumb = joystick.thumb;\n
    "},{"location":"virtualjoystick/#vector-to-cursor-keys","title":"Vector to cursor keys","text":"

    A controller to represent cursor keys by (drag) vector

    "},{"location":"virtualjoystick/#create-controller","title":"Create controller","text":"
    var controller = scene.plugins.get('rexVirtualJoyStick').addVectorToCursorKeys({\n// dir: '8dir',\n// forceMin: 16,\n// enable: true\n})\n

    or

    // import VirtualJoystick from 'phaser3-rex-plugins/plugins/vectortocursorkeys.js';\nvar controller = new VirtualJoystick(undefined, config);\n
    • dir :
      • 'up&down', or 0 : Simulate up or down cursor keys only.
      • 'left&right', or 1 : Simulate left or right cursor keys only.
      • '4dir', or 2 : Simulate up, down, left or right cursor keys.
      • '8dir', or 3 : Simulate up, up-left, up-right, down, down-left, down-right, left, or right cursor keys.
    • forceMin : Cursor keys will be pressed when force is larger then this value.
      • force : Distance between position of base game object to touch pointer
    • enable : Set false to disable cursor keys simulation.
    "},{"location":"virtualjoystick/#set-vector","title":"Set vector","text":"
    • Set vector
      controller.setVector(x0, y0, x1, y1);\n
    • Clear vector
      controller.clearVector();\n
    "},{"location":"virtualjoystick/#state-of-cursor-keys_1","title":"State of cursor keys","text":"
    var cursorKeys = controller.createCursorKeys();\n\nvar leftKeyDown = cursorKeys.left.isDown;\nvar rightKeyDown = cursorKeys.right.isDown;\nvar upKeyDown = cursorKeys.up.isDown;\nvar downKeyDown = cursorKeys.down.isDown;\n
    "},{"location":"virtualjoystick/#force-angle_1","title":"Force & Angle","text":"
    var force = controller.force;\nvar forceX = controller.forceX;\nvar forceY = controller.forceY;\n\nvar angle = controller.angle;  // degree between -180 to 180\nvar rotation = controller.rotation; // radians\n
    "},{"location":"waitevents/","title":"Wait events","text":""},{"location":"waitevents/#introduction","title":"Introduction","text":"

    Wait fired events or callbacks.

    • Author: Rex
    "},{"location":"waitevents/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"waitevents/#install-plugin","title":"Install plugin","text":""},{"location":"waitevents/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexwaiteventsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexwaiteventsplugin.min.js', true);\n
    • Create instance
      var waitEvents = scene.plugins.get('rexwaiteventsplugin').add(completeCallback, completeCallbackScope);\n
    "},{"location":"waitevents/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import WaitEventsPlugin from 'phaser3-rex-plugins/plugins/waitevents-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexWaitEvents',\nplugin: WaitEventsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Create instance
      var waitEvents = scene.plugins.get('rexWaitEvents').add(completeCallback, completeCallbackScope);\n
    "},{"location":"waitevents/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import WaitEvents from 'phaser3-rex-plugins/plugins/waitevents.js';\n
    • Create instance
      var waitEvents = new WaitEvents(completeCallback, completeCallbackScope);\n
    "},{"location":"waitevents/#create-instance","title":"Create instance","text":"
    var waitEvents = scene.plugins.get('rexWaitEvents').add(completeCallback, completeCallbackScope);\n
    • completeCallback, completeCallbackScope : Callback when all waitting events are fired.
    "},{"location":"waitevents/#set-complete-callback","title":"Set complete callback","text":"
    waitEvents.setCompleteCallback(completeCallback, completeCallbackScope);\n
    • completeCallback, completeCallbackScope : Callback when all waitting events are fired.
    "},{"location":"waitevents/#add-waiting-event","title":"Add waiting event","text":""},{"location":"waitevents/#callback","title":"Callback","text":"
    var callback = waitEvents.waitCallback();\n
    • callback : A function object which invoked when waitting event finished.

    For example, invokes completeCallback when all timers are time-out.

    scene.time.delayedCall(500, waitEvents.waitCallback());\nscene.time.delayedCall(1000, waitEvents.waitCallback());\nscene.time.delayedCall(1500, waitEvents.waitCallback());\n
    "},{"location":"waitevents/#callback-from-event-emitter","title":"Callback from event emitter","text":"
    waitEvents.waitEvent(eventEmitter, eventName);\n
    "},{"location":"waitevents/#remove-waiting-event","title":"Remove waiting event","text":"
    callback();\n

    or

    waitEvents.remove(callback);\n
    • callback : A function object created via waitEvents.waitCallback()
    "},{"location":"waitevents/#clear-all-waiting-events","title":"Clear all waiting events","text":"
    waitEvents.clear();\n
    "},{"location":"waitevents/#no-wait-event","title":"No wait event","text":"
    var noWaitEvent = waitEvents.noWaitEvent;\n
    "},{"location":"webfontloader/","title":"Webfont loader","text":""},{"location":"webfontloader/#introduction","title":"Introduction","text":"

    Load web font by google webfont loader in payload or preload stage.

    • Author: Rex
    • Custom File of loader
    "},{"location":"webfontloader/#live-demos","title":"Live demos","text":"
    • Webfont loader
    "},{"location":"webfontloader/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"webfontloader/#install-plugin","title":"Install plugin","text":""},{"location":"webfontloader/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      var sceneConfig = {\n// ....\npack: {\nfiles: [{\ntype: 'plugin',\nkey: 'rexwebfontloaderplugin',\nurl: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/    rexwebfontloaderplugin.min.js',\nstart: true\n}]\n}\n};\nclass MyScene extends Phaser.Scene {\nconstructor() {\nsuper(sceneConfig)\n}\n// ....\n\npreload() {\n// rexwebfontloaderplugin will be installed before preload(), but not added to loader yet\n// Call addToScene(scene) to add this await loader to loader of this scene\nthis.plugins.get('rexwebfontloaderplugin').addToScene(this);\n\nthis.load.rexWebFont(config);\n}\n}\n
    "},{"location":"webfontloader/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import WebFontLoaderPlugin from 'phaser3-rex-plugins/plugins/webfontloader-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexWebFontLoader',\nplugin: WebFontLoaderPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • In preload stage
      scene.load.rexWebFont(config);\n
    "},{"location":"webfontloader/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import WebFontLoader from 'phaser3-rex-plugins/plugins/webfontloader.js';\n
    • Start loading task
      WebFontLoader.call(scene.load, config);\n
    "},{"location":"webfontloader/#load-webfont","title":"Load webfont","text":"

    In preload stage:

    this.load.rexWebFont({\ngoogle: {\nfamilies: ['Bangers']\n},\n// testString: undefined,\n// testInterval: 20,\n});\n
    • testString : To test if the font is loaded completed or not.
      • undefined : No testing. Default value.
      • A string : A test string for all fonts
      • An object, {fontFamily: testString} : Test string for a specific font family.
    • testInterval : Retry interval.

    or load font in pack

    var sceneConfig = {\nkey: '...',\npack: {\nfiles: [{\ntype: 'rexWebFont',\nkey: 'webfont',\nconfig: {\ngoogle: {\nfamilies: ['Bangers']\n},\n// testString: undefined,\n// testInterval: 20,\n}\n}\n]\n}\n};\n

    Configuration of loading fonts

    • Google webfont
      WebFontConfig = {\ngoogle: {\nfamilies: ['Droid Sans', 'Droid Serif:bold']\n}\n};\n
    • Custom font
      WebFontConfig = {\ncustom: {\nfamilies: ['My Font', 'My Other Font:n4,i4,n7'],\nurls: ['/fonts.css']\n}\n};\n
      and fonts.css
      @font-face {\nfont-family: 'My Font';\nsrc: ...;\n}\n@font-face {\nfont-family: 'My Other Font';\nfont-style: normal;\nfont-weight: normal; /* or 400 */\nsrc: ...;\n}\n@font-face {\nfont-family: 'My Other Font';\nfont-style: italic;\nfont-weight: normal; /* or 400 */\nsrc: ...;\n}\n@font-face {\nfont-family: 'My Other Font';\nfont-style: normal;\nfont-weight: bold; /* or 700 */\nsrc: ...;\n}\n
    "},{"location":"webfontloader/#events","title":"Events","text":"
    • fontactive event

      this.load.on('webfontactive', function(fileObj, familyName){});\n
    • fontinactive event

      this.load.on('webfontinactive', function(fileObj, familyName){});\n
    "},{"location":"webfontloader/#test-string","title":"Test string","text":"

    Add string parameter testString into config, to test if the font is loaded completed or not.

    1. Fill 0 within an internal canvas.
    2. Draw testString.
    3. Check if any pixel has non-zero value.
    "},{"location":"wrap/","title":"Wrap","text":""},{"location":"wrap/#introduction","title":"Introduction","text":"

    Wrap the given value between min and max, built-in method of phaser.

    • Author: Richard Davey
    "},{"location":"wrap/#usage","title":"Usage","text":"
    var result = Phaser.Math.Wrap(value, min, max);\n
    • value : The value to wrap.
    "},{"location":"xor/","title":"XOR","text":""},{"location":"xor/#introduction","title":"Introduction","text":"

    Encrypt or decrypt string by XOR algorithm.

    • Author: Rex
    • Methods
    "},{"location":"xor/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"xor/#install-plugin","title":"Install plugin","text":""},{"location":"xor/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexxorplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexxorplugin.min.js', true);\n
    • Encrypt, or decrypt
      var encResult = scene.plugins.get('rexxorplugin').Encrypt(src, pwd);\nvar decResult = scene.plugins.get('rexxorplugin').Decrypt(encResult, pwd);\n
    "},{"location":"xor/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import XORPlugin from 'phaser3-rex-plugins/plugins/xor-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexXOR',\nplugin: XORPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Encrypt, or decrypt
      var encResult = scene.plugins.get('rexXOR').Encrypt(src, pwd);\nvar decResult = scene.plugins.get('rexXOR').Decrypt(encResult, pwd);\n
    "},{"location":"xor/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import XOR from 'phaser3-rex-plugins/plugins/xor.js';\n
    • Encrypt, or decrypt
      var encResult = XOR.Encrypt(src, pwd);\nvar decResult = XOR.Decrypt(encResult, pwd);\n
    "},{"location":"xor/#encrypt","title":"Encrypt","text":"
    var encResult = scene.plugins.get('rexXOR').Encrypt(src, pwd);\n
    "},{"location":"xor/#decrypt","title":"Decrypt","text":"
    var decResult = scene.plugins.get('rexXOR').Decrypt(encResult, pwd);\n
    "},{"location":"ymlachievements/","title":"YAML Achievements","text":""},{"location":"ymlachievements/#introduction","title":"Introduction","text":"

    Achievements in a YAML table.

    • Author: Rex
    • Member of scene
    "},{"location":"ymlachievements/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ymlachievements/#install-plugin","title":"Install plugin","text":""},{"location":"ymlachievements/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexymlachievementsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexymlachievementsplugin.min.js', true);\n
    • Add conditions-table object
      var achievements = scene.plugins.get('rexymlachievementsplugin').add();\n
    "},{"location":"ymlachievements/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import AchievementsPlugin from 'phaser3-rex-plugins/plugins/ymlachievements-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexAchievements',\nplugin: AchievementsPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add conditions-table object
      var achievements = scene.plugins.get('rexAchievements').add();\n
    "},{"location":"ymlachievements/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import Achievements from 'phaser3-rex-plugins/plugins/ymlachievements.js';\n
    • Add conditions-table object
      var achievements = new Achievements();\n
    "},{"location":"ymlachievements/#create-instance","title":"Create instance","text":"
    var achievements = scene.plugins.get('rexAchievements').add();\n
    "},{"location":"ymlachievements/#load-table-from-yaml-string","title":"Load table from YAML string","text":"
    achievements.loadYML(ymlString);\n

    For exameple

    Lv1 :\nAch1 : (A >= 10) && (A < 20)\nAch2 : (A >= 20) && (A < 50)\nAch3 : A >= 50\n

    Equations will be parsed by expression-parser.

    "},{"location":"ymlachievements/#test","title":"Test","text":"
    1. Run test
      var achievements.runTest(levelName, values);\n
      • levelName : Level name, in 1st column of achievements table.
      • values : Inputs in Key-value pairs
    2. Get obtained states
      var states = achievements.getObtainedState(levelName);\n
      • states : Obtained states of levelName
        {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n
        • wasObtained : Obtained this achievement achievementName before last testing.
        • justObtained : Obtained this achievement achievementName at last testing.

    or

    var states = achievements.getTestResults(levelName, values);\n
    "},{"location":"ymlachievements/#get-obtained-states","title":"Get obtained states","text":"
    • Get obtained states of an achievement in a level
      var state = achievements.getObtainedState(levelName, achievementName);\n
      • state : Obtained states of achievementName, in level levelName
        {\nwasObtained: boolean,\njustObtained: boolean\n}\n
        • wasObtained : Obtained this achievement achievementName before last testing.
        • justObtained : Obtained this achievement achievementName at last testing.
    • Get obtained states of a level
      var state = achievements.getObtainedState(levelName);\n
      • states : Obtained states of levelName
        {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n
    • Get obtained states of all levels
      var state = achievements.getObtainedState();\n// var state = achievements.getObtainedStates();\n
      • states : Obtained states of all levels
        {\nlevelName: {\nachievementName: {\nwasObtained: boolean,\njustObtained: boolean\n}\n}\n}\n
    • For each obtained state in a level
      achievements.forEachObtainedState(levelName, function(levelName, achievementName, state) {\n\n}, scope)\n
      • state : Obtained states of achievementName, in level levelName
        {\nwasObtained: boolean,\njustObtained: boolean\n}\n
    "},{"location":"ymlachievements/#get-name","title":"Get name","text":"
    • Name of levels
      var names = achievements.getLevelNames();\n// var names = achievements.getLevelNames(out);\n
    • Name of achievements in a level
      var names = achievements.getAchievementNames(levelName);\n// var names = achievements.getAchievementNames(levelName, out);\n
    "},{"location":"ymlachievements/#save-load-obtained-states","title":"Save & load obtained states","text":"
    • Get obtained states
      var states = achievements.getObtainedStates();\n
    • Load obtained states
      achievements.loadObtainedStates(states);\n
    "},{"location":"ymlachievements/#set-obtained-state","title":"Set obtained state","text":"
    • Set wasObtained, justObtained properties to true.
      achievements.setObtainedState(levelName, achievementName);\n
    • Set wasObtained, justObtained properties to false.
      achievements.clearObtainedState(levelName, achievementName);\n// achievements.setObtainedState(levelName, achievementName, false);\n
    "},{"location":"ymlconditionstable/","title":"YAML Conditions table","text":""},{"location":"ymlconditionstable/#introduction","title":"Introduction","text":"

    Check conditions to find passed tests listed in a YAML table.

    • Author: Rex
    • Member of scene
    "},{"location":"ymlconditionstable/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"ymlconditionstable/#install-plugin","title":"Install plugin","text":""},{"location":"ymlconditionstable/#load-minify-file","title":"Load minify file","text":"
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexymlconditionstableplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexymlconditionstableplugin.min.js', true);\n
    • Add conditions-table object
      var conditionstable = scene.plugins.get('rexymlconditionstableplugin').add();\n
    "},{"location":"ymlconditionstable/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import ConditionsTablePlugin from 'phaser3-rex-plugins/plugins/ymlconditionstable-plugin.js';\nvar config = {\n// ...\nplugins: {\nglobal: [{\nkey: 'rexConditionsTable',\nplugin: ConditionsTablePlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
    • Add conditions-table object
      var conditionstable = scene.plugins.get('rexConditionsTable').add();\n
    "},{"location":"ymlconditionstable/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Import class
      import ConditionsTable from 'phaser3-rex-plugins/plugins/ymlconditionstable.js';\n
    • Add conditions-table object
      var conditionstable = new ConditionsTable();\n
    "},{"location":"ymlconditionstable/#create-instance","title":"Create instance","text":"
    var table = scene.plugins.get('rexConditionsTable').add();\n
    "},{"location":"ymlconditionstable/#load-table-from-yaml-string","title":"Load table from YAML string","text":"
    table.loadYML(ymlString);\n

    For exameple

    Test1 : (A >= 10) && (A <= 20)\nTest2 : B == 3\n

    Equations will be parsed by expression-parser.

    "},{"location":"ymlconditionstable/#test","title":"Test","text":""},{"location":"ymlconditionstable/#get-test-results","title":"Get test results","text":"
    var results = table.getTestResults(context);\n
    • context : Inputs in Key-value pairs
    • results : {name: boolean}, use OR operation to combine result of tests with the same name.
    "},{"location":"ymlconditionstable/#get-first-pass-test-name","title":"Get first pass test name","text":"
    var testName = table.anyPassTest(context);\n
    • context : Inputs in Key-value pairs
    "},{"location":"youtubeplayer/","title":"Youtube player","text":""},{"location":"youtubeplayer/#introduction","title":"Introduction","text":"

    Play youtube video on iframe.

    • Author: Rex
    • DOM Game object
    "},{"location":"youtubeplayer/#live-demos","title":"Live demos","text":"
    • Youtube player
    "},{"location":"youtubeplayer/#usage","title":"Usage","text":"

    Sample code

    "},{"location":"youtubeplayer/#install-plugin","title":"Install plugin","text":""},{"location":"youtubeplayer/#load-minify-file","title":"Load minify file","text":"
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Load plugin (minify file) in preload stage
      scene.load.plugin('rexyoutubeplayerplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexyoutubeplayerplugin.min.js', true);\n
    • Add youtube player object
      var youtubePlayer = scene.add.rexYoutubePlayer(x, y, width, height, config);\n
    "},{"location":"youtubeplayer/#import-plugin","title":"Import plugin","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Install plugin in configuration of game
      import YoutubePlayerPlugin from 'phaser3-rex-plugins/plugins/youtubeplayer-plugin.js';\nvar config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\nplugins: {\nglobal: [{\nkey: 'rexYoutubePlayer',\nplugin: YoutubePlayerPlugin,\nstart: true\n},\n// ...\n]\n}\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Add youtube player object
      var youtubePlayer = scene.add.rexYoutubePlayer(x, y, width, height, config);\n
    "},{"location":"youtubeplayer/#import-class","title":"Import class","text":"
    • Install rex plugins from npm
      npm i phaser3-rex-plugins\n
    • Enable dom element in configuration of game
      var config = {\nparent: divId,\n// fullscreenTarget: divId, // For fullscreen\ndom: {\ncreateContainer: true\n},\ninput: {\nmouse: {\ntarget: divId\n},\ntouch: {\ntarget: divId\n},\n},\n// ...\n};\nvar game = new Phaser.Game(config);\n
      • Set parent to divId
      • Set dom.createContainer to true.
    • Import class
      import YoutubePlayer from 'phaser3-rex-plugins/plugins/youtubeplayer.js';\n
    • Add youtube player object
      var youtubePlayer = new YoutubePlayer(scene, x, y, width, height, config);\nscene.add.existing(youtubePlayer);\n
    "},{"location":"youtubeplayer/#add-youtube-player-object","title":"Add youtube player object","text":"
    • Youtube player on DOM
      var player = scene.add.rexYoutubePlayer(x, y, width, height, config);\n// var player = scene.add.rexYoutubePlayer(x, y, config);\n// var player = scene.add.rexYoutubePlayer(config);\n

    Default configuration

    {\nx: 0,\ny: 0,\nwidth: undefined,\nheight: undefined,\n\nvideoId: '',\nautoPlay: true,\ncontrols: false,\nkeyboardControl: true,\nmodestBranding: false,\nloop: false,\n}\n
    • x, y : Position
    • width, height : Size of element
    • videoId : The YouTube video ID that identifies the video that the player will load.
    • autoPlay : Automatically start to play when the player loads.
    • controls : Whether the video player controls are displayed.
    • keyboardControl : Set false to disable keyboard controls.
    • modestBranding : Set false to prevent the YouTube logo from displaying in the control bar.
    • loop : Play video when ended.
    "},{"location":"youtubeplayer/#custom-class","title":"Custom class","text":"
    • Define class
      class MyYoutubePlayer extends YoutubePlayer {  // or YoutubePlayerCanvas\nconstructor(scene, x, y, width, height, config) {\nsuper(scene, x, y, width, height, config) {\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {\n//     super.preUpdate(time, delta)\n// }\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var player = new MyYoutubePlayer(scene, x, y, width, height, config);\n
    "},{"location":"youtubeplayer/#load","title":"Load","text":"
    player.load(videoId);\n// player.load(videoId, autoPlay);\n
    "},{"location":"youtubeplayer/#play","title":"Play","text":"
    player.play();\n
    "},{"location":"youtubeplayer/#pause","title":"Pause","text":"
    player.pause();\n
    "},{"location":"youtubeplayer/#playback-time","title":"Playback time","text":"
    • Get
      var playbackTime = player.playbackTime; // time in seconds\n
      var t = player.t; // t: 0~1\n
    • Set
      player.setPlaybackTime(time); // time in seconds\n// player.playbackTime = time;\n
      player.setT(t); // t: 0~1\n// player.t = t;\n
    "},{"location":"youtubeplayer/#duration","title":"Duration","text":"
    var duration = player.duration;  // time in seconds\n
    "},{"location":"youtubeplayer/#volume","title":"Volume","text":"
    • Get
      var volume = player.volume;  // volume: 0~1\n
    • Set
      player.setVolume(volume);  // volume: 0~1\n// player.volume = volume;\n
    "},{"location":"youtubeplayer/#mute","title":"Mute","text":"
    • Get
      var muted = player.muted;  // muted: true/false\n
    • Set
      player.setMute(muted);  // muted: true/false\n// player.muted = muted;\n
    "},{"location":"youtubeplayer/#loop","title":"Loop","text":"
    • Get
      var loop = player.loop;  // loop: true/false\n
    • Set
      player.setLoop(loop);  // loop: true/false\n// player.loop = loop;\n
    "},{"location":"youtubeplayer/#resize","title":"Resize","text":"
    player.resize(width, height);\n
    "},{"location":"youtubeplayer/#status","title":"Status","text":"
    • Is playing
      var isPlaying = player.isPlaying;\n
    • Is paused
      var isPaused = player.isPaused;\n
    • Has end
      var hasEnded = player.hasEnded;\n
    • Video state
      var videoState = player.videoState;\n
      or
      var videoStateString = player.videoStateString;\n
      • -1 : unstarted
      • 0 : ended
      • 1 : playing
      • 2 : paused
      • 3 : buffering
      • 5 : cued
    "},{"location":"youtubeplayer/#events","title":"Events","text":"
    • Youtube player api ready
      player.on('ready', function(player){ }, scope);\n
    • State change
      player.on('statechange', function(player){ }, scope);\n
      • State : player.videoState
    • Unstarted
      player.on('unstarted', function(player){ }, scope);\n
    • Playing
      player.on('playing', function(player){ }, scope);\n
    • Pause
      player.on('pause', function(player){ }, scope);\n
    • Ended
      player.on('ended', function(player){ }, scope);\n
    • Buffering
      player.on('buffering', function(player){ }, scope);\n
    • Video cued
      player.on('cued', function(player){ }, scope);\n
    • Error
      player.on('error', function(player, errorMessage){ }, scope);\n

    No Playback time changed event

    Get playback time every tick might cause playing video lagging.

    "},{"location":"youtubeplayer/#other-properties","title":"Other properties","text":"

    See dom game object, game object

    "},{"location":"youtubeplayer/#interactive-with-other-game-objects","title":"Interactive with other game objects","text":"

    See dom-element's Interactive with other game objects

    "},{"location":"zone/","title":"Zone","text":""},{"location":"zone/#introduction","title":"Introduction","text":"

    Non-rendering rectangular game object for creating drop zones and input hit areas, built-in game object of phaser.

    • Author: Richard Davey
    "},{"location":"zone/#usage","title":"Usage","text":""},{"location":"zone/#add-zone-object","title":"Add zone object","text":"
    var zone = scene.add.zone(x, y, width, height);\n

    Add zone from JSON

    var zone = scene.make.zone({\nx: 0,\ny: 0,\n//width: 1,\n//height: 1,\n// origin: {x: 0.5, y: 0.5},\n});\n
    "},{"location":"zone/#custom-class","title":"Custom class","text":"
    • Define class
      class MyZone extends Phaser.GameObjects.Zone {\nconstructor(scene, x, y, width, height) {\nsuper(scene, x, y, width, height);\n// ...\nscene.add.existing(this);\n}\n// ...\n\n// preUpdate(time, delta) {}\n}\n
      • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
        • If the Game Object renders, it will be added to the Display List.
        • If it has a preUpdate method, it will be added to the Update List.
    • Create instance
      var zone = new MyZone(x, y, width, height);\n
    "},{"location":"zone/#input-hit-zone","title":"Input hit zone","text":"
    zone.setInteractive();\n

    See touch events

    "},{"location":"zone/#drop-zones","title":"Drop zones","text":"
    • Default drop zone
      zone.setDropZone();\n
    • Rectangle drop zone
      zone.setRectangleDropZone(width, height);\n
    • Circular drop zone
      zone.setCircleDropZone(radius);\n
    • Custom drop zone
      zone.setDropZone(shape, callback);\n
      • callback
        function(shape, x, y, gameObject) {\nreturn hit;  // true/false\n}\n

    See drop zone

    "},{"location":"zone/#other-properties","title":"Other properties","text":"

    See game object

    "}]} \ No newline at end of file diff --git a/docs/site/sitemap.xml b/docs/site/sitemap.xml index 7f357f9738..59c4ca85e1 100644 --- a/docs/site/sitemap.xml +++ b/docs/site/sitemap.xml @@ -2,2042 +2,2042 @@ https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/achievements/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/alphamaskimage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/anchor/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/angle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/animation/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/arcade-body/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/arcade-gameobject/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/arcade-tcrp-player/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/arcade-tcrp-recorder/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/arcade-tcrp-step-runner/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/arcade-world/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/array-addremove/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/array-filter/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/array-random/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/array-sort/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/audio/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/awaitloader/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/awaytime/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/base64/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/bbcodetext/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/bitmaptext/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/bitmapzone/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/blendmode/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/blitter/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-bejeweled/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-chessdata/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-fieldofview/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-hexagongrid/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-hexagonmap/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-image/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-match/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-miniboard/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-monopoly/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-moveto/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-overview/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-pathfinder/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-quadgrid/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-shape/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-sprite/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-texture/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board-tilemap/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/board/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/bounds/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/bracketparser/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/bracketparser2/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/buffdata/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/buildarcadeobject/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/bullet/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/button/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/camera-controller/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/camera-effects/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/camera-shader-effect/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/camera/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/canvas-circularprogress/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/canvas-data/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/canvas-lineprogress/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/canvas-roundrectangle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/canvas-texture/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/canvas/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/canvasinput/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/capitalizes-first/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/charactercache/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/circlemaskimage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/clamp/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/clickoutside/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/clock/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/color/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/conditionstable/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/config-data/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/container/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/containerlite-perspective/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/containerlite-skew/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/containerlite/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/create-number-array/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/csvscenario/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/csvtoarray/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/csvtohashtable/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/cursor/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/cursoratbounds/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/curve-spiral/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/cutjigsawimage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/datamanager/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/date/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/device/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/dialog-quest/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/distance/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/domelement/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/drag/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/dragrotate/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/dropdown/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/dynamic-texture/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/dynamicbitmaptext/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/dynamictext/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ease-function/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/easedata/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/easemove/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/effect-properties/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/effectlayer-outline/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/eightdirection/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/eventemitter3/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/eventpromise/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/expression-parser/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/fadeoutdestroy/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/fadevolume/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/filechooser/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/filedropzone/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-auth/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-broadcast/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-files/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-firestore/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-idalias/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-itemtable/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-leaderboard/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-messages/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-onlineuserlist/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-overview/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-singleroom/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-storage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/flash/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/flip/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/format/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/framemanager/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/fsm/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/fullscreen/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/fuzzy/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/game/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gameobject/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gamepad/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gashapon/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/geom-circle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/geom-ellipse/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/geom-hexagon/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/geom-line/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/geom-point/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/geom-polygon/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/geom-rectangle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/geom-rhombus/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/geom-triangle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gesture-overview/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gesture-pan/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gesture-pinch/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gesture-press/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gesture-rotate/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gesture-swipe/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gesture-tap/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/graphics/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gridalign/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gridcutimage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/gridtable/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/group/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/groupactions/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/groupnavigator/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/handlebars/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/hiddeninputtext/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/i18next/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/image/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/imagebox/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/imageuriloader/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/input-to-camera/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/input/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/inputtext/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/interception/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/interpolation/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/intouching/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/keyboardcombo/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/keyboardevents/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/keyshub/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/layer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/layermanager/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/levelcounter/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/lifetime/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/light/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/line/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/list-inputtext/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/live2d/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/loader/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/loading-animation-scene/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/loadingprogress/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/localforage-files/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/localforage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/localstorage-data/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/localstorage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/lokijs/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/luxon/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/lzstring/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/mainloop/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/markedeventsheet/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/mask/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/matterjs-attractor/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/matterjs-gameobject/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/matterjs-world/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/matterjs-wrap/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/mesh/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/modal-promise/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/modal/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/mousewheel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/mousewheelscroller/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/mousewheeltoupdown/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/moveto/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/mustache/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ninepatch/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ninepatch2/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/nineslice/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/orientation/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/pad/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/particles-along-bounds/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/particles/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/path/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/pathfollower/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/percentage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/perlin/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/perspective-card/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/perspective-carousel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/perspective-image/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/perspective-imagecarousel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/perspective-rendertexture/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/perspective-sprite/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/plane/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/plugin-list/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/pluginsystem/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/png-appender/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/point-light/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/polar-coordinate/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/popup/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/postfx-pipeline/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/prefx-pipeline/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/quad-image/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/quad-rendertexture/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/quest/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/random-data-generator/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/random/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/randomplace/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/raycaster/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/realtimetimers/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/rendertexture/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/repeatimage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/restorabledata/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/reverse-string/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/rexvideo/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/rope/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/rotate/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/rotateto/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/round-to/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/runcommands/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/scaledowndestroy/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/scalemanager/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/scaleouter/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/scene/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/scenemanager/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/scripttagloader/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/scroller/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/sequence/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-barrel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-builtin/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-colorreplace/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-crossstitching/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-crt/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-dissolve/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-dropshadow/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-fisheye/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-glowfilter/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-glowfilter2/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-grayscale/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-horrifi/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-hsladjust/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-inverse/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-kawaseblur/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-outline/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-pixelation/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-shockwave/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-split/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-swirl/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-toonify/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-warp-transition/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader-warp/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shader/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shake-position/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-arc/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-checkbox/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-circle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-circularprogress/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-cover/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-curve/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-custom-progress/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-custom-shapes/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-ellipse/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-fullwindowrectangle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-grid/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-isobox/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-isotriangle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-line/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-lineprogress/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-polygon/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-quad/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-rectangle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-roundrectangle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-roundrectangleprogress/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-spinner/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-star/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-toggleswitch/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-triangle/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shape-triangle2/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shatter-image/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/shatter-rendertexture/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ship/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/skew-image/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/skew-rendertexture/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/slider/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/snap/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/snapshot/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/sprite/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/statemanager/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/step/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/structs-list/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/structs-set/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tagplayer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tagtext/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tcrp-player/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tcrp-recoder/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/text/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/textedit/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/textpage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/textplayer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/texttranslation/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/texttruncator/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/texttyping/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/textures/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tiledmapdata/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tilemap/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tilesprite/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/timeline/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/timer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tintrgb/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tools/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/touchevents/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/toucheventstop/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/touchstate/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/transitionimage/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/transitionimagepack/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/tween/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-badgelabel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-basesizer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-buttons/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-chart/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-colorcomponents/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-colorinput/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-colorpicker/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-confirmaction/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-confirmactionbutton/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-confirmdialog/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-dialog/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-dropdownlist/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-expbar/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-fileselectorbutton/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-fixwidthbuttons/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-fixwidthsizer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-folder/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-gridbuttons/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-gridsizer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-gridtable/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-holygrail/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-imageinputlabel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-knob/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-label/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-menu/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-nameinputdialog/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-namevaluelabel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-numberbar/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-overlapsizer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-overview/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-pages/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-perspectivecard/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-scrollablepanel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-scrollbar/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-simpledropdownlist/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-simplelabel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-simpletextbox/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-simpletitlelabel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-sizer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-slider/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-splitpanels/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-style/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-tabpages/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-tabs/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-text-helper/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-textarea/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-textareainput/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-textbox/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-titlelabel/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-toast/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-toastqueue/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-trees/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-tweaker/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/uniqueitemlist/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/uuid/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/vector2/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/video/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/viewport-coordinate/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/virtualjoystick/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/waitevents/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/webfontloader/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/wrap/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/xor/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ymlachievements/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ymlconditionstable/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/youtubeplayer/ - 2024-10-14 + 2024-10-19 daily https://rexrainbow.github.io/phaser3-rex-notes/docs/site/zone/ - 2024-10-14 + 2024-10-19 daily \ No newline at end of file diff --git a/docs/site/sitemap.xml.gz b/docs/site/sitemap.xml.gz index 20cf5c4e3dbe639eae863751f6ddba0065acdb6c..d5d83766a6f17ebca123d79848de6171bc53937d 100644 GIT binary patch delta 847 zcmV-V1F-y$7LOKxABzYG_e>LK0{?SqbY*Q}a4vXlYyjPz-E!l&5ryyfDW-f+d&aw! z+D&=9cX@*30h&OQYzsug4M3Fq^Z`iO<4kT-sX9AVGqxpJ^BoEVx`FwAPeI*tf0x|e#`t0+an$X8ma^3GUi2X? zl-YhA+LJ@n!ui3gJKp)>>7oDn=XaxAR`t)1Umt%PzI`3O{n1`>d+gK8+(L2Y$@ulz zlZ5Nj!>31o4$OxS&i^SfxkdQQE60)%@k4vIeXu84X@jlyo4{wvO1so8UJhZR9{ygLv z+lL6~;Pnra+yy!TACngbAORthI0hacTN(`xv&zy>61t5Xz-6Gu!v2?rzsTod96cLu zjr7lxbp}QOwUfLCl_@J@cH+)UA1=d4W{_uy@BCGoQyXywI1So90@MwWcNL~N=OP8Q z_{fKodIvZGrIWJK@2yy|5lRF7390s}A zcKlk3#*7Ky{wv732pzqb*KoQfji4*_SlD)xrO4)lkv-w zCkfYY4<8YXNeTk^+(( zo@LIoq550hep@Lvc*CTJyy$!u2MI0|bRJ$RlRyKn0q>LW0~sJ)MBpBjlyo53iH31so9PJhZR9{ygLv z+q($p;PrQt+yy!T?~@k>AOS9uI0hacS{e-wv&zy>61t5Xz-6Gu!v2?rzscue96cLu zjr5O`bp}QOrIWk{l_@G?cH+)UA1=d4W{_uyZ~Rr7QyXywI1So90@MwWHx;Hi=OP8Q z_{h7HdIvZGxs$U8xB;7!YzP|+ZvsG%l6xgh*ks8!lamNE0dJGY2yy{|lRF73916ME zcKlk3#*7Ky{wv732pzqb*KoQfji4*